commit 52f44abd1137a50ff605163d49ea850e42160749 Author: ppst Date: Mon Jun 19 08:50:38 2023 +0800 feat: 从自己的gitee转移项目 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a8e9834 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# https://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f8877 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +node_modules +.vscode +dist +package-lock.json + +mock/node_modules +mock/package-lock.json \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e310552 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# layui-admin + +## 目录说明 + +admin (开发目录) + +dist (生成的静态页面) + +## 安装 + +```shell +npm init +``` + +## 运行 + +```shell +npm run start +``` + +## 特点 + +1. rem 自适应布局 + +2. mock 数据模拟 + +3. 界面使用 根据 scss 适配颜色 + +4. 常用界面示例 + +5. excel处理 + +6. gulp 打包 压缩 添加 css 浏览器前缀,js(es6=>es5),热重载,跨域代理等 + +7. 生产,测试,开发灵活配置 + +8. 公用模板 + +9. 合并js,css,html 减少资源请求 \ No newline at end of file diff --git a/admin/pages/chart/ecg.html b/admin/pages/chart/ecg.html new file mode 100644 index 0000000..645003f --- /dev/null +++ b/admin/pages/chart/ecg.html @@ -0,0 +1,37 @@ +@@include('./../../template/common/header.html', { +"title": "心电图", +csslinks:[] +}) + +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "心电图", + subtitle:'' + }) +
+
+
+ + +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/chart/ecg.js'] +}) \ No newline at end of file diff --git a/admin/pages/chart/histogram.html b/admin/pages/chart/histogram.html new file mode 100644 index 0000000..c83fe56 --- /dev/null +++ b/admin/pages/chart/histogram.html @@ -0,0 +1,37 @@ +@@include('./../../template/common/header.html', { +"title": "柱状图", +csslinks:[] +}) + +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "折线图", + subtitle:'' + }) +
+
+
+ + +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/chart/histogram.js'] +}) \ No newline at end of file diff --git a/admin/pages/chart/line.html b/admin/pages/chart/line.html new file mode 100644 index 0000000..ddd7f8e --- /dev/null +++ b/admin/pages/chart/line.html @@ -0,0 +1,37 @@ +@@include('./../../template/common/header.html', { +"title": "折线图", +csslinks:[] +}) + +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "折线图", + subtitle:'' + }) +
+
+
+ + +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/chart/line.js'] +}) \ No newline at end of file diff --git a/admin/pages/chart/wavypolyline.html b/admin/pages/chart/wavypolyline.html new file mode 100644 index 0000000..0db8c1b --- /dev/null +++ b/admin/pages/chart/wavypolyline.html @@ -0,0 +1,37 @@ +@@include('./../../template/common/header.html', { +"title": "波浪折线图", +csslinks:[] +}) + +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "波浪折线图", + subtitle:'' + }) +
+
+
+ + +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/chart/wavypolyline.js'] +}) \ No newline at end of file diff --git a/admin/pages/clipboard/index.html b/admin/pages/clipboard/index.html new file mode 100644 index 0000000..3167f05 --- /dev/null +++ b/admin/pages/clipboard/index.html @@ -0,0 +1,87 @@ +@@include('./../../template/common/header.html', { +"title": "clipboard", +csslinks:['./../../static/css/detail.css'] +}) + +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "clipboard", + subtitle:'' + }) +
+ +
+
constructor-id-node
+
+
+ 复制 +
+
+
+ +
+
constructor-button-nodelist
+
+ + + +
+
+ +
+
constructor-selector
+
+ 复制 +
+
+ +
+
function-target
+
+ +
this is copy text!
+
+
+ +
+
function-text
+
+ +
+
+ + +
+
function-target
+
+

这就是你要复制的内容

+ +
+
+ + +
+
function-target-input
+
+ + +
+
+ + +
+
function-textarea
+
+ + +
+
+ +
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/clipboard/index.js'] +}) \ No newline at end of file diff --git a/admin/pages/detail/index.html b/admin/pages/detail/index.html new file mode 100644 index 0000000..9452d38 --- /dev/null +++ b/admin/pages/detail/index.html @@ -0,0 +1,45 @@ +@@include('./../../template/common/header.html', { +"title": "详情", +csslinks:['./../../static/css/detail.css'] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "详情", + subtitle:'' + }) +
+
+
基本信息
+
    +
  • 任务ID :5cb92069c3492任务名称 :CRM->SCRM[FUL
  • +
  • 读节点 :5cb92069c3492写节点 :CRM->SCRM[FUL
  • +
  • 创建者 :5cb92069c3492创建时间 :CRM->SCRM[FUL
  • +
  • 更新者 :5cb92069c3492更新时间 :CRM->SCRM[FUL
  • +
  • 状态 :5cb92069c3492同步架构 :CRM->SCRM[FUL
  • +
  • 源库类型 :5cb92069c3492目标库类型 :CRM->SCRM[FUL
  • +
  • 源库端口 :5cb92069c3492目标库端口 :CRM->SCRM[FUL
  • +
  • 源库账号 :5cb92069c3492目标库账号 :CRM->SCRM[FUL
  • +
  • 已发送数据位点 :5cb92069c3492已删除数据位点 :CRM->SCRM[FUL
  • +
+
+
+
初始化设置
+

同步方式设置 :结构初始化 + 全量数据初始化+增量数据

+
+
+
映射关系
+
+
+
+
+
+
+ + +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/detail/index.js'] +}) \ No newline at end of file diff --git a/admin/pages/dialog/index.html b/admin/pages/dialog/index.html new file mode 100644 index 0000000..594493f --- /dev/null +++ b/admin/pages/dialog/index.html @@ -0,0 +1,79 @@ +@@include('./../../template/common/header.html', { +"title": "dialog", +csslinks:['./../../static/css/detail.css'] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "dialog", + subtitle:'' + }) +
+ +
+
iframe dialog
+
+ 打开 +
+
+ +
+
show OK dialog
+
+ 打开 +
+
+ + +
+
生成二维码 dialog
+
+ 打开 +
+
+ +
+
form add dialog
+
+ 打开 +
+
+ +
+
form edit dialog
+
+ 打开 +
+
+ + + +
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/dialog/index.js'] +}) \ No newline at end of file diff --git a/admin/pages/edittable/index.html b/admin/pages/edittable/index.html new file mode 100644 index 0000000..790b117 --- /dev/null +++ b/admin/pages/edittable/index.html @@ -0,0 +1,28 @@ +@@include('./../../template/common/header.html', { +"title": "edittable", +csslinks:['./../../static/css/edittable.css'] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "edittable", + subtitle:'' + }) +
+
+
+ 新增 +
+
+
+
+
+
+
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/edittable/index.js'] +}) \ No newline at end of file diff --git a/admin/pages/excel/export.html b/admin/pages/excel/export.html new file mode 100644 index 0000000..cf2c02c --- /dev/null +++ b/admin/pages/excel/export.html @@ -0,0 +1,23 @@ +@@include('./../../template/common/header.html', { +"title": "excel 导出", +csslinks:[] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "excel 导出", + subtitle:'' + }) +
+
+ 导出 +
+
+
+
+
+
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/excel/export.js'] +}) \ No newline at end of file diff --git a/admin/pages/excel/upload.html b/admin/pages/excel/upload.html new file mode 100644 index 0000000..c852f9a --- /dev/null +++ b/admin/pages/excel/upload.html @@ -0,0 +1,26 @@ +@@include('./../../template/common/header.html', { +"title": "excel 导入", +csslinks:['./../../static/css/excel.css'] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "excel 导入", + subtitle:'' + }) +
+
+
+ + +
+
+
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/excel/upload.js'] +}) \ No newline at end of file diff --git a/admin/pages/form/date.html b/admin/pages/form/date.html new file mode 100644 index 0000000..2d5b2ad --- /dev/null +++ b/admin/pages/form/date.html @@ -0,0 +1,48 @@ +@@include('./../../template/common/header.html', { +"title": "date 导入", +csslinks:[] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "date页面", + subtitle:'' + }) +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": [] +}) \ No newline at end of file diff --git a/admin/pages/form/index.html b/admin/pages/form/index.html new file mode 100644 index 0000000..e98c352 --- /dev/null +++ b/admin/pages/form/index.html @@ -0,0 +1,264 @@ +@@include('./../../template/common/header.html', { +"title": "demo", +csslinks:['./../../static/layui/layui/css/modules/laydate/default/laydate.css'] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "table页面", + subtitle:'' + }) +
+
+
+ + + + +
+ + +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
请填写6到12位密码
+
+ +
+
+ +
+ +
+
-
+
+ +
+
+
+ +
+ +
+ +
+
+ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+
此处只是演示联动排版,并未做联动交互
+
+ +
+ +
+ + + +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ + +
+
+
+ +
+
+
+ +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/form/index.js'] +}) \ No newline at end of file diff --git a/admin/pages/index.html b/admin/pages/index.html new file mode 100644 index 0000000..54cbe55 --- /dev/null +++ b/admin/pages/index.html @@ -0,0 +1,124 @@ + + + + + + admin + + + + + + + + + + +
+
+
+
+
+ +
+
+ + +
+
+
+
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/admin/pages/step/index.html b/admin/pages/step/index.html new file mode 100644 index 0000000..54c034f --- /dev/null +++ b/admin/pages/step/index.html @@ -0,0 +1,189 @@ +@@include('./../../template/common/header.html', { +"title": "demo", +csslinks:['./../../static/css/step.css'] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "demo", + subtitle:'' + }) +
+
+ + +
+
+
    +
  • 1. 源及目标
  • +
  • 2. 选择对象
  • +
  • 3. 方式设置
  • +
  • 4. 完成
  • +
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ + + 测试链接 +
+
+
+ + +
+
+
+ + + + + + +
+
+
+ + + + + + @@include('./../../template/common/footer.html', { + "jslinks": ['./../../static/js/step/index.js'] + }) \ No newline at end of file diff --git a/admin/pages/tab/index.html b/admin/pages/tab/index.html new file mode 100644 index 0000000..f487455 --- /dev/null +++ b/admin/pages/tab/index.html @@ -0,0 +1,28 @@ +@@include('./../../template/common/header.html', { +"title": "tab页面", +csslinks:[] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "tab页面", + subtitle:'' + }) +
+
+ +
+
    +
  • TAB1
  • +
  • TAB2
  • +
+
+
内容不一样是要有,因为你可以监听tab事件(阅读下文档就是了)
+
内容2
+
+
+
+
+
+@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/tab/index.js'] +}) \ No newline at end of file diff --git a/admin/pages/table/index.html b/admin/pages/table/index.html new file mode 100644 index 0000000..e62120f --- /dev/null +++ b/admin/pages/table/index.html @@ -0,0 +1,99 @@ +@@include('./../../template/common/header.html', { +"title": "table", +csslinks:[] +}) +
+ @@include('./../../template/common/breadcrumb.html', { + "title": "table页面", + subtitle:'' + }) +
+
+
+ + + + +
+ + +
+
+
+
+
+ 创建 + 全屏 + 整页全屏 +
+
+
+
+
+
+
+
+@@include('./../../template/common/celloperating.html') + +@@include('./../../template/common/footer.html', { +"jslinks": ['./../../static/js/table/index.js'] +}) \ No newline at end of file diff --git a/admin/res/js/api.js b/admin/res/js/api.js new file mode 100644 index 0000000..bcd95eb --- /dev/null +++ b/admin/res/js/api.js @@ -0,0 +1,24 @@ +layui.define(function (exports) { + // 根据环境获取请求地址 + var host = window.location.host; + var mockUrl = "/api/"; + var bossUrl = ''; + if (host.indexOf('127.0.0.1') > -1 || host.indexOf('localhost') > -1 || host.indexOf('192.168.') > -1) {// 本地环境 + bossUrl = 'https://127.0.0.1/'; + } else if (host.indexOf('-dev') > -1) {// 开发环境 + bossUrl = 'https://admin-de.ppst.top/'; + } else if (host.indexOf('-te') > -1) {// 测试环境 + bossUrl = 'https://admin-te.ppst.top/'; + } else {// 生产环境 + bossUrl = 'https://admin.ppst.top/'; + } + exports('api', { + getApiUrl: function (mapping, funcName) { + return bossUrl + mapping + '/' + funcName; + }, + getMockApiUrl: function (mapping, funcName) { + return mockUrl + mapping + '/' + funcName; + } + }); + +}); \ No newline at end of file diff --git a/admin/res/js/chart.js b/admin/res/js/chart.js new file mode 100644 index 0000000..8366e80 --- /dev/null +++ b/admin/res/js/chart.js @@ -0,0 +1,59 @@ +/** + 定义layui模块 - 模板引擎 - 自定义模板 + */ +layui.define(['index', 'laytpl', 'form'], function (exports) { + + exports("chart", { + getUserInfo: "boss/pages/userInfo/index.html", + xAxis: { + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + yAxis: { + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + textStyle: { + color: "#a5aaaf", + }, + series: { + itemStyle: { + normal: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: "#1289ff", + }, + { + offset: 1, + color: "#1289ff4d", + }, + ]), + }, + }, + }, + }); +}); + diff --git a/admin/res/js/config.js b/admin/res/js/config.js new file mode 100644 index 0000000..af2d2f2 --- /dev/null +++ b/admin/res/js/config.js @@ -0,0 +1,55 @@ +layui.define(['laytpl', 'layer', 'element', 'util'], function (exports) { + exports('setter', { + container: 'LAY_app', //容器ID + + base: layui.cache.base,//记录静态资源所在路径 + + views: layui.cache.base + 'tpl/',//动态模板所在目录 + + entry: 'index',//默认视图文件名 + + engine: '.html',//视图文件后缀名 + + pageTabs: true, //是否开启页面选项卡功能。iframe版推荐开启 + + name: 'layuiAdmin', + tableName: 'layuiAdmin',//本地存储表名 + + MOD_NAME: 'admin',//模块事件名 + + debug: true, //是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息 + + //自定义请求字段 + + request: { + // tokenName: '_openx_head' //自动携带 token 的字段名(如:access_token)。可设置 false 不携带。 + }, + + //自定义响应字段 + response: { + statusName: 'code', //数据状态的字段名称 + + statusCode: { + code: 1,//数据状态一切正常的状态码 + + logout: 1001 //登录状态失效的状态码 + }, + msgName: 'msg', //状态信息的字段名称 + + dataName: 'data' //数据详情的字段名称 + }, + + //扩展的第三方模块 + + extend: [ + 'echarts', //echarts 核心包 + 'echartsTheme' //echarts 主题 + ], theme: { + color: [{ + main: '#20222A', + selected: '#009688', + alias: 'default' + }] + } + }); +}); \ No newline at end of file diff --git a/admin/res/js/dialog.js b/admin/res/js/dialog.js new file mode 100644 index 0000000..cc49d76 --- /dev/null +++ b/admin/res/js/dialog.js @@ -0,0 +1,96 @@ +/** + 定义弹窗模块 - 自定义弹窗 + */ +layui.define(['index', 'tpl', 'qrcode'], function (exports) { + + exports("dialog", { + setIframeDialog: function ( + title = "", + data = { src: "", otherconfigStyle: "" }, + iframeArea = { width: "820px", height: "500px" }, + dialogArea = ["600px", "500px"] + ) { + var laytpl = layui.laytpl; + var templet = + " '; + laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: title, + content: templet, + area: dialogArea, + success: function () { }, + error: function (e) { + console.warn("setIframeDialog error:", e); + }, + }); + }); + }, + setTextDialog: function ( + title = "", + data = { text: "" }, + dialogArea = ["600px", "500px"] + ) { + var laytpl = layui.laytpl; + var templet = data.text; + laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: title, + content: templet, + area: dialogArea, + success: function () { }, + }); + }); + }, + showOkMsgDialog({ msg, title = "提示", btnTitle = "好的", dialogArea = ["520px", "270px"] }) { + layer.confirm("", + { + title: title, + area: dialogArea, + content: `
${msg}
`, + btnAlign: 'r', + skin: "msg-skin", + btn: [btnTitle] + }, function (index, layero) { + layer.close(index); + } + ); + }, + setQrCodeDialog({ id = "qrcode", title = "", data = { value: "" }, showQrcodeUrl = false, qrcodeArea = { + width: 400, + height: 400 + }, dialogArea = ["700px", "500px"] }) { + + var laytpl = layui.laytpl; + var qrcode = layui.qrcode; + var templet = '
'; + if (showQrcodeUrl) { + templet += '
'; + } + laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: title, + content: templet, + area: dialogArea, + success: function success() { + qrcode.qrcode(document.getElementById(id), qrcodeArea); + qrcode.makeCode(data.value); + if (showQrcodeUrl) { + layui.$('.show-qrcode-value').html(layui.$('.qrcode').attr('title')); + } + } + }); + }); + } + }); +}); diff --git a/admin/res/js/dynamicTr.js b/admin/res/js/dynamicTr.js new file mode 100644 index 0000000..f0fc299 --- /dev/null +++ b/admin/res/js/dynamicTr.js @@ -0,0 +1,105 @@ +layui.define(['index', 'api'], function (exports) { + var $ = layui.$, admin = layui.admin; + var obj = { + addTr: function (listTableCols) { + var html = ``; + for (var key in listTableCols) { + if (listTableCols.hasOwnProperty(key)) { + var element = listTableCols[key]; + if (element.toolbar) { + html += ` +
+ + +
`; + } else { + if (element.hide) { + html += ``; + } else { + html += ` +
+ +
+ `; + } + } + } + } + return html; + }, + addFormFiled: function (listTableCols) { + var addField = {}; + for (const key in listTableCols) { + if (listTableCols.hasOwnProperty(key)) { + const element = listTableCols[key]; + + if (!element.toolbar) { + if (element.hide) { + } else { + var id = $(`.layui-table .add-${element.field} .${element.field}`); + if (!$(id).val()) { + showToolTips($(id)); + return false + } + addField[element.field] = $(id).val(); + } + } + } + } + return addField; + }, + editTr: function (listTableCols, data) { + var html = ``; + for (var key in listTableCols) { + if (listTableCols.hasOwnProperty(key)) { + var element = listTableCols[key]; + if (element.toolbar) { + html += ` +
+ + +
`; + } else { + if (element.hide) { + html += ` + + `; + } else { + html += ` +
+ +
+ `; + } + } + } + } + return html; + }, + editFormFiled: function (listTableCols, data) { + var editField = {}; + var id = data.id; + for (var key in listTableCols) { + if (listTableCols.hasOwnProperty(key)) { + var element = listTableCols[key]; + + if (!element.toolbar) { + if (element.hide) { + editField[element.field] = data[element.field]; + } else { + var id = $(`.layui-table .edit-${element.field} .${element.field}`); + if (!$(id).val()) { + showToolTips($(id)); + return false + } + editField[element.field] = $(id).val(); + } + + } + } + } + return editField; + } + } + exports('dynamicTr', obj); +}); \ No newline at end of file diff --git a/admin/res/js/lib/admin.js b/admin/res/js/lib/admin.js new file mode 100644 index 0000000..8ab78cc --- /dev/null +++ b/admin/res/js/lib/admin.js @@ -0,0 +1,836 @@ +/** + + @Name:layuiAdmin iframe版核心模块 + @Author:贤心 + @Site:http://www.layui.com/admin/ + @License:LPPL + + */ + +layui.define('view', function(exports){ + var $ = layui.jquery + ,laytpl = layui.laytpl + ,element = layui.element + ,setter = layui.setter + ,view = layui.view + ,device = layui.device() + + ,$win = $(window), $body = $('body') + ,container = $('#'+ setter.container) + + ,SHOW = 'layui-show', HIDE = 'layui-hide', THIS = 'layui-this', DISABLED = 'layui-disabled', TEMP = 'template' + ,APP_BODY = '#LAY_app_body', APP_FLEXIBLE = 'LAY_app_flexible' + ,FILTER_TAB_TBAS = 'layadmin-layout-tabs' + ,APP_SPREAD_SM = 'layadmin-side-spread-sm', TABS_BODY = 'layadmin-tabsbody-item' + ,ICON_SHRINK = 'layui-icon-shrink-right', ICON_SPREAD = 'layui-icon-spread-left' + ,SIDE_SHRINK = 'layadmin-side-shrink', SIDE_MENU = 'LAY-system-side-menu' + + //通用方法 + ,admin = { + v: '1.2.1 std' + + //数据的异步请求 + ,req: view.req + + //清除本地 token,并跳转到登入页 + ,exit: view.exit + + //xss 转义 + ,escape: function(html){ + return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&') + .replace(//g, '>') + .replace(/'/g, ''').replace(/"/g, '"'); + } + + //事件监听 + ,on: function(events, callback){ + return layui.onevent.call(this, setter.MOD_NAME, events, callback); + } + + //发送验证码 + ,sendAuthCode: function(options){ + options = $.extend({ + seconds: 60 + ,elemPhone: '#LAY_phone' + ,elemVercode: '#LAY_vercode' + }, options); + + var seconds = options.seconds + ,btn = $(options.elem) + ,token = null + ,timer, countDown = function(loop){ + seconds--; + if(seconds < 0){ + btn.removeClass(DISABLED).html('获取验证码'); + seconds = options.seconds; + clearInterval(timer); + } else { + btn.addClass(DISABLED).html(seconds + '秒后重获'); + } + + if(!loop){ + timer = setInterval(function(){ + countDown(true); + }, 1000); + } + }; + + options.elemPhone = $(options.elemPhone); + options.elemVercode = $(options.elemVercode); + + btn.on('click', function(){ + var elemPhone = options.elemPhone + ,value = elemPhone.val(); + + if(seconds !== options.seconds || $(this).hasClass(DISABLED)) return; + + if(!/^1\d{10}$/.test(value)){ + elemPhone.focus(); + return layer.msg('请输入正确的手机号') + }; + + if(typeof options.ajax === 'object'){ + var success = options.ajax.success; + delete options.ajax.success; + } + + admin.req($.extend(true, { + url: '/auth/code' + ,type: 'get' + ,data: { + phone: value + } + ,success: function(res){ + layer.msg('验证码已发送至你的手机,请注意查收', { + icon: 1 + ,shade: 0 + }); + options.elemVercode.focus(); + countDown(); + success && success(res); + } + }, options.ajax)); + }); + } + + //屏幕类型 + ,screen: function(){ + var width = $win.width() + if(width > 1200){ + return 3; //大屏幕 + } else if(width > 992){ + return 2; //中屏幕 + } else if(width > 768){ + return 1; //小屏幕 + } else { + return 0; //超小屏幕 + } + } + + //侧边伸缩 + ,sideFlexible: function(status){ + var app = container + ,iconElem = $('#'+ APP_FLEXIBLE) + ,screen = admin.screen(); + + //设置状态,PC:默认展开、移动:默认收缩 + if(status === 'spread'){ + //切换到展开状态的 icon,箭头:← + iconElem.removeClass(ICON_SPREAD).addClass(ICON_SHRINK); + + //移动:从左到右位移;PC:清除多余选择器恢复默认 + if(screen < 2){ + app.addClass(APP_SPREAD_SM); + } else { + app.removeClass(APP_SPREAD_SM); + } + + app.removeClass(SIDE_SHRINK) + } else { + //切换到搜索状态的 icon,箭头:→ + iconElem.removeClass(ICON_SHRINK).addClass(ICON_SPREAD); + + //移动:清除多余选择器恢复默认;PC:从右往左收缩 + if(screen < 2){ + app.removeClass(SIDE_SHRINK); + } else { + app.addClass(SIDE_SHRINK); + } + + app.removeClass(APP_SPREAD_SM) + } + + layui.event.call(this, setter.MOD_NAME, 'side({*})', { + status: status + }); + } + + //弹出面板 + ,popup: view.popup + + //右侧面板 + ,popupRight: function(options){ + //layer.close(admin.popup.index); + return admin.popup.index = layer.open($.extend({ + type: 1 + ,id: 'LAY_adminPopupR' + ,anim: -1 + ,title: false + ,closeBtn: false + ,offset: 'r' + ,shade: 0.1 + ,shadeClose: true + ,skin: 'layui-anim layui-anim-rl layui-layer-adminRight' + ,area: '300px' + }, options)); + } + + //主题设置 + ,theme: function(options){ + var theme = setter.theme + ,local = layui.data(setter.tableName) + ,id = 'LAY_layadmin_theme' + ,style = document.createElement('style') + ,styleText = laytpl([ + //主题色 + '.layui-side-menu,' + ,'.layadmin-pagetabs .layui-tab-title li:after,' + ,'.layadmin-pagetabs .layui-tab-title li.layui-this:after,' + ,'.layui-layer-admin .layui-layer-title,' + ,'.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child' + ,'{background-color:{{d.color.main}} !important;}' + + //选中色 + ,'.layui-nav-tree .layui-this,' + ,'.layui-nav-tree .layui-this>a,' + ,'.layui-nav-tree .layui-nav-child dd.layui-this,' + ,'.layui-nav-tree .layui-nav-child dd.layui-this a' + ,'{background-color:{{d.color.selected}} !important;}' + + //logo + ,'.layui-layout-admin .layui-logo{background-color:{{d.color.logo || d.color.main}} !important;}' + + //头部色 + ,'{{# if(d.color.header){ }}' + ,'.layui-layout-admin .layui-header{background-color:{{ d.color.header }};}' + ,'.layui-layout-admin .layui-header a,' + ,'.layui-layout-admin .layui-header a cite{color: #f8f8f8;}' + ,'.layui-layout-admin .layui-header a:hover{color: #fff;}' + ,'.layui-layout-admin .layui-header .layui-nav .layui-nav-more{border-top-color: #fbfbfb;}' + ,'.layui-layout-admin .layui-header .layui-nav .layui-nav-mored{border-color: transparent; border-bottom-color: #fbfbfb;}' + ,'.layui-layout-admin .layui-header .layui-nav .layui-this:after, .layui-layout-admin .layui-header .layui-nav-bar{background-color: #fff; background-color: rgba(255,255,255,.5);}' + ,'.layadmin-pagetabs .layui-tab-title li:after{display: none;}' + ,'{{# } }}' + ].join('')).render(options = $.extend({}, local.theme, options)) + ,styleElem = document.getElementById(id); + + //添加主题样式 + if('styleSheet' in style){ + style.setAttribute('type', 'text/css'); + style.styleSheet.cssText = styleText; + } else { + style.innerHTML = styleText; + } + style.id = id; + + styleElem && $body[0].removeChild(styleElem); + $body[0].appendChild(style); + $body.attr('layadmin-themealias', options.color.alias); + + //本地存储记录 + local.theme = local.theme || {}; + layui.each(options, function(key, value){ + local.theme[key] = value; + }); + layui.data(setter.tableName, { + key: 'theme' + ,value: local.theme + }); + } + + //初始化主题 + ,initTheme: function(index){ + var theme = setter.theme; + index = index || 0; + if(theme.color[index]){ + theme.color[index].index = index; + admin.theme({ + color: theme.color[index] + }); + } + } + + //记录最近一次点击的页面标签数据 + ,tabsPage: {} + + //获取页面标签主体元素 + ,tabsBody: function(index){ + return $(APP_BODY).find('.'+ TABS_BODY).eq(index || 0); + } + + //切换页面标签主体 + ,tabsBodyChange: function(index, options){ + options = options || {}; + + admin.tabsBody(index).addClass(SHOW).siblings().removeClass(SHOW); + events.rollPage('auto', index); + + //执行 {setter.MOD_NAME}.tabsPage 下的事件 + layui.event.call(this, setter.MOD_NAME, 'tabsPage({*})', { + url: options.url + ,text: options.text + }); + } + + //resize事件管理 + ,resize: function(fn){ + var router = layui.router() + ,key = router.path.join('-'); + + if(admin.resizeFn[key]){ + $win.off('resize', admin.resizeFn[key]); + delete admin.resizeFn[key]; + } + + if(fn === 'off') return; //如果是清除 resize 事件,则终止往下执行 + + fn(), admin.resizeFn[key] = fn; + $win.on('resize', admin.resizeFn[key]); + } + ,resizeFn: {} + ,runResize: function(){ + var router = layui.router() + ,key = router.path.join('-'); + admin.resizeFn[key] && admin.resizeFn[key](); + } + ,delResize: function(){ + this.resize('off'); + } + + //关闭当前 pageTabs + ,closeThisTabs: function(){ + if(!admin.tabsPage.index) return; + $(TABS_HEADER).eq(admin.tabsPage.index).find('.layui-tab-close').trigger('click'); + } + + //全屏 + ,fullScreen: function(){ + var ele = document.documentElement + ,reqFullScreen = ele.requestFullScreen || ele.webkitRequestFullScreen + || ele.mozRequestFullScreen || ele.msRequestFullscreen; + if(typeof reqFullScreen !== 'undefined' && reqFullScreen) { + reqFullScreen.call(ele); + }; + } + + //退出全屏 + ,exitScreen: function(){ + var ele = document.documentElement + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + } + + //…… + }; + + //事件 + var events = admin.events = { + //伸缩 + flexible: function(othis){ + var iconElem = othis.find('#'+ APP_FLEXIBLE) + ,isSpread = iconElem.hasClass(ICON_SPREAD); + admin.sideFlexible(isSpread ? 'spread' : null); + } + + //刷新 + ,refresh: function(){ + var ELEM_IFRAME = '.layadmin-iframe' + ,length = $('.'+ TABS_BODY).length; + + if(admin.tabsPage.index >= length){ + admin.tabsPage.index = length - 1; + } + + var iframe = admin.tabsBody(admin.tabsPage.index).find(ELEM_IFRAME); + iframe[0].contentWindow.location.reload(true); + } + + //输入框搜索 + ,serach: function(othis){ + othis.off('keypress').on('keypress',function(e){ + if(!this.value.replace(/\s/g, '')) return; + //回车跳转 + if(e.keyCode === 13){ + var href = othis.attr('lay-action') + ,text = othis.attr('lay-text') || '搜索'; + + href = href + this.value; + text = text + ' '+ admin.escape(this.value) +''; + + //打开标签页 + layui.index.openTabsPage(href, text); + + //如果搜索关键词已经打开,则刷新页面即可 + events.serach.keys || (events.serach.keys = {}); + events.serach.keys[admin.tabsPage.index] = this.value; + if(this.value === events.serach.keys[admin.tabsPage.index]){ + events.refresh(othis); + } + + //清空输入框 + this.value = ''; + } + }); + } + + //点击消息 + ,message: function(othis){ + othis.find('.layui-badge-dot').remove(); + } + + //弹出主题面板 + ,theme: function(){ + admin.popupRight({ + id: 'LAY_adminPopupTheme' + ,success: function(){ + view(this.id).render('system/theme') + } + }); + } + + //便签 + ,note: function(othis){ + var mobile = admin.screen() < 2 + ,note = layui.data(setter.tableName).note; + + events.note.index = admin.popup({ + title: '便签' + ,shade: 0 + ,offset: [ + '41px' + ,(mobile ? null : (othis.offset().left - 250) + 'px') + ] + ,anim: -1 + ,id: 'LAY_adminNote' + ,skin: 'layadmin-note layui-anim layui-anim-upbit' + ,content: '' + ,resize: false + ,success: function(layero, index){ + var textarea = layero.find('textarea') + ,value = note === undefined ? '便签中的内容会存储在本地,这样即便你关掉了浏览器,在下次打开时,依然会读取到上一次的记录。是个非常小巧实用的本地备忘录' : note; + + textarea.val(value).focus().on('keyup', function(){ + layui.data(setter.tableName, { + key: 'note' + ,value: this.value + }); + }); + } + }) + } + + //全屏 + ,fullscreen: function(othis){ + var SCREEN_FULL = 'layui-icon-screen-full' + ,SCREEN_REST = 'layui-icon-screen-restore' + ,iconElem = othis.children("i"); + + if(iconElem.hasClass(SCREEN_FULL)){ + admin.fullScreen(); + iconElem.addClass(SCREEN_REST).removeClass(SCREEN_FULL); + } else { + admin.exitScreen(); + iconElem.addClass(SCREEN_FULL).removeClass(SCREEN_REST); + } + } + + //弹出关于面板 + ,about: function(){ + admin.popupRight({ + id: 'LAY_adminPopupAbout' + ,success: function(){ + view(this.id).render('system/about'); + } + }); + } + + //弹出更多面板 + ,more: function(){ + admin.popupRight({ + id: 'LAY_adminPopupMore' + ,success: function(){ + view(this.id).render('system/more'); + } + }); + } + + //返回上一页 + ,back: function(){ + history.back(); + } + + //主题设置 + ,setTheme: function(othis){ + var index = othis.data('index') + ,nextIndex = othis.siblings('.layui-this').data('index'); + + if(othis.hasClass(THIS)) return; + + othis.addClass(THIS).siblings('.layui-this').removeClass(THIS); + admin.initTheme(index); + } + + //左右滚动页面标签 + ,rollPage: function(type, index){ + var tabsHeader = $('#LAY_app_tabsheader') + ,liItem = tabsHeader.children('li') + ,scrollWidth = tabsHeader.prop('scrollWidth') + ,outerWidth = tabsHeader.outerWidth() + ,tabsLeft = parseFloat(tabsHeader.css('left')); + + //右左往右 + if(type === 'left'){ + if(!tabsLeft && tabsLeft <=0) return; + + //当前的left减去可视宽度,用于与上一轮的页标比较 + var prefLeft = -tabsLeft - outerWidth; + + liItem.each(function(index, item){ + var li = $(item) + ,left = li.position().left; + + if(left >= prefLeft){ + tabsHeader.css('left', -left); + return false; + } + }); + } else if(type === 'auto'){ //自动滚动 + (function(){ + var thisLi = liItem.eq(index), thisLeft; + + if(!thisLi[0]) return; + thisLeft = thisLi.position().left; + + //当目标标签在可视区域左侧时 + if(thisLeft < -tabsLeft){ + return tabsHeader.css('left', -thisLeft); + } + + //当目标标签在可视区域右侧时 + if(thisLeft + thisLi.outerWidth() >= outerWidth - tabsLeft){ + var subLeft = thisLeft + thisLi.outerWidth() - (outerWidth - tabsLeft); + liItem.each(function(i, item){ + var li = $(item) + ,left = li.position().left; + + //从当前可视区域的最左第二个节点遍历,如果减去最左节点的差 > 目标在右侧不可见的宽度,则将该节点放置可视区域最左 + if(left + tabsLeft > 0){ + if(left - tabsLeft > subLeft){ + tabsHeader.css('left', -left); + return false; + } + } + }); + } + }()); + } else { + //默认向左滚动 + liItem.each(function(i, item){ + var li = $(item) + ,left = li.position().left; + + if(left + li.outerWidth() >= outerWidth - tabsLeft){ + tabsHeader.css('left', -left); + return false; + } + }); + } + } + + //向右滚动页面标签 + ,leftPage: function(){ + events.rollPage('left'); + } + + //向左滚动页面标签 + ,rightPage: function(){ + events.rollPage(); + } + + //关闭当前标签页 + ,closeThisTabs: function(){ + var topAdmin = parent === self ? admin : parent.layui.admin; + topAdmin.closeThisTabs(); + } + + //关闭其它标签页 + ,closeOtherTabs: function(type){ + var TABS_REMOVE = 'LAY-system-pagetabs-remove'; + if(type === 'all'){ + $(TABS_HEADER+ ':gt(0)').remove(); + $(APP_BODY).find('.'+ TABS_BODY+ ':gt(0)').remove(); + + $(TABS_HEADER).eq(0).trigger('click'); + } else { + $(TABS_HEADER).each(function(index, item){ + if(index && index != admin.tabsPage.index){ + $(item).addClass(TABS_REMOVE); + admin.tabsBody(index).addClass(TABS_REMOVE); + } + }); + $('.'+ TABS_REMOVE).remove(); + } + } + + //关闭全部标签页 + ,closeAllTabs: function(){ + events.closeOtherTabs('all'); + //location.hash = ''; + } + + //遮罩 + ,shade: function(){ + admin.sideFlexible(); + } + + //呼出IM 示例 + ,im: function(){ + admin.popup({ + id: 'LAY-popup-layim-demo' //定义唯一ID,防止重复弹出 + ,shade: 0 + ,area: ['800px', '300px'] + ,title: '面板外的操作示例' + ,offset: 'lb' + ,success: function(){ + //将 views 目录下的某视图文件内容渲染给该面板 + layui.view(this.id).render('layim/demo').then(function(){ + layui.use('im'); + }); + } + }) + } + }; + + //初始 + !function(){ + //主题初始化,本地主题记录优先,其次为 initColorIndex + var local = layui.data(setter.tableName); + if(local.theme){ + admin.theme(local.theme); + } else if(setter.theme){ + admin.initTheme(setter.theme.initColorIndex); + } + + //常规版默认开启多标签页 + if(!('pageTabs' in layui.setter)) layui.setter.pageTabs = true; + + //不开启页面标签时 + if(!setter.pageTabs){ + $('#LAY_app_tabs').addClass(HIDE); + container.addClass('layadmin-tabspage-none'); + } + + //低版本IE提示 + if(device.ie && device.ie < 10){ + view.error('IE'+ device.ie + '下访问可能不佳,推荐使用:Chrome / Firefox / Edge 等高级浏览器', { + offset: 'auto' + ,id: 'LAY_errorIE' + }); + } + + }(); + + //admin.prevRouter = {}; //上一个路由 + + //监听 tab 组件切换,同步 index + element.on('tab('+ FILTER_TAB_TBAS +')', function(data){ + admin.tabsPage.index = data.index; + }); + + //监听选项卡切换,改变菜单状态 + admin.on('tabsPage(setMenustatus)', function(router){ + var pathURL = router.url, getData = function(item){ + return { + list: item.children('.layui-nav-child') + ,a: item.children('*[lay-href]') + } + } + ,sideMenu = $('#'+ SIDE_MENU) + ,SIDE_NAV_ITEMD = 'layui-nav-itemed' + + //捕获对应菜单 + ,matchMenu = function(list){ + list.each(function(index1, item1){ + var othis1 = $(item1) + ,data1 = getData(othis1) + ,listChildren1 = data1.list.children('dd') + ,matched1 = pathURL === data1.a.attr('lay-href'); + + listChildren1.each(function(index2, item2){ + var othis2 = $(item2) + ,data2 = getData(othis2) + ,listChildren2 = data2.list.children('dd') + ,matched2 = pathURL === data2.a.attr('lay-href'); + + listChildren2.each(function(index3, item3){ + var othis3 = $(item3) + ,data3 = getData(othis3) + ,matched3 = pathURL === data3.a.attr('lay-href'); + + if(matched3){ + var selected = data3.list[0] ? SIDE_NAV_ITEMD : THIS; + othis3.addClass(selected).siblings().removeClass(selected); //标记选择器 + return false; + } + + }); + + if(matched2){ + var selected = data2.list[0] ? SIDE_NAV_ITEMD : THIS; + othis2.addClass(selected).siblings().removeClass(selected); //标记选择器 + return false + } + + }); + + if(matched1){ + var selected = data1.list[0] ? SIDE_NAV_ITEMD : THIS; + othis1.addClass(selected).siblings().removeClass(selected); //标记选择器 + return false; + } + + }); + } + + //重置状态 + sideMenu.find('.'+ THIS).removeClass(THIS); + + //移动端点击菜单时自动收缩 + if(admin.screen() < 2) admin.sideFlexible(); + + //开始捕获 + matchMenu(sideMenu.children('li')); + }); + + //监听侧边导航点击事件 + element.on('nav(layadmin-system-side-menu)', function(elem){ + if(elem.siblings('.layui-nav-child')[0] && container.hasClass(SIDE_SHRINK)){ + admin.sideFlexible('spread'); + layer.close(elem.data('index')); + }; + admin.tabsPage.type = 'nav'; + }); + + //监听选项卡的更多操作 + element.on('nav(layadmin-pagetabs-nav)', function(elem){ + var dd = elem.parent(); + dd.removeClass(THIS); + dd.parent().removeClass(SHOW); + }); + + //同步路由 + var setThisRouter = function(othis){ + var layid = othis.attr('lay-id') + ,attr = othis.attr('lay-attr') + ,index = othis.index(); + + admin.tabsBodyChange(index, { + url: attr + }); + //location.hash = layid === setter.entry ? '/' : attr; + } + ,TABS_HEADER = '#LAY_app_tabsheader>li'; + + //标签页标题点击 + $body.on('click', TABS_HEADER, function(){ + var othis = $(this) + ,index = othis.index(); + + admin.tabsPage.type = 'tab'; + admin.tabsPage.index = index; + + setThisRouter(othis); + }); + + //监听 tabspage 删除 + element.on('tabDelete('+ FILTER_TAB_TBAS +')', function(obj){ + var othis = $(TABS_HEADER+ '.layui-this'); + + obj.index && admin.tabsBody(obj.index).remove(); + setThisRouter(othis); + + //移除resize事件 + admin.delResize(); + }); + + //页面跳转 + $body.on('click', '*[lay-href]', function(){ + var othis = $(this) + ,href = othis.attr('lay-href') + ,text = othis.attr('lay-text') + ,router = layui.router(); + + admin.tabsPage.elem = othis; + //admin.prevRouter[router.path[0]] = router.href; //记录上一次各菜单的路由信息 + + //执行跳转 + var topLayui = parent === self ? layui : top.layui; + topLayui.index.openTabsPage(href, text || othis.text()); + }); + + //点击事件 + $body.on('click', '*[layadmin-event]', function(){ + var othis = $(this) + ,attrEvent = othis.attr('layadmin-event'); + events[attrEvent] && events[attrEvent].call(this, othis); + }); + + //tips + $body.on('mouseenter', '*[lay-tips]', function(){ + var othis = $(this); + + if(othis.parent().hasClass('layui-nav-item') && !container.hasClass(SIDE_SHRINK)) return; + + var tips = othis.attr('lay-tips') + ,offset = othis.attr('lay-offset') + ,direction = othis.attr('lay-direction') + ,index = layer.tips(tips, this, { + tips: direction || 1 + ,time: -1 + ,success: function(layero, index){ + if(offset){ + layero.css('margin-left', offset + 'px'); + } + } + }); + othis.data('index', index); + }).on('mouseleave', '*[lay-tips]', function(){ + layer.close($(this).data('index')); + }); + + //窗口resize事件 + var resizeSystem = layui.data.resizeSystem = function(){ + //layer.close(events.note.index); + layer.closeAll('tips'); + + if(!resizeSystem.lock){ + setTimeout(function(){ + admin.sideFlexible(admin.screen() < 2 ? '' : 'spread'); + delete resizeSystem.lock; + }, 100); + } + + resizeSystem.lock = true; + } + $win.on('resize', layui.data.resizeSystem); + + //接口输出 + exports('admin', admin); +}); \ No newline at end of file diff --git a/admin/res/js/lib/index.js b/admin/res/js/lib/index.js new file mode 100644 index 0000000..e611530 --- /dev/null +++ b/admin/res/js/lib/index.js @@ -0,0 +1,52 @@ +/** + + @Name:layuiAdmin iframe版主入口 + @Author:贤心 + @Site:http://www.layui.com/admin/ + @License:LPPL + + */ + +layui.extend({ + setter: 'config' //配置模块 + , + admin: 'lib/admin' //核心模块 + , + view: 'lib/view' //视图渲染模块 +}).define(['setter', 'admin', 'table'], function (exports) { + var setter = layui.setter, + element = layui.element, + admin = layui.admin, + tabsPage = admin.tabsPage, + view = layui.view + //打开标签页 + , APP_BODY = '#LAY_app_body', FILTER_TAB_TBAS = 'layadmin-layout-tabs', $ = layui.$, $win = $(window); + + //初始 + if (admin.screen() < 2) admin.sideFlexible(); + + //将模块根路径设置为 controller 目录 + layui.config({ + base: '../../res/js/' + }); + + //扩展 lib 目录下的其它模块 + /* layui.each(setter.extend, function(index, item){ + alert(item) + var mods = {}; + mods[item] = '{/}' + 'lib/extend/' + item; + layui.extend(mods); + });*/ + + view().autoRender(); + + layui.table.set({ contentType: 'application/json', page: {}, loading: true }) + // page: {theme: '#1E9FFF'}, + + //加载公共模块 + // layui.use('common'); + + //对外输出 + exports('index', { + }); +}); \ No newline at end of file diff --git a/admin/res/js/lib/view.js b/admin/res/js/lib/view.js new file mode 100644 index 0000000..314d5a3 --- /dev/null +++ b/admin/res/js/lib/view.js @@ -0,0 +1,389 @@ +/** + + @Name:layuiAdmin 视图模块 + @Author:贤心 + @Site:http://www.layui.com/admin/ + @License:LPPL + + */ + +layui.define(['laytpl', 'layer'], function (exports) { + var $ = layui.jquery + , laytpl = layui.laytpl + , layer = layui.layer + , setter = layui.setter + , device = layui.device() + , hint = layui.hint() + + //对外接口 + , view = function (id) { + return new Class(id); + } + + , SHOW = 'layui-show', LAY_BODY = 'LAY_app_body' + + //构造器 + , Class = function (id) { + this.id = id; + this.container = $('#' + (id || LAY_BODY)); + }; + + //加载中 + view.loading = function (elem) { + elem.append( + this.elemLoad = $('') + ); + }; + + //移除加载 + view.removeLoad = function () { + this.elemLoad && this.elemLoad.remove(); + }; + + //清除 token,并跳转到登入页 + view.exit = function (callback) { + //清空本地记录的 token + layui.data(setter.tableName, { + key: setter.request.tokenName + , remove: true + }); + + //跳转到登入页 + //location.hash = '/user/login'; + callback && callback(); + }; + + //Ajax请求 + view.req = function (options) { + var that = this + , success = options.success + , error = options.error + , request = setter.request + , response = setter.response + , debug = function () { + return setter.debug + ? '
URL:' + options.url + : ''; + }; + + options.data = options.data || {}; + options.headers = options.headers || {}; + + if (request.tokenName) { + + var sendData = typeof options.data === 'string'? JSON.parse(options.data): options.data; + + var ssoToken = JSON.parse(localStorage.getItem(request.tokenName)) + if (ssoToken) { + options.data[request.tokenName] = ssoToken + } else { + options.data[request.tokenName] = {} + } + + //自动给参数传入默认 _openx_head + // options.data[request.tokenName] = request.tokenName in sendData ? options.data[request.tokenName] : (ssoToken || {}); + //自动给 Request Headers 传入 token + // options.headers[request.tokenName] = request.tokenName in options.headers ? options.headers[request.tokenName] : (ssoToken || ''); + } + + options.contentType = options.contentType || 'application/json; charset=UTF-8'; + options.data = options.contentType.indexOf("application/json") == 0 ? JSON.stringify(options.data) : options.data; + + delete options.success; + delete options.error; + + return $.ajax($.extend({ + type: 'post', + dataType: 'json', + beforeSend: function () { + layer.load(1); + }, + success: function (res) { + var statusCode = response.statusCode; + + //只有 response 的 code 一切正常才执行 done + if (res&&res[response.statusName] == statusCode.ok) { + typeof options.done === 'function' && options.done(res); + } + + //登录状态失效,清除本地 access_token,并强制跳转到登入页 + else if (res&&res[response.statusName] == statusCode.logout) { + view.exit(); + } + + //其它异常 + /* else { + var error = [ + 'Error: ' + (res[response.msgName] || '返回状态码异常') + ,debug() + ].join(''); + view.error(error); + }*/ + + try { + layer.closeAll('loading') + parent.layer.closeAll('loading') + } catch (e) { + console.log(e) + } + + //只要 http 状态码正常,无论 response 的 code 是否正常都执行 success + typeof success === 'function' && success(res); + } + , error: function (e, code) { + /* var tips = [ + '请求异常,请重试
错误信息:'+ code + ,debug() + ].join(''); + view.error(tips);*/ + try { + layer.closeAll('loading') + parent.layer.closeAll('loading') + } catch (e) { + console.log(e) + } + + var errorJSON = e.responseJSON || null; + var tips = errorJSON.message ? errorJSON.message : "系统错误,请联系管理员" + if (!errorJSON.code && tips.indexOf('Exception') != -1) { + tips = "系统错误,请联系管理员"; + } + layer.msg(tips) + typeof error === 'function' && error(e); + }, + + }, options)); + }; + + //弹窗 + view.popup = function (options) { + var success = options.success + , skin = options.skin; + + delete options.success; + delete options.skin; + + return layer.open($.extend({ + type: 1 + , title: '提示' + , content: '' + , id: 'LAY-system-view-popup' + , skin: 'layui-layer-admin' + (skin ? ' ' + skin : '') + , shadeClose: true + , closeBtn: false + , success: function (layero, index) { + var elemClose = $(''); + layero.append(elemClose); + elemClose.on('click', function () { + layer.close(index); + }); + typeof success === 'function' && success.apply(this, arguments); + } + }, options)) + }; + + //异常提示 + view.error = function (content, options) { + return view.popup($.extend({ + content: content + , maxWidth: 300 + //,shade: 0.01 + , offset: 't' + , anim: 6 + , id: 'LAY_adminError' + }, options)) + }; + + + //请求模板文件渲染 + Class.prototype.render = function (views, params) { + var that = this, router = layui.router(); + views = setter.views + views + setter.engine; + + $('#' + LAY_BODY).children('.layadmin-loading').remove(); + view.loading(that.container); //loading + + //请求模板 + $.ajax({ + url: views + , type: 'get' + , dataType: 'html' + , data: { + v: layui.cache.version + } + , success: function (html) { + html = '
' + html + '
'; + + var elemTitle = $(html).find('title') + , title = elemTitle.text() || (html.match(/\([\s\S]*)\<\/title>/) || [])[1]; + + var res = { + title: title + , body: html + }; + + elemTitle.remove(); + that.params = params || {}; //获取参数 + + if (that.then) { + that.then(res); + delete that.then; + } + + that.parse(html); + view.removeLoad(); + + if (that.done) { + that.done(res); + delete that.done; + } + + } + , error: function (e) { + view.removeLoad(); + + if (that.render.isError) { + return view.error('请求视图文件异常,状态:' + e.status); + } + ; + + if (e.status === 404) { + that.render('template/tips/404'); + } else { + that.render('template/tips/error'); + } + + that.render.isError = true; + } + }); + return that; + }; + + //解析模板 + Class.prototype.parse = function (html, refresh, callback) { + var that = this + , isScriptTpl = typeof html === 'object' //是否模板元素 + , elem = isScriptTpl ? html : $(html) + , elemTemp = isScriptTpl ? html : elem.find('*[template]') + , fn = function (options) { + var tpl = laytpl(options.dataElem.html()) + , res = $.extend({ + params: router.params + }, options.res); + + options.dataElem.after(tpl.render(res)); + typeof callback === 'function' && callback(); + + try { + options.done && new Function('d', options.done)(res); + } catch (e) { + console.error(options.dataElem[0], '\n存在错误回调脚本\n\n', e) + } + } + , router = layui.router(); + + elem.find('title').remove(); + that.container[refresh ? 'after' : 'html'](elem.children()); + + router.params = that.params || {}; + + //遍历模板区块 + for (var i = elemTemp.length; i > 0; i--) { + (function () { + var dataElem = elemTemp.eq(i - 1) + , layDone = dataElem.attr('lay-done') || dataElem.attr('lay-then') //获取回调 + , url = laytpl(dataElem.attr('lay-url') || '').render(router) //接口 url + , data = laytpl(dataElem.attr('lay-data') || '').render(router) //接口参数 + , headers = laytpl(dataElem.attr('lay-headers') || '').render(router); //接口请求的头信息 + + try { + data = new Function('return ' + data + ';')(); + } catch (e) { + hint.error('lay-data: ' + e.message); + data = {}; + } + ; + + try { + headers = new Function('return ' + headers + ';')(); + } catch (e) { + hint.error('lay-headers: ' + e.message); + headers = headers || {} + } + ; + + if (url) { + view.req({ + type: dataElem.attr('lay-type') || 'get' + , url: url + , data: data + , dataType: 'json' + , headers: headers + , success: function (res) { + fn({ + dataElem: dataElem + , res: res + , done: layDone + }); + } + }); + } else { + fn({ + dataElem: dataElem + , done: layDone + }); + } + }()); + } + + return that; + }; + + //自动渲染数据模板 + Class.prototype.autoRender = function (id, callback) { + var that = this; + $(id || 'body').find('*[template]').each(function (index, item) { + var othis = $(this); + that.container = othis; + that.parse(othis, 'refresh'); + }); + }; + + //直接渲染字符 + Class.prototype.send = function (views, data) { + var tpl = laytpl(views || this.container.html()).render(data || {}); + this.container.html(tpl); + return this; + }; + + //局部刷新模板 + Class.prototype.refresh = function (callback) { + var that = this + , next = that.container.next() + , templateid = next.attr('lay-templateid'); + + if (that.id != templateid) return that; + + that.parse(that.container, 'refresh', function () { + that.container.siblings('[lay-templateid="' + that.id + '"]:last').remove(); + typeof callback === 'function' && callback(); + }); + + return that; + }; + + //视图请求成功后的回调1 + Class.prototype.then = function (callback) { + this.then = callback; + return this; + }; + + //视图渲染完毕后的回调 + Class.prototype.done = function (callback) { + this.done = callback; + return this; + }; + + //对外接口 + exports('view', view); +}); \ No newline at end of file diff --git a/admin/res/js/qrcode.js b/admin/res/js/qrcode.js new file mode 100644 index 0000000..db847dd --- /dev/null +++ b/admin/res/js/qrcode.js @@ -0,0 +1,698 @@ + +layui.define(function (exports) { + + var QRCode = function () { + this.v = '0.1.beta'; + }; + (function () { + //--------------------------------------------------------------------- + // QRCode for JavaScript + // + // Copyright (c) 2009 Kazuhiko Arase + // + // URL: http://www.d-project.com/ + // + // Licensed under the MIT license: + // http://www.opensource.org/licenses/mit-license.php + // + // The word "QR Code" is registered trademark of + // DENSO WAVE INCORPORATED + // http://www.denso-wave.com/qrcode/faqpatent-e.html + // + //--------------------------------------------------------------------- + function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; + this.parsedData = []; + + // Added to support UTF-8 Characters + for (var i = 0, l = this.data.length; i < l; i++) { + var byteArray = []; + var code = this.data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3F); + } else if (code > 0x800) { + byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3F); + } else if (code > 0x80) { + byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3F); + } else { + byteArray[0] = code; + } + + this.parsedData.push(byteArray); + } + + this.parsedData = Array.prototype.concat.apply([], this.parsedData); + + if (this.parsedData.length != this.data.length) { + this.parsedData.unshift(191); + this.parsedData.unshift(187); + this.parsedData.unshift(239); + } + } + + QR8bitByte.prototype = { + getLength: function (buffer) { + return this.parsedData.length; + }, + write: function (buffer) { + for (var i = 0, l = this.parsedData.length; i < l; i++) { + buffer.put(this.parsedData[i], 8); + } + } + }; + + function QRCodeModel(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; + } + + QRCodeModel.prototype = { + addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) { + if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); } + return this.modules[row][col]; + }, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) { + this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } } + this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); } + if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); } + this.mapData(this.dataCache, maskPattern); + }, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () { + var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } } + return pattern; + }, createMovieClip: function (target_mc, instance_name, depth) { + var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } } + return qr_mc; + }, setupTimingPattern: function () { + for (var r = 8; r < this.moduleCount - 8; r++) { + if (this.modules[r][6] != null) { continue; } + this.modules[r][6] = (r % 2 == 0); + } + for (var c = 8; c < this.moduleCount - 8; c++) { + if (this.modules[6][c] != null) { continue; } + this.modules[6][c] = (c % 2 == 0); + } + }, setupPositionAdjustPattern: function () { + var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) { + for (var j = 0; j < pos.length; j++) { + var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; } + for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } + } + } + }, setupTypeNumber: function (test) { + var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; } + for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; } + }, setupTypeInfo: function (test, maskPattern) { + var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } } + for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } } + this.modules[this.moduleCount - 8][8] = (!test); + }, mapData: function (data, maskPattern) { + var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) { + if (col == 6) col--; while (true) { + for (var c = 0; c < 2; c++) { + if (this.modules[row][col - c] == null) { + var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); } + var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; } + this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; } + } + } + row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; } + } + } + } + }; QRCodeModel.PAD0 = 0xEC; QRCodeModel.PAD1 = 0x11; QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) { + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); } + var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; } + if (buffer.getLengthInBits() > totalDataCount * 8) { + throw new Error("code length overflow. (" + + buffer.getLengthInBits() + + ">" + + totalDataCount * 8 + + ")"); + } + if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); } + while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); } + while (true) { + if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } + buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; } + buffer.put(QRCodeModel.PAD1, 8); + } + return QRCodeModel.createBytes(buffer, rsBlocks); + }; QRCodeModel.createBytes = function (buffer, rsBlocks) { + var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) { + var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; } + offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; } + } + var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; } + var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } } + for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } } + return data; + }; var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 }; var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 }; var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }; var QRUtil = { + PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) { + var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); } + return ((data << 10) | d) ^ QRUtil.G15_MASK; + }, getBCHTypeNumber: function (data) { + var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); } + return (data << 12) | d; + }, getBCHDigit: function (data) { + var digit = 0; while (data != 0) { digit++; data >>>= 1; } + return digit; + }, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) { + var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); } + return a; + }, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) { + var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) { + for (var col = 0; col < moduleCount; col++) { + var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) { + if (row + r < 0 || moduleCount <= row + r) { continue; } + for (var c = -1; c <= 1; c++) { + if (col + c < 0 || moduleCount <= col + c) { continue; } + if (r == 0 && c == 0) { continue; } + if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; } + } + } + if (sameCount > 5) { lostPoint += (3 + sameCount - 5); } + } + } + for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } } + for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } } + for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } } + var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } } + var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint; + } + }; var QRMath = { + glog: function (n) { + if (n < 1) { throw new Error("glog(" + n + ")"); } + return QRMath.LOG_TABLE[n]; + }, gexp: function (n) { + while (n < 0) { n += 255; } + while (n >= 256) { n -= 255; } + return QRMath.EXP_TABLE[n]; + }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256) + }; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; } + for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; } + for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; } + function QRPolynomial(num, shift) { + if (num.length == undefined) { throw new Error(num.length + "/" + shift); } + var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; } + this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; } + } + QRPolynomial.prototype = { + get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) { + var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } } + return new QRPolynomial(num, 0); + }, mod: function (e) { + if (this.getLength() - e.getLength() < 0) { return this; } + var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); } + for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); } + return new QRPolynomial(num, 0).mod(e); + } + }; function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; } + QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]]; QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) { + var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); } + var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } } + return list; + }; QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } }; function QRBitBuffer() { this.buffer = []; this.length = 0; } + QRBitBuffer.prototype = { + get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) { + var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); } + if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); } + this.length++; + } + }; var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]]; + + function _isSupportCanvas() { + return typeof CanvasRenderingContext2D != "undefined"; + } + + // android 2.x doesn't support Data-URI spec + function _getAndroid() { + var android = false; + var sAgent = navigator.userAgent; + + if (/android/i.test(sAgent)) { // android + android = true; + var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); + + if (aMat && aMat[1]) { + android = parseFloat(aMat[1]); + } + } + + return android; + } + + var svgDrawer = (function () { + + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + + this.clear(); + + function makeSVG(tag, attrs) { + var el = document.createElementNS('http://www.w3.org/2000/svg', tag); + for (var k in attrs) + if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); + return el; + } + + var svg = makeSVG("svg", { 'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight }); + svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); + _el.appendChild(svg); + + svg.appendChild(makeSVG("rect", { "fill": _htOption.colorLight, "width": "100%", "height": "100%" })); + svg.appendChild(makeSVG("rect", { "fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template" })); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + if (oQRCode.isDark(row, col)) { + var child = makeSVG("use", { "x": String(col), "y": String(row) }); + child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template") + svg.appendChild(child); + } + } + } + }; + Drawing.prototype.clear = function () { + while (this._el.hasChildNodes()) + this._el.removeChild(this._el.lastChild); + }; + return Drawing; + })(); + + var useSVG = document.documentElement.tagName.toLowerCase() === "svg"; + + // Drawing in DOM by using Table tag + var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () { + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + var aHTML = ['']; + + for (var row = 0; row < nCount; row++) { + aHTML.push(''); + + for (var col = 0; col < nCount; col++) { + aHTML.push(''); + } + + aHTML.push(''); + } + + aHTML.push('
'); + _el.innerHTML = aHTML.join(''); + + // Fix the margin values as real size. + var elTable = _el.childNodes[0]; + var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; + var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; + + if (nLeftMarginTable > 0 && nTopMarginTable > 0) { + elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; + } + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._el.innerHTML = ''; + }; + + return Drawing; + })() : (function () { // Drawing in Canvas + function _onMakeImage() { + this._elImage.src = this._elCanvas.toDataURL("image/png"); + this._elImage.style.display = "block"; + this._elCanvas.style.display = "none"; + } + + // Android 2.1 bug workaround + // http://code.google.com/p/android/issues/detail?id=5141 + if (this._android && this._android <= 2.1) { + var factor = 1 / window.devicePixelRatio; + var drawImage = CanvasRenderingContext2D.prototype.drawImage; + CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (("nodeName" in image) && /img/i.test(image.nodeName)) { + for (var i = arguments.length - 1; i >= 1; i--) { + arguments[i] = arguments[i] * factor; + } + } else if (typeof dw == "undefined") { + arguments[1] *= factor; + arguments[2] *= factor; + arguments[3] *= factor; + arguments[4] *= factor; + } + + drawImage.apply(this, arguments); + }; + } + + /** + * Check whether the user's browser supports Data URI or not + * + * @private + * @param {Function} fSuccess Occurs if it supports Data URI + * @param {Function} fFail Occurs if it doesn't support Data URI + */ + function _safeSetDataURI(fSuccess, fFail) { + var self = this; + self._fFail = fFail; + self._fSuccess = fSuccess; + + // Check it just once + if (self._bSupportDataURI === null) { + var el = document.createElement("img"); + var fOnError = function () { + self._bSupportDataURI = false; + + if (self._fFail) { + self._fFail.call(self); + } + }; + var fOnSuccess = function () { + self._bSupportDataURI = true; + + if (self._fSuccess) { + self._fSuccess.call(self); + } + }; + + el.onabort = fOnError; + el.onerror = fOnError; + el.onload = fOnSuccess; + el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. + return; + } else if (self._bSupportDataURI === true && self._fSuccess) { + self._fSuccess.call(self); + } else if (self._bSupportDataURI === false && self._fFail) { + self._fFail.call(self); + } + }; + + /** + * Drawing QRCode by using canvas + * + * @constructor + * @param {HTMLElement} el + * @param {Object} htOption QRCode Options + */ + var Drawing = function (el, htOption) { + this._bIsPainted = false; + this._android = _getAndroid(); + + this._htOption = htOption; + this._elCanvas = document.createElement("canvas"); + this._elCanvas.width = htOption.width; + this._elCanvas.height = htOption.height; + el.appendChild(this._elCanvas); + this._el = el; + this._oContext = this._elCanvas.getContext("2d"); + this._bIsPainted = false; + this._elImage = document.createElement("img"); + this._elImage.alt = "Scan me!"; + this._elImage.style.display = "none"; + this._el.appendChild(this._elImage); + this._bSupportDataURI = null; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _elImage = this._elImage; + var _oContext = this._oContext; + var _htOption = this._htOption; + + var nCount = oQRCode.getModuleCount(); + var nWidth = _htOption.width / nCount; + var nHeight = _htOption.height / nCount; + var nRoundedWidth = Math.round(nWidth); + var nRoundedHeight = Math.round(nHeight); + + _elImage.style.display = "none"; + this.clear(); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + var bIsDark = oQRCode.isDark(row, col); + var nLeft = col * nWidth; + var nTop = row * nHeight; + _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.lineWidth = 1; + _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.fillRect(nLeft, nTop, nWidth, nHeight); + + // 안티 앨리어싱 방지 처리 + _oContext.strokeRect( + Math.floor(nLeft) + 0.5, + Math.floor(nTop) + 0.5, + nRoundedWidth, + nRoundedHeight + ); + + _oContext.strokeRect( + Math.ceil(nLeft) - 0.5, + Math.ceil(nTop) - 0.5, + nRoundedWidth, + nRoundedHeight + ); + } + } + + this._bIsPainted = true; + }; + + /** + * Make the image from Canvas if the browser supports Data URI. + */ + Drawing.prototype.makeImage = function () { + if (this._bIsPainted) { + _safeSetDataURI.call(this, _onMakeImage); + } + }; + + /** + * Return whether the QRCode is painted or not + * + * @return {Boolean} + */ + Drawing.prototype.isPainted = function () { + return this._bIsPainted; + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); + this._bIsPainted = false; + }; + + /** + * @private + * @param {Number} nNumber + */ + Drawing.prototype.round = function (nNumber) { + if (!nNumber) { + return nNumber; + } + + return Math.floor(nNumber * 1000) / 1000; + }; + + return Drawing; + })(); + + /** + * Get the type by string length + * + * @private + * @param {String} sText + * @param {Number} nCorrectLevel + * @return {Number} type + */ + function _getTypeNumber(sText, nCorrectLevel) { + var nType = 1; + var length = _getUTF8Length(sText); + + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { + var nLimit = 0; + + switch (nCorrectLevel) { + case QRErrorCorrectLevel.L: + nLimit = QRCodeLimitLength[i][0]; + break; + case QRErrorCorrectLevel.M: + nLimit = QRCodeLimitLength[i][1]; + break; + case QRErrorCorrectLevel.Q: + nLimit = QRCodeLimitLength[i][2]; + break; + case QRErrorCorrectLevel.H: + nLimit = QRCodeLimitLength[i][3]; + break; + } + + if (length <= nLimit) { + break; + } else { + nType++; + } + } + + if (nType > QRCodeLimitLength.length) { + throw new Error("Too long data"); + } + + return nType; + } + + function _getUTF8Length(sText) { + var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); + return replacedText.length + (replacedText.length != sText ? 3 : 0); + } + + /** + * @class QRCode + * @constructor + * @example + * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie"); + * + * @example + * var oQRCode = new QRCode("test", { + * text : "http://naver.com", + * width : 128, + * height : 128 + * }); + * + * oQRCode.clear(); // Clear the QRCode. + * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode. + * + * @param {HTMLElement|String} el target element or 'id' attribute of element. + * @param {Object|String} vOption + * @param {String} vOption.text QRCode link data + * @param {Number} [vOption.width=256] + * @param {Number} [vOption.height=256] + * @param {String} [vOption.colorDark="#000000"] + * @param {String} [vOption.colorLight="#ffffff"] + * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H] + */ + QRCode.prototype.qrcode = function (el, vOption) { + this._htOption = { + width: 256, + height: 256, + typeNumber: 4, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRErrorCorrectLevel.H + }; + + if (typeof vOption === 'string') { + vOption = { + text: vOption + }; + } + + // Overwrites options + if (vOption) { + for (var i in vOption) { + this._htOption[i] = vOption[i]; + } + } + + if (typeof el == "string") { + el = document.getElementById(el); + } + + if (this._htOption.useSVG) { + Drawing = svgDrawer; + } + + this._android = _getAndroid(); + this._el = el; + this._oQRCode = null; + this._oDrawing = new Drawing(this._el, this._htOption); + + if (this._htOption.text) { + this.makeCode(this._htOption.text); + } + return QRCode; + }; + + /** + * Make the QRCode + * + * @param {String} sText link data + */ + QRCode.prototype.makeCode = function (sText) { + this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); + this._oQRCode.addData(sText); + this._oQRCode.make(); + this._el.title = sText; + this._oDrawing.draw(this._oQRCode); + this.makeImage(); + }; + + /** + * Make the Image from Canvas element + * - It occurs automatically + * - Android below 3 doesn't support Data-URI spec. + * + * @private + */ + QRCode.prototype.makeImage = function () { + if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) { + this._oDrawing.makeImage(); + } + }; + + /** + * Clear the QRCode + */ + QRCode.prototype.clear = function () { + this._oDrawing.clear(); + }; + + /** + * @name QRCode.CorrectLevel + */ + QRCode.CorrectLevel = QRErrorCorrectLevel; + + })(); + exports('qrcode', new QRCode) +}); \ No newline at end of file diff --git a/admin/res/js/tpl.js b/admin/res/js/tpl.js new file mode 100644 index 0000000..4bb241d --- /dev/null +++ b/admin/res/js/tpl.js @@ -0,0 +1,89 @@ +/** + 定义layui模块 - 模板引擎 - 自定义模板 + */ +layui.define(['index', 'laytpl', 'form'], function (exports) { + + exports("tpl", { + setPlainTextTpl: function (eleId, data) { + var laytpl = layui.laytpl; + var form = layui.form; + var getTpl = '{{d.title}}'; + var view = document.getElementById(eleId); + if (!view) { console.warn("请填写有效的ElementId"); return false; } + laytpl(getTpl).render(data, function (html) { + view.innerHTML = html; + }); + form.render("select"); + }, + setInputTpl: function (eleId, data) { + var laytpl = layui.laytpl; + var form = layui.form; + var getTpl = ''; + var display = data.display ? data.display : 'block'; + var requiredhtml = data.required ? ' required lay-verify="required" ' : ''; + var placeholder = data.placeholder ? data.placeholder : '请输入内容'; + if (data.label) { + getTpl += ''; + } + getTpl += '
'; + getTpl += ''; + getTpl += '
'; + var view = document.getElementById(eleId); + if (!view) { console.warn("请填写有效的ElementId"); return false; } + laytpl(getTpl).render(data, function (html) { + view.innerHTML = html; + }); + form.render(); + }, + setTextareaTpl: function (eleId, data) { + var laytpl = layui.laytpl; + var form = layui.form; + var idHtml = data.id ? 'id="' + data.id + '"' : ''; + var classHtml = ' class="layui-textarea ' + (data.class ? data.class : '') + '" '; + var display = data.display ? data.display : 'block'; + var value = data.value ? data.value : ''; + var placeholder = data.placeholder ? data.placeholder : '请输入内容'; + var requiredhtml = data.required ? ' required lay-verify="required" ' : ''; + var getTpl = ''; + if (data.label) { + getTpl += ''; + } + getTpl += '
'; + getTpl += ' '; + getTpl += '
'; + var view = document.getElementById(eleId); + if (!view) { console.warn("请填写有效的ElementId"); return false; } + laytpl(getTpl).render(data, function (html) { + view.innerHTML = html; + }); + form.render(); + }, + setSelectTpl: function (eleId, data) { + var laytpl = layui.laytpl; + var form = layui.form; + var display = data.display ? data.display : 'block'; + var layFilterHtml = data.layFilter ? ' lay-filter="' + data.layFilter + '" ' : ' '; + var classHtml = data.class ? ' class="' + eleId + '-select" ' : ' '; + var requiredhtml = data.required ? ' required lay-verify="required" ' : ''; + var getTpl = ""; + if (data.label) { + getTpl += ''; + } + getTpl += '
'; + + if (data.list.length > 0) { + getTpl += '
'; + } else { + getTpl += '
'; + + } + + var view = document.getElementById(eleId); + if (!view) { console.warn("请填写有效的ElementId"); return false; } + laytpl(getTpl).render(data, function (html) { + view.innerHTML = html; + }); + form.render('select'); + }, + }); +}); diff --git a/admin/static/img/date-icon@2x.png b/admin/static/img/date-icon@2x.png new file mode 100644 index 0000000..564c017 Binary files /dev/null and b/admin/static/img/date-icon@2x.png differ diff --git a/admin/static/img/delete-cell.png b/admin/static/img/delete-cell.png new file mode 100644 index 0000000..0849eee Binary files /dev/null and b/admin/static/img/delete-cell.png differ diff --git a/admin/static/img/down@2x.png b/admin/static/img/down@2x.png new file mode 100644 index 0000000..e388a0b Binary files /dev/null and b/admin/static/img/down@2x.png differ diff --git a/admin/static/img/edit-cell.png b/admin/static/img/edit-cell.png new file mode 100644 index 0000000..904a665 Binary files /dev/null and b/admin/static/img/edit-cell.png differ diff --git a/admin/static/img/fail-icon@2x.png b/admin/static/img/fail-icon@2x.png new file mode 100644 index 0000000..106211b Binary files /dev/null and b/admin/static/img/fail-icon@2x.png differ diff --git a/admin/static/img/fail@2x.png b/admin/static/img/fail@2x.png new file mode 100644 index 0000000..2eb5010 Binary files /dev/null and b/admin/static/img/fail@2x.png differ diff --git a/admin/static/img/fold.png b/admin/static/img/fold.png new file mode 100644 index 0000000..41a6915 Binary files /dev/null and b/admin/static/img/fold.png differ diff --git a/admin/static/img/fold@2x.png b/admin/static/img/fold@2x.png new file mode 100644 index 0000000..14ddf54 Binary files /dev/null and b/admin/static/img/fold@2x.png differ diff --git a/admin/static/img/fz-this@2x.png b/admin/static/img/fz-this@2x.png new file mode 100644 index 0000000..f7003da Binary files /dev/null and b/admin/static/img/fz-this@2x.png differ diff --git a/admin/static/img/fz@2x.png b/admin/static/img/fz@2x.png new file mode 100644 index 0000000..691485e Binary files /dev/null and b/admin/static/img/fz@2x.png differ diff --git a/admin/static/img/icon-next@2x.png b/admin/static/img/icon-next@2x.png new file mode 100644 index 0000000..ac07537 Binary files /dev/null and b/admin/static/img/icon-next@2x.png differ diff --git a/admin/static/img/icon-pre@2x.png b/admin/static/img/icon-pre@2x.png new file mode 100644 index 0000000..18296ce Binary files /dev/null and b/admin/static/img/icon-pre@2x.png differ diff --git a/admin/static/img/jd-this@2x.png b/admin/static/img/jd-this@2x.png new file mode 100644 index 0000000..fc27f21 Binary files /dev/null and b/admin/static/img/jd-this@2x.png differ diff --git a/admin/static/img/jd@2x.png b/admin/static/img/jd@2x.png new file mode 100644 index 0000000..eb5b7ab Binary files /dev/null and b/admin/static/img/jd@2x.png differ diff --git a/admin/static/img/more@2x.png b/admin/static/img/more@2x.png new file mode 100644 index 0000000..daec4a1 Binary files /dev/null and b/admin/static/img/more@2x.png differ diff --git a/admin/static/img/open@2x.png b/admin/static/img/open@2x.png new file mode 100644 index 0000000..64b6003 Binary files /dev/null and b/admin/static/img/open@2x.png differ diff --git a/admin/static/img/plus@2x.png b/admin/static/img/plus@2x.png new file mode 100644 index 0000000..729483f Binary files /dev/null and b/admin/static/img/plus@2x.png differ diff --git a/admin/static/img/rw-1@2x.png b/admin/static/img/rw-1@2x.png new file mode 100644 index 0000000..6b9ac8e Binary files /dev/null and b/admin/static/img/rw-1@2x.png differ diff --git a/admin/static/img/rw-2@2x.png b/admin/static/img/rw-2@2x.png new file mode 100644 index 0000000..53e4ad9 Binary files /dev/null and b/admin/static/img/rw-2@2x.png differ diff --git a/admin/static/img/rw-3@2x.png b/admin/static/img/rw-3@2x.png new file mode 100644 index 0000000..bc6ca79 Binary files /dev/null and b/admin/static/img/rw-3@2x.png differ diff --git a/admin/static/img/rw-this@2x.png b/admin/static/img/rw-this@2x.png new file mode 100644 index 0000000..86bf8d0 Binary files /dev/null and b/admin/static/img/rw-this@2x.png differ diff --git a/admin/static/img/rw@2x.png b/admin/static/img/rw@2x.png new file mode 100644 index 0000000..6d06e82 Binary files /dev/null and b/admin/static/img/rw@2x.png differ diff --git a/admin/static/img/save-cell.png b/admin/static/img/save-cell.png new file mode 100644 index 0000000..3cc2c2a Binary files /dev/null and b/admin/static/img/save-cell.png differ diff --git a/admin/static/img/sjy-this@2x.png b/admin/static/img/sjy-this@2x.png new file mode 100644 index 0000000..29f5a15 Binary files /dev/null and b/admin/static/img/sjy-this@2x.png differ diff --git a/admin/static/img/sjy@2x.png b/admin/static/img/sjy@2x.png new file mode 100644 index 0000000..42ba20c Binary files /dev/null and b/admin/static/img/sjy@2x.png differ diff --git a/admin/static/img/success@2x.png b/admin/static/img/success@2x.png new file mode 100644 index 0000000..e2a5af6 Binary files /dev/null and b/admin/static/img/success@2x.png differ diff --git a/admin/static/img/unfold@2x.png b/admin/static/img/unfold@2x.png new file mode 100644 index 0000000..cf55f2a Binary files /dev/null and b/admin/static/img/unfold@2x.png differ diff --git a/admin/static/img/up@2x.png b/admin/static/img/up@2x.png new file mode 100644 index 0000000..da3e108 Binary files /dev/null and b/admin/static/img/up@2x.png differ diff --git a/admin/static/img/xl@2x.png b/admin/static/img/xl@2x.png new file mode 100644 index 0000000..ce1d401 Binary files /dev/null and b/admin/static/img/xl@2x.png differ diff --git a/admin/static/js/chart/ecg.js b/admin/static/js/chart/ecg.js new file mode 100644 index 0000000..0c6b548 --- /dev/null +++ b/admin/static/js/chart/ecg.js @@ -0,0 +1,314 @@ + + +layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laydate = layui.laydate, + laypage = layui.laypage; + var refreshNextTime = 0; + var intervalsTime = 0;//刷新时间频率 + var myRefreshTimeOut = ""; + var where = {}; + + var ecgChart = echarts.init(document.getElementById("ecgChart")); + var LIST_TABLE_ID = "listTable"; + var LIST_TABLE_DATA = [ + { + id: 1, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 2, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 3, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 4, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 5, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 6, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 7, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 8, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 9, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 10, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + ]; + var LIST_TABLE_COLS = [ + { + field: "id", + title: "id", + align: "center", + }, + { + field: "name", + title: "名称", + align: "center", + }, + { + field: "createTime", + title: "创建时间", + align: "center", + templet: function (d) { + return layui.util.toDateString(d.createTime, "yyyy-MM-dd"); + }, + } + ]; + init(); + + function init() { + getChartData(); + getTableData(); + refreshTime(); + } + + function stopRefreshTime() { + clearTimeout(myRefreshTimeOut); + } + function refreshTime() { + if (intervalsTime == 0) { + stopRefreshTime(); + } + var nowTime = new Date().getTime(); + if (nowTime > refreshNextTime) { + refreshNextTime = nowTime + parseInt(intervalsTime); + getChartData(); + getTableData(); + if (intervalsTime > 0) { + refreshTime(); + } + } else { + if (intervalsTime > 0) { + myRefreshTimeOut = window.setTimeout(function () { + refreshTime(); + }, intervalsTime); + } + } + } + function getChartData() { + var responseTimeOptions = { + xAxisData: ["4000", "3000", "5000", "6500", "4800"], + seriesData: [110, 250, 239, 124, 47], + }; //api 请求数据 + rendErecgChart(responseTimeOptions); + } + function rendErecgChart({ xAxisData, seriesData }) { + var xAxisData = []; + var yAxisData = []; + for (var i = 500; i > 0; i--) { + xAxisData.push(i + "秒前"); + } + for (i = 1; i < 501; i++) { + yAxisData.push(null); + } + var totalFlowRateOption = { + animation: false, + title: { + text: '总流量(kbps)'/*, + left:"110px"*/ }, + tooltip: { + trigger: 'axis', + axisPointer: { type: 'cross' } + }, + grid: { + left: 50/*"50px"*/, + right: 15/*"15px"*/ + }, + legend: { + data: ['当前流量'] + }, + xAxis: { + boundaryGap: false, + data: xAxisData, + nameLocation: "end", + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + textStyle: { + color: "#a5aaaf", + }, + yAxis: { + boundaryGap: false, nameLocation: "end", + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + series: { + symbol: "none",/*去掉小圆点*/ + name: '当前流量', + type: 'line', + data: yAxisData, + showBackground: false, + itemStyle: { + normal: { + color: "#1289ff", + }, + }, + } + }; + + ecgChart.setOption(totalFlowRateOption); + + setInterval(function () { + yAxisData.push(Math.round(Math.random() * 1000)); + if (yAxisData.length > 500) { + yAxisData.shift(); + } + ecgChart.setOption(totalFlowRateOption); + }, 1000); + } + function getTableData() { + var tableRenderOptions = { + elem: "#" + LIST_TABLE_ID, + data: LIST_TABLE_DATA, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + }; + table.render(tableRenderOptions); + laypage.render({ + elem: "pages", + count: 100, + layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + jump: function (obj) { + console.log(obj); + }, + }); + } +}); diff --git a/admin/static/js/chart/histogram.js b/admin/static/js/chart/histogram.js new file mode 100644 index 0000000..fb14c6e --- /dev/null +++ b/admin/static/js/chart/histogram.js @@ -0,0 +1,310 @@ + +layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laydate = layui.laydate, + laypage = layui.laypage; + var refreshNextTime = 0; + var intervalsTime = 0;//刷新时间频率 + var myRefreshTimeOut = ""; + var where = {}; + + + var histogramChart = echarts.init(document.getElementById("histogramChart")); + var LIST_TABLE_ID = "listTable"; + var LIST_TABLE_DATA = [ + { + id: 1, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 2, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 3, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 4, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 5, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 6, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 7, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 8, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 9, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 10, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + ]; + var LIST_TABLE_COLS = [ + { + field: "id", + title: "id", + align: "center", + }, + { + field: "name", + title: "名称", + align: "center", + }, + { + field: "createTime", + title: "创建时间", + align: "center", + templet: function (d) { + return layui.util.toDateString(d.createTime, "yyyy-MM-dd"); + }, + } + ]; + init(); + + function init() { + getChartData(); + getTableData(); + refreshTime(); + } + + function stopRefreshTime() { + clearTimeout(myRefreshTimeOut); + } + function refreshTime() { + if (intervalsTime == 0) { + stopRefreshTime(); + } + var nowTime = new Date().getTime(); + if (nowTime > refreshNextTime) { + refreshNextTime = nowTime + parseInt(intervalsTime); + getChartData(); + getTableData(); + if (intervalsTime > 0) { + refreshTime(); + } + } else { + if (intervalsTime > 0) { + myRefreshTimeOut = window.setTimeout(function () { + refreshTime(); + }, intervalsTime); + } + } + } + function getChartData() { + var responseTimeOptions = { + xAxisData: ["100", "200", "50", "250", "100"], + seriesData: [100, 700, 50, 250, 100], + }; //api 请求数据 + renderHistogramChart(responseTimeOptions); + } + function renderHistogramChart({ xAxisData, seriesData }) { + var option = { + xAxis: { + type: 'category', + data: xAxisData, + name: "响应时长/ms", + nameLocation: "end", + splitNumber: 10, + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + } + }, + yAxis: { + type: 'value', + name: "请求个数", + nameLocation: "end", + splitNumber: 4, + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + } + }, + textStyle: { + color: "#a5aaaf", + }, + series: [{ + data: seriesData, + type: 'bar', + barMinWidth: '180', + barCategoryGap: "0", + showBackground: false, + backgroundStyle: { + color: 'rgba(18, 137, 255, 1)', + }, + itemStyle: { + normal: { + label: { + formatter: "{c}", + show: true, + position: "top", + textStyle: { + fontWeight: "bolder", + fontSize: "16", + color: "#1289ff" + } + }, + opacity: 1, + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: "#1289ff", + }, + { + offset: 1, + color: "#1289ff4d", + }, + ]), + }, + } + }] + }; + histogramChart.setOption(option); + } + function getTableData() { + var tableRenderOptions = { + elem: "#" + LIST_TABLE_ID, + data: LIST_TABLE_DATA, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + }; + table.render(tableRenderOptions); + laypage.render({ + elem: "pages", + count: 100, + layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + jump: function (obj) { + console.log(obj); + }, + }); + } +}); diff --git a/admin/static/js/chart/line.js b/admin/static/js/chart/line.js new file mode 100644 index 0000000..ab661e5 --- /dev/null +++ b/admin/static/js/chart/line.js @@ -0,0 +1,285 @@ + + +layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laydate = layui.laydate, + laypage = layui.laypage; + var refreshNextTime = 0; + var intervalsTime = 0;//刷新时间频率 + var myRefreshTimeOut = ""; + var where = {}; + + var lineChart = echarts.init(document.getElementById("lineChart")); + var LIST_TABLE_ID = "listTable"; + var LIST_TABLE_DATA = [ + { + id: 1, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 2, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 3, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 4, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 5, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 6, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 7, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 8, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 9, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 10, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + ]; + var LIST_TABLE_COLS = [ + { + field: "id", + title: "id", + align: "center", + }, + { + field: "name", + title: "名称", + align: "center", + }, + { + field: "createTime", + title: "创建时间", + align: "center", + templet: function (d) { + return layui.util.toDateString(d.createTime, "yyyy-MM-dd"); + }, + } + ]; + init(); + + function init() { + getChartData(); + getTableData(); + refreshTime(); + } + + function stopRefreshTime() { + clearTimeout(myRefreshTimeOut); + } + function refreshTime() { + if (intervalsTime == 0) { + stopRefreshTime(); + } + var nowTime = new Date().getTime(); + if (nowTime > refreshNextTime) { + refreshNextTime = nowTime + parseInt(intervalsTime); + getChartData(); + getTableData(); + if (intervalsTime > 0) { + refreshTime(); + } + } else { + if (intervalsTime > 0) { + myRefreshTimeOut = window.setTimeout(function () { + refreshTime(); + }, intervalsTime); + } + } + } + function getChartData() { + var responseTimeOptions = { + xAxisData: ["4000", "3000", "5000", "6500", "4800"], + seriesData: [110, 250, 239, 124, 47], + }; //api 请求数据 + renderLineChart(responseTimeOptions); + } + function renderLineChart({ xAxisData, seriesData }) { + var option = { + xAxis: { + type: "category", + name: "响应时长/ms", + nameLocation: "end", + data: xAxisData, + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + yAxis: { + type: "value", + name: "请求个数", + nameLocation: "end", + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + textStyle: { + color: "#a5aaaf", + }, + series: [ + { + data: seriesData, + type: "line", + showBackground: false, + itemStyle: { + normal: { + color: "#1289ff", + }, + }, + }, + ], + }; + lineChart.setOption(option); + } + function getTableData() { + var tableRenderOptions = { + elem: "#" + LIST_TABLE_ID, + data: LIST_TABLE_DATA, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + }; + table.render(tableRenderOptions); + laypage.render({ + elem: "pages", + count: 100, + layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + jump: function (obj) { + console.log(obj); + }, + }); + } +}); diff --git a/admin/static/js/chart/wavypolyline.js b/admin/static/js/chart/wavypolyline.js new file mode 100644 index 0000000..7a86bf9 --- /dev/null +++ b/admin/static/js/chart/wavypolyline.js @@ -0,0 +1,233 @@ + +layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laydate = layui.laydate, + laypage = layui.laypage; + var wavypolylineChart = echarts.init( + document.getElementById("wavypolylineChart") + ); + var refreshNextTime = 0; + var intervalsTime = 0; //刷新时间频率 + var myRefreshTimeOut = ""; + var where = {}; + + var LIST_TABLE_ID = "listTable"; + var LIST_TABLE_DATA = [ + { + id: 1, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 2, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 3, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + { + id: 4, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }, + ]; + var LIST_TABLE_COLS = [ + { + field: "id", + title: "id", + align: "center", + }, + { + field: "name", + title: "名称", + align: "center", + }, + { + field: "createTime", + title: "创建时间", + align: "center", + templet: function (d) { + return layui.util.toDateString(d.createTime, "yyyy-MM-dd"); + }, + }, + ]; + init(); + + function init() { + getChartData(); + getTableData(); + refreshTime(); + } + + function stopRefreshTime() { + clearTimeout(myRefreshTimeOut); + } + function refreshTime() { + if (intervalsTime == 0) { + stopRefreshTime(); + } + var nowTime = new Date().getTime(); + if (nowTime > refreshNextTime) { + refreshNextTime = nowTime + parseInt(intervalsTime); + getChartData(); + getTableData(); + if (intervalsTime > 0) { + refreshTime(); + } + } else { + if (intervalsTime > 0) { + myRefreshTimeOut = window.setTimeout(function () { + refreshTime(); + }, intervalsTime); + } + } + } + function getChartData() { + var responseTimeOptions = { + xAxisData: ["100", "200", "50", "300", "100", "100", "200", "50", "300", "100"], + seriesData: [100, 200, 50, 300, 100, 100, 200, 50, 300, 100], + }; //api 请求数据 + renderWavypolylineChart(responseTimeOptions); + } + function renderWavypolylineChart({ xAxisData, seriesData }) { + var option = { + xAxis: { + type: "category", + boundaryGap: false, + name: "响应时长/ms", + nameLocation: "end", + data: xAxisData, + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + yAxis: { + type: "value", + name: "请求个数", + nameLocation: "end", + axisLine: { + lineStyle: { + color: "#454b5026", + }, + }, + splitLine: { + show: true, + lineStyle: { + color: ["#454b5026"], + width: 1, + type: "solid", + }, + }, + }, + textStyle: { + color: "#a5aaaf", + }, + series: [ + { + data: seriesData, + type: "line", + showBackground: false, + symbol: "none", //去掉折线图中的节点 + smooth: true, + areaStyle: { + normal: { + color: { + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { + offset: 0, + color: "#1289ff4d" + }, + { + offset: 0.7, + color: "rgba(255, 255, 255, 1)", // 100% 处的颜色 + }, + ], + globalCoord: false, // 缺省为 false + }, + }, + }, + itemStyle: { + normal: { + color: "#1289ff", + }, + }, + }, + ], + }; + + wavypolylineChart.setOption(option); + } + function getTableData() { + var tableRenderOptions = { + elem: "#" + LIST_TABLE_ID, + data: LIST_TABLE_DATA, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + }; + table.render(tableRenderOptions); + laypage.render({ + elem: "pages", + count: 100, + layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + jump: function (obj) { + console.log(obj); + }, + }); + } +}); diff --git a/admin/static/js/clipboard/clipboard.min.js b/admin/static/js/clipboard/clipboard.min.js new file mode 100644 index 0000000..28650f3 --- /dev/null +++ b/admin/static/js/clipboard/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.6 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o +function showToolTips(t) { + var row = layui.$(t).attr("data-tips"); + layer.tips(row, t, { tips: 1, time: 2000 }); +} +//假如 500px px2rem(500) 3.125rem +function px2rem(pxVal) { + return (pxVal * 0.8375) / 134 + 'rem'; +} +//暴力关闭所有弹窗 +function cancelDialog() { + layer.closeAll(); +} +//rem resize 改变的是iframe 中页面的html font-size +!function (win, doc) { + var d = doc.documentElement; + //300为左侧宽度 + function change() { + d.style.fontSize = (d.clientWidth + 300) / 10 + 'px'; + } + win.addEventListener('resize', change, false); + change(); +}(window, document); +//部分区域全屏 +function partFullScreen(buttonClass, fuuareaId) { + var fullarea = document.getElementById(fuuareaId); + var buttonEle = layui.$('.' + buttonClass); + var fullscreen = parseInt(buttonEle.attr('data-screen')); + if (fullscreen) { // 退出全屏 + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + buttonEle.attr('data-screen', '0').html('全屏'); + } else { // 进入全屏 + if (fullarea.requestFullscreen) { + fullarea.requestFullscreen(); + } else if (fullarea.webkitRequestFullScreen) { + fullarea.webkitRequestFullScreen(); + } else if (fullarea.mozRequestFullScreen) { + fullarea.mozRequestFullScreen(); + } else if (fullarea.msRequestFullscreen) { + fullarea.msRequestFullscreen(); + } else { + console.log('不支持全屏'); + } + buttonEle.attr('data-screen', '1').html('退出'); + } +} \ No newline at end of file diff --git a/admin/static/js/detail/index.js b/admin/static/js/detail/index.js new file mode 100644 index 0000000..3b5fc85 --- /dev/null +++ b/admin/static/js/detail/index.js @@ -0,0 +1,156 @@ + +layui.use(["index", "api", "tpl", "dialog", "laypage"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laypage = layui.laypage; + var LIST_TABLE_URL = layui.api.getMockApiUrl("detail", "list"); + var DELETE_TABLE_URL = layui.api.getMockApiUrl("detail", "detail"); + + var where = {}; + var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId + + var LIST_TABLE_ID = "listTable"; // table ElementId + var DETAIL_TABLE_ID = "detailTable"; + var LIST_TABLE_COLS = [{ + field: "id", + title: "id", + align: "left", + hide: true + }, { + field: "name", + title: "源库", + align: "left" + }, { + field: "ip", + title: "源库对象名", + align: "left" + }, { + field: "port", + title: "目标库", + align: "left" + }, { + field: "sid", + title: "目标库对象名", + align: "left" + }, { + fixed: "right", + title: "操作", + width: 150, + align: "left", + toolbar: "#cellOperating" + }]; + var DETAIL_TABLE_COLS = [{ + field: "id", + title: "id", + align: "left", + hide: true + }, { + field: "name", + title: "源库列名", + align: "left" + }, { + field: "ip", + title: "类型", + align: "left" + }, { + field: "port", + title: "目标库列", + align: "left" + }, { + field: "sid", + title: "类型", + align: "left" + }]; + + + init(); + + form.on("submit(" + FORM_QUERY_ID + ")", function (data) { + console.log("查询:", data.field); + getTableData(); + }); //单元格 操作列中 操作事件 + + table.on("tool(" + LIST_TABLE_ID + ")", function (obj) { + var data = obj.data; + var layEvent = obj.event; + + if (layEvent === "detail") { + detailDialog(data); + } + }); + + function init() { + getDetail(); + getSetting(); + getTableData(); + } + + function getDetail() { + //api 请求得到结果 + var data = { id: '5cb92069c3492', name: 'CRM->SCRM[FUL' }; + var html = ` +
  • 任务ID : ${data.id}任务名称 : ${data.name}
  • +
  • 读节点 : ${data.id}写节点 : ${data.name}
  • +
  • 创建者 : ${data.id}创建时间 : ${data.name}
  • +
  • 更新者 : ${data.id}更新时间 : ${data.name}
  • +
  • 状态 : ${data.id}同步架构 : ${data.name}
  • +
  • 源库类型 : ${data.id}目标库类型 : ${data.name}
  • +
  • 源库端口 : ${data.id}目标库端口 : ${data.name}
  • +
  • 源库账号 : ${data.id}目标库账号 : ${data.name}
  • +
  • 已发送数据位点 : ${data.id}已删除数据位点 : ${data.name}
  • + ` + $('.detail-content').html(html); + } + + function getSetting() { + //api 请求得到结果 + layui.tpl.setPlainTextTpl("settingId", { title: '同步方式设置2 :结构初始化 + 全量数据初始化+增量数据' }) + } + + function getTableData() { + var tableRenderOptions = { + height: 300, + id: LIST_TABLE_ID, + elem: "#" + LIST_TABLE_ID, + url: LIST_TABLE_URL, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where + }; + table.render(tableRenderOptions); + } + + function detailDialog(data) { + console.log('查看列:', data); + var templet = $("#tableDialogTemplate").html(); + layui.laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: "节点任务详情", + content: templet, + area: ["520px", "640px"], + success: function success() { + //请求api + var tableRenderOptions = { + height: 300, + id: DETAIL_TABLE_ID, + elem: "#" + DETAIL_TABLE_ID, + url: DELETE_TABLE_URL, + even: "false", + defaultToolbar: [], + page: false, + cols: [DETAIL_TABLE_COLS], + where: {} + }; + table.render(tableRenderOptions); + } + }); + }); + } + +}); \ No newline at end of file diff --git a/admin/static/js/dialog/index.js b/admin/static/js/dialog/index.js new file mode 100644 index 0000000..31c84de --- /dev/null +++ b/admin/static/js/dialog/index.js @@ -0,0 +1,125 @@ +layui.use(["index", "api", "tpl", "dialog"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + laypage = layui.laypage, + admin = layui.admin; + $('#demo1').on('click', function (e) { + e.stopPropagation(); + layui.dialog.setIframeDialog("iframe", { + src: "https://www.layui.com/", + otherconfigStyle: + 'scrolling="no" frameborder=0', + }); + }); + $('#demo2').on('click', function (e) { + e.stopPropagation(); + layui.dialog.showOkMsgDialog({ msg: "this is ok!" }); + }); + $('#demo3').on('click', function (e) { + e.stopPropagation(); + layui.dialog.setQrCodeDialog("qrcode", "生成二维码", { + value: 'https://www.layui.com/', + }); + }); + $('#demo4').on('click', function (e) { + e.stopPropagation(); + addDialog(); + }); + $('#demo5').on('click', function (e) { + e.stopPropagation(); + var data = { name: '我是编辑好的名称', type: 1 }; + editDialog(data); + }); + + function addDialog() { + var templet = $('#formDialogTemplate').html() + layui.laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: '创建', + content: templet, + area: [px2rem(520), px2rem(600)], + btn: ['取消', '确认'], + btnAlign: 'r', + yes: function (index, layero) { + layer.close(index) + return false + }, + btn2: function (index, layero) { + var submit = $('#LAY-dialog-submit') + var submitID = 'lay-dialog-submit' + form.on('submit(' + submitID + ')', function (data) { + var field = data.field //获取提交的字段 + console.log('表单 field:', field); + var ADD_URL = ''; + admin.req({ + url: ADD_URL, + data: field, + success: function (res) { + layer.close(index); + layer.msg('成功'); + }, + error: function (res) { + layer.msg('失败'); + return false; + } + }) + layer.close(index); //关闭弹层 + }) + submit.trigger('click') + return false + }, + success: function success() { + layui.form.render('') + } + }) + }) + } + function editDialog(data) { + var templet = $('#formDialogTemplate').html() + layui.laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: '编辑', + content: templet, + area: [px2rem(520), px2rem(600)], + btn: ['取消', '确认'], + btnAlign: 'r', + yes: function (index, layero) { + layer.close(index) + return false + }, + btn2: function (index, layero) { + var submit = $('#LAY-dialog-submit') + var submitID = 'lay-dialog-submit' + form.on('submit(' + submitID + ')', function (data) { + var field = data.field //获取提交的字段 + console.log('表单 field:', field); + var UPDATE_URL = ""; + admin.req({ + url: UPDATE_URL, + data: field, + success: function (res) { + layer.close(index); + layer.msg('成功'); + }, + error: function (res) { + layer.msg('失败'); + return false; + } + }) + layer.close(index) //关闭弹层 + }) + submit.trigger('click') + return false + }, + success: function success() { + form.val('dialogForm', data) + layui.form.render('') + } + }) + }) + } +}); diff --git a/admin/static/js/echarts.min.js b/admin/static/js/echarts.min.js new file mode 100644 index 0000000..75c7857 --- /dev/null +++ b/admin/static/js/echarts.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){ey[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=qv.call(t);if("[object Array]"===n){e=[];for(var o=0,a=t.length;o_y||t<-_y}function ft(t){this._target=t.target,this._life=t.life||1e3,this._delay=t.delay||0,this._initialized=!1,this.loop=null!=t.loop&&t.loop,this.gap=t.gap||0,this.easing=t.easing||"Linear",this.onframe=t.onframe,this.ondestroy=t.ondestroy,this.onrestart=t.onrestart,this._pausedTime=0,this._paused=!1}function gt(t){return(t=Math.round(t))<0?0:t>255?255:t}function pt(t){return(t=Math.round(t))<0?0:t>360?360:t}function mt(t){return t<0?0:t>1?1:t}function vt(t){return gt(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function yt(t){return mt(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function xt(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function _t(t,e,i){return t+(e-t)*i}function bt(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t}function wt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function St(t,e){Py&&wt(Py,e),Py=ky.put(t,Py||e.slice())}function Mt(t,e){if(t){e=e||[];var i=ky.get(t);if(i)return wt(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in Ly)return wt(e,Ly[n]),St(t,e),e;if("#"!==n.charAt(0)){var o=n.indexOf("("),a=n.indexOf(")");if(-1!==o&&a+1===n.length){var r=n.substr(0,o),s=n.substr(o+1,a-(o+1)).split(","),l=1;switch(r){case"rgba":if(4!==s.length)return void bt(e,0,0,0,1);l=yt(s.pop());case"rgb":return 3!==s.length?void bt(e,0,0,0,1):(bt(e,vt(s[0]),vt(s[1]),vt(s[2]),l),St(t,e),e);case"hsla":return 4!==s.length?void bt(e,0,0,0,1):(s[3]=yt(s[3]),It(s,e),St(t,e),e);case"hsl":return 3!==s.length?void bt(e,0,0,0,1):(It(s,e),St(t,e),e);default:return}}bt(e,0,0,0,1)}else{if(4===n.length)return(h=parseInt(n.substr(1),16))>=0&&h<=4095?(bt(e,(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1),St(t,e),e):void bt(e,0,0,0,1);if(7===n.length){var h=parseInt(n.substr(1),16);return h>=0&&h<=16777215?(bt(e,(16711680&h)>>16,(65280&h)>>8,255&h,1),St(t,e),e):void bt(e,0,0,0,1)}}}}function It(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=yt(t[1]),o=yt(t[2]),a=o<=.5?o*(n+1):o+n-o*n,r=2*o-a;return e=e||[],bt(e,gt(255*xt(r,a,i+1/3)),gt(255*xt(r,a,i)),gt(255*xt(r,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function Tt(t){if(t){var e,i,n=t[0]/255,o=t[1]/255,a=t[2]/255,r=Math.min(n,o,a),s=Math.max(n,o,a),l=s-r,h=(s+r)/2;if(0===l)e=0,i=0;else{i=h<.5?l/(s+r):l/(2-s-r);var u=((s-n)/6+l/2)/l,c=((s-o)/6+l/2)/l,d=((s-a)/6+l/2)/l;n===s?e=d-c:o===s?e=1/3+u-d:a===s&&(e=2/3+c-u),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,h];return null!=t[3]&&f.push(t[3]),f}}function At(t,e){var i=Mt(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0;return Ot(i,4===i.length?"rgba":"rgb")}}function Ct(t){var e=Mt(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function Dt(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),o=Math.floor(n),a=Math.ceil(n),r=e[o],s=e[a],l=n-o;return i[0]=gt(_t(r[0],s[0],l)),i[1]=gt(_t(r[1],s[1],l)),i[2]=gt(_t(r[2],s[2],l)),i[3]=mt(_t(r[3],s[3],l)),i}}function Lt(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),o=Math.floor(n),a=Math.ceil(n),r=Mt(e[o]),s=Mt(e[a]),l=n-o,h=Ot([gt(_t(r[0],s[0],l)),gt(_t(r[1],s[1],l)),gt(_t(r[2],s[2],l)),mt(_t(r[3],s[3],l))],"rgba");return i?{color:h,leftIndex:o,rightIndex:a,value:n}:h}}function kt(t,e,i,n){if(t=Mt(t))return t=Tt(t),null!=e&&(t[0]=pt(e)),null!=i&&(t[1]=yt(i)),null!=n&&(t[2]=yt(n)),Ot(It(t),"rgba")}function Pt(t,e){if((t=Mt(t))&&null!=e)return t[3]=mt(e),Ot(t,"rgba")}function Ot(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}function zt(t,e){return t[e]}function Nt(t,e,i){t[e]=i}function Et(t,e,i){return(e-t)*i+t}function Rt(t,e,i){return i>.5?e:t}function Vt(t,e,i,n,o){var a=t.length;if(1==o)for(s=0;so)t.length=o;else for(r=n;r=0&&!(m[i]<=e);i--);i=Math.min(i,h-2)}else{for(i=L;ie);i++);i=Math.min(i-1,h-2)}L=i,k=e;var n=m[i+1]-m[i];if(0!==n)if(I=(e-m[i])/n,l)if(A=v[i],T=v[0===i?i:i-1],C=v[i>h-2?h-1:i+1],D=v[i>h-3?h-1:i+2],d)Wt(T,A,C,D,I,I*I,I*I*I,r(t,o),p);else{if(f)a=Wt(T,A,C,D,I,I*I,I*I*I,P,1),a=Zt(P);else{if(g)return Rt(A,C,I);a=Ht(T,A,C,D,I,I*I,I*I*I)}s(t,o,a)}else if(d)Vt(v[i],v[i+1],I,r(t,o),p);else{var a;if(f)Vt(v[i],v[i+1],I,P,1),a=Zt(P);else{if(g)return Rt(v[i],v[i+1],I);a=Et(v[i],v[i+1],I)}s(t,o,a)}},ondestroy:i});return e&&"spline"!==e&&(O.easing=e),O}}}function jt(t,e,i,n){i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),this.x=t,this.y=e,this.width=i,this.height=n}function qt(t){for(var e=0;t>=qy;)e|=1&t,t>>=1;return t+e}function Yt(t,e,i,n){var o=e+1;if(o===i)return 1;if(n(t[o++],t[e])<0){for(;o=0;)o++;return o-e}function $t(t,e,i){for(i--;e>>1])<0?l=a:s=a+1;var h=n-s;switch(h){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;h>0;)t[s+h]=t[s+h-1],h--}t[s]=r}}function Jt(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])>0){for(s=n-o;l0;)r=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}else{for(s=o+1;ls&&(l=s);var h=r;r=o-l,l=o-h}for(r++;r>>1);a(t,e[i+u])>0?r=u+1:l=u}return l}function Qt(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])<0){for(s=o+1;ls&&(l=s);var h=r;r=o-l,l=o-h}else{for(s=n-o;l=0;)r=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}for(r++;r>>1);a(t,e[i+u])<0?l=u:r=u+1}return l}function te(t,e){function i(i){var s=a[i],h=r[i],u=a[i+1],c=r[i+1];r[i]=h+c,i===l-3&&(a[i+1]=a[i+2],r[i+1]=r[i+2]),l--;var d=Qt(t[u],t,s,h,0,e);s+=d,0!==(h-=d)&&0!==(c=Jt(t[s+h-1],t,u,c,c-1,e))&&(h<=c?n(s,h,u,c):o(s,h,u,c))}function n(i,n,o,a){var r=0;for(r=0;r=Yy||f>=Yy);if(g)break;p<0&&(p=0),p+=2}if((s=p)<1&&(s=1),1===n){for(r=0;r=0;r--)t[f+r]=t[d+r];if(0===n){v=!0;break}}if(t[c--]=h[u--],1==--a){v=!0;break}if(0!=(m=a-Jt(t[l],h,0,a,a-1,e))){for(a-=m,f=(c-=m)+1,d=(u-=m)+1,r=0;r=Yy||m>=Yy);if(v)break;g<0&&(g=0),g+=2}if((s=g)<1&&(s=1),1===a){for(f=(c-=n)+1,d=(l-=n)+1,r=n-1;r>=0;r--)t[f+r]=t[d+r];t[c]=h[u]}else{if(0===a)throw new Error;for(d=c-(a-1),r=0;r=0;r--)t[f+r]=t[d+r];t[c]=h[u]}else for(d=c-(a-1),r=0;r1;){var t=l-2;if(t>=1&&r[t-1]<=r[t]+r[t+1]||t>=2&&r[t-2]<=r[t]+r[t-1])r[t-1]r[t+1])break;i(t)}},this.forceMergeRuns=function(){for(;l>1;){var t=l-2;t>0&&r[t-1]s&&(l=s),Kt(t,i,i+l,i+a,e),a=l}r.pushRun(i,a),r.mergeRuns(),o-=a,i+=a}while(0!==o);r.forceMergeRuns()}}function ie(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}function ne(t,e,i){var n=null==e.x?0:e.x,o=null==e.x2?1:e.x2,a=null==e.y?0:e.y,r=null==e.y2?0:e.y2;return e.global||(n=n*i.width+i.x,o=o*i.width+i.x,a=a*i.height+i.y,r=r*i.height+i.y),t.createLinearGradient(n,a,o,r)}function oe(t,e,i){var n=i.width,o=i.height,a=Math.min(n,o),r=null==e.x?.5:e.x,s=null==e.y?.5:e.y,l=null==e.r?.5:e.r;return e.global||(r=r*n+i.x,s=s*o+i.y,l*=a),t.createRadialGradient(r,s,0,r,s,l)}function ae(){return!1}function re(t,e,i){var n=iy(),o=e.getWidth(),a=e.getHeight(),r=n.style;return r.position="absolute",r.left=0,r.top=0,r.width=o+"px",r.height=a+"px",n.width=o*i,n.height=a*i,n.setAttribute("data-zr-dom-id",t),n}function se(t){if("string"==typeof t){var e=ax.get(t);return e&&e.image}return t}function le(t,e,i,n,o){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!i)return e;var a=ax.get(t),r={hostEl:i,cb:n,cbPayload:o};return a?!ue(e=a.image)&&a.pending.push(r):(!e&&(e=new Image),e.onload=he,ax.put(t,e.__cachedImgObj={image:e,pending:[r]}),e.src=e.__zrImageSrc=t),e}return t}return e}function he(){var t=this.__cachedImgObj;this.onload=this.__cachedImgObj=null;for(var e=0;elx&&(sx=0,rx={}),sx++,rx[i]=o,o}function de(t,e,i,n,o,a,r){return a?ge(t,e,i,n,o,a,r):fe(t,e,i,n,o,r)}function fe(t,e,i,n,o,a){var r=Me(t,e,o,a),s=ce(t,e);o&&(s+=o[1]+o[3]);var l=r.outerHeight,h=new jt(pe(0,s,i),me(0,l,n),s,l);return h.lineHeight=r.lineHeight,h}function ge(t,e,i,n,o,a,r){var s=Ie(t,{rich:a,truncate:r,font:e,textAlign:i,textPadding:o}),l=s.outerWidth,h=s.outerHeight;return new jt(pe(0,l,i),me(0,h,n),l,h)}function pe(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function me(t,e,i){return"middle"===i?t-=e/2:"bottom"===i&&(t-=e),t}function ve(t,e,i){var n=e.x,o=e.y,a=e.height,r=e.width,s=a/2,l="left",h="top";switch(t){case"left":n-=i,o+=s,l="right",h="middle";break;case"right":n+=i+r,o+=s,h="middle";break;case"top":n+=r/2,o-=i,l="center",h="bottom";break;case"bottom":n+=r/2,o+=a+i,l="center";break;case"inside":n+=r/2,o+=s,l="center",h="middle";break;case"insideLeft":n+=i,o+=s,h="middle";break;case"insideRight":n+=r-i,o+=s,l="right",h="middle";break;case"insideTop":n+=r/2,o+=i,l="center";break;case"insideBottom":n+=r/2,o+=a-i,l="center",h="bottom";break;case"insideTopLeft":n+=i,o+=i;break;case"insideTopRight":n+=r-i,o+=i,l="right";break;case"insideBottomLeft":n+=i,o+=a-i,h="bottom";break;case"insideBottomRight":n+=r-i,o+=a-i,l="right",h="bottom"}return{x:n,y:o,textAlign:l,textVerticalAlign:h}}function ye(t,e,i,n,o){if(!e)return"";var a=(t+"").split("\n");o=xe(e,i,n,o);for(var r=0,s=a.length;r=r;l++)s-=r;var h=ce(i);return h>s&&(i="",h=0),s=t-h,n.ellipsis=i,n.ellipsisWidth=h,n.contentWidth=s,n.containerWidth=t,n}function _e(t,e){var i=e.containerWidth,n=e.font,o=e.contentWidth;if(!i)return"";var a=ce(t,n);if(a<=i)return t;for(var r=0;;r++){if(a<=o||r>=e.maxIterations){t+=e.ellipsis;break}var s=0===r?be(t,o,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(t.length*o/a):0;a=ce(t=t.substr(0,s),n)}return""===t&&(t=e.placeholder),t}function be(t,e,i,n){for(var o=0,a=0,r=t.length;al)t="",a=[];else if(null!=h)for(var u=xe(h-(i?i[1]+i[3]:0),e,n.ellipsis,{minChar:n.minChar,placeholder:n.placeholder}),c=0,d=a.length;co&&Te(i,t.substring(o,a)),Te(i,n[2],n[1]),o=hx.lastIndex}of)return{lines:[],width:0,height:0};k.textWidth=ce(k.text,_);var w=y.textWidth,S=null==w||"auto"===w;if("string"==typeof w&&"%"===w.charAt(w.length-1))k.percentWidth=w,h.push(k),w=0;else{if(S){w=k.textWidth;var M=y.textBackgroundColor,I=M&&M.image;I&&ue(I=se(I))&&(w=Math.max(w,I.width*b/I.height))}var C=x?x[1]+x[3]:0;w+=C;var D=null!=d?d-m:null;null!=D&&Dl&&(i*=l/(c=i+n),n*=l/c),o+a>l&&(o*=l/(c=o+a),a*=l/c),n+o>h&&(n*=h/(c=n+o),o*=h/c),i+a>h&&(i*=h/(c=i+a),a*=h/c),t.moveTo(r+i,s),t.lineTo(r+l-n,s),0!==n&&t.quadraticCurveTo(r+l,s,r+l,s+n),t.lineTo(r+l,s+h-o),0!==o&&t.quadraticCurveTo(r+l,s+h,r+l-o,s+h),t.lineTo(r+a,s+h),0!==a&&t.quadraticCurveTo(r,s+h,r,s+h-a),t.lineTo(r,s+i),0!==i&&t.quadraticCurveTo(r,s,r+i,s)}function De(t){return Le(t),d(t.rich,Le),t}function Le(t){if(t){t.font=Ae(t);var e=t.textAlign;"middle"===e&&(e="center"),t.textAlign=null==e||dx[e]?e:"left";var i=t.textVerticalAlign||t.textBaseline;"center"===i&&(i="middle"),t.textVerticalAlign=null==i||fx[i]?i:"top",t.textPadding&&(t.textPadding=D(t.textPadding))}}function ke(t,e,i,n,o){n.rich?Oe(t,e,i,n,o):Pe(t,e,i,n,o)}function Pe(t,e,i,n,o){var a=We(e,"font",n.font||ux),r=n.textPadding,s=t.__textCotentBlock;s&&!t.__dirty||(s=t.__textCotentBlock=Me(i,a,r,n.truncate));var l=s.outerHeight,h=s.lines,u=s.lineHeight,c=Ge(l,n,o),d=c.baseX,f=c.baseY,g=c.textAlign,p=c.textVerticalAlign;Ne(e,n,o,d,f);var m=me(f,l,p),v=d,y=m,x=Re(n);if(x||r){var _=ce(i,a);r&&(_+=r[1]+r[3]);var b=pe(d,_,g);x&&Ve(t,e,n,b,m,_,l),r&&(v=Ue(d,g,r),y+=r[0])}We(e,"textAlign",g||"left"),We(e,"textBaseline","middle"),We(e,"shadowBlur",n.textShadowBlur||0),We(e,"shadowColor",n.textShadowColor||"transparent"),We(e,"shadowOffsetX",n.textShadowOffsetX||0),We(e,"shadowOffsetY",n.textShadowOffsetY||0),y+=u/2;var w=n.textStrokeWidth,S=He(n.textStroke,w),M=Fe(n.textFill);S&&(We(e,"lineWidth",w),We(e,"strokeStyle",S)),M&&We(e,"fillStyle",M);for(var I=0;I=0&&"right"===(_=w[D]).textAlign;)Ee(t,e,_,n,M,v,C,"right"),I-=_.width,C-=_.width,D--;for(A+=(a-(A-m)-(y-C)-I)/2;T<=D;)Ee(t,e,_=w[T],n,M,v,A+_.width/2,"center"),A+=_.width,T++;v+=M}}function Ne(t,e,i,n,o){if(i&&e.textRotation){var a=e.textOrigin;"center"===a?(n=i.width/2+i.x,o=i.height/2+i.y):a&&(n=a[0]+i.x,o=a[1]+i.y),t.translate(n,o),t.rotate(-e.textRotation),t.translate(-n,-o)}}function Ee(t,e,i,n,o,a,r,s){var l=n.rich[i.styleName]||{},h=i.textVerticalAlign,u=a+o/2;"top"===h?u=a+i.height/2:"bottom"===h&&(u=a+o-i.height/2),!i.isLineHolder&&Re(l)&&Ve(t,e,l,"right"===s?r-i.width:"center"===s?r-i.width/2:r,u-i.height/2,i.width,i.height);var c=i.textPadding;c&&(r=Ue(r,s,c),u-=i.height/2-c[2]-i.textHeight/2),We(e,"shadowBlur",A(l.textShadowBlur,n.textShadowBlur,0)),We(e,"shadowColor",l.textShadowColor||n.textShadowColor||"transparent"),We(e,"shadowOffsetX",A(l.textShadowOffsetX,n.textShadowOffsetX,0)),We(e,"shadowOffsetY",A(l.textShadowOffsetY,n.textShadowOffsetY,0)),We(e,"textAlign",s),We(e,"textBaseline","middle"),We(e,"font",i.font||ux);var d=He(l.textStroke||n.textStroke,g),f=Fe(l.textFill||n.textFill),g=T(l.textStrokeWidth,n.textStrokeWidth);d&&(We(e,"lineWidth",g),We(e,"strokeStyle",d),e.strokeText(i.text,r,u)),f&&(We(e,"fillStyle",f),e.fillText(i.text,r,u))}function Re(t){return t.textBackgroundColor||t.textBorderWidth&&t.textBorderColor}function Ve(t,e,i,n,o,a,r){var s=i.textBackgroundColor,l=i.textBorderWidth,h=i.textBorderColor,u=_(s);if(We(e,"shadowBlur",i.textBoxShadowBlur||0),We(e,"shadowColor",i.textBoxShadowColor||"transparent"),We(e,"shadowOffsetX",i.textBoxShadowOffsetX||0),We(e,"shadowOffsetY",i.textBoxShadowOffsetY||0),u||l&&h){e.beginPath();var c=i.textBorderRadius;c?Ce(e,{x:n,y:o,width:a,height:r,r:c}):e.rect(n,o,a,r),e.closePath()}if(u)We(e,"fillStyle",s),e.fill();else if(b(s)){var d=s.image;(d=le(d,null,t,Be,s))&&ue(d)&&e.drawImage(d,n,o,a,r)}l&&h&&(We(e,"lineWidth",l),We(e,"strokeStyle",h),e.stroke())}function Be(t,e){e.image=t}function Ge(t,e,i){var n=e.x||0,o=e.y||0,a=e.textAlign,r=e.textVerticalAlign;if(i){var s=e.textPosition;if(s instanceof Array)n=i.x+Ze(s[0],i.width),o=i.y+Ze(s[1],i.height);else{var l=ve(s,i,e.textDistance);n=l.x,o=l.y,a=a||l.textAlign,r=r||l.textVerticalAlign}var h=e.textOffset;h&&(n+=h[0],o+=h[1])}return{baseX:n,baseY:o,textAlign:a,textVerticalAlign:r}}function We(t,e,i){return t[e]=i,t[e]}function He(t,e){return null==t||e<=0||"transparent"===t||"none"===t?null:t.image||t.colorStops?"#000":t}function Fe(t){return null==t||"none"===t?null:t.image||t.colorStops?"#000":t}function Ze(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t}function Ue(t,e,i){return"right"===e?t-i[1]:"center"===e?t+i[3]/2-i[1]/2:t+i[3]}function Xe(t,e){return null!=t&&(t||e.textBackgroundColor||e.textBorderWidth&&e.textBorderColor||e.textPadding)}function je(t){t=t||{},Fy.call(this,t);for(var e in t)t.hasOwnProperty(e)&&"style"!==e&&(this[e]=t[e]);this.style=new Jy(t.style,this),this._rect=null,this.__clipPaths=[]}function qe(t){je.call(this,t)}function Ye(t){return parseInt(t,10)}function $e(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function Ke(t){t.__unusedCount++}function Je(t){1==t.__unusedCount&&t.clear()}function Qe(t,e,i){return mx.copy(t.getBoundingRect()),t.transform&&mx.applyTransform(t.transform),vx.width=e,vx.height=i,!mx.intersect(vx)}function ti(t,e){if(t==e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=0){var o="touchend"!=n?e.targetTouches[0]:e.changedTouches[0];o&&oi(t,o,e,i)}else oi(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;var a=e.button;return null==e.which&&void 0!==a&&_x.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function si(t,e,i){xx?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function li(t,e,i){xx?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}function hi(t){return t.which>1}function ui(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function ci(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}function di(t){return"mousewheel"===t&&Uv.browser.firefox?"DOMMouseScroll":t}function fi(t,e,i){var n=t._gestureMgr;"start"===i&&n.clear();var o=n.recognize(e,t.handler.findHover(e.zrX,e.zrY,null).target,t.dom);if("end"===i&&n.clear(),o){var a=o.type;e.gestureEvent=a,t.handler.dispatchToElement({target:o.target},a,o.event)}}function gi(t){t._touching=!0,clearTimeout(t._touchTimer),t._touchTimer=setTimeout(function(){t._touching=!1},700)}function pi(t){var e=t.pointerType;return"pen"===e||"touch"===e}function mi(t){function e(t,e){return function(){if(!e._touching)return t.apply(e,arguments)}}d(Tx,function(e){t._handlers[e]=m(Dx[e],t)}),d(Cx,function(e){t._handlers[e]=m(Dx[e],t)}),d(Ix,function(i){t._handlers[i]=e(Dx[i],t)})}function vi(t){function e(e,i){d(e,function(e){si(t,di(e),i._handlers[e])},i)}fy.call(this),this.dom=t,this._touching=!1,this._touchTimer,this._gestureMgr=new Sx,this._handlers={},mi(this),Uv.pointerEventsSupported?e(Cx,this):(Uv.touchEventsSupported&&e(Tx,this),e(Ix,this))}function yi(t,e){var i=new zx(Fv(),t,e);return Ox[i.id]=i,i}function xi(t,e){Px[t]=e}function _i(t){delete Ox[t]}function bi(t){return t.replace(/^\s+/,"").replace(/\s+$/,"")}function wi(t,e,i,n){var o=e[1]-e[0],a=i[1]-i[0];if(0===o)return 0===a?i[0]:(i[0]+i[1])/2;if(n)if(o>0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/o*a+i[0]}function Si(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?bi(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t}function Mi(t,e,i){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),i?t:+t}function Ii(t){return t.sort(function(t,e){return t-e}),t}function Ti(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Ai(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}function Ci(t,e){var i=Math.log,n=Math.LN10,o=Math.floor(i(t[1]-t[0])/n),a=Math.round(i(Math.abs(e[1]-e[0]))/n),r=Math.min(Math.max(-o+a,0),20);return isFinite(r)?r:20}function Di(t,e,i){if(!t[e])return 0;var n=g(t,function(t,e){return t+(isNaN(e)?0:e)},0);if(0===n)return 0;for(var o=Math.pow(10,i),a=f(t,function(t){return(isNaN(t)?0:t)/n*o*100}),r=100*o,s=f(a,function(t){return Math.floor(t)}),l=g(s,function(t,e){return t+e},0),h=f(a,function(t,e){return t-s[e]});lu&&(u=h[d],c=d);++s[c],h[c]=0,++l}return s[e]/o}function Li(t){var e=2*Math.PI;return(t%e+e)%e}function ki(t){return t>-Ex&&t=-20?+t.toFixed(n<0?-n:0):t}function Ei(t){function e(t,i,n){return t.interval[n]=0}function Vi(t){return isNaN(t)?"-":(t=(t+"").split("."))[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function Bi(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}function Gi(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Wi(t,e,i){y(e)||(e=[e]);var n=e.length;if(!n)return"";for(var o=e[0].$vars||[],a=0;a':""}function Zi(t,e,i){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var n=Pi(e),o=i?"UTC":"",a=n["get"+o+"FullYear"](),r=n["get"+o+"Month"]()+1,s=n["get"+o+"Date"](),l=n["get"+o+"Hours"](),h=n["get"+o+"Minutes"](),u=n["get"+o+"Seconds"]();return t=t.replace("MM",Fx(r)).replace("M",r).replace("yyyy",a).replace("yy",a%100).replace("dd",Fx(s)).replace("d",s).replace("hh",Fx(l)).replace("h",l).replace("mm",Fx(h)).replace("m",h).replace("ss",Fx(u)).replace("s",u)}function Ui(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function Xi(t,e,i){return t[Yx+e]=i}function ji(t,e){return t[Yx+e]}function qi(t,e){return t.hasOwnProperty(Yx+e)}function Yi(t){var e={main:"",sub:""};return t&&(t=t.split(jx),e.main=t[0]||"",e.sub=t[1]||""),e}function $i(t){L(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(t),'componentType "'+t+'" illegal')}function Ki(t,e){t.$constructor=t,t.extend=function(t){var e=this,i=function(){t.$constructor?t.$constructor.apply(this,arguments):e.apply(this,arguments)};return a(i.prototype,t),i.extend=this.extend,i.superCall=Ji,i.superApply=Qi,h(i,this),i.superClass=e,i}}function Ji(t,e){var i=C(arguments,2);return this.superClass.prototype[e].apply(t,i)}function Qi(t,e,i){return this.superClass.prototype[e].apply(t,i)}function tn(t,e){function i(t){var e=n[t.main];return e&&e[qx]||((e=n[t.main]={})[qx]=!0),e}e=e||{};var n={};if(t.registerClass=function(t,e){return e&&($i(e),(e=Yi(e)).sub?e.sub!==qx&&(i(e)[e.sub]=t):n[e.main]=t),t},t.getClass=function(t,e,i){var o=n[t];if(o&&o[qx]&&(o=e?o[e]:null),i&&!o)throw new Error(e?"Component "+t+"."+(e||"")+" not exists. Load it first.":t+".type should be specified.");return o},t.getClassesByMainType=function(t){t=Yi(t);var e=[],i=n[t.main];return i&&i[qx]?d(i,function(t,i){i!==qx&&e.push(t)}):e.push(i),e},t.hasClass=function(t){return t=Yi(t),!!n[t.main]},t.getAllClassMainTypes=function(){var t=[];return d(n,function(e,i){t.push(i)}),t},t.hasSubTypes=function(t){t=Yi(t);var e=n[t.main];return e&&e[qx]},t.parseClassType=Yi,e.registerWhenExtend){var o=t.extend;o&&(t.extend=function(e){var i=o.call(this,e);return t.registerClass(i,e.type)})}return t}function en(t){return t>-n_&&tn_||t<-n_}function on(t,e,i,n,o){var a=1-o;return a*a*(a*t+3*o*e)+o*o*(o*n+3*a*i)}function an(t,e,i,n,o){var a=1-o;return 3*(((e-t)*a+2*(i-e)*o)*a+(n-i)*o*o)}function rn(t,e,i,n,o,a){var r=n+3*(e-i)-t,s=3*(i-2*e+t),l=3*(e-t),h=t-o,u=s*s-3*r*l,c=s*l-9*r*h,d=l*l-3*s*h,f=0;if(en(u)&&en(c))en(s)?a[0]=0:(M=-l/s)>=0&&M<=1&&(a[f++]=M);else{var g=c*c-4*u*d;if(en(g)){var p=c/u,m=-p/2;(M=-s/r+p)>=0&&M<=1&&(a[f++]=M),m>=0&&m<=1&&(a[f++]=m)}else if(g>0){var v=i_(g),y=u*s+1.5*r*(-c+v),x=u*s+1.5*r*(-c-v);(M=(-s-((y=y<0?-e_(-y,r_):e_(y,r_))+(x=x<0?-e_(-x,r_):e_(x,r_))))/(3*r))>=0&&M<=1&&(a[f++]=M)}else{var _=(2*u*s-3*r*c)/(2*i_(u*u*u)),b=Math.acos(_)/3,w=i_(u),S=Math.cos(b),M=(-s-2*w*S)/(3*r),m=(-s+w*(S+a_*Math.sin(b)))/(3*r),I=(-s+w*(S-a_*Math.sin(b)))/(3*r);M>=0&&M<=1&&(a[f++]=M),m>=0&&m<=1&&(a[f++]=m),I>=0&&I<=1&&(a[f++]=I)}}return f}function sn(t,e,i,n,o){var a=6*i-12*e+6*t,r=9*e+3*n-3*t-9*i,s=3*e-3*t,l=0;if(en(r))nn(a)&&(c=-s/a)>=0&&c<=1&&(o[l++]=c);else{var h=a*a-4*r*s;if(en(h))o[0]=-a/(2*r);else if(h>0){var u=i_(h),c=(-a+u)/(2*r),d=(-a-u)/(2*r);c>=0&&c<=1&&(o[l++]=c),d>=0&&d<=1&&(o[l++]=d)}}return l}function ln(t,e,i,n,o,a){var r=(e-t)*o+t,s=(i-e)*o+e,l=(n-i)*o+i,h=(s-r)*o+r,u=(l-s)*o+s,c=(u-h)*o+h;a[0]=t,a[1]=r,a[2]=h,a[3]=c,a[4]=c,a[5]=u,a[6]=l,a[7]=n}function hn(t,e,i,n,o,a,r,s,l,h,u){var c,d,f,g,p,m=.005,v=1/0;s_[0]=l,s_[1]=h;for(var y=0;y<1;y+=.05)l_[0]=on(t,i,o,r,y),l_[1]=on(e,n,a,s,y),(g=uy(s_,l_))=0&&g=0&&c<=1&&(o[l++]=c);else{var h=r*r-4*a*s;if(en(h))(c=-r/(2*a))>=0&&c<=1&&(o[l++]=c);else if(h>0){var u=i_(h),c=(-r+u)/(2*a),d=(-r-u)/(2*a);c>=0&&c<=1&&(o[l++]=c),d>=0&&d<=1&&(o[l++]=d)}}return l}function fn(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function gn(t,e,i,n,o){var a=(e-t)*n+t,r=(i-e)*n+e,s=(r-a)*n+a;o[0]=t,o[1]=a,o[2]=s,o[3]=s,o[4]=r,o[5]=i}function pn(t,e,i,n,o,a,r,s,l){var h,u=.005,c=1/0;s_[0]=r,s_[1]=s;for(var d=0;d<1;d+=.05)l_[0]=un(t,i,o,d),l_[1]=un(e,n,a,d),(m=uy(s_,l_))=0&&m1e-4)return s[0]=t-i,s[1]=e-n,l[0]=t+i,void(l[1]=e+n);if(p_[0]=f_(o)*i+t,p_[1]=d_(o)*n+e,m_[0]=f_(a)*i+t,m_[1]=d_(a)*n+e,h(s,p_,m_),u(l,p_,m_),(o%=g_)<0&&(o+=g_),(a%=g_)<0&&(a+=g_),o>a&&!r?a+=g_:oo&&(v_[0]=f_(f)*i+t,v_[1]=d_(f)*n+e,h(s,v_,s),u(l,v_,l))}function bn(t,e,i,n,o,a,r){if(0===o)return!1;var s=o,l=0,h=t;if(r>e+s&&r>n+s||rt+s&&a>i+s||ae+c&&u>n+c&&u>a+c&&u>s+c||ut+c&&h>i+c&&h>o+c&&h>r+c||he+h&&l>n+h&&l>a+h||lt+h&&s>i+h&&s>o+h||si||u+ho&&(o+=z_);var d=Math.atan2(l,s);return d<0&&(d+=z_),d>=n&&d<=o||d+z_>=n&&d+z_<=o}function Tn(t,e,i,n,o,a){if(a>e&&a>n||ao?r:0}function An(t,e){return Math.abs(t-e)e&&h>n&&h>a&&h>s||h1&&Cn(),c=on(e,n,a,s,B_[0]),g>1&&(d=on(e,n,a,s,B_[1]))),2==g?me&&s>n&&s>a||s=0&&h<=1){for(var u=0,c=un(e,n,a,h),d=0;di||s<-i)return 0;h=Math.sqrt(i*i-s*s);V_[0]=-h,V_[1]=h;var l=Math.abs(n-o);if(l<1e-4)return 0;if(l%E_<1e-4){n=0,o=E_;g=a?1:-1;return r>=V_[0]+t&&r<=V_[1]+t?g:0}if(a){var h=n;n=Mn(o),o=Mn(h)}else n=Mn(n),o=Mn(o);n>o&&(o+=E_);for(var u=0,c=0;c<2;c++){var d=V_[c];if(d+t>r){var f=Math.atan2(s,d),g=a?1:-1;f<0&&(f=E_+f),(f>=n&&f<=o||f+E_>=n&&f+E_<=o)&&(f>Math.PI/2&&f<1.5*Math.PI&&(g=-g),u+=g)}}return u}function Pn(t,e,i,n,o){for(var a=0,r=0,s=0,l=0,h=0,u=0;u1&&(i||(a+=Tn(r,s,l,h,n,o))),1==u&&(l=r=t[u],h=s=t[u+1]),c){case N_.M:r=l=t[u++],s=h=t[u++];break;case N_.L:if(i){if(bn(r,s,t[u],t[u+1],e,n,o))return!0}else a+=Tn(r,s,t[u],t[u+1],n,o)||0;r=t[u++],s=t[u++];break;case N_.C:if(i){if(wn(r,s,t[u++],t[u++],t[u++],t[u++],t[u],t[u+1],e,n,o))return!0}else a+=Dn(r,s,t[u++],t[u++],t[u++],t[u++],t[u],t[u+1],n,o)||0;r=t[u++],s=t[u++];break;case N_.Q:if(i){if(Sn(r,s,t[u++],t[u++],t[u],t[u+1],e,n,o))return!0}else a+=Ln(r,s,t[u++],t[u++],t[u],t[u+1],n,o)||0;r=t[u++],s=t[u++];break;case N_.A:var d=t[u++],f=t[u++],g=t[u++],p=t[u++],m=t[u++],v=t[u++],y=(t[u++],1-t[u++]),x=Math.cos(m)*g+d,_=Math.sin(m)*p+f;u>1?a+=Tn(r,s,x,_,n,o):(l=x,h=_);var b=(n-d)*p/g+d;if(i){if(In(d,f,p,m,m+v,y,e,b,o))return!0}else a+=kn(d,f,p,m,m+v,y,b,o);r=Math.cos(m+v)*g+d,s=Math.sin(m+v)*p+f;break;case N_.R:l=r=t[u++],h=s=t[u++];var x=l+t[u++],_=h+t[u++];if(i){if(bn(l,h,x,h,e,n,o)||bn(x,h,x,_,e,n,o)||bn(x,_,l,_,e,n,o)||bn(l,_,l,h,e,n,o))return!0}else a+=Tn(x,h,x,_,n,o),a+=Tn(l,_,l,h,n,o);break;case N_.Z:if(i){if(bn(r,s,l,h,e,n,o))return!0}else a+=Tn(r,s,l,h,n,o);r=l,s=h}}return i||An(s,h)||(a+=Tn(r,s,l,h,n,o)||0),0!==a}function On(t,e,i){return Pn(t,0,!1,e,i)}function zn(t,e,i,n){return Pn(t,e,!0,i,n)}function Nn(t){je.call(this,t),this.path=null}function En(t,e,i,n,o,a,r,s,l,h,u){var c=l*(J_/180),d=K_(c)*(t-i)/2+$_(c)*(e-n)/2,f=-1*$_(c)*(t-i)/2+K_(c)*(e-n)/2,g=d*d/(r*r)+f*f/(s*s);g>1&&(r*=Y_(g),s*=Y_(g));var p=(o===a?-1:1)*Y_((r*r*(s*s)-r*r*(f*f)-s*s*(d*d))/(r*r*(f*f)+s*s*(d*d)))||0,m=p*r*f/s,v=p*-s*d/r,y=(t+i)/2+K_(c)*m-$_(c)*v,x=(e+n)/2+$_(c)*m+K_(c)*v,_=eb([1,0],[(d-m)/r,(f-v)/s]),b=[(d-m)/r,(f-v)/s],w=[(-1*d-m)/r,(-1*f-v)/s],S=eb(b,w);tb(b,w)<=-1&&(S=J_),tb(b,w)>=1&&(S=0),0===a&&S>0&&(S-=2*J_),1===a&&S<0&&(S+=2*J_),u.addData(h,y,x,r,s,_,S,c,a)}function Rn(t){if(!t)return[];var e,i=t.replace(/-/g," -").replace(/ /g," ").replace(/ /g,",").replace(/,,/g,",");for(e=0;e0&&""===f[0]&&f.shift();for(var g=0;g=2){if(o&&"spline"!==o){var a=hb(n,o,i,e.smoothConstraint);t.moveTo(n[0][0],n[0][1]);for(var r=n.length,s=0;s<(i?r:r-1);s++){var l=a[2*s],h=a[2*s+1],u=n[(s+1)%r];t.bezierCurveTo(l[0],l[1],h[0],h[1],u[0],u[1])}}else{"spline"===o&&(n=lb(n,i)),t.moveTo(n[0][0],n[0][1]);for(var s=1,c=n.length;s=0)&&(n={textFill:null,textStroke:t.textStroke,textStrokeWidth:t.textStrokeWidth},t.textFill="#fff",null==t.textStroke&&(t.textStroke=i.autoColor,null==t.textStrokeWidth&&(t.textStrokeWidth=2))),n}function xo(t){var e=t.insideRollback;e&&(t.textFill=e.textFill,t.textStroke=e.textStroke,t.textStrokeWidth=e.textStrokeWidth)}function _o(t,e){var i=e||e.getModel("textStyle");return[t.fontStyle||i&&i.getShallow("fontStyle")||"",t.fontWeight||i&&i.getShallow("fontWeight")||"",(t.fontSize||i&&i.getShallow("fontSize")||12)+"px",t.fontFamily||i&&i.getShallow("fontFamily")||"sans-serif"].join(" ")}function bo(t,e,i,n,o,a){if("function"==typeof o&&(a=o,o=null),n&&n.isAnimationEnabled()){var r=t?"Update":"",s=n.getShallow("animationDuration"+r),l=n.getShallow("animationEasing"+r),h=n.getShallow("animationDelay"+r);"function"==typeof h&&(h=h(o,n.getAnimationDelayParams?n.getAnimationDelayParams(e,o):null)),"function"==typeof s&&(s=s(o)),s>0?e.animateTo(i,s,h||0,l,a,!!a):(e.stopAnimation(),e.attr(i),a&&a())}else e.stopAnimation(),e.attr(i),a&&a()}function wo(t,e,i,n,o){bo(!0,t,e,i,n,o)}function So(t,e,i,n,o){bo(!1,t,e,i,n,o)}function Mo(t,e){for(var i=at([]);t&&t!==e;)st(i,t.getLocalTransform(),i),t=t.parent;return i}function Io(t,e,i){return e&&!c(e)&&(e=by.getLocalTransform(e)),i&&(e=ct([],e)),$([],t,e)}function To(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),o=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),a=["left"===t?-n:"right"===t?n:0,"top"===t?-o:"bottom"===t?o:0];return a=Io(a,e,i),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function Ao(t,e,i,n){function o(t){var e={position:V(t.position),rotation:t.rotation};return t.shape&&(e.shape=a({},t.shape)),e}if(t&&e){var r=function(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=r[t.anid];if(e){var n=o(t);t.attr(o(e)),wo(t,n,i,t.dataIndex)}}})}}function Co(t,e){return f(t,function(t){var i=t[0];i=wb(i,e.x),i=Sb(i,e.x+e.width);var n=t[1];return n=wb(n,e.y),n=Sb(n,e.y+e.height),[i,n]})}function Do(t,e,i){var n=(e=a({rectHover:!0},e)).style={strokeNoScale:!0};if(i=i||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(n.image=t.slice(8),r(n,i),new qe(e)):Un(t.replace("path://",""),e,i,"center")}function Lo(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function ko(t,e,i){for(var n=0;n=i.length&&i.push({option:t})}}),i}function Bo(t){var e=z();Pb(t,function(t,i){var n=t.exist;n&&e.set(n.id,t)}),Pb(t,function(t,i){var n=t.option;L(!n||null==n.id||!e.get(n.id)||e.get(n.id)===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&e.set(n.id,t),!t.keyInfo&&(t.keyInfo={})}),Pb(t,function(t,i){var n=t.exist,o=t.option,a=t.keyInfo;if(Ob(o)){if(a.name=null!=o.name?o.name+"":n?n.name:"\0-",n)a.id=n.id;else if(null!=o.id)a.id=o.id+"";else{var r=0;do{a.id="\0"+a.name+"\0"+r++}while(e.get(a.id))}e.set(a.id,t)}})}function Go(t){return Ob(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")}function Wo(t,e){function i(t,e,i){for(var n=0,o=t.length;nn||l.newline?(a=0,u=m,r+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(p?-p.y+f.y:0);(c=r+v)>o||l.newline?(a+=s+i,r=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=a,d[1]=r,"horizontal"===t?a=u+i:r=c+i)})}function $o(t,e,i){var n=e.width,o=e.height,a=Si(t.x,n),r=Si(t.y,o),s=Si(t.x2,n),l=Si(t.y2,o);return(isNaN(a)||isNaN(parseFloat(t.x)))&&(a=0),(isNaN(s)||isNaN(parseFloat(t.x2)))&&(s=n),(isNaN(r)||isNaN(parseFloat(t.y)))&&(r=0),(isNaN(l)||isNaN(parseFloat(t.y2)))&&(l=o),i=Gx(i||0),{width:Math.max(s-a-i[1]-i[3],0),height:Math.max(l-r-i[0]-i[2],0)}}function Ko(t,e,i){i=Gx(i||0);var n=e.width,o=e.height,a=Si(t.left,n),r=Si(t.top,o),s=Si(t.right,n),l=Si(t.bottom,o),h=Si(t.width,n),u=Si(t.height,o),c=i[2]+i[0],d=i[1]+i[3],f=t.aspect;switch(isNaN(h)&&(h=n-s-d-a),isNaN(u)&&(u=o-l-c-r),null!=f&&(isNaN(h)&&isNaN(u)&&(f>n/o?h=.8*n:u=.8*o),isNaN(h)&&(h=f*u),isNaN(u)&&(u=h/f)),isNaN(a)&&(a=n-s-h-d),isNaN(r)&&(r=o-l-u-c),t.left||t.right){case"center":a=n/2-h/2-i[3];break;case"right":a=n-h-d}switch(t.top||t.bottom){case"middle":case"center":r=o/2-u/2-i[0];break;case"bottom":r=o-u-c}a=a||0,r=r||0,isNaN(h)&&(h=n-d-a-(s||0)),isNaN(u)&&(u=o-c-r-(l||0));var g=new jt(a+i[3],r+i[0],h,u);return g.margin=i,g}function Jo(t,e,i,n,o){var a=!o||!o.hv||o.hv[0],s=!o||!o.hv||o.hv[1],l=o&&o.boundingMode||"all";if(a||s){var h;if("raw"===l)h="group"===t.type?new jt(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(h=t.getBoundingRect(),t.needLocalTransform()){var u=t.getLocalTransform();(h=h.clone()).applyTransform(u)}e=Ko(r({width:h.width,height:h.height},e),i,n);var c=t.position,d=a?e.x-h.x:0,f=s?e.y-h.y:0;t.attr("position","raw"===l?[d,f]:[c[0]+d,c[1]+f])}}function Qo(t,e){return null!=t[Wb[e][0]]||null!=t[Wb[e][1]]&&null!=t[Wb[e][2]]}function ta(t,e,i){function n(i,n){var r={},l=0,h={},u=0;if(Bb(i,function(e){h[e]=t[e]}),Bb(i,function(t){o(e,t)&&(r[t]=h[t]=e[t]),a(r,t)&&l++,a(h,t)&&u++}),s[n])return a(e,i[1])?h[i[2]]=null:a(e,i[2])&&(h[i[1]]=null),h;if(2!==u&&l){if(l>=2)return r;for(var c=0;c=e:"max"===i?t<=e:t===e}function pa(t,e){return t.join(",")===e.join(",")}function ma(t,e){aw(e=e||{},function(e,i){if(null!=e){var n=t[i];if(Ub.hasClass(i)){e=Oo(e);var o=Vo(n=Oo(n),e);t[i]=sw(o,function(t){return t.option&&t.exist?lw(t.exist,t.option,!0):t.exist||t.option})}else t[i]=lw(n,e,!0)}})}function va(t){var e=t&&t.itemStyle;if(e)for(var i=0,o=dw.length;i=0?n():c=setTimeout(n,-a),h=o};return d.clear=function(){c&&(clearTimeout(c),c=null)},d.debounceNextCall=function(t){l=t},d}function La(t,e,i,n){var o=t[e];if(o){var a=o[ww]||o,r=o[Mw];if(o[Sw]!==i||r!==n){if(null==i||!n)return t[e]=a;(o=t[e]=Da(a,i,"debounce"===n))[ww]=a,o[Mw]=n,o[Sw]=i}return o}}function ka(t,e){var i=t[e];i&&i[ww]&&(t[e]=i[ww])}function Pa(t){return function(e,i,n){e=e&&e.toLowerCase(),fy.prototype[t].call(this,e,i,n)}}function Oa(){fy.call(this)}function za(t,e,n){function o(t,e){return t.prio-e.prio}n=n||{},"string"==typeof e&&(e=Uw[e]),this.id,this.group,this._dom=t;var a=this._zr=yi(t,{renderer:n.renderer||"canvas",devicePixelRatio:n.devicePixelRatio,width:n.width,height:n.height});this._throttledZrFlush=Da(m(a.flush,a),17),(e=i(e))&&vw(e,!0),this._theme=e,this._chartsViews=[],this._chartsMap={},this._componentsViews=[],this._componentsMap={},this._coordSysMgr=new ua,this._api=$a(this),fy.call(this),this._messageCenter=new Oa,this._initEvents(),this.resize=m(this.resize,this),this._pendingActions=[],ee(Zw,o),ee(Ww,o),a.animation.on("frame",this._onframe,this),k(this)}function Na(t,e,i){var n,o=this._model,a=this._coordSysMgr.getCoordinateSystems();e=Fo(o,e);for(var r=0;re.get("hoverLayerThreshold")&&!Uv.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function qa(t,e){var i=0;e.group.traverse(function(t){"group"===t.type||t.ignore||i++});var n=+t.get("progressive"),o=i>t.get("progressiveThreshold")&&n&&!Uv.node;o&&e.group.traverse(function(t){t.isGroup||(t.progressive=o?Math.floor(i++/n):-1,o&&t.stopAnimation(!0))});var a=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.setStyle("blend",a)})}function Ya(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function $a(t){var e=t._coordSysMgr;return a(new ha(t),{getCoordinateSystems:m(e.getCoordinateSystems,e),getComponentByElement:function(e){for(;e;){var i=e.__ecComponentInfo;if(null!=i)return t._model.getComponent(i.mainType,i.index);e=e.parent}}})}function Ka(t){function e(t,e){for(var n=0;n=0?o[s]=new h.constructor(a[s].length):o[s]=a[s]}return n}function xr(t,e,n){function o(t,e,i){cS[e]?t.otherDims[e]=i:(t.coordDim=e,t.coordDimIndex=i,h.set(e,!0))}function a(t,e,i){if(i||null!=e.get(t)){for(var n=0;null!=e.get(t+n);)n++;t+=n}return e.set(t,!0),t}e=e||[],n=n||{},t=(t||[]).slice();var r=(n.dimsDef||[]).slice(),s=z(n.encodeDef),l=z(),h=z(),u=[],c=n.dimCount;if(null==c){var d=_r(e[0]);c=Math.max(y(d)&&d.length||1,t.length,r.length),lS(t,function(t){var e=t.dimsDef;e&&(c=Math.max(c,e.length))})}for(var f=0;f=0&&wr(t)?function(t,e,i,n){return Eo(t)&&(c.hasItemOption=!0),n===u?i:Ro(No(t),h[n])}:function(t,e,i,n){var o=No(t),a=Ro(o&&o[n],h[n]);Eo(t)&&(c.hasItemOption=!0);var r=s&&s.categoryAxesModels;return r&&r[e]&&"string"==typeof a&&(f[e]=f[e]||r[e].getCategories(),(a=l(f[e],a))<0&&!isNaN(a)&&(a=+a)),a};return c.hasItemOption=!1,c.initData(t,d,g),c}function Mr(t){return"category"!==t&&"time"!==t}function Ir(t){return"category"===t?"ordinal":"time"===t?"time":"float"}function Tr(t,e){var i,n=[],o=t&&t.dimensions[t.categoryIndex];if(o&&(i=t.categoryAxesModels[o.name]),i){var a=i.getCategories();if(a){var r=e.length;if(y(e[0])&&e[0].length>1){n=[];for(var s=0;sn&&(r=o.interval=n);var s=o.intervalPrecision=Dr(r);return kr(o.niceTickExtent=[mS(Math.ceil(t[0]/r)*r,s),mS(Math.floor(t[1]/r)*r,s)],t),o}function Dr(t){return Ai(t)+2}function Lr(t,e,i){t[e]=Math.max(Math.min(t[e],i[1]),i[0])}function kr(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Lr(t,0,e),Lr(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function Pr(t,e,i,n){var o=[];if(!t)return o;e[0]1e4)return[];return e[1]>(o.length?o[o.length-1]:i[1])&&o.push(e[1]),o}function Or(t,e){return CS(t,AS(e))}function zr(t,e){var i,n,o,a=t.type,r=e.getMin(),s=e.getMax(),l=null!=r,h=null!=s,u=t.getExtent();return"ordinal"===a?i=(e.get("data")||[]).length:(y(n=e.get("boundaryGap"))||(n=[n||0,n||0]),"boolean"==typeof n[0]&&(n=[0,0]),n[0]=Si(n[0],1),n[1]=Si(n[1],1),o=u[1]-u[0]||Math.abs(u[0])),null==r&&(r="ordinal"===a?i?0:NaN:u[0]-n[0]*o),null==s&&(s="ordinal"===a?i?i-1:NaN:u[1]+n[1]*o),"dataMin"===r?r=u[0]:"function"==typeof r&&(r=r({min:u[0],max:u[1]})),"dataMax"===s?s=u[1]:"function"==typeof s&&(s=s({min:u[0],max:u[1]})),(null==r||!isFinite(r))&&(r=NaN),(null==s||!isFinite(s))&&(s=NaN),t.setBlank(M(r)||M(s)),e.getNeedCrossZero()&&(r>0&&s>0&&!l&&(r=0),r<0&&s<0&&!h&&(s=0)),[r,s]}function Nr(t,e){var i=zr(t,e),n=null!=e.getMin(),o=null!=e.getMax(),a=e.get("splitNumber");"log"===t.type&&(t.base=e.get("logBase"));var r=t.type;t.setExtent(i[0],i[1]),t.niceExtent({splitNumber:a,fixMin:n,fixMax:o,minInterval:"interval"===r||"time"===r?e.get("minInterval"):null,maxInterval:"interval"===r||"time"===r?e.get("maxInterval"):null});var s=e.get("interval");null!=s&&t.setInterval&&t.setInterval(s)}function Er(t,e){if(e=e||t.get("type"))switch(e){case"category":return new pS(t.getCategories(),[1/0,-1/0]);case"value":return new yS;default:return(Ar.getClass(e)||yS).create(t)}}function Rr(t,e,i,n,o){var a,r=0,s=0,l=(n-o)/180*Math.PI,h=1;e.length>40&&(h=Math.floor(e.length/40));for(var u=0;u1?h:(r+1)*h-1}function Vr(t,e){var i=t.scale,n=i.getTicksLabels(),o=i.getTicks();return"string"==typeof e?(e=function(t){return function(e){return t.replace("{value}",null!=e?e:"")}}(e),f(n,e)):"function"==typeof e?f(o,function(i,n){return e(Br(t,i),n)},this):n}function Br(t,e){return"category"===t.type?t.scale.getLabel(e):e}function Gr(t){return b(t)&&null!=t.value?t.value:t+""}function Wr(t,e){if("image"!==this.type){var i=this.style,n=this.shape;n&&"line"===n.symbolType?i.stroke=t:this.__isEmptyBrush?(i.stroke=t,i.fill=e||"#fff"):(i.fill&&(i.fill=t),i.stroke&&(i.stroke=t)),this.dirty(!1)}}function Hr(t,e,i,n,o,a,r){var s=0===t.indexOf("empty");s&&(t=t.substr(5,1).toLowerCase()+t.substr(6));var l;return l=0===t.indexOf("image://")?Xn(t.slice(8),new jt(e,i,n,o),r?"center":"cover"):0===t.indexOf("path://")?Un(t.slice(7),{},new jt(e,i,n,o),r?"center":"cover"):new WS({shape:{symbolType:t,x:e,y:i,width:n,height:o}}),l.__isEmptyBrush=s,l.setColor=Wr,l.setColor(a),l}function Fr(t,e){var i=(t[1]-t[0])/e/2;t[0]+=i,t[1]-=i}function Zr(t,e){return Math.abs(t-e)>1^-(1&s),l=l>>1^-(1&l),o=s+=o,a=l+=a,n.push([s/i,l/i])}return n}function Yr(t){var e,i=Xo(t,"label");if(i.length)e=i[0];else for(var n,o=t.dimensions.slice();o.length&&(e=o.pop(),"ordinal"===(n=t.getDimensionInfo(e).type)||"time"===n););return e}function $r(t,e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array?i.slice():[+i,+i]}function Kr(t){return[t[0]/2,t[1]/2]}function Jr(t,e,i){jy.call(this),this.updateData(t,e,i)}function Qr(t,e){this.parent.drift(t,e)}function ts(t){this.group=new jy,this._symbolCtor=t||Jr}function es(t,e,i){var n=t.getItemLayout(e);return n&&!isNaN(n[0])&&!isNaN(n[1])&&!(i&&i(e))&&"none"!==t.getItemVisual(e,"symbol")}function is(t){return t>=0?1:-1}function ns(t,e,i){for(var n,o=t.getBaseAxis(),a=t.getOtherAxis(o),r=o.onZero?0:a.scale.getExtent()[0],s=a.dim,l="x"===s||"radius"===s?1:0,h=e.stackedOn,u=e.get(s,i);h&&is(h.get(s,i))===is(u);){n=h;break}var c=[];return c[l]=e.get(o.dim,i),c[1-l]=n?n.get(s,i,!0):r,t.dataToPoint(c)}function os(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}function as(t){return isNaN(t[0])||isNaN(t[1])}function rs(t,e,i,n,o,a,r,s,l,h,u){for(var c=0,d=i,f=0;f=o||d<0)break;if(as(g)){if(u){d+=a;continue}break}if(d===i)t[a>0?"moveTo":"lineTo"](g[0],g[1]),aM(sM,g);else if(l>0){var p=d+a,m=e[p];if(u)for(;m&&as(e[p]);)m=e[p+=a];var v=.5,y=e[c];if(!(m=e[p])||as(m))aM(lM,g);else{as(m)&&!u&&(m=g),H(rM,m,y);var x,_;if("x"===h||"y"===h){var b="x"===h?0:1;x=Math.abs(g[b]-y[b]),_=Math.abs(g[b]-m[b])}else x=hy(g,y),_=hy(g,m);oM(lM,g,rM,-l*(1-(v=_/(_+x))))}iM(sM,sM,s),nM(sM,sM,r),iM(lM,lM,s),nM(lM,lM,r),t.bezierCurveTo(sM[0],sM[1],lM[0],lM[1],g[0],g[1]),oM(sM,g,rM,l*v)}else t.lineTo(g[0],g[1]);c=d,d+=a}return f}function ss(t,e){var i=[1/0,1/0],n=[-1/0,-1/0];if(e)for(var o=0;on[0]&&(n[0]=a[0]),a[1]>n[1]&&(n[1]=a[1])}return{min:e?i:n,max:e?n:i}}function ls(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function cs(t){return t>=0?1:-1}function ds(t,e){var i=t.getBaseAxis(),n=t.getOtherAxis(i),o=0;if(!i.onZero){var a=n.scale.getExtent();a[0]>0?o=a[0]:a[1]<0&&(o=a[1])}var r=n.dim,s="x"===r||"radius"===r?1:0;return e.mapArray([r],function(n,a){for(var l,h=e.stackedOn;h&&cs(h.get(r,a))===cs(n);){l=h;break}var u=[];return u[s]=e.get(i.dim,a),u[1-s]=l?l.get(r,a,!0):o,t.dataToPoint(u)},!0)}function fs(t,e,i){var n=us(t.getAxis("x")),o=us(t.getAxis("y")),a=t.getBaseAxis().isHorizontal(),r=Math.min(n[0],n[1]),s=Math.min(o[0],o[1]),l=Math.max(n[0],n[1])-r,h=Math.max(o[0],o[1])-s,u=i.get("lineStyle.normal.width")||2,c=i.get("clipOverflow")?u/2:Math.max(l,h);a?(s-=c,h+=2*c):(r-=c,l+=2*c);var d=new db({shape:{x:r,y:s,width:l,height:h}});return e&&(d.shape[a?"width":"height"]=0,So(d,{shape:{width:l,height:h}},i)),d}function gs(t,e,i){var n=t.getAngleAxis(),o=t.getRadiusAxis().getExtent(),a=n.getExtent(),r=Math.PI/180,s=new rb({shape:{cx:t.cx,cy:t.cy,r0:o[0],r:o[1],startAngle:-a[0]*r,endAngle:-a[1]*r,clockwise:n.inverse}});return e&&(s.shape.endAngle=-a[0]*r,So(s,{shape:{endAngle:-a[1]*r}},i)),s}function ps(t,e,i){return"polar"===t.type?gs(t,e,i):fs(t,e,i)}function ms(t,e,i){for(var n=e.getBaseAxis(),o="x"===n.dim||"radius"===n.dim?0:1,a=[],r=0;r=0;o--)if(i[o].dimension<2){n=i[o];break}if(n&&"cartesian2d"===e.type){var a=n.dimension,r=t.dimensions[a],s=e.getAxis(r),l=f(n.stops,function(t){return{coord:s.toGlobalCoord(s.dataToCoord(t.value)),color:t.color}}),h=l.length,u=n.outerColors.slice();h&&l[0].coord>l[h-1].coord&&(l.reverse(),u.reverse());var c=l[0].coord-10,g=l[h-1].coord+10,p=g-c;if(p<.001)return"transparent";d(l,function(t){t.offset=(t.coord-c)/p}),l.push({offset:h?l[h-1].offset:.5,color:u[1]||"transparent"}),l.unshift({offset:h?l[0].offset:.5,color:u[0]||"transparent"});var m=new xb(0,0,0,0,l,!0);return m[r]=c,m[r+"2"]=g,m}}}function ys(t){return this._axes[t]}function xs(t){pM.call(this,t)}function _s(t,e){return e.type||(e.data?"category":"value")}function bs(t,e,i){return t.getCoordSysModel()===e}function ws(t,e){var i=e*Math.PI/180,n=t.plain(),o=n.width,a=n.height,r=o*Math.cos(i)+a*Math.sin(i),s=o*Math.sin(i)+a*Math.cos(i);return new jt(n.x,n.y,r,s)}function Ss(t){var e,i=t.model,n=i.getFormattedLabels(),o=i.getModel("axisLabel"),a=1,r=n.length;r>40&&(a=Math.ceil(r/40));for(var s=0;sn[1],l="start"===e&&!s||"start"!==e&&s;return ki(r-CM/2)?(a=l?"bottom":"top",o="center"):ki(r-1.5*CM)?(a=l?"top":"bottom",o="center"):(a="middle",o=r<1.5*CM&&r>CM/2?l?"left":"right":l?"right":"left"),{rotation:r,textAlign:o,textVerticalAlign:a}}function Ps(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}function Os(t,e,i){var n=t.get("axisLabel.showMinLabel"),o=t.get("axisLabel.showMaxLabel");e=e||[],i=i||[];var a=e[0],r=e[1],s=e[e.length-1],l=e[e.length-2],h=i[0],u=i[1],c=i[i.length-1],d=i[i.length-2];!1===n?(zs(a),zs(h)):Ns(a,r)&&(n?(zs(r),zs(u)):(zs(a),zs(h))),!1===o?(zs(s),zs(c)):Ns(l,s)&&(o?(zs(l),zs(d)):(zs(s),zs(c)))}function zs(t){t&&(t.ignore=!0)}function Ns(t,e,i){var n=t&&t.getBoundingRect().clone(),o=e&&e.getBoundingRect().clone();if(n&&o){var a=at([]);return ht(a,a,-t.rotation),n.applyTransform(st([],a,t.getLocalTransform())),o.applyTransform(st([],a,e.getLocalTransform())),n.intersect(o)}}function Es(t){return"middle"===t||"center"===t}function Rs(t,e,i){var n=e.axis;if(e.get("axisTick.show")&&!n.scale.isBlank()){for(var o=e.getModel("axisTick"),a=o.getModel("lineStyle"),s=o.get("length"),l=OM(o,i.labelInterval),h=n.getTicksCoords(o.get("alignWithLabel")),u=n.scale.getTicks(),c=e.get("axisLabel.showMinLabel"),d=e.get("axisLabel.showMaxLabel"),f=[],g=[],p=t._transform,m=[],v=h.length,y=0;y=0||t===e}function Us(t){var e=Xs(t);if(e){var i=e.axisPointerModel,n=e.axis.scale,o=i.option,a=i.get("status"),r=i.get("value");null!=r&&(r=n.parse(r));var s=qs(i);null==a&&(o.status=s?"show":"hide");var l=n.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==r||r>l[1])&&(r=l[1]),r=0?"p":"n",v=p[i],y=o[s][i][m],x=a[s][i][m];c.isHorizontal()?(n=y,r=v[1]+h,l=v[0]-x,g=u,a[s][i][m]+=l,Math.abs(l)0?"bottom":"top":o.width>0?"left":"right";l||ol(t.style,d,n,h,a,i,g),uo(t,d)}function hl(t,e){var i=t.get(jM)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}function ul(t,e,i,n){var o=e.getData(),a=this.dataIndex,r=o.getName(a),s=e.get("selectedOffset");n.dispatchAction({type:"pieToggleSelect",from:t,name:r,seriesId:e.id}),o.each(function(t){cl(o.getItemGraphicEl(t),o.getItemLayout(t),e.isSelected(o.getName(t)),s,i)})}function cl(t,e,i,n,o){var a=(e.startAngle+e.endAngle)/2,r=Math.cos(a),s=Math.sin(a),l=i?n:0,h=[r*l,s*l];o?t.animate().when(200,{position:h}).start("bounceOut"):t.attr("position",h)}function dl(t,e){function i(){a.ignore=a.hoverIgnore,r.ignore=r.hoverIgnore}function n(){a.ignore=a.normalIgnore,r.ignore=r.normalIgnore}jy.call(this);var o=new rb({z2:2}),a=new cb,r=new ib;this.add(o),this.add(a),this.add(r),this.updateData(t,e,!0),this.on("emphasis",i).on("normal",n).on("mouseover",i).on("mouseout",n)}function fl(t,e,i,n,o,a,r){function s(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function l(t,e,i,n,o,a){for(var r=e?Number.MAX_VALUE:0,s=0,l=t.length;s=r&&(d=r-10),!e&&d<=r&&(d=r+10),t[s].x=i+d*a,r=d}}t.sort(function(t,e){return t.y-e.y});for(var h,u=0,c=t.length,d=[],f=[],g=0;ge&&a+1t[a].y+t[a].height)return void s(a,n/2);s(i-1,n/2)}(g,c,-h),u=t[g].y+t[g].height;r-u<0&&s(c-1,u-r);for(g=0;g=i?f.push(t[g]):d.push(t[g]);l(d,!1,e,i,n,o),l(f,!0,e,i,n,o)}function gl(t,e,i,n,o,a){for(var r=[],s=[],l=0;l1?(g.width=l,g.height=l/d):(g.height=l,g.width=l*d),g.y=s[1]-g.height/2,g.x=s[0]-g.width/2}else(a=t.getBoxLayoutParams()).aspect=d,g=Ko(a,{width:h,height:u});this.setViewRect(g.x,g.y,g.width,g.height),this.setCenter(t.get("center")),this.setZoom(t.get("zoom"))}function Tl(t,e){d(e.get("geoCoord"),function(e,i){t.addGeoCoord(i,e)})}function Al(t,e,i){Ll(t)[e]=i}function Cl(t,e,i){var n=Ll(t);n[e]===i&&(n[e]=null)}function Dl(t,e){return!!Ll(t)[e]}function Ll(t){return t[bI]||(t[bI]={})}function kl(t){this.pointerChecker,this._zr=t,this._opt={};var e=m,n=e(Pl,this),o=e(Ol,this),a=e(zl,this),s=e(Nl,this),l=e(El,this);fy.call(this),this.setPointerChecker=function(t){this.pointerChecker=t},this.enable=function(e,h){this.disable(),this._opt=r(i(h)||{},{zoomOnMouseWheel:!0,moveOnMouseMove:!0,preventDefaultMouseMove:!0}),null==e&&(e=!0),!0!==e&&"move"!==e&&"pan"!==e||(t.on("mousedown",n),t.on("mousemove",o),t.on("mouseup",a)),!0!==e&&"scale"!==e&&"zoom"!==e||(t.on("mousewheel",s),t.on("pinch",l))},this.disable=function(){t.off("mousedown",n),t.off("mousemove",o),t.off("mouseup",a),t.off("mousewheel",s),t.off("pinch",l)},this.dispose=this.disable,this.isDragging=function(){return this._dragging},this.isPinching=function(){return this._pinching}}function Pl(t){if(!(hi(t)||t.target&&t.target.draggable)){var e=t.offsetX,i=t.offsetY;this.pointerChecker&&this.pointerChecker(t,e,i)&&(this._x=e,this._y=i,this._dragging=!0)}}function Ol(t){if(!hi(t)&&Vl(this,"moveOnMouseMove",t)&&this._dragging&&"pinch"!==t.gestureEvent&&!Dl(this._zr,"globalPan")){var e=t.offsetX,i=t.offsetY,n=this._x,o=this._y,a=e-n,r=i-o;this._x=e,this._y=i,this._opt.preventDefaultMouseMove&&bx(t.event),this.trigger("pan",a,r,n,o,e,i)}}function zl(t){hi(t)||(this._dragging=!1)}function Nl(t){if(Vl(this,"zoomOnMouseWheel",t)&&0!==t.wheelDelta){var e=t.wheelDelta>0?1.1:1/1.1;Rl.call(this,t,e,t.offsetX,t.offsetY)}}function El(t){if(!Dl(this._zr,"globalPan")){var e=t.pinchScale>1?1.1:1/1.1;Rl.call(this,t,e,t.pinchX,t.pinchY)}}function Rl(t,e,i,n){this.pointerChecker&&this.pointerChecker(t,i,n)&&(bx(t.event),this.trigger("zoom",e,i,n))}function Vl(t,e,i){var n=t._opt[e];return n&&(!_(n)||i.event[n+"Key"])}function Bl(t,e,i){var n=t.target,o=n.position;o[0]+=e,o[1]+=i,n.dirty()}function Gl(t,e,i,n){var o=t.target,a=t.zoomLimit,r=o.position,s=o.scale,l=t.zoom=t.zoom||1;if(l*=e,a){var h=a.min||0,u=a.max||1/0;l=Math.max(Math.min(u,l),h)}var c=l/t.zoom;t.zoom=l,r[0]-=(i-r[0])*(c-1),r[1]-=(n-r[1])*(c-1),s[0]*=c,s[1]*=c,o.dirty()}function Wl(t,e,i){var n=e.getComponentByElement(t.topTarget),o=n&&n.coordinateSystem;return n&&n!==i&&!wI[n.mainType]&&o&&o.model!==i}function Hl(t,e){var i=t.getItemStyle(),n=t.get("areaColor");return null!=n&&(i.fill=n),i}function Fl(t,e,i,n,o){i.off("click"),i.off("mousedown"),e.get("selectedMode")&&(i.on("mousedown",function(){t._mouseDownFlag=!0}),i.on("click",function(a){if(t._mouseDownFlag){t._mouseDownFlag=!1;for(var r=a.target;!r.__regions;)r=r.parent;if(r){var s={type:("geo"===e.mainType?"geo":"map")+"ToggleSelect",batch:f(r.__regions,function(t){return{name:t.name,from:o.uid}})};s[e.mainType+"Id"]=e.id,n.dispatchAction(s),Zl(e,i)}}}))}function Zl(t,e){e.eachChild(function(e){d(e.__regions,function(i){e.trigger(t.isSelected(i.name)?"emphasis":"normal")})})}function Ul(t,e){var i=new jy;this._controller=new kl(t.getZr()),this._controllerHost={target:e?i:null},this.group=i,this._updateGroup=e,this._mouseDownFlag}function Xl(t,e,i){var n=t.getZoom(),o=t.getCenter(),a=e.zoom,r=t.dataToPoint(o);if(null!=e.dx&&null!=e.dy){r[0]-=e.dx,r[1]-=e.dy;o=t.pointToData(r);t.setCenter(o)}if(null!=a){if(i){var s=i.min||0,l=i.max||1/0;a=Math.max(Math.min(n*a,l),s)/n}t.scale[0]*=a,t.scale[1]*=a;var h=t.position,u=(e.originX-h[0])*(a-1),c=(e.originY-h[1])*(a-1);h[0]-=u,h[1]-=c,t.updateTransform();o=t.pointToData(r);t.setCenter(o),t.setZoom(a*n)}return{center:t.getCenter(),zoom:t.getZoom()}}function jl(t,e){var i={},n=["value"];return d(t,function(t){t.each(n,function(e,n){var o="ec-"+t.getName(n);i[o]=i[o]||[],isNaN(e)||i[o].push(e)})}),t[0].map(n,function(n,o){for(var a="ec-"+t[0].getName(o),r=0,s=1/0,l=-1/0,h=i[a].length,u=0;u=0;o--){var a=i[o];a.hierNode={defaultAncestor:null,ancestor:a,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},n.push(a)}}function ah(t,e){var i=t.isExpand?t.children:[],n=t.parentNode.children,o=t.hierNode.i?n[t.hierNode.i-1]:null;if(i.length){uh(t);var a=(i[0].hierNode.prelim+i[i.length-1].hierNode.prelim)/2;o?(t.hierNode.prelim=o.hierNode.prelim+e(t,o),t.hierNode.modifier=t.hierNode.prelim-a):t.hierNode.prelim=a}else o&&(t.hierNode.prelim=o.hierNode.prelim+e(t,o));t.parentNode.hierNode.defaultAncestor=ch(t,o,t.parentNode.hierNode.defaultAncestor||n[0],e)}function rh(t){var e=t.hierNode.prelim+t.parentNode.hierNode.modifier;t.setLayout({x:e},!0),t.hierNode.modifier+=t.parentNode.hierNode.modifier}function sh(t){return arguments.length?t:mh}function lh(t,e){var i={};return t-=Math.PI/2,i.x=e*Math.cos(t),i.y=e*Math.sin(t),i}function hh(t,e){return Ko(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function uh(t){for(var e=t.children,i=e.length,n=0,o=0;--i>=0;){var a=e[i];a.hierNode.prelim+=n,a.hierNode.modifier+=n,o+=a.hierNode.change,n+=a.hierNode.shift+o}}function ch(t,e,i,n){if(e){for(var o=t,a=t,r=a.parentNode.children[0],s=e,l=o.hierNode.modifier,h=a.hierNode.modifier,u=r.hierNode.modifier,c=s.hierNode.modifier;s=dh(s),a=fh(a),s&&a;){o=dh(o),r=fh(r),o.hierNode.ancestor=t;var d=s.hierNode.prelim+c-a.hierNode.prelim-h+n(s,a);d>0&&(ph(gh(s,t,i),t,d),h+=d,l+=d),c+=s.hierNode.modifier,h+=a.hierNode.modifier,l+=o.hierNode.modifier,u+=r.hierNode.modifier}s&&!dh(o)&&(o.hierNode.thread=s,o.hierNode.modifier+=c-l),a&&!fh(r)&&(r.hierNode.thread=a,r.hierNode.modifier+=h-u,i=t)}return i}function dh(t){var e=t.children;return e.length&&t.isExpand?e[e.length-1]:t.hierNode.thread}function fh(t){var e=t.children;return e.length&&t.isExpand?e[0]:t.hierNode.thread}function gh(t,e,i){return t.hierNode.ancestor.parentNode===e.parentNode?t.hierNode.ancestor:i}function ph(t,e,i){var n=i/(e.hierNode.i-t.hierNode.i);e.hierNode.change-=n,e.hierNode.shift+=i,e.hierNode.modifier+=i,e.hierNode.prelim+=i,t.hierNode.change+=n}function mh(t,e){return t.parentNode===e.parentNode?1:2}function vh(t,e){var i=t.getItemLayout(e);return i&&!isNaN(i.x)&&!isNaN(i.y)&&"none"!==t.getItemVisual(e,"symbol")}function yh(t,e,i){return i.itemModel=e,i.itemStyle=e.getModel("itemStyle.normal").getItemStyle(),i.hoverItemStyle=e.getModel("itemStyle.emphasis").getItemStyle(),i.lineStyle=e.getModel("lineStyle.normal").getLineStyle(),i.labelModel=e.getModel("label.normal"),i.hoverLabelModel=e.getModel("label.emphasis"),!1===t.isExpand&&0!==t.children.length?i.symbolInnerColor=i.itemStyle.fill:i.symbolInnerColor="#fff",i}function xh(t,e,i,n,o,a){var s=!i,l=t.tree.getNodeByDataIndex(e),a=yh(l,l.getModel(),a),h=t.tree.root,u=l.parentNode===h?l:l.parentNode||l,c=t.getItemGraphicEl(u.dataIndex),d=u.getLayout(),f=c?{x:c.position[0],y:c.position[1],rawX:c.__radialOldRawX,rawY:c.__radialOldRawY}:d,g=l.getLayout();s?(i=new Jr(t,e,a)).attr("position",[f.x,f.y]):i.updateData(t,e,a),i.__radialOldRawX=i.__radialRawX,i.__radialOldRawY=i.__radialRawY,i.__radialRawX=g.rawX,i.__radialRawY=g.rawY,n.add(i),t.setItemGraphicEl(e,i),wo(i,{position:[g.x,g.y]},o);var p=i.getSymbolPath();if("radial"===a.layout){var m,v,y=h.children[0],x=y.getLayout(),_=y.children.length;if(g.x===x.x&&!0===l.isExpand){var b={};b.x=(y.children[0].getLayout().x+y.children[_-1].getLayout().x)/2,b.y=(y.children[0].getLayout().y+y.children[_-1].getLayout().y)/2,(m=Math.atan2(b.y-x.y,b.x-x.x))<0&&(m=2*Math.PI+m),(v=b.xx.x)||(m-=Math.PI);var w=v?"left":"right";p.setStyle({textPosition:w,textRotation:-m,textOrigin:"center",verticalAlign:"middle"})}if(l.parentNode&&l.parentNode!==h){var S=i.__edge;S||(S=i.__edge=new pb({shape:bh(a,f,f),style:r({opacity:0},a.lineStyle)})),wo(S,{shape:bh(a,d,g),style:{opacity:1}},o),n.add(S)}}function _h(t,e,i,n,o,a){for(var r,s=t.tree.getNodeByDataIndex(e),l=t.tree.root,a=yh(s,s.getModel(),a),h=s.parentNode===l?s:s.parentNode||s;null==(r=h.getLayout());)h=h.parentNode===l?h:h.parentNode||h;wo(i,{position:[r.x+1,r.y+1]},o,function(){n.remove(i),t.setItemGraphicEl(e,null)}),i.fadeOut(null,{keepLabel:!0});var u=i.__edge;u&&wo(u,{shape:bh(a,r,r),style:{opacity:0}},o,function(){n.remove(u)})}function bh(t,e,i){var n,o,a,r,s=t.orient;if("radial"===t.layout){var l=e.rawX,h=e.rawY,u=i.rawX,c=i.rawY,d=lh(l,h),f=lh(l,h+(c-h)*t.curvature),g=lh(u,c+(h-c)*t.curvature),p=lh(u,c);return{x1:d.x,y1:d.y,x2:p.x,y2:p.y,cpx1:f.x,cpy1:f.y,cpx2:g.x,cpy2:g.y}}var l=e.x,h=e.y,u=i.x,c=i.y;return"horizontal"===s&&(n=l+(u-l)*t.curvature,o=h,a=u+(l-u)*t.curvature,r=c),"vertical"===s&&(n=l,o=h+(c-h)*t.curvature,a=u,r=c+(h-c)*t.curvature),{x1:l,y1:h,x2:u,y2:c,cpx1:n,cpy1:o,cpx2:a,cpy2:r}}function wh(t,e,i){for(var n,o=[t],a=[];n=o.pop();)if(a.push(n),n.isExpand){var r=n.children;if(r.length)for(var s=0;s=0;a--)n.push(o[a])}}function Mh(t,e){if(t&&("treemapZoomToNode"===t.type||"treemapRootToNode"===t.type)){var i=e.getData().tree.root,n=t.targetNode;if(n&&i.contains(n))return{node:n};var o=t.targetNodeId;if(null!=o&&(n=i.getNodeById(o)))return{node:n}}}function Ih(t){for(var e=[];t;)(t=t.parentNode)&&e.push(t);return e.reverse()}function Th(t,e){return l(Ih(t),e)>=0}function Ah(t,e){for(var i=[];t;){var n=t.dataIndex;i.push({name:t.name,dataIndex:n,value:e.getRawValue(n)}),t=t.parentNode}return i.reverse(),i}function Ch(t){var e=0;d(t.children,function(t){Ch(t);var i=t.value;y(i)&&(i=i[0]),e+=i});var i=t.value;y(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),y(t.value)?t.value[0]=i:t.value=i}function Dh(t,e){var i=e.get("color");if(i){var n;return d(t=t||[],function(t){var e=new Lo(t),i=e.get("color");(e.get("itemStyle.normal.color")||i&&"none"!==i)&&(n=!0)}),n||((t[0]||(t[0]={})).color=i.slice()),t}}function Lh(t){this.group=new jy,t.add(this.group)}function kh(t,e,i,n,o,a){var r=[[o?t:t-CI,e],[t+i,e],[t+i,e+n],[o?t:t-CI,e+n]];return!a&&r.splice(2,0,[t+i+CI,e+n/2]),!o&&r.push([t,e+n/2]),r}function Ph(t,e,i){t.eventData={componentType:"series",componentSubType:"treemap",seriesIndex:e.componentIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:i&&i.dataIndex,name:i&&i.name},treePathInfo:i&&Ah(i,e)}}function Oh(){var t,e=[],i={};return{add:function(t,n,o,a,r){return _(a)&&(r=a,a=0),!i[t.id]&&(i[t.id]=1,e.push({el:t,target:n,time:o,delay:a,easing:r}),!0)},done:function(e){return t=e,this},start:function(){for(var n=e.length,o=0,a=e.length;o=0;a--)null==i[a]&&(delete n[e[a]],e.pop())}function Vh(t,e){var i=t.visual,n=[];b(i)?ZI(i,function(t){n.push(t)}):null!=i&&n.push(i);var o={color:1,symbol:1};e||1!==n.length||o.hasOwnProperty(t.type)||(n[1]=n[0]),Xh(t,n)}function Bh(t){return{applyVisual:function(e,i,n){e=this.mapValueToVisual(e),n("color",t(i("color"),e))},_doMap:Zh([0,1])}}function Gh(t){var e=this.option.visual;return e[Math.round(wi(t,[0,1],[0,e.length-1],!0))]||{}}function Wh(t){return function(e,i,n){n(t,this.mapValueToVisual(e))}}function Hh(t){var e=this.option.visual;return e[this.option.loop&&t!==XI?t%e.length:t]}function Fh(){return this.option.visual[0]}function Zh(t){return{linear:function(e){return wi(e,t,this.option.visual,!0)},category:Hh,piecewise:function(e,i){var n=Uh.call(this,i);return null==n&&(n=wi(e,t,this.option.visual,!0)),n},fixed:Fh}}function Uh(t){var e=this.option,i=e.pieceList;if(e.hasSpecialVisual){var n=i[jI.findPieceIndex(t,i)];if(n&&n.visual)return n.visual[this.type]}}function Xh(t,e){return t.visual=e,"color"===t.type&&(t.parsedVisual=f(e,function(t){return Mt(t)})),e}function jh(t,e,i){return t?e<=i:e=o.length||t===o[t.depth])&&qh(t,eu(r,u,t,e,p,a),i,n,o,a)})}else l=$h(u),t.setVisual("color",l)}}function Yh(t,e,i,n){var o=a({},e);return d(["color","colorAlpha","colorSaturation"],function(a){var r=t.get(a,!0);null==r&&i&&(r=i[a]),null==r&&(r=e[a]),null==r&&(r=n.get(a)),null!=r&&(o[a]=r)}),o}function $h(t){var e=Jh(t,"color");if(e){var i=Jh(t,"colorAlpha"),n=Jh(t,"colorSaturation");return n&&(e=kt(e,null,null,n)),i&&(e=Pt(e,i)),e}}function Kh(t,e){return null!=e?kt(e,null,null,t):null}function Jh(t,e){var i=t[e];if(null!=i&&"none"!==i)return i}function Qh(t,e,i,n,o,a){if(a&&a.length){var r=tu(e,"color")||null!=o.color&&"none"!==o.color&&(tu(e,"colorAlpha")||tu(e,"colorSaturation"));if(r){var s=e.get("visualMin"),l=e.get("visualMax"),h=i.dataExtent.slice();null!=s&&sh[1]&&(h[1]=l);var u=e.get("colorMappingBy"),c={type:r.name,dataExtent:h,visual:r.range};"color"!==c.type||"index"!==u&&"id"!==u?c.mappingMethod="linear":(c.mappingMethod="category",c.loop=!0);var d=new jI(c);return d.__drColorMappingBy=u,d}}}function tu(t,e){var i=t.get(e);return $I(i)&&i.length?{name:e,range:i}:null}function eu(t,e,i,n,o,r){var s=a({},e);if(o){var l=o.type,h="color"===l&&o.__drColorMappingBy,u="index"===h?n:"id"===h?r.mapIdToIndex(i.getId()):i.getValue(t.get("visualDimension"));s[l]=o.mapValueToVisual(u)}return s}function iu(t,e,i,n){var o,a;if(!t.isRemoved()){var r=t.getLayout();o=r.width,a=r.height;var s=(f=t.getModel()).get(iT),l=f.get(nT)/2,h=du(f),u=Math.max(s,h),c=s-l,d=u-l,f=t.getModel();t.setLayout({borderWidth:s,upperHeight:u,upperLabelHeight:h},!0);var g=(o=JI(o-2*c,0))*(a=JI(a-c-d,0)),p=nu(t,f,g,e,i,n);if(p.length){var m={x:c,y:d,width:o,height:a},v=QI(o,a),y=1/0,x=[];x.area=0;for(var _=0,b=p.length;_=0;l--){var h=o["asc"===n?r-l-1:l].getValue();h/i*es[1]&&(s[1]=e)})}else s=[NaN,NaN];return{sum:n,dataExtent:s}}function su(t,e,i){for(var n,o=0,a=1/0,r=0,s=t.length;ro&&(o=n));var l=t.area*t.area,h=e*e*i;return l?JI(h*o/l,l/(h*a)):1/0}function lu(t,e,i,n,o){var a=e===i.width?0:1,r=1-a,s=["x","y"],l=["width","height"],h=i[s[a]],u=e?t.area/e:0;(o||u>i[l[r]])&&(u=i[l[r]]);for(var c=0,d=t.length;cRx&&(h=Rx),a=s}h=0?n+=h:n-=h:g>=0?n-=h:n+=h}return n}function Tu(t,e){return t.getVisual("opacity")||t.getModel().get(e)}function Au(t,e,i){var n=t.getGraphicEl(),o=Tu(t,e);null!=i&&(null==o&&(o=1),o*=i),n.downplay&&n.downplay(),n.traverse(function(t){"group"!==t.type&&t.setStyle("opacity",o)})}function Cu(t,e){var i=Tu(t,e),n=t.getGraphicEl();n.highlight&&n.highlight(),n.traverse(function(t){"group"!==t.type&&t.setStyle("opacity",i)})}function Du(t){return t instanceof Array||(t=[t,t]),t}function Lu(t){var e=t.coordinateSystem;if(!e||"view"===e.type){var i=t.getGraph();i.eachNode(function(t){var e=t.getModel();t.setLayout([+e.get("x"),+e.get("y")])}),ku(i)}}function ku(t){t.eachEdge(function(t){var e=t.getModel().get("lineStyle.normal.curveness")||0,i=V(t.node1.getLayout()),n=V(t.node2.getLayout()),o=[i,n];+e&&o.push([(i[0]+n[0])/2-(i[1]-n[1])*e,(i[1]+n[1])/2-(n[0]-i[0])*e]),t.setLayout(o)})}function Pu(t){var e=t.coordinateSystem;if(!e||"view"===e.type){var i=e.getBoundingRect(),n=t.getData(),o=n.graph,a=0,r=n.getSum("value"),s=2*Math.PI/(r||n.count()),l=i.width/2+i.x,h=i.height/2+i.y,u=Math.min(i.width,i.height)/2;o.eachNode(function(t){var e=t.getValue("value");a+=s*(r?e:1)/2,t.setLayout([u*Math.cos(a)+l,u*Math.sin(a)+h]),a+=s*(r?e:1)/2}),n.setLayout({cx:l,cy:h}),o.eachEdge(function(t){var e,i=t.getModel().get("lineStyle.normal.curveness")||0,n=V(t.node1.getLayout()),o=V(t.node2.getLayout()),a=(n[0]+o[0])/2,r=(n[1]+o[1])/2;+i&&(e=[l*(i*=3)+a*(1-i),h*i+r*(1-i)]),t.setLayout([n,o,e])})}}function Ou(t,e,i){for(var n=i.rect,o=n.width,a=n.height,r=[n.x+o/2,n.y+a/2],s=null==i.gravity?.1:i.gravity,l=0;l0?-1:i<0?1:e?-1:1}}function Zu(t,e){return Math.min(e[1],Math.max(e[0],t))}function Uu(t,e,i){this._axesMap=z(),this._axesLayout={},this.dimensions=t.dimensions,this._rect,this._model=t,this._init(t,e,i)}function Xu(t,e){return NT(ET(t,e[0]),e[1])}function ju(t,e){var i=e.layoutLength/(e.axisCount-1);return{position:i*t,axisNameAvailableWidth:i,axisLabelShow:!0}}function qu(t,e){var i,n,o=e.layoutLength,a=e.axisExpandWidth,r=e.axisCount,s=e.axisCollapseWidth,l=e.winInnerIndices,h=s,u=!1;return t$T}function hc(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function uc(t,e,i,n){var o=new jy;return o.add(new db({name:"main",style:gc(i),silent:!0,draggable:!0,cursor:"move",drift:FT(t,e,o,"nswe"),ondragend:FT(sc,e,{isEnd:!0})})),ZT(n,function(i){o.add(new db({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:FT(t,e,o,i),ondragend:FT(sc,e,{isEnd:!0})}))}),o}function cc(t,e,i,n){var o=n.brushStyle.lineWidth||0,a=jT(o,KT),r=i[0][0],s=i[1][0],l=r-o/2,h=s-o/2,u=i[0][1],c=i[1][1],d=u-a+o/2,f=c-a+o/2,g=u-r,p=c-s,m=g+o,v=p+o;fc(t,e,"main",r,s,g,p),n.transformable&&(fc(t,e,"w",l,h,a,v),fc(t,e,"e",d,h,a,v),fc(t,e,"n",l,h,m,a),fc(t,e,"s",l,f,m,a),fc(t,e,"nw",l,h,a,a),fc(t,e,"ne",d,h,a,a),fc(t,e,"sw",l,f,a,a),fc(t,e,"se",d,f,a,a))}function dc(t,e){var i=e.__brushOption,n=i.transformable,o=e.childAt(0);o.useStyle(gc(i)),o.attr({silent:!n,cursor:n?"move":"default"}),ZT(["w","e","n","s","se","sw","ne","nw"],function(i){var o=e.childOfName(i),a=vc(t,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?tA[a]+"-resize":null})})}function fc(t,e,i,n,o,a,r){var s=e.childOfName(i);s&&s.setShape(wc(bc(t,e,[[n,o],[n+a,o+r]])))}function gc(t){return r({strokeNoScale:!0},t.brushStyle)}function pc(t,e,i,n){var o=[XT(t,i),XT(e,n)],a=[jT(t,i),jT(e,n)];return[[o[0],a[0]],[o[1],a[1]]]}function mc(t){return Mo(t.group)}function vc(t,e){if(e.length>1)return("e"===(n=[vc(t,(e=e.split(""))[0]),vc(t,e[1])])[0]||"w"===n[0])&&n.reverse(),n.join("");var i={left:"w",right:"e",top:"n",bottom:"s"},n=To({w:"left",e:"right",n:"top",s:"bottom"}[e],mc(t));return i[n]}function yc(t,e,i,n,o,a,r,s){var l=n.__brushOption,h=t(l.range),u=_c(i,a,r);ZT(o.split(""),function(t){var e=QT[t];h[e[0]][e[1]]+=u[e[0]]}),l.range=e(pc(h[0][0],h[1][0],h[0][1],h[1][1])),ic(i,n),sc(i,{isEnd:!1})}function xc(t,e,i,n,o){var a=e.__brushOption.range,r=_c(t,i,n);ZT(a,function(t){t[0]+=r[0],t[1]+=r[1]}),ic(t,e),sc(t,{isEnd:!1})}function _c(t,e,i){var n=t.group,o=n.transformCoordToLocal(e,i),a=n.transformCoordToLocal(0,0);return[o[0]-a[0],o[1]-a[1]]}function bc(t,e,n){var o=ac(t,e);return o&&!0!==o?o.clipPath(n,t._transform):i(n)}function wc(t){var e=XT(t[0][0],t[1][0]),i=XT(t[0][1],t[1][1]);return{x:e,y:i,width:jT(t[0][0],t[1][0])-e,height:jT(t[0][1],t[1][1])-i}}function Sc(t,e,i){if(t._brushType){var n=t._zr,o=t._covers,a=oc(t,e,i);if(!t._dragging)for(var r=0;r=0?e:NaN}})}function Bc(t){return+t.replace("dim","")}function Gc(t,e){var i=0;d(t,function(t){var e=Bc(t);e>i&&(i=e)});var n=e[0];n&&n.length-1>i&&(i=n.length-1);for(var o=[],a=0;a<=i;a++)o.push("dim"+a);return o}function Wc(t,e,i){var n=t.model,o=t.getRect(),a=new db({shape:{x:o.x,y:o.y,width:o.width,height:o.height}}),r="horizontal"===n.get("layout")?"width":"height";return a.setShape(r,0),So(a,{shape:{width:o.width,height:o.height}},e,i),a}function Hc(t,e,i,n){for(var o=[],a=0;a=i.length)return e;for(var o=-1,a=e.length,r=i[n++],s={},l={};++o=i.length)return t;var a=[],r=n[o++];return d(t,function(t,i){a.push({key:i,values:e(t,o)})}),r?a.sort(function(t,e){return r(t.key,e.key)}):a}var i=[],n=[];return{key:function(t){return i.push(t),this},sortKeys:function(t){return n[i.length-1]=t,this},entries:function(i){return e(t(i,0),0)}}}function qc(t,e){return Ko(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function Yc(t,e,i,n,o,a,r){Kc(t,i,o),td(t,e,a,n,r),sd(t)}function $c(t){d(t,function(t){var e=ud(t.outEdges,gd),i=ud(t.inEdges,gd),n=Math.max(e,i);t.setLayout({value:n},!0)})}function Kc(t,e,i){for(var n=t,o=null,a=0;n.length;){o=[];for(var r=0,s=n.length;r0;o--)nd(a,r*=.99),id(a,n,i),ad(a,r),id(a,n,i)}function ed(t,e,i,n,o){var a=[];d(e,function(t){var e=t.length,i=0;d(t,function(t){i+=t.getLayout().value});var r=(n-(e-1)*o)/i;a.push(r)}),a.sort(function(t,e){return t-e});var r=a[0];d(e,function(t){d(t,function(t,e){t.setLayout({y:e},!0);var i=t.getLayout().value*r;t.setLayout({dy:i},!0)})}),d(i,function(t){var e=+t.getValue()*r;t.setLayout({dy:e},!0)})}function id(t,e,i){d(t,function(t){var n,o,a,r=0,s=t.length;for(t.sort(dd),a=0;a0){l=n.getLayout().y+o;n.setLayout({y:l},!0)}r=n.getLayout().y+n.getLayout().dy+e}if((o=r-e-i)>0){var l=n.getLayout().y-o;for(n.setLayout({y:l},!0),r=n.getLayout().y,a=s-2;a>=0;--a)(o=(n=t[a]).getLayout().y+n.getLayout().dy+e-r)>0&&(l=n.getLayout().y-o,n.setLayout({y:l},!0)),r=n.getLayout().y}})}function nd(t,e){d(t.slice().reverse(),function(t){d(t,function(t){if(t.outEdges.length){var i=ud(t.outEdges,od)/ud(t.outEdges,gd),n=t.getLayout().y+(i-cd(t))*e;t.setLayout({y:n},!0)}})})}function od(t){return cd(t.node2)*t.getValue()}function ad(t,e){d(t,function(t){d(t,function(t){if(t.inEdges.length){var i=ud(t.inEdges,rd)/ud(t.inEdges,gd),n=t.getLayout().y+(i-cd(t))*e;t.setLayout({y:n},!0)}})})}function rd(t){return cd(t.node1)*t.getValue()}function sd(t){d(t,function(t){t.outEdges.sort(ld),t.inEdges.sort(hd)}),d(t,function(t){var e=0,i=0;d(t.outEdges,function(t){t.setLayout({sy:e},!0),e+=t.getLayout().dy}),d(t.inEdges,function(t){t.setLayout({ty:i},!0),i+=t.getLayout().dy})})}function ld(t,e){return t.node2.getLayout().y-e.node2.getLayout().y}function hd(t,e){return t.node1.getLayout().y-e.node1.getLayout().y}function ud(t,e){for(var i=0,n=t.length,o=-1;++oe?1:t===e?0:NaN}function gd(t){return t.getValue()}function pd(t,e,i,n){jy.call(this),this.bodyIndex,this.whiskerIndex,this.styleUpdater=i,this._createContent(t,e,n),this.updateData(t,e,n),this._seriesModel}function md(t,e,i){return f(t,function(t){return t=t.slice(),t[e]=i.initBaseline,t})}function vd(t){var e={};return d(t,function(t,i){e["ends"+i]=t}),e}function yd(t){this.group=new jy,this.styleUpdater=t}function xd(t,e,i){var n=e.getItemModel(i),o=n.getModel(mA),a=e.getItemVisual(i,"color"),r=o.getItemStyle(["borderColor"]),s=t.childAt(t.whiskerIndex);s.style.set(r),s.style.stroke=a,s.dirty();var l=t.childAt(t.bodyIndex);l.style.set(r),l.style.stroke=a,l.dirty(),uo(t,n.getModel(vA).getItemStyle())}function _d(t){var e=[],i=[];return t.eachSeriesByType("boxplot",function(t){var n=t.getBaseAxis(),o=l(i,n);o<0&&(o=i.length,i[o]=n,e[o]={axis:n,seriesModels:[]}),e[o].seriesModels.push(t)}),e}function bd(t){var e,i,n=t.axis,o=t.seriesModels,a=o.length,r=t.boxWidthList=[],s=t.boxOffsetList=[],l=[];if("category"===n.type)i=n.getBandWidth();else{var h=0;xA(o,function(t){h=Math.max(h,t.getData().count())}),e=n.getExtent(),Math.abs(e[1]-e[0])}xA(o,function(t){var e=t.get("boxWidth");y(e)||(e=[e,e]),l.push([Si(e[0],i)||0,Si(e[1],i)||0])});var u=.8*i-2,c=u/a*.3,d=(u-c*(a-1))/a,f=d/2-u/2;xA(o,function(t,e){s.push(f),f+=c+d,r.push(Math.min(Math.max(d,l[e][0]),l[e][1]))})}function wd(t,e,i){var n,o=t.coordinateSystem,a=t.getData(),r=i/2,s=t.get("layout"),l="horizontal"===s?0:1,h=1-l,u=["x","y"],c=[];d(a.dimensions,function(t){var e=a.getDimensionInfo(t).coordDim;e===u[h]?c.push(t):e===u[l]&&(n=t)}),null==n||c.length<5||a.each([n].concat(c),function(){function t(t){var i=[];i[l]=d,i[h]=t;var n;return isNaN(d)||isNaN(t)?n=[NaN,NaN]:(n=o.dataToPoint(i))[l]+=e,n}function i(t,e){var i=t.slice(),n=t.slice();i[l]+=r,n[l]-=r,e?y.push(i,n):y.push(n,i)}function n(t){var e=[t.slice(),t.slice()];e[0][l]-=r,e[1][l]+=r,v.push(e)}var u=arguments,d=u[0],f=u[c.length+1],g=t(u[3]),p=t(u[1]),m=t(u[5]),v=[[p,t(u[2])],[m,t(u[4])]];n(p),n(m),n(g);var y=[];i(v[0][1],0),i(v[1][1],1),a.setItemLayout(f,{chartLayout:s,initBaseline:g[h],median:g,bodyEnds:y,whiskerEnds:v})})}function Sd(t,e,i){var n=e.getItemModel(i),o=n.getModel(_A),a=e.getItemVisual(i,"color"),r=e.getItemVisual(i,"borderColor")||a,s=o.getItemStyle(["color","color0","borderColor","borderColor0"]),l=t.childAt(t.whiskerIndex);l.useStyle(s),l.style.stroke=r;var h=t.childAt(t.bodyIndex);h.useStyle(s),h.style.fill=a,h.style.stroke=r,uo(t,n.getModel(bA).getItemStyle())}function Md(t,e){var i,n=t.getBaseAxis(),o="category"===n.type?n.getBandWidth():(i=n.getExtent(),Math.abs(i[1]-i[0])/e.count()),a=Si(TA(t.get("barMaxWidth"),o),o),r=Si(TA(t.get("barMinWidth"),1),o),s=t.get("barWidth");return null!=s?Si(s,o):Math.max(Math.min(o/2,a),r)}function Id(t){return y(t)||(t=[+t,+t]),t}function Td(t,e){t.eachChild(function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?e.color:null,fill:"fill"===e.brushType?e.color:null}})})}function Ad(t,e){jy.call(this);var i=new Jr(t,e),n=new jy;this.add(i),this.add(n),n.beforeUpdate=function(){this.attr(i.getScale())},this.updateData(t,e)}function Cd(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=f(e,function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),o([e,t[0],t[1]])}))}function Dd(t,e,i){jy.call(this),this.add(this.createLine(t,e,i)),this._updateEffectSymbol(t,e)}function Ld(t,e,i){jy.call(this),this._createPolyline(t,e,i)}function kd(t,e,i){Dd.call(this,t,e,i),this._lastFrame=0,this._lastFramePercent=0}function Pd(){this.group=new jy,this._lineEl=new PA}function Od(t){return t instanceof Array||(t=[t,t]),t}function zd(){var t=iy();this.canvas=t,this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={}}function Nd(t,e,i){var n=t[1]-t[0],o=(e=f(e,function(e){return{interval:[(e.interval[0]-t[0])/n,(e.interval[1]-t[0])/n]}})).length,a=0;return function(t){for(n=a;n=0;n--){var r=e[n].interval;if(r[0]<=t&&t<=r[1]){a=n;break}}return n>=0&&n=e[0]&&t<=e[1]}}function Rd(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}function Vd(t,e,i,n){var o=t.getItemLayout(e),a=i.get("symbolRepeat"),r=i.get("symbolClip"),s=i.get("symbolPosition")||"start",l=(i.get("symbolRotate")||0)*Math.PI/180||0,h=i.get("symbolPatternSize")||2,u=i.isAnimationEnabled(),c={dataIndex:e,layout:o,itemModel:i,symbolType:t.getItemVisual(e,"symbol")||"circle",color:t.getItemVisual(e,"color"),symbolClip:r,symbolRepeat:a,symbolRepeatDirection:i.get("symbolRepeatDirection"),symbolPatternSize:h,rotation:l,animationModel:u?i:null,hoverAnimation:u&&i.get("hoverAnimation"),z2:i.getShallow("z",!0)||0};Bd(i,a,o,n,c),Wd(t,e,o,a,r,c.boundingLength,c.pxSign,h,n,c),Hd(i,c.symbolScale,l,n,c);var d=c.symbolSize,f=i.get("symbolOffset");return y(f)&&(f=[Si(f[0],d[0]),Si(f[1],d[1])]),Fd(i,d,o,a,r,f,s,c.valueLineWidth,c.boundingLength,c.repeatCutLength,n,c),c}function Bd(t,e,i,n,o){var a,r=n.valueDim,s=t.get("symbolBoundingData"),l=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),h=l.toGlobalCoord(l.dataToCoord(0)),u=1-+(i[r.wh]<=0);if(y(s)){var c=[Gd(l,s[0])-h,Gd(l,s[1])-h];c[1]0?1:a<0?-1:0}function Gd(t,e){return t.toGlobalCoord(t.dataToCoord(t.scale.parse(e)))}function Wd(t,e,i,n,o,a,r,s,l,h){var u=l.valueDim,c=l.categoryDim,d=Math.abs(i[c.wh]),f=t.getItemVisual(e,"symbolSize");y(f)?f=f.slice():(null==f&&(f="100%"),f=[f,f]),f[c.index]=Si(f[c.index],d),f[u.index]=Si(f[u.index],n?d:Math.abs(a)),h.symbolSize=f,(h.symbolScale=[f[0]/s,f[1]/s])[u.index]*=(l.isHorizontal?-1:1)*r}function Hd(t,e,i,n,o){var a=t.get(NA)||0;a&&(RA.attr({scale:e.slice(),rotation:i}),RA.updateTransform(),a/=RA.getLineScale(),a*=e[n.valueDim.index]),o.valueLineWidth=a}function Fd(t,e,i,n,o,r,s,l,h,u,c,d){var f=c.categoryDim,g=c.valueDim,p=d.pxSign,m=Math.max(e[g.index]+l,0),v=m;if(n){var y=Math.abs(h),x=I(t.get("symbolMargin"),"15%")+"",_=!1;x.lastIndexOf("!")===x.length-1&&(_=!0,x=x.slice(0,x.length-1)),x=Si(x,e[g.index]);var b=Math.max(m+2*x,0),w=_?0:2*x,S=Ri(n),M=S?n:sf((y+w)/b);b=m+2*(x=(y-M*m)/2/(_?M:M-1)),w=_?0:2*x,S||"fixed"===n||(M=u?sf((Math.abs(u)+w)/b):0),v=M*b-w,d.repeatTimes=M,d.symbolMargin=x}var T=p*(v/2),A=d.pathPosition=[];A[f.index]=i[f.wh]/2,A[g.index]="start"===s?T:"end"===s?h-T:h/2,r&&(A[0]+=r[0],A[1]+=r[1]);var C=d.bundlePosition=[];C[f.index]=i[f.xy],C[g.index]=i[g.xy];var D=d.barRectShape=a({},i);D[g.wh]=p*Math.max(Math.abs(i[g.wh]),Math.abs(A[g.index]+T)),D[f.wh]=i[f.wh];var L=d.clipShape={};L[f.xy]=-i[f.xy],L[f.wh]=c.ecSize[f.wh],L[g.xy]=0,L[g.wh]=i[g.wh]}function Zd(t){var e=t.symbolPatternSize,i=Hr(t.symbolType,-e/2,-e/2,e,e,t.color);return i.attr({culling:!0}),"image"!==i.type&&i.setStyle({strokeNoScale:!0}),i}function Ud(t,e,i,n){function o(t){var e=l.slice(),n=i.pxSign,o=t;return("start"===i.symbolRepeatDirection?n>0:n<0)&&(o=u-1-t),e[h.index]=d*(o-u/2+.5)+l[h.index],{position:e,scale:i.symbolScale.slice(),rotation:i.rotation}}var a=t.__pictorialBundle,r=i.symbolSize,s=i.valueLineWidth,l=i.pathPosition,h=e.valueDim,u=i.repeatTimes||0,c=0,d=r[e.valueDim.index]+s+2*i.symbolMargin;for(of(t,function(t){t.__pictorialAnimationIndex=c,t.__pictorialRepeatTimes=u,c0)],d=t.__pictorialBarRect;ol(d.style,u,a,n,e.seriesModel,o,c),uo(d,u)}function sf(t){var e=Math.round(t);return Math.abs(t-e)<1e-4?e:Math.ceil(t)}function lf(t,e,i){this.dimension="single",this.dimensions=["single"],this._axis=null,this._rect,this._init(t,e,i),this.model=t}function hf(t,e){e=e||{};var i=t.coordinateSystem,n=t.axis,o={},a=n.position,r=n.orient,s=i.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],h={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};o.position=["vertical"===r?h.vertical[a]:l[0],"horizontal"===r?h.horizontal[a]:l[3]];var u={horizontal:0,vertical:1};o.rotation=Math.PI/2*u[r];var c={top:-1,bottom:1,right:1,left:-1};o.labelDirection=o.tickDirection=o.nameDirection=c[a],t.get("axisTick.inside")&&(o.tickDirection=-o.tickDirection),I(e.labelInside,t.get("axisLabel.inside"))&&(o.labelDirection=-o.labelDirection);var d=e.rotate;return null==d&&(d=t.get("axisLabel.rotate")),o.labelRotation="top"===a?-d:d,o.labelInterval=n.getLabelInterval(),o.z2=1,o}function uf(t,e,i,n,o){var r=t.axis;if(!r.scale.isBlank()&&r.containData(e))if(t.involveSeries){var s=cf(e,t),l=s.payloadBatch,h=s.snapToValue;l[0]&&null==o.seriesIndex&&a(o,l[0]),!n&&t.snap&&r.containData(h)&&null!=h&&(e=h),i.showPointer(t,e,l,o),i.showTooltip(t,s,h)}else i.showPointer(t,e)}function cf(t,e){var i=e.axis,n=i.dim,o=t,a=[],r=Number.MAX_VALUE,s=-1;return XA(e.seriesModels,function(e,l){var h,u,c=e.coordDimToDataDim(n);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,i);u=d.dataIndices,h=d.nestestValue}else{if(!(u=e.getData().indicesOfNearest(c[0],t,!1,"category"===i.type?.5:null)).length)return;h=e.getData().get(c[0],u[0])}if(null!=h&&isFinite(h)){var f=t-h,g=Math.abs(f);g<=r&&((g=0&&s<0)&&(r=g,s=f,o=h,a.length=0),XA(u,function(t){a.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:a,snapToValue:o}}function df(t,e,i,n){t[e.key]={value:i,payloadBatch:n}}function ff(t,e,i,n){var o=i.payloadBatch,a=e.axis,r=a.model,s=e.axisPointerModel;if(e.triggerTooltip&&o.length){var l=e.coordSys.model,h=Ys(l),u=t.map[h];u||(u=t.map[h]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:r.componentIndex,axisType:r.type,axisId:r.id,value:n,valueLabelOpt:{precision:s.get("label.precision"),formatter:s.get("label.formatter")},seriesDataIndices:o.slice()})}}function gf(t,e,i){var n=i.axesInfo=[];XA(e,function(e,i){var o=e.axisPointerModel.option,a=t[i];a?(!e.useHandle&&(o.status="show"),o.value=a.value,o.seriesDataIndices=(a.payloadBatch||[]).slice()):!e.useHandle&&(o.status="hide"),"show"===o.status&&n.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:o.value})})}function pf(t,e,i,n){if(!xf(e)&&t.list.length){var o=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:i.tooltipOption,position:i.position,dataIndexInside:o.dataIndexInside,dataIndex:o.dataIndex,seriesIndex:o.seriesIndex,dataByCoordSys:t.list})}else n({type:"hideTip"})}function mf(t,e,i){var n=i.getZr(),o=qA(n).axisPointerLastHighlights||{},a=qA(n).axisPointerLastHighlights={};XA(t,function(t,e){var i=t.axisPointerModel.option;"show"===i.status&&XA(i.seriesDataIndices,function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t})});var r=[],s=[];d(o,function(t,e){!a[e]&&s.push(t)}),d(a,function(t,e){!o[e]&&r.push(t)}),s.length&&i.dispatchAction({type:"downplay",escapeConnect:!0,batch:s}),r.length&&i.dispatchAction({type:"highlight",escapeConnect:!0,batch:r})}function vf(t,e){for(var i=0;i<(t||[]).length;i++){var n=t[i];if(e.axis.dim===n.axisDim&&e.axis.model.componentIndex===n.axisIndex)return n}}function yf(t){var e=t.axis.model,i={},n=i.axisDim=t.axis.dim;return i.axisIndex=i[n+"AxisIndex"]=e.componentIndex,i.axisName=i[n+"AxisName"]=e.name,i.axisId=i[n+"AxisId"]=e.id,i}function xf(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function _f(t,e,i){if(!Uv.node){var n=e.getZr();YA(n).records||(YA(n).records={}),bf(n,e),(YA(n).records[t]||(YA(n).records[t]={})).handler=i}}function bf(t,e){function i(i,n){t.on(i,function(i){var o=If(e);$A(YA(t).records,function(t){t&&n(t,i,o.dispatchAction)}),wf(o.pendings,e)})}YA(t).initialized||(YA(t).initialized=!0,i("click",v(Mf,"click")),i("mousemove",v(Mf,"mousemove")),i("globalout",Sf))}function wf(t,e){var i,n=t.showTip.length,o=t.hideTip.length;n?i=t.showTip[n-1]:o&&(i=t.hideTip[o-1]),i&&(i.dispatchAction=null,e.dispatchAction(i))}function Sf(t,e,i){t.handler("leave",null,i)}function Mf(t,e,i,n){e.handler(t,i,n)}function If(t){var e={showTip:[],hideTip:[]},i=function(n){var o=e[n.type];o?o.push(n):(n.dispatchAction=i,t.dispatchAction(n))};return{dispatchAction:i,pendings:e}}function Tf(t,e){if(!Uv.node){var i=e.getZr();(YA(i).records||{})[t]&&(YA(i).records[t]=null)}}function Af(){}function Cf(t,e,i,n){Df(JA(i).lastProp,n)||(JA(i).lastProp=n,e?wo(i,n,t):(i.stopAnimation(),i.attr(n)))}function Df(t,e){if(b(t)&&b(e)){var i=!0;return d(e,function(e,n){i=i&&Df(t[n],e)}),!!i}return t===e}function Lf(t,e){t[e.get("label.show")?"show":"hide"]()}function kf(t){return{position:t.position.slice(),rotation:t.rotation||0}}function Pf(t,e,i){var n=e.get("z"),o=e.get("zlevel");t&&t.traverse(function(t){"group"!==t.type&&(null!=n&&(t.z=n),null!=o&&(t.zlevel=o),t.silent=i)})}function Of(t){var e,i=t.get("type"),n=t.getModel(i+"Style");return"line"===i?(e=n.getLineStyle()).fill=null:"shadow"===i&&((e=n.getAreaStyle()).stroke=null),e}function zf(t,e,i,n,o){var a=Ef(i.get("value"),e.axis,e.ecModel,i.get("seriesDataIndices"),{precision:i.get("label.precision"),formatter:i.get("label.formatter")}),r=i.getModel("label"),s=Gx(r.get("padding")||0),l=r.getFont(),h=de(a,l),u=o.position,c=h.width+s[1]+s[3],d=h.height+s[0]+s[2],f=o.align;"right"===f&&(u[0]-=c),"center"===f&&(u[0]-=c/2);var g=o.verticalAlign;"bottom"===g&&(u[1]-=d),"middle"===g&&(u[1]-=d/2),Nf(u,c,d,n);var p=r.get("backgroundColor");p&&"auto"!==p||(p=e.get("axisLine.lineStyle.color")),t.label={shape:{x:0,y:0,width:c,height:d,r:r.get("borderRadius")},position:u.slice(),style:{text:a,textFont:l,textFill:r.getTextColor(),textPosition:"inside",fill:p,stroke:r.get("borderColor")||"transparent",lineWidth:r.get("borderWidth")||0,shadowBlur:r.get("shadowBlur"),shadowColor:r.get("shadowColor"),shadowOffsetX:r.get("shadowOffsetX"),shadowOffsetY:r.get("shadowOffsetY")},z2:10}}function Nf(t,e,i,n){var o=n.getWidth(),a=n.getHeight();t[0]=Math.min(t[0]+e,o)-e,t[1]=Math.min(t[1]+i,a)-i,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}function Ef(t,e,i,n,o){var a=e.scale.getLabel(t,{precision:o.precision}),r=o.formatter;if(r){var s={value:Br(e,t),seriesData:[]};d(n,function(t){var e=i.getSeriesByIndex(t.seriesIndex),n=t.dataIndexInside,o=e&&e.getDataParams(n);o&&s.seriesData.push(o)}),_(r)?a=r.replace("{value}",a):x(r)&&(a=r(s))}return a}function Rf(t,e,i){var n=ot();return ht(n,n,i.rotation),lt(n,n,i.position),Io([t.dataToCoord(e),(i.labelOffset||0)+(i.labelDirection||1)*(i.labelMargin||0)],n)}function Vf(t,e,i,n,o,a){var r=DM.innerTextLayout(i.rotation,0,i.labelDirection);i.labelMargin=o.get("label.margin"),zf(e,n,o,a,{position:Rf(n.axis,t,i),align:r.textAlign,verticalAlign:r.textVerticalAlign})}function Bf(t,e,i){return i=i||0,{x1:t[i],y1:t[1-i],x2:e[i],y2:e[1-i]}}function Gf(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}function Wf(t,e,i,n,o,a){return{cx:t,cy:e,r0:i,r:n,startAngle:o,endAngle:a,clockwise:!0}}function Hf(t,e){var i={};return i[e.dim+"AxisIndex"]=e.index,t.getCartesian(i)}function Ff(t){return"x"===t.dim?0:1}function Zf(t){return t.isHorizontal()?0:1}function Uf(t,e){var i=t.getRect();return[i[nC[e]],i[nC[e]]+i[oC[e]]]}function Xf(t,e,i){var n=new db({shape:{x:t.x-10,y:t.y-10,width:0,height:t.height+20}});return So(n,{shape:{width:t.width+20,height:t.height+20}},e,i),n}function jf(t,e,i){if(t.count())for(var n,o=e.coordinateSystem,a=e.getLayerSeries(),r=f(a,function(e){return f(e.indices,function(e){var i=o.dataToPoint(t.get("time",e));return i[1]=t.get("value",e),i})}),s=qf(r),l=s.y0,h=i/s.max,u=a.length,c=a[0].indices.length,d=0;da&&(a=h),n.push(h)}for(var u=0;ua&&(a=d)}return r.y0=o,r.max=a,r}function Yf(t,e){return e=e||[0,0],f(["x","y"],function(i,n){var o=this.getAxis(i),a=e[n],r=t[n]/2;return"category"===o.type?o.getBandWidth():Math.abs(o.dataToCoord(a-r)-o.dataToCoord(a+r))},this)}function $f(t,e){return e=e||[0,0],f([0,1],function(i){var n=e[i],o=t[i]/2,a=[],r=[];return a[i]=n-o,r[i]=n+o,a[1-i]=r[1-i]=e[1-i],Math.abs(this.dataToPoint(a)[i]-this.dataToPoint(r)[i])},this)}function Kf(t,e){var i=this.getAxis(),n=e instanceof Array?e[0]:e,o=(t instanceof Array?t[0]:t)/2;return"category"===i.type?i.getBandWidth():Math.abs(i.dataToCoord(n-o)-i.dataToCoord(n+o))}function Jf(t,e){return f(["Radius","Angle"],function(i,n){var o=this["get"+i+"Axis"](),a=e[n],r=t[n]/2,s="dataTo"+i,l="category"===o.type?o.getBandWidth():Math.abs(o[s](a-r)-o[s](a+r));return"Angle"===i&&(l=l*Math.PI/180),l},this)}function Qf(t){var e,i=t.type;if("path"===i){var n=t.shape;(e=Un(n.pathData,null,{x:n.x||0,y:n.y||0,width:n.width||0,height:n.height||0},"center")).__customPathData=t.pathData}else"image"===i?(e=new qe({})).__customImagePath=t.style.image:"text"===i?(e=new ib({})).__customText=t.style.text:e=new(0,Tb[i.charAt(0).toUpperCase()+i.slice(1)]);return e.__customGraphicType=i,e.name=t.name,e}function tg(t,e,n,o,a,r){var s={},l=n.style||{};if(n.shape&&(s.shape=i(n.shape)),n.position&&(s.position=n.position.slice()),n.scale&&(s.scale=n.scale.slice()),n.origin&&(s.origin=n.origin.slice()),n.rotation&&(s.rotation=n.rotation),"image"===t.type&&n.style){h=s.style={};d(["x","y","width","height"],function(e){eg(e,h,l,t.style,r)})}if("text"===t.type&&n.style){var h=s.style={};d(["x","y"],function(e){eg(e,h,l,t.style,r)}),!l.hasOwnProperty("textFill")&&l.fill&&(l.textFill=l.fill),!l.hasOwnProperty("textStroke")&&l.stroke&&(l.textStroke=l.stroke)}if("group"!==t.type&&(t.useStyle(l),r)){t.style.opacity=0;var u=l.opacity;null==u&&(u=1),So(t,{style:{opacity:u}},o,e)}r?t.attr(s):wo(t,s,o,e),t.attr({z2:n.z2||0,silent:n.silent}),!1!==n.styleEmphasis&&uo(t,n.styleEmphasis)}function eg(t,e,i,n,o){null==i[t]||o||(e[t]=i[t],i[t]=n[t])}function ig(t,e,i,n){function o(t){null==t&&(t=u),y&&(c=e.getItemModel(t),d=c.getModel(uC),f=c.getModel(cC),g=Yr(e),p=e.getItemVisual(t,"color"),y=!1)}var s=t.get("renderItem"),l=t.coordinateSystem,h={};l&&(h=l.prepareCustoms?l.prepareCustoms():fC[l.type](l));var u,c,d,f,g,p,m=r({getWidth:n.getWidth,getHeight:n.getHeight,getZr:n.getZr,getDevicePixelRatio:n.getDevicePixelRatio,value:function(t,i){return null==i&&(i=u),e.get(e.getDimension(t||0),i)},style:function(i,n){null==n&&(n=u),o(n);var r=c.getModel(lC).getItemStyle();null!=p&&(r.fill=p);var s=e.getItemVisual(n,"opacity");return null!=s&&(r.opacity=s),null!=g&&(fo(r,d,null,{autoColor:p,isRectText:!0}),r.text=d.getShallow("show")?T(t.getFormattedLabel(n,"normal"),e.get(g,n)):null),i&&a(r,i),r},styleEmphasis:function(i,n){null==n&&(n=u),o(n);var r=c.getModel(hC).getItemStyle();return null!=g&&(fo(r,f,null,{isRectText:!0},!0),r.text=f.getShallow("show")?A(t.getFormattedLabel(n,"emphasis"),t.getFormattedLabel(n,"normal"),e.get(g,n)):null),i&&a(r,i),r},visual:function(t,i){return null==i&&(i=u),e.getItemVisual(i,t)},barLayout:function(t){if(l.getBaseAxis){var e=l.getBaseAxis();return nl.getLayoutOnAxis(r({axis:e},t),n)}},currentSeriesIndices:function(){return i.getCurrentSeriesIndices()},font:function(t){return _o(t,i)}},h.api||{}),v={context:{},seriesId:t.id,seriesName:t.name,seriesIndex:t.seriesIndex,coordSys:h.coordSys,dataInsideLength:e.count(),encode:ng(t.getData())},y=!0;return function(t){return u=t,y=!0,s&&s(r({dataIndexInside:t,dataIndex:e.getRawIndex(t)},v),m)||{}}}function ng(t){var e={};return d(t.dimensions,function(i,n){var o=t.getDimensionInfo(i);if(!o.isExtraCoord){var a=o.coordDim;(e[a]=e[a]||[])[o.coordDimIndex]=n}}),e}function og(t,e,i,n,o,a){(t=ag(t,e,i,n,o,a))&&a.setItemGraphicEl(e,t)}function ag(t,e,i,n,o,a){var r=i.type;if(!t||r===t.__customGraphicType||"path"===r&&i.pathData===t.__customPathData||"image"===r&&i.style.image===t.__customImagePath||"text"===r&&i.style.text===t.__customText||(o.remove(t),t=null),null!=r){var s=!t;if(!t&&(t=Qf(i)),tg(t,e,i,n,a,s),"group"===r){var l=t.children()||[],h=i.children||[];if(i.diffChildrenByName)rg({oldChildren:l,newChildren:h,dataIndex:e,animatableModel:n,group:t,data:a});else{for(var u=0;un?t-=l+a:t+=a),null!=r&&(e+h+r>o?e-=h+r:e+=r),[t,e]}function kg(t,e,i,n,o){var a=Pg(i),r=a.width,s=a.height;return t=Math.min(t+r,n)-r,e=Math.min(e+s,o)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function Pg(t){var e=t.clientWidth,i=t.clientHeight;if(document.defaultView&&document.defaultView.getComputedStyle){var n=document.defaultView.getComputedStyle(t);n&&(e+=parseInt(n.paddingLeft,10)+parseInt(n.paddingRight,10)+parseInt(n.borderLeftWidth,10)+parseInt(n.borderRightWidth,10),i+=parseInt(n.paddingTop,10)+parseInt(n.paddingBottom,10)+parseInt(n.borderTopWidth,10)+parseInt(n.borderBottomWidth,10))}return{width:e,height:i}}function Og(t,e,i){var n=i[0],o=i[1],a=0,r=0,s=e.width,l=e.height;switch(t){case"inside":a=e.x+s/2-n/2,r=e.y+l/2-o/2;break;case"top":a=e.x+s/2-n/2,r=e.y-o-5;break;case"bottom":a=e.x+s/2-n/2,r=e.y+l+5;break;case"left":a=e.x-n-5,r=e.y+l/2-o/2;break;case"right":a=e.x+s+5,r=e.y+l/2-o/2}return[a,r]}function zg(t){return"center"===t||"middle"===t}function Ng(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function Eg(t){return t.dim}function Rg(t,e){var i={};d(t,function(t,e){var n=t.getData(),o=t.coordinateSystem.getBaseAxis(),a=o.getExtent(),r="category"===o.type?o.getBandWidth():Math.abs(a[1]-a[0])/n.count(),s=i[Eg(o)]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},l=s.stacks;i[Eg(o)]=s;var h=Ng(t);l[h]||s.autoWidthCount++,l[h]=l[h]||{width:0,maxWidth:0};var u=Si(t.get("barWidth"),r),c=Si(t.get("barMaxWidth"),r),d=t.get("barGap"),f=t.get("barCategoryGap");u&&!l[h].width&&(u=Math.min(s.remainedWidth,u),l[h].width=u,s.remainedWidth-=u),c&&(l[h].maxWidth=c),null!=d&&(s.gap=d),null!=f&&(s.categoryGap=f)});var n={};return d(i,function(t,e){n[e]={};var i=t.stacks,o=t.bandWidth,a=Si(t.categoryGap,o),r=Si(t.gap,1),s=t.remainedWidth,l=t.autoWidthCount,h=(s-a)/(l+(l-1)*r);h=Math.max(h,0),d(i,function(t,e){var i=t.maxWidth;i&&ie[0]&&(e=e.slice().reverse());var n=t.coordToPoint([e[0],i]),o=t.coordToPoint([e[1],i]);return{x1:n[0],y1:n[1],x2:o[0],y2:o[1]}}function Ug(t){return t.getRadiusAxis().inverse?0:1}function Xg(t,e,i){return{position:[t.cx,t.cy],rotation:i/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotate:e.getModel("axisLabel").get("rotate"),z2:1}}function jg(t,e,i,n,o){var a=e.axis,r=a.dataToCoord(t),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l,h,u,c=n.getRadiusAxis().getExtent();if("radius"===a.dim){var d=ot();ht(d,d,s),lt(d,d,[n.cx,n.cy]),l=Io([r,-o],d);var f=e.getModel("axisLabel").get("rotate")||0,g=DM.innerTextLayout(s,f*Math.PI/180,-1);h=g.textAlign,u=g.textVerticalAlign}else{var p=c[1];l=n.coordToPoint([p+o,r]);var m=n.cx,v=n.cy;h=Math.abs(l[0]-m)/p<.3?"center":l[0]>m?"left":"right",u=Math.abs(l[1]-v)/p<.3?"middle":l[1]>v?"top":"bottom"}return{position:l,align:h,verticalAlign:u}}function qg(t,e){e.update="updateView",ir(e,function(e,i){var n={};return i.eachComponent({mainType:"geo",query:e},function(i){i[t](e.name),d(i.coordinateSystem.regions,function(t){n[t.name]=i.isSelected(t.name)||!1})}),{selected:n,name:e.name}})}function Yg(t){var e={};d(t,function(t){e[t]=1}),t.length=0,d(e,function(e,i){t.push(i)})}function $g(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!0}function Kg(t,e,n){function o(){var t=function(){};return t.prototype.__hidden=t.prototype,new t}var a={};return HC(e,function(e){var r=a[e]=o();HC(t[e],function(t,o){if(jI.isValidType(o)){var a={type:o,visual:t};n&&n(a,e),r[o]=new jI(a),"opacity"===o&&((a=i(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new jI(a))}})}),a}function Jg(t,e,n){var o;d(n,function(t){e.hasOwnProperty(t)&&$g(e[t])&&(o=!0)}),o&&d(n,function(n){e.hasOwnProperty(n)&&$g(e[n])?t[n]=i(e[n]):delete t[n]})}function Qg(t,e,i,n,o,a){function r(t){return i.getItemVisual(u,t)}function s(t,e){i.setItemVisual(u,t,e)}function l(t,l){u=null==a?t:l;var c=i.getRawDataItem(u);if(!c||!1!==c.visualMap)for(var d=n.call(o,t),f=e[d],g=h[d],p=0,m=g.length;p1)return!1;var u=ap(i-t,o-t,n-e,a-e)/l;return!(u<0||u>1)}function op(t){return t<=1e-6&&t>=-1e-6}function ap(t,e,i,n){return t*n-e*i}function rp(t,e,i){var n=this._targetInfoList=[],o={},a=lp(e,t);ZC($C,function(t,e){(!i||!i.include||UC(i.include,e)>=0)&&t(a,n,o)})}function sp(t){return t[0]>t[1]&&t.reverse(),t}function lp(t,e){return Fo(t,e,{includeMainTypes:qC})}function hp(t,e,i,n){var o=i.getAxis(["x","y"][t]),a=sp(f([0,1],function(t){return e?o.coordToData(o.toLocalCoord(n[t])):o.toGlobalCoord(o.dataToCoord(n[t]))})),r=[];return r[t]=a,r[1-t]=[NaN,NaN],{values:a,xyMinMax:r}}function up(t,e,i,n){return[e[0]-n[t]*i[0],e[1]-n[t]*i[1]]}function cp(t,e){var i=dp(t),n=dp(e),o=[i[0]/n[0],i[1]/n[1]];return isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o}function dp(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}function fp(t,e,i,n,o){if(o){var a=t.getZr();a[nD]||(a[iD]||(a[iD]=gp),La(a,iD,i,e)(t,n))}}function gp(t,e){if(!t.isDisposed()){var i=t.getZr();i[nD]=!0,t.dispatchAction({type:"brushSelect",batch:e}),i[nD]=!1}}function pp(t,e,i,n){for(var o=0,a=e.length;o=0}function Dp(t,e,i){function n(t,e){return l(e.nodes,t)>=0}function o(t,n){var o=!1;return e(function(e){d(i(t,e)||[],function(t){n.records[e.name][t]&&(o=!0)})}),o}function a(t,n){n.nodes.push(t),e(function(e){d(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){var r={nodes:[],records:{}};if(e(function(t){r.records[t.name]={}}),!i)return r;a(i,r);var s;do{s=!1,t(function(t){!n(t,r)&&o(t,r)&&(a(t,r),s=!0)})}while(s);return r}}function Lp(t,e,i){var n=[1/0,-1/0];return mD(i,function(t){var i=t.getData();i&&mD(t.coordDimToDataDim(e),function(t){var e=i.getDataExtent(t);e[0]n[1]&&(n[1]=e[1])})}),n[1]0?0:NaN);var r=i.getMax(!0);return null!=r&&"dataMax"!==r&&"function"!=typeof r?e[1]=r:o&&(e[1]=a>0?a-1:NaN),i.get("scale",!0)||(e[0]>0&&(e[0]=0),e[1]<0&&(e[1]=0)),e}function Pp(t,e){var i=t.getAxisModel(),n=t._percentWindow,o=t._valueWindow;if(n){var a=Ci(o,[0,500]);a=Math.min(a,20);var r=e||0===n[0]&&100===n[1];i.setRange(r?null:+o[0].toFixed(a),r?null:+o[1].toFixed(a))}}function Op(t){var e=t._minMaxSpan={},i=t._dataZoomModel;mD(["min","max"],function(n){e[n+"Span"]=i.get(n+"Span");var o=i.get(n+"ValueSpan");if(null!=o&&(e[n+"ValueSpan"]=o,null!=(o=t.getAxisModel().axis.scale.parse(o)))){var a=t._dataExtent;e[n+"Span"]=wi(a[0]+o,a,[0,100],!0)}})}function zp(t){var e={};return xD(["start","end","startValue","endValue","throttle"],function(i){t.hasOwnProperty(i)&&(e[i]=t[i])}),e}function Np(t,e){var i=t._rangePropMode,n=t.get("rangeMode");xD([["start","startValue"],["end","endValue"]],function(t,o){var a=null!=e[t[0]],r=null!=e[t[1]];a&&!r?i[o]="percent":!a&&r?i[o]="value":n?i[o]=n[o]:a&&(i[o]="percent")})}function Ep(t){return{x:"y",y:"x",radius:"angle",angle:"radius"}[t]}function Rp(t){return"vertical"===t?"ns-resize":"ew-resize"}function Vp(t,e){var i=Hp(t),n=e.dataZoomId,o=e.coordId;d(i,function(t,i){var a=t.dataZoomInfos;a[n]&&l(e.allCoordIds,o)<0&&(delete a[n],t.count--)}),Zp(i);var a=i[o];a||((a=i[o]={coordId:o,dataZoomInfos:{},count:0}).controller=Fp(t,a),a.dispatchAction=v(qp,t)),!a.dataZoomInfos[n]&&a.count++,a.dataZoomInfos[n]=e;var r=Yp(a.dataZoomInfos);a.controller.enable(r.controlType,r.opt),a.controller.setPointerChecker(e.containsPoint),La(a,"dispatchAction",e.throttleRate,"fixRate")}function Bp(t,e){var i=Hp(t);d(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),Zp(i)}function Gp(t,e){if(t&&"dataZoom"===t.type&&t.batch)for(var i=0,n=t.batch.length;in[e]&&(e=o),a(i,t.roamControllerOpt)}),{controlType:e,opt:i}}function $p(t,e,i){i.getAxisProxy(t.name,e).reset(i)}function Kp(t,e,i){i.getAxisProxy(t.name,e).filterData(i)}function Jp(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}function Qp(t,e){t.eachTargetSeries(function(e){var i=e.getData();Qg(t.stateList,t.targetVisuals,i,t.getValueState,t,t.getDataDimension(i))})}function tm(t){t.eachSeries(function(e){var i=e.getData(),n=[];t.eachComponent("visualMap",function(t){if(t.isTargetSeries(e)){var o=t.getVisualMeta(m(em,null,e,t))||{stops:[],outerColors:[]};o.dimension=t.getDataDimension(i),n.push(o)}}),e.getData().setVisual("visualMeta",n)})}function em(t,e,i,n){for(var o=e.targetVisuals[n],a=jI.prepareVisualTypes(o),r={color:t.getData().getVisual("color")},s=0,l=a.length;s=0&&(r[a]=+r[a].toFixed(h)),r}function vm(t,e){var n=t.getData(),o=t.coordinateSystem;if(e&&!gm(e)&&!y(e.coord)&&o){var a=o.dimensions,r=ym(e,n,o,t);if((e=i(e)).type&&fL[e.type]&&r.baseAxis&&r.valueAxis){var s=cL(a,r.baseAxis.dim),l=cL(a,r.valueAxis.dim);e.coord=fL[e.type](n,r.baseDataDim,r.valueDataDim,s,l),e.value=e.coord[l]}else{for(var h=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],u=0;u<2;u++)if(fL[h[u]]){var c=t.coordDimToDataDim(a[u])[0];h[u]=bm(n,c,h[u])}e.coord=h}}return e}function ym(t,e,i,n){var o={};return null!=t.valueIndex||null!=t.valueDim?(o.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,o.valueAxis=i.getAxis(n.dataDimToCoordDim(o.valueDataDim)),o.baseAxis=i.getOtherAxis(o.valueAxis),o.baseDataDim=n.coordDimToDataDim(o.baseAxis.dim)[0]):(o.baseAxis=n.getBaseAxis(),o.valueAxis=i.getOtherAxis(o.baseAxis),o.baseDataDim=n.coordDimToDataDim(o.baseAxis.dim)[0],o.valueDataDim=n.coordDimToDataDim(o.valueAxis.dim)[0]),o}function xm(t,e){return!(t&&t.containData&&e.coord&&!fm(e))||t.containData(e.coord)}function _m(t,e,i,n){return n<2?t.coord&&t.coord[n]:t.value}function bm(t,e,i){if("average"===i){var n=0,o=0;return t.each(e,function(t,e){isNaN(t)||(n+=t,o++)},!0),n/o}return t.getDataExtent(e,!0)["max"===i?1:0]}function wm(t,e,i){var n=e.coordinateSystem;t.each(function(o){var a,r=t.getItemModel(o),s=Si(r.get("x"),i.getWidth()),l=Si(r.get("y"),i.getHeight());if(isNaN(s)||isNaN(l)){if(e.getMarkerPosition)a=e.getMarkerPosition(t.getValues(t.dimensions,o));else if(n){var h=t.get(n.dimensions[0],o),u=t.get(n.dimensions[1],o);a=n.dataToPoint([h,u])}}else a=[s,l];isNaN(s)||(a[0]=s),isNaN(l)||(a[1]=l),t.setItemLayout(o,a)})}function Sm(t,e,i){var n;n=t?f(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}):[{name:"value",type:"float"}];var o=new aS(n,i),a=f(i.get("data"),v(vm,e));return t&&(a=p(a,v(xm,t))),o.initData(a,null,t?_m:function(t){return t.value}),o}function Mm(t){return!isNaN(t)&&!isFinite(t)}function Im(t,e,i,n){var o=1-t,a=n.dimensions[t];return Mm(e[o])&&Mm(i[o])&&e[t]===i[t]&&n.getAxis(a).containData(e[t])}function Tm(t,e){if("cartesian2d"===t.type){var i=e[0].coord,n=e[1].coord;if(i&&n&&(Im(1,i,n,t)||Im(0,i,n,t)))return!0}return xm(t,e[0])&&xm(t,e[1])}function Am(t,e,i,n,o){var a,r=n.coordinateSystem,s=t.getItemModel(e),l=Si(s.get("x"),o.getWidth()),h=Si(s.get("y"),o.getHeight());if(isNaN(l)||isNaN(h)){if(n.getMarkerPosition)a=n.getMarkerPosition(t.getValues(t.dimensions,e));else{var u=r.dimensions,c=t.get(u[0],e),d=t.get(u[1],e);a=r.dataToPoint([c,d])}if("cartesian2d"===r.type){var f=r.getAxis("x"),g=r.getAxis("y"),u=r.dimensions;Mm(t.get(u[0],e))?a[0]=f.toGlobalCoord(f.getExtent()[i?0:1]):Mm(t.get(u[1],e))&&(a[1]=g.toGlobalCoord(g.getExtent()[i?0:1]))}isNaN(l)||(a[0]=l),isNaN(h)||(a[1]=h)}else a=[l,h];t.setItemLayout(e,a)}function Cm(t,e,i){var n;n=t?f(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}):[{name:"value",type:"float"}];var o=new aS(n,i),a=new aS(n,i),r=new aS([],i),s=f(i.get("data"),v(pL,e,t,i));t&&(s=p(s,v(Tm,t)));var l=t?_m:function(t){return t.value};return o.initData(f(s,function(t){return t[0]}),null,l),a.initData(f(s,function(t){return t[1]}),null,l),r.initData(f(s,function(t){return t[2]})),r.hasItemOption=!0,{from:o,to:a,line:r}}function Dm(t){return!isNaN(t)&&!isFinite(t)}function Lm(t,e,i,n){var o=1-t;return Dm(e[o])&&Dm(i[o])}function km(t,e){var i=e.coord[0],n=e.coord[1];return!("cartesian2d"!==t.type||!i||!n||!Lm(1,i,n,t)&&!Lm(0,i,n,t))||(xm(t,{coord:i,x:e.x0,y:e.y0})||xm(t,{coord:n,x:e.x1,y:e.y1}))}function Pm(t,e,i,n,o){var a,r=n.coordinateSystem,s=t.getItemModel(e),l=Si(s.get(i[0]),o.getWidth()),h=Si(s.get(i[1]),o.getHeight());if(isNaN(l)||isNaN(h)){if(n.getMarkerPosition)a=n.getMarkerPosition(t.getValues(i,e));else{var u=t.get(i[0],e),c=t.get(i[1],e);a=r.dataToPoint([u,c],!0)}if("cartesian2d"===r.type){var d=r.getAxis("x"),f=r.getAxis("y"),u=t.get(i[0],e),c=t.get(i[1],e);Dm(u)?a[0]=d.toGlobalCoord(d.getExtent()["x0"===i[0]?0:1]):Dm(c)&&(a[1]=f.toGlobalCoord(f.getExtent()["y0"===i[1]?0:1]))}isNaN(l)||(a[0]=l),isNaN(h)||(a[1]=h)}else a=[l,h];return a}function Om(t,e,i){var n,o,a=["x0","y0","x1","y1"];t?(n=f(t&&t.dimensions,function(t){var i=e.getData().getDimensionInfo(e.coordDimToDataDim(t)[0])||{};return i.name=t,i}),o=new aS(f(a,function(t,e){return{name:t,type:n[e%2].type}}),i)):o=new aS(n=[{name:"value",type:"float"}],i);var r=f(i.get("data"),v(mL,e,t,i));t&&(r=p(r,v(km,t)));var s=t?function(t,e,i,n){return t.coord[Math.floor(n/2)][n%2]}:function(t){return t.value};return o.initData(r,null,s),o.hasItemOption=!0,o}function zm(t){var e=t.type,i={number:"value",time:"time"};if(i[e]&&(t.axisType=i[e],delete t.type),Nm(t),Em(t,"controlPosition")){var n=t.controlStyle||(t.controlStyle={});Em(n,"position")||(n.position=t.controlPosition),"none"!==n.position||Em(n,"show")||(n.show=!1,delete n.position),delete t.controlPosition}d(t.data||[],function(t){b(t)&&!y(t)&&(!Em(t,"value")&&Em(t,"name")&&(t.value=t.name),Nm(t))})}function Nm(t){var e=t.itemStyle||(t.itemStyle={}),i=e.emphasis||(e.emphasis={}),n=t.label||t.label||{},o=n.normal||(n.normal={}),a={normal:1,emphasis:1};d(n,function(t,e){a[e]||Em(o,e)||(o[e]=t)}),i.label&&!Em(n,"emphasis")&&(n.emphasis=i.label,delete i.label)}function Em(t,e){return t.hasOwnProperty(e)}function Rm(t,e){return Ko(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()},t.get("padding"))}function Vm(t,e,n,o){return Un(t.get(e).replace(/^path:\/\//,""),i(o||{}),new jt(n[0],n[1],n[2],n[3]),"center")}function Bm(t,e,i,o,a,r){var s=e.get("color");a?(a.setColor(s),i.add(a),r&&r.onUpdate(a)):((a=Hr(t.get("symbol"),-1,-1,2,2,s)).setStyle("strokeNoScale",!0),i.add(a),r&&r.onCreate(a));var l=e.getItemStyle(["color","symbol","symbolSize"]);a.setStyle(l),o=n({rectHover:!0,z2:100},o,!0);var h=t.get("symbolSize");(h=h instanceof Array?h.slice():[+h,+h])[0]/=2,h[1]/=2,o.scale=h;var u=t.get("symbolOffset");if(u){var c=o.position=o.position||[0,0];c[0]+=Si(u[0],h[0]),c[1]+=Si(u[1],h[1])}var d=t.get("symbolRotate");return o.rotation=(d||0)*Math.PI/180||0,a.attr(o),a.updateTransform(),a}function Gm(t,e,i,n,o){if(!t.dragging){var a=n.getModel("checkpointStyle"),r=i.dataToCoord(n.getData().get(["value"],e));o||!a.get("animation",!0)?t.attr({position:[r,0]}):(t.stopAnimation(!0),t.animateTo({position:[r,0]},a.get("animationDuration",!0),a.get("animationEasing",!0)))}}function Wm(t){return 0===t.indexOf("my")}function Hm(t){this.model=t}function Fm(t){this.model=t}function Zm(t){var e={},i=[],n=[];return t.eachRawSeries(function(t){var o=t.coordinateSystem;if(!o||"cartesian2d"!==o.type&&"polar"!==o.type)i.push(t);else{var a=o.getBaseAxis();if("category"===a.type){var r=a.dim+"_"+a.index;e[r]||(e[r]={categoryAxis:a,valueAxis:o.getOtherAxis(a),series:[]},n.push({axisDim:a.dim,axisIndex:a.index})),e[r].series.push(t)}else i.push(t)}}),{seriesGroupByCategoryAxis:e,other:i,meta:n}}function Um(t){var e=[];return d(t,function(t,i){var n=t.categoryAxis,o=t.valueAxis.dim,a=[" "].concat(f(t.series,function(t){return t.name})),r=[n.model.getCategories()];d(t.series,function(t){r.push(t.getRawData().mapArray(o,function(t){return t}))});for(var s=[a.join(PL)],l=0;l=0)return!0}function $m(t){for(var e=t.split(/\n+/g),i=[],n=f(qm(e.shift()).split(OL),function(t){return{name:t,data:[]}}),o=0;o=0&&!i[o][n];o--);if(o<0){var a=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(a){var r=a.getPercentRange();i[0][n]={dataZoomId:n,start:r[0],end:r[1]}}}}),i.push(e)}function iv(t){var e=av(t),i=e[e.length-1];e.length>1&&e.pop();var n={};return zL(i,function(t,i){for(var o=e.length-1;o>=0;o--)if(t=e[o][i]){n[i]=t;break}}),n}function nv(t){t[NL]=null}function ov(t){return av(t).length}function av(t){var e=t[NL];return e||(e=t[NL]=[{}]),e}function rv(t,e,i){(this._brushController=new Yu(i.getZr())).on("brush",m(this._onBrush,this)).mount(),this._isZoomActive}function sv(t){var e={};return d(["xAxisIndex","yAxisIndex"],function(i){e[i]=t[i],null==e[i]&&(e[i]="all"),(!1===e[i]||"none"===e[i])&&(e[i]=[])}),e}function lv(t,e){t.setIconStatus("back",ov(e)>1?"emphasis":"normal")}function hv(t,e,i,n,o){var a=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(a="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=a,t.setIconStatus("zoom",a?"emphasis":"normal");var r=new rp(sv(t.option),e,{include:["grid"]});i._brushController.setPanels(r.makePanelOpts(o,function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"})).enableBrush(!!a&&{brushType:"auto",brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}function uv(t){this.model=t}function cv(t){return HL(t)}function dv(){if(!UL&&XL){UL=!0;var t=XL.styleSheets;t.length<31?XL.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}}function fv(t){return parseInt(t,10)}function gv(t,e){dv(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var o=e.delFromStorage,a=e.addToStorage;e.delFromStorage=function(t){o.call(e,t),t&&t.onRemove&&t.onRemove(n)},e.addToStorage=function(t){t.onAdd&&t.onAdd(n),a.call(e,t)},this._firstPaint=!0}function pv(t){return function(){Wy('In IE8.0 VML mode painter not support method "'+t+'"')}}function mv(t){return document.createElementNS(Tk,t)}function vv(t){return Lk(1e4*t)/1e4}function yv(t){return t-Ek}function xv(t,e){var i=e?t.textFill:t.fill;return null!=i&&i!==Dk}function _v(t,e){var i=e?t.textStroke:t.stroke;return null!=i&&i!==Dk}function bv(t,e){e&&wv(t,"transform","matrix("+Ck.call(e,",")+")")}function wv(t,e,i){(!i||"linear"!==i.type&&"radial"!==i.type)&&t.setAttribute(e,i)}function Sv(t,e,i){t.setAttributeNS("http://www.w3.org/1999/xlink",e,i)}function Mv(t,e,i){if(xv(e,i)){var n=i?e.textFill:e.fill;n="transparent"===n?Dk:n,"none"!==t.getAttribute("clip-path")&&n===Dk&&(n="rgba(0, 0, 0, 0.002)"),wv(t,"fill",n),wv(t,"fill-opacity",e.opacity)}else wv(t,"fill",Dk);if(_v(e,i)){var o=i?e.textStroke:e.stroke;wv(t,"stroke",o="transparent"===o?Dk:o),wv(t,"stroke-width",(i?e.textStrokeWidth:e.lineWidth)/(e.strokeNoScale?e.host.getLineScale():1)),wv(t,"paint-order","stroke"),wv(t,"stroke-opacity",e.opacity),e.lineDash?(wv(t,"stroke-dasharray",e.lineDash.join(",")),wv(t,"stroke-dashoffset",Lk(e.lineDashOffset||0))):wv(t,"stroke-dasharray",""),e.lineCap&&wv(t,"stroke-linecap",e.lineCap),e.lineJoin&&wv(t,"stroke-linejoin",e.lineJoin),e.miterLimit&&wv(t,"stroke-miterlimit",e.miterLimit)}else wv(t,"stroke",Dk)}function Iv(t){for(var e=[],i=t.data,n=t.len(),o=0;o=zk||!yv(p)&&(d>-Ok&&d<0||d>Ok)==!!g;var y=vv(s+h*Pk(c)),x=vv(l+u*kk(c));m&&(d=g?zk-1e-4:1e-4-zk,v=!0,9===o&&e.push("M",y,x));var _=vv(s+h*Pk(c+d)),b=vv(l+u*kk(c+d));e.push("A",vv(h),vv(u),Lk(f*Nk),+v,+g,_,b);break;case Ak.Z:a="Z";break;case Ak.R:var _=vv(i[o++]),b=vv(i[o++]),w=vv(i[o++]),S=vv(i[o++]);e.push("M",_,b,"L",_+w,b,"L",_+w,b+S,"L",_,b+S,"L",_,b)}a&&e.push(a);for(var M=0;M=11)}}(navigator.userAgent),Xv={"[object Function]":1,"[object RegExp]":1,"[object Date]":1,"[object Error]":1,"[object CanvasGradient]":1,"[object CanvasPattern]":1,"[object Image]":1,"[object Canvas]":1},jv={"[object Int8Array]":1,"[object Uint8Array]":1,"[object Uint8ClampedArray]":1,"[object Int16Array]":1,"[object Uint16Array]":1,"[object Int32Array]":1,"[object Uint32Array]":1,"[object Float32Array]":1,"[object Float64Array]":1},qv=Object.prototype.toString,Yv=Array.prototype,$v=Yv.forEach,Kv=Yv.filter,Jv=Yv.slice,Qv=Yv.map,ty=Yv.reduce,ey={},iy=function(){return ey.createCanvas()};ey.createCanvas=function(){return document.createElement("canvas")};var ny,oy="__ec_primitive__";O.prototype={constructor:O,get:function(t){return this["_ec_"+t]},set:function(t,e){return this["_ec_"+t]=e,e},each:function(t,e){void 0!==e&&(t=m(t,e));for(var i in this)this.hasOwnProperty(i)&&t(this[i],i.slice(4))},removeKey:function(t){delete this["_ec_"+t]}};var ay=(Object.freeze||Object)({$override:e,clone:i,merge:n,mergeAll:o,extend:a,defaults:r,createCanvas:iy,getContext:s,indexOf:l,inherits:h,mixin:u,isArrayLike:c,each:d,map:f,reduce:g,filter:p,find:function(t,e,i){if(t&&e)for(var n=0,o=t.length;n3&&(e=dy.call(e,1));for(var n=this._$handlers[t],o=n.length,a=0;a4&&(e=dy.call(e,1,e.length-1));for(var n=e[e.length-1],o=this._$handlers[t],a=o.length,r=0;r=0;a--){var r;if(n[a]!==i&&!n[a].ignore&&(r=nt(n[a],t,e))&&(!o.topTarget&&(o.topTarget=n[a]),r!==gy)){o.target=n[a];break}}return o}},d(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){my.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY),n=i.target;if("mousedown"===t)this._downEl=n,this._downPoint=[e.zrX,e.zrY],this._upEl=n;else if("mosueup"===t)this._upEl=n;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||hy(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}}),u(my,fy),u(my,Q);var vy="undefined"==typeof Float32Array?Array:Float32Array,yy=(Object.freeze||Object)({create:ot,identity:at,copy:rt,mul:st,translate:lt,rotate:ht,scale:ut,invert:ct}),xy=at,_y=5e-5,by=function(t){(t=t||{}).position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},wy=by.prototype;wy.transform=null,wy.needLocalTransform=function(){return dt(this.rotation)||dt(this.position[0])||dt(this.position[1])||dt(this.scale[0]-1)||dt(this.scale[1]-1)},wy.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;i||e?(n=n||ot(),i?this.getLocalTransform(n):xy(n),e&&(i?st(n,t.transform,n):rt(n,t.transform)),this.transform=n,this.invTransform=this.invTransform||ot(),ct(this.invTransform,n)):n&&xy(n)},wy.getLocalTransform=function(t){return by.getLocalTransform(this,t)},wy.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},wy.restoreTransform=function(t){var e=t.dpr||1;t.setTransform(e,0,0,e,0,0)};var Sy=[];wy.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(st(Sy,t.invTransform,e),e=Sy);var i=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],o=this.position,a=this.scale;dt(i-1)&&(i=Math.sqrt(i)),dt(n-1)&&(n=Math.sqrt(n)),e[0]<0&&(i=-i),e[3]<0&&(n=-n),o[0]=e[4],o[1]=e[5],a[0]=i,a[1]=n,this.rotation=Math.atan2(-e[1]/n,e[0]/i)}},wy.getGlobalScale=function(){var t=this.transform;if(!t)return[1,1];var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(t[2]*t[2]+t[3]*t[3]);return t[0]<0&&(e=-e),t[3]<0&&(i=-i),[e,i]},wy.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&$(i,i,n),i},wy.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&$(i,i,n),i},by.getLocalTransform=function(t,e){xy(e=e||[]);var i=t.origin,n=t.scale||[1,1],o=t.rotation||0,a=t.position||[0,0];return i&&(e[4]-=i[0],e[5]-=i[1]),ut(e,e,n),o&&ht(e,e,o),i&&(e[4]+=i[0],e[5]+=i[1]),e[4]+=a[0],e[5]+=a[1],e};var My={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-My.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*My.bounceIn(2*t):.5*My.bounceOut(2*t-1)+.5}};ft.prototype={constructor:ft,step:function(t,e){if(this._initialized||(this._startTime=t+this._delay,this._initialized=!0),this._paused)this._pausedTime+=e;else{var i=(t-this._startTime-this._pausedTime)/this._life;if(!(i<0)){i=Math.min(i,1);var n=this.easing,o="string"==typeof n?My[n]:n,a="function"==typeof o?o(i):i;return this.fire("frame",a),1==i?this.loop?(this.restart(t),"restart"):(this._needsRemove=!0,"destroy"):null}}},restart:function(t){var e=(t-this._startTime-this._pausedTime)%this._life;this._startTime=t-e+this.gap,this._pausedTime=0,this._needsRemove=!1},fire:function(t,e){this[t="on"+t]&&this[t](this._target,e)},pause:function(){this._paused=!0},resume:function(){this._paused=!1}};var Iy=function(){this.head=null,this.tail=null,this._len=0},Ty=Iy.prototype;Ty.insert=function(t){var e=new Ay(t);return this.insertEntry(e),e},Ty.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},Ty.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},Ty.len=function(){return this._len},Ty.clear=function(){this.head=this.tail=null,this._len=0};var Ay=function(t){this.value=t,this.next,this.prev},Cy=function(t){this._list=new Iy,this._map={},this._maxSize=t||10,this._lastRemovedEntry=null},Dy=Cy.prototype;Dy.put=function(t,e){var i=this._list,n=this._map,o=null;if(null==n[t]){var a=i.len(),r=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=i.head;i.remove(s),delete n[s.key],o=s.value,this._lastRemovedEntry=s}r?r.value=e:r=new Ay(e),r.key=t,i.insertEntry(r),n[t]=r}return o},Dy.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},Dy.clear=function(){this._list.clear(),this._map={}};var Ly={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},ky=new Cy(20),Py=null,Oy=Dt,zy=Lt,Ny=(Object.freeze||Object)({parse:Mt,lift:At,toHex:Ct,fastLerp:Dt,fastMapToColor:Oy,lerp:Lt,mapToColor:zy,modifyHSL:kt,modifyAlpha:Pt,stringify:Ot}),Ey=Array.prototype.slice,Ry=function(t,e,i,n){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||zt,this._setter=n||Nt,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};Ry.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var o=this._getter(this._target,n);if(null==o)continue;0!==t&&i[n].push({time:0,value:Ft(o)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},pause:function(){for(var t=0;t0&&this.animate(t,!1).when(null==n?500:n,a).delay(o||0),this}};var Fy=function(t){by.call(this,t),fy.call(this,t),Hy.call(this,t),this.id=t.id||Fv()};Fy.prototype={type:"element",name:"",__zr:null,ignore:!1,clipPath:null,drift:function(t,e){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=e,this.decomposeTransform(),this.dirty(!1)},beforeUpdate:function(){},afterUpdate:function(){},update:function(){this.updateTransform()},traverse:function(t,e){},attrKV:function(t,e){if("position"===t||"scale"===t||"origin"===t){if(e){var i=this[t];i||(i=this[t]=[]),i[0]=e[0],i[1]=e[1]}}else this[t]=e},hide:function(){this.ignore=!0,this.__zr&&this.__zr.refresh()},show:function(){this.ignore=!1,this.__zr&&this.__zr.refresh()},attr:function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(b(t))for(var i in t)t.hasOwnProperty(i)&&this.attrKV(i,t[i]);return this.dirty(!1),this},setClipPath:function(t){var e=this.__zr;e&&t.addSelfToZr(e),this.clipPath&&this.clipPath!==t&&this.removeClipPath(),this.clipPath=t,t.__zr=e,t.__clipTarget=this,this.dirty(!1)},removeClipPath:function(){var t=this.clipPath;t&&(t.__zr&&t.removeSelfFromZr(t.__zr),t.__zr=null,t.__clipTarget=null,this.clipPath=null,this.dirty(!1))},addSelfToZr:function(t){this.__zr=t;var e=this.animators;if(e)for(var i=0;i=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new jt(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},jt.create=function(t){return new jt(t.x,t.y,t.width,t.height)};var jy=function(t){t=t||{},Fy.call(this,t);for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this._children=[],this.__storage=null,this.__dirty=!0};jy.prototype={constructor:jy,isGroup:!0,type:"group",silent:!1,children:function(){return this._children.slice()},childAt:function(t){return this._children[t]},childOfName:function(t){for(var e=this._children,i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToStorage(t),t instanceof jy&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,n=this._children,o=l(n,t);return o<0?this:(n.splice(o,1),t.parent=null,i&&(i.delFromStorage(t),t instanceof jy&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;e=0&&(this.delFromStorage(t),this._roots.splice(o,1),t instanceof jy&&t.delChildrenFromStorage(this))}},addToStorage:function(t){return t.__storage=this,t.dirty(!1),this},delFromStorage:function(t){return t&&(t.__storage=null),this},dispose:function(){this._renderList=this._roots=null},displayableSortFunc:ie};var Ky=[["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["shadowColor","#000"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],Jy=function(t,e){this.extendFrom(t,!1),this.host=e};Jy.prototype={constructor:Jy,host:null,fill:"#000",stroke:null,opacity:1,lineDash:null,lineDashOffset:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,lineWidth:1,strokeNoScale:!1,text:null,font:null,textFont:null,fontStyle:null,fontWeight:null,fontSize:null,fontFamily:null,textTag:null,textFill:"#000",textStroke:null,textWidth:null,textHeight:null,textStrokeWidth:0,textLineHeight:null,textPosition:"inside",textRect:null,textOffset:null,textAlign:null,textVerticalAlign:null,textDistance:5,textShadowColor:"transparent",textShadowBlur:0,textShadowOffsetX:0,textShadowOffsetY:0,textBoxShadowColor:"transparent",textBoxShadowBlur:0,textBoxShadowOffsetX:0,textBoxShadowOffsetY:0,transformText:!1,textRotation:0,textOrigin:null,textBackgroundColor:null,textBorderColor:null,textBorderWidth:0,textBorderRadius:0,textPadding:null,rich:null,truncate:null,blend:null,bind:function(t,e,i){for(var n=this,o=i&&i.style,a=!o,r=0;r0},extendFrom:function(t,e){if(t)for(var i in t)!t.hasOwnProperty(i)||!0!==e&&(!1===e?this.hasOwnProperty(i):null==t[i])||(this[i]=t[i])},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,i){for(var n=("radial"===e.type?oe:ne)(t,e,i),o=e.colorStops,a=0;a=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i=0){if(!s){if((s=this._progressiveLayers[Math.min(h++,4)]).ctx.save(),s.renderScope={},s&&s.__progress>s.__maxProgress){g=s.__nextIdxNotProg-1;continue}l=s.__progress,s.__dirty||(f=l),s.__progress=f+1}y===f&&this._doPaintEl(m,s,!0,s.renderScope)}else this._doPaintEl(m,n,e,r);m.__dirty=!1}}s&&i(s),a&&a.restore(),this._furtherProgressive=!1,d(this._progressiveLayers,function(t){t.__maxProgress>=t.__progress&&(this._furtherProgressive=!0)},this)},_doPaintEl:function(t,e,i,n){var o=e.ctx,a=t.transform;if((e.__dirty||i)&&!t.invisible&&0!==t.style.opacity&&(!a||a[0]||a[3])&&(!t.culling||!Qe(t,this._width,this._height))){var r=t.__clipPaths;(n.prevClipLayer!==e||ti(r,n.prevElClipPaths))&&(n.prevElClipPaths&&(n.prevClipLayer.ctx.restore(),n.prevClipLayer=n.prevElClipPaths=null,n.prevEl=null),r&&(o.save(),ei(r,o),n.prevClipLayer=e,n.prevElClipPaths=r)),t.beforeBrush&&t.beforeBrush(o),t.brush(o,n.prevEl||null),n.prevEl=t,t.afterBrush&&t.afterBrush(o)}},getLayer:function(t){if(this._singleCanvas)return this._layers[0];var e=this._layers[t];return e||((e=new nx("zr_"+t,this,this.dpr)).__builtin__=!0,this._layerConfig[t]&&n(e,this._layerConfig[t],!0),this.insertLayer(t,e),e.initContext()),e},insertLayer:function(t,e){var i=this._layers,n=this._zlevelList,o=n.length,a=null,r=-1,s=this._domRoot;if(i[t])Wy("ZLevel "+t+" has been used already");else if($e(e)){if(o>0&&t>n[0]){for(r=0;rt);r++);a=i[n[r]]}if(n.splice(r+1,0,t),i[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?s.insertBefore(e.dom,l.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}else Wy("Layer of zlevel "+t+" is not valid")},eachLayer:function(t,e){var i,n,o=this._zlevelList;for(n=0;n=0){r!==g&&(r=g,l++);var p=c.__frame=l-1;if(!a){var m=Math.min(s,4);(a=i[m])||(a=i[m]=new nx("progressive",this,this.dpr)).initContext(),a.__maxProgress=0}a.__dirty=a.__dirty||c.__dirty,a.elCount++,a.__maxProgress=Math.max(a.__maxProgress,p),a.__maxProgress>=a.__progress&&(f.__dirty=!0)}else c.__frame=-1,a&&(a.__nextIdxNotProg=h,s++,a=null)}a&&(s++,a.__nextIdxNotProg=h),this.eachBuiltinLayer(function(t,e){n[e]!==t.elCount&&(t.__dirty=!0)}),i.length=Math.min(s,5),d(i,function(t,e){o[e]!==t.elCount&&(c.__dirty=!0),t.__dirty&&(t.__progress=0)})},clear:function(){return this.eachBuiltinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?n(i[t],e,!0):i[t]=e;var o=this._layers[t];o&&n(o,i[t],!0)}},delLayer:function(t){var e=this._layers,i=this._zlevelList,n=e[t];n&&(n.dom.parentNode.removeChild(n.dom),delete e[t],i.splice(l(i,t),1))},resize:function(t,e){var i=this._domRoot;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!=t||e!=this._height){i.style.width=t+"px",i.style.height=e+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(t,e);d(this._progressiveLayers,function(i){i.resize(t,e)}),this.refresh(!0)}return this._width=t,this._height=e,this},clearLayer:function(t){var e=this._layers[t];e&&e.clear()},dispose:function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},getRenderedCanvas:function(t){function e(t,e){var n=r._zlevelList;null==t&&(t=-1/0);for(var o,a=0;at&&s=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;i1&&n&&n.length>1){var a=ui(n)/ui(o);!isFinite(a)&&(a=1),e.pinchScale=a;var r=ci(n);return e.pinchX=r[0],e.pinchY=r[1],{type:"pinch",target:t[0].target,event:e}}}}},Ix=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Tx=["touchstart","touchend","touchmove"],Ax={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},Cx=f(Ix,function(t){var e=t.replace("mouse","pointer");return Ax[e]?e:t}),Dx={mousemove:function(t){t=ri(this.dom,t),this.trigger("mousemove",t)},mouseout:function(t){var e=(t=ri(this.dom,t)).toElement||t.relatedTarget;if(e!=this.dom)for(;e&&9!=e.nodeType;){if(e===this.dom)return;e=e.parentNode}this.trigger("mouseout",t)},touchstart:function(t){(t=ri(this.dom,t)).zrByTouch=!0,this._lastTouchMoment=new Date,fi(this,t,"start"),Dx.mousemove.call(this,t),Dx.mousedown.call(this,t),gi(this)},touchmove:function(t){(t=ri(this.dom,t)).zrByTouch=!0,fi(this,t,"change"),Dx.mousemove.call(this,t),gi(this)},touchend:function(t){(t=ri(this.dom,t)).zrByTouch=!0,fi(this,t,"end"),Dx.mouseup.call(this,t),+new Date-this._lastTouchMoment<300&&Dx.click.call(this,t),gi(this)},pointerdown:function(t){Dx.mousedown.call(this,t)},pointermove:function(t){pi(t)||Dx.mousemove.call(this,t)},pointerup:function(t){Dx.mouseup.call(this,t)},pointerout:function(t){pi(t)||Dx.mouseout.call(this,t)}};d(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){Dx[t]=function(e){e=ri(this.dom,e),this.trigger(t,e)}});var Lx=vi.prototype;Lx.dispose=function(){for(var t=Ix.concat(Tx),e=0;e=0||n&&l(n,r)<0)){var s=e.getShallow(r);null!=s&&(o[t[a][0]]=s)}}return o}},Kx=$x([["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),Jx={getLineStyle:function(t){var e=Kx(this,t),i=this.getLineDash(e.lineWidth);return i&&(e.lineDash=i),e},getLineDash:function(t){null==t&&(t=1);var e=this.get("type"),i=Math.max(t,2),n=4*t;return"solid"===e||null==e?null:"dashed"===e?[n,n]:[i,i]}},Qx=$x([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),t_={getAreaStyle:function(t,e){return Qx(this,t,e)}},e_=Math.pow,i_=Math.sqrt,n_=1e-8,o_=1e-4,a_=i_(3),r_=1/3,s_=E(),l_=E(),h_=E(),u_=Math.min,c_=Math.max,d_=Math.sin,f_=Math.cos,g_=2*Math.PI,p_=E(),m_=E(),v_=E(),y_=[],x_=[],__={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},b_=[],w_=[],S_=[],M_=[],I_=Math.min,T_=Math.max,A_=Math.cos,C_=Math.sin,D_=Math.sqrt,L_=Math.abs,k_="undefined"!=typeof Float32Array,P_=function(t){this._saveData=!t,this._saveData&&(this.data=[]),this._ctx=null};P_.prototype={constructor:P_,_xi:0,_yi:0,_x0:0,_y0:0,_ux:0,_uy:0,_len:0,_lineDash:null,_dashOffset:0,_dashIdx:0,_dashSum:0,setScale:function(t,e){this._ux=L_(1/By/t)||0,this._uy=L_(1/By/e)||0},getContext:function(){return this._ctx},beginPath:function(t){return this._ctx=t,t&&t.beginPath(),t&&(this.dpr=t.dpr),this._saveData&&(this._len=0),this._lineDash&&(this._lineDash=null,this._dashOffset=0),this},moveTo:function(t,e){return this.addData(__.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},lineTo:function(t,e){var i=L_(t-this._xi)>this._ux||L_(e-this._yi)>this._uy||this._len<5;return this.addData(__.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,o,a){return this.addData(__.C,t,e,i,n,o,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,o,a):this._ctx.bezierCurveTo(t,e,i,n,o,a)),this._xi=o,this._yi=a,this},quadraticCurveTo:function(t,e,i,n){return this.addData(__.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,o,a){return this.addData(__.A,t,e,i,i,n,o-n,0,a?0:1),this._ctx&&this._ctx.arc(t,e,i,n,o,a),this._xi=A_(o)*i+t,this._yi=C_(o)*i+t,this},arcTo:function(t,e,i,n,o){return this._ctx&&this._ctx.arcTo(t,e,i,n,o),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(__.R,t,e,i,n),this},closePath:function(){this.addData(__.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&f<=t||u<0&&f>=t||0==u&&(c>0&&g<=e||c<0&&g>=e);)f+=u*(i=r[n=this._dashIdx]),g+=c*i,this._dashIdx=(n+1)%p,u>0&&fl||c>0&&gh||s[n%2?"moveTo":"lineTo"](u>=0?I_(f,t):T_(f,t),c>=0?I_(g,e):T_(g,e));u=f-t,c=g-e,this._dashOffset=-D_(u*u+c*c)},_dashedBezierTo:function(t,e,i,n,o,a){var r,s,l,h,u,c=this._dashSum,d=this._dashOffset,f=this._lineDash,g=this._ctx,p=this._xi,m=this._yi,v=on,y=0,x=this._dashIdx,_=f.length,b=0;for(d<0&&(d=c+d),d%=c,r=0;r<1;r+=.1)s=v(p,t,i,o,r+.1)-v(p,t,i,o,r),l=v(m,e,n,a,r+.1)-v(m,e,n,a,r),y+=D_(s*s+l*l);for(;x<_&&!((b+=f[x])>d);x++);for(r=(b-d)/y;r<=1;)h=v(p,t,i,o,r),u=v(m,e,n,a,r),x%2?g.moveTo(h,u):g.lineTo(h,u),r+=f[x]/y,x=(x+1)%_;x%2!=0&&g.lineTo(o,a),s=o-h,l=a-u,this._dashOffset=-D_(s*s+l*l)},_dashedQuadraticTo:function(t,e,i,n){var o=i,a=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,o,a)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,k_&&(this.data=new Float32Array(t)))},getBoundingRect:function(){b_[0]=b_[1]=S_[0]=S_[1]=Number.MAX_VALUE,w_[0]=w_[1]=M_[0]=M_[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,o=0,a=0;al||L_(r-o)>h||c===u-1)&&(t.lineTo(a,r),n=a,o=r);break;case __.C:t.bezierCurveTo(s[c++],s[c++],s[c++],s[c++],s[c++],s[c++]),n=s[c-2],o=s[c-1];break;case __.Q:t.quadraticCurveTo(s[c++],s[c++],s[c++],s[c++]),n=s[c-2],o=s[c-1];break;case __.A:var f=s[c++],g=s[c++],p=s[c++],m=s[c++],v=s[c++],y=s[c++],x=s[c++],_=s[c++],b=p>m?p:m,w=p>m?1:p/m,S=p>m?m/p:1,M=v+y;Math.abs(p-m)>.001?(t.translate(f,g),t.rotate(x),t.scale(w,S),t.arc(0,0,b,v,M,1-_),t.scale(1/w,1/S),t.rotate(-x),t.translate(-f,-g)):t.arc(f,g,b,v,M,1-_),1==c&&(e=A_(v)*p+f,i=C_(v)*m+g),n=A_(M)*p+f,o=C_(M)*m+g;break;case __.R:e=n=s[c],i=o=s[c+1],t.rect(s[c++],s[c++],s[c++],s[c++]);break;case __.Z:t.closePath(),n=e,o=i}}}},P_.CMD=__;var O_=2*Math.PI,z_=2*Math.PI,N_=P_.CMD,E_=2*Math.PI,R_=1e-4,V_=[-1,-1,-1],B_=[-1,-1],G_=ix.prototype.getCanvasPattern,W_=Math.abs,H_=new P_(!0);Nn.prototype={constructor:Nn,type:"path",__dirtyPath:!0,strokeContainThreshold:5,brush:function(t,e){var i=this.style,n=this.path||H_,o=i.hasStroke(),a=i.hasFill(),r=i.fill,s=i.stroke,l=a&&!!r.colorStops,h=o&&!!s.colorStops,u=a&&!!r.image,c=o&&!!s.image;if(i.bind(t,this,e),this.setTransform(t),this.__dirty){var d;l&&(d=d||this.getBoundingRect(),this._fillGradient=i.getGradient(t,r,d)),h&&(d=d||this.getBoundingRect(),this._strokeGradient=i.getGradient(t,s,d))}l?t.fillStyle=this._fillGradient:u&&(t.fillStyle=G_.call(r,t)),h?t.strokeStyle=this._strokeGradient:c&&(t.strokeStyle=G_.call(s,t));var f=i.lineDash,g=i.lineDashOffset,p=!!t.setLineDash,m=this.getGlobalScale();n.setScale(m[0],m[1]),this.__dirtyPath||f&&!p&&o?(n.beginPath(t),f&&!p&&(n.setLineDash(f),n.setLineDashOffset(g)),this.buildPath(n,this.shape,!1),this.path&&(this.__dirtyPath=!1)):(t.beginPath(),this.path.rebuildPath(t)),a&&n.fill(t),f&&p&&(t.setLineDash(f),t.lineDashOffset=g),o&&n.stroke(t),f&&p&&t.setLineDash([]),this.restoreTransform(t),null!=i.text&&this.drawRectText(t,this.getBoundingRect())},buildPath:function(t,e,i){},createPathProxy:function(){this.path=new P_},getBoundingRect:function(){var t=this._rect,e=this.style,i=!t;if(i){var n=this.path;n||(n=this.path=new P_),this.__dirtyPath&&(n.beginPath(),this.buildPath(n,this.shape,!1)),t=n.getBoundingRect()}if(this._rect=t,e.hasStroke()){var o=this._rectWithStroke||(this._rectWithStroke=t.clone());if(this.__dirty||i){o.copy(t);var a=e.lineWidth,r=e.strokeNoScale?this.getLineScale():1;e.hasFill()||(a=Math.max(a,this.strokeContainThreshold||4)),r>1e-10&&(o.width+=a/r,o.height+=a/r,o.x-=a/r/2,o.y-=a/r/2)}return o}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),o=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var a=this.path.data;if(o.hasStroke()){var r=o.lineWidth,s=o.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(o.hasFill()||(r=Math.max(r,this.strokeContainThreshold)),zn(a,r/s,t,e)))return!0}if(o.hasFill())return On(a,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):je.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(b(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&W_(t[0]-1)>1e-10&&W_(t[3]-1)>1e-10?Math.sqrt(W_(t[0]*t[3]-t[2]*t[1])):1}},Nn.extend=function(t){var e=function(e){Nn.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var n=this.shape;for(var o in i)!n.hasOwnProperty(o)&&i.hasOwnProperty(o)&&(n[o]=i[o])}t.init&&t.init.call(this,e)};h(e,Nn);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},h(Nn,je);var F_=P_.CMD,Z_=[[],[],[]],U_=Math.sqrt,X_=Math.atan2,j_=function(t,e){var i,n,o,a,r,s,l=t.data,h=F_.M,u=F_.C,c=F_.L,d=F_.R,f=F_.A,g=F_.Q;for(o=0,a=0;o=11?function(){var e,i=this.__clipPaths,n=this.style;if(i)for(var o=0;oi-2?i-1:c+1],h=t[c>i-3?i-1:c+2]);var g=d*d,p=d*g;n.push([Wn(s[0],f[0],l[0],h[0],d,g,p),Wn(s[1],f[1],l[1],h[1],d,g,p)])}return n},hb=function(t,e,i,n){var o,a,r,s,l=[],h=[],u=[],c=[];if(n){r=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;d=i&&a>=o)return{x:i,y:o,width:n-i,height:a-o}},createIcon:Do,Group:jy,Image:qe,Text:ib,Circle:nb,Sector:rb,Ring:sb,Polygon:ub,Polyline:cb,Rect:db,Line:fb,BezierCurve:pb,Arc:mb,CompoundPath:vb,LinearGradient:xb,RadialGradient:_b,BoundingRect:jt}),Ab=["textStyle","color"],Cb={getTextColor:function(t){var e=this.ecModel;return this.getShallow("color")||(!t&&e?e.get(Ab):null)},getFont:function(){return _o({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},getTextRect:function(t){return de(t,this.getFont(),this.getShallow("align"),this.getShallow("verticalAlign")||this.getShallow("baseline"),this.getShallow("padding"),this.getShallow("rich"),this.getShallow("truncateText"))}},Db=$x([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["textPosition"],["textAlign"]]),Lb={getItemStyle:function(t,e){var i=Db(this,t,e),n=this.getBorderLineDash();return n&&(i.lineDash=n),i},getBorderLineDash:function(){var t=this.get("borderType");return"solid"===t||null==t?null:"dashed"===t?[5,5]:[1,1]}},kb=u;Lo.prototype={constructor:Lo,init:null,mergeOption:function(t){n(this.option,t,!0)},get:function(t,e){return null==t?this.option:ko(this.option,this.parsePath(t),!e&&Po(this,t))},getShallow:function(t,e){var i=this.option,n=null==i?i:i[t],o=!e&&Po(this,t);return null==n&&o&&(n=o.getShallow(t)),n},getModel:function(t,e){var i,n=null==t?this.option:ko(this.option,t=this.parsePath(t));return e=e||(i=Po(this,t))&&i.getModel(t),new Lo(n,e,this.ecModel)},isEmpty:function(){return null==this.option},restoreData:function(){},clone:function(){return new(0,this.constructor)(i(this.option))},setReadOnly:function(t){},parsePath:function(t){return"string"==typeof t&&(t=t.split(".")),t},customizeGetParent:function(t){Xi(this,"getParent",t)},isAnimationEnabled:function(){if(!Uv.node){if(null!=this.option.animation)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}}},Ki(Lo),kb(Lo,Jx),kb(Lo,t_),kb(Lo,Cb),kb(Lo,Lb);var Pb=d,Ob=b,zb=["fontStyle","fontWeight","fontSize","fontFamily","rich","tag","color","textBorderColor","textBorderWidth","width","height","lineHeight","align","verticalAlign","baseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY","backgroundColor","borderColor","borderWidth","borderRadius","padding"],Nb={getDataParams:function(t,e){var i=this.getData(e),n=this.getRawValue(t,e),o=i.getRawIndex(t),a=i.getName(t,!0),r=i.getRawDataItem(t),s=i.getItemVisual(t,"color");return{componentType:this.mainType,componentSubType:this.subType,seriesType:"series"===this.mainType?this.subType:null,seriesIndex:this.seriesIndex,seriesId:this.id,seriesName:this.name,name:a,dataIndex:o,data:r,dataType:e,value:n,color:s,marker:Fi(s),$vars:["seriesName","name","value"]}},getFormattedLabel:function(t,e,i,n,o){e=e||"normal";var a=this.getData(i).getItemModel(t),r=this.getDataParams(t,i);null!=n&&r.value instanceof Array&&(r.value=r.value[n]);var s=a.get([o||"label",e,"formatter"]);return"function"==typeof s?(r.status=e,s(r)):"string"==typeof s?Wi(s,r):void 0},getRawValue:function(t,e){var i=this.getData(e).getRawDataItem(t);if(null!=i)return!Ob(i)||i instanceof Array?i:i.value},formatTooltip:N},Eb=function(){var t=0;return function(){var e="\0__ec_prop_getter_"+t++;return function(t){return t[e]||(t[e]={})}}}(),Rb=0,Vb="_",Bb=d,Gb=["left","right","top","bottom","width","height"],Wb=[["width","left","right"],["height","top","bottom"]],Hb=Yo,Fb=(v(Yo,"vertical"),v(Yo,"horizontal"),{getBoxLayoutParams:function(){return{left:this.get("left"),top:this.get("top"),right:this.get("right"),bottom:this.get("bottom"),width:this.get("width"),height:this.get("height")}}}),Zb=Array.prototype.push,Ub=Lo.extend({type:"component",id:"",name:"",mainType:"",subType:"",componentIndex:0,defaultOption:null,ecModel:null,dependentModels:[],uid:null,layoutMode:null,$constructor:function(t,e,i,n){Lo.call(this,t,e,i,n),this.uid=qo("componentModel")},init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i)},mergeDefaultAndTheme:function(t,e){var i=this.layoutMode,o=i?ea(t):{};n(t,e.getTheme().get(this.mainType)),n(t,this.getDefaultOption()),i&&ta(t,o,i)},mergeOption:function(t,e){n(this.option,t,!0);var i=this.layoutMode;i&&ta(this.option,t,i)},optionUpdated:function(t,e){},getDefaultOption:function(){if(!qi(this,"__defaultOption")){for(var t=[],e=this.constructor;e;){var i=e.prototype.defaultOption;i&&t.push(i),e=e.superClass}for(var o={},a=t.length-1;a>=0;a--)o=n(o,t[a],!0);Xi(this,"__defaultOption",o)}return ji(this,"__defaultOption")},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});tn(Ub,{registerWhenExtend:!0}),function(t){var e={};t.registerSubTypeDefaulter=function(t,i){t=Yi(t),e[t.main]=i},t.determineSubType=function(i,n){var o=n.type;if(!o){var a=Yi(i).main;t.hasSubTypes(i)&&e[a]&&(o=e[a](n))}return o}}(Ub),function(t,e){function i(t){var i={},a=[];return d(t,function(r){var s=n(i,r),h=o(s.originalDeps=e(r),t);s.entryCount=h.length,0===s.entryCount&&a.push(r),d(h,function(t){l(s.predecessor,t)<0&&s.predecessor.push(t);var e=n(i,t);l(e.successor,t)<0&&e.successor.push(r)})}),{graph:i,noEntryList:a}}function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}function o(t,e){var i=[];return d(t,function(t){l(e,t)>=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,n,o){function a(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}if(t.length){var r=i(e),s=r.graph,l=r.noEntryList,h={};for(d(t,function(t){h[t]=!0});l.length;){var u=l.pop(),c=s[u],f=!!h[u];f&&(n.call(o,u,c.originalDeps.slice()),delete h[u]),d(c.successor,f?function(t){h[t]=!0,a(t)}:a)}d(h,function(){throw new Error("Circle dependency may exists")})}}}(Ub,function(t){var e=[];return d(Ub.getClassesByMainType(t),function(t){Zb.apply(e,t.prototype.dependencies||[])}),f(e,function(t){return Yi(t).main})}),u(Ub,Fb);var Xb="";"undefined"!=typeof navigator&&(Xb=navigator.platform||"");var jb={color:["#c23531","#2f4554","#61a0a8","#d48265","#91c7ae","#749f83","#ca8622","#bda29a","#6e7074","#546570","#c4ccd3"],textStyle:{fontFamily:Xb.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,animation:"auto",animationDuration:1e3,animationDurationUpdate:300,animationEasing:"exponentialOut",animationEasingUpdate:"cubicOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},qb={clearColorPalette:function(){Xi(this,"colorIdx",0),Xi(this,"colorNameMap",{})},getColorFromPalette:function(t,e){var i=ji(e=e||this,"colorIdx")||0,n=ji(e,"colorNameMap")||Xi(e,"colorNameMap",{});if(n.hasOwnProperty(t))return n[t];var o=this.get("color",!0)||[];if(o.length){var a=o[i];return t&&(n[t]=a),Xi(e,"colorIdx",(i+1)%o.length),a}}},Yb=d,$b=p,Kb=f,Jb=y,Qb=l,tw=b,ew="\0_ec_inner",iw=Lo.extend({constructor:iw,init:function(t,e,i,n){i=i||{},this.option=null,this._theme=new Lo(i),this._optionManager=n},setOption:function(t,e){L(!(ew in t),"please use chart.getOption()"),this._optionManager.setOption(t,e),this.resetOption(null)},resetOption:function(t){var e=!1,i=this._optionManager;if(!t||"recreate"===t){var n=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this.mergeOption(n)):oa.call(this,n),e=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(this.mergeOption(o),e=!0)}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this,this._api);a.length&&Yb(a,function(t){this.mergeOption(t,e=!0)},this)}return e},mergeOption:function(t){var e=this.option,o=this._componentsMap,r=[];Yb(t,function(t,o){null!=t&&(Ub.hasClass(o)?r.push(o):e[o]=null==e[o]?i(t):n(e[o],t,!0))}),Ub.topologicalTravel(r,Ub.getAllClassMainTypes(),function(i,n){var r=Oo(t[i]),s=Vo(o.get(i),r);Bo(s),Yb(s,function(t,e){var n=t.option;tw(n)&&(t.keyInfo.mainType=i,t.keyInfo.subType=ra(i,n,t.exist))});var l=aa(o,n);e[i]=[],o.set(i,[]),Yb(s,function(t,n){var r=t.exist,s=t.option;if(L(tw(s)||r,"Empty component definition"),s){var h=Ub.getClass(i,t.keyInfo.subType,!0);if(r&&r instanceof h)r.name=t.keyInfo.name,r.mergeOption(s,this),r.optionUpdated(s,!1);else{var u=a({dependentModels:l,componentIndex:n},t.keyInfo);a(r=new h(s,this,this,u),u),r.init(s,this,this,u),r.optionUpdated(null,!0)}}else r.mergeOption({},this),r.optionUpdated({},!1);o.get(i)[n]=r,e[i][n]=r.option},this),"series"===i&&(this._seriesIndices=sa(o.get("series")))},this),this._seriesIndices=this._seriesIndices||[]},getOption:function(){var t=i(this.option);return Yb(t,function(e,i){if(Ub.hasClass(i)){for(var n=(e=Oo(e)).length-1;n>=0;n--)Go(e[n])&&e.splice(n,1);t[i]=e}}),delete t[ew],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap.get(t);if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,o=t.name,a=this._componentsMap.get(e);if(!a||!a.length)return[];var r;if(null!=i)Jb(i)||(i=[i]),r=$b(Kb(i,function(t){return a[t]}),function(t){return!!t});else if(null!=n){var s=Jb(n);r=$b(a,function(t){return s&&Qb(n,t.id)>=0||!s&&t.id===n})}else if(null!=o){var l=Jb(o);r=$b(a,function(t){return l&&Qb(o,t.name)>=0||!l&&t.name===o})}else r=a.slice();return la(r,t)},findComponents:function(t){var e=t.query,i=t.mainType,n=function(t){var e=i+"Index",n=i+"Id",o=i+"Name";return!t||null==t[e]&&null==t[n]&&null==t[o]?null:{mainType:i,index:t[e],id:t[n],name:t[o]}}(e);return function(e){return t.filter?$b(e,t.filter):e}(la(n?this.queryComponents(n):this._componentsMap.get(i),t))},eachComponent:function(t,e,i){var n=this._componentsMap;if("function"==typeof t)i=e,e=t,n.each(function(t,n){Yb(t,function(t,o){e.call(i,n,t,o)})});else if(_(t))Yb(n.get(t),e,i);else if(tw(t)){var o=this.findComponents(t);Yb(o,e,i)}},getSeriesByName:function(t){var e=this._componentsMap.get("series");return $b(e,function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.get("series")[t]},getSeriesByType:function(t){var e=this._componentsMap.get("series");return $b(e,function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.get("series").slice()},eachSeries:function(t,e){Yb(this._seriesIndices,function(i){var n=this._componentsMap.get("series")[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){Yb(this._componentsMap.get("series"),t,e)},eachSeriesByType:function(t,e,i){Yb(this._seriesIndices,function(n){var o=this._componentsMap.get("series")[n];o.subType===t&&e.call(i,o,n)},this)},eachRawSeriesByType:function(t,e,i){return Yb(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return l(this._seriesIndices,t.componentIndex)<0},getCurrentSeriesIndices:function(){return(this._seriesIndices||[]).slice()},filterSeries:function(t,e){var i=$b(this._componentsMap.get("series"),t,e);this._seriesIndices=sa(i)},restoreData:function(){var t=this._componentsMap;this._seriesIndices=sa(t.get("series"));var e=[];t.each(function(t,i){e.push(i)}),Ub.topologicalTravel(e,Ub.getAllClassMainTypes(),function(e,i){Yb(t.get(e),function(t){t.restoreData()})})}});u(iw,qb);var nw=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption","getViewOfComponentModel","getViewOfSeriesModel"],ow={};ua.prototype={constructor:ua,create:function(t,e){var i=[];d(ow,function(n,o){var a=n.create(t,e);i=i.concat(a||[])}),this._coordinateSystems=i},update:function(t,e){d(this._coordinateSystems,function(i){i.update&&i.update(t,e)})},getCoordinateSystems:function(){return this._coordinateSystems.slice()}},ua.register=function(t,e){ow[t]=e},ua.get=function(t){return ow[t]};var aw=d,rw=i,sw=f,lw=n,hw=/^(min|max)?(.+)$/;ca.prototype={constructor:ca,setOption:function(t,e){t=rw(t,!0);var i=this._optionBackup,n=da.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(ma(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=sw(e.timelineOptions,rw),this._mediaList=sw(e.mediaList,rw),this._mediaDefault=rw(e.mediaDefault),this._currentMediaIndices=[],rw(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=rw(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,o=this._mediaDefault,a=[],r=[];if(!n.length&&!o)return r;for(var s=0,l=n.length;s":"")+r.join(a?"
    ":", ")}(o):Gi(Vi(o)),r=n.getName(t),s=n.getItemVisual(t,"color");b(s)&&s.colorStops&&(s=(s.colorStops[0]||{}).color);var l=Fi(s=s||"transparent"),h=this.name;return"\0-"===h&&(h=""),h=h?Gi(h)+(e?": ":"
    "):"",e?l+h+a:h+l+(r?Gi(r)+": "+a:a)},isAnimationEnabled:function(){if(Uv.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){Xi(this,"data",ji(this,"dataBeforeProcessed").cloneShallow())},getColorFromPalette:function(t,e){var i=this.ecModel,n=qb.getColorFromPalette.call(this,t,e);return n||(n=i.getColorFromPalette(t,e)),n},getAxisTooltipData:null,getTooltipPosition:null});u(yw,Nb),u(yw,qb);var xw=function(){this.group=new jy,this.uid=qo("viewComponent")};xw.prototype={constructor:xw,init:function(t,e){},render:function(t,e,i,n){},dispose:function(){}};var _w=xw.prototype;_w.updateView=_w.updateLayout=_w.updateVisual=function(t,e,i,n){},Ki(xw),tn(xw,{registerWhenExtend:!0}),Ta.prototype={type:"chart",init:function(t,e){},render:function(t,e,i,n){},highlight:function(t,e,i,n){Ca(t.getData(),n,"emphasis")},downplay:function(t,e,i,n){Ca(t.getData(),n,"normal")},remove:function(t,e){this.group.removeAll()},dispose:function(){}};var bw=Ta.prototype;bw.updateView=bw.updateLayout=bw.updateVisual=function(t,e,i,n){this.render(t,e,i,n)},Ki(Ta),tn(Ta,{registerWhenExtend:!0});var ww="\0__throttleOriginMethod",Sw="\0__throttleRate",Mw="\0__throttleType",Iw=Math.PI,Tw=d,Aw=Ub.parseClassType,Cw={zrender:"3.7.3"},Dw=1e3,Lw=1e3,kw=3e3,Pw={PROCESSOR:{FILTER:Dw,STATISTIC:5e3},VISUAL:{LAYOUT:Lw,GLOBAL:2e3,CHART:kw,COMPONENT:4e3,BRUSH:5e3}},Ow="__flagInMainProcess",zw="__optionUpdated",Nw=/^[a-zA-Z0-9_]+$/;Oa.prototype.on=Pa("on"),Oa.prototype.off=Pa("off"),Oa.prototype.one=Pa("one"),u(Oa,fy);var Ew=za.prototype;Ew._onframe=function(){if(this[zw]){var t=this[zw].silent;this[Ow]=!0,Rw.prepareAndUpdate.call(this),this[Ow]=!1,this[zw]=!1,Va.call(this,t),Ba.call(this,t)}},Ew.getDom=function(){return this._dom},Ew.getZr=function(){return this._zr},Ew.setOption=function(t,e,i){var n;if(b(e)&&(i=e.lazyUpdate,n=e.silent,e=e.notMerge),this[Ow]=!0,!this._model||e){var o=new ca(this._api),a=this._theme;(this._model=new iw(null,null,a,o)).init(null,null,a,o)}this._model.setOption(t,Hw),i?(this[zw]={silent:n},this[Ow]=!1):(Rw.prepareAndUpdate.call(this),this._zr.flush(),this[zw]=!1,this[Ow]=!1,Va.call(this,n),Ba.call(this,n))},Ew.setTheme=function(){console.log("ECharts#setTheme() is DEPRECATED in ECharts 3.0")},Ew.getModel=function(){return this._model},Ew.getOption=function(){return this._model&&this._model.getOption()},Ew.getWidth=function(){return this._zr.getWidth()},Ew.getHeight=function(){return this._zr.getHeight()},Ew.getDevicePixelRatio=function(){return this._zr.painter.dpr||window.devicePixelRatio||1},Ew.getRenderedCanvas=function(t){if(Uv.canvasSupported){(t=t||{}).pixelRatio=t.pixelRatio||1,t.backgroundColor=t.backgroundColor||this._model.get("backgroundColor");var e=this._zr;return d(e.storage.getDisplayList(),function(t){t.stopAnimation(!0)}),e.painter.getRenderedCanvas(t)}},Ew.getSvgDataUrl=function(){if(Uv.svgSupported){var t=this._zr;return d(t.storage.getDisplayList(),function(t){t.stopAnimation(!0)}),t.painter.pathToSvg()}},Ew.getDataURL=function(t){var e=(t=t||{}).excludeComponents,i=this._model,n=[],o=this;Tw(e,function(t){i.eachComponent({mainType:t},function(t){var e=o._componentsMap[t.__viewId];e.group.ignore||(n.push(e),e.group.ignore=!0)})});var a="svg"===this._zr.painter.getType()?this.getSvgDataUrl():this.getRenderedCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return Tw(n,function(t){t.group.ignore=!1}),a},Ew.getConnectedDataURL=function(t){if(Uv.canvasSupported){var e=this.group,n=Math.min,o=Math.max;if(qw[e]){var a=1/0,r=1/0,s=-1/0,l=-1/0,h=[],u=t&&t.pixelRatio||1;d(jw,function(u,c){if(u.group===e){var d=u.getRenderedCanvas(i(t)),f=u.getDom().getBoundingClientRect();a=n(f.left,a),r=n(f.top,r),s=o(f.right,s),l=o(f.bottom,l),h.push({dom:d,left:f.left,top:f.top})}});var c=(s*=u)-(a*=u),f=(l*=u)-(r*=u),g=iy();g.width=c,g.height=f;var p=yi(g);return Tw(h,function(t){var e=new qe({style:{x:t.left*u-a,y:t.top*u-r,image:t.dom}});p.add(e)}),p.refreshImmediately(),g.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}},Ew.convertToPixel=v(Na,"convertToPixel"),Ew.convertFromPixel=v(Na,"convertFromPixel"),Ew.containPixel=function(t,e){var i;return t=Fo(this._model,t),d(t,function(t,n){n.indexOf("Models")>=0&&d(t,function(t){var o=t.coordinateSystem;if(o&&o.containPoint)i|=!!o.containPoint(e);else if("seriesModels"===n){var a=this._chartsMap[t.__viewId];a&&a.containPoint&&(i|=a.containPoint(e,t))}},this)},this),!!i},Ew.getVisual=function(t,e){var i=(t=Fo(this._model,t,{defaultMainType:"series"})).seriesModel.getData(),n=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?i.indexOfRawIndex(t.dataIndex):null;return null!=n?i.getItemVisual(n,e):i.getVisual(e)},Ew.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},Ew.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]};var Rw={update:function(t){var e=this._model,i=this._api,n=this._coordSysMgr,o=this._zr;if(e){e.restoreData(),n.create(this._model,this._api),Ha.call(this,e,i),Fa.call(this,e),n.update(e,i),Ua.call(this,e,t),Xa.call(this,e,t);var a=e.get("backgroundColor")||"transparent",r=o.painter;if(r.isSingleCanvas&&r.isSingleCanvas())o.configLayer(0,{clearColor:a});else{if(!Uv.canvasSupported){var s=Mt(a);a=Ot(s,"rgb"),0===s[3]&&(a="transparent")}a.colorStops||a.image?(o.configLayer(0,{clearColor:a}),this.__hasGradientOrPatternBg=!0,this._dom.style.background="transparent"):(this.__hasGradientOrPatternBg&&o.configLayer(0,{clearColor:null}),this.__hasGradientOrPatternBg=!1,this._dom.style.background=a)}Tw(Fw,function(t){t(e,i)})}},updateView:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),Ua.call(this,e,t),Ga.call(this,"updateView",e,t))},updateVisual:function(t){var e=this._model;e&&(e.eachSeries(function(t){t.getData().clearAllVisual()}),Ua.call(this,e,t,!0),Ga.call(this,"updateVisual",e,t))},updateLayout:function(t){var e=this._model;e&&(Za.call(this,e,t),Ga.call(this,"updateLayout",e,t))},prepareAndUpdate:function(t){var e=this._model;Wa.call(this,"component",e),Wa.call(this,"chart",e),Rw.update.call(this,t)}};Ew.resize=function(t){this[Ow]=!0,this._zr.resize(t);var e=this._model&&this._model.resetOption("media");Rw[e?"prepareAndUpdate":"update"].call(this),this._loadingFX&&this._loadingFX.resize(),this[Ow]=!1;var i=t&&t.silent;Va.call(this,i),Ba.call(this,i)},Ew.showLoading=function(t,e){if(b(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),Xw[t]){var i=Xw[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},Ew.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},Ew.makeActionFromEvent=function(t){var e=a({},t);return e.type=Gw[t.type],e},Ew.dispatchAction=function(t,e){b(e)||(e={silent:!!e}),Bw[t.type]&&this._model&&(this[Ow]?this._pendingActions.push(t):(Ra.call(this,t,e.silent),e.flush?this._zr.flush(!0):!1!==e.flush&&Uv.browser.weChat&&this._throttledZrFlush(),Va.call(this,e.silent),Ba.call(this,e.silent)))},Ew.on=Pa("on"),Ew.off=Pa("off"),Ew.one=Pa("one");var Vw=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];Ew._initEvents=function(){Tw(Vw,function(t){this._zr.on(t,function(e){var i,n=this.getModel(),o=e.target;if("globalout"===t)i={};else if(o&&null!=o.dataIndex){var r=o.dataModel||n.getSeriesByIndex(o.seriesIndex);i=r&&r.getDataParams(o.dataIndex,o.dataType)||{}}else o&&o.eventData&&(i=a({},o.eventData));i&&(i.event=e,i.type=t,this.trigger(t,i))},this)},this),Tw(Gw,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},Ew.isDisposed=function(){return this._disposed},Ew.clear=function(){this.setOption({series:[]},!0)},Ew.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this._api,e=this._model;Tw(this._componentsViews,function(i){i.dispose(e,t)}),Tw(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete jw[this.id]}},u(za,fy);var Bw={},Gw={},Ww=[],Hw=[],Fw=[],Zw=[],Uw={},Xw={},jw={},qw={},Yw=new Date-0,$w=new Date-0,Kw="_echarts_instance_",Jw={},Qw=Ja;ar(2e3,function(t){t.eachRawSeries(function(e){var i=(e.visualColorAccessPath||"itemStyle.normal.color").split("."),n=e.getData(),o=e.get(i)||e.getColorFromPalette(e.get("name"));n.setVisual("color",o),t.isSeriesFiltered(e)||("function"!=typeof o||o instanceof yb||n.each(function(t){n.setItemVisual(t,"color",o(e.getDataParams(t)))}),n.each(function(t){var e=n.getItemModel(t).get(i,!0);null!=e&&n.setItemVisual(t,"color",e)}))})}),tr(vw),rr("default",function(t,e){r(e=e||{},{text:"loading",color:"#c23531",textColor:"#000",maskColor:"rgba(255, 255, 255, 0.8)",zlevel:0});var i=new db({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4}),n=new mb({shape:{startAngle:-Iw/2,endAngle:-Iw/2+.1,r:10},style:{stroke:e.color,lineCap:"round",lineWidth:5},zlevel:e.zlevel,z:10001}),o=new db({style:{fill:"none",text:e.text,textPosition:"right",textDistance:10,textFill:e.textColor},zlevel:e.zlevel,z:10001});n.animateShape(!0).when(1e3,{endAngle:3*Iw/2}).start("circularInOut"),n.animateShape(!0).when(1e3,{startAngle:3*Iw/2}).delay(300).start("circularInOut");var a=new jy;return a.add(n),a.add(o),a.add(i),a.resize=function(){var e=t.getWidth()/2,a=t.getHeight()/2;n.setShape({cx:e,cy:a});var r=n.shape.r;o.setShape({x:e-r,y:a-r,width:2*r,height:2*r}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},a.resize(),a}),ir({type:"highlight",event:"highlight",update:"highlight"},N),ir({type:"downplay",event:"downplay",update:"downplay"},N);var tS={};fr.prototype={constructor:fr,add:function(t){return this._add=t,this},update:function(t){return this._update=t,this},remove:function(t){return this._remove=t,this},execute:function(){var t=this._old,e=this._new,i={},n=[],o=[];for(gr(t,{},n,"_oldKeyGetter",this),gr(e,i,o,"_newKeyGetter",this),a=0;a0&&(_+="__ec__"+u[x]),u[x]++),_&&(h[v]=_)}this._nameList=e,this._idList=h},rS.count=function(){return this.indices.length},rS.get=function(t,e,i){var n=this._storage,o=this.indices[e];if(null==o||!n[t])return NaN;var a=n[t][o];if(i){var r=this._dimensionInfos[t];if(r&&r.stackable)for(var s=this.stackedOn;s;){var l=s.get(t,e);(a>=0&&l>0||a<=0&&l<0)&&(a+=l),s=s.stackedOn}}return a},rS.getValues=function(t,e,i){var n=[];y(t)||(i=e,e=t,t=this.dimensions);for(var o=0,a=t.length;ol&&(l=a));return this._extent[t+!!e]=[s,l]}return[1/0,-1/0]},rS.getSum=function(t,e){var i=0;if(this._storage[t])for(var n=0,o=this.count();nt))return a;o=a-1}}return-1},rS.indicesOfNearest=function(t,e,i,n){var o=[];if(!this._storage[t])return o;null==n&&(n=1/0);for(var a=Number.MAX_VALUE,r=-1,s=0,l=this.count();s=0&&r<0)&&(a=u,r=h,o.length=0),o.push(s))}return o},rS.getRawIndex=function(t){var e=this.indices[t];return null==e?-1:e},rS.getRawDataItem=function(t){return this._rawData.getItem(this.getRawIndex(t))},rS.getName=function(t){return this._nameList[this.indices[t]]||""},rS.getId=function(t){return this._idList[this.indices[t]]||this.getRawIndex(t)+""},rS.each=function(t,e,i,n){"function"==typeof t&&(n=i,i=e,e=t,t=[]);var o=[],a=(t=f(vr(t),this.getDimension,this)).length,r=this.indices;n=n||this;for(var s=0;sf-g&&(c=f-g,h.length=c);for(var p=0;p=e[0]&&t<=e[1]},Ar.prototype.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},Ar.prototype.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},Ar.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},Ar.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getDataExtent(e,!0))},Ar.prototype.getExtent=function(){return this._extent.slice()},Ar.prototype.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},Ar.prototype.getTicksLabels=function(){for(var t=[],e=this.getTicks(),i=0;ie[1]&&(e[1]=t[1]),yS.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=Dr(t)},getTicks:function(){return Pr(this._interval,this._extent,this._niceExtent,this._intervalPrecision)},getTicksLabels:function(){for(var t=[],e=this.getTicks(),i=0;i>>1;t[o][1]i&&(a=i);var r=MS.length,s=wS(MS,a,0,r),l=MS[Math.min(s,r-1)],h=l[1];"year"===l[0]&&(h*=Ni(o/h/t,!0));var u=this.getSetting("useUTC")?0:60*new Date(+n[0]||+n[1]).getTimezoneOffset()*1e3,c=[Math.round(_S((n[0]-u)/h)*h+u),Math.round(bS((n[1]-u)/h)*h+u)];kr(c,n),this._stepLvl=l,this._interval=h,this._niceExtent=c},parse:function(t){return+Pi(t)}});d(["contain","normalize"],function(t){SS.prototype[t]=function(e){return xS[t].call(this,this.parse(e))}});var MS=[["hh:mm:ss",1e3],["hh:mm:ss",5e3],["hh:mm:ss",1e4],["hh:mm:ss",15e3],["hh:mm:ss",3e4],["hh:mm\nMM-dd",6e4],["hh:mm\nMM-dd",3e5],["hh:mm\nMM-dd",6e5],["hh:mm\nMM-dd",9e5],["hh:mm\nMM-dd",18e5],["hh:mm\nMM-dd",36e5],["hh:mm\nMM-dd",72e5],["hh:mm\nMM-dd",216e5],["hh:mm\nMM-dd",432e5],["MM-dd\nyyyy",864e5],["MM-dd\nyyyy",1728e5],["MM-dd\nyyyy",2592e5],["MM-dd\nyyyy",3456e5],["MM-dd\nyyyy",432e6],["MM-dd\nyyyy",5184e5],["week",6048e5],["MM-dd\nyyyy",864e6],["week",12096e5],["week",18144e5],["month",26784e5],["week",36288e5],["month",53568e5],["week",36288e5],["quarter",8208e6],["month",107136e5],["month",13392e6],["half-year",16416e6],["month",214272e5],["month",26784e6],["year",32832e6]];SS.create=function(t){return new SS({useUTC:t.ecModel.get("useUTC")})};var IS=Ar.prototype,TS=yS.prototype,AS=Ai,CS=Mi,DS=Math.floor,LS=Math.ceil,kS=Math.pow,PS=Math.log,OS=Ar.extend({type:"log",base:10,$constructor:function(){Ar.apply(this,arguments),this._originalScale=new yS},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return f(TS.getTicks.call(this),function(n){var o=Mi(kS(this.base,n));return o=n===e[0]&&t.__fixMin?Or(o,i[0]):o,o=n===e[1]&&t.__fixMax?Or(o,i[1]):o},this)},getLabel:TS.getLabel,scale:function(t){return t=IS.scale.call(this,t),kS(this.base,t)},setExtent:function(t,e){var i=this.base;t=PS(t)/PS(i),e=PS(e)/PS(i),TS.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=IS.getExtent.call(this);e[0]=kS(t,e[0]),e[1]=kS(t,e[1]);var i=this._originalScale,n=i.getExtent();return i.__fixMin&&(e[0]=Or(e[0],n[0])),i.__fixMax&&(e[1]=Or(e[1],n[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=PS(t[0])/PS(e),t[1]=PS(t[1])/PS(e),IS.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getDataExtent(e,!0,function(t){return t>0}))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=Oi(i);for(t/i*n<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var o=[Mi(LS(e[0]/n)*n),Mi(DS(e[1]/n)*n)];this._interval=n,this._niceExtent=o}},niceExtent:function(t){TS.niceExtent.call(this,t);var e=this._originalScale;e.__fixMin=t.fixMin,e.__fixMax=t.fixMax}});d(["contain","normalize"],function(t){OS.prototype[t]=function(e){return e=PS(e)/PS(this.base),IS[t].call(this,e)}}),OS.create=function(){return new OS};var zS={getFormattedLabels:function(){return Vr(this.axis,this.get("axisLabel.formatter"))},getCategories:function(){return"category"===this.get("type")&&f(this.get("data"),Gr)},getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return this.axis&&null!=i&&"dataMin"!==i&&"function"!=typeof i&&!M(i)&&(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return this.axis&&null!=i&&"dataMax"!==i&&"function"!=typeof i&&!M(i)&&(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:N,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}},NS=Zn({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,a=e.height/2;t.moveTo(i,n-a),t.lineTo(i+o,n+a),t.lineTo(i-o,n+a),t.closePath()}}),ES=Zn({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,a=e.height/2;t.moveTo(i,n-a),t.lineTo(i+o,n),t.lineTo(i,n+a),t.lineTo(i-o,n),t.closePath()}}),RS=Zn({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,n=e.y,o=e.width/5*3,a=Math.max(o,e.height),r=o/2,s=r*r/(a-r),l=n-a+r+s,h=Math.asin(s/r),u=Math.cos(h)*r,c=Math.sin(h),d=Math.cos(h),f=.6*r,g=.7*r;t.moveTo(i-u,l+s),t.arc(i,l,r,Math.PI-h,2*Math.PI+h),t.bezierCurveTo(i+u-c*f,l+s+d*f,i,n-g,i,n),t.bezierCurveTo(i,n-g,i-u+c*f,l+s+d*f,i-u,l+s),t.closePath()}}),VS=Zn({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,n=e.width,o=e.x,a=e.y,r=n/3*2;t.moveTo(o,a),t.lineTo(o+r,a+i),t.lineTo(o,a+i/4*3),t.lineTo(o-r,a+i),t.lineTo(o,a),t.closePath()}}),BS={line:function(t,e,i,n,o){o.x1=t,o.y1=e+n/2,o.x2=t+i,o.y2=e+n/2},rect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n},roundRect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n,o.r=Math.min(i,n)/4},square:function(t,e,i,n,o){var a=Math.min(i,n);o.x=t,o.y=e,o.width=a,o.height=a},circle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.r=Math.min(i,n)/2},diamond:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n},pin:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},arrow:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},triangle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n}},GS={};d({line:fb,rect:db,roundRect:db,square:db,circle:nb,diamond:ES,pin:RS,arrow:VS,triangle:NS},function(t,e){GS[e]=new t});var WS=Zn({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},beforeBrush:function(){var t=this.style;"pin"===this.shape.symbolType&&"inside"===t.textPosition&&(t.textPosition=["50%","40%"],t.textAlign="center",t.textVerticalAlign="middle")},buildPath:function(t,e,i){var n=e.symbolType,o=GS[n];"none"!==e.symbolType&&(o||(o=GS[n="rect"]),BS[n](e.x,e.y,e.width,e.height,o.shape),o.buildPath(t,o.shape,i))}}),HS=(Object.freeze||Object)({createList:function(t){return Sr(t.get("data"),t,t.ecModel)},createScale:function(t,e){var i=e;e instanceof Lo||u(i=new Lo(e),zS);var n=Er(i);return n.setExtent(t[0],t[1]),Nr(n,i),n},mixinAxisModelCommonMethods:function(t){u(t,zS)},completeDimensions:xr,createSymbol:Hr}),FS=wi,ZS=[0,1],US=function(t,e,i){this.dim=t,this.scale=e,this._extent=i||[0,0],this.inverse=!1,this.onBand=!1,this._labelInterval};US.prototype={constructor:US,contain:function(t){var e=this._extent,i=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return t>=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){return this._extent.slice()},getPixelPrecision:function(t){return Ci(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,n=this.scale;return t=n.normalize(t),this.onBand&&"ordinal"===n.type&&Fr(i=i.slice(),n.count()),FS(t,ZS,i,e)},coordToData:function(t,e){var i=this._extent,n=this.scale;this.onBand&&"ordinal"===n.type&&Fr(i=i.slice(),n.count());var o=FS(t,i,ZS,e);return this.scale.scale(o)},pointToData:function(t,e){},getTicksCoords:function(t){if(this.onBand&&!t){for(var e=this.getBands(),i=[],n=0;n0}),function(t){var e=t.properties,i=t.geometry,n=i.coordinates,o=[];"Polygon"===i.type&&o.push({type:"polygon",exterior:n[0],interiors:n.slice(1)}),"MultiPolygon"===i.type&&d(n,function(t){t[0]&&o.push({type:"polygon",exterior:t[0],interiors:t.slice(1)})});var a=new Xr(e.name,o,e.cp);return a.properties=e,a})},qS={};d(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone","merge"],function(t){qS[t]=ay[t]}),yw.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return Sr(t.data,this,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{normal:{position:"top"}},lineStyle:{normal:{width:2,type:"solid"}},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:!1,connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}});var YS=Jr.prototype;YS._createSymbol=function(t,e,i,n){this.removeAll();var o=Hr(t,-1,-1,2,2,e.getItemVisual(i,"color"));o.attr({z2:100,culling:!0,scale:Kr(n)}),o.drift=Qr,this._symbolType=t,this.add(o)},YS.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(t)},YS.getSymbolPath=function(){return this.childAt(0)},YS.getScale=function(){return this.childAt(0).scale},YS.highlight=function(){this.childAt(0).trigger("emphasis")},YS.downplay=function(){this.childAt(0).trigger("normal")},YS.setZ=function(t,e){var i=this.childAt(0);i.zlevel=t,i.z=e},YS.setDraggable=function(t){var e=this.childAt(0);e.draggable=t,e.cursor=t?"move":"pointer"},YS.updateData=function(t,e,i){this.silent=!1;var n=t.getItemVisual(e,"symbol")||"circle",o=t.hostModel,a=$r(t,e),r=n!==this._symbolType;if(r?this._createSymbol(n,t,e,a):((s=this.childAt(0)).silent=!1,wo(s,{scale:Kr(a)},o,e)),this._updateCommon(t,e,a,i),r){var s=this.childAt(0),l=i&&i.fadeIn,h={scale:s.scale.slice()};l&&(h.style={opacity:s.style.opacity}),s.scale=[0,0],l&&(s.style.opacity=0),So(s,h,o,e)}this._seriesModel=o};var $S=["itemStyle","normal"],KS=["itemStyle","emphasis"],JS=["label","normal"],QS=["label","emphasis"];YS._updateCommon=function(t,e,i,n){var o=this.childAt(0),r=t.hostModel,s=t.getItemVisual(e,"color");"image"!==o.type&&o.useStyle({strokeNoScale:!0});var l=n&&n.itemStyle,h=n&&n.hoverItemStyle,u=n&&n.symbolRotate,c=n&&n.symbolOffset,d=n&&n.labelModel,f=n&&n.hoverLabelModel,g=n&&n.hoverAnimation,p=n&&n.cursorStyle;if(!n||t.hasItemOption){var m=n&&n.itemModel?n.itemModel:t.getItemModel(e);l=m.getModel($S).getItemStyle(["color"]),h=m.getModel(KS).getItemStyle(),u=m.getShallow("symbolRotate"),c=m.getShallow("symbolOffset"),d=m.getModel(JS),f=m.getModel(QS),g=m.getShallow("hoverAnimation"),p=m.getShallow("cursor")}else h=a({},h);var v=o.style;o.attr("rotation",(u||0)*Math.PI/180||0),c&&o.attr("position",[Si(c[0],i[0]),Si(c[1],i[1])]),p&&o.attr("cursor",p),o.setColor(s,n&&n.symbolInnerColor),o.setStyle(l);var y=t.getItemVisual(e,"opacity");null!=y&&(v.opacity=y);var x=n&&n.useNameLabel,_=!x&&Yr(t);(x||null!=_)&&co(v,h,d,f,{labelFetcher:r,labelDataIndex:e,defaultText:x?t.getName(e):t.get(_,e),isRectText:!0,autoColor:s}),o.off("mouseover").off("mouseout").off("emphasis").off("normal"),o.hoverStyle=h,uo(o);var b=Kr(i);if(g&&r.isAnimationEnabled()){var w=function(){var t=b[1]/b[0];this.animateTo({scale:[Math.max(1.1*b[0],b[0]+3),Math.max(1.1*b[1],b[1]+3*t)]},400,"elasticOut")},S=function(){this.animateTo({scale:b},400,"elasticOut")};o.on("mouseover",w).on("mouseout",S).on("emphasis",w).on("normal",S)}},YS.fadeOut=function(t,e){var i=this.childAt(0);this.silent=i.silent=!0,!(e&&e.keepLabel)&&(i.style.text=null),wo(i,{style:{opacity:0},scale:[0,0]},this._seriesModel,this.dataIndex,t)},h(Jr,jy);var tM=ts.prototype;tM.updateData=function(t,e){var i=this.group,n=t.hostModel,o=this._data,a=this._symbolCtor,r={itemStyle:n.getModel("itemStyle.normal").getItemStyle(["color"]),hoverItemStyle:n.getModel("itemStyle.emphasis").getItemStyle(),symbolRotate:n.get("symbolRotate"),symbolOffset:n.get("symbolOffset"),hoverAnimation:n.get("hoverAnimation"),labelModel:n.getModel("label.normal"),hoverLabelModel:n.getModel("label.emphasis"),cursorStyle:n.get("cursor")};t.diff(o).add(function(n){var o=t.getItemLayout(n);if(es(t,n,e)){var s=new a(t,n,r);s.attr("position",o),t.setItemGraphicEl(n,s),i.add(s)}}).update(function(s,l){var h=o.getItemGraphicEl(l),u=t.getItemLayout(s);es(t,s,e)?(h?(h.updateData(t,s,r),wo(h,{position:u},n)):(h=new a(t,s)).attr("position",u),i.add(h),t.setItemGraphicEl(s,h)):i.remove(h)}).remove(function(t){var e=o.getItemGraphicEl(t);e&&e.fadeOut(function(){i.remove(e)})}).execute(),this._data=t},tM.updateLayout=function(){var t=this._data;t&&t.eachItemGraphicEl(function(e,i){var n=t.getItemLayout(i);e.attr("position",n)})},tM.remove=function(t){var e=this.group,i=this._data;i&&(t?i.eachItemGraphicEl(function(t){t.fadeOut(function(){e.remove(t)})}):e.removeAll())};var eM=function(t,e,i,n,o,a){for(var r=os(t,e),s=[],l=[],h=[],u=[],c=[],d=[],f=[],g=a.dimensions,p=0;p0&&as(i[o-1]);o--);for(;n0&&as(i[a-1]);a--);for(;o=0){var r=o.getItemGraphicEl(a);if(!r){var s=o.getItemLayout(a);if(!s)return;(r=new Jr(o,a)).position=s,r.setZ(t.get("zlevel"),t.get("z")),r.ignore=isNaN(s[0])||isNaN(s[1]),r.__temp=!0,o.setItemGraphicEl(a,r),r.stopSymbolAnimation(!0),this.group.add(r)}r.highlight()}else Ta.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var o=t.getData(),a=Ho(o,n);if(null!=a&&a>=0){var r=o.getItemGraphicEl(a);r&&(r.__temp?(o.setItemGraphicEl(a,null),this.group.remove(r)):r.downplay())}else Ta.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new hM({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new uM({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_getSymbolIgnoreFunc:function(t,e){var i=e.getAxesByScale("ordinal")[0];if(i&&i.isLabelIgnored)return m(i.isLabelIgnored,i)},_updateAnimation:function(t,e,i,n,o){var a=this._polyline,r=this._polygon,s=t.hostModel,l=eM(this._data,t,this._stackedOnPoints,e,this._coordSys,i),h=l.current,u=l.stackedOnCurrent,c=l.next,d=l.stackedOnNext;o&&(h=ms(l.current,i,o),u=ms(l.stackedOnCurrent,i,o),c=ms(l.next,i,o),d=ms(l.stackedOnNext,i,o)),a.shape.__points=l.current,a.shape.points=h,wo(a,{shape:{points:c}},s),r&&(r.setShape({points:h,stackedOnPoints:u}),wo(r,{shape:{points:c,stackedOnPoints:d}},s));for(var f=[],g=l.status,p=0;pe&&(e=t[i]);return e},min:function(t){for(var e=1/0,i=0;ie[1]&&e.reverse(),e},getOtherAxis:function(){this.grid.getOtherAxis()},isLabelIgnored:function(t){if("category"===this.type){var e=this.getLabelInterval();return"function"==typeof e&&!e(t,this.scale.getLabel(t))||t%(e+1)}},pointToData:function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},toLocalCoord:null,toGlobalCoord:null},h(mM,US);var vM={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#333",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},yM={};yM.categoryAxis=n({boundaryGap:!0,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},vM),yM.valueAxis=n({boundaryGap:[0,0],splitNumber:5},vM),yM.timeAxis=r({scale:!0,min:"dataMin",max:"dataMax"},yM.valueAxis),yM.logAxis=r({scale:!0,logBase:10},yM.valueAxis);var xM=["value","category","time","log"],_M=function(t,e,i,a){d(xM,function(r){e.extend({type:t+"Axis."+r,mergeDefaultAndTheme:function(e,o){var a=this.layoutMode,s=a?ea(e):{};n(e,o.getTheme().get(r+"Axis")),n(e,this.getDefaultOption()),e.type=i(t,e),a&&ta(e,s,a)},defaultOption:o([{},yM[r+"Axis"],a],!0)})}),Ub.registerSubTypeDefaulter(t+"Axis",v(i,t))},bM=Ub.extend({type:"cartesian2dAxis",axis:null,init:function(){bM.superApply(this,"init",arguments),this.resetRange()},mergeOption:function(){bM.superApply(this,"mergeOption",arguments),this.resetRange()},restoreData:function(){bM.superApply(this,"restoreData",arguments),this.resetRange()},getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"grid",index:this.option.gridIndex,id:this.option.gridId})[0]}});n(bM.prototype,zS);var wM={offset:0};_M("x",bM,_s,wM),_M("y",bM,_s,wM),Ub.extend({type:"grid",dependencies:["xAxis","yAxis"],layoutMode:"box",coordinateSystem:null,defaultOption:{show:!1,zlevel:0,z:0,left:"10%",top:60,right:"10%",bottom:60,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"}});var SM=d,MM=function(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)},IM=Nr,TM=Ms.prototype;TM.type="grid",TM.axisPointerEnabled=!0,TM.getRect=function(){return this._rect},TM.update=function(t,e){var i=this._axesMap;this._updateScale(t,this.model),SM(i.x,function(t){IM(t.scale,t.model)}),SM(i.y,function(t){IM(t.scale,t.model)}),SM(i.x,function(t){Is(i,"y",t)}),SM(i.y,function(t){Is(i,"x",t)}),this.resize(this.model,e)},TM.resize=function(t,e,i){function n(){SM(a,function(t){var e=t.isHorizontal(),i=e?[0,o.width]:[0,o.height],n=t.inverse?1:0;t.setExtent(i[n],i[1-n]),As(t,e?o.x:o.y)})}var o=Ko(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;n(),!i&&t.get("containLabel")&&(SM(a,function(t){if(!t.model.get("axisLabel.inside")){var e=Ss(t);if(e){var i=t.isHorizontal()?"height":"width",n=t.model.get("axisLabel.margin");o[i]-=e[i]+n,"top"===t.position?o.y+=e.height+n:"left"===t.position&&(o.x+=e.width+n)}}}),n())},TM.getAxis=function(t,e){var i=this._axesMap[t];if(null!=i){if(null==e)for(var n in i)if(i.hasOwnProperty(n))return i[n];return i[e]}},TM.getAxes=function(){return this._axesList.slice()},TM.getCartesian=function(t,e){if(null!=t&&null!=e){var i="x"+t+"y"+e;return this._coordsMap[i]}b(t)&&(e=t.yAxisIndex,t=t.xAxisIndex);for(var n=0,o=this._coordsList;nh[1]?-1:1,c=["start"===o?h[0]-u*l:"end"===o?h[1]+u*l:(h[0]+h[1])/2,Es(o)?t.labelOffset+r*l:0],d=e.get("nameRotate");null!=d&&(d=d*CM/180);var f;Es(o)?n=kM(t.rotation,null!=d?d:t.rotation,r):(n=ks(t,o,d||0,h),null!=(f=t.axisNameAvailableWidth)&&(f=Math.abs(f/Math.sin(n.rotation)),!isFinite(f)&&(f=null)));var g=s.getFont(),p=e.get("nameTruncate",!0)||{},m=p.ellipsis,v=I(t.nameTruncateMaxWidth,p.maxWidth,f),y=null!=m&&null!=v?Zx(i,v,g,m,{minChar:2,placeholder:p.placeholder}):i,x=e.get("tooltip",!0),_=e.mainType,b={componentType:_,name:i,$vars:["name"]};b[_+"Index"]=e.componentIndex;var w=new ib({anid:"name",__fullText:i,__truncatedText:y,position:c,rotation:n.rotation,silent:Ps(e),z2:1,tooltip:x&&x.show?a({content:i,formatter:function(){return i},formatterParams:b},x):null});fo(w.style,s,{text:y,textFont:g,textFill:s.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:n.textAlign,textVerticalAlign:n.textVerticalAlign}),e.get("triggerEvent")&&(w.eventData=Ls(e),w.eventData.targetType="axisName",w.eventData.name=i),this._dumbGroup.add(w),w.updateTransform(),this.group.add(w),w.decomposeTransform()}}},kM=DM.innerTextLayout=function(t,e,i){var n,o,a=Li(e-t);return ki(a)?(o=i>0?"top":"bottom",n="center"):ki(a-CM)?(o=i>0?"bottom":"top",n="center"):(o="middle",n=a>0&&a0?"right":"left":i>0?"left":"right"),{rotation:a,textAlign:n,textVerticalAlign:o}},PM=DM.ifIgnoreOnTick=function(t,e,i,n,o,a){if(0===e&&o||e===n-1&&a)return!1;var r,s=t.scale;return"ordinal"===s.type&&("function"==typeof i?(r=s.getTicks()[e],!i(r,s.getLabel(r))):e%(i+1))},OM=DM.getInterval=function(t,e){var i=t.get("interval");return null!=i&&"auto"!=i||(i=e),i},zM=d,NM=v,EM=lr({type:"axis",_axisPointer:null,axisPointerClass:null,render:function(t,e,i,n){this.axisPointerClass&&Us(t),EM.superApply(this,"render",arguments),$s(this,t,0,i,0,!0)},updateAxisPointer:function(t,e,i,n,o){$s(this,t,0,i,0,!1)},remove:function(t,e){var i=this._axisPointer;i&&i.remove(e),EM.superApply(this,"remove",arguments)},dispose:function(t,e){Ks(this,e),EM.superApply(this,"dispose",arguments)}}),RM=[];EM.registerAxisPointerClass=function(t,e){RM[t]=e},EM.getAxisPointerClass=function(t){return t&&RM[t]};var VM=DM.ifIgnoreOnTick,BM=DM.getInterval,GM=["axisLine","axisTickLabel","axisName"],WM=["splitArea","splitLine"],HM=EM.extend({type:"cartesianAxis",axisPointerClass:"CartesianAxisPointer",render:function(t,e,i,n){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new jy,this.group.add(this._axisGroup),t.get("show")){var a=t.getCoordSysModel(),r=Js(a,t),s=new DM(t,r);d(GM,s.add,s),this._axisGroup.add(s.getGroup()),d(WM,function(e){t.get(e+".show")&&this["_"+e](t,a,r.labelInterval)},this),Ao(o,this._axisGroup,t),HM.superCall(this,"render",t,e,i,n)}},_splitLine:function(t,e,i){var n=t.axis;if(!n.scale.isBlank()){var o=t.getModel("splitLine"),a=o.getModel("lineStyle"),s=a.get("color"),l=BM(o,i);s=y(s)?s:[s];for(var h=e.coordinateSystem.getRect(),u=n.isHorizontal(),c=0,d=n.getTicksCoords(),f=n.scale.getTicks(),g=t.get("axisLabel.showMinLabel"),p=t.get("axisLabel.showMaxLabel"),m=[],v=[],x=a.getLineStyle(),_=0;_1){var h;"string"==typeof i?h=fM[i]:"function"==typeof i&&(h=i),h&&(e=e.downSample(a.dim,1/l,h,gM),t.setData(e))}}},this)},"line"));var FM="__ec_stack_";nl.getLayoutOnAxis=function(t,e){var i=[],n=t.axis;if("category"===n.type){for(var o=n.getBandWidth(),a=0;a0?1:-1,r=n.height>0?1:-1;return{x:n.x+a*o/2,y:n.y+r*o/2,width:n.width-a*o,height:n.height-r*o}},polar:function(t,e,i){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle}}};or(v(nl,"bar")),ar(function(t){t.eachSeriesByType("bar",function(t){t.getData().setVisual("legendSymbol","roundRect")})});var $M={updateSelectedMap:function(t){this._targetList=t.slice(),this._selectTargetMap=g(t||[],function(t,e){return t.set(e.name,e),t},z())},select:function(t,e){var i=null!=e?this._targetList[e]:this._selectTargetMap.get(t);"single"===this.get("selectedMode")&&this._selectTargetMap.each(function(t){t.selected=!1}),i&&(i.selected=!0)},unSelect:function(t,e){var i=null!=e?this._targetList[e]:this._selectTargetMap.get(t);i&&(i.selected=!1)},toggleSelected:function(t,e){var i=null!=e?this._targetList[e]:this._selectTargetMap.get(t);if(null!=i)return this[i.selected?"unSelect":"select"](t,e),i.selected},isSelected:function(t,e){var i=null!=e?this._targetList[e]:this._selectTargetMap.get(t);return i&&i.selected}},KM=hr({type:"series.pie",init:function(t){KM.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()},this.updateSelectedMap(t.data),this._defaultLabelLine(t)},mergeOption:function(t){KM.superCall(this,"mergeOption",t),this.updateSelectedMap(this.option.data)},getInitialData:function(t,e){var i=xr(["value"],t.data),n=new aS(i,this);return n.initData(t.data),n},getDataParams:function(t){var e=this.getData(),i=KM.superCall(this,"getDataParams",t),n=[];return e.each("value",function(t){n.push(t)}),i.percent=Di(n,t,e.hostModel.get("percentPrecision")),i.$vars.push("percent"),i},_defaultLabelLine:function(t){zo(t.labelLine,["show"]);var e=t.labelLine.normal,i=t.labelLine.emphasis;e.show=e.show&&t.label.normal.show,i.show=i.show&&t.label.emphasis.show},defaultOption:{zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,selectedOffset:10,hoverOffset:10,avoidLabelOverlap:!0,percentPrecision:2,stillShowZeroSum:!0,label:{normal:{rotate:!1,show:!0,position:"outer"},emphasis:{}},labelLine:{normal:{show:!0,length:15,length2:15,smooth:!1,lineStyle:{width:1,type:"solid"}}},itemStyle:{normal:{borderWidth:1},emphasis:{}},animationType:"expansion",animationEasing:"cubicOut",data:[]}});u(KM,$M);var JM=dl.prototype;JM.updateData=function(t,e,i){function n(){s.stopAnimation(!0),s.animateTo({shape:{r:u.r+l.get("hoverOffset")}},300,"elasticOut")}function o(){s.stopAnimation(!0),s.animateTo({shape:{r:u.r}},300,"elasticOut")}var s=this.childAt(0),l=t.hostModel,h=t.getItemModel(e),u=t.getItemLayout(e),c=a({},u);c.label=null,i?(s.setShape(c),"scale"===l.getShallow("animationType")?(s.shape.r=u.r0,So(s,{shape:{r:u.r}},l,e)):(s.shape.endAngle=u.startAngle,wo(s,{shape:{endAngle:u.endAngle}},l,e))):wo(s,{shape:c},l,e);var d=h.getModel("itemStyle"),f=t.getItemVisual(e,"color");s.useStyle(r({lineJoin:"bevel",fill:f},d.getModel("normal").getItemStyle())),s.hoverStyle=d.getModel("emphasis").getItemStyle();var g=h.getShallow("cursor");g&&s.attr("cursor",g),cl(this,t.getItemLayout(e),h.get("selected"),l.get("selectedOffset"),l.get("animation")),s.off("mouseover").off("mouseout").off("emphasis").off("normal"),h.get("hoverAnimation")&&l.isAnimationEnabled()&&s.on("mouseover",n).on("mouseout",o).on("emphasis",n).on("normal",o),this._updateLabel(t,e),uo(this)},JM._updateLabel=function(t,e){var i=this.childAt(1),n=this.childAt(2),o=t.hostModel,a=t.getItemModel(e),r=t.getItemLayout(e).label,s=t.getItemVisual(e,"color");wo(i,{shape:{points:r.linePoints||[[r.x,r.y],[r.x,r.y],[r.x,r.y]]}},o,e),wo(n,{style:{x:r.x,y:r.y}},o,e),n.attr({rotation:r.rotation,origin:[r.x,r.y],z2:10});var l=a.getModel("label.normal"),h=a.getModel("label.emphasis"),u=a.getModel("labelLine.normal"),c=a.getModel("labelLine.emphasis"),s=t.getItemVisual(e,"color");co(n.style,n.hoverStyle={},l,h,{labelFetcher:t.hostModel,labelDataIndex:e,defaultText:t.getName(e),autoColor:s,useInsideStyle:!!r.inside},{textAlign:r.textAlign,textVerticalAlign:r.verticalAlign,opacity:t.getItemVisual(e,"opacity")}),n.ignore=n.normalIgnore=!l.get("show"),n.hoverIgnore=!h.get("show"),i.ignore=i.normalIgnore=!u.get("show"),i.hoverIgnore=!c.get("show"),i.setStyle({stroke:s,opacity:t.getItemVisual(e,"opacity")}),i.setStyle(u.getModel("lineStyle").getLineStyle()),i.hoverStyle=c.getModel("lineStyle").getLineStyle();var d=u.get("smooth");d&&!0===d&&(d=.4),i.setShape({smooth:d})},h(dl,jy);Ta.extend({type:"pie",init:function(){var t=new jy;this._sectorGroup=t},render:function(t,e,i,n){if(!n||n.from!==this.uid){var o=t.getData(),a=this._data,r=this.group,s=e.get("animation"),l=!a,h=t.get("animationType"),u=v(ul,this.uid,t,s,i),c=t.get("selectedMode");if(o.diff(a).add(function(t){var e=new dl(o,t);l&&"scale"!==h&&e.eachChild(function(t){t.stopAnimation(!0)}),c&&e.on("click",u),o.setItemGraphicEl(t,e),r.add(e)}).update(function(t,e){var i=a.getItemGraphicEl(e);i.updateData(o,t),i.off("click"),c&&i.on("click",u),r.add(i),o.setItemGraphicEl(t,i)}).remove(function(t){var e=a.getItemGraphicEl(t);r.remove(e)}).execute(),s&&l&&o.count()>0&&"scale"!==h){var d=o.getItemLayout(0),f=Math.max(i.getWidth(),i.getHeight())/2,g=m(r.removeClipPath,r);r.setClipPath(this._createClipPath(d.cx,d.cy,f,d.startAngle,d.clockwise,g,t))}this._data=o}},dispose:function(){},_createClipPath:function(t,e,i,n,o,a,r){var s=new rb({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:o}});return So(s,{shape:{endAngle:n+(o?1:-1)*Math.PI*2}},r,a),s},containPoint:function(t,e){var i=e.getData().getItemLayout(0);if(i){var n=t[0]-i.cx,o=t[1]-i.cy,a=Math.sqrt(n*n+o*o);return a<=i.r&&a>=i.r0}}});var QM=function(t,e){d(e,function(e){e.update="updateView",ir(e,function(i,n){var o={};return n.eachComponent({mainType:"series",subType:t,query:i},function(t){t[e.method]&&t[e.method](i.name,i.dataIndex);var n=t.getData();n.each(function(e){var i=n.getName(e);o[i]=t.isSelected(i)||!1})}),{name:i.name,selected:o}})})},tI=function(t,e){var i={};e.eachRawSeriesByType(t,function(t){var n=t.getRawData(),o={};if(!e.isSeriesFiltered(t)){var a=t.getData();a.each(function(t){var e=a.getRawIndex(t);o[e]=t}),n.each(function(e){var r=o[e],s=null!=r&&a.getItemVisual(r,"color",!0);if(s)n.setItemVisual(e,"color",s);else{var l=n.getItemModel(e).get("itemStyle.normal.color")||t.getColorFromPalette(n.getName(e),i);n.setItemVisual(e,"color",l),null!=r&&a.setItemVisual(r,"color",l)}})}})},eI=function(t,e,i,n){var o,a,r=t.getData(),s=[],l=!1;r.each(function(i){var n,h,u,c,d=r.getItemLayout(i),f=r.getItemModel(i),g=f.getModel("label.normal"),p=g.get("position")||f.get("label.emphasis.position"),m=f.getModel("labelLine.normal"),v=m.get("length"),y=m.get("length2"),x=(d.startAngle+d.endAngle)/2,_=Math.cos(x),b=Math.sin(x);o=d.cx,a=d.cy;var w="inside"===p||"inner"===p;if("center"===p)n=d.cx,h=d.cy,c="center";else{var S=(w?(d.r+d.r0)/2*_:d.r*_)+o,M=(w?(d.r+d.r0)/2*b:d.r*b)+a;if(n=S+3*_,h=M+3*b,!w){var I=S+_*(v+e-d.r),T=M+b*(v+e-d.r),A=I+(_<0?-1:1)*y,C=T;n=A+(_<0?-5:5),h=C,u=[[S,M],[I,T],[A,C]]}c=w?"center":_>0?"left":"right"}var D=g.getFont(),L=g.get("rotate")?_<0?-x+Math.PI:-x:0,k=de(t.getFormattedLabel(i,"normal")||r.getName(i),D,c,"top");l=!!L,d.label={x:n,y:h,position:p,height:k.height,len:v,len2:y,linePoints:u,textAlign:c,verticalAlign:"middle",rotation:L,inside:w},w||s.push(d.label)}),!l&&t.get("avoidLabelOverlap")&&gl(s,o,a,e,i,n)},iI=2*Math.PI,nI=Math.PI/180,oI=function(t,e){var i=e.findComponents({mainType:"legend"});i&&i.length&&e.eachSeriesByType(t,function(t){var e=t.getData();e.filterSelf(function(t){for(var n=e.getName(t),o=0;o=0;a--){var r=n[a],s=o[a],l=r[0]-s[0]/2,h=r[1]-s[1]/2;if(t>=l&&e>=h&&t<=l+s[0]&&e<=h+s[1])return a}return-1}}),rI=pl.prototype;rI.updateData=function(t){this.group.removeAll();var e=this._symbolEl,i=t.hostModel;e.setShape({points:t.mapArray(t.getItemLayout),sizes:t.mapArray(function(e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array||(i=[i,i]),i})}),e.symbolProxy=Hr(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor,e.useStyle(i.getModel("itemStyle.normal").getItemStyle(["color"]));var n=t.getVisual("color");n&&e.setColor(n),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>=0&&(e.dataIndex=i)}),this.group.add(e)},rI.updateLayout=function(t){var e=t.getData();this._symbolEl.setShape({points:e.mapArray(e.getItemLayout)})},rI.remove=function(){this.group.removeAll()},ur({type:"scatter",init:function(){this._normalSymbolDraw=new ts,this._largeSymbolDraw=new pl},render:function(t,e,i){var n=t.getData(),o=this._largeSymbolDraw,a=this._normalSymbolDraw,r=this.group,s=t.get("large")&&n.count()>t.get("largeThreshold")?o:a;this._symbolDraw=s,s.updateData(n),r.add(s.group),r.remove(s===o?a.group:o.group)},updateLayout:function(t){this._symbolDraw.updateLayout(t)},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(e,!0)},dispose:function(){}}),ar(v(cM,"scatter","circle",null)),or(v(dM,"scatter")),h(ml,US),vl.prototype.getIndicatorAxes=function(){return this._indicatorAxes},vl.prototype.dataToPoint=function(t,e){var i=this._indicatorAxes[e];return this.coordToPoint(i.dataToCoord(t),e)},vl.prototype.coordToPoint=function(t,e){var i=this._indicatorAxes[e].angle;return[this.cx+t*Math.cos(i),this.cy-t*Math.sin(i)]},vl.prototype.pointToData=function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=Math.sqrt(e*e+i*i);e/=n,i/=n;for(var o,a=Math.atan2(-i,e),r=1/0,s=-1,l=0;ln[0]&&isFinite(c)&&isFinite(n[0]))}else{r.getTicks().length-1>a&&(h=i(h));var d=Math.round((n[0]+n[1])/2/h)*h,f=Math.round(a/2);r.setExtent(Mi(d-f*h),Mi(d+(a-f)*h)),r.setInterval(h)}})},vl.dimensions=[],vl.create=function(t,e){var i=[];return t.eachComponent("radar",function(n){var o=new vl(n,t,e);i.push(o),n.coordinateSystem=o}),t.eachSeriesByType("radar",function(t){"radar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("radarIndex")||0])}),i},ua.register("radar",vl);var sI=yM.valueAxis,lI=(sr({type:"radar",optionUpdated:function(){var t=this.get("boundaryGap"),e=this.get("splitNumber"),o=this.get("scale"),s=this.get("axisLine"),l=this.get("axisTick"),h=this.get("axisLabel"),u=this.get("name"),c=this.get("name.show"),d=this.get("name.formatter"),g=this.get("nameGap"),p=this.get("triggerEvent"),m=f(this.get("indicator")||[],function(f){null!=f.max&&f.max>0&&!f.min?f.min=0:null!=f.min&&f.min<0&&!f.max&&(f.max=0);var m=u;if(null!=f.color&&(m=r({color:f.color},u)),f=n(i(f),{boundaryGap:t,splitNumber:e,scale:o,axisLine:s,axisTick:l,axisLabel:h,name:f.text,nameLocation:"end",nameGap:g,nameTextStyle:m,triggerEvent:p},!1),c||(f.name=""),"string"==typeof d){var v=f.name;f.name=d.replace("{value}",null!=v?v:"")}else"function"==typeof d&&(f.name=d(f.name,f));var y=a(new Lo(f,null,this.ecModel),zS);return y.mainType="radar",y.componentIndex=this.componentIndex,y},this);this.getIndicatorModels=function(){return m}},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"75%",startAngle:90,name:{show:!0},boundaryGap:[0,0],splitNumber:5,nameGap:15,scale:!1,shape:"polygon",axisLine:n({lineStyle:{color:"#bbb"}},sI.axisLine),axisLabel:yl(sI.axisLabel,!1),axisTick:yl(sI.axisTick,!1),splitLine:yl(sI.splitLine,!0),splitArea:yl(sI.splitArea,!0),indicator:[]}}),["axisLine","axisTickLabel","axisName"]);lr({type:"radar",render:function(t,e,i){this.group.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},_buildAxes:function(t){var e=t.coordinateSystem;d(f(e.getIndicatorAxes(),function(t){return new DM(t.model,{position:[e.cx,e.cy],rotation:t.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})}),function(t){d(lI,t.add,t),this.group.add(t.getGroup())},this)},_buildSplitLineAndArea:function(t){function e(t,e,i){var n=i%e.length;return t[n]=t[n]||[],n}var i=t.coordinateSystem,n=i.getIndicatorAxes();if(n.length){var o=t.get("shape"),a=t.getModel("splitLine"),s=t.getModel("splitArea"),l=a.getModel("lineStyle"),h=s.getModel("areaStyle"),u=a.get("show"),c=s.get("show"),g=l.get("color"),p=h.get("color");g=y(g)?g:[g],p=y(p)?p:[p];var m=[],v=[];if("circle"===o)for(var x=n[0].getTicksCoords(),_=i.cx,b=i.cy,w=0;w"+f(i,function(t,i){return Gi(t.name+" : "+e[i])}).join("
    ")},defaultOption:{zlevel:0,z:2,coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{normal:{width:2,type:"solid"}},label:{normal:{position:"top"}},symbol:"emptyCircle",symbolSize:4}});ur({type:"radar",render:function(t,e,n){function o(t,e){var i=t.getItemVisual(e,"symbol")||"circle",n=t.getItemVisual(e,"color");if("none"!==i){var o=xl(t.getItemVisual(e,"symbolSize")),a=Hr(i,-1,-1,2,2,n);return a.attr({style:{strokeNoScale:!0},z2:100,scale:[o[0]/2,o[1]/2]}),a}}function a(e,i,n,a,r,s){n.removeAll();for(var l=0;l"+Gi(n+" : "+i)},getTooltipPosition:function(t){if(null!=t){var e=this.getData().getName(t),i=this.coordinateSystem,n=i.getRegion(e);return n&&i.dataToPoint(n.center)}},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},defaultOption:{zlevel:0,z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:.75,showLegendSymbol:!0,dataRangeHoverLink:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{normal:{show:!1,color:"#000"},emphasis:{show:!0,color:"rgb(100,0,0)"}},itemStyle:{normal:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{areaColor:"rgba(255,215,0,0.8)"}}}});u(_I,$M);var bI="\0_ec_interaction_mutex";ir({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},function(){}),u(kl,fy);var wI={axisPointer:1,tooltip:1,brush:1};Ul.prototype={constructor:Ul,draw:function(t,e,i,n,o){var a="geo"===t.mainType,r=t.getData&&t.getData();a&&e.eachComponent({mainType:"series",subType:"map"},function(e){r||e.getHostGeoModel()!==t||(r=e.getData())});var s=t.coordinateSystem,l=this.group,h=s.scale,u={position:s.position,scale:h};!l.childAt(0)||o?l.attr(u):wo(l,u,t),l.removeAll();var c=["itemStyle","normal"],f=["itemStyle","emphasis"],g=["label","normal"],p=["label","emphasis"],m=z();d(s.regions,function(e){var i=m.get(e.name)||m.set(e.name,new jy),n=new vb({shape:{paths:[]}});i.add(n);var o,s=(D=t.getRegionModel(e.name)||t).getModel(c),u=D.getModel(f),v=Hl(s),y=Hl(u),x=D.getModel(g),_=D.getModel(p);if(r){o=r.indexOfName(e.name);var b=r.getItemVisual(o,"color",!0);b&&(v.fill=b)}d(e.geometries,function(t){if("polygon"===t.type){n.shape.paths.push(new ub({shape:{points:t.exterior}}));for(var e=0;e<(t.interiors?t.interiors.length:0);e++)n.shape.paths.push(new ub({shape:{points:t.interiors[e]}}))}}),n.setStyle(v),n.style.strokeNoScale=!0,n.culling=!0;var w=x.get("show"),S=_.get("show"),M=r&&isNaN(r.get("value",o)),I=r&&r.getItemLayout(o);if(a||M&&(w||S)||I&&I.showLabel){var T,A=a?e.name:o;(!r||o>=0)&&(T=t);var C=new ib({position:e.center.slice(),scale:[1/h[0],1/h[1]],z2:10,silent:!0});co(C.style,C.hoverStyle={},x,_,{labelFetcher:T,labelDataIndex:A,defaultText:e.name,useInsideStyle:!1},{textAlign:"center",textVerticalAlign:"middle"}),i.add(C)}if(r)r.setItemGraphicEl(o,i);else{var D=t.getRegionModel(e.name);n.eventData={componentType:"geo",geoIndex:t.componentIndex,name:e.name,region:D&&D.option||{}}}(i.__regions||(i.__regions=[])).push(e),uo(i,y,{hoverSilentOnTouch:!!t.get("selectedMode")}),l.add(i)}),this._updateController(t,e,i),Fl(this,t,l,i,n),Zl(t,l)},remove:function(){this.group.removeAll(),this._controller.dispose(),this._controllerHost={}},_updateController:function(t,e,i){function n(){var e={type:"geoRoam",componentType:l};return e[l+"Id"]=t.id,e}var o=t.coordinateSystem,r=this._controller,s=this._controllerHost;s.zoomLimit=t.get("scaleLimit"),s.zoom=o.getZoom(),r.enable(t.get("roam")||!1);var l=t.mainType;r.off("pan").on("pan",function(t,e){this._mouseDownFlag=!1,Bl(s,t,e),i.dispatchAction(a(n(),{dx:t,dy:e}))},this),r.off("zoom").on("zoom",function(t,e,o){if(this._mouseDownFlag=!1,Gl(s,t,e,o),i.dispatchAction(a(n(),{zoom:t,originX:e,originY:o})),this._updateGroup){var r=this.group,l=r.scale;r.traverse(function(t){"text"===t.type&&t.attr("scale",[1/l[0],1/l[1]])})}},this),r.setPointerChecker(function(e,n,a){return o.getViewRectAfterRoam().contain(n,a)&&!Wl(e,i,t)})}},ur({type:"map",render:function(t,e,i,n){if(!n||"mapToggleSelect"!==n.type||n.from!==this.uid){var o=this.group;if(o.removeAll(),!t.getHostGeoModel()){if(n&&"geoRoam"===n.type&&"series"===n.componentType&&n.seriesId===t.id)(a=this._mapDraw)&&o.add(a.group);else if(t.needsDrawMap){var a=this._mapDraw||new Ul(i,!0);o.add(a.group),a.draw(t,e,i,this,n),this._mapDraw=a}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&e.getComponent("legend")&&this._renderSymbols(t,e,i)}}},remove:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},dispose:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},_renderSymbols:function(t,e,i){var n=t.originalData,o=this.group;n.each("value",function(e,i){if(!isNaN(e)){var a=n.getItemLayout(i);if(a&&a.point){var r=a.point,s=a.offset,l=new nb({style:{fill:t.getData().getVisual("color")},shape:{cx:r[0]+9*s,cy:r[1],r:3},silent:!0,z2:s?8:10});if(!s){var h=t.mainSeries.getData(),u=n.getName(i),c=h.indexOfName(u),d=n.getItemModel(i),f=d.getModel("label.normal"),g=d.getModel("label.emphasis"),p=h.getItemGraphicEl(c),m=T(t.getFormattedLabel(i,"normal"),u),v=T(t.getFormattedLabel(i,"emphasis"),m),y=function(){var t=fo({},g,{text:g.get("show")?v:null},{isRectText:!0,useInsideStyle:!1},!0);l.style.extendFrom(t),l.__mapOriginalZ2=l.z2,l.z2+=1},x=function(){fo(l.style,f,{text:f.get("show")?m:null,textPosition:f.getShallow("position")||"bottom"},{isRectText:!0,useInsideStyle:!1}),null!=l.__mapOriginalZ2&&(l.z2=l.__mapOriginalZ2,l.__mapOriginalZ2=null)};p.on("mouseover",y).on("mouseout",x).on("emphasis",y).on("normal",x),x()}o.add(l)}}})}}),ir({type:"geoRoam",event:"geoRoam",update:"updateLayout"},function(t,e){var i=t.componentType||"series";e.eachComponent({mainType:i,query:t},function(e){var n=e.coordinateSystem;if("geo"===n.type){var o=Xl(n,t,e.get("scaleLimit"));e.setCenter&&e.setCenter(o.center),e.setZoom&&e.setZoom(o.zoom),"series"===i&&d(e.seriesGroup,function(t){t.setCenter(o.center),t.setZoom(o.zoom)})}})});or(function(t){var e={};t.eachSeriesByType("map",function(i){var n=i.getMapType();if(!i.getHostGeoModel()&&!e[n]){var o={};d(i.seriesGroup,function(e){var i=e.coordinateSystem,n=e.originalData;e.get("showLegendSymbol")&&t.getComponent("legend")&&n.each("value",function(t,e){var a=n.getName(e),r=i.getRegion(a);if(r&&!isNaN(t)){var s=o[a]||0,l=i.dataToPoint(r.center);o[a]=s+1,n.setItemLayout(e,{point:l,offset:s})}})});var a=i.getData();a.each(function(t){var e=a.getName(t),i=a.getItemLayout(t)||{};i.showLabel=!o[e],a.setItemLayout(t,i)}),e[n]=!0}})}),ar(function(t){t.eachSeriesByType("map",function(t){var e=t.get("color"),i=t.getModel("itemStyle.normal"),n=i.get("areaColor"),o=i.get("color")||e[t.seriesIndex%e.length];t.getData().setVisual({areaColor:n,color:o})})}),er(Pw.PROCESSOR.STATISTIC,function(t){var e={};t.eachSeriesByType("map",function(t){var i=t.getHostGeoModel(),n=i?"o"+i.id:"i"+t.getMapType();(e[n]=e[n]||[]).push(t)}),d(e,function(t,e){for(var i=jl(f(t,function(t){return t.getData()}),t[0].get("mapValueCalculation")),n=0;ne&&(e=n.height)}this.height=e+1},getNodeById:function(t){if(this.getId()===t)return this;for(var e=0,i=this.children,n=i.length;e=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},getLayout:function(){return this.hostTree.data.getItemLayout(this.dataIndex)},getModel:function(t){if(!(this.dataIndex<0)){var e,i=this.hostTree,n=i.data.getItemModel(this.dataIndex),o=this.getLevelModel();return o||0!==this.children.length&&(0===this.children.length||!1!==this.isExpand)||(e=this.getLeavesModel()),n.getModel(t,(o||e||i.hostModel).getModel(t))}},getLevelModel:function(){return(this.hostTree.levelModels||[])[this.depth]},getLeavesModel:function(){return this.hostTree.leavesModel},setVisual:function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},getVisual:function(t,e){return this.hostTree.data.getItemVisual(this.dataIndex,t,e)},getRawIndex:function(){return this.hostTree.data.getRawIndex(this.dataIndex)},getId:function(){return this.hostTree.data.getId(this.dataIndex)}},ih.prototype={constructor:ih,type:"tree",eachNode:function(t,e,i){this.root.eachNode(t,e,i)},getNodeByDataIndex:function(t){var e=this.data.getRawIndex(t);return this._nodes[e]},getNodeByName:function(t){return this.root.getNodeByName(t)},update:function(){for(var t=this.data,e=this._nodes,i=0,n=e.length;ia&&(a=t.depth)});var r=t.expandAndCollapse&&t.initialTreeDepth>=0?t.initialTreeDepth:a;return o.root.eachNode("preorder",function(t){var e=t.hostTree.data.getRawDataItem(t.dataIndex);t.isExpand=e&&null!=e.collapsed?!e.collapsed:t.depth<=r}),o.data},formatTooltip:function(t){for(var e=this.getData().tree,i=e.root.children[0],n=e.getNodeByDataIndex(t),o=n.getValue(),a=n.name;n&&n!==i;)a=n.parentNode.name+"."+a,n=n.parentNode;return Gi(a+(isNaN(o)||null==o?"":" : "+o))},defaultOption:{zlevel:0,z:2,left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",orient:"horizontal",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{normal:{color:"#ccc",width:1.5,curveness:.5}},itemStyle:{normal:{color:"lightsteelblue",borderColor:"#c23531",borderWidth:1.5}},label:{normal:{show:!0,color:"#555"}},leaves:{label:{normal:{show:!0}}},animationEasing:"linear",animationDuration:700,animationDurationUpdate:1e3}}),ur({type:"tree",init:function(t,e){this._oldTree,this._mainGroup=new jy,this.group.add(this._mainGroup)},render:function(t,e,i,n){var o=t.getData(),a=t.layoutInfo,r=this._mainGroup,s=t.get("layout");"radial"===s?r.attr("position",[a.x+a.width/2,a.y+a.height/2]):r.attr("position",[a.x,a.y]);var l=this._data,h={expandAndCollapse:t.get("expandAndCollapse"),layout:s,orient:t.get("orient"),curvature:t.get("lineStyle.normal.curveness"),symbolRotate:t.get("symbolRotate"),symbolOffset:t.get("symbolOffset"),hoverAnimation:t.get("hoverAnimation"),useNameLabel:!0,fadeIn:!0};o.diff(l).add(function(e){vh(o,e)&&xh(o,e,null,r,t,h)}).update(function(e,i){var n=l.getItemGraphicEl(i);vh(o,e)?xh(o,e,n,r,t,h):n&&_h(o,e,n,r,t,h)}).remove(function(e){var i=l.getItemGraphicEl(e);_h(o,e,i,r,t,h)}).execute(),!0===h.expandAndCollapse&&o.eachItemGraphicEl(function(e,n){e.off("click").on("click",function(){i.dispatchAction({type:"treeExpandAndCollapse",seriesId:t.id,dataIndex:n})})}),this._data=o},dispose:function(){},remove:function(){this._mainGroup.removeAll(),this._data=null}}),ir({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,e){e.eachComponent({mainType:"series",subType:"tree",query:t},function(e){var i=t.dataIndex,n=e.getData().tree.getNodeByDataIndex(i);n.isExpand=!n.isExpand})});var AI=function(t,e){var i=hh(t,e);t.layoutInfo=i;var n=t.get("layout"),o=0,a=0,r=null;"radial"===n?(o=2*Math.PI,a=Math.min(i.height,i.width)/2,r=sh(function(t,e){return(t.parentNode===e.parentNode?1:2)/t.depth})):(o=i.width,a=i.height,r=sh());var s=t.getData().tree.root,l=s.children[0];oh(s),wh(l,ah,r),s.hierNode.modifier=-l.hierNode.prelim,Sh(l,rh);var h=l,u=l,c=l;Sh(l,function(t){var e=t.getLayout().x;eu.getLayout().x&&(u=t),t.depth>c.depth&&(c=t)});var d=h===u?1:r(h,u)/2,f=d-h.getLayout().x,g=0,p=0,m=0,v=0;"radial"===n?(g=o/(u.getLayout().x+d+f),p=a/(c.depth-1||1),Sh(l,function(t){m=(t.getLayout().x+f)*g,v=(t.depth-1)*p;var e=lh(m,v);t.setLayout({x:e.x,y:e.y,rawX:m,rawY:v},!0)})):"horizontal"===t.get("orient")?(p=a/(u.getLayout().x+d+f),g=o/(c.depth-1||1),Sh(l,function(t){v=(t.getLayout().x+f)*p,m=(t.depth-1)*g,t.setLayout({x:m,y:v},!0)})):(g=o/(u.getLayout().x+d+f),p=a/(c.depth-1||1),Sh(l,function(t){m=(t.getLayout().x+f)*g,v=(t.depth-1)*p,t.setLayout({x:m,y:v},!0)}))};ar(v(cM,"tree","circle",null)),or(function(t,e){t.eachSeriesByType("tree",function(t){AI(t,e)})}),or(function(t,e){t.eachSeriesByType("tree",function(t){AI(t,e)})}),yw.extend({type:"series.treemap",layoutMode:"box",dependencies:["grid","polar"],_viewRoot:null,defaultOption:{progressive:0,hoverLayerThreshold:1/0,left:"center",top:"middle",right:null,bottom:null,width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{normal:{color:"rgba(0,0,0,0.7)",borderColor:"rgba(255,255,255,0.7)",borderWidth:1,shadowColor:"rgba(150,150,150,1)",shadowBlur:3,shadowOffsetX:0,shadowOffsetY:0,textStyle:{color:"#fff"}},emphasis:{textStyle:{}}}},label:{normal:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",ellipsis:!0}},upperLabel:{normal:{show:!1,position:[0,"50%"],height:20,color:"#fff",ellipsis:!0,verticalAlign:"middle"},emphasis:{show:!0,position:[0,"50%"],color:"#fff",ellipsis:!0,verticalAlign:"middle"}},itemStyle:{normal:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},getInitialData:function(t,e){var i={name:t.name,children:t.data};Ch(i);var n=t.levels||[];n=t.levels=Dh(n,e);var o={};return o.levels=n,ih.createTree(i,this,o).data},optionUpdated:function(){this.resetViewRoot()},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=Vi(y(i)?i[0]:i);return Gi(e.getName(t)+": "+n)},getDataParams:function(t){var e=yw.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return e.treePathInfo=Ah(i,this),e},setLayoutInfo:function(t){this.layoutInfo=this.layoutInfo||{},a(this.layoutInfo,t)},mapIdToIndex:function(t){var e=this._idIndexMap;e||(e=this._idIndexMap=z(),this._idIndexMapCount=0);var i=e.get(t);return null==i&&e.set(t,i=this._idIndexMapCount++),i},getViewRoot:function(){return this._viewRoot},resetViewRoot:function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)}});var CI=5;Lh.prototype={constructor:Lh,render:function(t,e,i,n){var o=t.getModel("breadcrumb"),a=this.group;if(a.removeAll(),o.get("show")&&i){var r=o.getModel("itemStyle.normal"),s=r.getModel("textStyle"),l={pos:{left:o.get("left"),right:o.get("right"),top:o.get("top"),bottom:o.get("bottom")},box:{width:e.getWidth(),height:e.getHeight()},emptyItemWidth:o.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,l,s),this._renderContent(t,l,r,s,n),Jo(a,l.pos,l.box)}},_prepare:function(t,e,i){for(var n=t;n;n=n.parentNode){var o=n.getModel().get("name"),a=i.getTextRect(o),r=Math.max(a.width+16,e.emptyItemWidth);e.totalWidth+=r+8,e.renderList.push({node:n,text:o,width:r})}},_renderContent:function(t,e,i,n,o){for(var a=0,s=e.emptyItemWidth,l=t.get("breadcrumb.height"),h=$o(e.pos,e.box),u=e.totalWidth,c=e.renderList,d=c.length-1;d>=0;d--){var f=c[d],g=f.node,p=f.width,m=f.text;u>h.width&&(u-=p-s,p=s,m=null);var y=new ub({shape:{points:kh(a,0,p,l,d===c.length-1,0===d)},style:r(i.getItemStyle(),{lineJoin:"bevel",text:m,textFill:n.getTextColor(),textFont:n.getFont()}),z:10,onclick:v(o,g)});this.group.add(y),Ph(y,t,g),a+=p+8}},remove:function(){this.group.removeAll()}};var DI=m,LI=jy,kI=db,PI=d,OI=["label","normal"],zI=["label","emphasis"],NI=["upperLabel","normal"],EI=["upperLabel","emphasis"],RI=10,VI=1,BI=2,GI=$x([["fill","color"],["stroke","strokeColor"],["lineWidth","strokeWidth"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),WI=function(t){var e=GI(t);return e.stroke=e.fill=e.lineWidth=null,e};ur({type:"treemap",init:function(t,e){this._containerGroup,this._storage={nodeGroup:[],background:[],content:[]},this._oldTree,this._breadcrumb,this._controller,this._state="ready"},render:function(t,e,i,n){if(!(l(e.findComponents({mainType:"series",subType:"treemap",query:n}),t)<0)){this.seriesModel=t,this.api=i,this.ecModel=e;var o=Mh(n,t),a=n&&n.type,r=t.layoutInfo,s=!this._oldTree,h=this._storage,u="treemapRootToNode"===a&&o&&h?{rootNodeGroup:h.nodeGroup[o.node.getRawIndex()],direction:n.direction}:null,c=this._giveContainerGroup(r),d=this._doRender(c,t,u);s||a&&"treemapZoomToNode"!==a&&"treemapRootToNode"!==a?d.renderFinally():this._doAnimation(c,d,t,u),this._resetController(i),this._renderBreadcrumb(t,i,o)}},_giveContainerGroup:function(t){var e=this._containerGroup;return e||(e=this._containerGroup=new LI,this._initEvents(e),this.group.add(e)),e.attr("position",[t.x,t.y]),e},_doRender:function(t,e,i){function n(t,e,i,o,a){function r(t){return t.getId()}function s(r,s){var l=null!=r?t[r]:null,h=null!=s?e[s]:null,c=u(l,h,i,a);c&&n(l&&l.viewChildren||[],h&&h.viewChildren||[],c,o,a+1)}o?(e=t,PI(t,function(t,e){!t.isRemoved()&&s(e,e)})):new fr(e,t,r,r).add(s).update(s).remove(v(s,null)).execute()}var o=e.getData().tree,a=this._oldTree,r={nodeGroup:[],background:[],content:[]},s={nodeGroup:[],background:[],content:[]},l=this._storage,h=[],u=v(zh,e,s,l,i,r,h);n(o.root?[o.root]:[],a&&a.root?[a.root]:[],t,o===a||!a,0);var c=function(t){var e={nodeGroup:[],background:[],content:[]};return t&&PI(t,function(t,i){var n=e[i];PI(t,function(t){t&&(n.push(t),t.__tmWillDelete=1)})}),e}(l);return this._oldTree=o,this._storage=s,{lastsForAnimation:r,willDeleteEls:c,renderFinally:function(){PI(c,function(t){PI(t,function(t){t.parent&&t.parent.remove(t)})}),PI(h,function(t){t.invisible=!0,t.dirty()})}}},_doAnimation:function(t,e,i,n){if(i.get("animation")){var o=i.get("animationDurationUpdate"),r=i.get("animationEasing"),s=Oh();PI(e.willDeleteEls,function(t,e){PI(t,function(t,i){if(!t.invisible){var a,l=t.parent;if(n&&"drillDown"===n.direction)a=l===n.rootNodeGroup?{shape:{x:0,y:0,width:l.__tmNodeWidth,height:l.__tmNodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var h=0,u=0;l.__tmWillDelete||(h=l.__tmNodeWidth/2,u=l.__tmNodeHeight/2),a="nodeGroup"===e?{position:[h,u],style:{opacity:0}}:{shape:{x:h,y:u,width:0,height:0},style:{opacity:0}}}a&&s.add(t,a,o,r)}})}),PI(this._storage,function(t,i){PI(t,function(t,n){var l=e.lastsForAnimation[i][n],h={};l&&("nodeGroup"===i?l.old&&(h.position=t.position.slice(),t.attr("position",l.old)):(l.old&&(h.shape=a({},t.shape),t.setShape(l.old)),l.fadein?(t.setStyle("opacity",0),h.style={opacity:1}):1!==t.style.opacity&&(h.style={opacity:1})),s.add(t,h,o,r))})},this),this._state="animating",s.done(DI(function(){this._state="ready",e.renderFinally()},this)).start()}},_resetController:function(t){var e=this._controller;e||((e=this._controller=new kl(t.getZr())).enable(this.seriesModel.get("roam")),e.on("pan",DI(this._onPan,this)),e.on("zoom",DI(this._onZoom,this)));var i=new jt(0,0,t.getWidth(),t.getHeight());e.setPointerChecker(function(t,e,n){return i.contain(e,n)})},_clearController:function(){var t=this._controller;t&&(t.dispose(),t=null)},_onPan:function(t,e){if("animating"!==this._state&&(Math.abs(t)>3||Math.abs(e)>3)){var i=this.seriesModel.getData().tree.root;if(!i)return;var n=i.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+t,y:n.y+e,width:n.width,height:n.height}})}},_onZoom:function(t,e,i){if("animating"!==this._state){var n=this.seriesModel.getData().tree.root;if(!n)return;var o=n.getLayout();if(!o)return;var a=new jt(o.x,o.y,o.width,o.height),r=this.seriesModel.layoutInfo;e-=r.x,i-=r.y;var s=ot();lt(s,s,[-e,-i]),ut(s,s,[t,t]),lt(s,s,[e,i]),a.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x,y:a.y,width:a.width,height:a.height}})}},_initEvents:function(t){t.on("click",function(t){if("ready"===this._state){var e=this.seriesModel.get("nodeClick",!0);if(e){var i=this.findTarget(t.offsetX,t.offsetY);if(i){var n=i.node;if(n.getLayout().isLeafRoot)this._rootToNode(i);else if("zoomToNode"===e)this._zoomToNode(i);else if("link"===e){var o=n.hostTree.data.getItemModel(n.dataIndex),a=o.get("link",!0),r=o.get("target",!0)||"blank";a&&window.open(a,r)}}}}},this)},_renderBreadcrumb:function(t,e,i){i||(i=null!=t.get("leafDepth",!0)?{node:t.getViewRoot()}:this.findTarget(e.getWidth()/2,e.getHeight()/2))||(i={node:t.getData().tree.root}),(this._breadcrumb||(this._breadcrumb=new Lh(this.group))).render(t,e,i.node,DI(function(e){"animating"!==this._state&&(Th(t.getViewRoot(),e)?this._rootToNode({node:e}):this._zoomToNode({node:e}))},this))},remove:function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage={nodeGroup:[],background:[],content:[]},this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},dispose:function(){this._clearController()},_zoomToNode:function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},_rootToNode:function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},findTarget:function(t,e){var i;return this.seriesModel.getViewRoot().eachNode({attr:"viewChildren",order:"preorder"},function(n){var o=this._storage.background[n.getRawIndex()];if(o){var a=o.transformCoordToLocal(t,e),r=o.shape;if(!(r.x<=a[0]&&a[0]<=r.x+r.width&&r.y<=a[1]&&a[1]<=r.y+r.height))return!1;i={node:n,offsetX:a[0],offsetY:a[1]}}},this),i}});for(var HI=["treemapZoomToNode","treemapRender","treemapMove"],FI=0;FI=0&&t.call(e,i[o],o)},sT.eachEdge=function(t,e){for(var i=this.edges,n=i.length,o=0;o=0&&i[o].node1.dataIndex>=0&&i[o].node2.dataIndex>=0&&t.call(e,i[o],o)},sT.breadthFirstTraverse=function(t,e,i,n){if(e instanceof gu||(e=this._nodesMap[fu(e)]),e){for(var o="out"===i?"outEdges":"in"===i?"inEdges":"edges",a=0;a=0&&i.node2.dataIndex>=0});for(var o=0,a=n.length;o=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i,n){return this[t][e].getItemVisual(this.dataIndex,i,n)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}};u(gu,lT("hostGraph","data")),u(pu,lT("hostGraph","edgeData")),rT.Node=gu,rT.Edge=pu;var hT=function(t,e,i,n,o){for(var a=new rT(n),r=0;r "+d)),h++)}var f,g=i.get("coordinateSystem");if("cartesian2d"===g||"polar"===g)f=Sr(t,i,i.ecModel);else{var p=ua.get(g),m=xr((p&&"view"!==p.type?p.dimensions||[]:[]).concat(["value"]),t);(f=new aS(m,i)).initData(t)}var v=new aS(["value"],i);return v.initData(l,s),o&&o(f,v),ql({mainData:f,struct:a,structAttr:"graph",datas:{node:f,edge:v},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a},uT=hr({type:"series.graph",init:function(t){uT.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeOption:function(t){uT.superApply(this,"mergeOption",arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeDefaultAndTheme:function(t){uT.superApply(this,"mergeDefaultAndTheme",arguments),zo(t.edgeLabel,["show"])},getInitialData:function(t,e){var i=t.edges||t.links||[],n=t.data||t.nodes||[],o=this;if(n&&i)return hT(n,i,this,!0,function(t,i){function n(t){return(t=this.parsePath(t))&&"label"===t[0]?r:this.parentModel}t.wrapMethod("getItemModel",function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t});var a=o.getModel("edgeLabel"),r=new Lo({label:a.option},a.parentModel,e);i.wrapMethod("getItemModel",function(t){return t.customizeGetParent(n),t})}).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,i){if("edge"===i){var n=this.getData(),o=this.getDataParams(t,i),a=n.graph.getEdgeByIndex(t),r=n.getName(a.node1.dataIndex),s=n.getName(a.node2.dataIndex),l=[];return null!=r&&l.push(r),null!=s&&l.push(s),l=Gi(l.join(" > ")),o.value&&(l+=" : "+Gi(o.value)),l}return uT.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=f(this.option.categories||[],function(t){return null!=t.value?t:a({value:0},t)}),e=new aS(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray(function(t){return e.getItemModel(t,!0)})},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},isAnimationEnabled:function(){return uT.superCall(this,"isAnimationEnabled")&&!("force"===this.get("layout")&&this.get("force.layoutAnimation"))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",legendHoverLink:!0,hoverAnimation:!0,layout:null,focusNodeAdjacency:!1,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{normal:{position:"middle"},emphasis:{}},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{normal:{show:!1,formatter:"{b}"},emphasis:{show:!0}},itemStyle:{normal:{},emphasis:{}},lineStyle:{normal:{color:"#aaa",width:1,curveness:0,opacity:.5},emphasis:{}}}}),cT=fb.prototype,dT=pb.prototype,fT=Zn({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(mu(e)?cT:dT).buildPath(t,e)},pointAt:function(t){return mu(this.shape)?cT.pointAt.call(this,t):dT.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=mu(e)?[e.x2-e.x1,e.y2-e.y1]:dT.tangentAt.call(this,t);return X(i,i)}}),gT=["fromSymbol","toSymbol"],pT=bu.prototype;pT.beforeUpdate=function(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var o=1,a=this.parent;a;)a.scale&&(o/=a.scale[0]),a=a.parent;var r=t.childOfName("line");if(this.__dirty||r.__dirty){var s=r.shape.percent,l=r.pointAt(0),h=r.pointAt(s),u=H([],h,l);if(X(u,u),e&&(e.attr("position",l),c=r.tangentAt(0),e.attr("rotation",Math.PI/2-Math.atan2(c[1],c[0])),e.attr("scale",[o*s,o*s])),i){i.attr("position",h);var c=r.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(c[1],c[0])),i.attr("scale",[o*s,o*s])}if(!n.ignore){n.attr("position",h);var d,f,g,p=5*o;if("end"===n.__position)d=[u[0]*p+h[0],u[1]*p+h[1]],f=u[0]>.8?"left":u[0]<-.8?"right":"center",g=u[1]>.8?"top":u[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var m=s/2,v=[(c=r.tangentAt(m))[1],-c[0]],y=r.pointAt(m);v[1]>0&&(v[0]=-v[0],v[1]=-v[1]),d=[y[0]+v[0]*p,y[1]+v[1]*p],f="center",g="bottom";var x=-Math.atan2(c[1],c[0]);h[0].8?"right":u[0]<-.8?"left":"center",g=u[1]>.8?"bottom":u[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||g,textAlign:n.__textAlign||f},position:d,scale:[o,o]})}}}},pT._createLine=function(t,e,i){var n=t.hostModel,o=xu(t.getItemLayout(e));o.shape.percent=0,So(o,{shape:{percent:1}},n,e),this.add(o);var a=new ib({name:"label"});this.add(a),d(gT,function(i){var n=yu(i,t,e);this.add(n),this[vu(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},pT.updateData=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=t.getItemLayout(e),r={shape:{}};_u(r.shape,a),wo(o,r,n,e),d(gT,function(i){var n=t.getItemVisual(e,i),o=vu(i);if(this[o]!==n){this.remove(this.childOfName(i));var a=yu(i,t,e);this.add(a)}this[o]=n},this),this._updateCommonStl(t,e,i)},pT._updateCommonStl=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=i&&i.lineStyle,s=i&&i.hoverLineStyle,l=i&&i.labelModel,h=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var u=t.getItemModel(e);a=u.getModel("lineStyle.normal").getLineStyle(),s=u.getModel("lineStyle.emphasis").getLineStyle(),l=u.getModel("label.normal"),h=u.getModel("label.emphasis")}var c=t.getItemVisual(e,"color"),f=A(t.getItemVisual(e,"opacity"),a.opacity,1);o.useStyle(r({strokeNoScale:!0,fill:"none",stroke:c,opacity:f},a)),o.hoverStyle=s,d(gT,function(t){var e=this.childOfName(t);e&&(e.setColor(c),e.setStyle({opacity:f}))},this);var g,p,m,v,y=l.getShallow("show"),x=h.getShallow("show"),_=this.childOfName("label");if(y||x){var b=n.getRawValue(e);p=null==b?p=t.getName(e):isFinite(b)?Mi(b):b,g=c||"#000",m=T(n.getFormattedLabel(e,"normal",t.dataType),p),v=T(n.getFormattedLabel(e,"emphasis",t.dataType),m)}if(y){var w=fo(_.style,l,{text:m},{autoColor:g});_.__textAlign=w.textAlign,_.__verticalAlign=w.textVerticalAlign,_.__position=l.get("position")||"middle"}else _.setStyle("text",null);_.hoverStyle=x?{text:v,textFill:h.getTextColor(!0),fontStyle:h.getShallow("fontStyle"),fontWeight:h.getShallow("fontWeight"),fontSize:h.getShallow("fontSize"),fontFamily:h.getShallow("fontFamily")}:{text:null},_.ignore=!y&&!x,uo(this)},pT.highlight=function(){this.trigger("emphasis")},pT.downplay=function(){this.trigger("normal")},pT.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},pT.setLinePoints=function(t){var e=this.childOfName("line");_u(e.shape,t),e.dirty()},h(bu,jy);var mT=Mu.prototype;mT.updateData=function(t){var e=this._lineData,i=this.group,n=this._ctor,o=t.hostModel,a={lineStyle:o.getModel("lineStyle.normal").getLineStyle(),hoverLineStyle:o.getModel("lineStyle.emphasis").getLineStyle(),labelModel:o.getModel("label.normal"),hoverLabelModel:o.getModel("label.emphasis")};t.diff(e).add(function(e){if(Su(t.getItemLayout(e))){var o=new n(t,e,a);t.setItemGraphicEl(e,o),i.add(o)}}).update(function(o,r){var s=e.getItemGraphicEl(r);Su(t.getItemLayout(o))?(s?s.updateData(t,o,a):s=new n(t,o,a),t.setItemGraphicEl(o,s),i.add(s)):i.remove(s)}).remove(function(t){i.remove(e.getItemGraphicEl(t))}).execute(),this._lineData=t},mT.updateLayout=function(){var t=this._lineData;t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},mT.remove=function(){this.group.removeAll()};var vT=[],yT=[],xT=[],_T=un,bT=uy,wT=Math.abs,ST=function(t,e){function i(t){var e=t.getVisual("symbolSize");return e instanceof Array&&(e=(e[0]+e[1])/2),e}var n=[],o=gn,a=[[],[],[]],r=[[],[]],s=[];e/=2,t.eachEdge(function(t,l){var h=t.getLayout(),u=t.getVisual("fromSymbol"),c=t.getVisual("toSymbol");h.__original||(h.__original=[V(h[0]),V(h[1])],h[2]&&h.__original.push(V(h[2])));var d=h.__original;if(null!=h[2]){if(R(a[0],d[0]),R(a[1],d[2]),R(a[2],d[1]),u&&"none"!=u){var f=i(t.node1),g=Iu(a,d[0],f*e);o(a[0][0],a[1][0],a[2][0],g,n),a[0][0]=n[3],a[1][0]=n[4],o(a[0][1],a[1][1],a[2][1],g,n),a[0][1]=n[3],a[1][1]=n[4]}if(c&&"none"!=c){var f=i(t.node2),g=Iu(a,d[1],f*e);o(a[0][0],a[1][0],a[2][0],g,n),a[1][0]=n[1],a[2][0]=n[2],o(a[0][1],a[1][1],a[2][1],g,n),a[1][1]=n[1],a[2][1]=n[2]}R(h[0],a[0]),R(h[1],a[2]),R(h[2],a[1])}else{if(R(r[0],d[0]),R(r[1],d[1]),H(s,r[1],r[0]),X(s,s),u&&"none"!=u){f=i(t.node1);W(r[0],r[0],s,f*e)}if(c&&"none"!=c){f=i(t.node2);W(r[1],r[1],s,-f*e)}R(h[0],r[0]),R(h[1],r[1])}})},MT=["itemStyle","normal","opacity"],IT=["lineStyle","normal","opacity"];ur({type:"graph",init:function(t,e){var i=new ts,n=new Mu,o=this.group;this._controller=new kl(e.getZr()),this._controllerHost={target:o},o.add(i.group),o.add(n.group),this._symbolDraw=i,this._lineDraw=n,this._firstRender=!0},render:function(t,e,i){var n=t.coordinateSystem;this._model=t,this._nodeScaleRatio=t.get("nodeScaleRatio");var o=this._symbolDraw,a=this._lineDraw,r=this.group;if("view"===n.type){var s={position:n.position,scale:n.scale};this._firstRender?r.attr(s):wo(r,s,t)}ST(t.getGraph(),this._getNodeGlobalScale(t));var l=t.getData();o.updateData(l);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,i),clearTimeout(this._layoutTimeout);var u=t.forceLayout,c=t.get("force.layoutAnimation");u&&this._startForceLayoutIteration(u,c),l.eachItemGraphicEl(function(e,n){var o=l.getItemModel(n);e.off("drag").off("dragend");var a=l.getItemModel(n).get("draggable");a&&e.on("drag",function(){u&&(u.warmUp(),!this._layouting&&this._startForceLayoutIteration(u,c),u.setFixed(n),l.setItemLayout(n,e.position))},this).on("dragend",function(){u&&u.setUnfixed(n)},this),e.setDraggable(a&&u),e.off("mouseover",e.__focusNodeAdjacency),e.off("mouseout",e.__unfocusNodeAdjacency),o.get("focusNodeAdjacency")&&(e.on("mouseover",e.__focusNodeAdjacency=function(){i.dispatchAction({type:"focusNodeAdjacency",seriesId:t.id,dataIndex:e.dataIndex})}),e.on("mouseout",e.__unfocusNodeAdjacency=function(){i.dispatchAction({type:"unfocusNodeAdjacency",seriesId:t.id})}))},this),l.graph.eachEdge(function(e){var n=e.getGraphicEl();n.off("mouseover",n.__focusNodeAdjacency),n.off("mouseout",n.__unfocusNodeAdjacency),e.getModel().get("focusNodeAdjacency")&&(n.on("mouseover",n.__focusNodeAdjacency=function(){i.dispatchAction({type:"focusNodeAdjacency",seriesId:t.id,edgeDataIndex:e.dataIndex})}),n.on("mouseout",n.__unfocusNodeAdjacency=function(){i.dispatchAction({type:"unfocusNodeAdjacency",seriesId:t.id})}))});var d="circular"===t.get("layout")&&t.get("circular.rotateLabel"),f=l.getLayout("cx"),g=l.getLayout("cy");l.eachItemGraphicEl(function(t,e){var i=t.getSymbolPath();if(d){var n=l.getItemLayout(e),o=Math.atan2(n[1]-g,n[0]-f);o<0&&(o=2*Math.PI+o);var a=n[0]=o/3?1:2),l=e.y-n(r)*a*(a>=o/3?1:2);r=e.angle-Math.PI/2,t.moveTo(s,l),t.lineTo(e.x+i(r)*a,e.y+n(r)*a),t.lineTo(e.x+i(e.angle)*o,e.y+n(e.angle)*o),t.lineTo(e.x-i(r)*a,e.y-n(r)*a),t.lineTo(s,l)}}),CT=2*Math.PI,DT=(Ta.extend({type:"gauge",render:function(t,e,i){this.group.removeAll();var n=t.get("axisLine.lineStyle.color"),o=Nu(t,i);this._renderMain(t,e,i,n,o)},dispose:function(){},_renderMain:function(t,e,i,n,o){for(var a=this.group,r=t.getModel("axisLine").getModel("lineStyle"),s=t.get("clockwise"),l=-t.get("startAngle")/180*Math.PI,h=-t.get("endAngle")/180*Math.PI,u=(h-l)%CT,c=l,d=r.get("width"),f=0;f=t&&(0===e?0:n[e-1][0]).4?"bottom":"middle",textAlign:A<-.4?"left":A>.4?"right":"center"},{autoColor:P}),silent:!0}))}if(p.get("show")&&T!==v){for(var O=0;O<=y;O++){var A=Math.cos(b),C=Math.sin(b),z=new fb({shape:{x1:A*c+h,y1:C*c+u,x2:A*(c-_)+h,y2:C*(c-_)+u},silent:!0,style:I});"auto"===I.stroke&&z.setStyle({stroke:n((T+O/y)/v)}),l.add(z),b+=S}b-=S}else b+=w}},_renderPointer:function(t,e,i,n,o,a,r,s){var l=this.group,h=this._data;if(t.get("pointer.show")){var u=[+t.get("min"),+t.get("max")],c=[a,r],d=t.getData();d.diff(h).add(function(e){var i=new AT({shape:{angle:a}});So(i,{shape:{angle:wi(d.get("value",e),u,c,!0)}},t),l.add(i),d.setItemGraphicEl(e,i)}).update(function(e,i){var n=h.getItemGraphicEl(i);wo(n,{shape:{angle:wi(d.get("value",e),u,c,!0)}},t),l.add(n),d.setItemGraphicEl(e,n)}).remove(function(t){var e=h.getItemGraphicEl(t);l.remove(e)}).execute(),d.eachItemGraphicEl(function(t,e){var i=d.getItemModel(e),a=i.getModel("pointer");t.setShape({x:o.cx,y:o.cy,width:Si(a.get("width"),o.r),r:Si(a.get("length"),o.r)}),t.useStyle(i.getModel("itemStyle.normal").getItemStyle()),"auto"===t.style.fill&&t.setStyle("fill",n(wi(d.get("value",e),u,[0,1],!0))),uo(t,i.getModel("itemStyle.emphasis").getItemStyle())}),this._data=d}else h&&h.eachItemGraphicEl(function(t){l.remove(t)})},_renderTitle:function(t,e,i,n,o){var a=t.getModel("title");if(a.get("show")){var r=a.get("offsetCenter"),s=o.cx+Si(r[0],o.r),l=o.cy+Si(r[1],o.r),h=+t.get("min"),u=+t.get("max"),c=n(wi(t.getData().get("value",0),[h,u],[0,1],!0));this.group.add(new ib({silent:!0,style:fo({},a,{x:s,y:l,text:t.getData().getName(0),textAlign:"center",textVerticalAlign:"middle"},{autoColor:c,forceRich:!0})}))}},_renderDetail:function(t,e,i,n,o){var a=t.getModel("detail"),r=+t.get("min"),s=+t.get("max");if(a.get("show")){var l=a.get("offsetCenter"),h=o.cx+Si(l[0],o.r),u=o.cy+Si(l[1],o.r),c=Si(a.get("width"),o.r),d=Si(a.get("height"),o.r),f=t.getData().get("value",0),g=n(wi(f,[r,s],[0,1],!0));this.group.add(new ib({silent:!0,style:fo({},a,{x:h,y:u,text:Eu(f,a.get("formatter")),textWidth:isNaN(c)?null:c,textHeight:isNaN(d)?null:d,textAlign:"center",textVerticalAlign:"middle"},{autoColor:g,forceRich:!0})}))}}}),hr({type:"series.funnel",init:function(t){DT.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()},this._defaultLabelLine(t)},getInitialData:function(t,e){var i=xr(["value"],t.data),n=new aS(i,this);return n.initData(t.data),n},_defaultLabelLine:function(t){zo(t.labelLine,["show"]);var e=t.labelLine.normal,i=t.labelLine.emphasis;e.show=e.show&&t.label.normal.show,i.show=i.show&&t.label.emphasis.show},getDataParams:function(t){var e=this.getData(),i=DT.superCall(this,"getDataParams",t),n=e.getSum("value");return i.percent=n?+(e.get("value",t)/n*100).toFixed(2):0,i.$vars.push("percent"),i},defaultOption:{zlevel:0,z:2,legendHoverLink:!0,left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",gap:0,funnelAlign:"center",label:{normal:{show:!0,position:"outer"},emphasis:{show:!0}},labelLine:{normal:{show:!0,length:20,lineStyle:{width:1,type:"solid"}},emphasis:{}},itemStyle:{normal:{borderColor:"#fff",borderWidth:1},emphasis:{}}}})),LT=Ru.prototype,kT=["itemStyle","normal","opacity"];LT.updateData=function(t,e,i){var n=this.childAt(0),o=t.hostModel,a=t.getItemModel(e),s=t.getItemLayout(e),l=t.getItemModel(e).get(kT);l=null==l?1:l,n.useStyle({}),i?(n.setShape({points:s.points}),n.setStyle({opacity:0}),So(n,{style:{opacity:l}},o,e)):wo(n,{style:{opacity:l},shape:{points:s.points}},o,e);var h=a.getModel("itemStyle"),u=t.getItemVisual(e,"color");n.setStyle(r({lineJoin:"round",fill:u},h.getModel("normal").getItemStyle(["opacity"]))),n.hoverStyle=h.getModel("emphasis").getItemStyle(),this._updateLabel(t,e),uo(this)},LT._updateLabel=function(t,e){var i=this.childAt(1),n=this.childAt(2),o=t.hostModel,a=t.getItemModel(e),r=t.getItemLayout(e).label,s=t.getItemVisual(e,"color");wo(i,{shape:{points:r.linePoints||r.linePoints}},o,e),wo(n,{style:{x:r.x,y:r.y}},o,e),n.attr({rotation:r.rotation,origin:[r.x,r.y],z2:10});var l=a.getModel("label.normal"),h=a.getModel("label.emphasis"),u=a.getModel("labelLine.normal"),c=a.getModel("labelLine.emphasis"),s=t.getItemVisual(e,"color");co(n.style,n.hoverStyle={},l,h,{labelFetcher:t.hostModel,labelDataIndex:e,defaultText:t.getName(e),autoColor:s,useInsideStyle:!!r.inside},{textAlign:r.textAlign,textVerticalAlign:r.verticalAlign}),n.ignore=n.normalIgnore=!l.get("show"),n.hoverIgnore=!h.get("show"),i.ignore=i.normalIgnore=!u.get("show"),i.hoverIgnore=!c.get("show"),i.setStyle({stroke:s}),i.setStyle(u.getModel("lineStyle").getLineStyle()),i.hoverStyle=c.getModel("lineStyle").getLineStyle()},h(Ru,jy);Ta.extend({type:"funnel",render:function(t,e,i){var n=t.getData(),o=this._data,a=this.group;n.diff(o).add(function(t){var e=new Ru(n,t);n.setItemGraphicEl(t,e),a.add(e)}).update(function(t,e){var i=o.getItemGraphicEl(e);i.updateData(n,t),a.add(i),n.setItemGraphicEl(t,i)}).remove(function(t){var e=o.getItemGraphicEl(t);a.remove(e)}).execute(),this._data=n},remove:function(){this.group.removeAll(),this._data=null},dispose:function(){}});ar(v(tI,"funnel")),or(function(t,e,i){t.eachSeriesByType("funnel",function(t){var i=t.getData(),n=t.get("sort"),o=Vu(t,e),a=Bu(i,n),r=[Si(t.get("minSize"),o.width),Si(t.get("maxSize"),o.width)],s=i.getDataExtent("value"),l=t.get("min"),h=t.get("max");null==l&&(l=Math.min(s[0],0)),null==h&&(h=s[1]);var u=t.get("funnelAlign"),c=t.get("gap"),d=(o.height-c*(i.count()-1))/i.count(),f=o.y,g=function(t,e){var n,a=wi(i.get("value",t)||0,[l,h],r,!0);switch(u){case"left":n=o.x;break;case"center":n=o.x+(o.width-a)/2;break;case"right":n=o.x+o.width-a}return[[n,e],[n+a,e]]};"ascending"===n&&(d=-d,c=-c,f+=o.height,a=a.reverse());for(var p=0;pa&&(e[1-n]=e[n]+u.sign*a),e},zT=d,NT=Math.min,ET=Math.max,RT=Math.floor,VT=Math.ceil,BT=Mi,GT=Math.PI;Uu.prototype={type:"parallel",constructor:Uu,_init:function(t,e,i){var n=t.dimensions,o=t.parallelAxisIndex;zT(n,function(t,i){var n=o[i],a=e.getComponent("parallelAxis",n),r=this._axesMap.set(t,new PT(t,Er(a),[0,0],a.get("type"),n)),s="category"===r.type;r.onBand=s&&a.get("boundaryGap"),r.inverse=a.get("inverse"),a.axis=r,r.model=a,r.coordinateSystem=a.coordinateSystem=this},this)},update:function(t,e){this._updateAxesFromSeries(this._model,t)},containPoint:function(t){var e=this._makeLayoutInfo(),i=e.axisBase,n=e.layoutBase,o=e.pixelDimIndex,a=t[1-o],r=t[o];return a>=i&&a<=i+e.axisLength&&r>=n&&r<=n+e.layoutLength},getModel:function(){return this._model},_updateAxesFromSeries:function(t,e){e.eachSeries(function(i){if(t.contains(i,e)){var n=i.getData();zT(this.dimensions,function(t){var e=this._axesMap.get(t);e.scale.unionExtentFromData(n,t),Nr(e.scale,e.model)},this)}},this)},resize:function(t,e){this._rect=Ko(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()}),this._layoutAxes()},getRect:function(){return this._rect},_makeLayoutInfo:function(){var t,e=this._model,i=this._rect,n=["x","y"],o=["width","height"],a=e.get("layout"),r="horizontal"===a?0:1,s=i[o[r]],l=[0,s],h=this.dimensions.length,u=Xu(e.get("axisExpandWidth"),l),c=Xu(e.get("axisExpandCount")||0,[0,h]),d=e.get("axisExpandable")&&h>3&&h>c&&c>1&&u>0&&s>0,f=e.get("axisExpandWindow");f?(t=Xu(f[1]-f[0],l),f[1]=f[0]+t):(t=Xu(u*(c-1),l),(f=[u*(e.get("axisExpandCenter")||RT(h/2))-t/2])[1]=f[0]+t);var g=(s-t)/(h-c);g<3&&(g=0);var p=[RT(BT(f[0]/u,1))+1,VT(BT(f[1]/u,1))-1],m=g/u*f[0];return{layout:a,pixelDimIndex:r,layoutBase:i[n[r]],layoutLength:s,axisBase:i[n[1-r]],axisLength:i[o[1-r]],axisExpandable:d,axisExpandWidth:u,axisCollapseWidth:g,axisExpandWindow:f,axisCount:h,winInnerIndices:p,axisExpandWindow0Pos:m}},_layoutAxes:function(){var t=this._rect,e=this._axesMap,i=this.dimensions,n=this._makeLayoutInfo(),o=n.layout;e.each(function(t){var e=[0,n.axisLength],i=t.inverse?1:0;t.setExtent(e[i],e[1-i])}),zT(i,function(i,a){var r=(n.axisExpandable?qu:ju)(a,n),s={horizontal:{x:r.position,y:n.axisLength},vertical:{x:0,y:r.position}},l={horizontal:GT/2,vertical:0},h=[s[o].x+t.x,s[o].y+t.y],u=l[o],c=ot();ht(c,c,u),lt(c,c,h),this._axesLayout[i]={position:h,rotation:u,transform:c,axisNameAvailableWidth:r.axisNameAvailableWidth,axisLabelShow:r.axisLabelShow,nameTruncateMaxWidth:r.nameTruncateMaxWidth,tickDirection:1,labelDirection:1,labelInterval:e.get(i).getLabelInterval()}},this)},getAxis:function(t){return this._axesMap.get(t)},dataToPoint:function(t,e){return this.axisCoordToPoint(this._axesMap.get(e).dataToCoord(t),e)},eachActiveState:function(t,e,i){for(var n=this.dimensions,o=this._axesMap,a=this.hasAxisBrushed(),r=0,s=t.count();ro*(1-u[0])?(l="jump",r=s-o*(1-u[2])):(r=s-o*u[1])>=0&&(r=s-o*(1-u[1]))<=0&&(r=0),(r*=e.axisExpandWidth/h)?OT(r,n,a,"all"):l="none";else{o=n[1]-n[0];(n=[ET(0,a[1]*s/o-o/2)])[1]=NT(a[1],n[0]+o),n[0]=n[1]-o}return{axisExpandWindow:n,behavior:l}}},ua.register("parallel",{create:function(t,e){var i=[];return t.eachComponent("parallel",function(n,o){var a=new Uu(n,t,e);a.name="parallel_"+o,a.resize(n,e),n.coordinateSystem=a,a.model=n,i.push(a)}),t.eachSeries(function(e){if("parallel"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"parallel",index:e.get("parallelIndex"),id:e.get("parallelId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}});var WT=Ub.extend({type:"baseParallelAxis",axis:null,activeIntervals:[],getAreaSelectStyle:function(){return $x([["fill","color"],["lineWidth","borderWidth"],["stroke","borderColor"],["width","width"],["opacity","opacity"]])(this.getModel("areaSelectStyle"))},setActiveIntervals:function(t){var e=this.activeIntervals=i(t);if(e)for(var n=e.length-1;n>=0;n--)Ii(e[n])},getActiveState:function(t){var e=this.activeIntervals;if(!e.length)return"normal";if(null==t)return"inactive";for(var i=0,n=e.length;i5)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]);"none"!==n.behavior&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(t){if(!this._mouseDownPoint&&Rc(this,"mousemove")){var e=this._model,i=e.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]),n=i.behavior;"jump"===n&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===n?null:{axisExpandWindow:i.axisExpandWindow,animation:"jump"===n&&null})}}};tr(function(t){Wu(t),Hu(t)}),yw.extend({type:"series.parallel",dependencies:["parallel"],visualColorAccessPath:"lineStyle.normal.color",getInitialData:function(t,e){var i=e.getComponent("parallel",this.get("parallelIndex")),n=i.parallelAxisIndex,o=t.data,a=i.dimensions,r=f(Gc(a,o),function(t,i){var r=l(a,t),s=r>=0&&e.getComponent("parallelAxis",n[r]);return s&&"category"===s.get("type")?(Vc(s,t,o),{name:t,type:"ordinal"}):r<0&&xr.guessOrdinal(o,i)?{name:t,type:"ordinal"}:t}),s=new aS(r,this);return s.initData(o),this.option.progressive&&(this.option.animation=!1),s},getRawIndicesByActiveState:function(t){var e=this.coordinateSystem,i=this.getData(),n=[];return e.eachActiveState(i,function(e,o){t===e&&n.push(i.getRawIndex(o))}),n},defaultOption:{zlevel:0,z:2,coordinateSystem:"parallel",parallelIndex:0,label:{normal:{show:!1},emphasis:{show:!1}},inactiveOpacity:.05,activeOpacity:1,lineStyle:{normal:{width:1,opacity:.45,type:"solid"}},progressive:!1,smooth:!1,animationEasing:"linear"}});Ta.extend({type:"parallel",init:function(){this._dataGroup=new jy,this.group.add(this._dataGroup),this._data},render:function(t,e,i,n){this._renderForNormal(t,n)},dispose:function(){},_renderForNormal:function(t,e){var i=this._dataGroup,n=t.getData(),o=this._data,a=t.coordinateSystem,r=a.dimensions,s=t.option.smooth?.3:null;if(n.diff(o).add(function(t){Fc(n,i,t,r,a)}).update(function(i,s){var l=o.getItemGraphicEl(s),h=Hc(n,i,r,a);n.setItemGraphicEl(i,l),wo(l,{shape:{points:h}},e&&!1===e.animation?null:t,i)}).remove(function(t){var e=o.getItemGraphicEl(t);i.remove(e)}).execute(),Zc(n,s),!this._data){var l=Wc(a,t,function(){setTimeout(function(){i.removeClipPath()})});i.setClipPath(l)}this._data=n},remove:function(){this._dataGroup&&this._dataGroup.removeAll(),this._data=null}});var lA=["lineStyle","normal","opacity"];ar(function(t){t.eachSeriesByType("parallel",function(e){var i=e.getModel("itemStyle.normal"),n=e.getModel("lineStyle.normal"),o=t.get("color"),a=n.get("color")||i.get("color")||o[e.seriesIndex%o.length],r=e.get("inactiveOpacity"),s=e.get("activeOpacity"),l=e.getModel("lineStyle.normal").getLineStyle(),h=e.coordinateSystem,u=e.getData(),c={normal:l.opacity,active:s,inactive:r};h.eachActiveState(u,function(t,e){var i=u.getItemModel(e),n=c[t];if("normal"===t){var o=i.get(lA,!0);null!=o&&(n=o)}u.setItemVisual(e,"opacity",n)}),u.setVisual("color",a)})});var hA=yw.extend({type:"series.sankey",layoutInfo:null,getInitialData:function(t){var e=t.edges||t.links,i=t.data||t.nodes;if(i&&e)return hT(i,e,this,!0).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},formatTooltip:function(t,e,i){if("edge"===i){var n=this.getDataParams(t,i),o=n.data,a=o.source+" -- "+o.target;return n.value&&(a+=" : "+n.value),Gi(a)}return hA.superCall(this,"formatTooltip",t,e)},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",layout:null,left:"5%",top:"5%",right:"20%",bottom:"5%",nodeWidth:20,nodeGap:8,layoutIterations:32,label:{normal:{show:!0,position:"right",color:"#000",fontSize:12},emphasis:{show:!0}},itemStyle:{normal:{borderWidth:1,borderColor:"#333"}},lineStyle:{normal:{color:"#314656",opacity:.2,curveness:.5},emphasis:{opacity:.6}},animationEasing:"linear",animationDuration:1e3}}),uA=Zn({shape:{x1:0,y1:0,x2:0,y2:0,cpx1:0,cpy1:0,cpx2:0,cpy2:0,extent:0},buildPath:function(t,e){var i=e.extent/2;t.moveTo(e.x1,e.y1-i),t.bezierCurveTo(e.cpx1,e.cpy1-i,e.cpx2,e.cpy2-i,e.x2,e.y2-i),t.lineTo(e.x2,e.y2+i),t.bezierCurveTo(e.cpx2,e.cpy2+i,e.cpx1,e.cpy1+i,e.x1,e.y1+i),t.closePath()}});ur({type:"sankey",_model:null,render:function(t,e,i){var n=t.getGraph(),o=this.group,a=t.layoutInfo,r=t.getData(),s=t.getData("edge");this._model=t,o.removeAll(),o.attr("position",[a.x,a.y]),n.eachEdge(function(e){var i=new uA;i.dataIndex=e.dataIndex,i.seriesIndex=t.seriesIndex,i.dataType="edge";var n=e.getModel("lineStyle.normal"),a=n.get("curveness"),r=e.node1.getLayout(),l=e.node2.getLayout(),h=e.getLayout();i.shape.extent=Math.max(1,h.dy);var u=r.x+r.dx,c=r.y+h.sy+h.dy/2,d=l.x,f=l.y+h.ty+h.dy/2,g=u*(1-a)+d*a,p=c,m=u*a+d*(1-a),v=f;switch(i.setShape({x1:u,y1:c,x2:d,y2:f,cpx1:g,cpy1:p,cpx2:m,cpy2:v}),i.setStyle(n.getItemStyle()),i.style.fill){case"source":i.style.fill=e.node1.getVisual("color");break;case"target":i.style.fill=e.node2.getVisual("color")}uo(i,e.getModel("lineStyle.emphasis").getItemStyle()),o.add(i),s.setItemGraphicEl(e.dataIndex,i)}),n.eachNode(function(e){var i=e.getLayout(),n=e.getModel(),a=n.getModel("label.normal"),s=n.getModel("label.emphasis"),l=new db({shape:{x:i.x,y:i.y,width:e.getLayout().dx,height:e.getLayout().dy},style:n.getModel("itemStyle.normal").getItemStyle()}),h=e.getModel("itemStyle.emphasis").getItemStyle();co(l.style,h,a,s,{labelFetcher:t,labelDataIndex:e.dataIndex,defaultText:e.id,isRectText:!0}),l.setStyle("fill",e.getVisual("color")),uo(l,h),o.add(l),r.setItemGraphicEl(e.dataIndex,l),l.dataType="node"}),!this._data&&t.get("animation")&&o.setClipPath(Xc(o.getBoundingRect(),t,function(){o.removeClipPath()})),this._data=t.getData()},dispose:function(){}});or(function(t,e,i){t.eachSeriesByType("sankey",function(t){var i=t.get("nodeWidth"),n=t.get("nodeGap"),o=qc(t,e);t.layoutInfo=o;var a=o.width,r=o.height,s=t.getGraph(),l=s.nodes,h=s.edges;$c(l),Yc(l,h,i,n,a,r,0!==p(l,function(t){return 0===t.getLayout().value}).length?0:t.get("layoutIterations"))})}),ar(function(t,e){t.eachSeriesByType("sankey",function(t){var e=t.getGraph().nodes;e.sort(function(t,e){return t.getLayout().value-e.getLayout().value});var i=e[0].getLayout().value,n=e[e.length-1].getLayout().value;d(e,function(e){var o=new jI({type:"color",mappingMethod:"linear",dataExtent:[i,n],visual:t.get("color")}).mapValueToVisual(e.getLayout().value);e.setVisual("color",o);var a=e.getModel().get("itemStyle.normal.color");null!=a&&e.setVisual("color",a)})})});var cA=Nn.extend({type:"whiskerInBox",shape:{},buildPath:function(t,e){for(var i in e)if(e.hasOwnProperty(i)&&0===i.indexOf("ends")){var n=e[i];t.moveTo(n[0][0],n[0][1]),t.lineTo(n[1][0],n[1][1])}}}),dA=pd.prototype;dA._createContent=function(t,e,i){var n=t.getItemLayout(e),o="horizontal"===n.chartLayout?1:0,a=0;this.add(new ub({shape:{points:i?md(n.bodyEnds,o,n):n.bodyEnds},style:{strokeNoScale:!0},z2:100})),this.bodyIndex=a++;var r=f(n.whiskerEnds,function(t){return i?md(t,o,n):t});this.add(new cA({shape:vd(r),style:{strokeNoScale:!0},z2:100})),this.whiskerIndex=a++},dA.updateData=function(t,e,i){var n=this._seriesModel=t.hostModel,o=t.getItemLayout(e),a=Tb[i?"initProps":"updateProps"];a(this.childAt(this.bodyIndex),{shape:{points:o.bodyEnds}},n,e),a(this.childAt(this.whiskerIndex),{shape:vd(o.whiskerEnds)},n,e),this.styleUpdater.call(null,this,t,e)},h(pd,jy);var fA=yd.prototype;fA.updateData=function(t){var e=this.group,i=this._data,n=this.styleUpdater;t.diff(i).add(function(i){if(t.hasValue(i)){var o=new pd(t,i,n,!0);t.setItemGraphicEl(i,o),e.add(o)}}).update(function(o,a){var r=i.getItemGraphicEl(a);t.hasValue(o)?(r?r.updateData(t,o):r=new pd(t,o,n),e.add(r),t.setItemGraphicEl(o,r)):e.remove(r)}).remove(function(t){var n=i.getItemGraphicEl(t);n&&e.remove(n)}).execute(),this._data=t},fA.remove=function(){var t=this.group,e=this._data;this._data=null,e&&e.eachItemGraphicEl(function(e){e&&t.remove(e)})};var gA={_baseAxisDim:null,getInitialData:function(t,e){var i,n,o=e.getComponent("xAxis",this.get("xAxisIndex")),a=e.getComponent("yAxis",this.get("yAxisIndex")),r=o.get("type"),s=a.get("type");"category"===r?(t.layout="horizontal",i=o.getCategories(),n=!0):"category"===s?(t.layout="vertical",i=a.getCategories(),n=!0):t.layout=t.layout||"horizontal";var l=["x","y"],h="horizontal"===t.layout?0:1,u=this._baseAxisDim=l[h],c=l[1-h],f=t.data;n&&d(f,function(t,e){t.value&&y(t.value)?t.value.unshift(e):y(t)&&t.unshift(e)});var g=this.defaultValueDimensions,p=[{name:u,otherDims:{tooltip:!1},dimsDef:["base"]},{name:c,dimsDef:g.slice()}];p=xr(p,f,{encodeDef:this.get("encode"),dimsDef:this.get("dimensions"),dimCount:g.length+1});var m=new aS(p,this);return m.initData(f,i?i.slice():null),m},getBaseAxis:function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis}},pA={init:function(){var t=this._whiskerBoxDraw=new yd(this.getStyleUpdater());this.group.add(t.group)},render:function(t,e,i){this._whiskerBoxDraw.updateData(t.getData())},remove:function(t){this._whiskerBoxDraw.remove()}};u(yw.extend({type:"series.boxplot",dependencies:["xAxis","yAxis","grid"],defaultValueDimensions:["min","Q1","median","Q3","max"],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,boxWidth:[7,50],itemStyle:{normal:{color:"#fff",borderWidth:1},emphasis:{borderWidth:2,shadowBlur:5,shadowOffsetX:2,shadowOffsetY:2,shadowColor:"rgba(0,0,0,0.4)"}},animationEasing:"elasticOut",animationDuration:800}}),gA,!0),u(Ta.extend({type:"boxplot",getStyleUpdater:function(){return xd},dispose:N}),pA,!0);var mA=["itemStyle","normal"],vA=["itemStyle","emphasis"],yA=["itemStyle","normal","borderColor"],xA=d;ar(function(t,e){var i=t.get("color");t.eachRawSeriesByType("boxplot",function(e){var n=i[e.seriesIndex%i.length],o=e.getData();o.setVisual({legendSymbol:"roundRect",color:e.get(yA)||n}),t.isSeriesFiltered(e)||o.each(function(t){var e=o.getItemModel(t);o.setItemVisual(t,{color:e.get(yA,!0)})})})}),or(function(t){var e=_d(t);xA(e,function(t){var e=t.seriesModels;e.length&&(bd(t),xA(e,function(e,i){wd(e,t.boxOffsetList[i],t.boxWidthList[i])}))})}),u(yw.extend({type:"series.candlestick",dependencies:["xAxis","yAxis","grid"],defaultValueDimensions:["open","close","lowest","highest"],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,itemStyle:{normal:{color:"#c23531",color0:"#314656",borderWidth:1,borderColor:"#c23531",borderColor0:"#314656"},emphasis:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,animationUpdate:!1,animationEasing:"linear",animationDuration:300},getShadowDim:function(){return"open"},brushSelector:function(t,e,i){var n=e.getItemLayout(t);return i.rect(n.brushRect)}}),gA,!0),u(Ta.extend({type:"candlestick",getStyleUpdater:function(){return Sd},dispose:N}),pA,!0);var _A=["itemStyle","normal"],bA=["itemStyle","emphasis"],wA=["itemStyle","normal","borderColor"],SA=["itemStyle","normal","borderColor0"],MA=["itemStyle","normal","color"],IA=["itemStyle","normal","color0"],TA=T;tr(function(t){t&&y(t.series)&&d(t.series,function(t){b(t)&&"k"===t.type&&(t.type="candlestick")})}),ar(function(t,e){t.eachRawSeriesByType("candlestick",function(e){var i=e.getData();i.setVisual({legendSymbol:"roundRect"}),t.isSeriesFiltered(e)||i.each(function(t){var e=i.getItemModel(t),n=i.getItemLayout(t).sign;i.setItemVisual(t,{color:e.get(n>0?MA:IA),borderColor:e.get(n>0?wA:SA)})})})}),or(function(t){t.eachSeriesByType("candlestick",function(t){var e,i=t.coordinateSystem,n=t.getData(),o=Md(t,n),a=t.get("layout"),r="horizontal"===a?0:1,s=1-r,l=["x","y"],h=[];if(d(n.dimensions,function(t){var i=n.getDimensionInfo(t).coordDim;i===l[s]?h.push(t):i===l[r]&&(e=t)}),!(null==e||h.length<4)){var u=0;n.each([e].concat(h),function(){function t(t){var e=[];return e[r]=d,e[s]=t,isNaN(d)||isNaN(t)?[NaN,NaN]:i.dataToPoint(e)}function e(t,e){var i=t.slice(),n=t.slice();i[r]=Kn(i[r]+o/2,1,!1),n[r]=Kn(n[r]-o/2,1,!0),e?M.push(i,n):M.push(n,i)}function l(t){return t[r]=Kn(t[r],1),t}var c=arguments,d=c[0],f=c[h.length+1],g=c[1],p=c[2],m=c[3],v=c[4],y=Math.min(g,p),x=Math.max(g,p),_=t(y),b=t(x),w=t(m),S=[[l(t(v)),l(b)],[l(w),l(_)]],M=[];e(b,0),e(_,1);var I;I=g>p?-1:g0?n.getItemModel(u-1).get()[2]<=p?1:-1:1,n.setItemLayout(f,{chartLayout:a,sign:I,initBaseline:g>p?b[s]:_[s],bodyEnds:M,whiskerEnds:S,brushRect:function(){var e=t(Math.min(g,p,m,v)),i=t(Math.max(g,p,m,v));return e[r]-=o/2,i[r]-=o/2,{x:e[0],y:e[1],width:s?o:i[0]-e[0],height:s?i[1]-e[1]:o}}()}),++u},!0)}})}),yw.extend({type:"series.effectScatter",dependencies:["grid","polar"],getInitialData:function(t,e){return Sr(t.data,this,e)},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",rippleEffect:{period:4,scale:2.5,brushType:"fill"},symbolSize:10}});var AA=Ad.prototype;AA.stopEffectAnimation=function(){this.childAt(1).removeAll()},AA.startEffectAnimation=function(t){for(var e=t.symbolType,i=t.color,n=this.childAt(1),o=0;o<3;o++){var a=Hr(e,-1,-1,2,2,i);a.attr({style:{strokeNoScale:!0},z2:99,silent:!0,scale:[.5,.5]});var r=-o/3*t.period+t.effectOffset;a.animate("",!0).when(t.period,{scale:[t.rippleScale/2,t.rippleScale/2]}).delay(r).start(),a.animateStyle(!0).when(t.period,{opacity:0}).delay(r).start(),n.add(a)}Td(n,t)},AA.updateEffectAnimation=function(t){for(var e=this._effectCfg,i=this.childAt(1),n=["symbolType","period","rippleScale"],o=0;o "))},defaultOption:{coordinateSystem:"geo",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,label:{normal:{show:!1,position:"end"}},lineStyle:{normal:{opacity:.5}}}}),DA=Dd.prototype;DA.createLine=function(t,e,i){return new bu(t,e,i)},DA._updateEffectSymbol=function(t,e){var i=t.getItemModel(e).getModel("effect"),n=i.get("symbolSize"),o=i.get("symbol");y(n)||(n=[n,n]);var a=i.get("color")||t.getItemVisual(e,"color"),r=this.childAt(1);this._symbolType!==o&&(this.remove(r),(r=Hr(o,-.5,-.5,1,1,a)).z2=100,r.culling=!0,this.add(r)),r&&(r.setStyle("shadowColor",a),r.setStyle(i.getItemStyle(["color"])),r.attr("scale",n),r.setColor(a),r.attr("scale",n),this._symbolType=o,this._updateEffectAnimation(t,i,e))},DA._updateEffectAnimation=function(t,e,i){var n=this.childAt(1);if(n){var o=this,a=t.getItemLayout(i),r=1e3*e.get("period"),s=e.get("loop"),l=e.get("constantSpeed"),h=I(e.get("delay"),function(e){return e/t.count()*r/3}),u="function"==typeof h;if(n.ignore=!0,this.updateAnimationPoints(n,a),l>0&&(r=this.getLineLength(n)/l*1e3),r!==this._period||s!==this._loop){n.stopAnimation();var c=h;u&&(c=h(i)),n.__t>0&&(c=-r*n.__t),n.__t=0;var d=n.animate("",s).when(r,{__t:1}).delay(c).during(function(){o.updateSymbolPosition(n)});s||d.done(function(){o.remove(n)}),d.start()}this._period=r,this._loop=s}},DA.getLineLength=function(t){return hy(t.__p1,t.__cp1)+hy(t.__cp1,t.__p2)},DA.updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},DA.updateData=function(t,e,i){this.childAt(0).updateData(t,e,i),this._updateEffectSymbol(t,e)},DA.updateSymbolPosition=function(t){var e=t.__p1,i=t.__p2,n=t.__cp1,o=t.__t,a=t.position,r=un,s=cn;a[0]=r(e[0],n[0],i[0],o),a[1]=r(e[1],n[1],i[1],o);var l=s(e[0],n[0],i[0],o),h=s(e[1],n[1],i[1],o);t.rotation=-Math.atan2(h,l)-Math.PI/2,t.ignore=!1},DA.updateLayout=function(t,e){this.childAt(0).updateLayout(t,e);var i=t.getItemModel(e).getModel("effect");this._updateEffectAnimation(t,i,e)},h(Dd,jy);var LA=Ld.prototype;LA._createPolyline=function(t,e,i){var n=t.getItemLayout(e),o=new cb({shape:{points:n}});this.add(o),this._updateCommonStl(t,e,i)},LA.updateData=function(t,e,i){var n=t.hostModel;wo(this.childAt(0),{shape:{points:t.getItemLayout(e)}},n,e),this._updateCommonStl(t,e,i)},LA._updateCommonStl=function(t,e,i){var n=this.childAt(0),o=t.getItemModel(e),a=t.getItemVisual(e,"color"),s=i&&i.lineStyle,l=i&&i.hoverLineStyle;i&&!t.hasItemOption||(s=o.getModel("lineStyle.normal").getLineStyle(),l=o.getModel("lineStyle.emphasis").getLineStyle()),n.useStyle(r({strokeNoScale:!0,fill:"none",stroke:a},s)),n.hoverStyle=l,uo(this)},LA.updateLayout=function(t,e){this.childAt(0).setShape("points",t.getItemLayout(e))},h(Ld,jy);var kA=kd.prototype;kA.createLine=function(t,e,i){return new Ld(t,e,i)},kA.updateAnimationPoints=function(t,e){this._points=e;for(var i=[0],n=0,o=1;o=0&&!(n[r]<=e);r--);r=Math.min(r,o-2)}else{for(var r=a;re);r++);r=Math.min(r-1,o-2)}Y(t.position,i[r],i[r+1],(e-n[r])/(n[r+1]-n[r]));var s=i[r+1][0]-i[r][0],l=i[r+1][1]-i[r][1];t.rotation=-Math.atan2(l,s)-Math.PI/2,this._lastFrame=r,this._lastFramePercent=e,t.ignore=!1}},h(kd,Dd);var PA=Zn({shape:{polyline:!1,segs:[]},buildPath:function(t,e){for(var i=e.segs,n=e.polyline,o=0;o2?t.quadraticCurveTo(a[2][0],a[2][1],a[1][0],a[1][1]):t.lineTo(a[1][0],a[1][1])}},findDataIndex:function(t,e){for(var i=this.shape,n=i.segs,o=i.polyline,a=Math.max(this.style.lineWidth,1),r=0;r2){if(Sn(s[0][0],s[0][1],s[2][0],s[2][1],s[1][0],s[1][1],a,t,e))return r}else if(bn(s[0][0],s[0][1],s[1][0],s[1][1],a,t,e))return r}return-1}}),OA=Pd.prototype;OA.updateData=function(t){this.group.removeAll();var e=this._lineEl,i=t.hostModel;e.setShape({segs:t.mapArray(t.getItemLayout),polyline:i.get("polyline")}),e.useStyle(i.getModel("lineStyle.normal").getLineStyle());var n=t.getVisual("color");n&&e.setStyle("stroke",n),e.setStyle("fill"),e.seriesIndex=i.seriesIndex,e.on("mousemove",function(t){e.dataIndex=null;var i=e.findDataIndex(t.offsetX,t.offsetY);i>0&&(e.dataIndex=i)}),this.group.add(e)},OA.updateLayout=function(t){var e=t.getData();this._lineEl.setShape({segs:e.mapArray(e.getItemLayout)})},OA.remove=function(){this.group.removeAll()},ur({type:"lines",init:function(){},render:function(t,e,i){var n=t.getData(),o=this._lineDraw,a=t.get("effect.show"),r=t.get("polyline"),s=t.get("large")&&n.count()>=t.get("largeThreshold");a===this._hasEffet&&r===this._isPolyline&&s===this._isLarge||(o&&o.remove(),o=this._lineDraw=s?new Pd:new Mu(r?a?kd:Ld:a?Dd:bu),this._hasEffet=a,this._isPolyline=r,this._isLarge=s);var l=t.get("zlevel"),h=t.get("effect.trailLength"),u=i.getZr(),c="svg"===u.painter.getType();c||u.painter.getLayer(l).clear(!0),null==this._lastZlevel||c||u.configLayer(this._lastZlevel,{motionBlur:!1}),a&&h&&(c||u.configLayer(l,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(h/10+.9,1),0)})),this.group.add(o.group),o.updateData(n),this._lastZlevel=l},updateLayout:function(t,e,i){this._lineDraw.updateLayout(t);var n=i.getZr();"svg"===n.painter.getType()||n.painter.getLayer(this._lastZlevel).clear(!0)},remove:function(t,e){this._lineDraw&&this._lineDraw.remove(e,!0);var i=e.getZr();"svg"===i.painter.getType()||i.painter.getLayer(this._lastZlevel).clear(!0)},dispose:function(){}});or(function(t){t.eachSeriesByType("lines",function(t){var e=t.coordinateSystem,i=t.getData();i.each(function(n){var o=i.getItemModel(n),a=o.option instanceof Array?o.option:o.get("coords"),r=[];if(t.get("polyline"))for(var s=0;s0){var I=a(v)?s:l;v>0&&(v=v*S+w),x[_++]=I[M],x[_++]=I[M+1],x[_++]=I[M+2],x[_++]=I[M+3]*v*256}else _+=4}return c.putImageData(y,0,0),u},_getBrush:function(){var t=this._brushCanvas||(this._brushCanvas=iy()),e=this.pointSize+this.blurSize,i=2*e;t.width=i,t.height=i;var n=t.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-e,e,this.pointSize,0,2*Math.PI,!0),n.closePath(),n.fill(),t},_getGradient:function(t,e,i){for(var n=this._gradientPixels,o=n[i]||(n[i]=new Uint8ClampedArray(1024)),a=[0,0,0,0],r=0,s=0;s<256;s++)e[i](s/255,!0,a),o[r++]=a[0],o[r++]=a[1],o[r++]=a[2],o[r++]=a[3];return o}},ur({type:"heatmap",render:function(t,e,i){var n;e.eachComponent("visualMap",function(e){e.eachTargetSeries(function(i){i===t&&(n=e)})}),this.group.removeAll();var o=t.coordinateSystem;"cartesian2d"===o.type||"calendar"===o.type?this._renderOnCartesianAndCalendar(o,t,i):Rd(o)&&this._renderOnGeo(o,t,n,i)},dispose:function(){},_renderOnCartesianAndCalendar:function(t,e,i){if("cartesian2d"===t.type)var n=t.getAxis("x"),o=t.getAxis("y"),r=n.getBandWidth(),s=o.getBandWidth();var l=this.group,h=e.getData(),u=e.getModel("itemStyle.normal").getItemStyle(["color"]),c=e.getModel("itemStyle.emphasis").getItemStyle(),d=e.getModel("label.normal"),f=e.getModel("label.emphasis"),g=t.type,p="cartesian2d"===g?[e.coordDimToDataDim("x")[0],e.coordDimToDataDim("y")[0],e.coordDimToDataDim("value")[0]]:[e.coordDimToDataDim("time")[0],e.coordDimToDataDim("value")[0]];h.each(function(i){var n;if("cartesian2d"===g){if(isNaN(h.get(p[2],i)))return;var o=t.dataToPoint([h.get(p[0],i),h.get(p[1],i)]);n=new db({shape:{x:o[0]-r/2,y:o[1]-s/2,width:r,height:s},style:{fill:h.getItemVisual(i,"color"),opacity:h.getItemVisual(i,"opacity")}})}else{if(isNaN(h.get(p[1],i)))return;n=new db({z2:1,shape:t.dataToRect([h.get(p[0],i)]).contentShape,style:{fill:h.getItemVisual(i,"color"),opacity:h.getItemVisual(i,"opacity")}})}var m=h.getItemModel(i);h.hasItemOption&&(u=m.getModel("itemStyle.normal").getItemStyle(["color"]),c=m.getModel("itemStyle.emphasis").getItemStyle(),d=m.getModel("label.normal"),f=m.getModel("label.emphasis"));var v=e.getRawValue(i),y="-";v&&null!=v[2]&&(y=v[2]),co(u,c,d,f,{labelFetcher:e,labelDataIndex:i,defaultText:y,isRectText:!0}),n.setStyle(u),uo(n,h.hasItemOption?c:a({},c)),l.add(n),h.setItemGraphicEl(i,n)})},_renderOnGeo:function(t,e,i,n){var o=i.targetVisuals.inRange,a=i.targetVisuals.outOfRange,r=e.getData(),s=this._hmLayer||this._hmLayer||new zd;s.blurSize=e.get("blurSize"),s.pointSize=e.get("pointSize"),s.minOpacity=e.get("minOpacity"),s.maxOpacity=e.get("maxOpacity");var l=t.getViewRect().clone(),h=t.getRoamTransform().transform;l.applyTransform(h);var u=Math.max(l.x,0),c=Math.max(l.y,0),d=Math.min(l.width+l.x,n.getWidth()),f=Math.min(l.height+l.y,n.getHeight()),g=d-u,p=f-c,m=r.mapArray(["lng","lat","value"],function(e,i,n){var o=t.dataToPoint([e,i]);return o[0]-=u,o[1]-=c,o.push(n),o}),v=i.getExtent(),y="visualMap.continuous"===i.type?Ed(v,i.option.range):Nd(v,i.getPieceList(),i.option.selected);s.update(m,g,p,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:a.color.getColorMapper()},y);var x=new qe({style:{width:g,height:p,x:u,y:c,image:s.canvas},silent:!0});this.group.add(x)}});var zA=ZM.extend({type:"series.pictorialBar",dependencies:["grid"],defaultOption:{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",progressive:0,hoverAnimation:!1},getInitialData:function(t){return t.stack=null,zA.superApply(this,"getInitialData",arguments)}}),NA=["itemStyle","normal","borderWidth"],EA=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],RA=new nb;ur({type:"pictorialBar",render:function(t,e,i){var n=this.group,o=t.getData(),a=this._data,r=t.coordinateSystem,s=!!r.getBaseAxis().isHorizontal(),l=r.grid.getRect(),h={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:t,coordSys:r,coordSysExtent:[[l.x,l.x+l.width],[l.y,l.y+l.height]],isHorizontal:s,valueDim:EA[+s],categoryDim:EA[1-s]};return o.diff(a).add(function(t){if(o.hasValue(t)){var e=Yd(o,t),i=Vd(o,t,e,h),a=Qd(o,h,i);o.setItemGraphicEl(t,a),n.add(a),rf(a,h,i)}}).update(function(t,e){var i=a.getItemGraphicEl(e);if(o.hasValue(t)){var r=Yd(o,t),s=Vd(o,t,r,h),l=nf(o,s);i&&l!==i.__pictorialShapeStr&&(n.remove(i),o.setItemGraphicEl(t,null),i=null),i?tf(i,h,s):i=Qd(o,h,s,!0),o.setItemGraphicEl(t,i),i.__pictorialSymbolMeta=s,n.add(i),rf(i,h,s)}else n.remove(i)}).remove(function(t){var e=a.getItemGraphicEl(t);e&&ef(a,t,e.__pictorialSymbolMeta.animationModel,e)}).execute(),this._data=o,this.group},dispose:N,remove:function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl(function(e){ef(n,e.dataIndex,t,e)}):i.removeAll()}});or(v(nl,"pictorialBar")),ar(v(cM,"pictorialBar","roundRect",null));var VA=function(t,e,i,n,o){US.call(this,t,e,i),this.type=n||"value",this.position=o||"bottom",this.orient=null,this._labelInterval=null};VA.prototype={constructor:VA,model:null,isHorizontal:function(){var t=this.position;return"top"===t||"bottom"===t},pointToData:function(t,e){return this.coordinateSystem.pointToData(t,e)[0]},toGlobalCoord:null,toLocalCoord:null},h(VA,US),lf.prototype={type:"singleAxis",axisPointerEnabled:!0,constructor:lf,_init:function(t,e,i){var n=this.dimension,o=new VA(n,Er(t),[0,0],t.get("type"),t.get("position")),a="category"===o.type;o.onBand=a&&t.get("boundaryGap"),o.inverse=t.get("inverse"),o.orient=t.get("orient"),t.axis=o,o.model=t,o.coordinateSystem=this,this._axis=o},update:function(t,e){t.eachSeries(function(t){if(t.coordinateSystem===this){var e=t.getData(),i=this.dimension;this._axis.scale.unionExtentFromData(e,t.coordDimToDataDim(i)),Nr(this._axis.scale,this._axis.model)}},this)},resize:function(t,e){this._rect=Ko({left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")},{width:e.getWidth(),height:e.getHeight()}),this._adjustAxis()},getRect:function(){return this._rect},_adjustAxis:function(){var t=this._rect,e=this._axis,i=e.isHorizontal(),n=i?[0,t.width]:[0,t.height],o=e.reverse?1:0;e.setExtent(n[o],n[1-o]),this._updateAxisTransform(e,i?t.x:t.y)},_updateAxisTransform:function(t,e){var i=t.getExtent(),n=i[0]+i[1],o=t.isHorizontal();t.toGlobalCoord=o?function(t){return t+e}:function(t){return n-t+e},t.toLocalCoord=o?function(t){return t-e}:function(t){return n-t+e}},getAxis:function(){return this._axis},getBaseAxis:function(){return this._axis},getAxes:function(){return[this._axis]},getTooltipAxes:function(){return{baseAxes:[this.getAxis()]}},containPoint:function(t){var e=this.getRect(),i=this.getAxis();return"horizontal"===i.orient?i.contain(i.toLocalCoord(t[0]))&&t[1]>=e.y&&t[1]<=e.y+e.height:i.contain(i.toLocalCoord(t[1]))&&t[0]>=e.y&&t[0]<=e.y+e.height},pointToData:function(t){var e=this.getAxis();return[e.coordToData(e.toLocalCoord(t["horizontal"===e.orient?0:1]))]},dataToPoint:function(t){var e=this.getAxis(),i=this.getRect(),n=[],o="horizontal"===e.orient?0:1;return t instanceof Array&&(t=t[0]),n[o]=e.toGlobalCoord(e.dataToCoord(+t)),n[1-o]=0===o?i.y+i.height/2:i.x+i.width/2,n}},ua.register("single",{create:function(t,e){var i=[];return t.eachComponent("singleAxis",function(n,o){var a=new lf(n,t,e);a.name="single_"+o,a.resize(n,e),n.coordinateSystem=a,i.push(a)}),t.eachSeries(function(e){if("singleAxis"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"singleAxis",index:e.get("singleAxisIndex"),id:e.get("singleAxisId")})[0];e.coordinateSystem=i&&i.coordinateSystem}}),i},dimensions:lf.prototype.dimensions});var BA=DM.getInterval,GA=DM.ifIgnoreOnTick,WA=["axisLine","axisTickLabel","axisName"],HA=EM.extend({type:"singleAxis",axisPointerClass:"SingleAxisPointer",render:function(t,e,i,n){var o=this.group;o.removeAll();var a=hf(t),r=new DM(t,a);d(WA,r.add,r),o.add(r.getGroup()),t.get("splitLine.show")&&this._splitLine(t,a.labelInterval),HA.superCall(this,"render",t,e,i,n)},_splitLine:function(t,e){var i=t.axis;if(!i.scale.isBlank()){var n=t.getModel("splitLine"),o=n.getModel("lineStyle"),a=o.get("width"),r=o.get("color"),s=BA(n,e);r=r instanceof Array?r:[r];for(var l=t.coordinateSystem.getRect(),h=i.isHorizontal(),u=[],c=0,d=i.getTicksCoords(),f=[],g=[],p=t.get("axisLabel.showMinLabel"),m=t.get("axisLabel.showMaxLabel"),v=0;v=0)&&i({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},remove:function(t,e){Tf(e.getZr(),"axisPointer"),KA.superApply(this._model,"remove",arguments)},dispose:function(t,e){Tf("axisPointer",e),KA.superApply(this._model,"dispose",arguments)}}),JA=Eb(),QA=i,tC=m;(Af.prototype={_group:null,_lastGraphicKey:null,_handle:null,_dragging:!1,_lastValue:null,_lastStatus:null,_payloadInfo:null,animationThreshold:15,render:function(t,e,i,n){var o=e.get("value"),a=e.get("status");if(this._axisModel=t,this._axisPointerModel=e,this._api=i,n||this._lastValue!==o||this._lastStatus!==a){this._lastValue=o,this._lastStatus=a;var r=this._group,s=this._handle;if(!a||"hide"===a)return r&&r.hide(),void(s&&s.hide());r&&r.show(),s&&s.show();var l={};this.makeElOption(l,o,t,e,i);var h=l.graphicKey;h!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=h;var u=this._moveAnimation=this.determineAnimation(t,e);if(r){var c=v(Cf,e,u);this.updatePointerEl(r,l,c,e),this.updateLabelEl(r,l,c,e)}else r=this._group=new jy,this.createPointerEl(r,l,t,e),this.createLabelEl(r,l,t,e),i.getZr().add(r);Pf(r,e,!0),this._renderHandle(o)}},remove:function(t){this.clear(t)},dispose:function(t){this.clear(t)},determineAnimation:function(t,e){var i=e.get("animation"),n=t.axis,o="category"===n.type,a=e.get("snap");if(!a&&!o)return!1;if("auto"===i||null==i){var r=this.animationThreshold;if(o&&n.getBandWidth()>r)return!0;if(a){var s=Xs(t).seriesDataCount,l=n.getExtent();return Math.abs(l[0]-l[1])/s>r}return!1}return!0===i},makeElOption:function(t,e,i,n,o){},createPointerEl:function(t,e,i,n){var o=e.pointer;if(o){var a=JA(t).pointerEl=new Tb[o.type](QA(e.pointer));t.add(a)}},createLabelEl:function(t,e,i,n){if(e.label){var o=JA(t).labelEl=new db(QA(e.label));t.add(o),Lf(o,n)}},updatePointerEl:function(t,e,i){var n=JA(t).pointerEl;n&&(n.setStyle(e.pointer.style),i(n,{shape:e.pointer.shape}))},updateLabelEl:function(t,e,i,n){var o=JA(t).labelEl;o&&(o.setStyle(e.label.style),i(o,{shape:e.label.shape,position:e.label.position}),Lf(o,n))},_renderHandle:function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,i=this._api.getZr(),n=this._handle,o=e.getModel("handle"),a=e.get("status");if(!o.get("show")||!a||"hide"===a)return n&&i.remove(n),void(this._handle=null);var r;this._handle||(r=!0,n=this._handle=Do(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){bx(t.event)},onmousedown:tC(this._onHandleDragMove,this,0,0),drift:tC(this._onHandleDragMove,this),ondragend:tC(this._onHandleDragEnd,this)}),i.add(n)),Pf(n,e,!1);var s=["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];n.setStyle(o.getItemStyle(null,s));var l=o.get("size");y(l)||(l=[l,l]),n.attr("scale",[l[0]/2,l[1]/2]),La(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,r)}},_moveHandleToValue:function(t,e){Cf(this._axisPointerModel,!e&&this._moveAnimation,this._handle,kf(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},_onHandleDragMove:function(t,e){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(kf(i),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(kf(n)),JA(i).lastProp=null,this._doDispatchAxisPointer()}},_doDispatchAxisPointer:function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},_onHandleDragEnd:function(t){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},getHandleTransform:null,updateHandleTransform:null,clear:function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),i=this._group,n=this._handle;e&&i&&(this._lastGraphicKey=null,i&&e.remove(i),n&&e.remove(n),this._group=null,this._handle=null,this._payloadInfo=null)},doClear:function(){},buildLabel:function(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}}).constructor=Af,Ki(Af);var eC=Af.extend({makeElOption:function(t,e,i,n,o){var a=i.axis,r=a.grid,s=n.get("type"),l=Hf(r,a).getOtherAxis(a).getGlobalExtent(),h=a.toGlobalCoord(a.dataToCoord(e,!0));if(s&&"none"!==s){var u=Of(n),c=iC[s](a,h,l,u);c.style=u,t.graphicKey=c.type,t.pointer=c}Vf(e,t,Js(r.model,i),i,n,o)},getHandleTransform:function(t,e,i){var n=Js(e.axis.grid.model,e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:Rf(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,n){var o=i.axis,a=o.grid,r=o.getGlobalExtent(!0),s=Hf(a,o).getOtherAxis(o).getGlobalExtent(),l="x"===o.dim?0:1,h=t.position;h[l]+=e[l],h[l]=Math.min(r[1],h[l]),h[l]=Math.max(r[0],h[l]);var u=(s[1]+s[0])/2,c=[u,u];c[l]=h[l];var d=[{verticalAlign:"middle"},{align:"center"}];return{position:h,rotation:t.rotation,cursorPoint:c,tooltipOption:d[l]}}}),iC={line:function(t,e,i,n){var o=Bf([e,i[0]],[e,i[1]],Ff(t));return Yn({shape:o,style:n}),{type:"Line",shape:o}},shadow:function(t,e,i,n){var o=t.getBandWidth(),a=i[1]-i[0];return{type:"Rect",shape:Gf([e-o/2,i[0]],[o,a],Ff(t))}}};EM.registerAxisPointerClass("CartesianAxisPointer",eC),tr(function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!y(e)&&(t.axisPointer.link=[e])}}),er(Pw.PROCESSOR.STATISTIC,function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=Bs(t,e)}),ir({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},function(t,e,i){var n=t.currTrigger,o=[t.x,t.y],a=t,r=t.dispatchAction||m(i.dispatchAction,i),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){xf(o)&&(o=UA({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=xf(o),h=a.axesInfo,u=s.axesInfo,c="leave"===n||xf(o),d={},f={},g={list:[],map:{}},p={showPointer:jA(df,f),showTooltip:jA(ff,g)};XA(s.coordSysMap,function(t,e){var i=l||t.containPoint(o);XA(s.coordSysAxesInfo[e],function(t,e){var n=t.axis,a=vf(h,t);if(!c&&i&&(!h||a)){var r=a&&a.value;null!=r||l||(r=n.pointToData(o)),null!=r&&uf(t,r,p,!1,d)}})});var v={};return XA(u,function(t,e){var i=t.linkGroup;i&&!f[e]&&XA(i.axesInfo,function(e,n){var o=f[n];if(e!==t&&o){var a=o.value;i.mapper&&(a=t.axis.scale.parse(i.mapper(a,yf(e),yf(t)))),v[t.key]=a}})}),XA(v,function(t,e){uf(u[e],t,p,!0,d)}),gf(f,u,d),pf(g,o,t,r),mf(u,0,i),d}});var nC=["x","y"],oC=["width","height"],aC=Af.extend({makeElOption:function(t,e,i,n,o){var a=i.axis,r=a.coordinateSystem,s=Uf(r,1-Zf(a)),l=r.dataToPoint(e)[0],h=n.get("type");if(h&&"none"!==h){var u=Of(n),c=rC[h](a,l,s,u);c.style=u,t.graphicKey=c.type,t.pointer=c}Vf(e,t,hf(i),i,n,o)},getHandleTransform:function(t,e,i){var n=hf(e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:Rf(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,n){var o=i.axis,a=o.coordinateSystem,r=Zf(o),s=Uf(a,r),l=t.position;l[r]+=e[r],l[r]=Math.min(s[1],l[r]),l[r]=Math.max(s[0],l[r]);var h=Uf(a,1-r),u=(h[1]+h[0])/2,c=[u,u];return c[r]=l[r],{position:l,rotation:t.rotation,cursorPoint:c,tooltipOption:{verticalAlign:"middle"}}}}),rC={line:function(t,e,i,n){var o=Bf([e,i[0]],[e,i[1]],Zf(t));return Yn({shape:o,style:n}),{type:"Line",shape:o}},shadow:function(t,e,i,n){var o=t.getBandWidth(),a=i[1]-i[0];return{type:"Rect",shape:Gf([e-o/2,i[0]],[o,a],Zf(t))}}};EM.registerAxisPointerClass("SingleAxisPointer",aC),lr({type:"single"});var sC=yw.extend({type:"series.themeRiver",dependencies:["singleAxis"],nameMap:null,init:function(t){sC.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()}},fixData:function(t){for(var e=t.length,i=f(jc().key(function(t){return t[2]}).entries(t),function(t){return{name:t.key,dataList:t.values}}),n=i.length,o=-1,a=-1,r=0;ro&&(o=s,a=r)}for(var l=0;ln[1]&&n.reverse(),{coordSys:{type:"polar",cx:t.cx,cy:t.cy,r:n[1],r0:n[0]},api:{coord:m(function(n){var o=e.dataToRadius(n[0]),a=i.dataToAngle(n[1]),r=t.coordToPoint([o,a]);return r.push(o,a*Math.PI/180),r}),size:m(Jf,t)}}},calendar:function(t){var e=t.getRect(),i=t.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:t.getCellWidth(),cellHeight:t.getCellHeight(),rangeInfo:{start:i.start,end:i.end,weeks:i.weeks,dayCount:i.allDay}},api:{coord:m(t.dataToPoint,t)}}}};hr({type:"series.custom",dependencies:["grid","polar","geo","singleAxis","calendar"],defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0},getInitialData:function(t,e){return Sr(t.data,this,e)}}),ur({type:"custom",_data:null,render:function(t,e,i){var n=this._data,o=t.getData(),a=this.group,r=ig(t,o,e,i);o.diff(n).add(function(e){o.hasValue(e)&&og(null,e,r(e),t,a,o)}).update(function(e,i){var s=n.getItemGraphicEl(i);o.hasValue(e)?og(s,e,r(e),t,a,o):s&&a.remove(s)}).remove(function(t){var e=n.getItemGraphicEl(t);e&&a.remove(e)}).execute(),this._data=o},dispose:N}),tr(function(t){var e=t.graphic;y(e)?e[0]&&e[0].elements?t.graphic=[t.graphic[0]]:t.graphic=[{elements:e}]:e&&!e.elements&&(t.graphic=[{elements:[e]}])});var gC=sr({type:"graphic",defaultOption:{elements:[],parentId:null},_elOptionsToUpdate:null,mergeOption:function(t){var e=this.option.elements;this.option.elements=null,gC.superApply(this,"mergeOption",arguments),this.option.elements=e},optionUpdated:function(t,e){var i=this.option,n=(e?i:t).elements,o=i.elements=e?[]:i.elements,a=[];this._flatten(n,a);var r=Vo(o,a);Bo(r);var s=this._elOptionsToUpdate=[];d(r,function(t,e){var i=t.option;i&&(s.push(i),gg(t,i),pg(o,e,i),mg(o[e],i))},this);for(var l=o.length-1;l>=0;l--)null==o[l]?o.splice(l,1):delete o[l].$action},_flatten:function(t,e,i){d(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});lr({type:"graphic",init:function(t,e){this._elMap=z(),this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t,i),this._relocate(t,i)},_updateElements:function(t,e){var i=t.useElOptionsToUpdate();if(i){var n=this._elMap,o=this.group;d(i,function(t){var e=t.$action,i=t.id,a=n.get(i),r=t.parentId,s=null!=r?n.get(r):o;if("text"===t.type){var l=t.style;t.hv&&t.hv[1]&&(l.textVerticalAlign=l.textBaseline=null),!l.hasOwnProperty("textFill")&&l.fill&&(l.textFill=l.fill),!l.hasOwnProperty("textStroke")&&l.stroke&&(l.textStroke=l.stroke)}var h=dg(t);e&&"merge"!==e?"replace"===e?(cg(a,n),ug(i,s,h,n)):"remove"===e&&cg(a,n):a?a.attr(h):ug(i,s,h,n);var u=n.get(i);u&&(u.__ecGraphicWidth=t.width,u.__ecGraphicHeight=t.height)})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,o=this._elMap,a=i.length-1;a>=0;a--){var r=i[a],s=o.get(r.id);if(s){var l=s.parent;Jo(s,r,l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0},null,{hv:r.hv,boundingMode:r.bounding})}}},_clear:function(){var t=this._elMap;t.each(function(e){cg(e,t)}),this._elMap=z()},dispose:function(){this._clear()}});var pC=sr({type:"legend.plain",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){pC.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});ir("legendToggleSelect","legendselectchanged",v(vg,"toggleSelected")),ir("legendSelect","legendselected",v(vg,"select")),ir("legendUnSelect","legendunselected",v(vg,"unSelect"));var mC=v,vC=d,yC=jy,xC=lr({type:"legend.plain",newlineDisabled:!1,init:function(){this.group.add(this._contentGroup=new yC),this._backgroundEl},getContentGroup:function(){return this._contentGroup},render:function(t,e,i){if(this.resetInner(),t.get("show",!0)){var n=t.get("align");n&&"auto"!==n||(n="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left"),this.renderInner(n,t,e,i);var o=t.getBoxLayoutParams(),a={width:i.getWidth(),height:i.getHeight()},s=t.get("padding"),l=Ko(o,a,s),h=this.layoutInner(t,n,l),u=Ko(r({width:h.width,height:h.height},o),a,s);this.group.attr("position",[u.x-h.x,u.y-h.y]),this.group.add(this._backgroundEl=xg(h,t))}},resetInner:function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl)},renderInner:function(t,e,i,n){var o=this.getContentGroup(),a=z(),r=e.get("selectedMode");vC(e.getData(),function(s,l){var h=s.get("name");if(this.newlineDisabled||""!==h&&"\n"!==h){var u=i.getSeriesByName(h)[0];if(!a.get(h))if(u){var c=u.getData(),d=c.getVisual("color");"function"==typeof d&&(d=d(u.getDataParams(0)));var f=c.getVisual("legendSymbol")||"roundRect",g=c.getVisual("symbol");this._createItem(h,l,s,e,f,g,t,d,r).on("click",mC(_g,h,n)).on("mouseover",mC(bg,u,null,n)).on("mouseout",mC(wg,u,null,n)),a.set(h,!0)}else i.eachRawSeries(function(i){if(!a.get(h)&&i.legendDataProvider){var o=i.legendDataProvider(),u=o.indexOfName(h);if(u<0)return;var c=o.getItemVisual(u,"color");this._createItem(h,l,s,e,"roundRect",null,t,c,r).on("click",mC(_g,h,n)).on("mouseover",mC(bg,i,h,n)).on("mouseout",mC(wg,i,h,n)),a.set(h,!0)}},this)}else o.add(new yC({newline:!0}))},this)},_createItem:function(t,e,i,n,o,r,s,l,h){var u=n.get("itemWidth"),c=n.get("itemHeight"),d=n.get("inactiveColor"),f=n.isSelected(t),g=new yC,p=i.getModel("textStyle"),m=i.get("icon"),v=i.getModel("tooltip"),y=v.parentModel;if(o=m||o,g.add(Hr(o,0,0,u,c,f?l:d,!0)),!m&&r&&(r!==o||"none"==r)){var x=.8*c;"none"===r&&(r="circle"),g.add(Hr(r,(u-x)/2,(c-x)/2,x,x,f?l:d))}var _="left"===s?u+5:-5,b=s,w=n.get("formatter"),S=t;"string"==typeof w&&w?S=w.replace("{name}",null!=t?t:""):"function"==typeof w&&(S=w(t)),g.add(new ib({style:fo({},p,{text:S,x:_,y:c/2,textFill:f?p.getTextColor():d,textAlign:b,textVerticalAlign:"middle"})}));var M=new db({shape:g.getBoundingRect(),invisible:!0,tooltip:v.get("show")?a({content:t,formatter:y.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:n.componentIndex,name:t,$vars:["name"]}},v.option):null});return g.add(M),g.eachChild(function(t){t.silent=!0}),M.silent=!h,this.getContentGroup().add(g),uo(g),g.__legendDataIndex=e,g},layoutInner:function(t,e,i){var n=this.getContentGroup();Hb(t.get("orient"),n,t.get("itemGap"),i.width,i.height);var o=n.getBoundingRect();return n.attr("position",[-o.x,-o.y]),this.group.getBoundingRect()}});er(function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;ii[s],f=[-u.x,-u.y];f[r]=n.position[r];var g=[0,0],p=[-c.x,-c.y],m=T(t.get("pageButtonGap",!0),t.get("itemGap",!0));d&&("end"===t.get("pageButtonPosition",!0)?p[r]+=i[s]-c[s]:g[r]+=c[s]+m),p[1-r]+=u[l]/2-c[l]/2,n.attr("position",f),o.attr("position",g),a.attr("position",p);var v=this.group.getBoundingRect();if((v={x:0,y:0})[s]=d?i[s]:u[s],v[l]=Math.max(u[l],c[l]),v[h]=Math.min(0,c[h]+p[1-r]),o.__rectSize=i[s],d){var y={x:0,y:0};y[s]=Math.max(i[s]-c[s]-m,0),y[l]=v[l],o.setClipPath(new db({shape:y})),o.__rectSize=y[s]}else a.eachChild(function(t){t.attr({invisible:!0,silent:!0})});var x=this._getPageInfo(t);return null!=x.pageIndex&&wo(n,{position:x.contentPosition},!!d&&t),this._updatePageInfoView(t,x),v},_pageGo:function(t,e,i){var n=this._getPageInfo(e)[t];null!=n&&i.dispatchAction({type:"legendScroll",scrollDataIndex:n,legendId:e.id})},_updatePageInfoView:function(t,e){var i=this._controllerGroup;d(["pagePrev","pageNext"],function(n){var o=null!=e[n+"DataIndex"],a=i.childOfName(n);a&&(a.setStyle("fill",o?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),a.cursor=o?"pointer":"default")});var n=i.childOfName("pageText"),o=t.get("pageFormatter"),a=e.pageIndex,r=null!=a?a+1:0,s=e.pageCount;n&&o&&n.setStyle("text",_(o)?o.replace("{current}",r).replace("{total}",s):o({current:r,total:s}))},_getPageInfo:function(t){function e(t){var e=t.getBoundingRect().clone();return e[f]+=t.position[u],e}var i,n,o,a,r=t.get("scrollDataIndex",!0),s=this.getContentGroup(),l=s.getBoundingRect(),h=this._containerGroup.__rectSize,u=t.getOrient().index,c=wC[u],d=wC[1-u],f=SC[u],g=s.position.slice();this._showController?s.eachChild(function(t){t.__legendDataIndex===r&&(a=t)}):a=s.childAt(0);var p=h?Math.ceil(l[c]/h):0;if(a){var m=a.getBoundingRect(),v=a.position[u]+m[f];g[u]=-v-l[f],i=Math.floor(p*(v+m[f]+h/2)/l[c]),i=l[c]&&p?Math.max(0,Math.min(p-1,i)):-1;var y={x:0,y:0};y[c]=h,y[d]=l[d],y[f]=-g[u]-l[f];var x,_=s.children();if(s.eachChild(function(t,i){var n=e(t);n.intersect(y)&&(null==x&&(x=i),o=t.__legendDataIndex),i===_.length-1&&n[f]+n[c]<=y[f]+y[c]&&(o=null)}),null!=x){var b=e(_[x]);if(y[f]=b[f]+b[c]-y[c],x<=0&&b[f]>=y[f])n=null;else{for(;x>0&&e(_[x-1]).intersect(y);)x--;n=_[x].__legendDataIndex}}}return{contentPosition:g,pageIndex:i,pageCount:p,pagePrevDataIndex:n,pageNextDataIndex:o}}});ir("legendScroll","legendscroll",function(t,e){var i=t.scrollDataIndex;null!=i&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},function(t){t.setScrollDataIndex(i)})}),sr({type:"tooltip",dependencies:["axisPointer"],defaultOption:{zlevel:0,z:8,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",confine:!1,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"rgba(50,50,50,0.7)",borderColor:"#333",borderRadius:4,borderWidth:0,padding:5,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#fff",fontSize:14}}});var IC=d,TC=Bi,AC=["","-webkit-","-moz-","-o-"];Ag.prototype={constructor:Ag,_enterable:!0,update:function(){var t=this._container,e=t.currentStyle||document.defaultView.getComputedStyle(t),i=t.style;"absolute"!==i.position&&"absolute"!==e.position&&(i.position="relative")},show:function(t){clearTimeout(this._hideTimeout);var e=this.el;e.style.cssText="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+Tg(t)+";left:"+this._x+"px;top:"+this._y+"px;"+(t.get("extraCssText")||""),e.style.display=e.innerHTML?"block":"none",this._show=!0},setContent:function(t){this.el.innerHTML=null==t?"":t},setEnterable:function(t){this._enterable=t},getSize:function(){var t=this.el;return[t.clientWidth,t.clientHeight]},moveTo:function(t,e){var i,n=this._zr;n&&n.painter&&(i=n.painter.getViewportRootOffset())&&(t+=i.offsetLeft,e+=i.offsetTop);var o=this.el.style;o.left=t+"px",o.top=e+"px",this._x=t,this._y=e},hide:function(){this.el.style.display="none",this._show=!1},hideLater:function(t){!this._show||this._inContent&&this._enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(m(this.hide,this),t)):this.hide())},isShow:function(){return this._show}};var CC=m,DC=d,LC=Si,kC=new db({shape:{x:-1,y:-1,width:2,height:2}});lr({type:"tooltip",init:function(t,e){if(!Uv.node){var i=new Ag(e.getDom(),e);this._tooltipContent=i}},render:function(t,e,i){if(!Uv.node){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastDataByCoordSys=null,this._alwaysShowContent=t.get("alwaysShowContent");var n=this._tooltipContent;n.update(),n.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow()}},_initGlobalListener:function(){var t=this._tooltipModel.get("triggerOn");_f("itemTooltip",this._api,CC(function(e,i,n){"none"!==t&&(t.indexOf(e)>=0?this._tryShow(i,n):"leave"===e&&this._hide(n))},this))},_keepShow:function(){var t=this._tooltipModel,e=this._ecModel,i=this._api;if(null!=this._lastX&&null!=this._lastY&&"none"!==t.get("triggerOn")){var n=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){n.manuallyShowTip(t,e,i,{x:n._lastX,y:n._lastY})})}},manuallyShowTip:function(t,e,i,n){if(n.from!==this.uid&&!Uv.node){var o=Dg(n,i);this._ticket="";var a=n.dataByCoordSys;if(n.tooltip&&null!=n.x&&null!=n.y){var r=kC;r.position=[n.x,n.y],r.update(),r.tooltip=n.tooltip,this._tryShow({offsetX:n.x,offsetY:n.y,target:r},o)}else if(a)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,event:{},dataByCoordSys:n.dataByCoordSys,tooltipOption:n.tooltipOption},o);else if(null!=n.seriesIndex){if(this._manuallyAxisShowTip(t,e,i,n))return;var s=UA(n,e),l=s.point[0],h=s.point[1];null!=l&&null!=h&&this._tryShow({offsetX:l,offsetY:h,position:n.position,target:s.el,event:{}},o)}else null!=n.x&&null!=n.y&&(i.dispatchAction({type:"updateAxisPointer",x:n.x,y:n.y}),this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().findHover(n.x,n.y).target,event:{}},o))}},manuallyHideTip:function(t,e,i,n){var o=this._tooltipContent;this._alwaysShowContent||o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=null,n.from!==this.uid&&this._hide(Dg(n,i))},_manuallyAxisShowTip:function(t,e,i,n){var o=n.seriesIndex,a=n.dataIndex,r=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=o&&null!=a&&null!=r){var s=e.getSeriesByIndex(o);if(s&&"axis"===(t=Cg([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model,t])).get("trigger"))return i.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:a,position:n.position}),!0}},_tryShow:function(t,e){var i=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var n=t.dataByCoordSys;n&&n.length?this._showAxisTooltip(n,t):i&&null!=i.dataIndex?(this._lastDataByCoordSys=null,this._showSeriesItemTooltip(t,i,e)):i&&i.tooltip?(this._lastDataByCoordSys=null,this._showComponentItemTooltip(t,i,e)):(this._lastDataByCoordSys=null,this._hide(e))}},_showOrMove:function(t,e){var i=t.get("showDelay");e=m(e,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(e,i):e()},_showAxisTooltip:function(t,e){var i=this._ecModel,n=this._tooltipModel,o=[e.offsetX,e.offsetY],a=[],r=[],s=Cg([e.tooltipOption,n]);DC(t,function(t){DC(t.dataByAxis,function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),n=t.value,o=[];if(e&&null!=n){var s=Ef(n,e.axis,i,t.seriesDataIndices,t.valueLabelOpt);d(t.seriesDataIndices,function(a){var l=i.getSeriesByIndex(a.seriesIndex),h=a.dataIndexInside,u=l&&l.getDataParams(h);u.axisDim=t.axisDim,u.axisIndex=t.axisIndex,u.axisType=t.axisType,u.axisId=t.axisId,u.axisValue=Br(e.axis,n),u.axisValueLabel=s,u&&(r.push(u),o.push(l.formatTooltip(h,!0)))});var l=s;a.push((l?Gi(l)+"
    ":"")+o.join("
    "))}})},this),a.reverse(),a=a.join("

    ");var l=e.position;this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(s,l,o[0],o[1],this._tooltipContent,r):this._showTooltipContent(s,a,r,Math.random(),o[0],o[1],l)})},_showSeriesItemTooltip:function(t,e,i){var n=this._ecModel,o=e.seriesIndex,a=n.getSeriesByIndex(o),r=e.dataModel||a,s=e.dataIndex,l=e.dataType,h=r.getData(),u=Cg([h.getItemModel(s),r,a&&(a.coordinateSystem||{}).model,this._tooltipModel]),c=u.get("trigger");if(null==c||"item"===c){var d=r.getDataParams(s,l),f=r.formatTooltip(s,!1,l),g="item_"+r.name+"_"+s;this._showOrMove(u,function(){this._showTooltipContent(u,f,d,g,t.offsetX,t.offsetY,t.position,t.target)}),i({type:"showTip",dataIndexInside:s,dataIndex:h.getRawIndex(s),seriesIndex:o,from:this.uid})}},_showComponentItemTooltip:function(t,e,i){var n=e.tooltip;if("string"==typeof n){var o=n;n={content:o,formatter:o}}var a=new Lo(n,this._tooltipModel,this._ecModel),r=a.get("content"),s=Math.random();this._showOrMove(a,function(){this._showTooltipContent(a,r,a.get("formatterParams")||{},s,t.offsetX,t.offsetY,t.position,e)}),i({type:"showTip",from:this.uid})},_showTooltipContent:function(t,e,i,n,o,a,r,s){if(this._ticket="",t.get("showContent")&&t.get("show")){var l=this._tooltipContent,h=t.get("formatter");r=r||t.get("position");var u=e;if(h&&"string"==typeof h)u=Wi(h,i,!0);else if("function"==typeof h){var c=CC(function(e,n){e===this._ticket&&(l.setContent(n),this._updatePosition(t,r,o,a,l,i,s))},this);this._ticket=n,u=h(i,n,c)}l.setContent(u),l.show(t),this._updatePosition(t,r,o,a,l,i,s)}},_updatePosition:function(t,e,i,n,o,a,r){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var h=o.getSize(),u=t.get("align"),c=t.get("verticalAlign"),d=r&&r.getBoundingRect().clone();if(r&&d.applyTransform(r.transform),"function"==typeof e&&(e=e([i,n],a,o.el,d,{viewSize:[s,l],contentSize:h.slice()})),y(e))i=LC(e[0],s),n=LC(e[1],l);else if(b(e)){e.width=h[0],e.height=h[1];var f=Ko(e,{width:s,height:l});i=f.x,n=f.y,u=null,c=null}else"string"==typeof e&&r?(i=(g=Og(e,d,h))[0],n=g[1]):(i=(g=Lg(i,n,o.el,s,l,u?null:20,c?null:20))[0],n=g[1]);if(u&&(i-=zg(u)?h[0]/2:"right"===u?h[0]:0),c&&(n-=zg(c)?h[1]/2:"bottom"===c?h[1]:0),t.get("confine")){var g=kg(i,n,o.el,s,l);i=g[0],n=g[1]}o.moveTo(i,n)},_updateContentNotChangedOnAxis:function(t){var e=this._lastDataByCoordSys,i=!!e&&e.length===t.length;return i&&DC(e,function(e,n){var o=e.dataByAxis||{},a=(t[n]||{}).dataByAxis||[];(i&=o.length===a.length)&&DC(o,function(t,e){var n=a[e]||{},o=t.seriesDataIndices||[],r=n.seriesDataIndices||[];(i&=t.value===n.value&&t.axisType===n.axisType&&t.axisId===n.axisId&&o.length===r.length)&&DC(o,function(t,e){var n=r[e];i&=t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})})}),this._lastDataByCoordSys=t,!!i},_hide:function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},dispose:function(t,e){Uv.node||(this._tooltipContent.hide(),Tf("itemTooltip",e))}}),ir({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),ir({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){}),Vg.prototype={constructor:Vg,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToRadius:US.prototype.dataToCoord,radiusToData:US.prototype.coordToData},h(Vg,US),Bg.prototype={constructor:Bg,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToAngle:US.prototype.dataToCoord,angleToData:US.prototype.coordToData},h(Bg,US);var PC=function(t){this.name=t||"",this.cx=0,this.cy=0,this._radiusAxis=new Vg,this._angleAxis=new Bg,this._radiusAxis.polar=this._angleAxis.polar=this};PC.prototype={type:"polar",axisPointerEnabled:!0,constructor:PC,dimensions:["radius","angle"],model:null,containPoint:function(t){var e=this.pointToCoord(t);return this._radiusAxis.contain(e[0])&&this._angleAxis.contain(e[1])},containData:function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},getAxis:function(t){return this["_"+t+"Axis"]},getAxes:function(){return[this._radiusAxis,this._angleAxis]},getAxesByScale:function(t){var e=[],i=this._angleAxis,n=this._radiusAxis;return i.scale.type===t&&e.push(i),n.scale.type===t&&e.push(n),e},getAngleAxis:function(){return this._angleAxis},getRadiusAxis:function(){return this._radiusAxis},getOtherAxis:function(t){var e=this._angleAxis;return t===e?this._radiusAxis:e},getBaseAxis:function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},getTooltipAxes:function(t){var e=null!=t&&"auto"!==t?this.getAxis(t):this.getBaseAxis();return{baseAxes:[e],otherAxes:[this.getOtherAxis(e)]}},dataToPoint:function(t,e){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],e),this._angleAxis.dataToAngle(t[1],e)])},pointToData:function(t,e){var i=this.pointToCoord(t);return[this._radiusAxis.radiusToData(i[0],e),this._angleAxis.angleToData(i[1],e)]},pointToCoord:function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=this.getAngleAxis(),o=n.getExtent(),a=Math.min(o[0],o[1]),r=Math.max(o[0],o[1]);n.inverse?a=r-360:r=a+360;var s=Math.sqrt(e*e+i*i);e/=s,i/=s;for(var l=Math.atan2(-i,e)/Math.PI*180,h=lr;)l+=360*h;return[s,l]},coordToPoint:function(t){var e=t[0],i=t[1]/180*Math.PI;return[Math.cos(i)*e+this.cx,-Math.sin(i)*e+this.cy]}};var OC=Ub.extend({type:"polarAxis",axis:null,getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"polar",index:this.option.polarIndex,id:this.option.polarId})[0]}});n(OC.prototype,zS);var zC={angle:{startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:!1}},radius:{splitNumber:5}};_M("angle",OC,Gg,zC.angle),_M("radius",OC,Gg,zC.radius),sr({type:"polar",dependencies:["polarAxis","angleAxis"],coordinateSystem:null,findAxisModel:function(t){var e;return this.ecModel.eachComponent(t,function(t){t.getCoordSysModel()===this&&(e=t)},this),e},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"80%"}});var NC={dimensions:PC.prototype.dimensions,create:function(t,e){var i=[];return t.eachComponent("polar",function(t,n){var o=new PC(n);o.update=Hg;var a=o.getRadiusAxis(),r=o.getAngleAxis(),s=t.findAxisModel("radiusAxis"),l=t.findAxisModel("angleAxis");Fg(a,s),Fg(r,l),Wg(o,t,e),i.push(o),t.coordinateSystem=o,o.model=t}),t.eachSeries(function(e){if("polar"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"polar",index:e.get("polarIndex"),id:e.get("polarId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}};ua.register("polar",NC);var EC=["axisLine","axisLabel","axisTick","splitLine","splitArea"];EM.extend({type:"angleAxis",axisPointerClass:"PolarAxisPointer",render:function(t,e){if(this.group.removeAll(),t.get("show")){var i=t.axis,n=i.polar,o=n.getRadiusAxis().getExtent(),a=i.getTicksCoords();"category"!==i.type&&a.pop(),d(EC,function(e){!t.get(e+".show")||i.scale.isBlank()&&"axisLine"!==e||this["_"+e](t,n,a,o)},this)}},_axisLine:function(t,e,i,n){var o=t.getModel("axisLine.lineStyle"),a=new nb({shape:{cx:e.cx,cy:e.cy,r:n[Ug(e)]},style:o.getLineStyle(),z2:1,silent:!0});a.style.fill=null,this.group.add(a)},_axisTick:function(t,e,i,n){var o=t.getModel("axisTick"),a=(o.get("inside")?-1:1)*o.get("length"),s=n[Ug(e)],l=f(i,function(t){return new fb({shape:Zg(e,[s,s+a],t)})});this.group.add(Ib(l,{style:r(o.getModel("lineStyle").getLineStyle(),{stroke:t.get("axisLine.lineStyle.color")})}))},_axisLabel:function(t,e,i,n){for(var o=t.axis,a=t.get("data"),r=t.getModel("axisLabel"),s=t.getFormattedLabels(),l=r.get("margin"),h=o.getLabelsCoords(),u=0;uf?"left":"right",m=Math.abs(d[1]-g)/c<.3?"middle":d[1]>g?"top":"bottom";a&&a[u]&&a[u].textStyle&&(r=new Lo(a[u].textStyle,r,r.ecModel));var v=new ib({silent:!0});this.group.add(v),fo(v.style,r,{x:d[0],y:d[1],textFill:r.getTextColor()||t.get("axisLine.lineStyle.color"),text:s[u],textAlign:p,textVerticalAlign:m})}},_splitLine:function(t,e,i,n){var o=t.getModel("splitLine").getModel("lineStyle"),a=o.get("color"),s=0;a=a instanceof Array?a:[a];for(var l=[],h=0;h=0?"p":"n",S=i.pointToCoord(M[n]),I=r[u][n][p];if("radius"===g.dim)o=I,s=S[0],c=(h=(-S[1]+d)*Math.PI/180)+f*Math.PI/180,Math.abs(s)0?C=A[1]:C===A[1]&&t<0&&(C=A[0]),r[u][n][p]=C}e.setItemLayout(n,{cx:m,cy:v,r0:o,r:s,startAngle:h,endAngle:c})}},!0)}},this)},"bar")),lr({type:"polar"}),u(Ub.extend({type:"geo",coordinateSystem:null,layoutMode:"box",init:function(t){Ub.prototype.init.apply(this,arguments),zo(t.label,["show"])},optionUpdated:function(){var t=this.option,e=this;t.regions=xI.getFilledRegions(t.regions,t.map,t.nameMap),this._optionModelMap=g(t.regions||[],function(t,i){return i.name&&t.set(i.name,new Lo(i,e)),t},z()),this.updateSelectedMap(t.regions)},defaultOption:{zlevel:0,z:0,show:!0,left:"center",top:"center",aspectScale:.75,silent:!1,map:"",boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{normal:{show:!1,color:"#000"},emphasis:{show:!0,color:"rgb(100,0,0)"}},itemStyle:{normal:{borderWidth:.5,borderColor:"#444",color:"#eee"},emphasis:{color:"rgba(255,215,0,0.8)"}},regions:[]},getRegionModel:function(t){return this._optionModelMap.get(t)||new Lo(null,this,this.ecModel)},getFormattedLabel:function(t,e){var i=this.getRegionModel(t).get("label."+e+".formatter"),n={name:t};return"function"==typeof i?(n.status=e,i(n)):"string"==typeof i?i.replace("{a}",null!=t?t:""):void 0},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t}}),$M),lr({type:"geo",init:function(t,e){var i=new Ul(e,!0);this._mapDraw=i,this.group.add(i.group)},render:function(t,e,i,n){if(!n||"geoToggleSelect"!==n.type||n.from!==this.uid){var o=this._mapDraw;t.get("show")?o.draw(t,e,i,this,n):this._mapDraw.group.removeAll(),this.group.silent=t.get("silent")}},dispose:function(){this._mapDraw&&this._mapDraw.remove()}}),qg("toggleSelected",{type:"geoToggleSelect",event:"geoselectchanged"}),qg("select",{type:"geoSelect",event:"geoselected"}),qg("unSelect",{type:"geoUnSelect",event:"geounselected"});var WC=["rect","polygon","keep","clear"],HC=d,FC={lineX:tp(0),lineY:tp(1),rect:{point:function(t,e,i){return t&&i.boundingRect.contain(t[0],t[1])},rect:function(t,e,i){return t&&i.boundingRect.intersect(t)}},polygon:{point:function(t,e,i){return t&&i.boundingRect.contain(t[0],t[1])&&Ur(i.range,t[0],t[1])},rect:function(t,e,i){var n=i.range;if(!t||n.length<=1)return!1;var o=t.x,a=t.y,r=t.width,s=t.height,l=n[0];return!!(Ur(n,o,a)||Ur(n,o+r,a)||Ur(n,o,a+s)||Ur(n,o+r,a+s)||jt.create(t).contain(l[0],l[1])||ip(o,a,o+r,a,n)||ip(o,a,o,a+s,n)||ip(o+r,a,o+r,a+s,n)||ip(o,a+s,o+r,a+s,n))||void 0}}},ZC=d,UC=l,XC=v,jC=["dataToPoint","pointToData"],qC=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],YC=rp.prototype;YC.setOutputRanges=function(t,e){this.matchOutputRanges(t,e,function(t,e,i){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var n=QC[t.brushType](0,i,e);t.__rangeOffset={offset:tD[t.brushType](n.values,t.range,[1,1]),xyMinMax:n.xyMinMax}}})},YC.matchOutputRanges=function(t,e,i){ZC(t,function(t){var n=this.findTargetInfo(t,e);n&&!0!==n&&d(n.coordSyses,function(n){var o=QC[t.brushType](1,n,t.range);i(t,o.values,n,e)})},this)},YC.setInputRanges=function(t,e){ZC(t,function(t){var i=this.findTargetInfo(t,e);if(t.range=t.range||[],i&&!0!==i){t.panelId=i.panelId;var n=QC[t.brushType](0,i.coordSys,t.coordRange),o=t.__rangeOffset;t.range=o?tD[t.brushType](n.values,o.offset,cp(n.xyMinMax,o.xyMinMax)):n.values}},this)},YC.makePanelOpts=function(t,e){return f(this._targetInfoList,function(i){var n=i.getPanelRect();return{panelId:i.panelId,defaultBrushType:e&&e(i),clipPath:Lc(n),isTargetByCursor:Pc(n,t,i.coordSysModel),getLinearBrushOtherExtent:kc(n)}})},YC.controlSeries=function(t,e,i){var n=this.findTargetInfo(t,i);return!0===n||n&&UC(n.coordSyses,e.coordinateSystem)>=0},YC.findTargetInfo=function(t,e){for(var i=this._targetInfoList,n=lp(e,t),o=0;o=0||UC(n,t.getAxis("y").model)>=0)&&a.push(t)}),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:a[0],coordSyses:a,getPanelRect:JC.grid,xAxisDeclared:r[t.id],yAxisDeclared:s[t.id]})}))},geo:function(t,e){ZC(t.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:i,coordSyses:[i],getPanelRect:JC.geo})})}},KC=[function(t,e){var i=t.xAxisModel,n=t.yAxisModel,o=t.gridModel;return!o&&i&&(o=i.axis.grid.model),!o&&n&&(o=n.axis.grid.model),o&&o===e.gridModel},function(t,e){var i=t.geoModel;return i&&i===e.geoModel}],JC={grid:function(){return this.coordSys.grid.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(Mo(t)),e}},QC={lineX:XC(hp,0),lineY:XC(hp,1),rect:function(t,e,i){var n=e[jC[t]]([i[0][0],i[1][0]]),o=e[jC[t]]([i[0][1],i[1][1]]),a=[sp([n[0],o[0]]),sp([n[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,i){var n=[[1/0,-1/0],[1/0,-1/0]];return{values:f(i,function(i){var o=e[jC[t]](i);return n[0][0]=Math.min(n[0][0],o[0]),n[1][0]=Math.min(n[1][0],o[1]),n[0][1]=Math.max(n[0][1],o[0]),n[1][1]=Math.max(n[1][1],o[1]),o}),xyMinMax:n}}},tD={lineX:XC(up,0),lineY:XC(up,1),rect:function(t,e,i){return[[t[0][0]-i[0]*e[0][0],t[0][1]-i[0]*e[0][1]],[t[1][0]-i[1]*e[1][0],t[1][1]-i[1]*e[1][1]]]},polygon:function(t,e,i){return f(t,function(t,n){return[t[0]-i[0]*e[n][0],t[1]-i[1]*e[n][1]]})}},eD=["inBrush","outOfBrush"],iD="__ecBrushSelect",nD="__ecInBrushSelectEvent",oD=Pw.VISUAL.BRUSH;or(oD,function(t,e,i){t.eachComponent({mainType:"brush"},function(e){i&&"takeGlobalCursor"===i.type&&e.setBrushOption("brush"===i.key?i.brushOption:{brushType:!1}),(e.brushTargetManager=new rp(e.option,t)).setInputRanges(e.areas,t)})}),ar(oD,function(t,e,n){var o,a,s=[];t.eachComponent({mainType:"brush"},function(e,n){function l(t){return"all"===m||v[t]}function h(t){return!!t.length}function u(t,e){var i=t.coordinateSystem;b|=i.hasAxisBrushed(),l(e)&&i.eachActiveState(t.getData(),function(t,e){"active"===t&&(x[e]=1)})}function c(i,n,o){var a=mp(i);if(a&&!vp(e,n)&&(d(w,function(n){a[n.brushType]&&e.brushTargetManager.controlSeries(n,i,t)&&o.push(n),b|=h(o)}),l(n)&&h(o))){var r=i.getData();r.each(function(t){pp(a,o,r,t)&&(x[t]=1)})}}var g={brushId:e.id,brushIndex:n,brushName:e.name,areas:i(e.areas),selected:[]};s.push(g);var p=e.option,m=p.brushLink,v=[],x=[],_=[],b=0;n||(o=p.throttleType,a=p.throttleDelay);var w=f(e.areas,function(t){return yp(r({boundingRect:aD[t.brushType](t)},t))}),S=Kg(e.option,eD,function(t){t.mappingMethod="fixed"});y(m)&&d(m,function(t){v[t]=1}),t.eachSeries(function(t,e){var i=_[e]=[];"parallel"===t.subType?u(t,e):c(t,e,i)}),t.eachSeries(function(t,e){var i={seriesId:t.id,seriesIndex:e,seriesName:t.name,dataIndex:[]};g.selected.push(i);var n=mp(t),o=_[e],a=t.getData(),r=l(e)?function(t){return x[t]?(i.dataIndex.push(a.getRawIndex(t)),"inBrush"):"outOfBrush"}:function(t){return pp(n,o,a,t)?(i.dataIndex.push(a.getRawIndex(t)),"inBrush"):"outOfBrush"};(l(e)?b:h(o))&&Qg(eD,S,a,r)})}),fp(e,o,a,s,n)});var aD={lineX:N,lineY:N,rect:function(t){return xp(t.range)},polygon:function(t){for(var e,i=t.range,n=0,o=i.length;ne[0][1]&&(e[0][1]=a[0]),a[1]e[1][1]&&(e[1][1]=a[1])}return e&&xp(e)}},rD=["#ddd"];sr({type:"brush",dependencies:["geo","grid","xAxis","yAxis","parallel","series"],defaultOption:{toolbox:null,brushLink:null,seriesIndex:"all",geoIndex:null,xAxisIndex:null,yAxisIndex:null,brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(120,140,180,0.3)",borderColor:"rgba(120,140,180,0.8)"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},areas:[],brushType:null,brushOption:{},coordInfoList:[],optionUpdated:function(t,e){var i=this.option;!e&&Jg(i,t,["inBrush","outOfBrush"]),i.inBrush=i.inBrush||{},i.outOfBrush=i.outOfBrush||{color:rD}},setAreas:function(t){t&&(this.areas=f(t,function(t){return _p(this.option,t)},this))},setBrushOption:function(t){this.brushOption=_p(this.option,t),this.brushType=this.brushOption.brushType}});lr({type:"brush",init:function(t,e){this.ecModel=t,this.api=e,this.model,(this._brushController=new Yu(e.getZr())).on("brush",m(this._onBrush,this)).mount()},render:function(t){return this.model=t,bp.apply(this,arguments)},updateView:bp,updateLayout:bp,updateVisual:bp,dispose:function(){this._brushController.dispose()},_onBrush:function(t,e){var n=this.model.id;this.model.brushTargetManager.setOutputRanges(t,this.ecModel),(!e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:i(t),$from:n})}}),ir({type:"brush",event:"brush",update:"updateView"},function(t,e){e.eachComponent({mainType:"brush",query:t},function(e){e.setAreas(t.areas)})}),ir({type:"brushSelect",event:"brushSelected",update:"none"},function(){});var sD={},lD={toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}}},hD=lD.toolbox.brush;Mp.defaultOption={show:!0,type:["rect","polygon","lineX","lineY","keep","clear"],icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:i(hD.title)};var uD=Mp.prototype;uD.render=uD.updateView=uD.updateLayout=function(t,e,i){var n,o,a;e.eachComponent({mainType:"brush"},function(t){n=t.brushType,o=t.brushOption.brushMode||"single",a|=t.areas.length}),this._brushType=n,this._brushMode=o,d(t.get("type",!0),function(e){t.setIconStatus(e,("keep"===e?"multiple"===o:"clear"===e?a:e===n)?"emphasis":"normal")})},uD.getIcons=function(){var t=this.model,e=t.get("icon",!0),i={};return d(t.get("type",!0),function(t){e[t]&&(i[t]=e[t])}),i},uD.onclick=function(t,e,i){var n=this._brushType,o=this._brushMode;"clear"===i?(e.dispatchAction({type:"axisAreaSelect",intervals:[]}),e.dispatchAction({type:"brush",command:"clear",areas:[]})):e.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:"keep"===i?n:n!==i&&i,brushMode:"keep"===i?"multiple"===o?"single":"multiple":o}})},wp("brush",Mp),tr(function(t,e){var i=t&&t.brush;if(y(i)||(i=i?[i]:[]),i.length){var n=[];d(i,function(t){var e=t.hasOwnProperty("toolbox")?t.toolbox:[];e instanceof Array&&(n=n.concat(e))});var o=t&&t.toolbox;y(o)&&(o=o[0]),o||(o={feature:{}},t.toolbox=[o]);var a=o.feature||(o.feature={}),r=a.brush||(a.brush={}),s=r.type||(r.type=[]);s.push.apply(s,n),Yg(s),e&&!s.length&&s.push.apply(s,WC)}});Ip.prototype={constructor:Ip,type:"calendar",dimensions:["time","value"],getDimensionsInfo:function(){return[{name:"time",type:"time"}]},getRangeInfo:function(){return this._rangeInfo},getModel:function(){return this._model},getRect:function(){return this._rect},getCellWidth:function(){return this._sw},getCellHeight:function(){return this._sh},getOrient:function(){return this._orient},getFirstDayOfWeek:function(){return this._firstDayOfWeek},getDateInfo:function(t){var e=(t=Pi(t)).getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var o=t.getDay();return o=Math.abs((o+7-this.getFirstDayOfWeek())%7),{y:e,m:i,d:n,day:o,time:t.getTime(),formatedDate:e+"-"+i+"-"+n,date:t}},getNextNDay:function(t,e){return 0===(e=e||0)?this.getDateInfo(t):((t=new Date(this.getDateInfo(t).time)).setDate(t.getDate()+e),this.getDateInfo(t))},update:function(t,e){function i(t,e){return null!=t[e]&&"auto"!==t[e]}this._firstDayOfWeek=+this._model.getModel("dayLabel").get("firstDay"),this._orient=this._model.get("orient"),this._lineWidth=this._model.getModel("itemStyle.normal").getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var n=this._rangeInfo.weeks||1,o=["width","height"],a=this._model.get("cellSize").slice(),r=this._model.getBoxLayoutParams(),s="horizontal"===this._orient?[n,7]:[7,n];d([0,1],function(t){i(a,t)&&(r[o[t]]=a[t]*s[t])});var l={width:e.getWidth(),height:e.getHeight()},h=this._rect=Ko(r,l);d([0,1],function(t){i(a,t)||(a[t]=h[o[t]]/s[t])}),this._sw=a[0],this._sh=a[1]},dataToPoint:function(t,e){y(t)&&(t=t[0]),null==e&&(e=!0);var i=this.getDateInfo(t),n=this._rangeInfo,o=i.formatedDate;if(e&&!(i.time>=n.start.time&&i.time<=n.end.time))return[NaN,NaN];var a=i.day,r=this._getRangeInfo([n.start.time,o]).nthWeek;return"vertical"===this._orient?[this._rect.x+a*this._sw+this._sw/2,this._rect.y+r*this._sh+this._sh/2]:[this._rect.x+r*this._sw+this._sw/2,this._rect.y+a*this._sh+this._sh/2]},pointToData:function(t){var e=this.pointToDate(t);return e&&e.time},dataToRect:function(t,e){var i=this.dataToPoint(t,e);return{contentShape:{x:i[0]-(this._sw-this._lineWidth)/2,y:i[1]-(this._sh-this._lineWidth)/2,width:this._sw-this._lineWidth,height:this._sh-this._lineWidth},center:i,tl:[i[0]-this._sw/2,i[1]-this._sh/2],tr:[i[0]+this._sw/2,i[1]-this._sh/2],br:[i[0]+this._sw/2,i[1]+this._sh/2],bl:[i[0]-this._sw/2,i[1]+this._sh/2]}},pointToDate:function(t){var e=Math.floor((t[0]-this._rect.x)/this._sw)+1,i=Math.floor((t[1]-this._rect.y)/this._sh)+1,n=this._rangeInfo.range;return"vertical"===this._orient?this._getDateByWeeksAndDay(i,e-1,n):this._getDateByWeeksAndDay(e,i-1,n)},convertToPixel:v(Tp,"dataToPoint"),convertFromPixel:v(Tp,"pointToData"),_initRangeOption:function(){var t=this._model.get("range"),e=t;if(y(e)&&1===e.length&&(e=e[0]),/^\d{4}$/.test(e)&&(t=[e+"-01-01",e+"-12-31"]),/^\d{4}[\/|-]\d{1,2}$/.test(e)){var i=this.getDateInfo(e),n=i.date;n.setMonth(n.getMonth()+1);var o=this.getNextNDay(n,-1);t=[i.formatedDate,o.formatedDate]}/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(e)&&(t=[e,e]);var a=this._getRangeInfo(t);return a.start.time>a.end.time&&t.reverse(),t},_getRangeInfo:function(t){var e;(t=[this.getDateInfo(t[0]),this.getDateInfo(t[1])])[0].time>t[1].time&&(e=!0,t.reverse());var i=Math.floor(t[1].time/864e5)-Math.floor(t[0].time/864e5)+1,n=new Date(t[0].time),o=n.getDate(),a=t[1].date.getDate();if(n.setDate(o+i-1),n.getDate()!==a)for(var r=n.getTime()-t[1].time>0?1:-1;n.getDate()!==a&&(n.getTime()-t[1].time)*r>0;)i-=r,n.setDate(o+i-1);var s=Math.floor((i+t[0].day+6)/7),l=e?1-s:s-1;return e&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:i,weeks:s,nthWeek:l,fweek:t[0].day,lweek:t[1].day}},_getDateByWeeksAndDay:function(t,e,i){var n=this._getRangeInfo(i);if(t>n.weeks||0===t&&en.lweek)return!1;var o=7*(t-1)-n.fweek+e,a=new Date(n.start.time);return a.setDate(n.start.d+o),this.getDateInfo(a)}},Ip.dimensions=Ip.prototype.dimensions,Ip.getDimensionsInfo=Ip.prototype.getDimensionsInfo,Ip.create=function(t,e){var i=[];return t.eachComponent("calendar",function(n){var o=new Ip(n,t,e);i.push(o),n.coordinateSystem=o}),t.eachSeries(function(t){"calendar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("calendarIndex")||0])}),i},ua.register("calendar",Ip);var cD=Ub.extend({type:"calendar",coordinateSystem:null,defaultOption:{zlevel:0,z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{normal:{color:"#fff",borderWidth:1,borderColor:"#ccc"}},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",nameMap:"en",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",nameMap:"en",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},init:function(t,e,i,n){var o=ea(t);cD.superApply(this,"init",arguments),Ap(t,o)},mergeOption:function(t,e){cD.superApply(this,"mergeOption",arguments),Ap(this.option,t)}}),dD={EN:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],CN:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},fD={EN:["S","M","T","W","T","F","S"],CN:["日","一","二","三","四","五","六"]};lr({type:"calendar",_tlpoints:null,_blpoints:null,_firstDayOfMonth:null,_firstDayPoints:null,render:function(t,e,i){var n=this.group;n.removeAll();var o=t.coordinateSystem,a=o.getRangeInfo(),r=o.getOrient();this._renderDayRect(t,a,n),this._renderLines(t,a,r,n),this._renderYearText(t,a,r,n),this._renderMonthText(t,r,n),this._renderWeekText(t,a,r,n)},_renderDayRect:function(t,e,i){for(var n=t.coordinateSystem,o=t.getModel("itemStyle.normal").getItemStyle(),a=n.getCellWidth(),r=n.getCellHeight(),s=e.start.time;s<=e.end.time;s=n.getNextNDay(s,1).time){var l=n.dataToRect([s],!1).tl,h=new db({shape:{x:l[0],y:l[1],width:a,height:r},cursor:"default",style:o});i.add(h)}},_renderLines:function(t,e,i,n){function o(e){a._firstDayOfMonth.push(r.getDateInfo(e)),a._firstDayPoints.push(r.dataToRect([e],!1).tl);var o=a._getLinePointsOfOneWeek(t,e,i);a._tlpoints.push(o[0]),a._blpoints.push(o[o.length-1]),l&&a._drawSplitline(o,s,n)}var a=this,r=t.coordinateSystem,s=t.getModel("splitLine.lineStyle").getLineStyle(),l=t.get("splitLine.show"),h=s.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var u=e.start,c=0;u.time<=e.end.time;c++){o(u.formatedDate),0===c&&(u=r.getDateInfo(e.start.y+"-"+e.start.m));var d=u.date;d.setMonth(d.getMonth()+1),u=r.getDateInfo(d)}o(r.getNextNDay(e.end.time,1).formatedDate),l&&this._drawSplitline(a._getEdgesPoints(a._tlpoints,h,i),s,n),l&&this._drawSplitline(a._getEdgesPoints(a._blpoints,h,i),s,n)},_getEdgesPoints:function(t,e,i){var n=[t[0].slice(),t[t.length-1].slice()],o="horizontal"===i?0:1;return n[0][o]=n[0][o]-e/2,n[1][o]=n[1][o]+e/2,n},_drawSplitline:function(t,e,i){var n=new cb({z2:20,shape:{points:t},style:e});i.add(n)},_getLinePointsOfOneWeek:function(t,e,i){var n=t.coordinateSystem;e=n.getDateInfo(e);for(var o=[],a=0;a<7;a++){var r=n.getNextNDay(e.time,a),s=n.dataToRect([r.time],!1);o[2*r.day]=s.tl,o[2*r.day+1]=s["horizontal"===i?"bl":"tr"]}return o},_formatterLabel:function(t,e){return"string"==typeof t&&t?Hi(t,e):"function"==typeof t?t(e):e.nameMap},_yearTextPositionControl:function(t,e,i,n,o){e=e.slice();var a=["center","bottom"];"bottom"===n?(e[1]+=o,a=["center","top"]):"left"===n?e[0]-=o:"right"===n?(e[0]+=o,a=["center","top"]):e[1]-=o;var r=0;return"left"!==n&&"right"!==n||(r=Math.PI/2),{rotation:r,position:e,style:{textAlign:a[0],textVerticalAlign:a[1]}}},_renderYearText:function(t,e,i,n){var o=t.getModel("yearLabel");if(o.get("show")){var a=o.get("margin"),r=o.get("position");r||(r="horizontal"!==i?"top":"left");var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],l=(s[0][0]+s[1][0])/2,h=(s[0][1]+s[1][1])/2,u="horizontal"===i?0:1,c={top:[l,s[u][1]],bottom:[l,s[1-u][1]],left:[s[1-u][0],h],right:[s[u][0],h]},d=e.start.y;+e.end.y>+e.start.y&&(d=d+"-"+e.end.y);var f=o.get("formatter"),g={start:e.start.y,end:e.end.y,nameMap:d},p=this._formatterLabel(f,g),m=new ib({z2:30});fo(m.style,o,{text:p}),m.attr(this._yearTextPositionControl(m,c[r],i,r,a)),n.add(m)}},_monthTextPositionControl:function(t,e,i,n,o){var a="left",r="top",s=t[0],l=t[1];return"horizontal"===i?(l+=o,e&&(a="center"),"start"===n&&(r="bottom")):(s+=o,e&&(r="middle"),"start"===n&&(a="right")),{x:s,y:l,textAlign:a,textVerticalAlign:r}},_renderMonthText:function(t,e,i){var n=t.getModel("monthLabel");if(n.get("show")){var o=n.get("nameMap"),r=n.get("margin"),s=n.get("position"),l=n.get("align"),h=[this._tlpoints,this._blpoints];_(o)&&(o=dD[o.toUpperCase()]||[]);var u="start"===s?0:1,c="horizontal"===e?0:1;r="start"===s?-r:r;for(var d="center"===l,f=0;f=a[0]&&t<=a[1]}if(t===this._dataZoomModel){var i=this._dimName,n=this.getTargetSeriesModels(),o=t.get("filterMode"),a=this._valueWindow;if("none"!==o){var r=this.getOtherAxisModel();t.get("$fromToolbox")&&r&&"category"===r.get("type")&&(o="empty"),mD(n,function(t){var n=t.getData(),r=t.coordDimToDataDim(i);"weakFilter"===o?n&&n.filterSelf(function(t){for(var e,i,o,s=0;sa[1];if(h&&!u&&!c)return!0;h&&(o=!0),u&&(e=!0),c&&(i=!0)}return o&&e&&i}):n&&mD(r,function(i){"empty"===o?t.setData(n.map(i,function(t){return e(t)?t:NaN})):n.filterSelf(i,e)})})}}}};var xD=d,_D=pD,bD=sr({type:"dataZoom",dependencies:["xAxis","yAxis","zAxis","radiusAxis","angleAxis","singleAxis","series"],defaultOption:{zlevel:0,z:4,orient:null,xAxisIndex:null,yAxisIndex:null,filterMode:"filter",throttle:null,start:0,end:100,startValue:null,endValue:null,minSpan:null,maxSpan:null,minValueSpan:null,maxValueSpan:null,rangeMode:null},init:function(t,e,i){this._dataIntervalByAxis={},this._dataInfo={},this._axisProxies={},this.textStyleModel,this._autoThrottle=!0,this._rangePropMode=["percent","percent"];var n=zp(t);this.mergeDefaultAndTheme(t,i),this.doInit(n)},mergeOption:function(t){var e=zp(t);n(this.option,t,!0),this.doInit(e)},doInit:function(t){var e=this.option;Uv.canvasSupported||(e.realtime=!1),this._setDefaultThrottle(t),Np(this,t),xD([["start","startValue"],["end","endValue"]],function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=null)},this),this.textStyleModel=this.getModel("textStyle"),this._resetTarget(),this._giveAxisProxies()},_giveAxisProxies:function(){var t=this._axisProxies;this.eachTargetAxis(function(e,i,n,o){var a=this.dependentModels[e.axis][i],r=a.__dzAxisProxy||(a.__dzAxisProxy=new yD(e.name,i,this,o));t[e.name+"_"+i]=r},this)},_resetTarget:function(){var t=this.option,e=this._judgeAutoMode();_D(function(e){var i=e.axisIndex;t[i]=Oo(t[i])},this),"axisIndex"===e?this._autoSetAxisIndex():"orient"===e&&this._autoSetOrient()},_judgeAutoMode:function(){var t=this.option,e=!1;_D(function(i){null!=t[i.axisIndex]&&(e=!0)},this);var i=t.orient;return null==i&&e?"orient":e?void 0:(null==i&&(t.orient="horizontal"),"axisIndex")},_autoSetAxisIndex:function(){var t=!0,e=this.get("orient",!0),i=this.option,n=this.dependentModels;if(t){var o="vertical"===e?"y":"x";n[o+"Axis"].length?(i[o+"AxisIndex"]=[0],t=!1):xD(n.singleAxis,function(n){t&&n.get("orient",!0)===e&&(i.singleAxisIndex=[n.componentIndex],t=!1)})}t&&_D(function(e){if(t){var n=[],o=this.dependentModels[e.axis];if(o.length&&!n.length)for(var a=0,r=o.length;a0?100:20}},getFirstTargetAxisModel:function(){var t;return _D(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;_D(function(n){xD(this.get(n.axisIndex),function(o){t.call(e,n,o,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},getAxisModel:function(t,e){var i=this.getAxisProxy(t,e);return i&&i.getAxisModel()},setRawRange:function(t,e){var i=this.option;xD([["start","startValue"],["end","endValue"]],function(e){null==t[e[0]]&&null==t[e[1]]||(i[e[0]]=t[e[0]],i[e[1]]=t[e[1]])},this),!e&&Np(this,t)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(t){if(t)return t.__dzAxisProxy;var e=this._axisProxies;for(var i in e)if(e.hasOwnProperty(i)&&e[i].hostedBy(this))return e[i];for(var i in e)if(e.hasOwnProperty(i)&&!e[i].hostedBy(this))return e[i]},getRangePropMode:function(){return this._rangePropMode.slice()}}),wD=xw.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var o,a=0;a0&&e%p)g+=f;else{var i=null==t||isNaN(t)||""===t,n=i?0:MD(t,a,h,!0);i&&!l&&e?(c.push([c[c.length-1][0],0]),d.push([d[d.length-1][0],0])):!i&&l&&(c.push([g,0]),d.push([g,0])),c.push([g,n]),d.push([g,n]),g+=f,l=i}});var m=this.dataZoomModel;this._displayables.barGroup.add(new ub({shape:{points:c},style:r({fill:m.get("dataBackgroundColor")},m.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new cb({shape:{points:d},style:m.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(!1!==e){var i,n=this.ecModel;return t.eachTargetAxis(function(o,a){d(t.getAxisProxy(o.name,a).getTargetSeriesModels(),function(t){if(!(i||!0!==e&&l(LD,t.get("type"))<0)){var r,s=n.getComponent(o.axis,a).axis,h=Ep(o.name),u=t.coordinateSystem;null!=h&&u.getOtherAxis&&(r=u.getOtherAxis(s).inverse),i={thisAxis:s,series:t,thisDim:o.name,otherDim:h,otherAxisInverse:r}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,o=this._size,a=this.dataZoomModel;n.add(t.filler=new SD({draggable:!0,cursor:Rp(this._orient),drift:TD(this._onDragMove,this,"all"),onmousemove:function(t){bx(t.event)},ondragstart:TD(this._showDataInfo,this,!0),ondragend:TD(this._onDragEnd,this),onmouseover:TD(this._showDataInfo,this,!0),onmouseout:TD(this._showDataInfo,this,!1),style:{fill:a.get("fillerColor"),textPosition:"inside"}})),n.add(new SD($n({silent:!0,shape:{x:0,y:0,width:o[0],height:o[1]},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:1,fill:"rgba(0,0,0,0)"}}))),AD([0,1],function(t){var o=Do(a.get("handleIcon"),{cursor:Rp(this._orient),draggable:!0,drift:TD(this._onDragMove,this,t),onmousemove:function(t){bx(t.event)},ondragend:TD(this._onDragEnd,this),onmouseover:TD(this._showDataInfo,this,!0),onmouseout:TD(this._showDataInfo,this,!1)},{x:-1,y:0,width:2,height:2}),r=o.getBoundingRect();this._handleHeight=Si(a.get("handleSize"),this._size[1]),this._handleWidth=r.width/r.height*this._handleHeight,o.setStyle(a.getModel("handleStyle").getItemStyle());var s=a.get("handleColor");null!=s&&(o.style.fill=s),n.add(e[t]=o);var l=a.textStyleModel;this.group.add(i[t]=new ib({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",textFill:l.getTextColor(),textFont:l.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[MD(t[0],[0,100],e,!0),MD(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this.dataZoomModel,n=this._handleEnds,o=this._getViewExtent(),a=i.findRepresentativeAxisProxy().getMinMaxSpan(),r=[0,100];OT(e,n,o,i.get("zoomLock")?"all":t,null!=a.minSpan?MD(a.minSpan,r,o,!0):null,null!=a.maxSpan?MD(a.maxSpan,r,o,!0):null),this._range=ID([MD(n[0],o,r,!0),MD(n[1],o,r,!0)])},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=ID(i.slice()),o=this._size;AD([0,1],function(t){var n=e.handles[t],a=this._handleHeight;n.attr({scale:[a/2,a/2],position:[i[t],o[1]/2-a/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=Mo(n.handles[t].parent,this.group),i=To(0===t?"right":"left",e),s=this._handleWidth/2+DD,l=Io([c[t]+(0===t?-s:s),this._size[1]/2],e);o[t].setStyle({x:l[0],y:l[1],textVerticalAlign:a===CD?"middle":i,textAlign:a===CD?i:"center",text:r[t]})}var i=this.dataZoomModel,n=this._displayables,o=n.handleLabels,a=this._orient,r=["",""];if(i.get("showDetail")){var s=i.findRepresentativeAxisProxy();if(s){var l=s.getAxisModel().axis,h=this._range,u=t?s.calculateDataWindow({start:h[0],end:h[1]}).valueWindow:s.getDataValueWindow();r=[this._formatLabel(u[0],l),this._formatLabel(u[1],l)]}}var c=ID(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),o=i.get("labelPrecision");null!=o&&"auto"!==o||(o=e.getPixelPrecision());var a=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(o,20));return x(n)?n(t,a):_(n)?n.replace("{value}",a):a},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=Io([e,i],this._displayables.barGroup.getLocalTransform(),!0);this._updateInterval(t,n[0]);var o=this.dataZoomModel.get("realtime");this._updateView(!o),o&&o&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),this._dispatchZoomAction()},_onClickPanelClick:function(t){var e=this._size,i=this._displayables.barGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(i[0]<0||i[0]>e[0]||i[1]<0||i[1]>e[1])){var n=this._handleEnds,o=(n[0]+n[1])/2;this._updateInterval("all",i[0]-o),this._updateView(),this._dispatchZoomAction()}},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_findCoordRect:function(){var t;if(AD(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});bD.extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,preventDefaultMouseMove:!0}});var PD=v,OD="\0_ec_dataZoom_roams",zD=m,ND=wD.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){ND.superApply(this,"render",arguments),Gp(n,t.id)&&(this._range=t.getPercentRange()),d(this.getTargetCoordInfo(),function(e,n){var o=f(e,function(t){return Wp(t.model)});d(e,function(e){var a=e.model,r=t.option;Vp(i,{coordId:Wp(a),allCoordIds:o,containsPoint:function(t,e,i){return a.coordinateSystem.containPoint([e,i])},dataZoomId:t.id,throttleRate:t.get("throttle",!0),panGetRange:zD(this._onPan,this,e,n),zoomGetRange:zD(this._onZoom,this,e,n),zoomLock:r.zoomLock,disabled:r.disabled,roamControllerOpt:{zoomOnMouseWheel:r.zoomOnMouseWheel,moveOnMouseMove:r.moveOnMouseMove,preventDefaultMouseMove:r.preventDefaultMouseMove}})},this)},this)},dispose:function(){Bp(this.api,this.dataZoomModel.id),ND.superApply(this,"dispose",arguments),this._range=null},_onPan:function(t,e,i,n,o,a,r,s,l){var h=this._range.slice(),u=t.axisModels[0];if(u){var c=ED[e]([a,r],[s,l],u,i,t),d=c.signal*(h[1]-h[0])*c.pixel/c.pixelLength;return OT(d,h,[0,100],"all"),this._range=h}},_onZoom:function(t,e,i,n,o,a){var r=this._range.slice(),s=t.axisModels[0];if(s){var l=ED[e](null,[o,a],s,i,t),h=(l.signal>0?l.pixelStart+l.pixelLength-l.pixel:l.pixel-l.pixelStart)/l.pixelLength*(r[1]-r[0])+r[0];n=Math.max(1/n,0),r[0]=(r[0]-h)*n+h,r[1]=(r[1]-h)*n+h;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();return OT(0,r,[0,100],0,u.minSpan,u.maxSpan),this._range=r}}}),ED={grid:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem.getRect();return t=t||[0,0],"x"===a.dim?(r.pixel=e[0]-t[0],r.pixelLength=s.width,r.pixelStart=s.x,r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=s.height,r.pixelStart=s.y,r.signal=a.inverse?-1:1),r},polar:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),h=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(r.pixel=e[0]-t[0],r.pixelLength=l[1]-l[0],r.pixelStart=l[0],r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=h[1]-h[0],r.pixelStart=h[0],r.signal=a.inverse?-1:1),r},singleAxis:function(t,e,i,n,o){var a=i.axis,r=o.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===a.orient?(s.pixel=e[0]-t[0],s.pixelLength=r.width,s.pixelStart=r.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=r.height,s.pixelStart=r.y,s.signal=a.inverse?-1:1),s}};er(function(t,e){t.eachComponent("dataZoom",function(t){t.eachTargetAxis($p),t.eachTargetAxis(Kp)}),t.eachComponent("dataZoom",function(t){var e=t.findRepresentativeAxisProxy(),i=e.getDataPercentWindow(),n=e.getDataValueWindow();t.setRawRange({start:i[0],end:i[1],startValue:n[0],endValue:n[1]},!0)})}),ir("dataZoom",function(t,e){var i=Dp(m(e.eachComponent,e,"dataZoom"),pD,function(t,e){return t.get(e.axisIndex)}),n=[];e.eachComponent({mainType:"dataZoom",query:t},function(t,e){n.push.apply(n,i(t).nodes)}),d(n,function(e,i){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})});var RD=d,VD=function(t){var e=t&&t.visualMap;y(e)||(e=e?[e]:[]),RD(e,function(t){if(t){Jp(t,"splitList")&&!Jp(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var e=t.pieces;e&&y(e)&&RD(e,function(t){b(t)&&(Jp(t,"start")&&!Jp(t,"min")&&(t.min=t.start),Jp(t,"end")&&!Jp(t,"max")&&(t.max=t.end))})}})};Ub.registerSubTypeDefaulter("visualMap",function(t){return t.categories||(t.pieces?t.pieces.length>0:t.splitNumber>0)&&!t.calculable?"piecewise":"continuous"}),ar(Pw.VISUAL.COMPONENT,function(t){t.eachComponent("visualMap",function(t){Qp(t)}),tm(t)});var BD={get:function(t,e,n){var o=i((GD[t]||{})[e]);return n&&y(o)?o[o.length-1]:o}},GD={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},WD=jI.mapVisual,HD=jI.eachVisual,FD=y,ZD=d,UD=Ii,XD=wi,jD=N,qD=["#f6efa6","#d88273","#bf444c"],YD=sr({type:"visualMap",dependencies:["series"],stateList:["inRange","outOfRange"],replacableOptionKeys:["inRange","outOfRange","target","controller","color"],dataBound:[-1/0,1/0],layoutMode:{type:"box",ignoreSize:!0},defaultOption:{show:!0,zlevel:0,z:4,seriesIndex:"all",min:0,max:200,dimension:null,inRange:null,outOfRange:null,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,color:null,formatter:null,text:null,textStyle:{color:"#333"}},init:function(t,e,i){this._dataExtent,this.targetVisuals={},this.controllerVisuals={},this.textStyleModel,this.itemSize,this.mergeDefaultAndTheme(t,i)},optionUpdated:function(t,e){var i=this.option;Uv.canvasSupported||(i.realtime=!1),!e&&Jg(i,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},resetVisual:function(t){var e=this.stateList;t=m(t,this),this.controllerVisuals=Kg(this.option.controller,e,t),this.targetVisuals=Kg(this.option.target,e,t)},getTargetSeriesIndices:function(){var t=this.option.seriesIndex,e=[];return null==t||"all"===t?this.ecModel.eachSeries(function(t,i){e.push(i)}):e=Oo(t),e},eachTargetSeries:function(t,e){d(this.getTargetSeriesIndices(),function(i){t.call(e,this.ecModel.getSeriesByIndex(i))},this)},isTargetSeries:function(t){var e=!1;return this.eachTargetSeries(function(i){i===t&&(e=!0)}),e},formatValueText:function(t,e,i){function n(t){return t===l[0]?"min":t===l[1]?"max":(+t).toFixed(Math.min(s,20))}var o,a,r=this.option,s=r.precision,l=this.dataBound,h=r.formatter;return i=i||["<",">"],y(t)&&(t=t.slice(),o=!0),a=e?t:o?[n(t[0]),n(t[1])]:n(t),_(h)?h.replace("{value}",o?a[0]:a).replace("{value2}",o?a[1]:a):x(h)?o?h(t[0],t[1]):h(t):o?t[0]===l[0]?i[0]+" "+a[1]:t[1]===l[1]?i[1]+" "+a[0]:a[0]+" - "+a[1]:a},resetExtent:function(){var t=this.option,e=UD([t.min,t.max]);this._dataExtent=e},getDataDimension:function(t){var e=this.option.dimension;return null!=e?e:t.dimensions.length-1},getExtent:function(){return this._dataExtent.slice()},completeVisualOption:function(){function t(t){FD(e.color)&&!t.inRange&&(t.inRange={color:e.color.slice().reverse()}),t.inRange=t.inRange||{color:qD},ZD(this.stateList,function(e){var i=t[e];if(_(i)){var n=BD.get(i,"active",s);n?(t[e]={},t[e][i]=n):delete t[e]}},this)}var e=this.option,o={inRange:e.inRange,outOfRange:e.outOfRange},a=e.target||(e.target={}),r=e.controller||(e.controller={});n(a,o),n(r,o);var s=this.isCategory();t.call(this,a),t.call(this,r),function(t,e,i){var n=t[e],o=t[i];n&&!o&&(o=t[i]={},ZD(n,function(t,e){if(jI.isValidType(e)){var i=BD.get(e,"inactive",s);null!=i&&(o[e]=i,"color"!==e||o.hasOwnProperty("opacity")||o.hasOwnProperty("colorAlpha")||(o.opacity=[0,0]))}}))}.call(this,a,"inRange","outOfRange"),function(t){var e=(t.inRange||{}).symbol||(t.outOfRange||{}).symbol,n=(t.inRange||{}).symbolSize||(t.outOfRange||{}).symbolSize,o=this.get("inactiveColor");ZD(this.stateList,function(a){var r=this.itemSize,l=t[a];l||(l=t[a]={color:s?o:[o]}),null==l.symbol&&(l.symbol=e&&i(e)||(s?"roundRect":["roundRect"])),null==l.symbolSize&&(l.symbolSize=n&&i(n)||(s?r[0]:[r[0],r[0]])),l.symbol=WD(l.symbol,function(t){return"none"===t||"square"===t?"roundRect":t});var h=l.symbolSize;if(null!=h){var u=-1/0;HD(h,function(t){t>u&&(u=t)}),l.symbolSize=WD(h,function(t){return XD(t,[0,u],[0,r[0]],!0)})}},this)}.call(this,r)},resetItemSize:function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},isCategory:function(){return!!this.option.categories},setSelected:jD,getValueState:jD,getVisualMeta:jD}),$D=[20,140],KD=YD.extend({type:"visualMap.continuous",defaultOption:{align:"auto",calculable:!1,range:null,realtime:!0,itemHeight:null,itemWidth:null,hoverLink:!0,hoverLinkDataSize:null,hoverLinkOnHandle:null},optionUpdated:function(t,e){KD.superApply(this,"optionUpdated",arguments),this.resetExtent(),this.resetVisual(function(t){t.mappingMethod="linear",t.dataExtent=this.getExtent()}),this._resetRange()},resetItemSize:function(){KD.superApply(this,"resetItemSize",arguments);var t=this.itemSize;"horizontal"===this._orient&&t.reverse(),(null==t[0]||isNaN(t[0]))&&(t[0]=$D[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=$D[1])},_resetRange:function(){var t=this.getExtent(),e=this.option.range;!e||e.auto?(t.auto=1,this.option.range=t):y(e)&&(e[0]>e[1]&&e.reverse(),e[0]=Math.max(e[0],t[0]),e[1]=Math.min(e[1],t[1]))},completeVisualOption:function(){YD.prototype.completeVisualOption.apply(this,arguments),d(this.stateList,function(t){var e=this.option.controller[t].symbolSize;e&&e[0]!==e[1]&&(e[0]=0)},this)},setSelected:function(t){this.option.range=t.slice(),this._resetRange()},getSelected:function(){var t=this.getExtent(),e=Ii((this.get("range")||[]).slice());return e[0]>t[1]&&(e[0]=t[1]),e[1]>t[1]&&(e[1]=t[1]),e[0]=i[1]||t<=e[1])?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){t[0]<=e&&e<=t[1]&&n.push(i)},!0,this),e.push({seriesId:i.id,dataIndex:n})},this),e},getVisualMeta:function(t){function e(e,i){o.push({value:e,color:t(e,i)})}for(var i=im(0,0,this.getExtent()),n=im(0,0,this.option.range.slice()),o=[],a=0,r=0,s=n.length,l=i.length;rt[1])break;i.push({color:this.getControllerVisual(a,"color",e),offset:o/100})}return i.push({color:this.getControllerVisual(t[1],"color",e),offset:1}),i},_createBarPoints:function(t,e){var i=this.visualMapModel.itemSize;return[[i[0]-e[0],t[0]],[i[0],t[0]],[i[0],t[1]],[i[0]-e[1],t[1]]]},_createBarGroup:function(t){var e=this._orient,i=this.visualMapModel.get("inverse");return new jy("horizontal"!==e||i?"horizontal"===e&&i?{scale:"bottom"===t?[-1,1]:[1,1],rotation:-Math.PI/2}:"vertical"!==e||i?{scale:"left"===t?[1,1]:[-1,1]}:{scale:"left"===t?[1,-1]:[-1,-1]}:{scale:"bottom"===t?[1,1]:[-1,1],rotation:Math.PI/2})},_updateHandle:function(t,e){if(this._useHandle){var i=this._shapes,n=this.visualMapModel,o=i.handleThumbs,a=i.handleLabels;tL([0,1],function(r){var s=o[r];s.setStyle("fill",e.handlesColor[r]),s.position[1]=t[r];var l=Io(i.handleLabelPoints[r],Mo(s,this.group));a[r].setStyle({x:l[0],y:l[1],text:n.formatValueText(this._dataInterval[r]),textVerticalAlign:"middle",textAlign:this._applyTransform("horizontal"===this._orient?0===r?"bottom":"top":"left",i.barGroup)})},this)}},_showIndicator:function(t,e,i,n){var o=this.visualMapModel,a=o.getExtent(),r=o.itemSize,s=[0,r[1]],l=QD(t,a,s,!0),h=this._shapes,u=h.indicator;if(u){u.position[1]=l,u.attr("invisible",!1),u.setShape("points",sm(!!i,n,l,r[1]));var c={convertOpacityToAlpha:!0},d=this.getControllerVisual(t,"color",c);u.setStyle("fill",d);var f=Io(h.indicatorLabelPoint,Mo(u,this.group)),g=h.indicatorLabel;g.attr("invisible",!1);var p=this._applyTransform("left",h.barGroup),m=this._orient;g.setStyle({text:(i||"")+o.formatValueText(e),textVerticalAlign:"horizontal"===m?p:"middle",textAlign:"horizontal"===m?"center":p,x:f[0],y:f[1]})}},_enableHoverLinkToSeries:function(){var t=this;this._shapes.barGroup.on("mousemove",function(e){if(t._hovering=!0,!t._dragging){var i=t.visualMapModel.itemSize,n=t._applyTransform([e.offsetX,e.offsetY],t._shapes.barGroup,!0,!0);n[1]=eL(iL(0,n[1]),i[1]),t._doHoverLinkToSeries(n[1],0<=n[0]&&n[0]<=i[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},_enableHoverLinkFromSeries:function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},_doHoverLinkToSeries:function(t,e){var i=this.visualMapModel,n=i.itemSize;if(i.option.hoverLink){var o=[0,n[1]],a=i.getExtent();t=eL(iL(o[0],t),o[1]);var r=lm(i,a,o),s=[t-r,t+r],l=QD(t,o,a,!0),h=[QD(s[0],o,a,!0),QD(s[1],o,a,!0)];s[0]o[1]&&(h[1]=1/0),e&&(h[0]===-1/0?this._showIndicator(l,h[1],"< ",r):h[1]===1/0?this._showIndicator(l,h[0],"> ",r):this._showIndicator(l,l,"≈ ",r));var u=this._hoverLinkDataIndices,c=[];(e||hm(i))&&(c=this._hoverLinkDataIndices=i.findTargetDataIndices(h));var d=Wo(u,c);this._dispatchHighDown("downplay",om(d[0])),this._dispatchHighDown("highlight",om(d[1]))}},_hoverLinkFromSeriesMouseOver:function(t){var e=t.target,i=this.visualMapModel;if(e&&null!=e.dataIndex){var n=this.ecModel.getSeriesByIndex(e.seriesIndex);if(i.isTargetSeries(n)){var o=n.getData(e.dataType),a=o.getDimension(i.getDataDimension(o)),r=o.get(a,e.dataIndex,!0);isNaN(r)||this._showIndicator(r,r)}}},_hideIndicator:function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0)},_clearHoverLinkToSeries:function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",om(t)),t.length=0},_clearHoverLinkFromSeries:function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},_applyTransform:function(t,e,i,n){var o=Mo(e,n?null:this.group);return Tb[y(t)?"applyTransform":"transformDirection"](t,o,i)},_dispatchHighDown:function(t,e){e&&e.length&&this.api.dispatchAction({type:t,batch:e})},dispose:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},remove:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()}});ir({type:"selectDataRange",event:"dataRangeSelected",update:"update"},function(t,e){e.eachComponent({mainType:"visualMap",query:t},function(e){e.setSelected(t.selected)})}),tr(VD);var rL=YD.extend({type:"visualMap.piecewise",defaultOption:{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieceList:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0,showLabel:null},optionUpdated:function(t,e){rL.superApply(this,"optionUpdated",arguments),this._pieceList=[],this.resetExtent();var n=this._mode=this._determineMode();sL[this._mode].call(this),this._resetSelected(t,e);var o=this.option.categories;this.resetVisual(function(t,e){"categories"===n?(t.mappingMethod="category",t.categories=i(o)):(t.dataExtent=this.getExtent(),t.mappingMethod="piecewise",t.pieceList=f(this._pieceList,function(t){var t=i(t);return"inRange"!==e&&(t.visual=null),t}))})},completeVisualOption:function(){function t(t,e,i){return t&&t[e]&&(b(t[e])?t[e].hasOwnProperty(i):t[e]===i)}var e=this.option,i={},n=jI.listVisualTypes(),o=this.isCategory();d(e.pieces,function(t){d(n,function(e){t.hasOwnProperty(e)&&(i[e]=1)})}),d(i,function(i,n){var a=0;d(this.stateList,function(i){a|=t(e,i,n)||t(e.target,i,n)},this),!a&&d(this.stateList,function(t){(e[t]||(e[t]={}))[n]=BD.get(n,"inRange"===t?"active":"inactive",o)})},this),YD.prototype.completeVisualOption.apply(this,arguments)},_resetSelected:function(t,e){var i=this.option,n=this._pieceList,o=(e?i:t).selected||{};if(i.selected=o,d(n,function(t,e){var i=this.getSelectedMapKey(t);o.hasOwnProperty(i)||(o[i]=!0)},this),"single"===i.selectedMode){var a=!1;d(n,function(t,e){var i=this.getSelectedMapKey(t);o[i]&&(a?o[i]=!1:a=!0)},this)}},getSelectedMapKey:function(t){return"categories"===this._mode?t.value+"":t.index+""},getPieceList:function(){return this._pieceList},_determineMode:function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},setSelected:function(t){this.option.selected=i(t)},getValueState:function(t){var e=jI.findPieceIndex(t,this._pieceList);return null!=e&&this.option.selected[this.getSelectedMapKey(this._pieceList[e])]?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){jI.findPieceIndex(e,this._pieceList)===t&&n.push(i)},!0,this),e.push({seriesId:i.id,dataIndex:n})},this),e},getRepresentValue:function(t){var e;if(this.isCategory())e=t.value;else if(null!=t.value)e=t.value;else{var i=t.interval||[];e=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return e},getVisualMeta:function(t){function e(e,a){var r=o.getRepresentValue({interval:e});a||(a=o.getValueState(r));var s=t(r,a);e[0]===-1/0?n[0]=s:e[1]===1/0?n[1]=s:i.push({value:e[0],color:s},{value:e[1],color:s})}if(!this.isCategory()){var i=[],n=[],o=this,a=this._pieceList.slice();if(a.length){var r=a[0].interval[0];r!==-1/0&&a.unshift({interval:[-1/0,r]}),(r=a[a.length-1].interval[1])!==1/0&&a.push({interval:[r,1/0]})}else a.push({interval:[-1/0,1/0]});var s=-1/0;return d(a,function(t){var i=t.interval;i&&(i[0]>s&&e([s,i[0]],"outOfRange"),e(i.slice()),s=i[1])},this),{stops:i,outerColors:n}}}}),sL={splitNumber:function(){var t=this.option,e=this._pieceList,i=Math.min(t.precision,20),n=this.getExtent(),o=t.splitNumber;o=Math.max(parseInt(o,10),1),t.splitNumber=o;for(var a=(n[1]-n[0])/o;+a.toFixed(i)!==a&&i<5;)i++;t.precision=i,a=+a.toFixed(i);var r=0;t.minOpen&&e.push({index:r++,interval:[-1/0,n[0]],close:[0,0]});for(var s=n[0],l=r+o;r","≥"][e[0]]];t.text=t.text||this.formatValueText(null!=t.value?t.value:t.interval,!1,i)},this)}};JD.extend({type:"visualMap.piecewise",doRender:function(){var t=this.group;t.removeAll();var e=this.visualMapModel,i=e.get("textGap"),n=e.textStyleModel,o=n.getFont(),a=n.getTextColor(),r=this._getItemAlign(),s=e.itemSize,l=this._getViewData(),h=l.endsText,u=I(e.get("showLabel",!0),!h);h&&this._renderEndsText(t,h[0],s,u,r),d(l.viewPieceList,function(n){var l=n.piece,h=new jy;h.onclick=m(this._onItemClick,this,l),this._enableHoverLink(h,n.indexInModelPieceList);var c=e.getRepresentValue(l);if(this._createItemSymbol(h,c,[0,0,s[0],s[1]]),u){var d=this.visualMapModel.getValueState(c);h.add(new ib({style:{x:"right"===r?-i:s[0]+i,y:s[1]/2,text:l.text,textVerticalAlign:"middle",textAlign:r,textFont:o,textFill:a,opacity:"outOfRange"===d?.5:1}}))}t.add(h)},this),h&&this._renderEndsText(t,h[1],s,u,r),Hb(e.get("orient"),t,e.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},_enableHoverLink:function(t,e){function i(t){var i=this.visualMapModel;i.option.hoverLink&&this.api.dispatchAction({type:t,batch:om(i.findTargetDataIndices(e))})}t.on("mouseover",m(i,this,"highlight")).on("mouseout",m(i,this,"downplay"))},_getItemAlign:function(){var t=this.visualMapModel,e=t.option;if("vertical"===e.orient)return nm(t,this.api,t.itemSize);var i=e.align;return i&&"auto"!==i||(i="left"),i},_renderEndsText:function(t,e,i,n,o){if(e){var a=new jy,r=this.visualMapModel.textStyleModel;a.add(new ib({style:{x:n?"right"===o?i[0]:0:i[0]/2,y:i[1]/2,textVerticalAlign:"middle",textAlign:n?o:"center",text:e,textFont:r.getFont(),textFill:r.getTextColor()}})),t.add(a)}},_getViewData:function(){var t=this.visualMapModel,e=f(t.getPieceList(),function(t,e){return{piece:t,indexInModelPieceList:e}}),i=t.get("text"),n=t.get("orient"),o=t.get("inverse");return("horizontal"===n?o:!o)?e.reverse():i&&(i=i.slice().reverse()),{viewPieceList:e,endsText:i}},_createItemSymbol:function(t,e,i){t.add(Hr(this.getControllerVisual(e,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(e,"color")))},_onItemClick:function(t){var e=this.visualMapModel,n=e.option,o=i(n.selected),a=e.getSelectedMapKey(t);"single"===n.selectedMode?(o[a]=!0,d(o,function(t,e){o[e]=e===a})):o[a]=!o[a],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}});tr(VD);var lL=Vi,hL=Gi,uL=sr({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(Uv.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,n){var o=this.constructor,r=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType),s=t[r];i&&i.data?(s?s.mergeOption(i,e,!0):(n&&dm(i),d(i.data,function(t){t instanceof Array?(dm(t[0]),dm(t[1])):dm(t)}),a(s=new o(i,this,e),{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),s.__hostSeries=t),t[r]=s):t[r]=null},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=y(i)?f(i,lL).join(", "):lL(i),o=e.getName(t),a=hL(this.name);return(null!=i||o)&&(a+="
    "),o&&(a+=hL(o),null!=i&&(a+=" : ")),null!=i&&(a+=hL(n)),a},getData:function(){return this._data},setData:function(t){this._data=t}});u(uL,Nb),uL.extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{normal:{show:!0,position:"inside"},emphasis:{show:!0}},itemStyle:{normal:{borderWidth:2}}}});var cL=l,dL=v,fL={min:dL(mm,"min"),max:dL(mm,"max"),average:dL(mm,"average")},gL=lr({type:"marker",init:function(){this.markerGroupMap=z()},render:function(t,e,i){var n=this.markerGroupMap;n.each(function(t){t.__keep=!1});var o=this.type+"Model";e.eachSeries(function(t){var n=t[o];n&&this.renderSeries(t,n,e,i)},this),n.each(function(t){!t.__keep&&this.group.remove(t.group)},this)},renderSeries:function(){}});gL.extend({type:"markPoint",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(wm(e.getData(),t,i),this.markerGroupMap.get(t.id).updateLayout(e))},this)},renderSeries:function(t,e,i,n){var o=t.coordinateSystem,a=t.id,r=t.getData(),s=this.markerGroupMap,l=s.get(a)||s.set(a,new ts),h=Sm(o,t,e);e.setData(h),wm(e.getData(),t,n),h.each(function(t){var i=h.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),h.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.normal.color")||r.getVisual("color"),symbol:i.getShallow("symbol")})}),l.updateData(h),this.group.add(l.group),h.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),l.__keep=!0,l.group.silent=e.get("silent")||t.get("silent")}}),tr(function(t){t.markPoint=t.markPoint||{}}),uL.extend({type:"markLine",defaultOption:{zlevel:0,z:5,symbol:["circle","arrow"],symbolSize:[8,16],precision:2,tooltip:{trigger:"item"},label:{normal:{show:!0,position:"end"},emphasis:{show:!0}},lineStyle:{normal:{type:"dashed"},emphasis:{width:3}},animationEasing:"linear"}});var pL=function(t,e,o,r){var s=t.getData(),l=r.type;if(!y(r)&&("min"===l||"max"===l||"average"===l||null!=r.xAxis||null!=r.yAxis)){var h,u;if(null!=r.yAxis||null!=r.xAxis)h=null!=r.yAxis?"y":"x",e.getAxis(h),u=I(r.yAxis,r.xAxis);else{var c=ym(r,s,e,t);h=c.valueDataDim,c.valueAxis,u=bm(s,h,l)}var d="x"===h?0:1,f=1-d,g=i(r),p={};g.type=null,g.coord=[],p.coord=[],g.coord[f]=-1/0,p.coord[f]=1/0;var m=o.get("precision");m>=0&&"number"==typeof u&&(u=+u.toFixed(Math.min(m,20))),g.coord[d]=p.coord[d]=u,r=[g,p,{type:l,valueIndex:r.valueIndex,value:u}]}return r=[vm(t,r[0]),vm(t,r[1]),a({},r[2])],r[2].type=r[2].type||"",n(r[2],r[0]),n(r[2],r[1]),r};gL.extend({type:"markLine",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),o=e.__from,a=e.__to;o.each(function(e){Am(o,e,!0,t,i),Am(a,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[o.getItemLayout(t),a.getItemLayout(t)])}),this.markerGroupMap.get(t.id).updateLayout()}},this)},renderSeries:function(t,e,i,n){function o(e,i,o){var a=e.getItemModel(i);Am(e,i,o,t,n),e.setItemVisual(i,{symbolSize:a.get("symbolSize")||p[o?0:1],symbol:a.get("symbol",!0)||g[o?0:1],color:a.get("itemStyle.normal.color")||s.getVisual("color")})}var a=t.coordinateSystem,r=t.id,s=t.getData(),l=this.markerGroupMap,h=l.get(r)||l.set(r,new Mu);this.group.add(h.group);var u=Cm(a,t,e),c=u.from,d=u.to,f=u.line;e.__from=c,e.__to=d,e.setData(f);var g=e.get("symbol"),p=e.get("symbolSize");y(g)||(g=[g,g]),"number"==typeof p&&(p=[p,p]),u.from.each(function(t){o(c,t,!0),o(d,t,!1)}),f.each(function(t){var e=f.getItemModel(t).get("lineStyle.normal.color");f.setItemVisual(t,{color:e||c.getItemVisual(t,"color")}),f.setItemLayout(t,[c.getItemLayout(t),d.getItemLayout(t)]),f.setItemVisual(t,{fromSymbolSize:c.getItemVisual(t,"symbolSize"),fromSymbol:c.getItemVisual(t,"symbol"),toSymbolSize:d.getItemVisual(t,"symbolSize"),toSymbol:d.getItemVisual(t,"symbol")})}),h.updateData(f),u.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),h.__keep=!0,h.group.silent=e.get("silent")||t.get("silent")}}),tr(function(t){t.markLine=t.markLine||{}}),uL.extend({type:"markArea",defaultOption:{zlevel:0,z:1,tooltip:{trigger:"item"},animation:!1,label:{normal:{show:!0,position:"top"},emphasis:{show:!0,position:"top"}},itemStyle:{normal:{borderWidth:0}}}});var mL=function(t,e,i,n){var a=vm(t,n[0]),r=vm(t,n[1]),s=I,l=a.coord,h=r.coord;l[0]=s(l[0],-1/0),l[1]=s(l[1],-1/0),h[0]=s(h[0],1/0),h[1]=s(h[1],1/0);var u=o([{},a,r]);return u.coord=[a.coord,r.coord],u.x0=a.x,u.y0=a.y,u.x1=r.x,u.y1=r.y,u},vL=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]];gL.extend({type:"markArea",updateLayout:function(t,e,i){e.eachSeries(function(t){var e=t.markAreaModel;if(e){var n=e.getData();n.each(function(e){var o=f(vL,function(o){return Pm(n,e,o,t,i)});n.setItemLayout(e,o),n.getItemGraphicEl(e).setShape("points",o)})}},this)},renderSeries:function(t,e,i,n){var o=t.coordinateSystem,a=t.name,s=t.getData(),l=this.markerGroupMap,h=l.get(a)||l.set(a,{group:new jy});this.group.add(h.group),h.__keep=!0;var u=Om(o,t,e);e.setData(u),u.each(function(e){u.setItemLayout(e,f(vL,function(i){return Pm(u,e,i,t,n)})),u.setItemVisual(e,{color:s.getVisual("color")})}),u.diff(h.__data).add(function(t){var e=new ub({shape:{points:u.getItemLayout(t)}});u.setItemGraphicEl(t,e),h.group.add(e)}).update(function(t,i){var n=h.__data.getItemGraphicEl(i);wo(n,{shape:{points:u.getItemLayout(t)}},e,t),h.group.add(n),u.setItemGraphicEl(t,n)}).remove(function(t){var e=h.__data.getItemGraphicEl(t);h.group.remove(e)}).execute(),u.eachItemGraphicEl(function(t,i){var n=u.getItemModel(i),o=n.getModel("label.normal"),a=n.getModel("label.emphasis"),s=u.getItemVisual(i,"color");t.useStyle(r(n.getModel("itemStyle.normal").getItemStyle(),{fill:Pt(s,.4),stroke:s})),t.hoverStyle=n.getModel("itemStyle.emphasis").getItemStyle(),co(t.style,t.hoverStyle,o,a,{labelFetcher:e,labelDataIndex:i,defaultText:u.getName(i)||"",isRectText:!0,autoColor:s}),uo(t,{}),t.dataModel=e}),h.__data=u,h.group.silent=e.get("silent")||t.get("silent")}}),tr(function(t){t.markArea=t.markArea||{}});Ub.registerSubTypeDefaulter("timeline",function(){return"slider"}),ir({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(t,e){var i=e.getComponent("timeline");return i&&null!=t.currentIndex&&(i.setCurrentIndex(t.currentIndex),!i.get("loop",!0)&&i.isIndexMax()&&i.setPlayState(!1)),e.resetOption("timeline"),r({currentIndex:i.option.currentIndex},t)}),ir({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(t,e){var i=e.getComponent("timeline");i&&null!=t.playState&&i.setPlayState(t.playState)});var yL=Ub.extend({type:"timeline",layoutMode:"box",defaultOption:{zlevel:0,z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{normal:{},emphasis:{}},label:{normal:{color:"#000"},emphasis:{}},data:[]},init:function(t,e,i){this._data,this._names,this.mergeDefaultAndTheme(t,i),this._initData()},mergeOption:function(t){yL.superApply(this,"mergeOption",arguments),this._initData()},setCurrentIndex:function(t){null==t&&(t=this.option.currentIndex);var e=this._data.count();this.option.loop?t=(t%e+e)%e:(t>=e&&(t=e-1),t<0&&(t=0)),this.option.currentIndex=t},getCurrentIndex:function(){return this.option.currentIndex},isIndexMax:function(){return this.getCurrentIndex()>=this._data.count()-1},setPlayState:function(t){this.option.autoPlay=!!t},getPlayState:function(){return!!this.option.autoPlay},_initData:function(){var t=this.option,e=t.data||[],n=t.axisType,o=this._names=[];if("category"===n){var a=[];d(e,function(t,e){var n,r=No(t);b(t)?(n=i(t)).value=e:n=e,a.push(n),_(r)||null!=r&&!isNaN(r)||(r=""),o.push(r+"")}),e=a}var r={category:"ordinal",time:"time"}[n]||"number";(this._data=new aS([{name:"value",type:r}],this)).initData(e,o)},getData:function(){return this._data},getCategories:function(){if("category"===this.get("axisType"))return this._names.slice()}});u(yL.extend({type:"timeline.slider",defaultOption:{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"emptyCircle",symbolSize:10,lineStyle:{show:!0,width:2,color:"#304654"},label:{position:"auto",normal:{show:!0,interval:"auto",rotate:0,color:"#304654"},emphasis:{show:!0,color:"#c23531"}},itemStyle:{normal:{color:"#304654",borderWidth:1},emphasis:{color:"#c23531"}},checkpointStyle:{symbol:"circle",symbolSize:13,color:"#c23531",borderWidth:5,borderColor:"rgba(194,53,49, 0.5)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:22,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"path://M18.6,50.8l22.5-22.5c0.2-0.2,0.3-0.4,0.3-0.7c0-0.3-0.1-0.5-0.3-0.7L18.7,4.4c-0.1-0.1-0.2-0.3-0.2-0.5 c0-0.4,0.3-0.8,0.8-0.8c0.2,0,0.5,0.1,0.6,0.3l23.5,23.5l0,0c0.2,0.2,0.3,0.4,0.3,0.7c0,0.3-0.1,0.5-0.3,0.7l-0.1,0.1L19.7,52 c-0.1,0.1-0.3,0.2-0.5,0.2c-0.4,0-0.8-0.3-0.8-0.8C18.4,51.2,18.5,51,18.6,50.8z",prevIcon:"path://M43,52.8L20.4,30.3c-0.2-0.2-0.3-0.4-0.3-0.7c0-0.3,0.1-0.5,0.3-0.7L42.9,6.4c0.1-0.1,0.2-0.3,0.2-0.5 c0-0.4-0.3-0.8-0.8-0.8c-0.2,0-0.5,0.1-0.6,0.3L18.3,28.8l0,0c-0.2,0.2-0.3,0.4-0.3,0.7c0,0.3,0.1,0.5,0.3,0.7l0.1,0.1L41.9,54 c0.1,0.1,0.3,0.2,0.5,0.2c0.4,0,0.8-0.3,0.8-0.8C43.2,53.2,43.1,53,43,52.8z",normal:{color:"#304654",borderColor:"#304654",borderWidth:1},emphasis:{color:"#c23531",borderColor:"#c23531",borderWidth:2}},data:[]}}),Nb);var xL=xw.extend({type:"timeline"}),_L=function(t,e,i,n){US.call(this,t,e,i),this.type=n||"value",this._autoLabelInterval,this.model=null};_L.prototype={constructor:_L,getLabelInterval:function(){var t=this.model,e=t.getModel("label.normal"),i=e.get("interval");return null!=i&&"auto"!=i?i:((i=this._autoLabelInterval)||(i=this._autoLabelInterval=Rr(f(this.scale.getTicks(),this.dataToCoord,this),Vr(this,e.get("formatter")),e.getFont(),"horizontal"===t.get("orient")?0:90,e.get("rotate"))),i)},isLabelIgnored:function(t){if("category"===this.type){var e=this.getLabelInterval();return"function"==typeof e&&!e(t,this.scale.getLabel(t))||t%(e+1)}}},h(_L,US);var bL=m,wL=d,SL=Math.PI;xL.extend({type:"timeline.slider",init:function(t,e){this.api=e,this._axis,this._viewRect,this._timer,this._currentPointer,this._mainGroup,this._labelGroup},render:function(t,e,i,n){if(this.model=t,this.api=i,this.ecModel=e,this.group.removeAll(),t.get("show",!0)){var o=this._layout(t,i),a=this._createGroup("mainGroup"),r=this._createGroup("labelGroup"),s=this._axis=this._createAxis(o,t);t.formatTooltip=function(t){return Gi(s.scale.getLabel(t))},wL(["AxisLine","AxisTick","Control","CurrentPointer"],function(e){this["_render"+e](o,a,s,t)},this),this._renderAxisLabel(o,r,s,t),this._position(o,t)}this._doPlayStop()},remove:function(){this._clearTimer(),this.group.removeAll()},dispose:function(){this._clearTimer()},_layout:function(t,e){var i=t.get("label.normal.position"),n=t.get("orient"),o=Rm(t,e);null==i||"auto"===i?i="horizontal"===n?o.y+o.height/2=0||"+"===i?"left":"right"},r={horizontal:i>=0||"+"===i?"top":"bottom",vertical:"middle"},s={horizontal:0,vertical:SL/2},l="vertical"===n?o.height:o.width,h=t.getModel("controlStyle"),u=h.get("show"),c=u?h.get("itemSize"):0,d=u?h.get("itemGap"):0,f=c+d,g=t.get("label.normal.rotate")||0;g=g*SL/180;var p,m,v,y,x=h.get("position",!0),_=(u=h.get("show",!0))&&h.get("showPlayBtn",!0),b=u&&h.get("showPrevBtn",!0),w=u&&h.get("showNextBtn",!0),S=0,M=l;return"left"===x||"bottom"===x?(_&&(p=[0,0],S+=f),b&&(m=[S,0],S+=f),w&&(v=[M-c,0],M-=f)):(_&&(p=[M-c,0],M-=f),b&&(m=[0,0],S+=f),w&&(v=[M-c,0],M-=f)),y=[S,M],t.get("inverse")&&y.reverse(),{viewRect:o,mainLength:l,orient:n,rotation:s[n],labelRotation:g,labelPosOpt:i,labelAlign:t.get("label.normal.align")||a[n],labelBaseline:t.get("label.normal.verticalAlign")||t.get("label.normal.baseline")||r[n],playPosition:p,prevBtnPosition:m,nextBtnPosition:v,axisExtent:y,controlSize:c,controlGap:d}},_position:function(t,e){function i(t){var e=t.position;t.origin=[c[0][0]-e[0],c[1][0]-e[1]]}function n(t){return[[t.x,t.x+t.width],[t.y,t.y+t.height]]}function o(t,e,i,n,o){t[n]+=i[n][o]-e[n][o]}var a=this._mainGroup,r=this._labelGroup,s=t.viewRect;if("vertical"===t.orient){var l=ot(),h=s.x,u=s.y+s.height;lt(l,l,[-h,-u]),ht(l,l,-SL/2),lt(l,l,[h,u]),(s=s.clone()).applyTransform(l)}var c=n(s),d=n(a.getBoundingRect()),f=n(r.getBoundingRect()),g=a.position,p=r.position;p[0]=g[0]=c[0][0];var m=t.labelPosOpt;if(isNaN(m))o(g,d,c,1,v="+"===m?0:1),o(p,f,c,1,1-v);else{var v=m>=0?0:1;o(g,d,c,1,v),p[1]=g[1]+m}a.attr("position",g),r.attr("position",p),a.rotation=r.rotation=t.rotation,i(a),i(r)},_createAxis:function(t,e){var i=e.getData(),n=e.get("axisType"),o=Er(e,n),a=i.getDataExtent("value");o.setExtent(a[0],a[1]),this._customizeScale(o,i),o.niceTicks();var r=new _L("value",o,t.axisExtent,n);return r.model=e,r},_customizeScale:function(t,e){t.getTicks=function(){return e.mapArray(["value"],function(t){return t})},t.getTicksLabels=function(){return f(this.getTicks(),t.getLabel,t)}},_createGroup:function(t){var e=this["_"+t]=new jy;return this.group.add(e),e},_renderAxisLine:function(t,e,i,n){var o=i.getExtent();n.get("lineStyle.show")&&e.add(new fb({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:a({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1}))},_renderAxisTick:function(t,e,i,n){var o=n.getData(),a=i.scale.getTicks();wL(a,function(t,a){var r=i.dataToCoord(t),s=o.getItemModel(a),l=s.getModel("itemStyle.normal"),h=s.getModel("itemStyle.emphasis"),u={position:[r,0],onclick:bL(this._changeTimeline,this,a)},c=Bm(s,l,e,u);uo(c,h.getItemStyle()),s.get("tooltip")?(c.dataIndex=a,c.dataModel=n):c.dataIndex=c.dataModel=null},this)},_renderAxisLabel:function(t,e,i,n){var o=n.getModel("label.normal");if(o.get("show")){var a=n.getData(),r=i.scale.getTicks(),s=Vr(i,o.get("formatter")),l=i.getLabelInterval();wL(r,function(n,o){if(!i.isLabelIgnored(o,l)){var r=a.getItemModel(o),h=r.getModel("label.normal"),u=r.getModel("label.emphasis"),c=i.dataToCoord(n),d=new ib({position:[c,0],rotation:t.labelRotation-t.rotation,onclick:bL(this._changeTimeline,this,o),silent:!1});fo(d.style,h,{text:s[o],textAlign:t.labelAlign,textVerticalAlign:t.labelBaseline}),e.add(d),uo(d,fo({},u))}},this)}},_renderControl:function(t,e,i,n){function o(t,i,o,u){if(t){var c=Vm(n,i,h,{position:t,origin:[a/2,0],rotation:u?-r:0,rectHover:!0,style:s,onclick:o});e.add(c),uo(c,l)}}var a=t.controlSize,r=t.rotation,s=n.getModel("controlStyle.normal").getItemStyle(),l=n.getModel("controlStyle.emphasis").getItemStyle(),h=[0,-a/2,a,a],u=n.getPlayState(),c=n.get("inverse",!0);o(t.nextBtnPosition,"controlStyle.nextIcon",bL(this._changeTimeline,this,c?"-":"+")),o(t.prevBtnPosition,"controlStyle.prevIcon",bL(this._changeTimeline,this,c?"+":"-")),o(t.playPosition,"controlStyle."+(u?"stopIcon":"playIcon"),bL(this._handlePlayClick,this,!u),!0)},_renderCurrentPointer:function(t,e,i,n){var o=n.getData(),a=n.getCurrentIndex(),r=o.getItemModel(a).getModel("checkpointStyle"),s=this,l={onCreate:function(t){t.draggable=!0,t.drift=bL(s._handlePointerDrag,s),t.ondragend=bL(s._handlePointerDragend,s),Gm(t,a,i,n,!0)},onUpdate:function(t){Gm(t,a,i,n)}};this._currentPointer=Bm(r,r,this._mainGroup,{},this._currentPointer,l)},_handlePlayClick:function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},_handlePointerDrag:function(t,e,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},_handlePointerDragend:function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},_pointerChangeTimeline:function(t,e){var i=this._toAxisCoord(t)[0],n=Ii(this._axis.getExtent().slice());i>n[1]&&(i=n[1]),ii.getHeight()&&(n.textPosition="top",l=!0);var h=l?-5-o.height:s+8;a+o.width/2>i.getWidth()?(n.textPosition=["100%",h],n.textAlign="right"):a-o.width/2<0&&(n.textPosition=[0,h],n.textAlign="left")}})}},updateView:function(t,e,i,n){d(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},updateLayout:function(t,e,i,n){d(this._features,function(t){t.updateLayout&&t.updateLayout(t.model,e,i,n)})},remove:function(t,e){d(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){d(this._features,function(i){i.dispose&&i.dispose(t,e)})}});var IL=lD.toolbox.saveAsImage;Hm.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:IL.title,type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:IL.lang.slice()},Hm.prototype.unusable=!Uv.canvasSupported,Hm.prototype.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",o=document.createElement("a"),a=i.get("type",!0)||"png";o.download=n+"."+a,o.target="_blank";var r=e.getConnectedDataURL({type:a,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(o.href=r,"function"!=typeof MouseEvent||Uv.browser.ie||Uv.browser.edge)if(window.navigator.msSaveOrOpenBlob){for(var s=atob(r.split(",")[1]),l=s.length,h=new Uint8Array(l);l--;)h[l]=s.charCodeAt(l);var u=new Blob([h]);window.navigator.msSaveOrOpenBlob(u,n+"."+a)}else{var c=i.get("lang"),d='';window.open().document.write(d)}else{var f=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});o.dispatchEvent(f)}},wp("saveAsImage",Hm);var TL=lD.toolbox.magicType;Fm.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:i(TL.title),option:{},seriesIndex:{}};var AL=Fm.prototype;AL.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return d(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var CL={line:function(t,e,i,o){if("bar"===t)return n({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},o.get("option.line")||{},!0)},bar:function(t,e,i,o){if("line"===t)return n({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},o.get("option.bar")||{},!0)},stack:function(t,e,i,o){if("line"===t||"bar"===t)return n({id:e,stack:"__ec_magicType_stack__"},o.get("option.stack")||{},!0)},tiled:function(t,e,i,o){if("line"===t||"bar"===t)return n({id:e,stack:""},o.get("option.tiled")||{},!0)}},DL=[["line","bar"],["stack","tiled"]];AL.onclick=function(t,e,i){var n=this.model,o=n.get("seriesIndex."+i);if(CL[i]){var a={series:[]};d(DL,function(t){l(t,i)>=0&&d(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==o?null:{seriesIndex:o}},function(e){var o=e.subType,s=e.id,l=CL[i](o,s,e,n);l&&(r(l,e.option),a.series.push(l));var h=e.coordinateSystem;if(h&&"cartesian2d"===h.type&&("line"===i||"bar"===i)){var u=h.getAxesByScale("ordinal")[0];if(u){var c=u.dim+"Axis",d=t.queryComponents({mainType:c,index:e.get(name+"Index"),id:e.get(name+"Id")})[0].componentIndex;a[c]=a[c]||[];for(var f=0;f<=d;f++)a[c][d]=a[c][d]||{};a[c][d].boundaryGap="bar"===i}}}),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:a})}},ir({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),wp("magicType",Fm);var LL=lD.toolbox.dataView,kL=new Array(60).join("-"),PL="\t",OL=new RegExp("["+PL+"]+","g");Qm.defaultOption={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:i(LL.title),lang:i(LL.lang),backgroundColor:"#fff",textColor:"#000",textareaColor:"#fff",textareaBorderColor:"#333",buttonColor:"#c23531",buttonTextColor:"#fff"},Qm.prototype.onclick=function(t,e){function i(){n.removeChild(a),x._dom=null}var n=e.getDom(),o=this.model;this._dom&&n.removeChild(this._dom);var a=document.createElement("div");a.style.cssText="position:absolute;left:5px;top:5px;bottom:5px;right:5px;",a.style.backgroundColor=o.get("backgroundColor")||"#fff";var r=document.createElement("h4"),s=o.get("lang")||[];r.innerHTML=s[0]||o.get("title"),r.style.cssText="margin: 10px 20px;",r.style.color=o.get("textColor");var l=document.createElement("div"),h=document.createElement("textarea");l.style.cssText="display:block;width:100%;overflow:auto;";var u=o.get("optionToContent"),c=o.get("contentToOption"),d=jm(t);if("function"==typeof u){var f=u(e.getOption());"string"==typeof f?l.innerHTML=f:S(f)&&l.appendChild(f)}else l.appendChild(h),h.readOnly=o.get("readOnly"),h.style.cssText="width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;",h.style.color=o.get("textColor"),h.style.borderColor=o.get("textareaBorderColor"),h.style.backgroundColor=o.get("textareaColor"),h.value=d.value;var g=d.meta,p=document.createElement("div");p.style.cssText="position:absolute;bottom:0;left:0;right:0;";var m="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",v=document.createElement("div"),y=document.createElement("div");m+=";background-color:"+o.get("buttonColor"),m+=";color:"+o.get("buttonTextColor");var x=this;si(v,"click",i),si(y,"click",function(){var t;try{t="function"==typeof c?c(l,e.getOption()):Jm(h.value,g)}catch(t){throw i(),new Error("Data view format error "+t)}t&&e.dispatchAction({type:"changeDataView",newOption:t}),i()}),v.innerHTML=s[1],y.innerHTML=s[2],y.style.cssText=m,v.style.cssText=m,!o.get("readOnly")&&p.appendChild(y),p.appendChild(v),si(h,"keydown",function(t){if(9===(t.keyCode||t.which)){var e=this.value,i=this.selectionStart,n=this.selectionEnd;this.value=e.substring(0,i)+PL+e.substring(n),this.selectionStart=this.selectionEnd=i+1,bx(t)}}),a.appendChild(r),a.appendChild(l),a.appendChild(p),l.style.height=n.clientHeight-80+"px",n.appendChild(a),this._dom=a},Qm.prototype.remove=function(t,e){this._dom&&e.getDom().removeChild(this._dom)},Qm.prototype.dispose=function(t,e){this.remove(t,e)},wp("dataView",Qm),ir({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(t,e){var i=[];d(t.newOption.series,function(t){var n=e.getSeriesByName(t.name)[0];if(n){var o=n.get("data");i.push({name:t.name,data:tv(t.data,o)})}else i.push(a({type:"scatter"},t))}),e.mergeOption(r({series:i},t.newOption))});var zL=d,NL="\0_ec_hist_store";bD.extend({type:"dataZoom.select"}),wD.extend({type:"dataZoom.select"});var EL=lD.toolbox.dataZoom,RL=d,VL="\0_ec_\0toolbox-dataZoom_";rv.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:i(EL.title)};var BL=rv.prototype;BL.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,hv(t,e,this,n,i),lv(t,e)},BL.onclick=function(t,e,i){GL[i].call(this)},BL.remove=function(t,e){this._brushController.unmount()},BL.dispose=function(t,e){this._brushController.dispose()};var GL={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(iv(this.ecModel))}};BL._onBrush=function(t,e){function i(t,e,i){var r=e.getAxis(t),s=r.model,l=n(t,s,a),h=l.findRepresentativeAxisProxy(s).getMinMaxSpan();null==h.minValueSpan&&null==h.maxValueSpan||(i=OT(0,i.slice(),r.scale.getExtent(),0,h.minValueSpan,h.maxValueSpan)),l&&(o[l.id]={dataZoomId:l.id,startValue:i[0],endValue:i[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(i){i.getAxisModel(t,e.componentIndex)&&(n=i)}),n}if(e.isEnd&&t.length){var o={},a=this.ecModel;this._brushController.updateCovers([]),new rp(sv(this.model.option),a,{include:["grid"]}).matchOutputRanges(t,a,function(t,e,n){if("cartesian2d"===n.type){var o=t.brushType;"rect"===o?(i("x",n,e[0]),i("y",n,e[1])):i({lineX:"x",lineY:"y"}[o],n,e)}}),ev(a,o),this._dispatchZoomAction(o)}},BL._dispatchZoomAction=function(t){var e=[];RL(t,function(t,n){e.push(i(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},wp("dataZoom",rv),tr(function(t){function e(t,e){if(e){var o=t+"Index",a=e[o];null==a||"all"==a||y(a)||(a=!1===a||"none"===a?[]:[a]),i(t,function(e,i){if(null==a||"all"==a||-1!==l(a,i)){var r={type:"select",$fromToolbox:!0,id:VL+t+i};r[o]=i,n.push(r)}})}}function i(e,i){var n=t[e];y(n)||(n=n?[n]:[]),RL(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);y(n)||(t.dataZoom=n=[n]);var o=t.toolbox;if(o&&(y(o)&&(o=o[0]),o&&o.feature)){var a=o.feature.dataZoom;e("xAxis",a),e("yAxis",a)}}});var WL=lD.toolbox.restore;uv.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:WL.title},uv.prototype.onclick=function(t,e,i){nv(t),e.dispatchAction({type:"restore",from:this.uid})},wp("restore",uv),ir({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")});var HL,FL="urn:schemas-microsoft-com:vml",ZL="undefined"==typeof window?null:window,UL=!1,XL=ZL&&ZL.document;if(XL&&!Uv.canvasSupported)try{!XL.namespaces.zrvml&&XL.namespaces.add("zrvml",FL),HL=function(t){return XL.createElement("')}}catch(t){HL=function(t){return XL.createElement("<"+t+' xmlns="'+FL+'" class="zrvml">')}}var jL=P_.CMD,qL=Math.round,YL=Math.sqrt,$L=Math.abs,KL=Math.cos,JL=Math.sin,QL=Math.max;if(!Uv.canvasSupported){var tk=21600,ek=tk/2,ik=function(t){t.style.cssText="position:absolute;left:0;top:0;width:1px;height:1px;",t.coordsize=tk+","+tk,t.coordorigin="0,0"},nk=function(t){return String(t).replace(/&/g,"&").replace(/"/g,""")},ok=function(t,e,i){return"rgb("+[t,e,i].join(",")+")"},ak=function(t,e){e&&t&&e.parentNode!==t&&t.appendChild(e)},rk=function(t,e){e&&t&&e.parentNode===t&&t.removeChild(e)},sk=function(t,e,i){return 1e5*(parseFloat(t)||0)+1e3*(parseFloat(e)||0)+i},lk=function(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t},hk=function(t,e,i){var n=Mt(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=ok(n[0],n[1],n[2]),t.opacity=i*n[3])},uk=function(t){var e=Mt(t);return[ok(e[0],e[1],e[2]),e[3]]},ck=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof yb){var o,a=0,r=[0,0],s=0,l=1,h=i.getBoundingRect(),u=h.width,c=h.height;if("linear"===n.type){o="gradient";var d=i.transform,f=[n.x*u,n.y*c],g=[n.x2*u,n.y2*c];d&&($(f,f,d),$(g,g,d));var p=g[0]-f[0],m=g[1]-f[1];(a=180*Math.atan2(p,m)/Math.PI)<0&&(a+=360),a<1e-6&&(a=0)}else{o="gradientradial";var f=[n.x*u,n.y*c],d=i.transform,v=i.scale,y=u,x=c;r=[(f[0]-h.x)/y,(f[1]-h.y)/x],d&&$(f,f,d),y/=v[0]*tk,x/=v[1]*tk;var _=QL(y,x);s=0/_,l=2*n.r/_-s}var b=n.colorStops.slice();b.sort(function(t,e){return t.offset-e.offset});for(var w=b.length,S=[],M=[],I=0;I=2){var C=S[0][0],D=S[1][0],L=S[0][1]*e.opacity,k=S[1][1]*e.opacity;t.type=o,t.method="none",t.focus="100%",t.angle=a,t.color=C,t.color2=D,t.colors=M.join(","),t.opacity=k,t.opacity2=L}"radial"===o&&(t.focusposition=r.join(","))}else hk(t,n,e.opacity)},dk=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof yb||hk(t,e.stroke,e.opacity)},fk=function(t,e,i,n){var o="fill"==e,a=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(o||!o&&i.lineWidth)?(t[o?"filled":"stroked"]="true",i[e]instanceof yb&&rk(t,a),a||(a=cv(e)),o?ck(a,i,n):dk(a,i),ak(t,a)):(t[o?"filled":"stroked"]="false",rk(t,a))},gk=[[],[],[]],pk=function(t,e){var i,n,o,a,r,s,l=jL.M,h=jL.C,u=jL.L,c=jL.A,d=jL.Q,f=[],g=t.data,p=t.len();for(a=0;a.01?O&&(z+=.0125):Math.abs(N-C)<1e-4?O&&zA?x-=.0125:x+=.0125:O&&NC?y+=.0125:y-=.0125),f.push(E,qL(((A-D)*M+w)*tk-ek),",",qL(((C-L)*I+S)*tk-ek),",",qL(((A+D)*M+w)*tk-ek),",",qL(((C+L)*I+S)*tk-ek),",",qL((z*M+w)*tk-ek),",",qL((N*I+S)*tk-ek),",",qL((y*M+w)*tk-ek),",",qL((x*I+S)*tk-ek)),r=y,s=x;break;case jL.R:var R=gk[0],V=gk[1];R[0]=g[a++],R[1]=g[a++],V[0]=R[0]+g[a++],V[1]=R[1]+g[a++],e&&($(R,R,e),$(V,V,e)),R[0]=qL(R[0]*tk-ek),V[0]=qL(V[0]*tk-ek),R[1]=qL(R[1]*tk-ek),V[1]=qL(V[1]*tk-ek),f.push(" m ",R[0],",",R[1]," l ",V[0],",",R[1]," l ",V[0],",",V[1]," l ",R[0],",",V[1]);break;case jL.Z:f.push(" x ")}if(i>0){f.push(n);for(var B=0;B100&&(xk=0,yk={});var i,n=_k.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(t){}e={style:n.fontStyle||"normal",variant:n.fontVariant||"normal",weight:n.fontWeight||"normal",size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},yk[t]=e,xk++}return e};!function(t,e){cx[t]=e}("measureText",function(t,e){var i=XL;vk||((vk=i.createElement("div")).style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",XL.body.appendChild(vk));try{vk.style.font=e}catch(t){}return vk.innerHTML="",vk.appendChild(i.createTextNode(t)),{width:vk.offsetWidth}});for(var wk=new jt,Sk=[px,je,qe,Nn,ib],Mk=0;Mk=o&&h+1>=a){for(var u=[],c=0;c=o&&c+1>=a)return Cv(0,s.components);l[i]=s}else l[i]=void 0}r++}();if(d)return d}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon:function(t,e,i,n){for(var o=e.length,a=i.length,r=t.newPos,s=r-n,l=0;r+1=0;--n)if(e[n]===t)return!0;return!1}),i):null:i[0]},Lv.prototype.update=function(t,e){if(t){var i=this.getDefs(!1);if(t._dom&&i.contains(t._dom))"function"==typeof e&&e();else{var n=this.add(t);n&&(t._dom=n)}}},Lv.prototype.addDom=function(t){this.getDefs(!0).appendChild(t)},Lv.prototype.removeDom=function(t){this.getDefs(!1).removeChild(t._dom)},Lv.prototype.getDoms=function(){var t=this.getDefs(!1);if(!t)return[];var e=[];return d(this._tagNames,function(i){var n=t.getElementsByTagName(i);e=e.concat([].slice.call(n))}),e},Lv.prototype.markAllUnused=function(){var t=this;d(this.getDoms(),function(e){e[t._markLabel]="0"})},Lv.prototype.markUsed=function(t){t&&(t[this._markLabel]="1")},Lv.prototype.removeUnused=function(){var t=this.getDefs(!1);if(t){var e=this;d(this.getDoms(),function(i){"1"!==i[e._markLabel]&&t.removeChild(i)})}},Lv.prototype.getSvgProxy=function(t){return t instanceof Nn?Rk:t instanceof qe?Vk:t instanceof ib?Bk:Rk},Lv.prototype.getTextSvgElement=function(t){return t.__textSvgEl},Lv.prototype.getSvgElement=function(t){return t.__svgEl},h(kv,Lv),kv.prototype.addWithoutUpdate=function(t,e){if(e&&e.style){var i=this;d(["fill","stroke"],function(n){if(e.style[n]&&("linear"===e.style[n].type||"radial"===e.style[n].type)){var o,a=e.style[n],r=i.getDefs(!0);a._dom?(o=a._dom,r.contains(a._dom)||i.addDom(o)):o=i.add(a),i.markUsed(e);var s=o.getAttribute("id");t.setAttribute(n,"url(#"+s+")")}})}},kv.prototype.add=function(t){var e;if("linear"===t.type)e=this.createElement("linearGradient");else{if("radial"!==t.type)return Wy("Illegal gradient type."),null;e=this.createElement("radialGradient")}return t.id=t.id||this.nextId++,e.setAttribute("id","zr-gradient-"+t.id),this.updateDom(t,e),this.addDom(e),e},kv.prototype.update=function(t){var e=this;Lv.prototype.update.call(this,t,function(){var i=t.type,n=t._dom.tagName;"linear"===i&&"linearGradient"===n||"radial"===i&&"radialGradient"===n?e.updateDom(t,t._dom):(e.removeDom(t),e.add(t))})},kv.prototype.updateDom=function(t,e){if("linear"===t.type)e.setAttribute("x1",t.x),e.setAttribute("y1",t.y),e.setAttribute("x2",t.x2),e.setAttribute("y2",t.y2);else{if("radial"!==t.type)return void Wy("Illegal gradient type.");e.setAttribute("cx",t.x),e.setAttribute("cy",t.y),e.setAttribute("r",t.r)}t.global?e.setAttribute("gradientUnits","userSpaceOnUse"):e.setAttribute("gradientUnits","objectBoundingBox"),e.innerHTML="";for(var i=t.colorStops,n=0,o=i.length;n0){var n,o,a=this.getDefs(!0),r=e[0],s=i?"_textDom":"_dom";r[s]?(o=r[s].getAttribute("id"),n=r[s],a.contains(n)||a.appendChild(n)):(o="zr-clip-"+this.nextId,++this.nextId,(n=this.createElement("clipPath")).setAttribute("id",o),a.appendChild(n),r[s]=n);var l=this.getSvgProxy(r);if(r.transform&&r.parent.invTransform&&!i){var h=Array.prototype.slice.call(r.transform);st(r.transform,r.parent.invTransform,r.transform),l.brush(r),r.transform=h}else l.brush(r);var u=this.getSvgElement(r);n.appendChild(u.cloneNode()),t.setAttribute("clip-path","url(#"+o+")"),e.length>1&&this.updateDom(n,e.slice(1),i)}else t&&t.setAttribute("clip-path","none")},Pv.prototype.markUsed=function(t){var e=this;t.__clipPaths&&t.__clipPaths.length>0&&d(t.__clipPaths,function(t){t._dom&&Lv.prototype.markUsed.call(e,t._dom),t._textDom&&Lv.prototype.markUsed.call(e,t._textDom)})};var Zk=function(t,e){this.root=t,this.storage=e;var i=mv("svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("version","1.1"),i.setAttribute("baseProfile","full"),i.style["user-select"]="none",this.gradientManager=new kv(i),this.clipPathManager=new Pv(i);var n=document.createElement("div");n.style.cssText="overflow: hidden;",this._svgRoot=i,this._viewport=n,t.appendChild(n),n.appendChild(i),this.resize(),this._visibleList=[]};Zk.prototype={constructor:Zk,getType:function(){return"svg"},getViewportRoot:function(){return this._viewport},getViewportRootOffset:function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},refresh:function(){var t=this.storage.getDisplayList(!0);this._paintList(t)},_paintList:function(t){this.gradientManager.markAllUnused(),this.clipPathManager.markAllUnused();var e,i=this._svgRoot,n=this._visibleList,o=t.length,a=[];for(e=0;e=0;--n)if(e[n]===t)return!0;return!1}),i):null:i[0]},resize:function(){var t=this._getWidth(),e=this._getHeight();if(this._width!==t&&this._height!==e){this._width=t,this._height=e;var i=this._viewport.style;i.width=t+"px",i.height=e+"px";var n=this._svgRoot;n.setAttribute("width",t),n.setAttribute("height",e)}},getWidth:function(){return this._getWidth()},getHeight:function(){return this._getHeight()},_getWidth:function(){var t=this.root,e=document.defaultView.getComputedStyle(t);return(t.clientWidth||Ov(e.width))-Ov(e.paddingLeft)-Ov(e.paddingRight)|0},_getHeight:function(){var t=this.root,e=document.defaultView.getComputedStyle(t);return(t.clientHeight||Ov(e.height))-Ov(e.paddingTop)-Ov(e.paddingBottom)|0},dispose:function(){this.root.innerHTML="",this._svgRoot=this._viewport=this.storage=null},clear:function(){this._viewport&&this.root.removeChild(this._viewport)},pathToSvg:function(){this.refresh();var t=this._svgRoot.outerHTML;return"data:img/svg+xml;utf-8,"+unescape(t)}},d(["getLayer","insertLayer","eachLayer","eachBuiltinLayer","eachOtherLayer","getLayers","modLayer","delLayer","clearLayer","toDataURL","pathToImage"],function(t){Zk.prototype[t]=Wv(t)}),xi("svg",Zk),t.version="3.8.4",t.dependencies=Cw,t.PRIORITY=Pw,t.init=function(t,e,i){var n=Qa(t);if(n)return n;var o=new za(t,e,i);return o.id="ec_"+Yw++,jw[o.id]=o,t.setAttribute?t.setAttribute(Kw,o.id):t[Kw]=o.id,Ka(o),o},t.connect=function(t){if(y(t)){var e=t;t=null,d(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+$w++,d(e,function(e){e.group=t})}return qw[t]=!0,t},t.disConnect=Ja,t.disconnect=Qw,t.dispose=function(t){"string"==typeof t?t=jw[t]:t instanceof za||(t=Qa(t)),t instanceof za&&!t.isDisposed()&&t.dispose()},t.getInstanceByDom=Qa,t.getInstanceById=function(t){return jw[t]},t.registerTheme=function(t,e){Uw[t]=e},t.registerPreprocessor=tr,t.registerProcessor=er,t.registerPostUpdate=function(t){Fw.push(t)},t.registerAction=ir,t.registerCoordinateSystem=nr,t.getCoordinateSystemDimensions=function(t){var e=ua.get(t);if(e)return e.getDimensionsInfo?e.getDimensionsInfo():e.dimensions.slice()},t.registerLayout=or,t.registerVisual=ar,t.registerLoading=rr,t.extendComponentModel=sr,t.extendComponentView=lr,t.extendSeriesModel=hr,t.extendChartView=ur,t.setCanvasCreator=function(t){e("createCanvas",t)},t.registerMap=function(t,e,i){e.geoJson&&!e.features&&(i=e.specialAreas,e=e.geoJson),"string"==typeof e&&(e="undefined"!=typeof JSON&&JSON.parse?JSON.parse(e):new Function("return ("+e+");")()),Jw[t]={geoJson:e,specialAreas:i}},t.getMap=cr,t.dataTool=tS,t.zrender=Nx,t.graphic=Tb,t.number=Bx,t.format=Xx,t.throttle=Da,t.helper=HS,t.matrix=yy,t.vector=cy,t.color=Ny,t.util=qS,t.List=aS,t.Model=Lo,t.Axis=US,t.env=Uv,t.parseGeoJson=jS}); diff --git a/admin/static/js/edittable/index.js b/admin/static/js/edittable/index.js new file mode 100644 index 0000000..8111932 --- /dev/null +++ b/admin/static/js/edittable/index.js @@ -0,0 +1,192 @@ + +layui.use(["index", "api", "tpl", "dialog", "laypage", 'dynamicTr'], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laypage = layui.laypage; + var LIST_TABLE_URL = layui.api.getMockApiUrl("edittable", "list"); + var List_TABLE_ADD_URL = layui.api.getMockApiUrl( + "edittable", + "insert" + ); + var LIST_TABLE_UPDATE_URL = layui.api.getMockApiUrl( + "edittable", + "update" + ); + var LIST_TABLE_DELETE_URL = layui.api.getMockApiUrl( + "edittable", + "delete" + ); + var where = { + data: "", + }; + var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId + var LIST_TABLE_ID = "listTable"; // table ElementId + // table field 配置 + var LIST_TABLE_COLS = [{ + field: "id", + title: "id", + align: "left", + hide: true, + }, + { + field: "groupName", + title: "分组名称", + align: "left", + // edit:"text" + }, + { + field: "remark", + title: "备注", + align: "left", + // edit:"text" + }, + { + fixed: "right", + title: "操作", + width: 88, + align: "left", + toolbar: "#cellOperating", + }, + ]; + var isEdit = false; + + init(); // 创建 + + $(".add-dialog").click(function (e) { + e.stopPropagation(); + if (isEdit) { + layer.msg("有一个在编辑"); + return false; + } + isEdit = true; + $("tbody").before(layui.dynamicTr.addTr(LIST_TABLE_COLS)); + form.render(); + }); + + //单元格 操作列中 操作事件 + table.on("tool(" + LIST_TABLE_ID + ")", function (obj) { + var data = obj.data; + var layEvent = obj.event; + debugger; + if (layEvent === "add") { + var addField = layui.dynamicTr.addFormFiled(LIST_TABLE_COLS); + if (!addField) { + return false; + } + admin.req({ + url: List_TABLE_ADD_URL, + data: addField, + success: function (res) { + layer.msg("新增成功"); + isEdit = false; + layui.table.reload(LIST_TABLE_ID, { where: where }); + }, + }); + } else if (layEvent === "save") { + var editField = layui.dynamicTr.editFormFiled(LIST_TABLE_COLS, data); + if (!editField) { + return false; + } + admin.req({ + url: LIST_TABLE_UPDATE_URL, + data: editField, + success: function (res) { + layer.msg("编辑成功"); + layui.table.reload(LIST_TABLE_ID, { where: where }); + + // obj.update(editField); + isEdit = false; + }, + }); + } else if (layEvent === "cancel") { + layui.table.reload(LIST_TABLE_ID, { where: where }); + isEdit = false; + } else if (layEvent === "edit") { + if (isEdit) { + layer.msg("有一个在编辑"); + return false; + } + var target = $(obj.tr); + $(target).html(layui.dynamicTr.editTr(LIST_TABLE_COLS, data)); + isEdit = false; + } else if (layEvent === "delete") { + layer.confirm( + "", { + title: "提示", + area: ["520px", "270px"], + content: '
    确定删除分组吗?
    ', + btnAlign: "r", + btn: ["取消", "确认"], + }, + function (index, layero) { + layer.close(index); + }, + function (index) { + admin.req({ + url: LIST_TABLE_DELETE_URL, + data: { data: obj.data }, + success: function (res) { + if (res) { + obj.del(); + layer.close(index); + } else { + layui.dialog.showOkMsgDialog({ + msg: "无法删除,请先清空组内数据源和节点信息。", + }); + return false; + } + }, + }); + } + ); + } + }); + + function init() { + getTableData(); + } + + function getTableData() { + var tableRenderOptions = { + height: 600, + id: LIST_TABLE_ID, + elem: "#" + LIST_TABLE_ID, + url: LIST_TABLE_URL, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + parseData: function (res) { + return { + code: 0, + msg: "", + //count: res.totalSize, + data: res.data, + }; + }, + }; + table.render(tableRenderOptions); + // laypage.render({ + // elem: "pages", + // count: 100, + // layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + // jump: function jump(obj) { + // } + // }); + // admin.req({ + // url: LIST_TABLE_URL, + // data: where, + // success: function (res) { + // tableRenderOptions.data = res; + // table.render(tableRenderOptions); + // }, + // error:function(err){ + // table.render(tableRenderOptions); + // } + // }); + } +}); \ No newline at end of file diff --git a/admin/static/js/excel/export.js b/admin/static/js/excel/export.js new file mode 100644 index 0000000..1fa1b50 --- /dev/null +++ b/admin/static/js/excel/export.js @@ -0,0 +1,125 @@ +layui.config({ + base: './../../static/layui/layui_exts/' +}).use(['table', 'excel'], function () { + var table = layui.table //表格 + , + $ = layui.$, + excel = layui.excel; + + var LIST_TABLE_ID = "listTable"; // table ElementId + + $(".export-button").click(function (e) { + exportFile('listTable'); + }); + //执行一个 table 实例 + table.render({ + elem: '#listTable', + height: 420, + data: [{ id: 1, username: '小毛', city: '长沙', birth: '1990-06-16', createTime: '2020-01-01', remark: '备注' }], + // url: './data.json', //数据接口 + title: '用户表', + page: true, //开启分页 + toolbar: '#toolbarDemo', //操作1:启用自定义模板表格头部工具栏 + defaultToolbar: [], //操作2:隐藏头部工具栏右侧的图标 + cols: [ + [ //表头 + { + type: 'checkbox', + fixed: 'left' + }, { + field: 'id', + title: 'ID', + width: 200, + sort: true + }, { + field: 'username', + title: '用户名', + width: 100 + }, { + field: 'city', + title: '城市', + width: 100 + }, { + field: 'birth', + title: '生日', + width: 120, + sort: true, + totalRow: true + }, { + field: 'createTime', + title: '创建日期', + width: 180 + }, { + field: 'remark', + title: '备注', + width: 300 + } + ] + ] + }); + + //监听头工具栏事件 + table.on('toolbar(test)', function (obj) { + var checkStatus = table.checkStatus(obj.config.id), + data = checkStatus.data; //获取选中的数据 + switch (obj.event) { + case 'table_export': + exportFile('demo') + break; + }; + }); + + /** + * by yutons + * Array.from() 非常方便的将一个类数组的集合 ==》 数组,直接使用数组身上的方法。例如:常用的map,foreach… + * 但是,问题来了,IE不识别Array.from这个方法。所以写了它兼容IE的写法。 + */ + if (!Array.from) { + Array.from = function (el) { + return Array.apply(this, el); + } + } + //表格导出 + function exportFile(id) { + //根据传入tableID获取表头 + var headers = $("div[lay-id=" + id + "] .layui-table-box table").get(0); + var htrs = Array.from(headers.querySelectorAll('tr')); + var titles = {}; + for (var j = 0; j < htrs.length; j++) { + var hths = Array.from(htrs[j].querySelectorAll("th")); + for (var i = 0; i < hths.length; i++) { + var clazz = hths[i].getAttributeNode('class').value; + if (clazz != ' layui-table-col-special' && clazz != 'layui-hide') { + //排除居左、具有、隐藏字段 + //修改:默认字段data-field+i,兼容部分数据表格中不存在data-field值的问题 + titles['data-field' + i] = hths[i].innerText; + } + } + } + //根据传入tableID获取table内容 + var bodys = $("div[lay-id=" + id + "] .layui-table-box table").get(1); + var btrs = Array.from(bodys.querySelectorAll("tr")) + var bodysArr = new Array(); + for (var j = 0; j < btrs.length; j++) { + var contents = {}; + var btds = Array.from(btrs[j].querySelectorAll("td")); + for (var i = 0; i < btds.length; i++) { + for (var key in titles) { + //修改:默认字段data-field+i,兼容部分数据表格中不存在data-field值的问题 + var field = 'data-field' + i; + if (field === key) { + //根据表头字段获取table内容字段 + contents[field] = btds[i].innerText; + } + } + } + bodysArr.push(contents) + } + //将标题行置顶添加到数组 + bodysArr.unshift(titles); + //导出excel + excel.exportExcel({ + sheet1: bodysArr + }, '表' + new Date().toLocaleString() + '.xlsx', 'xlsx'); + } +}); \ No newline at end of file diff --git a/admin/static/js/excel/upload.js b/admin/static/js/excel/upload.js new file mode 100644 index 0000000..4a30722 --- /dev/null +++ b/admin/static/js/excel/upload.js @@ -0,0 +1,80 @@ +layui.config({ + base: './../../static/layui/layui_exts/' +}).use(['table', 'excel'], function () { + var table = layui.table //表格 + , + $ = layui.$, + excel = layui.excel; + $('#LAY-excel-import-excel').change(function (e) { + // 注意:这里直接引用 e.target.files 会导致 FileList 对象在读取之前变化,导致无法弹出文件 + var files = Object.values(e.target.files) + uploadExcel(files) + // 变更完清空,否则选择同一个文件不触发此事件 + e.target.value = '' + }) + // 文件拖拽 + document.body.ondragover = function (e) { + e.preventDefault() + } + document.body.ondrop = function (e) { + e.preventDefault() + var files = e.dataTransfer.files + uploadExcel(files) + } + + if (!Array.from) { + Array.from = function (el) { + return Array.apply(this, el); + } + } + + /** + * 上传excel的处理函数,传入文件对象数组 + * @param {FileList} files [description] + * @return {[type]} [description] + */ + function uploadExcel(files) { + try { + excel.importExcel(files, { + // 可以在读取数据的同时梳理数据 + /*fields: { + 'id': 'A' + , 'username': 'B' + , 'experience': 'C' + , 'sex': 'D' + , 'score': 'E' + , 'city': 'F' + , 'classify': 'G' + , 'wealth': 'H' + , 'sign': 'I' + }*/ + }, function (data, book) { + // data: {1: {sheet1: [{id: 1, name: 2}, {...}]}}// 工作表的数据对象 + // book: {1: {Sheets: {}, Props: {}, ....}} // 工作表的整个原生对象,https://github.com/SheetJS/js-xlsx#workbook-object + // 也可以全部读取出来再进行数据梳理 + /* data = excel.filterImportData(data, { + 'id': 'A' + , 'username': 'B' + , 'experience': 'C' + , 'sex': 'D' + , 'score': 'E' + , 'city': 'F' + , 'classify': 'G' + , 'wealth': 'H' + , 'sign': 'I' + })*/ + // 如果不需要展示直接上传,可以再次 $.ajax() 将JSON数据通过 JSON.stringify() 处理后传递到后端即可 + /** + * 2019-06-21 JeffreyWang 应群友需求,加一个单元格合并还原转换 + * 思路: + * 1. 渲染时为每个cell加上唯一的ID,demo里边采用 table-export-文件索引-sheet名称-行索引-列索引 + * 2. 根据 book[文件索引].Sheets[sheet名称]['!merge'] 参数,取左上角元素设置 colspan 以及 rowspan,并删除其他元素 + */ + console.log(data, book); + }) + } catch (e) { + layer.alert(e.message) + } + } + +}); \ No newline at end of file diff --git a/admin/static/js/form/index.js b/admin/static/js/form/index.js new file mode 100644 index 0000000..4d788c3 --- /dev/null +++ b/admin/static/js/form/index.js @@ -0,0 +1,97 @@ + +layui.use(['form', 'layedit', 'tpl', 'laydate'], function () { + var form = layui.form + , layer = layui.layer + , layedit = layui.layedit + , laydate = layui.laydate; + var where = {}; + + var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId + init(); + form.on(`submit(${FORM_QUERY_ID})`, function (data) { + console.log("查询:", data.field); + table.reload(LIST_TABLE_ID, { where }); + }); + function init() { + getSelectData(); + } + function getSelectData() { + var data = { list: [] }; + var res = [ + { name: "1111", value: "1111" }, + { name: "2222", value: "2222" }, + ]; + var list = [{ name: "请选择", value: "" }]; + for (var item in res) { + var selected = false; + list.push({ + name: res[item].name, + value: res[item].value, + selected: selected, + }); + } + data.list = list; + layui.tpl.setSelectTpl("testIdSelect", data); + } + //日期 + laydate.render({ + elem: '#date' + }); + laydate.render({ + elem: '#date1' + }); + //创建一个编辑器 + var editIndex = layedit.build('LAY_demo_editor'); + + //自定义验证规则 + form.verify({ + title: function (value) { + if (value.length < 5) { + return '标题至少得5个字符啊'; + } + } + , pass: [ + /^[\S]{6,12}$/ + , '密码必须6到12位,且不能出现空格' + ] + , content: function (value) { + layedit.sync(editIndex); + } + }); + + //监听指定开关 + form.on('switch(switchTest)', function (data) { + layer.msg('开关checked:' + (this.checked ? 'true' : 'false'), { + offset: '6px' + }); + layer.tips('温馨提示:请注意开关状态的文字可以随意定义,而不仅仅是ON|OFF', data.othis) + }); + + //监听提交 + form.on('submit(demo1)', function (data) { + layer.alert(JSON.stringify(data.field), { + title: '最终的提交信息' + }) + return false; + }); + + //表单赋值 + layui.$('#LAY-component-form-setval').on('click', function () { + form.val('example', { + "username": "贤心" // "name": "value" + , "password": "123456" + , "interest": 1 + , "like[write]": true //复选框选中状态 + , "close": true //开关状态 + , "sex": "女" + , "desc": "我爱 layui" + }); + }); + + //表单取值 + layui.$('#LAY-component-form-getval').on('click', function () { + var data = form.val('example'); + alert(JSON.stringify(data)); + }); + +}); \ No newline at end of file diff --git a/admin/static/js/index.js b/admin/static/js/index.js new file mode 100644 index 0000000..3c115df --- /dev/null +++ b/admin/static/js/index.js @@ -0,0 +1,81 @@ +!function (win, doc) { + var d = doc.documentElement; + function change() { + d.style.fontSize = d.clientWidth / 10 + 'px'; + } + win.addEventListener('resize', change, false); + change(); +}(window, document); +layui.use(["layer", "element"], function () { + var $ = layui.$, + layer = layui.layer, + element = layui.element; $(".main-tree .left-menu").on("click", function (e) { + e.stopPropagation(); + var src = $(this).attr("lay-href"); + var title = $(this).attr("lay-title"); + $('.left-menu').removeClass("layui-this"); + $(this).addClass("layui-this"); + iframeToHref(src); + }); + $(".left-fold-box").on("click", function (e) { + e.stopPropagation(); + $(".left-side").hide(); + $(".layui-body").addClass("left-0").removeClass("left-230"); + var iframe = document.getElementById('iframe'); + var innerDoc = (iframe.contentDocument) + ? iframe.contentDocument + : iframe.contentWindow.document; + innerDoc.querySelector("#rightFold > .logo").classList.remove('display-none'); + innerDoc.querySelector("#rightFold > .unfold").classList.remove('display-none'); + }); + $(".right-fold-box .back-url").on("click", function () { + if ($(this).attr("lay-href")) { + iframeToHref($(this).attr("lay-href")); + } + }); + // 子菜单展开收缩 + $(".menu-box").on('click', ".open-icon", function (e) { + e.stopPropagation(); + $(this).removeClass('open-icon'); + $(this).addClass('close-icon'); + $(this).parent().siblings().addClass("display-none"); + }); + $(".menu-box").on('click', ".close-icon", function (e) { + e.stopPropagation(); + $(this).removeClass('close-icon'); + $(this).addClass('open-icon'); + $(this).parent().siblings().removeClass("display-none"); + }); + + var leftMenuChange = function () { + var iframe = document.getElementById('iframe'); + var innerDoc = (iframe.contentDocument) + ? iframe.contentDocument + : iframe.contentWindow.document; + innerDoc.querySelector("#rightFold > .logo").classList.add('display-none'); + innerDoc.querySelector("#rightFold > .unfold").classList.add('display-none'); + $(".layui-body").addClass("left-230").removeClass("left-0"); + $(".left-side").show(); + } + var rightMenuChange = function () { + var iframe = document.getElementById('iframe'); + var innerDoc = (iframe.contentDocument) + ? iframe.contentDocument + : iframe.contentWindow.document; + innerDoc.querySelector("#rightFold > .logo").classList.remove('display-none'); + innerDoc.querySelector("#rightFold > .unfold").classList.remove('display-none'); + $(".layui-body").removeClass("left-230").addClass("left-0"); + $(".left-side").hide(); + } + var iframeToHref = function (url) { + var iframe = document.getElementById("iframe"); + iframe.src = url; + }; + var routerPush = function ({ url, breadcrumb }) { + iframeToHref(url); + }; + + window.routerPush = routerPush; + window.leftMenuChange = leftMenuChange; + window.rightMenuChange = rightMenuChange; +}); diff --git a/admin/static/js/step/index.js b/admin/static/js/step/index.js new file mode 100644 index 0000000..a8a1e9e --- /dev/null +++ b/admin/static/js/step/index.js @@ -0,0 +1,294 @@ + +layui.use(["index", "api", "tpl"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + laypage = layui.laypage, + admin = layui.admin; + var sourceTitle = ""; + var selectSourceNode = { id: "", name: "" }; + var targetNodeId = []; + var selectTargetNode = []; + var unSelectTargetNodeId = ""; + var LIST_TABLE_ID = "listTable"; // table ElementId + var LIST_TABLE_DATA = [ + { + name: "层MySQL密码格式检查", + content: "检查数据传输服务器是否能连通源数据库", + tips: "查数据传输服务器失败", + status: "1", + }, + { + name: "层MySQL密码格式检查", + content: "检查数据传输服务器是否能连通源数据库", + tips: "查数据传输服务器失败", + status: "2", + }, + { + name: "层MySQL密码格式检查", + content: "检查数据传输服务器是否能连通源数据库", + tips: "查数据传输服务器失败", + status: "1", + }, + { + name: "层MySQL密码格式检查", + content: "检查数据传输服务器是否能连通源数据库", + tips: "查数据传输服务器失败", + status: "2", + }, + { + name: "层MySQL密码格式检查", + content: "检查数据传输服务器是否能连通源数据库", + tips: "查数据传输服务器失败", + status: "1", + }, + ]; + // table field 配置 + var LIST_TABLE_COLS = [ + { + field: "name", + title: "检查项", + align: "left", + }, + { + field: "content", + title: "检查内容", + align: "left", + }, + { + field: "tips", + title: "消息提醒", + align: "left", + }, + { + field: "status", + title: "检查结果", + align: "left", + templet: function templet(d) { + if (d.status == "1") { + return "成功"; + } else if (d.status == "2") { + return `
    失败
    `; + } + return ""; + }, + }, + ]; + //step1 + form.on("submit(lay-step1-submit)", function (data) { + console.log("step1:", data.field); + element.progress("progress", "50%"); + $($(".step-ul").children()[1]).addClass("active"); + sourceTitle = "sales_order"; //获取了源码名称 + $(".source-title").html(sourceTitle); + getSourceNodeLIst(); + $(".step-2") + .removeClass("display-none") + .siblings() + .addClass("display-none"); + }); + //step2 + form.on("submit(lay-step2-pre-submit)", function (data) { + console.log("step1:", data.field); + element.progress("progress", "25%"); + $($(".step-ul").children()[0]).addClass("active"); + $($(".step-ul").children()[1]).removeClass("active"); + $(".step-1") + .removeClass("display-none") + .siblings() + .addClass("display-none"); + }); + form.on("submit(lay-step2-next-submit)", function () { + element.progress("progress", "75%"); + $($(".step-ul").children()[2]).addClass("active"); + $(".step-3") + .removeClass("display-none") + .siblings() + .addClass("display-none"); + }); + $(".source-tree-list").on("click", ".tree-node", function (e) { + e.stopPropagation(); + selectSourceNode.id = $(this).attr("data-id"); + selectSourceNode.name = $(this).attr("data-name"); + console.log("tree-node selectSourceNode:", selectSourceNode); + $(this).addClass("active").siblings().removeClass("active"); + }); + $(".opr-box .icon-next").on("click", function () { + if (selectSourceNode.name == "") { + layer.msg("请选择源对象"); + return false; + } + if (targetNodeId.includes(selectSourceNode.id)) { + layer.msg("已选择"); + return false; + } + changeTargetNode(); + }); + + $(".opr-box .icon-pre").on("click", function () { + console.log("icon-pre"); + if (unSelectTargetNodeId == "") { + layer.msg("请选择目标对象"); + return false; + } + resetTargetNodes(unSelectTargetNodeId); + }); + + $(".target-tree-list").on("click", ".tree-node", function () { + console.log(".target-tree-list .tree-node", $(this).attr("data-id")); + $(this).addClass("active").siblings().removeClass("active"); + unSelectTargetNodeId = $(this).attr("data-id"); + }); + + function changeTargetNode() { + targetNodeId.push(selectSourceNode.id); + totalNodes(); + selectTargetNode.push({ + id: selectSourceNode.id, + name: selectSourceNode.name, + }); + var ddHtml = `
    ${selectSourceNode.name}编辑
    `; + $(".target-tree-list").append(ddHtml); + } + function totalNodes() { + $(".total-nodes").html(`(${targetNodeId.length}个对象)`); + } + function getSourceNodeLIst() { + targetNodeId = []; + var data = [ + { id: "1", name: "sales_orderpromotion1" }, + { id: "2", name: "sales_orderpromotion2" }, + { id: "3", name: "sales_orderpromotion3" }, + ]; + var html = ""; + data.forEach((element) => { + html += `
    ${element.name}
    + `; + }); + $(".source-tree-list").html(html); + } + function resetTargetNodes(selectId) { + var html = ""; + var newSelectNode = []; + targetNodeId = []; + selectTargetNode.forEach((element) => { + if (element.id != selectId) { + html += `
    ${element.name}编辑
    `; + targetNodeId.push(element.id); + newSelectNode.push({ id: element.id, name: element.name }); + } + }); + $(".target-tree-list").html(html); + selectTargetNode = newSelectNode; + totalNodes(); + unSelectTargetNodeId = ""; + } + $(".target-tree-list").on("click", ".edit", function (e) { + e.stopPropagation(); + editDialog({ id: $(this).parent().attr('data-id'), name: $(this).parent().attr('data-name') }); + }); + function editDialog({ id, name }) { + console.log('editDialog:id,name:', id, name); + var templet = $("#formDialogTemplate").html(); + layui.laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: "编辑表", + content: templet, + area: ["620px", "640px"], + success: function success() { + table.render({ + elem: "#editTable", + data: [ + { id: 1, col: "acount_money", type: "decimal(11,2)" }, + { id: 1, col: "acount_money", type: "decimal(11,2)" }, + ], + defaultToolbar: [], + toolbar: "#toolbarDemo", + title: "用户数据表", + cols: [ + [ + { type: "checkbox", width: 20 }, + { field: "id", title: "ID", hide: true }, + { field: "col", title: "列名", width: 250, edit: "text" }, + { field: "type", title: "类型", width: 250, edit: "text" }, + ], + ], + page: false, + }); + }, + }); + }); + } + table.on("toolbar(editTable)", function (obj) { + var checkStatus = table.checkStatus(obj.config.id); + if (obj.event == "getCheckData") { + var data = checkStatus.data; + if (data.length == 0) { + layer.msg('请选择列'); + return false; + } + + // admin.req({ + // url: url, + // data: params, + // success: function (res) { + // layer.msg('成功'); + // }, + // }); + layer.close(layer.index); + } + }); + + //step3 + form.on("submit(lay-step3-pre-submit)", function () { + element.progress("progress", "50%"); + $($(".step-ul").children()[1]).addClass("active"); + $($(".step-ul").children()[2]).removeClass("active"); + $(".step-2") + .removeClass("display-none") + .siblings() + .addClass("display-none"); + }); + form.on("submit(lay-step3-next-submit)", function () { + element.progress("progress", "100%"); + $($(".step-ul").children()[3]).addClass("active"); + $(".active-after").addClass("display-none"); + $(".step-4") + .removeClass("display-none") + .siblings() + .addClass("display-none"); + getTableData(); + }); + //step4 + function getTableData() { + var where = {}; + var tableRenderOptions = { + height: 600, + id: LIST_TABLE_ID, + elem: "#" + LIST_TABLE_ID, + data: LIST_TABLE_DATA, + // url: LIST_TABLE_URL, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + parseData: function (res) { + return { + code: 0, + msg: "", + //count: res.totalSize, + data: res, + }; + }, + /* done: function (res, curr, count) { + loadPage(curr, count); + },*/ + }; + table.render(tableRenderOptions); + } +}); diff --git a/admin/static/js/tab/index.js b/admin/static/js/tab/index.js new file mode 100644 index 0000000..c456a70 --- /dev/null +++ b/admin/static/js/tab/index.js @@ -0,0 +1,125 @@ +layui.use(["index", "api", "tpl", "dialog", "laypage"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laypage = layui.laypage; + var LIST_TABLE_URL = layui.api.getApiUrl("app", "list"); + var DELETE_TABLE_URL = layui.api.getApiUrl("app", "remove"); + var where = {}; + + var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId + + var LIST_TABLE_ID = "listTable"; // table ElementId + + var LIST_TABLE_DATA = [ + { id: 1, name: "我的名字", remark: "我是一个备注" }, + { id: 2, name: "我的名字", remark: "我是一个备注" }, + { id: 3, name: "我的名字", remark: "我是一个备注" }, + { id: 4, name: "我的名字", remark: "我是一个备注" }, + { id: 5, name: "我的名字", remark: "我是一个备注" }, + { id: 6, name: "我的名字", remark: "我是一个备注" }, + { id: 7, name: "我的名字", remark: "我是一个备注" }, + { id: 8, name: "我的名字", remark: "我是一个备注" }, + { id: 9, name: "我的名字", remark: "我是一个备注" }, + { id: 10, name: "我的名字", remark: "我是一个备注" }, + + ]; + // table field 配置 + var LIST_TABLE_COLS = [ + { + field: "id", + title: "id", + align: "center", + hide: true, + }, + { + field: "name", + title: "分组名称", + align: "center", + }, + { + field: "remark", + title: "备注", + align: "center", + }, + { + fixed: "right", + title: "操作", + width: 150, + align: "center", + toolbar: "#cellOperating", + }, + ]; + init(); + // 创建 + $(".add-dialog").click(function (e) { + e.stopPropagation(); + addDialog(); + }); + //单元格 操作列中 操作事件 + table.on(`tool(${LIST_TABLE_ID})`, function (obj) { + var data = obj.data; + var layEvent = obj.event; + if (layEvent === "edit") { + editDialog(data); + } else if (layEvent === "delete") { + layer.confirm("", + { + title: "提示", + area: ["520px", "270px"], + content: '
    确定删除该数据源吗?
    ', + btnAlign: 'r', + btn: ['取消', '确认'] + }, function (index, layero) { + layer.close(index); + }, function (index) { + console.log("按钮【按钮二】的回调"); + layui.dialog.showOkMsgDialog({ msg: "该数据源存在同步任务,不能删除!" }); + return false; + } + ); + } + }); + + function init() { + getTableData(); + } + function getTableData() { + var tableRenderOptions = { + height: 600, + id: LIST_TABLE_ID, + elem: "#" + LIST_TABLE_ID, + data: LIST_TABLE_DATA, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: where, + }; + table.render(tableRenderOptions); + laypage.render({ + elem: "pages", + count: 100, + layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + jump: function (obj) { + console.log(obj); + }, + }); + // admin.req({ + // url: LIST_TABLE_URL, + // data: where, + // success: function (res) { + // tableRenderOptions.data = res; + // table.render(tableRenderOptions); + // console.log('success:',res); + // }, + // error:function(err){ + // console.log('error:',err); + // table.render(tableRenderOptions); + // } + // }); + } + +}); diff --git a/admin/static/js/table/index.js b/admin/static/js/table/index.js new file mode 100644 index 0000000..0cbc256 --- /dev/null +++ b/admin/static/js/table/index.js @@ -0,0 +1,268 @@ + +layui.use(["api", "tpl", "dialog", "laypage"], function () { + var $ = layui.$, + table = layui.table, + element = layui.element, + form = layui.form, + admin = layui.admin, + laypage = layui.laypage; + var LIST_TABLE_URL = layui.api.getMockApiUrl("index", "list"); //查询url + + var where = {}; + + var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId + + var LIST_TABLE_ID = "listTable"; // table ElementId + + // table field 配置 + var LIST_TABLE_COLS = [{ + field: "id", + title: "id", + align: "center", + }, + { + field: "name", + title: "名称", + align: "center", + }, + { + field: "createTime", + title: "创建时间", + align: "center", + templet: function (d) { + return layui.util.toDateString(d.createTime, "yyyy-MM-dd"); + }, + }, + { + field: "fz", + title: "所属分组", + align: "center", + sort: true, + templet: function (d) { + if (d.fz == "1") { + return "类型1"; + } else if (d.fz == "2") { + return "类型2"; + } else if (d.fz == "3") { + return "类型3"; + } + return ""; + }, + }, + { + field: "type", + title: "类型", + align: "center", + sort: true, + templet: function (d) { + if (d.type == "1") { + return "类型1"; + } else if (d.type == "2") { + return "类型2"; + } else if (d.type == "3") { + return "类型3"; + } + return ""; + }, + }, + { + fixed: "right", + title: "操作", + width: 120, + align: "center", + toolbar: "#cellOperating", + }, + ]; + + + init(); + + $(".add-dialog").click(function (e) { + e.stopPropagation(); + addDialog(); + }); + + + $(".part-full-screen").click(function (e) { + e.stopPropagation(); + partFullScreen('part-full-screen', 'fulldiv'); + }); + $(".full-screen").click(function (e) { + e.stopPropagation(); + var fullScreen = parseInt($(this).attr('data-screen')); + if (fullScreen) { + admin.exitScreen(); + $(this).attr('data-screen', '0').html('整页全屏'); + } else { + admin.fullScreen(); + $(this).attr('data-screen', '1').html("退出整页全屏"); + } + + }); + // 重置 + $(".reset-btn").click(function (e) { + e.stopPropagation(); + //重置where + return false; + }); + form.on(`submit(${FORM_QUERY_ID})`, function (data) { + console.log("查询:", data.field); + table.reload(LIST_TABLE_ID, { where }); + }); + //单元格 操作列中 操作事件 + table.on(`tool(${LIST_TABLE_ID})`, function (obj) { + //阻止冒泡 + var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象 + layui.stope(evt); + var data = obj.data; + var layEvent = obj.event; + if (layEvent === "delete") { + layer.confirm( + "", { + title: "提示", + area: ["520px", "270px"], + content: '
    确定删除该数据吗?
    ', + btnAlign: "r", + btn: ["取消", "确认"], + }, + function (index, layero) { + layer.close(index); + }, + function (index) { + layui.dialog.showOkMsgDialog({ msg: "该数据存在,不能删除!" }); + return false; + } + ); + } else if (layEvent === "edit") { + $(".tips-box").remove(); + editDialog(data); + } + }); + + function init() { + getSelectData(); + getTableData(); + } + + function getTableData() { + var tableRenderOptions = { + height: 800, + elem: "#" + LIST_TABLE_ID, + url: LIST_TABLE_URL, + even: "false", + defaultToolbar: [], + page: false, + cols: [LIST_TABLE_COLS], + where: {}, + }; + console.log("tableRenderOptions:", tableRenderOptions); + table.render(tableRenderOptions); + laypage.render({ + elem: "pages", + count: 100, + layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"], + jump: function (obj) { + // console.log(obj); + }, + }); + } + + function addDialog() { + var templet = $("#formDialogTemplate").html(); + layui.laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: "新增", + content: templet, + area: [px2rem(520), px2rem(600)], + btn: ["取消", "确认"], + btnAlign: "r", + yes: function (index, layero) { + layer.close(index); + return false; + }, + btn2: function (index, layero) { + var submit = $("#LAY-dialog-submit"); + var submitID = "lay-dialog-submit"; + form.on("submit(" + submitID + ")", function (data) { + var params = data.field; //获取提交的字段 + // admin.req({ + // url: ADD_URL, + // data: params, + // success: function (res) { + table.reload(LIST_TABLE_ID, { where: where }); + layer.msg("新增成功"); + layer.close(index); + // }, + // }); + }); + submit.trigger("click"); + return false; + }, + success: function success() { + layui.form.render(""); + } + }); + }); + } + + function editDialog(data) { + var templet = $("#formDialogTemplate").html(); + layui.laytpl(templet).render({}, function (html) { + layer.open({ + type: 1, + title: "编辑", + content: templet, + area: [px2rem(520), px2rem(600)], + btn: ["取消", "确认"], + btnAlign: "r", + yes: function (index, layero) { + layer.close(index); + return false; + }, + btn2: function (index, layero) { + var submit = $("#LAY-dialog-submit"); + var submitID = "lay-dialog-submit"; + form.on("submit(" + submitID + ")", function (data) { + var params = data.field; + // admin.req({ + // url: UPDATE_URL, + // data: params, + // success: function (res) { + layui.table.reload(LIST_TABLE_ID, { where: where }); + layer.close(index); //关闭弹层 + layer.msg("成功"); + // }, + // }); + }); + submit.trigger("click"); + return false; + }, + success: function success() { + data.name = "这个名字我就是要固定不改"; + form.val("dialogForm", data); + layui.form.render(""); + }, + }); + }); + } + + function getSelectData() { + var data = { list: [] }; + var res = [ + { name: "1111", value: "1111" }, + { name: "2222", value: "2222" }, + ]; + var list = [{ name: "请选择", value: "" }]; + for (var item in res) { + var selected = false; + list.push({ + name: res[item].name, + value: res[item].value, + selected: selected, + }); + } + data.list = list; + layui.tpl.setSelectTpl("testIdSelect", data); + } +}); \ No newline at end of file diff --git a/admin/static/js/utils.js b/admin/static/js/utils.js new file mode 100644 index 0000000..a47741a --- /dev/null +++ b/admin/static/js/utils.js @@ -0,0 +1,17 @@ +function formatDuring(mss) { + var days = parseInt(mss / (1000 * 60 * 60 * 24)); + var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60)); + var seconds = (mss % (1000 * 60)) / 1000; + var returnStr = ""; + if (days > 0) { + returnStr += days + "天"; + } + if (hours > 0) { + returnStr += hours + "小时"; + } + if (minutes > 0) { + returnStr += minutes + "分钟"; + } + return returnStr + seconds + "秒"; +} diff --git a/admin/static/layui/global.js b/admin/static/layui/global.js new file mode 100644 index 0000000..c4e2ef7 --- /dev/null +++ b/admin/static/layui/global.js @@ -0,0 +1,9 @@ +/** +* 全部配置静态资源所在路径 +*/ +const GLOBAL_CONFIG_BASE_URL = './../../res/js/'; +layui.config({ + base: `${GLOBAL_CONFIG_BASE_URL}` //静态资源所在路径 +}).extend({ + index: 'lib/index', //主入口模块 +}) diff --git a/admin/static/layui/layui/css/default.css b/admin/static/layui/layui/css/default.css new file mode 100644 index 0000000..7db27ff --- /dev/null +++ b/admin/static/layui/layui/css/default.css @@ -0,0 +1,2725 @@ +html #layuicss-layuiAdmin { + display: none; + position: absolute; + width: 1989px; +} + + + + +/* 系统 */ +::-webkit-input-placeholder { + color: #ccc +} + +/** 滚动条 **/ +/* +::-webkit-scrollbar{width: 10px; height: 10px;} +::-webkit-scrollbar-button:vertical{display: none;} +::-webkit-scrollbar-track, ::-webkit-scrollbar-corner{background-color: #e2e2e2;} +::-webkit-scrollbar-thumb{border-radius: 0; background-color: rgba(0,0,0,.3);} +::-webkit-scrollbar-thumb:vertical:hover{background-color: rgba(0,0,0,.35);} +::-webkit-scrollbar-thumb:vertical:active{background-color: rgba(0,0,0,.38);} +*/ + + +/* 全局 */ + +*[template], +.layadmin-tabsbody-item { + display: none; +} + +*[lay-href], +*[lay-tips], +*[layadmin-event] { + cursor: pointer; +} + +/* 重置布局结构 */ +.layui-layout-admin .layui-header { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 50px; +} + +/* +.layui-layout-admin .layui-header .layui-layout-right .layui-nav-item a{color: #fff;} +.layui-layout-admin .layui-header .layui-layout-right .layui-nav-item a cite{color: rgba(255,255,255,.7);} +*/ + +.layui-layout-admin .layui-header .layui-nav .layui-nav-child a { + color: #333; +} + +.layui-layout-admin .layui-side { + width: 220px; + top: 0; + z-index: 1001; +} + +.layui-layout-admin .layui-logo, +.layui-layout-admin .layui-header .layui-nav .layui-nav-item { + height: 50px; + line-height: 50px; +} + +.layui-layout-admin .layui-logo { + position: fixed; + left: 0; + top: 0; + z-index: 1002; + width: 220px; + height: 49px; + padding: 0 15px; + box-sizing: border-box; + overflow: hidden; + font-weight: 300; + background-repeat: no-repeat; + background-position: center center; +} + +.layui-layout-admin .layui-layout-left, +.layadmin-pagetabs, +.layui-layout-admin .layui-body, +.layui-layout-admin .layui-footer { + left: 220px; +} + +.layadmin-pagetabs { + position: fixed; + top: 50px; + right: 0; + z-index: 999; +} + +.layadmin-pagetabs .layui-breadcrumb { + padding: 0 15px; +} + +.layui-layout-admin .layui-body { + position: fixed; + top: 90px; + bottom: 0; +} + +.layui-layout-admin .layui-body .layadmin-tabsbody-item { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + overflow: hidden; +} + +.layui-layout-admin .layui-header .layui-nav-img { + width: 26px; + height: 26px; +} + +.layui-layout-admin .layui-header .layui-nav-child { + top: 55px; +} + +.layui-layout-admin .layui-header .layui-layout-right .layui-nav-child { + left: auto; + right: 0; +} + +.layui-layout-admin .layui-header .layui-nav .layui-nav-child dd.layui-this a, +.layui-layout-admin .layui-header .layui-nav .layui-nav-child dd.layui-this { + background: none +} + +/* 统一动画 */ +.layui-layout-admin .layui-header .layui-nav .layui-nav-item, +.layui-layout-admin .layui-layout-left, +.layadmin-pagetabs, +.layui-layout-admin .layui-body, +.layui-layout-admin .layui-footer, +.layui-layout-admin .layui-side, +.layui-layout-admin .layui-logo, +.layui-layout-admin .layui-header .layui-layout-right { + transition: all .3s; + -webkit-transition: all .3s; +} + +/* 图标 */ +.layui-icon-login-qq { + color: #3492ED; +} + +.layui-icon-login-wechat { + color: #4DAF29; +} + +.layui-icon-login-weibo { + color: #CF1900; +} + +/* 重置表格风格 */ +/* +.layui-table th, +.layui-table td, +.layui-table[lay-skin="line"], +.layui-table[lay-skin="row"], +.layui-table-view, +.layui-table-header, +.layui-table-tool, +.layui-table-page, +.layui-table-fixed-r, +.layui-table-tips-main{border-color: #f6f6f6;} + +.layui-table thead tr, +.layui-table-header, +.layui-table-tool, +.layui-table-patch, +.layui-table-mend{background-color: #fff;} + +.layui-table[lay-even] tr:nth-child(even), +.layui-table tbody tr:hover, +.layui-table-hover, +.layui-table-click{background-color: #f8f8f8;} +*/ + +/* 表单 */ +.layui-form[wid100] .layui-form-label { + width: 100px; +} + +.layui-form[wid100] .layui-input-block { + margin-left: 130px; +} + +@media screen and (max-width: 450px) { + .layui-form[wid100] .layui-form-item .layui-input-inline { + margin-left: 132px; + } + + .layui-form[wid100] .layui-form-item .layui-input-inline+.layui-form-mid { + margin-left: 130px; + } +} + +.layui-form-item .layui-input-company { + width: auto; + padding-right: 10px; + line-height: 38px; +} + +/* 辅助 */ +.layadmin-flexible {} + +.layui-bg-white { + background-color: #fff; +} + +.layadmin-loading { + position: absolute; + left: 50%; + top: 50%; + margin: -16px -15px; + font-size: 30px; + color: #c2c2c2; +} + +.layadmin-fixed { + position: fixed; + left: 0; + top: 0; + z-index: 999; +} + +.layadmin-link { + color: #029789 !important; +} + +.layadmin-link:hover { + opacity: 0.8; +} + +/* 弹出面板 */ +.layui-layer-admin .layui-layer-title { + height: 50px; + line-height: 50px; + border: none 0; + background-color: #20222A; + color: #fff; +} + +.layui-layer-admin i[close] { + position: absolute; + padding: 5px; + right: 10px; + top: 12px; + color: #fff; + cursor: pointer; +} + +.layui-layer-admin .layui-layer-content { + padding: 20px; + line-height: 22px; +} + +.layui-layer-admin .layui-layer-content cite { + font-style: normal; + color: #FF5722; +} + +/* 右侧面板 */ +.layui-layer-adminRight { + top: 50px !important; + bottom: 0; + box-shadow: 1px 1px 10px rgba(0, 0, 0, .1); + border-radius: 0; + overflow: auto; +} + +/* 弹出便签 */ +.layadmin-note .layui-layer-content { + padding: 0; +} + +.layadmin-note textarea { + display: block; + width: 300px; + height: 132px; + min-width: 300px; + min-height: 132px; + line-height: 20px; + padding: 10px 20px; + border: none; + box-sizing: border-box; + color: #666; + word-wrap: break-word; +} + +/* 头部导航 */ +.layui-layout-admin .layui-layout-left { + padding: 0 10px; +} + +.layui-layout-admin .layui-layout-left .layui-nav-item { + margin: 0 20px; +} + +.layui-layout-admin .layui-input-search { + display: inline-block; + vertical-align: middle; + height: 32px; + border: none; + cursor: text; +} + +.layui-layout-admin .layui-layout-left a { + padding: 0; +} + +.layui-layout-admin .layui-layout-right { + padding: 0; +} + +.layui-header .layui-nav-item .layui-icon { + position: relative; + top: 1px; + font-size: 16px; +} + +.layui-header .layui-nav-item:hover {} + +.layui-header .layui-layout-right .layui-badge-dot { + margin-left: 11px; +} + +.layui-header .layui-nav .layui-this:after, +.layui-layout-admin .layui-header .layui-nav-bar { + top: 0 !important; + bottom: auto; + height: 3px; + background-color: #fff; + background-color: rgba(255, 255, 255, .3); +} + +/* 遮罩 */ +.layadmin-body-shade { + position: fixed; + display: none; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: rgba(0, 0, 0, .3); + z-index: 1000; +} + +/* 侧边菜单 */ +.layui-side-menu .layui-side-scroll { + width: 240px; +} + +.layui-side-menu .layui-nav { + width: 220px; + margin-top: 50px; + background: none; +} + +.layui-side-menu .layui-nav .layui-nav-item a { + height: 40px; + line-height: 40px; + padding-left: 45px; + padding-right: 30px; +} + +.layui-side-menu .layui-nav .layui-nav-item>a { + padding-top: 8px; + padding-bottom: 8px; +} + +.layui-side-menu .layui-nav .layui-nav-item a:hover { + background: none; +} + +.layui-side-menu .layui-nav .layui-nav-itemed>.layui-nav-child { + padding: 5px 0; +} + +.layui-side-menu .layui-nav .layui-nav-item .layui-icon { + position: absolute; + top: 50%; + left: 20px; + margin-top: -19px; +} + +.layui-side-menu .layui-nav .layui-nav-child .layui-nav-child { + background: none !important; +} + +.layui-side-menu .layui-nav .layui-nav-child .layui-nav-child a { + padding-left: 60px +} + +.layui-side-menu .layui-nav .layui-nav-more { + right: 15px; +} + +/* 侧边菜单 - 平板移动设备 */ +@media screen and (max-width: 992px) { + .layui-layout-admin .layui-side { + transform: translate3d(-220px, 0, 0); + -webkit-transform: translate3d(-220px, 0, 0); + width: 220px; + } + + .layui-layout-admin .layui-layout-left, + .layadmin-pagetabs, + .layui-layout-admin .layui-body, + .layui-layout-admin .layui-footer { + left: 0; + } +} + +/* 侧边收缩模式 */ +.layadmin-side-shrink .layui-layout-admin .layui-logo { + width: 60px; + background-image: url(res/logo.png); + /*background-size: 20px;)*/ +} + +.layadmin-side-shrink .layui-layout-admin .layui-logo span { + display: none; +} + +.layadmin-side-shrink .layui-side { + left: 0; + width: 60px; +} + +.layadmin-side-shrink .layui-layout-admin .layui-layout-left, +.layadmin-side-shrink .layadmin-pagetabs, +.layadmin-side-shrink .layui-layout-admin .layui-body, +.layadmin-side-shrink .layui-layout-admin .layui-footer { + left: 60px; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav { + position: static; + width: 60px; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav-item { + position: static; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav-item>a { + padding-right: 0; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav-item cite, +.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>a .layui-nav-more, +.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child { + display: none; + padding: 8px 0; + width: 200px; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-itemed>a { + background: rgba(0, 0, 0, .3); +} + +/* 移动端展开模式 */ +.layadmin-side-spread-sm .layui-layout-admin .layui-layout-left, +.layadmin-side-spread-sm .layadmin-pagetabs, +.layadmin-side-spread-sm .layui-layout-admin .layui-body, +.layadmin-side-spread-sm .layui-layout-admin .layui-footer { + left: 0; + transform: translate3d(220px, 0, 0); + -webkit-transform: translate3d(220px, 0, 0); +} + +.layadmin-side-spread-sm .layui-layout-admin .layui-layout-right { + transform: translate3d(220px, 0, 0); + -webkit-transform: translate3d(220px, 0, 0); +} + +.layadmin-side-spread-sm .layui-side { + transform: translate3d(0, 0, 0); + -webkit-transform: translate3d(0, 0, 0); +} + +.layadmin-side-spread-sm .layadmin-body-shade { + display: block; +} + + +/* 页面标签 */ +.layadmin-pagetabs { + height: 40px; + line-height: 40px; + padding: 0 80px 0 40px; + /*border-bottom: 2px solid #292B34;*/ + background-color: #fff; + box-sizing: border-box; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .1); +} + +.layadmin-pagetabs .layadmin-tabs-control { + position: absolute; + top: 0; + width: 40px; + height: 100%; + text-align: center; + cursor: pointer; + transition: all .3s; + -webkit-transition: all .3s; + box-sizing: border-box; + border-left: 1px solid #f6f6f6; +} + +.layadmin-pagetabs .layadmin-tabs-control:hover { + background-color: #f6f6f6; +} + +.layadmin-pagetabs .layui-icon-prev { + left: 0; + border-left: none; + border-right: 1px solid #f6f6f6; +} + +.layadmin-pagetabs .layui-icon-next { + right: 40px; + right: 40px; +} + +.layadmin-pagetabs .layui-icon-down { + right: 0; +} + +.layadmin-tabs-select.layui-nav { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + padding: 0; + background: none; +} + +.layadmin-tabs-select.layui-nav .layui-nav-item { + line-height: 40px; +} + +.layadmin-tabs-select.layui-nav .layui-nav-item>a { + height: 40px; +} + +.layadmin-tabs-select.layui-nav .layui-nav-item a { + color: #666; +} + +.layadmin-tabs-select.layui-nav .layui-nav-child { + top: 40px; + left: auto; + right: 0; +} + +.layadmin-tabs-select.layui-nav .layui-nav-child dd.layui-this, +.layadmin-tabs-select.layui-nav .layui-nav-child dd.layui-this a { + background-color: #f2f2f2 !important; + color: #333; +} + +.layadmin-tabs-select.layui-nav .layui-nav-more, +.layadmin-tabs-select.layui-nav .layui-nav-bar { + display: none; +} + +.layadmin-pagetabs .layui-tab { + margin: 0; + overflow: hidden; +} + +.layadmin-pagetabs .layui-tab-title { + height: 40px; + border: none; +} + +.layadmin-pagetabs .layui-tab-title li { + min-width: 0; + line-height: 40px; + max-width: 160px; + text-overflow: ellipsis; + padding-right: 40px; + overflow: hidden; + border-right: 1px solid #f6f6f6; + vertical-align: top; +} + +.layadmin-pagetabs .layui-tab-title li:first-child { + padding-right: 15px; +} + +.layadmin-pagetabs .layui-tab-title li:first-child .layui-tab-close { + display: none; +} + +.layadmin-pagetabs .layui-tab-title li .layui-tab-close { + position: absolute; + right: 8px; + top: 50%; + margin: -7px 0 0 0; + width: 16px; + height: 16px; + line-height: 16px; + border-radius: 50%; + font-size: 12px; +} + +.layadmin-pagetabs .layui-tab-title li:after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 0; + height: 2px; + border-radius: 0; + background-color: #292B34; + transition: all .3s; + -webkit-transition: all .3s; +} + +.layadmin-pagetabs .layui-tab-title li:hover:after { + width: 100%; +} + +.layadmin-pagetabs .layui-tab-title li:hover, +.layadmin-pagetabs .layui-tab-title li.layui-this { + background-color: #f6f6f6; +} + +.layadmin-pagetabs .layui-tab-title li.layui-this:after { + width: 100%; + border: none; + height: 2px; + background-color: #292B34; +} + +/* 不开启页面标签时 */ +.layadmin-tabspage-none .layui-layout-admin .layui-header { + border-bottom: none; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); +} + +.layadmin-tabspage-none .layui-layout-admin .layui-body { + top: 50px; +} + +.layadmin-tabspage-none .layadmin-header { + display: block; +} + +.layadmin-tabspage-none .layadmin-header .layui-breadcrumb { + border-top: 1px solid #f6f6f6; +} + +/* 底部固定区域 */ +.layui-layout-admin .layui-footer { + padding: 10px 0; + text-align: center; +} + +/* 默认主题修饰 */ +.layui-layout-admin .layui-header { + border-bottom: 1px solid #f6f6f6; + box-sizing: border-box; + background-color: #fff; +} + +.layui-layout-admin .layui-header a, +.layui-layout-admin .layui-header a cite { + color: #333; +} + +.layui-layout-admin .layui-header a:hover { + color: #000; +} + +.layui-layout-admin .layui-header .layui-nav .layui-nav-more { + border-top-color: #666 +} + +.layui-layout-admin .layui-header .layui-nav .layui-nav-mored { + border-color: transparent; + border-bottom-color: #666; +} + +.layui-layout-admin .layui-header .layui-nav .layui-this:after, +.layui-layout-admin .layui-header .layui-nav-bar { + height: 2px; + background-color: #20222A +} + +.layui-layout-admin .layui-logo { + background-color: #20222A; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .15); +} + +.layui-layout-admin .layui-logo, +.layui-layout-admin .layui-logo a { + color: #fff; + color: rgba(255, 255, 255, .8) +} + +.layui-side-menu { + box-shadow: 1px 0 2px 0 rgba(0, 0, 0, .05); +} + +.layui-layout-admin .layui-footer { + box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05); +} + +.layui-side-menu, +.layadmin-setTheme-side { + background-color: #20222A; + color: #fff; +} + +.layadmin-setTheme-header { + background-color: #fff; +} + +.layui-layout-admin .layui-footer { + background-color: #fff; +} + +.layui-tab-admin .layui-tab-title { + background-color: #393D49; + color: #fff; +} + + +/* + + 格局 + +*/ + +.layui-fluid { + padding: 15px; +} + +.layadmin-header { + display: none; + height: 50px; + line-height: 50px; + margin-bottom: 0; + border-radius: 0; +} + +.layadmin-header .layui-breadcrumb { + padding: 0 15px; +} + +.layui-card-header { + position: relative; +} + +.layui-card-header .layui-icon { + line-height: initial; + position: absolute; + right: 15px; + top: 50%; + margin-top: -7px; +} + +.layadmin-iframe { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + right: 0; + bottom: 0; +} + + +/* + + 控制台 + +*/ + + +/* 重置轮播样式 */ +.layadmin-carousel { + height: 185px !important; + background-color: #fff; +} + +.layadmin-carousel .layui-carousel-ind li { + background-color: #e2e2e2; +} + +.layadmin-carousel .layui-carousel-ind li:hover { + background-color: #c2c2c2; +} + +.layadmin-carousel .layui-carousel-ind li.layui-this { + background-color: #999; +} + +.layadmin-carousel .layui-carousel, +.layadmin-carousel>*[carousel-item]>* { + background-color: #fff; +} + +.layadmin-carousel .layui-col-space10 { + margin: 0; +} + +.layadmin-carousel .layui-carousel-ind { + position: absolute; + top: -41px; + text-align: right; +} + +.layadmin-carousel .layui-carousel-ind ul { + background: none; +} + +/* 重置tab样式 */ +.layui-card .layui-tab-brief .layui-tab-title { + height: 42px; + border-bottom-color: #f6f6f6; +} + +.layui-card .layui-tab-brief .layui-tab-title li { + margin: 0 15px; + padding: 0; + line-height: 42px; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this { + color: #333; +} + +.layui-card .layui-tab-brief .layui-tab-title .layui-this:after { + height: 43px; +} + +.layui-card .layui-tab-brief .layui-tab-content { + padding: 15px; +} + +.layui-card .layui-table-view { + margin: 0; +} + +/* 快捷方式 */ +.layadmin-shortcut li { + text-align: center; +} + +.layadmin-shortcut li .layui-icon { + display: inline-block; + width: 100%; + height: 60px; + line-height: 60px; + text-align: center; + border-radius: 2px; + font-size: 30px; + background-color: #F8F8F8; + color: #333; + transition: all .3s; + -webkit-transition: all .3s; +} + +.layadmin-shortcut li cite { + position: relative; + top: 2px; + display: block; + color: #666; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + font-size: 14px; +} + +.layadmin-shortcut li:hover .layui-icon { + background-color: #f2f2f2; +} + +/* 待办事项 */ +.layadmin-backlog .layadmin-backlog-body { + display: block; + padding: 10px 15px; + background-color: #f8f8f8; + color: #999; + border-radius: 2px; + transition: all .3s; + -webkit-transition: all .3s; +} + +.layadmin-backlog-body h3 { + padding-bottom: 10px; + font-size: 12px; +} + +.layadmin-backlog-body p cite { + font-style: normal; + font-size: 30px; + font-weight: 300; + color: #009688; +} + +.layadmin-backlog-body:hover { + background-color: #f2f2f2; + color: #888; +} + +/* 数据概览 */ +.layadmin-dataview { + height: 332px !important; +} + +.layadmin-dataview>*[carousel-item]:before { + display: none; +} + +.layadmin-dataview>*[carousel-item]>div { + height: 332px; +} + +/* 控制台效果报告 */ +.layadmin-takerates { + padding-top: 5px; +} + +.layadmin-takerates .layui-progress { + margin: 50px 0 60px; +} + +.layadmin-takerates .layui-progress:last-child { + margin-bottom: 10px; +} + +.layadmin-takerates .layui-progress h3 { + position: absolute; + right: 0; + top: -35px; + color: #999; + font-size: 14px; +} + +.layadmin-takerates .layui-progress-bar { + text-align: left; +} + +.layadmin-takerates .layui-progress-text { + top: -35px; + line-height: 26px; + font-size: 26px; +} + +/* 产品动态 */ +.layadmin-news { + height: 60px !important; + padding: 5px 0; +} + +.layadmin-news a { + display: block; + line-height: 60px; + text-align: center; +} + +.layadmin-news .layui-carousel-ind { + height: 45px; +} + +/* 文字列表 */ +.layadmin-list li { + margin-bottom: 6px; + padding-bottom: 6px; + border-bottom-color: #f6f6f6; + list-style-position: inside; + list-style-type: disc; +} + +.layadmin-list li { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.layadmin-list li a { + color: #666; +} + +.layadmin-list li a:hover { + color: #009688; +} + +.layadmin-list li:last-child { + border: none; + padding: 0; + margin: 0; +} + +/* 文本区域 */ +.layadmin-text p { + margin-bottom: 10px; + text-indent: 2em; +} + +.layadmin-text p:last-child { + margin: 0; +} + +.layadmin-font-em { + font-size: 13px; + color: #758697; +} + + + + +/******************************** + + 其它主页开始 By star1029 + +*******************************/ + +/* 主页示例一 by star1029 */ +/* 进行中的项目 */ +.layui-card-header .layui-a-tips { + position: absolute; + right: 15px; + color: #01AAED; +} + +.layuiadmin-card-text { + background-color: #f8f8f8; + color: #777; + padding: 24px; +} + +.layuiadmin-card-text .layui-text-top { + padding-bottom: 10px; +} + +.layuiadmin-card-text .layui-text-top i { + margin-right: 10px; + font-size: 24px; + color: #009688; +} + +.layuiadmin-card-text .layui-text-top a { + line-height: 24px; + font-size: 16px; + vertical-align: top; +} + +.layuiadmin-card-text .layui-text-center { + height: 44px; + line-height: 22px; + margin-bottom: 10px; + overflow: hidden; +} + +.layuiadmin-card-text .layui-text-bottom { + position: relative; +} + +.layuiadmin-card-text .layui-text-bottom a { + color: #777; + font-size: 12px; + text-overflow: ellipsis; + word-break: break-all; +} + +.layuiadmin-card-text .layui-text-bottom span { + color: #CCC; + font-size: 12px; + position: absolute; + right: 0; +} + +.layuiadmin-card-text a:hover, +.layuiadmin-card-link a:hover, +.layuiadmin-card-team li a:hover { + color: #01AAED; + transition: all 300ms; +} + +/* 动态 */ +.layuiadmin-card-status { + padding: 0 10px 10px 10px; +} + +.layuiadmin-card-status dd { + padding: 15px 0; + border-bottom: 1px solid #EEE; + display: -webkit-flex; + display: flex; +} + +.layuiadmin-card-status dd:last-child { + border: none; +} + +.layuiadmin-card-status dd div.layui-status-img, +.layuiadmin-card-team .layui-team-img { + width: 32px; + height: 32px; + border-radius: 50%; + background-color: #009688; + margin-right: 15px; +} + +.layuiadmin-card-status dd div.layui-status-img a { + width: 100%; + height: 100%; + display: inline-block; + text-align: center; + line-height: 32px; +} + +.layuiadmin-card-status dd div.layui-status-img img, +.layuiadmin-card-team .layui-team-img img { + width: 50%; + height: 50%; +} + +.layuiadmin-card-status dd div a { + color: #01AAED; +} + +.layuiadmin-card-status dd div span { + color: #BBB; +} + +/* 便捷导航 */ +.layuiadmin-card-link { + padding-left: 10px; + font-size: 0 +} + +.layuiadmin-card-link a { + display: inline-block; + width: 25%; + color: #666; + font-size: 14px; + margin-bottom: 12px; +} + +.layuiadmin-card-link button { + vertical-align: top; +} + +.layuiadmin-card-link button:hover { + color: #009688; +} + +/* 团队 */ +.layuiadmin-card-team li { + padding: 10px 0 10px 10px; +} + +.layuiadmin-card-team .layui-team-img { + display: inline-block; + margin-right: 8px; + width: 24px; + height: 24px; + text-align: center; + line-height: 24px; +} + +.layuiadmin-card-team span { + color: #777; +} + + +/* 主页示例二 by star1029 */ +.layuiadmin-badge { + position: absolute; + top: 50%; + margin-top: -9px; + right: 15px; + color: #01AAED; +} + +.layuiadmin-card-list { + padding: 15px; +} + +.layuiadmin-card-list p.layuiadmin-big-font { + font-size: 36px; + color: #666; + line-height: 36px; + padding: 5px 0 10px; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-all; + white-space: nowrap; +} + +.layuiadmin-card-list p.layuiadmin-normal-font { + padding-bottom: 10px; + font-size: 20px; + color: #666; + line-height: 24px; +} + +.layuiadmin-span-color { + font-size: 14px; + position: absolute; + right: 15px; +} + +.layuiadmin-span-color i { + padding-left: 5px; +} + +.layuiadmin-btn-group { + position: absolute; + right: 15px; +} + +.layuiadmin-card-status li { + position: relative; + padding: 10px 0; + border-bottom: 1px solid #EEE; +} + +.layuiadmin-card-status li h3 { + padding-bottom: 5px; + font-weight: 700; +} + +.layuiadmin-card-status li p { + padding-bottom: 10px; +} + +.layuiadmin-card-status li>span { + color: #999; +} + +.layuiadmin-home2-usernote .layuiadmin-reply { + display: none; + position: absolute; + right: 0; + bottom: 12px; +} + +.layuiadmin-home2-usernote li:hover .layuiadmin-reply { + display: block; +} + +.layuiadmin-page-table td span { + color: #2F4056; +} + +.layuiadmin-page-table td span.first { + color: #FF5722; +} + +.layuiadmin-page-table td span.second { + color: #FFB800; +} + +.layuiadmin-page-table td span.third { + color: #5FB878; +} + + +/****** 其它主页结束 By star1029 ******/ + + + + +/* + + 应用 + +*/ + + +/* 消息中心 */ +.layuiAdmin-msg-detail h1 { + font-size: 16px; +} + +.layuiAdmin-msg-detail .layui-card-header { + height: auto; + line-height: 30px; + padding: 15px; +} + +.layuiAdmin-msg-detail .layui-card-header span { + padding: 0 5px; + color: #999; +} + +.layuiAdmin-msg-detail .layui-card-header span:first-child { + padding-left: 0; +} + +.layuiAdmin-msg-detail .layui-card-body { + padding: 15px; +} + +/* 文章列表 */ +.layuiadmin-content-bread { + padding-bottom: 20px; +} + +/* 进度条样式 */ +.layuiadmin-order-progress { + position: relative; + top: 12px; +} + + + + +/* + + 系统 + +*/ + + +/* 头部图标重置 */ +.layui-card-header.layuiadmin-card-header-auto { + padding-top: 15px; + padding-bottom: 15px; + height: auto; +} + +.layuiadmin-card-header-auto i.layuiadmin-button-btn { + position: relative; + right: 0; + top: 0; + vertical-align: middle; +} + +.layuiadmin-card-header-auto .layui-form-item:last-child { + margin-bottom: 0; +} + + +/* 主题设置 */ +.layadmin-setTheme { + padding: 15px; + overflow-x: hidden; +} + +.layadmin-setTheme>h5 { + padding: 20px 0 10px; + color: #000; +} + +.layadmin-setTheme>h5:first-child { + padding-top: 0; +} + +.layadmin-setTheme-color { + width: 330px; + font-size: 0; +} + +.layadmin-setTheme-color li { + position: relative; + display: inline-block; + vertical-align: top; + width: 80px; + height: 50px; + margin: 0 15px 15px 0; + background-color: #f2f2f2; + cursor: pointer; + font-size: 12px; + color: #666; +} + +.layadmin-setTheme-color li:after { + content: ''; + position: absolute; + z-index: 20; + top: 50%; + left: 50%; + width: 1px; + height: 0; + border: 1px solid #f2f2f2; + transition: all .3s; + -webkit-transition: all .3s; + opacity: 0; +} + +.layadmin-setTheme-color li.layui-this:after, +.layadmin-setTheme-color li:hover:after { + width: 100%; + height: 100%; + padding: 4px; + top: -5px; + left: -5px; + border-color: #5FB878; + opacity: 1; +} + +.layadmin-setTheme-header { + position: relative; + z-index: 10; + height: 10px; + border-top: 1px solid #f2f2f2; + border-right: 1px solid #f2f2f2; +} + +.layadmin-setTheme-side { + position: absolute; + left: 0; + top: 0; + width: 20px; + height: 100%; + z-index: 11; + box-shadow: 1px 0 2px 0 rgba(0, 0, 0, .05); +} + +.layadmin-setTheme-logo { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 10px; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .15); +} + +.layadmin-form-right { + text-align: right; +} + + +/* 关于 */ +.layadmin-about p { + margin-bottom: 10px; +} + +/* 菜单列表 */ +.layadmin-menu-list .layui-card-header { + height: 50px; + line-height: 50px; + font-size: 16px; +} + +.layadmin-menu-list .layui-card-header:active { + background-color: #f2f2f2; +} + +.layadmin-menu-list .layui-card-header .layui-icon { + position: relative; + top: 1px; + left: 0; + display: inline-block; + margin: 0 10px 0; + font-size: 18px; +} + + +/* 动画 */ +@-webkit-keyframes layui-rl { + + /* 从右往左滑入 */ + from { + -webkit-transform: translate3d(100%, 0, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + } +} + +@keyframes layui-rl { + from { + transform: translate3d(100%, 0, 0); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.layui-anim-rl { + -webkit-animation-name: layui-rl; + animation-name: layui-rl; +} + +@-webkit-keyframes layui-lr { + + /* 从右往左滑入 */ + from { + -webkit-transform: translate3d(0 0, 0); + opacity: 1; + } + + to { + -webkit-transform: translate3d(100%, 0, 0); + opacity: 1; + } +} + +@keyframes layui-lr { + from { + transform: translate3d(0, 0, 0); + } + + to { + transform: translate3d(100%, 0, 0); + } +} + +.layui-anim-lr { + -webkit-animation-name: layui-lr; + animation-name: layui-lr; +} + +.layui-anim-rl.layer-anim-close { + -webkit-animation-name: layui-lr; + animation-name: layui-lr; +} + + +/* 提示页 */ +.layadmin-tips { + margin-top: 30px; + text-align: center; +} + +.layadmin-tips .layui-icon[face] { + display: inline-block; + font-size: 300px; + color: #393D49; +} + +.layadmin-tips .layui-text { + width: 500px; + margin: 30px auto; + padding-top: 20px; + border-top: 5px solid #009688; + font-size: 16px; +} + +.layadmin-tips h1 { + font-size: 100px; + line-height: 100px; + color: #009688; +} + +.layadmin-tips .layui-text .layui-anim { + display: inline-block; +} + + +/* + + 响应式补充 + +*/ + +@media screen and (max-width: 768px) { + + /* 产品清单模板 */ + .layadmin-panel-selection { + margin: 0; + width: auto; + } + + /* 导航 */ + .layui-body .layui-nav .layui-nav-item { + display: block; + } + + /* 主体容器 */ + .layui-layout-admin .layui-body .layadmin-tabsbody-item { + -webkit-overflow-scrolling: touch; + overflow: auto; + } +} + +.layui-card{ + background:rgba(255,255,255,1); + box-shadow:0px 2px 20px rgba(228,232,233,1); + opacity:1; + border-radius:0px 4px 4px 4px; +} + +.layui-card .layui-tab-brief { + box-shadow: 0px 2px 20px #e4e8e9; + opacity: 1; + border-radius: 0px 4px 4px 4px; + background-color: #fff; +} + +.layui-card .layui-tab-brief .layui-tab-title { + background-color: #fff; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this { + background-color: #fff; + color: #3D89FF; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-bottom: 2px solid #3D89FF; + border-top: none; +} + +.layui-card .layui-tab-card .layui-tab-title li.layui-this { + background-color: #f2f2f2; +} + +.layui-card .layui-tab-card .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-bottom: 2px solid #3D89FF; + border-top: none; +} + +.layui-card .layui-tab-title { + background-color: #f2f2f2; +} + +.layui-card .layui-tab-title li.layui-this { + background-color: #fff; +} + +.layui-card .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-top: 2px solid #3D89FF; + border-bottom: none; +} + +.layui-card .layui-tab-title li .layui-tab-close { + background-color: #f2f4f5; + border-radius: 50%; +} + +.layui-card .layui-tab-title li .layui-tab-close:hover { + background-color: #FF5722; +} + +/* .layui-btn { + background: #3D89FF; + border-radius: 4px; + margin-right: 8px; + margin-bottom: 8px; +} + +.layui-btn.layui-btn-primary { + background: #fff; + border: 1px solid #dedfe1; + border-radius: 4px; + color: #454b50; +} + +.layui-btn.layui-btn-normal { + color: #3D89FF; + border-color: #3D89FF; + border-style: solid; + border-width: 1px; + background: #fff; +} + +.layui-btn.layui-btn-disabled { + background-color: #9CC0F9; + color: #fff; +} + +.layui-btn.layui-btn-disabled-default { + border-width: 1px; + border-style: solid; + border-color: #dedfe1; + background-color: #dedfe1; + color: #b8b8b8; +} + +.layui-btn.layui-btn-danger { + background-color: #ff4d4f; +} */ + +.layui-table thead tr, +.layui-table-click, +.layui-table-header, +.layui-table-hover, +.layui-table-mend, +.layui-table-patch, +.layui-table-tool, +.layui-table-total, +.layui-table-total tr, +.layui-table[lay-even] tr:nth-child(even) { + background-color: #F6F8F9; +} + +.layui-table thead tr { + border-left: 4px; + border-left-style: solid; + border-color: #f6f8f9; +} + +.layui-table tbody tr { + border-left: 4px; + border-left-style: solid; + border-color: transparent; +} + +.layui-table tbody tr:hover { + background-color: #E8F2FF; + border-color: #3D89FF; +} + +.layui-table-view .layui-form-checkbox[lay-skin=primary] i { + width: 14px; + height: 14px; + line-height: 14px; +} + +.layui-form-checkbox[lay-skin=primary]:hover i { + border-color: #3D89FF; +} + +.layui-table .layui-a { + color: #3D89FF; + cursor: pointer; + display: inline-block; + padding: 0px 5px; +} + +.layui-table .layui-a.layui-a-primary { + color: #ff9800; +} + +.layui-table .layui-a.layui-a-danger { + color: #F63C49; +} + +.layui-laypage span, +.layui-laypage a { + margin-right: 8px; + border-radius: 4px; +} + +.layui-laypage span.layui-laypage-curr { + border-width: 1px; + border-style: solid; + border-color: #3D89FF; +} + +.layui-laypage span.layui-laypage-curr .layui-laypage-em { + background-color: unset; + color: #3D89FF; +} + +.layui-laypage span.layui-laypage-curr em { + color: #3D89FF; +} + +.layui-laypage a { + border-color: #DFE5E8; + border-style: solid; + border-width: 1px; +} + +.layui-layer.layui-layer-msg { + width: auto !important; +} + +.layui-layer.layui-layer-msg .layui-layer-content { + height: auto; +} + +.layui-layer .layui-layer-title { + color: #454b50; + height: 49px; + line-height: 49px; + padding: 0 80px 0 16px; +} + +.layui-layer.layui-layer-page .layui-layer-content { + padding: 30px 30px 20px 0px; + overflow-y: auto; +} + +.layui-layer.layui-layer-dialog .layui-layer-content { + text-align: center; +} + +.layui-layer.layui-layer-dialog .layui-layer-btn { + text-align: center; +} + +.layui-form-radio i { + font-size: 16px; + margin-right: 6px; +} + +.layui-form-radio i:hover { + color: #3D89FF; +} + +.layui-form-radio.layui-form-radioed i { + color: #3D89FF; +} + +.layui-form-radio.layui-form-radioed i:hover { + color: #3D89FF; +} + +.layui-form-checked { + border-color: #3D89FF; +} + +.layui-form-checked i { + color: #3D89FF; +} + +.layui-form-checked span { + background-color: #3D89FF; +} + +.layui-form-checked:hover { + border-color: #3D89FF; +} + +.layui-form-checked:hover i { + color: #3D89FF; +} + +.layui-form-checked:hover span { + background-color: #3D89FF; +} + +.layui-form-checkbox[lay-skin=primary] { + padding-left: 20px; +} + +.layui-form-checkbox[lay-skin=primary] i { + width: 14px; + height: 14px; + line-height: 14px; +} + +.layui-form-checkbox[lay-skin=primary]:hover i { + border-color: #3D89FF; +} + +.layui-form-checked[lay-skin=primary] i { + border-color: #3D89FF; + background-color: #3D89FF; +} + +.layui-form-checkbox[lay-skin=primary] span { + background: 0 0; + color: #666; +} + +.layui-form-switch.layui-form-onswitch { + border-color: #3D89FF; + background-color: #3D89FF; +} + +.layui-input { + border-radius: 4px; +} + +.layui-input:focus, +.layui-input:hover { + border-color: #3D89FF !important; +} + +.layui-input-disable { + border-radius: 4px; + background-color: #F5F5F5; + border: 1px solid #E7E8EB; + color: #BDC2C5 +} + +.layui-input:focus, +.layui-input-disable:hover { + border-color: #E7E8EB !important; +} + +.layui-form-danger { + border-color: #ff4d4f; +} + +.layui-form-danger:focus { + border-color: #ff4d4f; +} + +.layui-unselect dl dd:hover { + background-color: #E8F2FF; +} + +.layui-unselect dl dd.layui-this { + background-color: #E8F2FF; + color: #454B50; +} + +.layui-nav { + background-color: #323E47; +} + +.layui-nav.layui-nav-tree .layui-nav-bar { + background-color: #3D89FF; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed { + margin-bottom: 3px; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed>.layui-nav-child { + background-color: unset !important; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed:before { + position: absolute; + content: ''; + top: 0; + right: 0; + bottom: 3px; + left: 5px; + width: calc(100% - 10px); + height: 100%; + background-color: rgba(81, 94, 104, 0.53); + border-radius: 4px; +} + +.layui-nav.layui-nav-tree .layui-nav-child dd { + width: calc(100% - 10px); + margin: 0 auto; +} + +.layui-nav.layui-nav-tree .layui-nav-child a { + width: calc(100% - 40px); + margin: 0 auto; +} + +.layui-nav.layui-nav-tree .layui-nav-child a:hover { + background: #515e68; + border-radius: 4px; + width: calc(100% - 40px); +} + +.layui-nav.layui-nav-tree .layui-nav-child a:hover:after { + position: absolute; + content: ''; + left: 0; + top: 0; + bottom: 0; + width: 3px; + background-color: #3D89FF; + z-index: 2; +} + +.layui-nav.layui-nav-tree .layui-nav-item a:hover { + background-color: unset; +} + +.layui-nav.layui-nav-tree .layui-this, +.layui-nav.layui-nav-tree .layui-this>a, +.layui-nav.layui-nav-tree .layui-nav-child dd.layui-this, +.layui-nav.layui-nav-tree .layui-nav-child dd.layui-this a { + background-color: #3D89FF !important; + border-radius: 4px; +} + +.layui-nav .layui-this:after, +.layui-nav-bar, +.layui-nav-tree .layui-nav-itemed:after { + background-color: #3D89FF; +} + +/* 颜色 */ +.layui-bg-gray-1 { + background-color: #F2F4F5 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-2 { + background-color: #F3F3F3 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-3 { + background-color: #DEDFE1 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-4 { + background-color: #E3E3E3 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-5 { + background-color: #F6F8F9 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-6 { + background-color: #F8F8F8 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-blue-1 { + background-color: #3D89FF !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-1 { + background-color: #323E47 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-2 { + background-color: #424E58 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-3 { + background-color: #515E68 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-select-gray { + background-color: #EBEBEB !important; + opacity: 1; + border-radius: 4px; +} + +.layui-text-blue-1 { + color: #3D89FF !important +} + +.layui-text-black-1 { + color: #454B50 !important +} + +.layui-text-black-2 { + color: #515151 !important +} + +.layui-text-gray-1 { + color: #8E8E8E !important +} + +.layui-text-gray-2 { + color: #C3C3C3 !important +} + +.layui-text-red-1 { + color: #F63C49 !important +} + +.layui-table td, +.layui-table th, +.layui-table-fixed-r, +.layui-table-header, +.layui-table-page, +.layui-table-tips-main, +.layui-table-tool, +.layui-table-view, +.layui-table[lay-skin=line], +.layui-table[lay-skin=row] { + border-width: 0px; + border-style: solid; + border-color: #e6e6e6 +} + +.layui-layer-btn-c { + text-align: right !important +} + +.layui-laypage { + display: block; + margin: 0; + font-size: 0; + text-align: center +} + +/* 按钮 */ +.layui-btn-default { + width: 80px; + height: 32px; + line-height: 32px; + padding: 0px; +} +.layui-btn-blue { + background-color: #3D89FF; + border-radius: 4px; + color: #FFFFFF +} + +.layui-btn-primary-gray { + border: 1px solid #CFD0D4; + background-color: #fff; + border-radius: 4px; + color: #454B50; +} + +.layui-btn-primary-blue { + border: 1px solid #3D89FF; + background-color: #fff; + border-radius: 4px; + color: #3D89FF +} + +.layui-btn-primary-gray:hover { + border-color: #3D89FF; + color: #333 +} + +.layui-btn-primary-blue:hover { + border-color: #3D89FF; + color: #333 +} + +.layui-btn-disabled-blue { + background-color: #9CC0F9; + border-width: 0px; + border-radius: 4px; + color: #FFFFFF +} + +.layui-btn-disabled-gray { + background-color: #F5F5F5; + border-width: 1px; + border-color: #DEDFE1; + border-radius: 4px; + color: #B8B8B8 +} + +.layui-btn-disabled-gray:hover { + opacity: .8; + color: #B8B8B8 +} + +.layui-btn-normal-blue { + background-color: #3D89FF; + border-radius: 4px; + color: #FFFFFF +} + +.layui-btn-sm { + height: 38px !important; + line-height: 38px !important; + padding: 0 10px; + font-size: 12px +} + +.layui-btn-lg-blue { + background-color: #3D89FF; + height: 44px; + line-height: 44px; + padding: 0 25px; + font-size: 16px; + border-radius: 4px; +} + +.layui-btn-sm-blue { + background-color: #3D89FF; + height: 30px; + line-height: 30px; + padding: 0 10px; + font-size: 12px; + border-radius: 4px; +} + +.layui-btn-xs-blue { + background-color: #3D89FF; + height: 22px; + line-height: 22px; + padding: 0 5px; + font-size: 12px; + border-radius: 4px; +} + +.layui-btn-danger-red { + background-color: #F63C49; + border-radius: 4px; +} + +/* 表单 */ +.layui-form-select dl dd.layui-this { + background-color: #3D89FF !important; + color: #fff !important; +} + +.layui-laydate .layui-this { + background-color: #3D89FF !important; + color: #fff !important; +} + +.layui-laydate-header i:hover, +.layui-laydate-header span:hover { + color: #3D89FF !important +} + +.layui-laydate-footer span:hover { + color: #3D89FF !important +} + +/* tab */ +.layui-nav .layui-this:after, +.layui-nav-bar, +.layui-nav-tree .layui-nav-itemed:after { + position: absolute; + left: 0; + top: 0; + width: 0; + height: 5px; + background-color: #3D89FF; + transition: all .2s; + -webkit-transition: all .2s; +} + +.layui-nav-pages { + font-size: 14px; + color: #454b50; + width: 100%; + height: 100%; +} + +.layui-nav-page-tabs { + width: 100%; + height: 100%; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; +} + +.layui-nav-page-menu { + color: #8e8e8e; + text-decoration: none; + line-height: 42px; + padding-left: 29px; + padding-right: 9px; + background-color: transparent; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.layui-nav-page-menu.active { + background-color: #ffffff; + border-radius: 6px 6px 0px 0px; + position: relative; + color: #454b50; +} + +.layui-pages { + flex: 1; + background-color: #ffffff; + margin-top: 10px; + box-shadow: 0px 2px 10px 0px rgba(228, 232, 233, 0.8); + border-radius: 0px 0px 4px 4px; +} + +.layui-tab-title-black { + color: #454B50 +} + +.layui-tab-brief>.layui-tab-title .layui-this { + color: #3D89FF +} + +.layui-tab-brief>.layui-tab-more li.layui-this:after, +.layui-tab-brief>.layui-tab-title .layui-this:after { + border: none; + border-radius: 0; + border-bottom: 3px solid #3D89FF +} + +/* 内容块 */ +.layui-form-gray { + background-color: #F8F8F8; + border-radius: 2px; + border: 1px solid #ECECEC; + padding: 22px 0px 0px 24px; + margin-bottom: 14px; +} + +.layui-input-inline-w218 { + width: 218px !important; +} + +.layui-input-inline-w303 { + width: 303px !important; +} + +.layui-input-inline-w650 { + width: 650px !important; +} + +.layui-icon-upload { + width: 55px; + height: 55px; + background-color: #FFFFFF; + border-radius: 4px; + border: 1px dashed #D2D3D8; +} + +.layui-input-inline-upload { + width: 55px !important; + margin-left: 14px; +} + +.layui-form-mid-hint { + margin-left: 55px; +} + +.layui-title1 { + display: flex; + margin-bottom: 24px; + align-items: center; +} + +.layui-title-line { + width: 3px; + height: 16px; + background-color: #3D89FF; + margin-right: 6px; + float: left; +} + +.layui-title-label1 { + font-size: 18px; + color: #333333 +} + +.layui-title2 { + display: flex; + margin: 22px 0px 14px 0px; + /* align-items: center; */ +} + +.layui-title-label2 { + font-size: 14px; + color: #454B50; +} + +/* 逐条添加 */ +.layui-form-item-gray { + background-color: #FFFFFF; + border-radius: 4px; + border: 1px solid #ECECEC; + margin-bottom: 20px; +} + +.layui-form-item-left1 { + padding: 20px 0px 0px 20px; + background: #F8F8F8; +} + +.layui-form-item-left2 { + float: left; + padding: 20px 0px 0px 20px; + width: 96%; + background: #F8F8F8; +} + +.layui-form-item-right { + float: left; + width: 30px; + height: 179px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + border-left: 1px solid #E9E9E9; + display: flex; + align-items: center; + justify-content: center; +} + +.layui-icon-close-gray { + color: #8E8E8E; + font-size: 10px +} + +.layui-form-label-item { + padding: 9px 0px; +} + +.layui-input-block-item { + display: flex; + align-items: center; + margin-left: 90px; +} + +.layui-form-item-add { + height: 50px; + border-radius: 4px; + border: 1px dashed #D2D3D8; + margin-bottom: 20px; + display: flex; + align-items: center; + padding-left: 20px; + font-size: 14px; + color: #454B50 +} + +.layui-icon-add-circle-fine-blue { + float: left; + font-size: 20px; + color: #3D89FF; + margin-right: 8px; +} + +/* 数据表单 */ +.layui-custom-line { + border-top: 1px solid #E6E6E6; + border-bottom: 1px solid #E6E6E6; + border-left: 1px solid #E6E6E6; +} + +.lauyu-custom-item-line { + width: 100%; + height: 1px; + background-color: #E6E6E6; +} + +.layui-custom-key { + height: 50px; + background-color: #F6F7F9; + border-right: 1px solid #E6E6E6; + display: flex; + align-items: center; + justify-content: center; +} + +.layui-custom-value { + height: 50px; + border-right: 1px solid #E6E6E6; + display: flex; + align-items: center; + padding: 0px 40px; +} + + + +.layui-form-block { + background: rgba(248, 248, 248, 1); + border: 1px solid rgba(236, 236, 236, 1); + opacity: 1; + border-radius: 4px; + padding: 20px 20px 5px 0px; + margin-bottom: 10px; + position: relative; +} + +.layui-form-item-close { + position: absolute; + right: 0px; + top: 0px; + width: 30px; + height: 100%; + text-align: center; + border-left: 1px solid rgba(233, 233, 233, 1); + background: rgba(255, 255, 255, 1); + opacity: 1; + border-radius: 0px 4px 4px 0px; +} + +.layui-form-item-close-icon { + position: absolute; + top: 50%; + right: 50%; + text-align: center; + width: 10px; + height: 10px; + color: #F63C49; + cursor: pointer; + font-weight: bold; +} + +.layui-table-tool { + background-color: #ffffff +} + +.layui-card-gray { + margin-bottom: 15px; + border-radius: 2px; + background-color: #fff; + box-shadow: 0 2px 10px 0 rgba(228, 232, 233, 0.8) !important +} + +/* 弹窗 */ +.layui-layer { + box-shadow: 0px 2px 20px rgba(187, 187, 187, 0.53) !important; + border-radius: 4px !important +} + +.layui-form-layer { + padding: 30px 30px 42px 30px; + border-bottom: 1px solid #EFEFEF +} + +.layui-input-noborder { + border: 0px; + /* width: 150px */ +} + +.layui-layer-row-checkbox { + padding: 22px 22px 0px 22px +} + +.layui-layer-row-select { + min-height: 259px; + border: 1px solid #DEDFE1; + border-radius: 4px; + margin-top: 10px; + padding: 16px +} + +.layui-layer-select { + width: 66px !important; + height: 32px; + margin: 0px 8px 8px 0px; + border: 1px solid #3D89FF; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + font-size: 14px; + color: #454B50; + float: left +} + +.layui-inline-layer-btn { + position: relative; + left: 348px; + padding: 10px 0px; +} + +.layui-btn-layer { + width: 80px; + height: 32px; + line-height: 32px +} + +.layui-text-gray { + font-size: 14px; + color: #454B50 +} + + + +.layui-transfer-data li:hover { + background-color: #E2EDFF; + transition: .5s all +} + +.layui-transfer-active .layui-btn { + display: block; + margin: 0; + padding: 0 15px; + background-color: #3D89FF !important; + border-color: #3D89FF !important; + color: #fff +} + +.layui-transfer-active .layui-btn-disabled { + background-color: #FBFBFB; + border-color: #e6e6e6; + color: #C9C9C9 +} + +.layui-form-checked[lay-skin=primary] i { + border-color: #3D89FF !important; + background-color: #3D89FF; + color: #fff +} + +/* 控件 */ +.layui-laypage a:hover { + color: #3D89FF +} + +.layui-laypage input:focus, +.layui-laypage select:focus { + border-color: #3D89FF !important +} + +.layui-laypage select { + height: 28px; + padding: 3px; + border-radius: 4px; + cursor: pointer; + background-color: #fff; +} + +.layui-icon-picture-gray { + font-size: 23px !important; + color: #A8A8A8 !important; +} +.layui-icon-close-fill-black { + font-size: 16px; + color: #000000; + position: relative; + left: -8px; + top: -8px +} +.layui-row-fl { + float: left; +} +.layui-upload-drag { + float: left; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 0px; + font-size: 12px; + color: #A8A8A8; + border-radius: 4px; +} +.layui-upload-drag-lg { + width: 198px; + height: 198px; + margin-bottom: 20px; +} +.layui-upload-img-lg { + float: left; + width: 200px; + height: 200px; + margin-bottom: 20px; + border-radius: 4px; +} +.layui-upload-drag-mid { + width: 98px; + height: 98px; + margin-bottom: 20px; +} +.layui-upload-img-mid { + float: left; + width: 100px; + height: 100px; + margin-bottom: 20px; + border-radius: 4px; +} +.layui-upload-drag-sm { + width: 54px; + height: 54px; + margin-bottom: 8px; +} +.layui-upload-img-sm { + float: left; + width: 56px; + height: 56px; + margin-bottom: 8px; + border-radius: 4px +} +.layui-upload-drag-xs { + width: 44px; + height: 44px; + margin-bottom: 8px; +} +.layui-upload-img-xs { + float: left; + width: 46px; + height: 46px; + margin-bottom: 8px; + border-radius: 4px +} +.layui-upload-input { + width: 377px; + height: 32px; + margin-right: 16px; +} + + +.layui-label { + float: left; + height: 32px; + padding: 0px 14px; + margin: 0px 8px 8px 0px; + background-color: #EFEFEF; + border-radius: 4px; + font-size: 14px; + color: #454B50; + display: flex; + align-items: center; + justify-content: space-between; +} +.layui-icon-close-fill-label { + font-size: 14px; + color: #AEAEAE; + margin-left: 8px; +} +.layui-input-inline-content { + padding: 19px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + border: 1px solid #E7E8EB; + box-shadow:0px 2px 6px rgba(68,70,74,0.05); + background-color: #FFFFFF; + font-size: 14px; + color: #454B50 +} +.layui-input-inline-content:hover { + border: 1px solid #3D89FF +} +.layui-laypage select{ + padding:0px; + height:26px; +} \ No newline at end of file diff --git a/admin/static/layui/layui/css/layui.css b/admin/static/layui/layui/css/layui.css new file mode 100644 index 0000000..5a10469 --- /dev/null +++ b/admin/static/layui/layui/css/layui.css @@ -0,0 +1,2 @@ +/** layui-v2.5.6 MIT License By https://www.layui.com */ + .layui-inline,img{display:inline-block;vertical-align:middle}h1,h2,h3,h4,h5,h6{font-weight:400}.layui-edge,.layui-header,.layui-inline,.layui-main{position:relative}.layui-body,.layui-edge,.layui-elip{overflow:hidden}.layui-btn,.layui-edge,.layui-inline,img{vertical-align:middle}.layui-btn,.layui-disabled,.layui-icon,.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-elip,.layui-form-checkbox span,.layui-form-pane .layui-form-label{text-overflow:ellipsis;white-space:nowrap}.layui-breadcrumb,.layui-tree-btnGroup{visibility:hidden}blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}a:active,a:hover{outline:0}img{border:none}li{list-style:none}table{border-collapse:collapse;border-spacing:0}h4,h5,h6{font-size:100%}button,input,optgroup,option,select,textarea{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;outline:0}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}body{line-height:24px;font:14px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}hr{height:1px;margin:10px 0;border:0;clear:both}a{color:#333;text-decoration:none}a:hover{color:#777}a cite{font-style:normal;*cursor:pointer}.layui-border-box,.layui-border-box *{box-sizing:border-box}.layui-box,.layui-box *{box-sizing:content-box}.layui-clear{clear:both;*zoom:1}.layui-clear:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-inline{*display:inline;*zoom:1}.layui-edge{display:inline-block;width:0;height:0;border-width:6px;border-style:dashed;border-color:transparent}.layui-edge-top{top:-4px;border-bottom-color:#999;border-bottom-style:solid}.layui-edge-right{border-left-color:#999;border-left-style:solid}.layui-edge-bottom{top:2px;border-top-color:#999;border-top-style:solid}.layui-edge-left{border-right-color:#999;border-right-style:solid}.layui-disabled,.layui-disabled:hover{color:#d2d2d2!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=256);src:url(../font/iconfont.eot?v=256#iefix) format('embedded-opentype'),url(../font/iconfont.woff2?v=256) format('woff2'),url(../font/iconfont.woff?v=256) format('woff'),url(../font/iconfont.ttf?v=256) format('truetype'),url(../font/iconfont.svg?v=256#layui-icon) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-icon-reply-fill:before{content:"\e611"}.layui-icon-set-fill:before{content:"\e614"}.layui-icon-menu-fill:before{content:"\e60f"}.layui-icon-search:before{content:"\e615"}.layui-icon-share:before{content:"\e641"}.layui-icon-set-sm:before{content:"\e620"}.layui-icon-engine:before{content:"\e628"}.layui-icon-close:before{content:"\1006"}.layui-icon-close-fill:before{content:"\1007"}.layui-icon-chart-screen:before{content:"\e629"}.layui-icon-star:before{content:"\e600"}.layui-icon-circle-dot:before{content:"\e617"}.layui-icon-chat:before{content:"\e606"}.layui-icon-release:before{content:"\e609"}.layui-icon-list:before{content:"\e60a"}.layui-icon-chart:before{content:"\e62c"}.layui-icon-ok-circle:before{content:"\1005"}.layui-icon-layim-theme:before{content:"\e61b"}.layui-icon-table:before{content:"\e62d"}.layui-icon-right:before{content:"\e602"}.layui-icon-left:before{content:"\e603"}.layui-icon-cart-simple:before{content:"\e698"}.layui-icon-face-cry:before{content:"\e69c"}.layui-icon-face-smile:before{content:"\e6af"}.layui-icon-survey:before{content:"\e6b2"}.layui-icon-tree:before{content:"\e62e"}.layui-icon-ie:before{content:"\e7bb"}.layui-icon-upload-circle:before{content:"\e62f"}.layui-icon-add-circle:before{content:"\e61f"}.layui-icon-download-circle:before{content:"\e601"}.layui-icon-templeate-1:before{content:"\e630"}.layui-icon-util:before{content:"\e631"}.layui-icon-face-surprised:before{content:"\e664"}.layui-icon-edit:before{content:"\e642"}.layui-icon-speaker:before{content:"\e645"}.layui-icon-down:before{content:"\e61a"}.layui-icon-file:before{content:"\e621"}.layui-icon-layouts:before{content:"\e632"}.layui-icon-rate-half:before{content:"\e6c9"}.layui-icon-add-circle-fine:before{content:"\e608"}.layui-icon-prev-circle:before{content:"\e633"}.layui-icon-read:before{content:"\e705"}.layui-icon-404:before{content:"\e61c"}.layui-icon-carousel:before{content:"\e634"}.layui-icon-help:before{content:"\e607"}.layui-icon-code-circle:before{content:"\e635"}.layui-icon-windows:before{content:"\e67f"}.layui-icon-water:before{content:"\e636"}.layui-icon-username:before{content:"\e66f"}.layui-icon-find-fill:before{content:"\e670"}.layui-icon-about:before{content:"\e60b"}.layui-icon-location:before{content:"\e715"}.layui-icon-up:before{content:"\e619"}.layui-icon-pause:before{content:"\e651"}.layui-icon-date:before{content:"\e637"}.layui-icon-layim-uploadfile:before{content:"\e61d"}.layui-icon-delete:before{content:"\e640"}.layui-icon-play:before{content:"\e652"}.layui-icon-top:before{content:"\e604"}.layui-icon-firefox:before{content:"\e686"}.layui-icon-friends:before{content:"\e612"}.layui-icon-refresh-3:before{content:"\e9aa"}.layui-icon-ok:before{content:"\e605"}.layui-icon-layer:before{content:"\e638"}.layui-icon-face-smile-fine:before{content:"\e60c"}.layui-icon-dollar:before{content:"\e659"}.layui-icon-group:before{content:"\e613"}.layui-icon-layim-download:before{content:"\e61e"}.layui-icon-picture-fine:before{content:"\e60d"}.layui-icon-link:before{content:"\e64c"}.layui-icon-diamond:before{content:"\e735"}.layui-icon-log:before{content:"\e60e"}.layui-icon-key:before{content:"\e683"}.layui-icon-rate-solid:before{content:"\e67a"}.layui-icon-fonts-del:before{content:"\e64f"}.layui-icon-unlink:before{content:"\e64d"}.layui-icon-fonts-clear:before{content:"\e639"}.layui-icon-triangle-r:before{content:"\e623"}.layui-icon-circle:before{content:"\e63f"}.layui-icon-radio:before{content:"\e643"}.layui-icon-align-center:before{content:"\e647"}.layui-icon-align-right:before{content:"\e648"}.layui-icon-align-left:before{content:"\e649"}.layui-icon-loading-1:before{content:"\e63e"}.layui-icon-return:before{content:"\e65c"}.layui-icon-fonts-strong:before{content:"\e62b"}.layui-icon-upload:before{content:"\e67c"}.layui-icon-dialogue:before{content:"\e63a"}.layui-icon-video:before{content:"\e6ed"}.layui-icon-headset:before{content:"\e6fc"}.layui-icon-cellphone-fine:before{content:"\e63b"}.layui-icon-add-1:before{content:"\e654"}.layui-icon-face-smile-b:before{content:"\e650"}.layui-icon-fonts-html:before{content:"\e64b"}.layui-icon-screen-full:before{content:"\e622"}.layui-icon-form:before{content:"\e63c"}.layui-icon-cart:before{content:"\e657"}.layui-icon-camera-fill:before{content:"\e65d"}.layui-icon-tabs:before{content:"\e62a"}.layui-icon-heart-fill:before{content:"\e68f"}.layui-icon-fonts-code:before{content:"\e64e"}.layui-icon-ios:before{content:"\e680"}.layui-icon-at:before{content:"\e687"}.layui-icon-fire:before{content:"\e756"}.layui-icon-set:before{content:"\e716"}.layui-icon-fonts-u:before{content:"\e646"}.layui-icon-triangle-d:before{content:"\e625"}.layui-icon-tips:before{content:"\e702"}.layui-icon-picture:before{content:"\e64a"}.layui-icon-more-vertical:before{content:"\e671"}.layui-icon-bluetooth:before{content:"\e689"}.layui-icon-flag:before{content:"\e66c"}.layui-icon-loading:before{content:"\e63d"}.layui-icon-fonts-i:before{content:"\e644"}.layui-icon-refresh-1:before{content:"\e666"}.layui-icon-rmb:before{content:"\e65e"}.layui-icon-addition:before{content:"\e624"}.layui-icon-home:before{content:"\e68e"}.layui-icon-time:before{content:"\e68d"}.layui-icon-user:before{content:"\e770"}.layui-icon-notice:before{content:"\e667"}.layui-icon-chrome:before{content:"\e68a"}.layui-icon-edge:before{content:"\e68b"}.layui-icon-login-weibo:before{content:"\e675"}.layui-icon-voice:before{content:"\e688"}.layui-icon-upload-drag:before{content:"\e681"}.layui-icon-login-qq:before{content:"\e676"}.layui-icon-snowflake:before{content:"\e6b1"}.layui-icon-heart:before{content:"\e68c"}.layui-icon-logout:before{content:"\e682"}.layui-icon-file-b:before{content:"\e655"}.layui-icon-template:before{content:"\e663"}.layui-icon-transfer:before{content:"\e691"}.layui-icon-auz:before{content:"\e672"}.layui-icon-console:before{content:"\e665"}.layui-icon-app:before{content:"\e653"}.layui-icon-prev:before{content:"\e65a"}.layui-icon-website:before{content:"\e7ae"}.layui-icon-next:before{content:"\e65b"}.layui-icon-component:before{content:"\e857"}.layui-icon-android:before{content:"\e684"}.layui-icon-more:before{content:"\e65f"}.layui-icon-login-wechat:before{content:"\e677"}.layui-icon-shrink-right:before{content:"\e668"}.layui-icon-spread-left:before{content:"\e66b"}.layui-icon-camera:before{content:"\e660"}.layui-icon-note:before{content:"\e66e"}.layui-icon-refresh:before{content:"\e669"}.layui-icon-female:before{content:"\e661"}.layui-icon-male:before{content:"\e662"}.layui-icon-screen-restore:before{content:"\e758"}.layui-icon-password:before{content:"\e673"}.layui-icon-senior:before{content:"\e674"}.layui-icon-theme:before{content:"\e66a"}.layui-icon-tread:before{content:"\e6c5"}.layui-icon-praise:before{content:"\e6c6"}.layui-icon-star-fill:before{content:"\e658"}.layui-icon-rate:before{content:"\e67b"}.layui-icon-template-1:before{content:"\e656"}.layui-icon-vercode:before{content:"\e679"}.layui-icon-service:before{content:"\e626"}.layui-icon-cellphone:before{content:"\e678"}.layui-icon-print:before{content:"\e66d"}.layui-icon-cols:before{content:"\e610"}.layui-icon-wifi:before{content:"\e7e0"}.layui-icon-export:before{content:"\e67d"}.layui-icon-rss:before{content:"\e808"}.layui-icon-slider:before{content:"\e714"}.layui-icon-email:before{content:"\e618"}.layui-icon-subtraction:before{content:"\e67e"}.layui-icon-mike:before{content:"\e6dc"}.layui-icon-light:before{content:"\e748"}.layui-icon-gift:before{content:"\e627"}.layui-icon-mute:before{content:"\e685"}.layui-icon-reduce-circle:before{content:"\e616"}.layui-icon-music:before{content:"\e690"}.layui-main{width:1140px;margin:0 auto}.layui-header{z-index:1000;height:60px}.layui-header a:hover{transition:all .5s;-webkit-transition:all .5s}.layui-side{position:fixed;left:0;top:0;bottom:0;z-index:999;width:200px;overflow-x:hidden}.layui-side-scroll{position:relative;width:220px;height:100%;overflow-x:hidden}.layui-body{position:absolute;left:200px;right:0;top:0;bottom:0;z-index:998;width:auto;overflow-y:auto;box-sizing:border-box}.layui-layout-body{overflow:hidden}.layui-layout-admin .layui-header{background-color:#23262E}.layui-layout-admin .layui-side{top:60px;width:200px;overflow-x:hidden}.layui-layout-admin .layui-body{position:fixed;top:60px;bottom:44px}.layui-layout-admin .layui-main{width:auto;margin:0 15px}.layui-layout-admin .layui-footer{position:fixed;left:200px;right:0;bottom:0;height:44px;line-height:44px;padding:0 15px;background-color:#eee}.layui-layout-admin .layui-logo{position:absolute;left:0;top:0;width:200px;height:100%;line-height:60px;text-align:center;color:#009688;font-size:16px}.layui-layout-admin .layui-header .layui-nav{background:0 0}.layui-layout-left{position:absolute!important;left:200px;top:0}.layui-layout-right{position:absolute!important;right:0;top:0}.layui-container{position:relative;margin:0 auto;padding:0 15px;box-sizing:border-box}.layui-fluid{position:relative;margin:0 auto;padding:0 15px}.layui-row:after,.layui-row:before{content:'';display:block;clear:both}.layui-col-lg1,.layui-col-lg10,.layui-col-lg11,.layui-col-lg12,.layui-col-lg2,.layui-col-lg3,.layui-col-lg4,.layui-col-lg5,.layui-col-lg6,.layui-col-lg7,.layui-col-lg8,.layui-col-lg9,.layui-col-md1,.layui-col-md10,.layui-col-md11,.layui-col-md12,.layui-col-md2,.layui-col-md3,.layui-col-md4,.layui-col-md5,.layui-col-md6,.layui-col-md7,.layui-col-md8,.layui-col-md9,.layui-col-sm1,.layui-col-sm10,.layui-col-sm11,.layui-col-sm12,.layui-col-sm2,.layui-col-sm3,.layui-col-sm4,.layui-col-sm5,.layui-col-sm6,.layui-col-sm7,.layui-col-sm8,.layui-col-sm9,.layui-col-xs1,.layui-col-xs10,.layui-col-xs11,.layui-col-xs12,.layui-col-xs2,.layui-col-xs3,.layui-col-xs4,.layui-col-xs5,.layui-col-xs6,.layui-col-xs7,.layui-col-xs8,.layui-col-xs9{position:relative;display:block;box-sizing:border-box}.layui-col-xs1,.layui-col-xs10,.layui-col-xs11,.layui-col-xs12,.layui-col-xs2,.layui-col-xs3,.layui-col-xs4,.layui-col-xs5,.layui-col-xs6,.layui-col-xs7,.layui-col-xs8,.layui-col-xs9{float:left}.layui-col-xs1{width:8.33333333%}.layui-col-xs2{width:16.66666667%}.layui-col-xs3{width:25%}.layui-col-xs4{width:33.33333333%}.layui-col-xs5{width:41.66666667%}.layui-col-xs6{width:50%}.layui-col-xs7{width:58.33333333%}.layui-col-xs8{width:66.66666667%}.layui-col-xs9{width:75%}.layui-col-xs10{width:83.33333333%}.layui-col-xs11{width:91.66666667%}.layui-col-xs12{width:100%}.layui-col-xs-offset1{margin-left:8.33333333%}.layui-col-xs-offset2{margin-left:16.66666667%}.layui-col-xs-offset3{margin-left:25%}.layui-col-xs-offset4{margin-left:33.33333333%}.layui-col-xs-offset5{margin-left:41.66666667%}.layui-col-xs-offset6{margin-left:50%}.layui-col-xs-offset7{margin-left:58.33333333%}.layui-col-xs-offset8{margin-left:66.66666667%}.layui-col-xs-offset9{margin-left:75%}.layui-col-xs-offset10{margin-left:83.33333333%}.layui-col-xs-offset11{margin-left:91.66666667%}.layui-col-xs-offset12{margin-left:100%}@media screen and (max-width:768px){.layui-hide-xs{display:none!important}.layui-show-xs-block{display:block!important}.layui-show-xs-inline{display:inline!important}.layui-show-xs-inline-block{display:inline-block!important}}@media screen and (min-width:768px){.layui-container{width:750px}.layui-hide-sm{display:none!important}.layui-show-sm-block{display:block!important}.layui-show-sm-inline{display:inline!important}.layui-show-sm-inline-block{display:inline-block!important}.layui-col-sm1,.layui-col-sm10,.layui-col-sm11,.layui-col-sm12,.layui-col-sm2,.layui-col-sm3,.layui-col-sm4,.layui-col-sm5,.layui-col-sm6,.layui-col-sm7,.layui-col-sm8,.layui-col-sm9{float:left}.layui-col-sm1{width:8.33333333%}.layui-col-sm2{width:16.66666667%}.layui-col-sm3{width:25%}.layui-col-sm4{width:33.33333333%}.layui-col-sm5{width:41.66666667%}.layui-col-sm6{width:50%}.layui-col-sm7{width:58.33333333%}.layui-col-sm8{width:66.66666667%}.layui-col-sm9{width:75%}.layui-col-sm10{width:83.33333333%}.layui-col-sm11{width:91.66666667%}.layui-col-sm12{width:100%}.layui-col-sm-offset1{margin-left:8.33333333%}.layui-col-sm-offset2{margin-left:16.66666667%}.layui-col-sm-offset3{margin-left:25%}.layui-col-sm-offset4{margin-left:33.33333333%}.layui-col-sm-offset5{margin-left:41.66666667%}.layui-col-sm-offset6{margin-left:50%}.layui-col-sm-offset7{margin-left:58.33333333%}.layui-col-sm-offset8{margin-left:66.66666667%}.layui-col-sm-offset9{margin-left:75%}.layui-col-sm-offset10{margin-left:83.33333333%}.layui-col-sm-offset11{margin-left:91.66666667%}.layui-col-sm-offset12{margin-left:100%}}@media screen and (min-width:992px){.layui-container{width:970px}.layui-hide-md{display:none!important}.layui-show-md-block{display:block!important}.layui-show-md-inline{display:inline!important}.layui-show-md-inline-block{display:inline-block!important}.layui-col-md1,.layui-col-md10,.layui-col-md11,.layui-col-md12,.layui-col-md2,.layui-col-md3,.layui-col-md4,.layui-col-md5,.layui-col-md6,.layui-col-md7,.layui-col-md8,.layui-col-md9{float:left}.layui-col-md1{width:8.33333333%}.layui-col-md2{width:16.66666667%}.layui-col-md3{width:25%}.layui-col-md4{width:33.33333333%}.layui-col-md5{width:41.66666667%}.layui-col-md6{width:50%}.layui-col-md7{width:58.33333333%}.layui-col-md8{width:66.66666667%}.layui-col-md9{width:75%}.layui-col-md10{width:83.33333333%}.layui-col-md11{width:91.66666667%}.layui-col-md12{width:100%}.layui-col-md-offset1{margin-left:8.33333333%}.layui-col-md-offset2{margin-left:16.66666667%}.layui-col-md-offset3{margin-left:25%}.layui-col-md-offset4{margin-left:33.33333333%}.layui-col-md-offset5{margin-left:41.66666667%}.layui-col-md-offset6{margin-left:50%}.layui-col-md-offset7{margin-left:58.33333333%}.layui-col-md-offset8{margin-left:66.66666667%}.layui-col-md-offset9{margin-left:75%}.layui-col-md-offset10{margin-left:83.33333333%}.layui-col-md-offset11{margin-left:91.66666667%}.layui-col-md-offset12{margin-left:100%}}@media screen and (min-width:1200px){.layui-container{width:1170px}.layui-hide-lg{display:none!important}.layui-show-lg-block{display:block!important}.layui-show-lg-inline{display:inline!important}.layui-show-lg-inline-block{display:inline-block!important}.layui-col-lg1,.layui-col-lg10,.layui-col-lg11,.layui-col-lg12,.layui-col-lg2,.layui-col-lg3,.layui-col-lg4,.layui-col-lg5,.layui-col-lg6,.layui-col-lg7,.layui-col-lg8,.layui-col-lg9{float:left}.layui-col-lg1{width:8.33333333%}.layui-col-lg2{width:16.66666667%}.layui-col-lg3{width:25%}.layui-col-lg4{width:33.33333333%}.layui-col-lg5{width:41.66666667%}.layui-col-lg6{width:50%}.layui-col-lg7{width:58.33333333%}.layui-col-lg8{width:66.66666667%}.layui-col-lg9{width:75%}.layui-col-lg10{width:83.33333333%}.layui-col-lg11{width:91.66666667%}.layui-col-lg12{width:100%}.layui-col-lg-offset1{margin-left:8.33333333%}.layui-col-lg-offset2{margin-left:16.66666667%}.layui-col-lg-offset3{margin-left:25%}.layui-col-lg-offset4{margin-left:33.33333333%}.layui-col-lg-offset5{margin-left:41.66666667%}.layui-col-lg-offset6{margin-left:50%}.layui-col-lg-offset7{margin-left:58.33333333%}.layui-col-lg-offset8{margin-left:66.66666667%}.layui-col-lg-offset9{margin-left:75%}.layui-col-lg-offset10{margin-left:83.33333333%}.layui-col-lg-offset11{margin-left:91.66666667%}.layui-col-lg-offset12{margin-left:100%}}.layui-col-space1{margin:-.5px}.layui-col-space1>*{padding:.5px}.layui-col-space2{margin:-1px}.layui-col-space2>*{padding:1px}.layui-col-space4{margin:-2px}.layui-col-space4>*{padding:2px}.layui-col-space5{margin:-2.5px}.layui-col-space5>*{padding:2.5px}.layui-col-space6{margin:-3px}.layui-col-space6>*{padding:3px}.layui-col-space8{margin:-4px}.layui-col-space8>*{padding:4px}.layui-col-space10{margin:-5px}.layui-col-space10>*{padding:5px}.layui-col-space12{margin:-6px}.layui-col-space12>*{padding:6px}.layui-col-space14{margin:-7px}.layui-col-space14>*{padding:7px}.layui-col-space15{margin:-7.5px}.layui-col-space15>*{padding:7.5px}.layui-col-space16{margin:-8px}.layui-col-space16>*{padding:8px}.layui-col-space18{margin:-9px}.layui-col-space18>*{padding:9px}.layui-col-space20{margin:-10px}.layui-col-space20>*{padding:10px}.layui-col-space22{margin:-11px}.layui-col-space22>*{padding:11px}.layui-col-space24{margin:-12px}.layui-col-space24>*{padding:12px}.layui-col-space25{margin:-12.5px}.layui-col-space25>*{padding:12.5px}.layui-col-space26{margin:-13px}.layui-col-space26>*{padding:13px}.layui-col-space28{margin:-14px}.layui-col-space28>*{padding:14px}.layui-col-space30{margin:-15px}.layui-col-space30>*{padding:15px}.layui-btn,.layui-input,.layui-select,.layui-textarea,.layui-upload-button{outline:0;-webkit-appearance:none;transition:all .3s;-webkit-transition:all .3s;box-sizing:border-box}.layui-elem-quote{margin-bottom:10px;padding:15px;line-height:22px;border-left:5px solid #009688;border-radius:0 2px 2px 0;background-color:#f2f2f2}.layui-quote-nm{border-style:solid;border-width:1px 1px 1px 5px;background:0 0}.layui-elem-field{margin-bottom:10px;padding:0;border-width:1px;border-style:solid}.layui-elem-field legend{margin-left:20px;padding:0 10px;font-size:20px;font-weight:300}.layui-field-title{margin:10px 0 20px;border-width:1px 0 0}.layui-field-box{padding:10px 15px}.layui-field-title .layui-field-box{padding:10px 0}.layui-progress{position:relative;height:6px;border-radius:20px;background-color:#e2e2e2}.layui-progress-bar{position:absolute;left:0;top:0;width:0;max-width:100%;height:6px;border-radius:20px;text-align:right;background-color:#5FB878;transition:all .3s;-webkit-transition:all .3s}.layui-progress-big,.layui-progress-big .layui-progress-bar{height:18px;line-height:18px}.layui-progress-text{position:relative;top:-20px;line-height:18px;font-size:12px;color:#666}.layui-progress-big .layui-progress-text{position:static;padding:0 10px;color:#fff}.layui-collapse{border-width:1px;border-style:solid;border-radius:2px}.layui-colla-content,.layui-colla-item{border-top-width:1px;border-top-style:solid}.layui-colla-item:first-child{border-top:none}.layui-colla-title{position:relative;height:42px;line-height:42px;padding:0 15px 0 35px;color:#333;background-color:#f2f2f2;cursor:pointer;font-size:14px;overflow:hidden}.layui-colla-content{display:none;padding:10px 15px;line-height:22px;color:#666}.layui-colla-icon{position:absolute;left:15px;top:0;font-size:14px}.layui-card{margin-bottom:15px;border-radius:2px;background-color:#fff;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}.layui-card:last-child{margin-bottom:0}.layui-card-header{position:relative;height:42px;line-height:42px;padding:0 15px;border-bottom:1px solid #f6f6f6;color:#333;border-radius:2px 2px 0 0;font-size:14px}.layui-bg-black,.layui-bg-blue,.layui-bg-cyan,.layui-bg-green,.layui-bg-orange,.layui-bg-red{color:#fff!important}.layui-card-body{position:relative;padding:10px 15px;line-height:24px}.layui-card-body[pad15]{padding:15px}.layui-card-body[pad20]{padding:20px}.layui-card-body .layui-table{margin:5px 0}.layui-card .layui-tab{margin:0}.layui-panel-window{position:relative;padding:15px;border-radius:0;border-top:5px solid #E6E6E6;background-color:#fff}.layui-auxiliar-moving{position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;background:0 0;z-index:9999999999}.layui-form-label,.layui-form-mid,.layui-form-select,.layui-input-block,.layui-input-inline,.layui-textarea{position:relative}.layui-bg-red{background-color:#FF5722!important}.layui-bg-orange{background-color:#FFB800!important}.layui-bg-green{background-color:#009688!important}.layui-bg-cyan{background-color:#2F4056!important}.layui-bg-blue{background-color:#1E9FFF!important}.layui-bg-black{background-color:#393D49!important}.layui-bg-gray{background-color:#eee!important;color:#666!important}.layui-badge-rim,.layui-colla-content,.layui-colla-item,.layui-collapse,.layui-elem-field,.layui-form-pane .layui-form-item[pane],.layui-form-pane .layui-form-label,.layui-input,.layui-layedit,.layui-layedit-tool,.layui-quote-nm,.layui-select,.layui-tab-bar,.layui-tab-card,.layui-tab-title,.layui-tab-title .layui-this:after,.layui-textarea{border-color:#e6e6e6}.layui-timeline-item:before,hr{background-color:#e6e6e6}.layui-text{line-height:22px;font-size:14px;color:#666}.layui-text h1,.layui-text h2,.layui-text h3{font-weight:500;color:#333}.layui-text h1{font-size:30px}.layui-text h2{font-size:24px}.layui-text h3{font-size:18px}.layui-text a:not(.layui-btn){color:#01AAED}.layui-text a:not(.layui-btn):hover{text-decoration:underline}.layui-text ul{padding:5px 0 5px 15px}.layui-text ul li{margin-top:5px;list-style-type:disc}.layui-text em,.layui-word-aux{color:#999!important;padding:0 5px!important}.layui-btn{display:inline-block;height:38px;line-height:38px;padding:0 18px;background-color:#009688;color:#fff;white-space:nowrap;text-align:center;font-size:14px;border:none;border-radius:2px;cursor:pointer}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80);color:#fff}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn+.layui-btn{margin-left:10px}.layui-btn-container{font-size:0}.layui-btn-container .layui-btn{margin-right:10px;margin-bottom:10px}.layui-btn-container .layui-btn+.layui-btn{margin-left:0}.layui-table .layui-btn-container .layui-btn{margin-bottom:9px}.layui-btn-radius{border-radius:100px}.layui-btn .layui-icon{margin-right:3px;font-size:18px;vertical-align:bottom;vertical-align:middle\9}.layui-btn-primary{border:1px solid #C9C9C9;background-color:#fff;color:#555}.layui-btn-primary:hover{border-color:#009688;color:#333}.layui-btn-normal{background-color:#1E9FFF}.layui-btn-warm{background-color:#FFB800}.layui-btn-danger{background-color:#FF5722}.layui-btn-checked{background-color:#5FB878}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border:1px solid #e6e6e6;background-color:#FBFBFB;color:#C9C9C9;cursor:not-allowed;opacity:1}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-sm i{font-size:16px!important}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:14px!important}.layui-btn-group{display:inline-block;vertical-align:middle;font-size:0}.layui-btn-group .layui-btn{margin-left:0!important;margin-right:0!important;border-left:1px solid rgba(255,255,255,.5);border-radius:0}.layui-btn-group .layui-btn-primary{border-left:none}.layui-btn-group .layui-btn-primary:hover{border-color:#C9C9C9;color:#009688}.layui-btn-group .layui-btn:first-child{border-left:none;border-radius:2px 0 0 2px}.layui-btn-group .layui-btn-primary:first-child{border-left:1px solid #c9c9c9}.layui-btn-group .layui-btn:last-child{border-radius:0 2px 2px 0}.layui-btn-group .layui-btn+.layui-btn{margin-left:0}.layui-btn-group+.layui-btn-group{margin-left:10px}.layui-btn-fluid{width:100%}.layui-input,.layui-select,.layui-textarea{height:38px;line-height:1.3;line-height:38px\9;border-width:1px;border-style:solid;background-color:#fff;border-radius:2px}.layui-input::-webkit-input-placeholder,.layui-select::-webkit-input-placeholder,.layui-textarea::-webkit-input-placeholder{line-height:1.3}.layui-input,.layui-textarea{display:block;width:100%;padding-left:10px}.layui-input:hover,.layui-textarea:hover{border-color:#D2D2D2!important}.layui-input:focus,.layui-textarea:focus{border-color:#C9C9C9!important}.layui-textarea{min-height:100px;height:auto;line-height:20px;padding:6px 10px;resize:vertical}.layui-select{padding:0 10px}.layui-form input[type=checkbox],.layui-form input[type=radio],.layui-form select{display:none}.layui-form [lay-ignore]{display:initial}.layui-form-item{margin-bottom:15px;clear:both;*zoom:1}.layui-form-item:after{content:'\20';clear:both;*zoom:1;display:block;height:0}.layui-form-label{float:left;display:block;padding:9px 15px;width:80px;font-weight:400;line-height:20px;text-align:right}.layui-form-label-col{display:block;float:none;padding:9px 0;line-height:20px;text-align:left}.layui-form-item .layui-inline{margin-bottom:5px;margin-right:10px}.layui-input-block{margin-left:110px;min-height:36px}.layui-input-inline{display:inline-block;vertical-align:middle}.layui-form-item .layui-input-inline{float:left;width:190px;margin-right:10px}.layui-form-text .layui-input-inline{width:auto}.layui-form-mid{float:left;display:block;padding:9px 0!important;line-height:20px;margin-right:10px}.layui-form-danger+.layui-form-select .layui-input,.layui-form-danger:focus{border-color:#FF5722!important}.layui-form-select .layui-input{padding-right:30px;cursor:pointer}.layui-form-select .layui-edge{position:absolute;right:10px;top:50%;margin-top:-3px;cursor:pointer;border-width:6px;border-top-color:#c2c2c2;border-top-style:solid;transition:all .3s;-webkit-transition:all .3s}.layui-form-select dl{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:899;min-width:100%;border:1px solid #d2d2d2;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12);box-sizing:border-box}.layui-form-select dl dd,.layui-form-select dl dt{padding:0 10px;line-height:36px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-form-select dl dt{font-size:12px;color:#999}.layui-form-select dl dd{cursor:pointer}.layui-form-select dl dd:hover{background-color:#f2f2f2;-webkit-transition:.5s all;transition:.5s all}.layui-form-select .layui-select-group dd{padding-left:20px}.layui-form-select dl dd.layui-select-tips{padding-left:10px!important;color:#999}.layui-form-select dl dd.layui-this{background-color:#5FB878;color:#fff}.layui-form-checkbox,.layui-form-select dl dd.layui-disabled{background-color:#fff}.layui-form-selected dl{display:block}.layui-form-checkbox,.layui-form-checkbox *,.layui-form-switch{display:inline-block;vertical-align:middle}.layui-form-selected .layui-edge{margin-top:-9px;-webkit-transform:rotate(180deg);transform:rotate(180deg);margin-top:-3px\9}:root .layui-form-selected .layui-edge{margin-top:-9px\0/IE9}.layui-form-selectup dl{top:auto;bottom:42px}.layui-select-none{margin:5px 0;text-align:center;color:#999}.layui-select-disabled .layui-disabled{border-color:#eee!important}.layui-select-disabled .layui-edge{border-top-color:#d2d2d2}.layui-form-checkbox{position:relative;height:30px;line-height:30px;margin-right:10px;padding-right:30px;cursor:pointer;font-size:0;-webkit-transition:.1s linear;transition:.1s linear;box-sizing:border-box}.layui-form-checkbox span{padding:0 10px;height:100%;font-size:14px;border-radius:2px 0 0 2px;background-color:#d2d2d2;color:#fff;overflow:hidden}.layui-form-checkbox:hover span{background-color:#c2c2c2}.layui-form-checkbox i{position:absolute;right:0;top:0;width:30px;height:28px;border:1px solid #d2d2d2;border-left:none;border-radius:0 2px 2px 0;color:#fff;font-size:20px;text-align:center}.layui-form-checkbox:hover i{border-color:#c2c2c2;color:#c2c2c2}.layui-form-checked,.layui-form-checked:hover{border-color:#5FB878}.layui-form-checked span,.layui-form-checked:hover span{background-color:#5FB878}.layui-form-checked i,.layui-form-checked:hover i{color:#5FB878}.layui-form-item .layui-form-checkbox{margin-top:4px}.layui-form-checkbox[lay-skin=primary]{height:auto!important;line-height:normal!important;min-width:18px;min-height:18px;border:none!important;margin-right:0;padding-left:28px;padding-right:0;background:0 0}.layui-form-checkbox[lay-skin=primary] span{padding-left:0;padding-right:15px;line-height:18px;background:0 0;color:#666}.layui-form-checkbox[lay-skin=primary] i{right:auto;left:0;width:16px;height:16px;line-height:16px;border:1px solid #d2d2d2;font-size:12px;border-radius:2px;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-checkbox[lay-skin=primary]:hover i{border-color:#5FB878;color:#fff}.layui-form-checked[lay-skin=primary] i{border-color:#5FB878!important;background-color:#5FB878;color:#fff}.layui-checkbox-disbaled[lay-skin=primary] span{background:0 0!important;color:#c2c2c2}.layui-checkbox-disbaled[lay-skin=primary]:hover i{border-color:#d2d2d2}.layui-form-item .layui-form-checkbox[lay-skin=primary]{margin-top:10px}.layui-form-switch{position:relative;height:22px;line-height:22px;min-width:35px;padding:0 5px;margin-top:8px;border:1px solid #d2d2d2;border-radius:20px;cursor:pointer;background-color:#fff;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch i{position:absolute;left:5px;top:3px;width:16px;height:16px;border-radius:20px;background-color:#d2d2d2;-webkit-transition:.1s linear;transition:.1s linear}.layui-form-switch em{position:relative;top:0;width:25px;margin-left:21px;padding:0!important;text-align:center!important;color:#999!important;font-style:normal!important;font-size:12px}.layui-form-onswitch{border-color:#5FB878;background-color:#5FB878}.layui-checkbox-disbaled,.layui-checkbox-disbaled i{border-color:#e2e2e2!important}.layui-form-onswitch i{left:100%;margin-left:-21px;background-color:#fff}.layui-form-onswitch em{margin-left:5px;margin-right:21px;color:#fff!important}.layui-checkbox-disbaled span{background-color:#e2e2e2!important}.layui-checkbox-disbaled:hover i{color:#fff!important}[lay-radio]{display:none}.layui-form-radio,.layui-form-radio *{display:inline-block;vertical-align:middle}.layui-form-radio{line-height:28px;margin:6px 10px 0 0;padding-right:10px;cursor:pointer;font-size:0}.layui-form-radio *{font-size:14px}.layui-form-radio>i{margin-right:8px;font-size:22px;color:#c2c2c2}.layui-form-radio>i:hover,.layui-form-radioed>i{color:#5FB878}.layui-radio-disbaled>i{color:#e2e2e2!important}.layui-form-pane .layui-form-label{width:110px;padding:8px 15px;height:38px;line-height:20px;border-width:1px;border-style:solid;border-radius:2px 0 0 2px;text-align:center;background-color:#FBFBFB;overflow:hidden;box-sizing:border-box}.layui-form-pane .layui-input-inline{margin-left:-1px}.layui-form-pane .layui-input-block{margin-left:110px;left:-1px}.layui-form-pane .layui-input{border-radius:0 2px 2px 0}.layui-form-pane .layui-form-text .layui-form-label{float:none;width:100%;border-radius:2px;box-sizing:border-box;text-align:left}.layui-form-pane .layui-form-text .layui-input-inline{display:block;margin:0;top:-1px;clear:both}.layui-form-pane .layui-form-text .layui-input-block{margin:0;left:0;top:-1px}.layui-form-pane .layui-form-text .layui-textarea{min-height:100px;border-radius:0 0 2px 2px}.layui-form-pane .layui-form-checkbox{margin:4px 0 4px 10px}.layui-form-pane .layui-form-radio,.layui-form-pane .layui-form-switch{margin-top:6px;margin-left:10px}.layui-form-pane .layui-form-item[pane]{position:relative;border-width:1px;border-style:solid}.layui-form-pane .layui-form-item[pane] .layui-form-label{position:absolute;left:0;top:0;height:100%;border-width:0 1px 0 0}.layui-form-pane .layui-form-item[pane] .layui-input-inline{margin-left:110px}@media screen and (max-width:450px){.layui-form-item .layui-form-label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-form-item .layui-inline{display:block;margin-right:0;margin-bottom:20px;clear:both}.layui-form-item .layui-inline:after{content:'\20';clear:both;display:block;height:0}.layui-form-item .layui-input-inline{display:block;float:none;left:-3px;width:auto;margin:0 0 10px 112px}.layui-form-item .layui-input-inline+.layui-form-mid{margin-left:110px;top:-5px;padding:0}.layui-form-item .layui-form-checkbox{margin-right:5px;margin-bottom:5px}}.layui-layedit{border-width:1px;border-style:solid;border-radius:2px}.layui-layedit-tool{padding:3px 5px;border-bottom-width:1px;border-bottom-style:solid;font-size:0}.layedit-tool-fixed{position:fixed;top:0;border-top:1px solid #e2e2e2}.layui-layedit-tool .layedit-tool-mid,.layui-layedit-tool .layui-icon{display:inline-block;vertical-align:middle;text-align:center;font-size:14px}.layui-layedit-tool .layui-icon{position:relative;width:32px;height:30px;line-height:30px;margin:3px 5px;color:#777;cursor:pointer;border-radius:2px}.layui-layedit-tool .layui-icon:hover{color:#393D49}.layui-layedit-tool .layui-icon:active{color:#000}.layui-layedit-tool .layedit-tool-active{background-color:#e2e2e2;color:#000}.layui-layedit-tool .layui-disabled,.layui-layedit-tool .layui-disabled:hover{color:#d2d2d2;cursor:not-allowed}.layui-layedit-tool .layedit-tool-mid{width:1px;height:18px;margin:0 10px;background-color:#d2d2d2}.layedit-tool-html{width:50px!important;font-size:30px!important}.layedit-tool-b,.layedit-tool-code,.layedit-tool-help{font-size:16px!important}.layedit-tool-d,.layedit-tool-face,.layedit-tool-image,.layedit-tool-unlink{font-size:18px!important}.layedit-tool-image input{position:absolute;font-size:0;left:0;top:0;width:100%;height:100%;opacity:.01;filter:Alpha(opacity=1);cursor:pointer}.layui-layedit-iframe iframe{display:block;width:100%}#LAY_layedit_code{overflow:hidden}.layui-laypage{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;margin:10px 0;font-size:0}.layui-laypage>a:first-child,.layui-laypage>a:first-child em{border-radius:2px 0 0 2px}.layui-laypage>a:last-child,.layui-laypage>a:last-child em{border-radius:0 2px 2px 0}.layui-laypage>:first-child{margin-left:0!important}.layui-laypage>:last-child{margin-right:0!important}.layui-laypage a,.layui-laypage button,.layui-laypage input,.layui-laypage select,.layui-laypage span{border:1px solid #e2e2e2}.layui-laypage a,.layui-laypage span{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding:0 15px;height:28px;line-height:28px;margin:0 -1px 5px 0;background-color:#fff;color:#333;font-size:12px}.layui-flow-more a *,.layui-laypage input,.layui-table-view select[lay-ignore]{display:inline-block}.layui-laypage a:hover{color:#009688}.layui-laypage em{font-style:normal}.layui-laypage .layui-laypage-spr{color:#999;font-weight:700}.layui-laypage a{text-decoration:none}.layui-laypage .layui-laypage-curr{position:relative}.layui-laypage .layui-laypage-curr em{position:relative;color:#fff}.layui-laypage .layui-laypage-curr .layui-laypage-em{position:absolute;left:-1px;top:-1px;padding:1px;width:100%;height:100%;background-color:#009688}.layui-laypage-em{border-radius:2px}.layui-laypage-next em,.layui-laypage-prev em{font-family:Sim sun;font-size:16px}.layui-laypage .layui-laypage-count,.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh,.layui-laypage .layui-laypage-skip{margin-left:10px;margin-right:10px;padding:0;border:none}.layui-laypage .layui-laypage-limits,.layui-laypage .layui-laypage-refresh{vertical-align:top}.layui-laypage .layui-laypage-refresh i{font-size:18px;cursor:pointer}.layui-laypage select{height:22px;padding:3px;border-radius:2px;cursor:pointer}.layui-laypage .layui-laypage-skip{height:30px;line-height:30px;color:#999}.layui-laypage button,.layui-laypage input{height:30px;line-height:30px;border-radius:2px;vertical-align:top;background-color:#fff;box-sizing:border-box}.layui-laypage input{width:40px;margin:0 10px;padding:0 3px;text-align:center}.layui-laypage input:focus,.layui-laypage select:focus{border-color:#009688!important}.layui-laypage button{margin-left:10px;padding:0 10px;cursor:pointer}.layui-table,.layui-table-view{margin:10px 0}.layui-flow-more{margin:10px 0;text-align:center;color:#999;font-size:14px}.layui-flow-more a{height:32px;line-height:32px}.layui-flow-more a *{vertical-align:top}.layui-flow-more a cite{padding:0 20px;border-radius:3px;background-color:#eee;color:#333;font-style:normal}.layui-flow-more a cite:hover{opacity:.8}.layui-flow-more a i{font-size:30px;color:#737383}.layui-table{width:100%;background-color:#fff;color:#666}.layui-table tr{transition:all .3s;-webkit-transition:all .3s}.layui-table th{text-align:left;font-weight:400}.layui-table tbody tr:hover,.layui-table thead tr,.layui-table-click,.layui-table-header,.layui-table-hover,.layui-table-mend,.layui-table-patch,.layui-table-tool,.layui-table-total,.layui-table-total tr,.layui-table[lay-even] tr:nth-child(even){background-color:#f2f2f2}.layui-table td,.layui-table th,.layui-table-col-set,.layui-table-fixed-r,.layui-table-grid-down,.layui-table-header,.layui-table-page,.layui-table-tips-main,.layui-table-tool,.layui-table-total,.layui-table-view,.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border-width:1px;border-style:solid;border-color:#e6e6e6}.layui-table td,.layui-table th{position:relative;padding:9px 15px;min-height:20px;line-height:20px;font-size:14px}.layui-table[lay-skin=line] td,.layui-table[lay-skin=line] th{border-width:0 0 1px}.layui-table[lay-skin=row] td,.layui-table[lay-skin=row] th{border-width:0 1px 0 0}.layui-table[lay-skin=nob] td,.layui-table[lay-skin=nob] th{border:none}.layui-table img{max-width:100px}.layui-table[lay-size=lg] td,.layui-table[lay-size=lg] th{padding:15px 30px}.layui-table-view .layui-table[lay-size=lg] .layui-table-cell{height:40px;line-height:40px}.layui-table[lay-size=sm] td,.layui-table[lay-size=sm] th{font-size:12px;padding:5px 10px}.layui-table-view .layui-table[lay-size=sm] .layui-table-cell{height:20px;line-height:20px}.layui-table[lay-data]{display:none}.layui-table-box{position:relative;overflow:hidden}.layui-table-view .layui-table{position:relative;width:auto;margin:0}.layui-table-view .layui-table[lay-skin=line]{border-width:0 1px 0 0}.layui-table-view .layui-table[lay-skin=row]{border-width:0 0 1px}.layui-table-view .layui-table td,.layui-table-view .layui-table th{padding:5px 0;border-top:none;border-left:none}.layui-table-view .layui-table th.layui-unselect .layui-table-cell span{cursor:pointer}.layui-table-view .layui-table td{cursor:default}.layui-table-view .layui-table td[data-edit=text]{cursor:text}.layui-table-view .layui-form-checkbox[lay-skin=primary] i{width:18px;height:18px}.layui-table-view .layui-form-radio{line-height:0;padding:0}.layui-table-view .layui-form-radio>i{margin:0;font-size:20px}.layui-table-init{position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;z-index:110}.layui-table-init .layui-icon{position:absolute;left:50%;top:50%;margin:-15px 0 0 -15px;font-size:30px;color:#c2c2c2}.layui-table-header{border-width:0 0 1px;overflow:hidden}.layui-table-header .layui-table{margin-bottom:-1px}.layui-table-tool .layui-inline[lay-event]{position:relative;width:26px;height:26px;padding:5px;line-height:16px;margin-right:10px;text-align:center;color:#333;border:1px solid #ccc;cursor:pointer;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool .layui-inline[lay-event]:hover{border:1px solid #999}.layui-table-tool-temp{padding-right:120px}.layui-table-tool-self{position:absolute;right:17px;top:10px}.layui-table-tool .layui-table-tool-self .layui-inline[lay-event]{margin:0 0 0 10px}.layui-table-tool-panel{position:absolute;top:29px;left:-1px;padding:5px 0;min-width:150px;min-height:40px;border:1px solid #d2d2d2;text-align:left;overflow-y:auto;background-color:#fff;box-shadow:0 2px 4px rgba(0,0,0,.12)}.layui-table-cell,.layui-table-tool-panel li{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layui-table-tool-panel li{padding:0 10px;line-height:30px;-webkit-transition:.5s all;transition:.5s all}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary]{width:100%;padding-left:28px}.layui-table-tool-panel li:hover{background-color:#f2f2f2}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] i{position:absolute;left:0;top:0}.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] span{padding:0}.layui-table-tool .layui-table-tool-self .layui-table-tool-panel{left:auto;right:-1px}.layui-table-col-set{position:absolute;right:0;top:0;width:20px;height:100%;border-width:0 0 0 1px;background-color:#fff}.layui-table-sort{width:10px;height:20px;margin-left:5px;cursor:pointer!important}.layui-table-sort .layui-edge{position:absolute;left:5px;border-width:5px}.layui-table-sort .layui-table-sort-asc{top:3px;border-top:none;border-bottom-style:solid;border-bottom-color:#b2b2b2}.layui-table-sort .layui-table-sort-asc:hover{border-bottom-color:#666}.layui-table-sort .layui-table-sort-desc{bottom:5px;border-bottom:none;border-top-style:solid;border-top-color:#b2b2b2}.layui-table-sort .layui-table-sort-desc:hover{border-top-color:#666}.layui-table-sort[lay-sort=asc] .layui-table-sort-asc{border-bottom-color:#000}.layui-table-sort[lay-sort=desc] .layui-table-sort-desc{border-top-color:#000}.layui-table-cell{height:28px;line-height:28px;padding:0 15px;position:relative;box-sizing:border-box}.layui-table-cell .layui-form-checkbox[lay-skin=primary]{top:-1px;padding:0}.layui-table-cell .layui-table-link{color:#01AAED}.laytable-cell-checkbox,.laytable-cell-numbers,.laytable-cell-radio,.laytable-cell-space{padding:0;text-align:center}.layui-table-body{position:relative;overflow:auto;margin-right:-1px;margin-bottom:-1px}.layui-table-body .layui-none{line-height:26px;padding:15px;text-align:center;color:#999}.layui-table-fixed{position:absolute;left:0;top:0;z-index:101}.layui-table-fixed .layui-table-body{overflow:hidden}.layui-table-fixed-l{box-shadow:0 -1px 8px rgba(0,0,0,.08)}.layui-table-fixed-r{left:auto;right:-1px;border-width:0 0 0 1px;box-shadow:-1px 0 8px rgba(0,0,0,.08)}.layui-table-fixed-r .layui-table-header{position:relative;overflow:visible}.layui-table-mend{position:absolute;right:-49px;top:0;height:100%;width:50px}.layui-table-tool{position:relative;z-index:890;width:100%;min-height:50px;line-height:30px;padding:10px 15px;border-width:0 0 1px}.layui-table-tool .layui-btn-container{margin-bottom:-10px}.layui-table-page,.layui-table-total{border-width:1px 0 0;margin-bottom:-1px;overflow:hidden}.layui-table-page{position:relative;width:100%;padding:7px 7px 0;height:41px;font-size:12px;white-space:nowrap}.layui-table-page>div{height:26px}.layui-table-page .layui-laypage{margin:0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span{height:26px;line-height:26px;margin-bottom:10px;border:none;background:0 0}.layui-table-page .layui-laypage a,.layui-table-page .layui-laypage span.layui-laypage-curr{padding:0 12px}.layui-table-page .layui-laypage span{margin-left:0;padding:0}.layui-table-page .layui-laypage .layui-laypage-prev{margin-left:-7px!important}.layui-table-page .layui-laypage .layui-laypage-curr .layui-laypage-em{left:0;top:0;padding:0}.layui-table-page .layui-laypage button,.layui-table-page .layui-laypage input{height:26px;line-height:26px}.layui-table-page .layui-laypage input{width:40px}.layui-table-page .layui-laypage button{padding:0 10px}.layui-table-page select{height:18px}.layui-table-patch .layui-table-cell{padding:0;width:30px}.layui-table-edit{position:absolute;left:0;top:0;width:100%;height:100%;padding:0 14px 1px;border-radius:0;box-shadow:1px 1px 20px rgba(0,0,0,.15)}.layui-table-edit:focus{border-color:#5FB878!important}select.layui-table-edit{padding:0 0 0 10px;border-color:#C9C9C9}.layui-table-view .layui-form-checkbox,.layui-table-view .layui-form-radio,.layui-table-view .layui-form-switch{top:0;margin:0;box-sizing:content-box}.layui-table-view .layui-form-checkbox{top:-1px;height:26px;line-height:26px}.layui-table-view .layui-form-checkbox i{height:26px}.layui-table-grid .layui-table-cell{overflow:visible}.layui-table-grid-down{position:absolute;top:0;right:0;width:26px;height:100%;padding:5px 0;border-width:0 0 0 1px;text-align:center;background-color:#fff;color:#999;cursor:pointer}.layui-table-grid-down .layui-icon{position:absolute;top:50%;left:50%;margin:-8px 0 0 -8px}.layui-table-grid-down:hover{background-color:#fbfbfb}body .layui-table-tips .layui-layer-content{background:0 0;padding:0;box-shadow:0 1px 6px rgba(0,0,0,.12)}.layui-table-tips-main{margin:-44px 0 0 -1px;max-height:150px;padding:8px 15px;font-size:14px;overflow-y:scroll;background-color:#fff;color:#666}.layui-table-tips-c{position:absolute;right:-3px;top:-13px;width:20px;height:20px;padding:3px;cursor:pointer;background-color:#666;border-radius:50%;color:#fff}.layui-table-tips-c:hover{background-color:#777}.layui-table-tips-c:before{position:relative;right:-2px}.layui-upload-file{display:none!important;opacity:.01;filter:Alpha(opacity=1)}.layui-upload-drag,.layui-upload-form,.layui-upload-wrap{display:inline-block}.layui-upload-list{margin:10px 0}.layui-upload-choose{padding:0 10px;color:#999}.layui-upload-drag{position:relative;padding:30px;border:1px dashed #e2e2e2;background-color:#fff;text-align:center;cursor:pointer;color:#999}.layui-upload-drag .layui-icon{font-size:50px;color:#009688}.layui-upload-drag[lay-over]{border-color:#009688}.layui-upload-iframe{position:absolute;width:0;height:0;border:0;visibility:hidden}.layui-upload-wrap{position:relative;vertical-align:middle}.layui-upload-wrap .layui-upload-file{display:block!important;position:absolute;left:0;top:0;z-index:10;font-size:100px;width:100%;height:100%;opacity:.01;filter:Alpha(opacity=1);cursor:pointer}.layui-transfer-active,.layui-transfer-box{display:inline-block;vertical-align:middle}.layui-transfer-box,.layui-transfer-header,.layui-transfer-search{border-width:0;border-style:solid;border-color:#e6e6e6}.layui-transfer-box{position:relative;border-width:1px;width:200px;height:360px;border-radius:2px;background-color:#fff}.layui-transfer-box .layui-form-checkbox{width:100%;margin:0!important}.layui-transfer-header{height:38px;line-height:38px;padding:0 10px;border-bottom-width:1px}.layui-transfer-search{position:relative;padding:10px;border-bottom-width:1px}.layui-transfer-search .layui-input{height:32px;padding-left:30px;font-size:12px}.layui-transfer-search .layui-icon-search{position:absolute;left:20px;top:50%;margin-top:-8px;color:#666}.layui-transfer-active{margin:0 15px}.layui-transfer-active .layui-btn{display:block;margin:0;padding:0 15px;background-color:#5FB878;border-color:#5FB878;color:#fff}.layui-transfer-active .layui-btn-disabled{background-color:#FBFBFB;border-color:#e6e6e6;color:#C9C9C9}.layui-transfer-active .layui-btn:first-child{margin-bottom:15px}.layui-transfer-active .layui-btn .layui-icon{margin:0;font-size:14px!important}.layui-transfer-data{padding:5px 0;overflow:auto}.layui-transfer-data li{height:32px;line-height:32px;padding:0 10px}.layui-transfer-data li:hover{background-color:#f2f2f2;transition:.5s all}.layui-transfer-data .layui-none{padding:15px 10px;text-align:center;color:#999}.layui-nav{position:relative;padding:0 20px;background-color:#393D49;color:#fff;border-radius:2px;font-size:0;box-sizing:border-box}.layui-nav *{font-size:14px}.layui-nav .layui-nav-item{position:relative;display:inline-block;*display:inline;*zoom:1;vertical-align:middle;line-height:60px}.layui-nav .layui-nav-item a{display:block;padding:0 20px;color:#fff;color:rgba(255,255,255,.7);transition:all .3s;-webkit-transition:all .3s}.layui-nav .layui-this:after,.layui-nav-bar,.layui-nav-tree .layui-nav-itemed:after{position:absolute;left:0;top:0;width:0;height:5px;background-color:#5FB878;transition:all .2s;-webkit-transition:all .2s}.layui-nav-bar{z-index:1000}.layui-nav .layui-nav-item a:hover,.layui-nav .layui-this a{color:#fff}.layui-nav .layui-this:after{content:'';top:auto;bottom:0;width:100%}.layui-nav-img{width:30px;height:30px;margin-right:10px;border-radius:50%}.layui-nav .layui-nav-more{content:'';width:0;height:0;border-style:solid dashed dashed;border-color:#fff transparent transparent;overflow:hidden;cursor:pointer;transition:all .2s;-webkit-transition:all .2s;position:absolute;top:50%;right:3px;margin-top:-3px;border-width:6px;border-top-color:rgba(255,255,255,.7)}.layui-nav .layui-nav-mored,.layui-nav-itemed>a .layui-nav-more{margin-top:-9px;border-style:dashed dashed solid;border-color:transparent transparent #fff}.layui-nav-child{display:none;position:absolute;left:0;top:65px;min-width:100%;line-height:36px;padding:5px 0;box-shadow:0 2px 4px rgba(0,0,0,.12);border:1px solid #d2d2d2;background-color:#fff;z-index:100;border-radius:2px;white-space:nowrap}.layui-nav .layui-nav-child a{color:#333}.layui-nav .layui-nav-child a:hover{background-color:#f2f2f2;color:#000}.layui-nav-child dd{position:relative}.layui-nav .layui-nav-child dd.layui-this a,.layui-nav-child dd.layui-this{background-color:#5FB878;color:#fff}.layui-nav-child dd.layui-this:after{display:none}.layui-nav-tree{width:200px;padding:0}.layui-nav-tree .layui-nav-item{display:block;width:100%;line-height:45px}.layui-nav-tree .layui-nav-item a{position:relative;height:45px;line-height:45px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-nav-tree .layui-nav-item a:hover{background-color:#4E5465}.layui-nav-tree .layui-nav-bar{width:5px;height:0;background-color:#009688}.layui-nav-tree .layui-nav-child dd.layui-this,.layui-nav-tree .layui-nav-child dd.layui-this a,.layui-nav-tree .layui-this,.layui-nav-tree .layui-this>a,.layui-nav-tree .layui-this>a:hover{background-color:#009688;color:#fff}.layui-nav-tree .layui-this:after{display:none}.layui-nav-itemed>a,.layui-nav-tree .layui-nav-title a,.layui-nav-tree .layui-nav-title a:hover{color:#fff!important}.layui-nav-tree .layui-nav-child{position:relative;z-index:0;top:0;border:none;box-shadow:none}.layui-nav-tree .layui-nav-child a{height:40px;line-height:40px;color:#fff;color:rgba(255,255,255,.7)}.layui-nav-tree .layui-nav-child,.layui-nav-tree .layui-nav-child a:hover{background:0 0;color:#fff}.layui-nav-tree .layui-nav-more{right:10px}.layui-nav-itemed>.layui-nav-child{display:block;padding:0;background-color:rgba(0,0,0,.3)!important}.layui-nav-itemed>.layui-nav-child>.layui-this>.layui-nav-child{display:block}.layui-nav-side{position:fixed;top:0;bottom:0;left:0;overflow-x:hidden;z-index:999}.layui-bg-blue .layui-nav-bar,.layui-bg-blue .layui-nav-itemed:after,.layui-bg-blue .layui-this:after{background-color:#93D1FF}.layui-bg-blue .layui-nav-child dd.layui-this{background-color:#1E9FFF}.layui-bg-blue .layui-nav-itemed>a,.layui-nav-tree.layui-bg-blue .layui-nav-title a,.layui-nav-tree.layui-bg-blue .layui-nav-title a:hover{background-color:#007DDB!important}.layui-breadcrumb{font-size:0}.layui-breadcrumb>*{font-size:14px}.layui-breadcrumb a{color:#999!important}.layui-breadcrumb a:hover{color:#5FB878!important}.layui-breadcrumb a cite{color:#666;font-style:normal}.layui-breadcrumb span[lay-separator]{margin:0 10px;color:#999}.layui-tab{margin:10px 0;text-align:left!important}.layui-tab[overflow]>.layui-tab-title{overflow:hidden}.layui-tab-title{position:relative;left:0;height:40px;white-space:nowrap;font-size:0;border-bottom-width:1px;border-bottom-style:solid;transition:all .2s;-webkit-transition:all .2s}.layui-tab-title li{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;font-size:14px;transition:all .2s;-webkit-transition:all .2s;position:relative;line-height:40px;min-width:65px;padding:0 15px;text-align:center;cursor:pointer}.layui-tab-title li a{display:block}.layui-tab-title .layui-this{color:#000}.layui-tab-title .layui-this:after{position:absolute;left:0;top:0;content:'';width:100%;height:41px;border-width:1px;border-style:solid;border-bottom-color:#fff;border-radius:2px 2px 0 0;box-sizing:border-box;pointer-events:none}.layui-tab-bar{position:absolute;right:0;top:0;z-index:10;width:30px;height:39px;line-height:39px;border-width:1px;border-style:solid;border-radius:2px;text-align:center;background-color:#fff;cursor:pointer}.layui-tab-bar .layui-icon{position:relative;display:inline-block;top:3px;transition:all .3s;-webkit-transition:all .3s}.layui-tab-item{display:none}.layui-tab-more{padding-right:30px;height:auto!important;white-space:normal!important}.layui-tab-more li.layui-this:after{border-bottom-color:#e2e2e2;border-radius:2px}.layui-tab-more .layui-tab-bar .layui-icon{top:-2px;top:3px\9;-webkit-transform:rotate(180deg);transform:rotate(180deg)}:root .layui-tab-more .layui-tab-bar .layui-icon{top:-2px\0/IE9}.layui-tab-content{padding:10px}.layui-tab-title li .layui-tab-close{position:relative;display:inline-block;width:18px;height:18px;line-height:20px;margin-left:8px;top:1px;text-align:center;font-size:14px;color:#c2c2c2;transition:all .2s;-webkit-transition:all .2s}.layui-tab-title li .layui-tab-close:hover{border-radius:2px;background-color:#FF5722;color:#fff}.layui-tab-brief>.layui-tab-title .layui-this{color:#009688}.layui-tab-brief>.layui-tab-more li.layui-this:after,.layui-tab-brief>.layui-tab-title .layui-this:after{border:none;border-radius:0;border-bottom:2px solid #5FB878}.layui-tab-brief[overflow]>.layui-tab-title .layui-this:after{top:-1px}.layui-tab-card{border-width:1px;border-style:solid;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.1)}.layui-tab-card>.layui-tab-title{background-color:#f2f2f2}.layui-tab-card>.layui-tab-title li{margin-right:-1px;margin-left:-1px}.layui-tab-card>.layui-tab-title .layui-this{background-color:#fff}.layui-tab-card>.layui-tab-title .layui-this:after{border-top:none;border-width:1px;border-bottom-color:#fff}.layui-tab-card>.layui-tab-title .layui-tab-bar{height:40px;line-height:40px;border-radius:0;border-top:none;border-right:none}.layui-tab-card>.layui-tab-more .layui-this{background:0 0;color:#5FB878}.layui-tab-card>.layui-tab-more .layui-this:after{border:none}.layui-timeline{padding-left:5px}.layui-timeline-item{position:relative;padding-bottom:20px}.layui-timeline-axis{position:absolute;left:-5px;top:0;z-index:10;width:20px;height:20px;line-height:20px;background-color:#fff;color:#5FB878;border-radius:50%;text-align:center;cursor:pointer}.layui-timeline-axis:hover{color:#FF5722}.layui-timeline-item:before{content:'';position:absolute;left:5px;top:0;z-index:0;width:1px;height:100%}.layui-timeline-item:last-child:before{display:none}.layui-timeline-item:first-child:before{display:block}.layui-timeline-content{padding-left:25px}.layui-timeline-title{position:relative;margin-bottom:10px}.layui-badge,.layui-badge-dot,.layui-badge-rim{position:relative;display:inline-block;padding:0 6px;font-size:12px;text-align:center;background-color:#FF5722;color:#fff;border-radius:2px}.layui-badge{height:18px;line-height:18px}.layui-badge-dot{width:8px;height:8px;padding:0;border-radius:50%}.layui-badge-rim{height:18px;line-height:18px;border-width:1px;border-style:solid;background-color:#fff;color:#666}.layui-btn .layui-badge,.layui-btn .layui-badge-dot{margin-left:5px}.layui-nav .layui-badge,.layui-nav .layui-badge-dot{position:absolute;top:50%;margin:-8px 6px 0}.layui-tab-title .layui-badge,.layui-tab-title .layui-badge-dot{left:5px;top:-2px}.layui-carousel{position:relative;left:0;top:0;background-color:#f8f8f8}.layui-carousel>[carousel-item]{position:relative;width:100%;height:100%;overflow:hidden}.layui-carousel>[carousel-item]:before{position:absolute;content:'\e63d';left:50%;top:50%;width:100px;line-height:20px;margin:-10px 0 0 -50px;text-align:center;color:#c2c2c2;font-family:layui-icon!important;font-size:30px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-carousel>[carousel-item]>*{display:none;position:absolute;left:0;top:0;width:100%;height:100%;background-color:#f8f8f8;transition-duration:.3s;-webkit-transition-duration:.3s}.layui-carousel-updown>*{-webkit-transition:.3s ease-in-out up;transition:.3s ease-in-out up}.layui-carousel-arrow{display:none\9;opacity:0;position:absolute;left:10px;top:50%;margin-top:-18px;width:36px;height:36px;line-height:36px;text-align:center;font-size:20px;border:0;border-radius:50%;background-color:rgba(0,0,0,.2);color:#fff;-webkit-transition-duration:.3s;transition-duration:.3s;cursor:pointer}.layui-carousel-arrow[lay-type=add]{left:auto!important;right:10px}.layui-carousel:hover .layui-carousel-arrow[lay-type=add],.layui-carousel[lay-arrow=always] .layui-carousel-arrow[lay-type=add]{right:20px}.layui-carousel[lay-arrow=always] .layui-carousel-arrow{opacity:1;left:20px}.layui-carousel[lay-arrow=none] .layui-carousel-arrow{display:none}.layui-carousel-arrow:hover,.layui-carousel-ind ul:hover{background-color:rgba(0,0,0,.35)}.layui-carousel:hover .layui-carousel-arrow{display:block\9;opacity:1;left:20px}.layui-carousel-ind{position:relative;top:-35px;width:100%;line-height:0!important;text-align:center;font-size:0}.layui-carousel[lay-indicator=outside]{margin-bottom:30px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind{top:10px}.layui-carousel[lay-indicator=outside] .layui-carousel-ind ul{background-color:rgba(0,0,0,.5)}.layui-carousel[lay-indicator=none] .layui-carousel-ind{display:none}.layui-carousel-ind ul{display:inline-block;padding:5px;background-color:rgba(0,0,0,.2);border-radius:10px;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind li{display:inline-block;width:10px;height:10px;margin:0 3px;font-size:14px;background-color:#e2e2e2;background-color:rgba(255,255,255,.5);border-radius:50%;cursor:pointer;-webkit-transition-duration:.3s;transition-duration:.3s}.layui-carousel-ind li:hover{background-color:rgba(255,255,255,.7)}.layui-carousel-ind li.layui-this{background-color:#fff}.layui-carousel>[carousel-item]>.layui-carousel-next,.layui-carousel>[carousel-item]>.layui-carousel-prev,.layui-carousel>[carousel-item]>.layui-this{display:block}.layui-carousel>[carousel-item]>.layui-this{left:0}.layui-carousel>[carousel-item]>.layui-carousel-prev{left:-100%}.layui-carousel>[carousel-item]>.layui-carousel-next{left:100%}.layui-carousel>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel>[carousel-item]>.layui-carousel-prev.layui-carousel-right{left:0}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-left{left:-100%}.layui-carousel>[carousel-item]>.layui-this.layui-carousel-right{left:100%}.layui-carousel[lay-anim=updown] .layui-carousel-arrow{left:50%!important;top:20px;margin:0 0 0 -18px}.layui-carousel[lay-anim=updown]>[carousel-item]>*,.layui-carousel[lay-anim=fade]>[carousel-item]>*{left:0!important}.layui-carousel[lay-anim=updown] .layui-carousel-arrow[lay-type=add]{top:auto!important;bottom:20px}.layui-carousel[lay-anim=updown] .layui-carousel-ind{position:absolute;top:50%;right:20px;width:auto;height:auto}.layui-carousel[lay-anim=updown] .layui-carousel-ind ul{padding:3px 5px}.layui-carousel[lay-anim=updown] .layui-carousel-ind li{display:block;margin:6px 0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next{top:100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{top:0}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-left{top:-100%}.layui-carousel[lay-anim=updown]>[carousel-item]>.layui-this.layui-carousel-right{top:100%}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev{opacity:0}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-next.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-carousel-prev.layui-carousel-right{opacity:1}.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-left,.layui-carousel[lay-anim=fade]>[carousel-item]>.layui-this.layui-carousel-right{opacity:0}.layui-fixbar{position:fixed;right:15px;bottom:15px;z-index:999999}.layui-fixbar li{width:50px;height:50px;line-height:50px;margin-bottom:1px;text-align:center;cursor:pointer;font-size:30px;background-color:#9F9F9F;color:#fff;border-radius:2px;opacity:.95}.layui-fixbar li:hover{opacity:.85}.layui-fixbar li:active{opacity:1}.layui-fixbar .layui-fixbar-top{display:none;font-size:40px}body .layui-util-face{border:none;background:0 0}body .layui-util-face .layui-layer-content{padding:0;background-color:#fff;color:#666;box-shadow:none}.layui-util-face .layui-layer-TipsG{display:none}.layui-util-face ul{position:relative;width:372px;padding:10px;border:1px solid #D9D9D9;background-color:#fff;box-shadow:0 0 20px rgba(0,0,0,.2)}.layui-util-face ul li{cursor:pointer;float:left;border:1px solid #e8e8e8;height:22px;width:26px;overflow:hidden;margin:-1px 0 0 -1px;padding:4px 2px;text-align:center}.layui-util-face ul li:hover{position:relative;z-index:2;border:1px solid #eb7350;background:#fff9ec}.layui-code{position:relative;margin:10px 0;padding:15px;line-height:20px;border:1px solid #ddd;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New;font-size:12px}.layui-rate,.layui-rate *{display:inline-block;vertical-align:middle}.layui-rate{padding:10px 5px 10px 0;font-size:0}.layui-rate li i.layui-icon{font-size:20px;color:#FFB800;margin-right:5px;transition:all .3s;-webkit-transition:all .3s}.layui-rate li i:hover{cursor:pointer;transform:scale(1.12);-webkit-transform:scale(1.12)}.layui-rate[readonly] li i:hover{cursor:default;transform:scale(1)}.layui-colorpicker{width:26px;height:26px;border:1px solid #e6e6e6;padding:5px;border-radius:2px;line-height:24px;display:inline-block;cursor:pointer;transition:all .3s;-webkit-transition:all .3s}.layui-colorpicker:hover{border-color:#d2d2d2}.layui-colorpicker.layui-colorpicker-lg{width:34px;height:34px;line-height:32px}.layui-colorpicker.layui-colorpicker-sm{width:24px;height:24px;line-height:22px}.layui-colorpicker.layui-colorpicker-xs{width:22px;height:22px;line-height:20px}.layui-colorpicker-trigger-bgcolor{display:block;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);border-radius:2px}.layui-colorpicker-trigger-span{display:block;height:100%;box-sizing:border-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;text-align:center}.layui-colorpicker-trigger-i{display:inline-block;color:#FFF;font-size:12px}.layui-colorpicker-trigger-i.layui-icon-close{color:#999}.layui-colorpicker-main{position:absolute;z-index:66666666;width:280px;padding:7px;background:#FFF;border:1px solid #d2d2d2;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12)}.layui-colorpicker-main-wrapper{height:180px;position:relative}.layui-colorpicker-basis{width:260px;height:100%;position:relative}.layui-colorpicker-basis-white{width:100%;height:100%;position:absolute;top:0;left:0;background:linear-gradient(90deg,#FFF,hsla(0,0%,100%,0))}.layui-colorpicker-basis-black{width:100%;height:100%;position:absolute;top:0;left:0;background:linear-gradient(0deg,#000,transparent)}.layui-colorpicker-basis-cursor{width:10px;height:10px;border:1px solid #FFF;border-radius:50%;position:absolute;top:-3px;right:-3px;cursor:pointer}.layui-colorpicker-side{position:absolute;top:0;right:0;width:12px;height:100%;background:linear-gradient(red,#FF0,#0F0,#0FF,#00F,#F0F,red)}.layui-colorpicker-side-slider{width:100%;height:5px;box-shadow:0 0 1px #888;box-sizing:border-box;background:#FFF;border-radius:1px;border:1px solid #f0f0f0;cursor:pointer;position:absolute;left:0}.layui-colorpicker-main-alpha{display:none;height:12px;margin-top:7px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.layui-colorpicker-alpha-bgcolor{height:100%;position:relative}.layui-colorpicker-alpha-slider{width:5px;height:100%;box-shadow:0 0 1px #888;box-sizing:border-box;background:#FFF;border-radius:1px;border:1px solid #f0f0f0;cursor:pointer;position:absolute;top:0}.layui-colorpicker-main-pre{padding-top:7px;font-size:0}.layui-colorpicker-pre{width:20px;height:20px;border-radius:2px;display:inline-block;margin-left:6px;margin-bottom:7px;cursor:pointer}.layui-colorpicker-pre:nth-child(11n+1){margin-left:0}.layui-colorpicker-pre-isalpha{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.layui-colorpicker-pre.layui-this{box-shadow:0 0 3px 2px rgba(0,0,0,.15)}.layui-colorpicker-pre>div{height:100%;border-radius:2px}.layui-colorpicker-main-input{text-align:right;padding-top:7px}.layui-colorpicker-main-input .layui-btn-container .layui-btn{margin:0 0 0 10px}.layui-colorpicker-main-input div.layui-inline{float:left;margin-right:10px;font-size:14px}.layui-colorpicker-main-input input.layui-input{width:150px;height:30px;color:#666}.layui-slider{height:4px;background:#e2e2e2;border-radius:3px;position:relative;cursor:pointer}.layui-slider-bar{border-radius:3px;position:absolute;height:100%}.layui-slider-step{position:absolute;top:0;width:4px;height:4px;border-radius:50%;background:#FFF;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.layui-slider-wrap{width:36px;height:36px;position:absolute;top:-16px;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:10;text-align:center}.layui-slider-wrap-btn{width:12px;height:12px;border-radius:50%;background:#FFF;display:inline-block;vertical-align:middle;cursor:pointer;transition:.3s}.layui-slider-wrap:after{content:"";height:100%;display:inline-block;vertical-align:middle}.layui-slider-wrap-btn.layui-slider-hover,.layui-slider-wrap-btn:hover{transform:scale(1.2)}.layui-slider-wrap-btn.layui-disabled:hover{transform:scale(1)!important}.layui-slider-tips{position:absolute;top:-42px;z-index:66666666;white-space:nowrap;display:none;-webkit-transform:translateX(-50%);transform:translateX(-50%);color:#FFF;background:#000;border-radius:3px;height:25px;line-height:25px;padding:0 10px}.layui-slider-tips:after{content:'';position:absolute;bottom:-12px;left:50%;margin-left:-6px;width:0;height:0;border-width:6px;border-style:solid;border-color:#000 transparent transparent}.layui-slider-input{width:70px;height:32px;border:1px solid #e6e6e6;border-radius:3px;font-size:16px;line-height:32px;position:absolute;right:0;top:-15px}.layui-slider-input-btn{display:none;position:absolute;top:0;right:0;width:20px;height:100%;border-left:1px solid #d2d2d2}.layui-slider-input-btn i{cursor:pointer;position:absolute;right:0;bottom:0;width:20px;height:50%;font-size:12px;line-height:16px;text-align:center;color:#999}.layui-slider-input-btn i:first-child{top:0;border-bottom:1px solid #d2d2d2}.layui-slider-input-txt{height:100%;font-size:14px}.layui-slider-input-txt input{height:100%;border:none}.layui-slider-input-btn i:hover{color:#009688}.layui-slider-vertical{width:4px;margin-left:34px}.layui-slider-vertical .layui-slider-bar{width:4px}.layui-slider-vertical .layui-slider-step{top:auto;left:0;-webkit-transform:translateY(50%);transform:translateY(50%)}.layui-slider-vertical .layui-slider-wrap{top:auto;left:-16px;-webkit-transform:translateY(50%);transform:translateY(50%)}.layui-slider-vertical .layui-slider-tips{top:auto;left:2px}@media \0screen{.layui-slider-wrap-btn{margin-left:-20px}.layui-slider-vertical .layui-slider-wrap-btn{margin-left:0;margin-bottom:-20px}.layui-slider-vertical .layui-slider-tips{margin-left:-8px}.layui-slider>span{margin-left:8px}}.layui-tree{line-height:22px}.layui-tree .layui-form-checkbox{margin:0!important}.layui-tree-set{width:100%;position:relative}.layui-tree-pack{display:none;padding-left:20px;position:relative}.layui-tree-iconClick,.layui-tree-main{display:inline-block;vertical-align:middle}.layui-tree-line .layui-tree-pack{padding-left:27px}.layui-tree-line .layui-tree-set .layui-tree-set:after{content:'';position:absolute;top:14px;left:-9px;width:17px;height:0;border-top:1px dotted #c0c4cc}.layui-tree-entry{position:relative;padding:3px 0;height:20px;white-space:nowrap}.layui-tree-entry:hover{background-color:#eee}.layui-tree-line .layui-tree-entry:hover{background-color:rgba(0,0,0,0)}.layui-tree-line .layui-tree-entry:hover .layui-tree-txt{color:#999;text-decoration:underline;transition:.3s}.layui-tree-main{cursor:pointer;padding-right:10px}.layui-tree-line .layui-tree-set:before{content:'';position:absolute;top:0;left:-9px;width:0;height:100%;border-left:1px dotted #c0c4cc}.layui-tree-line .layui-tree-set.layui-tree-setLineShort:before{height:13px}.layui-tree-line .layui-tree-set.layui-tree-setHide:before{height:0}.layui-tree-iconClick{position:relative;height:20px;line-height:20px;margin:0 10px;color:#c0c4cc}.layui-tree-icon{height:12px;line-height:12px;width:12px;text-align:center;border:1px solid #c0c4cc}.layui-tree-iconClick .layui-icon{font-size:18px}.layui-tree-icon .layui-icon{font-size:12px;color:#666}.layui-tree-iconArrow{padding:0 5px}.layui-tree-iconArrow:after{content:'';position:absolute;left:4px;top:3px;z-index:100;width:0;height:0;border-width:5px;border-style:solid;border-color:transparent transparent transparent #c0c4cc;transition:.5s}.layui-tree-btnGroup,.layui-tree-editInput{position:relative;vertical-align:middle;display:inline-block}.layui-tree-spread>.layui-tree-entry>.layui-tree-iconClick>.layui-tree-iconArrow:after{transform:rotate(90deg) translate(3px,4px)}.layui-tree-txt{display:inline-block;vertical-align:middle;color:#555}.layui-tree-search{margin-bottom:15px;color:#666}.layui-tree-btnGroup .layui-icon{display:inline-block;vertical-align:middle;padding:0 2px;cursor:pointer}.layui-tree-btnGroup .layui-icon:hover{color:#999;transition:.3s}.layui-tree-entry:hover .layui-tree-btnGroup{visibility:visible}.layui-tree-editInput{height:20px;line-height:20px;padding:0 3px;border:none;background-color:rgba(0,0,0,.05)}.layui-tree-emptyText{text-align:center;color:#999}.layui-anim{-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-anim.layui-icon{display:inline-block}.layui-anim-loop{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.layui-trans,.layui-trans a{transition:all .3s;-webkit-transition:all .3s}@-webkit-keyframes layui-rotate{from{-webkit-transform:rotate(0)}to{-webkit-transform:rotate(360deg)}}@keyframes layui-rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.layui-anim-rotate{-webkit-animation-name:layui-rotate;animation-name:layui-rotate;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes layui-up{from{-webkit-transform:translate3d(0,100%,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-up{from{transform:translate3d(0,100%,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-up{-webkit-animation-name:layui-up;animation-name:layui-up}@-webkit-keyframes layui-upbit{from{-webkit-transform:translate3d(0,30px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes layui-upbit{from{transform:translate3d(0,30px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-anim-upbit{-webkit-animation-name:layui-upbit;animation-name:layui-upbit}@-webkit-keyframes layui-scale{0%{opacity:.3;-webkit-transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale{0%{opacity:.3;-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-ms-transform:scale(1);transform:scale(1)}}.layui-anim-scale{-webkit-animation-name:layui-scale;animation-name:layui-scale}@-webkit-keyframes layui-scale-spring{0%{opacity:.5;-webkit-transform:scale(.5)}80%{opacity:.8;-webkit-transform:scale(1.1)}100%{opacity:1;-webkit-transform:scale(1)}}@keyframes layui-scale-spring{0%{opacity:.5;transform:scale(.5)}80%{opacity:.8;transform:scale(1.1)}100%{opacity:1;transform:scale(1)}}.layui-anim-scaleSpring{-webkit-animation-name:layui-scale-spring;animation-name:layui-scale-spring}@-webkit-keyframes layui-fadein{0%{opacity:0}100%{opacity:1}}@keyframes layui-fadein{0%{opacity:0}100%{opacity:1}}.layui-anim-fadein{-webkit-animation-name:layui-fadein;animation-name:layui-fadein}@-webkit-keyframes layui-fadeout{0%{opacity:1}100%{opacity:0}}@keyframes layui-fadeout{0%{opacity:1}100%{opacity:0}}.layui-anim-fadeout{-webkit-animation-name:layui-fadeout;animation-name:layui-fadeout} \ No newline at end of file diff --git a/admin/static/layui/layui/css/layui.mobile.css b/admin/static/layui/layui/css/layui.mobile.css new file mode 100644 index 0000000..7835392 --- /dev/null +++ b/admin/static/layui/layui/css/layui.mobile.css @@ -0,0 +1,2 @@ +/** layui-v2.5.6 MIT License By https://www.layui.com */ + blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}html{font:12px 'Helvetica Neue','PingFang SC',STHeitiSC-Light,Helvetica,Arial,sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0)}a{text-decoration:none;background:0 0}a:active,a:hover{outline:0}table{border-collapse:collapse;border-spacing:0}li{list-style:none}b,strong{font-weight:700}h1,h2,h3,h4,h5,h6{font-weight:500}address,cite,dfn,em,var{font-style:normal}dfn{font-style:italic}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}img{border:0;vertical-align:bottom}.layui-inline,input,label{vertical-align:middle}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;outline:0}button,select{text-transform:none}select{-webkit-appearance:none;border:none}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}@font-face{font-family:layui-icon;src:url(../font/iconfont.eot?v=1.0.7);src:url(../font/iconfont.eot?v=1.0.7#iefix) format('embedded-opentype'),url(../font/iconfont.woff?v=1.0.7) format('woff'),url(../font/iconfont.ttf?v=1.0.7) format('truetype'),url(../font/iconfont.svg?v=1.0.7#iconfont) format('svg')}.layui-icon{font-family:layui-icon!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.layui-box,.layui-box *{-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important;box-sizing:content-box!important}.layui-border-box,.layui-border-box *{-webkit-box-sizing:border-box!important;-moz-box-sizing:border-box!important;box-sizing:border-box!important}.layui-inline{position:relative;display:inline-block;*display:inline;*zoom:1}.layui-edge,.layui-upload-iframe{position:absolute;width:0;height:0}.layui-edge{border-style:dashed;border-color:transparent;overflow:hidden}.layui-elip{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-unselect{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-disabled,.layui-disabled:active{background-color:#d2d2d2!important;color:#fff!important;cursor:not-allowed!important}.layui-circle{border-radius:100%}.layui-show{display:block!important}.layui-hide{display:none!important}.layui-upload-iframe{border:0;visibility:hidden}.layui-upload-enter{border:1px solid #009E94;background-color:#009E94;color:#fff;-webkit-transform:scale(1.1);transform:scale(1.1)}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}@-webkit-keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-left{-webkit-animation-name:layui-m-anim-left;animation-name:layui-m-anim-left}@-webkit-keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes layui-m-anim-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}100%{-webkit-transform:translateX(0);transform:translateX(0)}}.layui-m-anim-right{-webkit-animation-name:layui-m-anim-right;animation-name:layui-m-anim-right}@-webkit-keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}@keyframes layui-m-anim-lout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}.layui-m-anim-lout{-webkit-animation-name:layui-m-anim-lout;animation-name:layui-m-anim-lout}@-webkit-keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}@keyframes layui-m-anim-rout{0%{-webkit-transform:translateX(0);transform:translateX(0)}100%{-webkit-transform:translateX(100%);transform:translateX(100%)}}.layui-m-anim-rout{-webkit-animation-name:layui-m-anim-rout;animation-name:layui-m-anim-rout}.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} \ No newline at end of file diff --git a/admin/static/layui/layui/css/modules/code.css b/admin/static/layui/layui/css/modules/code.css new file mode 100644 index 0000000..9143a25 --- /dev/null +++ b/admin/static/layui/layui/css/modules/code.css @@ -0,0 +1,2 @@ +/** layui-v2.5.6 MIT License By https://www.layui.com */ + html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} \ No newline at end of file diff --git a/admin/static/layui/layui/css/modules/laydate/default/laydate.css b/admin/static/layui/layui/css/modules/laydate/default/laydate.css new file mode 100644 index 0000000..9768e8f --- /dev/null +++ b/admin/static/layui/layui/css/modules/laydate/default/laydate.css @@ -0,0 +1,496 @@ +/** layui-v2.5.6 MIT License By https://www.layui.com */ + +.laydate-set-ym, +.layui-laydate, +.layui-laydate *, +.layui-laydate-list { + box-sizing: border-box +} + +html #layuicss-laydate { + display: none; + position: absolute; + width: 1989px +} + +.layui-laydate * { + margin: 0; + padding: 0 +} + +.layui-laydate { + position: absolute; + z-index: 66666666; + margin: 5px 0; + border-radius: 2px; + font-size: 14px; + -webkit-animation-duration: .3s; + animation-duration: .3s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-name: laydate-upbit; + animation-name: laydate-upbit +} + +.layui-laydate-main { + width: 272px +} + +.layui-laydate-content td, +.layui-laydate-header *, +.layui-laydate-list li { + transition-duration: .3s; + -webkit-transition-duration: .3s +} + +@-webkit-keyframes laydate-upbit { + from { + -webkit-transform: translate3d(0, 20px, 0); + opacity: .3 + } + to { + -webkit-transform: translate3d(0, 0, 0); + opacity: 1 + } +} + +@keyframes laydate-upbit { + from { + transform: translate3d(0, 20px, 0); + opacity: .3 + } + to { + transform: translate3d(0, 0, 0); + opacity: 1 + } +} + +.layui-laydate-static { + position: relative; + z-index: 0; + display: inline-block; + margin: 0; + -webkit-animation: none; + animation: none +} + +.laydate-ym-show .laydate-next-m, +.laydate-ym-show .laydate-prev-m { + display: none!important +} + +.laydate-ym-show .laydate-next-y, +.laydate-ym-show .laydate-prev-y { + display: inline-block!important +} + +.laydate-time-show .laydate-set-ym span[lay-type=month], +.laydate-time-show .laydate-set-ym span[lay-type=year], +.laydate-time-show .layui-laydate-header .layui-icon, +.laydate-ym-show .laydate-set-ym span[lay-type=month] { + display: none!important +} + +.layui-laydate-header { + position: relative; + line-height: 30px; + padding: 10px 70px 5px +} + +.laydate-set-ym span, +.layui-laydate-header i { + padding: 0 5px; + cursor: pointer +} + +.layui-laydate-header * { + display: inline-block; + vertical-align: bottom +} + +.layui-laydate-header i { + position: absolute; + top: 10px; + color: #999; + font-size: 18px +} + +.layui-laydate-header i.laydate-prev-y { + left: 15px +} + +.layui-laydate-header i.laydate-prev-m { + left: 45px +} + +.layui-laydate-header i.laydate-next-y { + right: 15px +} + +.layui-laydate-header i.laydate-next-m { + right: 45px +} + +.laydate-set-ym { + width: 100%; + text-align: center; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap +} + +.laydate-time-text { + cursor: default!important +} + +.layui-laydate-content { + position: relative; + padding: 10px; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none +} + +.layui-laydate-content table { + border-collapse: collapse; + border-spacing: 0 +} + +.layui-laydate-content td, +.layui-laydate-content th { + width: 36px; + height: 30px; + padding: 5px; + text-align: center +} + +.layui-laydate-content td { + position: relative; + cursor: pointer +} + +.laydate-day-mark { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + line-height: 30px; + font-size: 12px; + overflow: hidden +} + +.laydate-day-mark::after { + position: absolute; + content: ''; + right: 2px; + top: 2px; + width: 5px; + height: 5px; + border-radius: 50% +} + +.layui-laydate-footer { + position: relative; + height: 46px; + line-height: 26px; + padding: 10px 20px +} + +.layui-laydate-footer span { + margin-right: 15px; + display: inline-block; + cursor: pointer; + font-size: 12px +} + +.layui-laydate-footer span:hover { + color: #5FB878 +} + +.laydate-footer-btns { + position: absolute; + right: 10px; + top: 10px +} + +.laydate-footer-btns span { + height: 26px; + line-height: 26px; + margin: 0 0 0 -1px; + padding: 0 10px; + border: 1px solid #C9C9C9; + background-color: #fff; + white-space: nowrap; + vertical-align: top; + border-radius: 2px +} + +.layui-laydate-list>li, +.layui-laydate-range .layui-laydate-main { + display: inline-block; + vertical-align: middle +} + +.layui-laydate-list { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + padding: 10px; + background-color: #fff +} + +.layui-laydate-list>li { + position: relative; + width: 33.3%; + height: 36px; + line-height: 36px; + margin: 3px 0; + text-align: center; + cursor: pointer +} + +.laydate-month-list>li { + width: 25%; + margin: 17px 0 +} + +.laydate-time-list>li { + height: 100%; + margin: 0; + line-height: normal; + cursor: default +} + +.laydate-time-list p { + position: relative; + top: -4px; + line-height: 29px +} + +.laydate-time-list ol { + height: 181px; + overflow: hidden +} + +.laydate-time-list>li:hover ol { + overflow-y: auto +} + +.laydate-time-list ol li { + width: 130%; + padding-left: 33px; + line-height: 30px; + text-align: left; + cursor: pointer +} + +.layui-laydate-hint { + position: absolute; + top: 115px; + left: 50%; + width: 250px; + margin-left: -125px; + line-height: 20px; + padding: 15px; + text-align: center; + font-size: 12px +} + +.layui-laydate-range { + width: 546px +} + +.layui-laydate-range .laydate-main-list-0 .laydate-next-m, +.layui-laydate-range .laydate-main-list-0 .laydate-next-y, +.layui-laydate-range .laydate-main-list-1 .laydate-prev-m, +.layui-laydate-range .laydate-main-list-1 .laydate-prev-y { + display: none +} + +.layui-laydate-range .laydate-main-list-1 .layui-laydate-content { + border-left: 1px solid #e2e2e2 +} + +.layui-laydate, +.layui-laydate-hint { + border: 1px solid #d2d2d2; + box-shadow: 0 2px 4px rgba(0, 0, 0, .12); + background-color: #fff; + color: #666 +} + +.layui-laydate-header { + border-bottom: 1px solid #e2e2e2 +} + +.layui-laydate-header i:hover, +.layui-laydate-header span:hover { + color: #5FB878 +} + +.layui-laydate-content { + border-top: none 0; + border-bottom: none 0 +} + +.layui-laydate-content th { + font-weight: 400; + color: #333 +} + +.layui-laydate-content td { + color: #666 +} + +.layui-laydate-content td.laydate-selected { + background-color: #00F7DE +} + +.laydate-selected:hover { + background-color: #00F7DE!important +} + +.layui-laydate-content td:hover, +.layui-laydate-list li:hover { + background-color: #eaeaea; + color: #333 +} + +.laydate-time-list li ol { + margin: 0; + padding: 0; + border: 1px solid #e2e2e2; + border-left-width: 0 +} + +.laydate-time-list li:first-child ol { + border-left-width: 1px +} + +.laydate-time-list>li:hover { + background: 0 0 +} + +.layui-laydate-content .laydate-day-next, +.layui-laydate-content .laydate-day-prev { + color: #d2d2d2 +} + +.laydate-selected.laydate-day-next, +.laydate-selected.laydate-day-prev { + background-color: #f8f8f8!important +} + +.layui-laydate-footer { + border-top: 1px solid #e2e2e2 +} + +.layui-laydate-hint { + color: #FF5722 +} + +.laydate-day-mark::after { + background-color: #5FB878 +} + +.layui-laydate-content td.layui-this .laydate-day-mark::after { + display: none +} + +.layui-laydate-footer span[lay-type=date] { + color: #5FB878 +} + +.layui-laydate .layui-this { + background-color: #009688; + color: #fff! +} + +.layui-laydate .laydate-disabled, +.layui-laydate .laydate-disabled:hover { + background: 0 0!important; + color: #d2d2d2!important; + cursor: not-allowed!important; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none +} + +.laydate-theme-molv { + border: none +} + +.laydate-theme-molv.layui-laydate-range { + width: 548px +} + +.laydate-theme-molv .layui-laydate-main { + width: 274px +} + +.laydate-theme-molv .layui-laydate-header { + border: none; + background-color: #009688 +} + +.laydate-theme-molv .layui-laydate-header i, +.laydate-theme-molv .layui-laydate-header span { + color: #f6f6f6 +} + +.laydate-theme-molv .layui-laydate-header i:hover, +.laydate-theme-molv .layui-laydate-header span:hover { + color: #fff +} + +.laydate-theme-molv .layui-laydate-content { + border: 1px solid #e2e2e2; + border-top: none; + border-bottom: none +} + +.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content { + border-left: none +} + +.laydate-theme-grid .laydate-month-list>li, +.laydate-theme-grid .laydate-year-list>li, +.laydate-theme-grid .layui-laydate-content td, +.laydate-theme-grid .layui-laydate-content thead, +.laydate-theme-molv .layui-laydate-footer { + border: 1px solid #e2e2e2 +} + +.laydate-theme-grid .laydate-selected, +.laydate-theme-grid .laydate-selected:hover { + background-color: #f2f2f2!important; + color: #009688!important +} + +.laydate-theme-grid .laydate-selected.laydate-day-next, +.laydate-theme-grid .laydate-selected.laydate-day-prev { + color: #d2d2d2!important +} + +.laydate-theme-grid .laydate-month-list, +.laydate-theme-grid .laydate-year-list { + margin: 1px 0 0 1px +} + +.laydate-theme-grid .laydate-month-list>li, +.laydate-theme-grid .laydate-year-list>li { + margin: 0 -1px -1px 0 +} + +.laydate-theme-grid .laydate-year-list>li { + height: 43px; + line-height: 43px +} + +.laydate-theme-grid .laydate-month-list>li { + height: 71px; + line-height: 71px +} \ No newline at end of file diff --git a/admin/static/layui/layui/css/modules/layer/default/icon-ext.png b/admin/static/layui/layui/css/modules/layer/default/icon-ext.png new file mode 100644 index 0000000..bbbb669 Binary files /dev/null and b/admin/static/layui/layui/css/modules/layer/default/icon-ext.png differ diff --git a/admin/static/layui/layui/css/modules/layer/default/icon.png b/admin/static/layui/layui/css/modules/layer/default/icon.png new file mode 100644 index 0000000..3e17da8 Binary files /dev/null and b/admin/static/layui/layui/css/modules/layer/default/icon.png differ diff --git a/admin/static/layui/layui/css/modules/layer/default/layer.css b/admin/static/layui/layui/css/modules/layer/default/layer.css new file mode 100644 index 0000000..032ae12 --- /dev/null +++ b/admin/static/layui/layui/css/modules/layer/default/layer.css @@ -0,0 +1,2 @@ +/** layui-v2.5.6 MIT License By https://www.layui.com */ + .layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}html #layuicss-layer{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;border-radius:2px;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-load{background:url(loading-1.gif) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layer-anim{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-00{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:1px -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 15px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:5px 5px 0;padding:0 15px;border:1px solid #dedede;background-color:#fff;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#1E9FFF;background-color:#1E9FFF;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:8px 15px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:5px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#fff;border-color:#E9E7E7;color:#333}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95;border-color:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:230px;height:36px;margin:0 auto;line-height:30px;padding-left:10px;border:1px solid #e6e6e6;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px;padding:6px 10px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;overflow:hidden;cursor:pointer}.layui-layer-tab .layui-layer-title span.layui-this{height:43px;border-left:1px solid #eee;border-right:1px solid #eee;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.layui-this{display:block}.layui-layer-photos{-webkit-animation-duration:.8s;animation-duration:.8s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} \ No newline at end of file diff --git a/admin/static/layui/layui/css/modules/layer/default/loading-0.gif b/admin/static/layui/layui/css/modules/layer/default/loading-0.gif new file mode 100644 index 0000000..6f3c953 Binary files /dev/null and b/admin/static/layui/layui/css/modules/layer/default/loading-0.gif differ diff --git a/admin/static/layui/layui/css/modules/layer/default/loading-1.gif b/admin/static/layui/layui/css/modules/layer/default/loading-1.gif new file mode 100644 index 0000000..db3a483 Binary files /dev/null and b/admin/static/layui/layui/css/modules/layer/default/loading-1.gif differ diff --git a/admin/static/layui/layui/css/modules/layer/default/loading-2.gif b/admin/static/layui/layui/css/modules/layer/default/loading-2.gif new file mode 100644 index 0000000..5bb90fd Binary files /dev/null and b/admin/static/layui/layui/css/modules/layer/default/loading-2.gif differ diff --git a/admin/static/layui/layui/font/iconfont.eot b/admin/static/layui/layui/font/iconfont.eot new file mode 100644 index 0000000..622d7ec Binary files /dev/null and b/admin/static/layui/layui/font/iconfont.eot differ diff --git a/admin/static/layui/layui/font/iconfont.svg b/admin/static/layui/layui/font/iconfont.svg new file mode 100644 index 0000000..999ca1f --- /dev/null +++ b/admin/static/layui/layui/font/iconfont.svg @@ -0,0 +1,554 @@ + + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/admin/static/layui/layui/font/iconfont.ttf b/admin/static/layui/layui/font/iconfont.ttf new file mode 100644 index 0000000..06e30f9 Binary files /dev/null and b/admin/static/layui/layui/font/iconfont.ttf differ diff --git a/admin/static/layui/layui/font/iconfont.woff b/admin/static/layui/layui/font/iconfont.woff new file mode 100644 index 0000000..66a1783 Binary files /dev/null and b/admin/static/layui/layui/font/iconfont.woff differ diff --git a/admin/static/layui/layui/font/iconfont.woff2 b/admin/static/layui/layui/font/iconfont.woff2 new file mode 100644 index 0000000..47e9980 Binary files /dev/null and b/admin/static/layui/layui/font/iconfont.woff2 differ diff --git a/admin/static/layui/layui/images/face/0.gif b/admin/static/layui/layui/images/face/0.gif new file mode 100644 index 0000000..a63f0d5 Binary files /dev/null and b/admin/static/layui/layui/images/face/0.gif differ diff --git a/admin/static/layui/layui/images/face/1.gif b/admin/static/layui/layui/images/face/1.gif new file mode 100644 index 0000000..b2b78b2 Binary files /dev/null and b/admin/static/layui/layui/images/face/1.gif differ diff --git a/admin/static/layui/layui/images/face/10.gif b/admin/static/layui/layui/images/face/10.gif new file mode 100644 index 0000000..556c7e3 Binary files /dev/null and b/admin/static/layui/layui/images/face/10.gif differ diff --git a/admin/static/layui/layui/images/face/11.gif b/admin/static/layui/layui/images/face/11.gif new file mode 100644 index 0000000..2bfc58b Binary files /dev/null and b/admin/static/layui/layui/images/face/11.gif differ diff --git a/admin/static/layui/layui/images/face/12.gif b/admin/static/layui/layui/images/face/12.gif new file mode 100644 index 0000000..1c321c7 Binary files /dev/null and b/admin/static/layui/layui/images/face/12.gif differ diff --git a/admin/static/layui/layui/images/face/13.gif b/admin/static/layui/layui/images/face/13.gif new file mode 100644 index 0000000..300bbc2 Binary files /dev/null and b/admin/static/layui/layui/images/face/13.gif differ diff --git a/admin/static/layui/layui/images/face/14.gif b/admin/static/layui/layui/images/face/14.gif new file mode 100644 index 0000000..43b6d0a Binary files /dev/null and b/admin/static/layui/layui/images/face/14.gif differ diff --git a/admin/static/layui/layui/images/face/15.gif b/admin/static/layui/layui/images/face/15.gif new file mode 100644 index 0000000..c9f25fa Binary files /dev/null and b/admin/static/layui/layui/images/face/15.gif differ diff --git a/admin/static/layui/layui/images/face/16.gif b/admin/static/layui/layui/images/face/16.gif new file mode 100644 index 0000000..34f28e4 Binary files /dev/null and b/admin/static/layui/layui/images/face/16.gif differ diff --git a/admin/static/layui/layui/images/face/17.gif b/admin/static/layui/layui/images/face/17.gif new file mode 100644 index 0000000..39cd035 Binary files /dev/null and b/admin/static/layui/layui/images/face/17.gif differ diff --git a/admin/static/layui/layui/images/face/18.gif b/admin/static/layui/layui/images/face/18.gif new file mode 100644 index 0000000..7bce299 Binary files /dev/null and b/admin/static/layui/layui/images/face/18.gif differ diff --git a/admin/static/layui/layui/images/face/19.gif b/admin/static/layui/layui/images/face/19.gif new file mode 100644 index 0000000..adac542 Binary files /dev/null and b/admin/static/layui/layui/images/face/19.gif differ diff --git a/admin/static/layui/layui/images/face/2.gif b/admin/static/layui/layui/images/face/2.gif new file mode 100644 index 0000000..7edbb58 Binary files /dev/null and b/admin/static/layui/layui/images/face/2.gif differ diff --git a/admin/static/layui/layui/images/face/20.gif b/admin/static/layui/layui/images/face/20.gif new file mode 100644 index 0000000..50631a6 Binary files /dev/null and b/admin/static/layui/layui/images/face/20.gif differ diff --git a/admin/static/layui/layui/images/face/21.gif b/admin/static/layui/layui/images/face/21.gif new file mode 100644 index 0000000..b984212 Binary files /dev/null and b/admin/static/layui/layui/images/face/21.gif differ diff --git a/admin/static/layui/layui/images/face/22.gif b/admin/static/layui/layui/images/face/22.gif new file mode 100644 index 0000000..1f0bd8b Binary files /dev/null and b/admin/static/layui/layui/images/face/22.gif differ diff --git a/admin/static/layui/layui/images/face/23.gif b/admin/static/layui/layui/images/face/23.gif new file mode 100644 index 0000000..e05e0f9 Binary files /dev/null and b/admin/static/layui/layui/images/face/23.gif differ diff --git a/admin/static/layui/layui/images/face/24.gif b/admin/static/layui/layui/images/face/24.gif new file mode 100644 index 0000000..f35928a Binary files /dev/null and b/admin/static/layui/layui/images/face/24.gif differ diff --git a/admin/static/layui/layui/images/face/25.gif b/admin/static/layui/layui/images/face/25.gif new file mode 100644 index 0000000..0b4a883 Binary files /dev/null and b/admin/static/layui/layui/images/face/25.gif differ diff --git a/admin/static/layui/layui/images/face/26.gif b/admin/static/layui/layui/images/face/26.gif new file mode 100644 index 0000000..45c4fb5 Binary files /dev/null and b/admin/static/layui/layui/images/face/26.gif differ diff --git a/admin/static/layui/layui/images/face/27.gif b/admin/static/layui/layui/images/face/27.gif new file mode 100644 index 0000000..7a4c013 Binary files /dev/null and b/admin/static/layui/layui/images/face/27.gif differ diff --git a/admin/static/layui/layui/images/face/28.gif b/admin/static/layui/layui/images/face/28.gif new file mode 100644 index 0000000..fc5a0cf Binary files /dev/null and b/admin/static/layui/layui/images/face/28.gif differ diff --git a/admin/static/layui/layui/images/face/29.gif b/admin/static/layui/layui/images/face/29.gif new file mode 100644 index 0000000..5dd7442 Binary files /dev/null and b/admin/static/layui/layui/images/face/29.gif differ diff --git a/admin/static/layui/layui/images/face/3.gif b/admin/static/layui/layui/images/face/3.gif new file mode 100644 index 0000000..86df67b Binary files /dev/null and b/admin/static/layui/layui/images/face/3.gif differ diff --git a/admin/static/layui/layui/images/face/30.gif b/admin/static/layui/layui/images/face/30.gif new file mode 100644 index 0000000..b751f98 Binary files /dev/null and b/admin/static/layui/layui/images/face/30.gif differ diff --git a/admin/static/layui/layui/images/face/31.gif b/admin/static/layui/layui/images/face/31.gif new file mode 100644 index 0000000..c9476d7 Binary files /dev/null and b/admin/static/layui/layui/images/face/31.gif differ diff --git a/admin/static/layui/layui/images/face/32.gif b/admin/static/layui/layui/images/face/32.gif new file mode 100644 index 0000000..9931b06 Binary files /dev/null and b/admin/static/layui/layui/images/face/32.gif differ diff --git a/admin/static/layui/layui/images/face/33.gif b/admin/static/layui/layui/images/face/33.gif new file mode 100644 index 0000000..59111a3 Binary files /dev/null and b/admin/static/layui/layui/images/face/33.gif differ diff --git a/admin/static/layui/layui/images/face/34.gif b/admin/static/layui/layui/images/face/34.gif new file mode 100644 index 0000000..a334548 Binary files /dev/null and b/admin/static/layui/layui/images/face/34.gif differ diff --git a/admin/static/layui/layui/images/face/35.gif b/admin/static/layui/layui/images/face/35.gif new file mode 100644 index 0000000..a932264 Binary files /dev/null and b/admin/static/layui/layui/images/face/35.gif differ diff --git a/admin/static/layui/layui/images/face/36.gif b/admin/static/layui/layui/images/face/36.gif new file mode 100644 index 0000000..6de432a Binary files /dev/null and b/admin/static/layui/layui/images/face/36.gif differ diff --git a/admin/static/layui/layui/images/face/37.gif b/admin/static/layui/layui/images/face/37.gif new file mode 100644 index 0000000..d05f2da Binary files /dev/null and b/admin/static/layui/layui/images/face/37.gif differ diff --git a/admin/static/layui/layui/images/face/38.gif b/admin/static/layui/layui/images/face/38.gif new file mode 100644 index 0000000..8b1c88a Binary files /dev/null and b/admin/static/layui/layui/images/face/38.gif differ diff --git a/admin/static/layui/layui/images/face/39.gif b/admin/static/layui/layui/images/face/39.gif new file mode 100644 index 0000000..38b84a5 Binary files /dev/null and b/admin/static/layui/layui/images/face/39.gif differ diff --git a/admin/static/layui/layui/images/face/4.gif b/admin/static/layui/layui/images/face/4.gif new file mode 100644 index 0000000..d52200c Binary files /dev/null and b/admin/static/layui/layui/images/face/4.gif differ diff --git a/admin/static/layui/layui/images/face/40.gif b/admin/static/layui/layui/images/face/40.gif new file mode 100644 index 0000000..ae42991 Binary files /dev/null and b/admin/static/layui/layui/images/face/40.gif differ diff --git a/admin/static/layui/layui/images/face/41.gif b/admin/static/layui/layui/images/face/41.gif new file mode 100644 index 0000000..b9c715c Binary files /dev/null and b/admin/static/layui/layui/images/face/41.gif differ diff --git a/admin/static/layui/layui/images/face/42.gif b/admin/static/layui/layui/images/face/42.gif new file mode 100644 index 0000000..0eb1434 Binary files /dev/null and b/admin/static/layui/layui/images/face/42.gif differ diff --git a/admin/static/layui/layui/images/face/43.gif b/admin/static/layui/layui/images/face/43.gif new file mode 100644 index 0000000..ac0b700 Binary files /dev/null and b/admin/static/layui/layui/images/face/43.gif differ diff --git a/admin/static/layui/layui/images/face/44.gif b/admin/static/layui/layui/images/face/44.gif new file mode 100644 index 0000000..ad44497 Binary files /dev/null and b/admin/static/layui/layui/images/face/44.gif differ diff --git a/admin/static/layui/layui/images/face/45.gif b/admin/static/layui/layui/images/face/45.gif new file mode 100644 index 0000000..6837fca Binary files /dev/null and b/admin/static/layui/layui/images/face/45.gif differ diff --git a/admin/static/layui/layui/images/face/46.gif b/admin/static/layui/layui/images/face/46.gif new file mode 100644 index 0000000..d62916d Binary files /dev/null and b/admin/static/layui/layui/images/face/46.gif differ diff --git a/admin/static/layui/layui/images/face/47.gif b/admin/static/layui/layui/images/face/47.gif new file mode 100644 index 0000000..58a0836 Binary files /dev/null and b/admin/static/layui/layui/images/face/47.gif differ diff --git a/admin/static/layui/layui/images/face/48.gif b/admin/static/layui/layui/images/face/48.gif new file mode 100644 index 0000000..7ffd161 Binary files /dev/null and b/admin/static/layui/layui/images/face/48.gif differ diff --git a/admin/static/layui/layui/images/face/49.gif b/admin/static/layui/layui/images/face/49.gif new file mode 100644 index 0000000..959b992 Binary files /dev/null and b/admin/static/layui/layui/images/face/49.gif differ diff --git a/admin/static/layui/layui/images/face/5.gif b/admin/static/layui/layui/images/face/5.gif new file mode 100644 index 0000000..4e8b09f Binary files /dev/null and b/admin/static/layui/layui/images/face/5.gif differ diff --git a/admin/static/layui/layui/images/face/50.gif b/admin/static/layui/layui/images/face/50.gif new file mode 100644 index 0000000..6e22e7f Binary files /dev/null and b/admin/static/layui/layui/images/face/50.gif differ diff --git a/admin/static/layui/layui/images/face/51.gif b/admin/static/layui/layui/images/face/51.gif new file mode 100644 index 0000000..ad3f4d3 Binary files /dev/null and b/admin/static/layui/layui/images/face/51.gif differ diff --git a/admin/static/layui/layui/images/face/52.gif b/admin/static/layui/layui/images/face/52.gif new file mode 100644 index 0000000..39f8a22 Binary files /dev/null and b/admin/static/layui/layui/images/face/52.gif differ diff --git a/admin/static/layui/layui/images/face/53.gif b/admin/static/layui/layui/images/face/53.gif new file mode 100644 index 0000000..a181ee7 Binary files /dev/null and b/admin/static/layui/layui/images/face/53.gif differ diff --git a/admin/static/layui/layui/images/face/54.gif b/admin/static/layui/layui/images/face/54.gif new file mode 100644 index 0000000..e289d92 Binary files /dev/null and b/admin/static/layui/layui/images/face/54.gif differ diff --git a/admin/static/layui/layui/images/face/55.gif b/admin/static/layui/layui/images/face/55.gif new file mode 100644 index 0000000..4351083 Binary files /dev/null and b/admin/static/layui/layui/images/face/55.gif differ diff --git a/admin/static/layui/layui/images/face/56.gif b/admin/static/layui/layui/images/face/56.gif new file mode 100644 index 0000000..e0eff22 Binary files /dev/null and b/admin/static/layui/layui/images/face/56.gif differ diff --git a/admin/static/layui/layui/images/face/57.gif b/admin/static/layui/layui/images/face/57.gif new file mode 100644 index 0000000..0bf130f Binary files /dev/null and b/admin/static/layui/layui/images/face/57.gif differ diff --git a/admin/static/layui/layui/images/face/58.gif b/admin/static/layui/layui/images/face/58.gif new file mode 100644 index 0000000..0f06508 Binary files /dev/null and b/admin/static/layui/layui/images/face/58.gif differ diff --git a/admin/static/layui/layui/images/face/59.gif b/admin/static/layui/layui/images/face/59.gif new file mode 100644 index 0000000..7081e4f Binary files /dev/null and b/admin/static/layui/layui/images/face/59.gif differ diff --git a/admin/static/layui/layui/images/face/6.gif b/admin/static/layui/layui/images/face/6.gif new file mode 100644 index 0000000..f7715bf Binary files /dev/null and b/admin/static/layui/layui/images/face/6.gif differ diff --git a/admin/static/layui/layui/images/face/60.gif b/admin/static/layui/layui/images/face/60.gif new file mode 100644 index 0000000..6e15f89 Binary files /dev/null and b/admin/static/layui/layui/images/face/60.gif differ diff --git a/admin/static/layui/layui/images/face/61.gif b/admin/static/layui/layui/images/face/61.gif new file mode 100644 index 0000000..f092d7e Binary files /dev/null and b/admin/static/layui/layui/images/face/61.gif differ diff --git a/admin/static/layui/layui/images/face/62.gif b/admin/static/layui/layui/images/face/62.gif new file mode 100644 index 0000000..7fe4984 Binary files /dev/null and b/admin/static/layui/layui/images/face/62.gif differ diff --git a/admin/static/layui/layui/images/face/63.gif b/admin/static/layui/layui/images/face/63.gif new file mode 100644 index 0000000..cf8e23e Binary files /dev/null and b/admin/static/layui/layui/images/face/63.gif differ diff --git a/admin/static/layui/layui/images/face/64.gif b/admin/static/layui/layui/images/face/64.gif new file mode 100644 index 0000000..a779719 Binary files /dev/null and b/admin/static/layui/layui/images/face/64.gif differ diff --git a/admin/static/layui/layui/images/face/65.gif b/admin/static/layui/layui/images/face/65.gif new file mode 100644 index 0000000..7bb98f2 Binary files /dev/null and b/admin/static/layui/layui/images/face/65.gif differ diff --git a/admin/static/layui/layui/images/face/66.gif b/admin/static/layui/layui/images/face/66.gif new file mode 100644 index 0000000..bb6d077 Binary files /dev/null and b/admin/static/layui/layui/images/face/66.gif differ diff --git a/admin/static/layui/layui/images/face/67.gif b/admin/static/layui/layui/images/face/67.gif new file mode 100644 index 0000000..6e33f7c Binary files /dev/null and b/admin/static/layui/layui/images/face/67.gif differ diff --git a/admin/static/layui/layui/images/face/68.gif b/admin/static/layui/layui/images/face/68.gif new file mode 100644 index 0000000..1a6c400 Binary files /dev/null and b/admin/static/layui/layui/images/face/68.gif differ diff --git a/admin/static/layui/layui/images/face/69.gif b/admin/static/layui/layui/images/face/69.gif new file mode 100644 index 0000000..a02f0b2 Binary files /dev/null and b/admin/static/layui/layui/images/face/69.gif differ diff --git a/admin/static/layui/layui/images/face/7.gif b/admin/static/layui/layui/images/face/7.gif new file mode 100644 index 0000000..e6d4db8 Binary files /dev/null and b/admin/static/layui/layui/images/face/7.gif differ diff --git a/admin/static/layui/layui/images/face/70.gif b/admin/static/layui/layui/images/face/70.gif new file mode 100644 index 0000000..416c5c1 Binary files /dev/null and b/admin/static/layui/layui/images/face/70.gif differ diff --git a/admin/static/layui/layui/images/face/71.gif b/admin/static/layui/layui/images/face/71.gif new file mode 100644 index 0000000..c17d60c Binary files /dev/null and b/admin/static/layui/layui/images/face/71.gif differ diff --git a/admin/static/layui/layui/images/face/8.gif b/admin/static/layui/layui/images/face/8.gif new file mode 100644 index 0000000..66f967b Binary files /dev/null and b/admin/static/layui/layui/images/face/8.gif differ diff --git a/admin/static/layui/layui/images/face/9.gif b/admin/static/layui/layui/images/face/9.gif new file mode 100644 index 0000000..6044740 Binary files /dev/null and b/admin/static/layui/layui/images/face/9.gif differ diff --git a/admin/static/layui/layui/lay/modules/carousel.js b/admin/static/layui/layui/lay/modules/carousel.js new file mode 100644 index 0000000..28a4471 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/carousel.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
      ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
    "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
    1. '+o.replace(/[\r\t\n]+/g,"
    2. ")+"
    "),c.find(">.layui-code-h3")[0]||c.prepend('

    '+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

    ");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/element.js b/admin/static/layui/layui/lay/modules/element.js new file mode 100644 index 0000000..ad884e0 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/element.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='
  • "+(i.title||"unnaming")+"
  • ";return s[0]?s.before(r):n.append(r),o.append('
    '+(i.content||"")+"
    "),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a(''),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append(''),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append(''+(l?"":"")+""),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/flow.js b/admin/static/layui/layui/lay/modules/flow.js new file mode 100644 index 0000000..be77157 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/flow.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/form.js b/admin/static/layui/layui/lay/modules/form.js new file mode 100644 index 0000000..3befbe6 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/form.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",c="layui-hide",o="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};u.prototype.set=function(e){var t=this;return i.extend(!0,t.config,e),t},u.prototype.verify=function(e){var t=this;return i.extend(!0,t.config.verify,e),t},u.prototype.on=function(e,i){return layui.onevent.call(this,l,e,i)},u.prototype.val=function(e,t){var a=i(r+'[lay-filter="'+e+'"]');a.each(function(e,a){var n=i(this);layui.each(t,function(e,i){var t,a=n.find('[name="'+e+'"]');a[0]&&(t=a[0].type,"checkbox"===t?a[0].checked=i:"radio"===t?a.each(function(){this.value===i&&(this.checked=!0)}):a.val(i))})}),f.render(null,e)},u.prototype.render=function(e,t){var n=this,u=i(r+function(){return t?'[lay-filter="'+t+'"]':""}()),d={select:function(){var e,t="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=u.find("select"),v=function(t,l){i(t.target).parent().hasClass(n)&&!l||(i("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},h=function(t,u,f){var h,p=i(this),m=t.find("."+n),k=m.find("input"),g=t.find("dl"),x=g.children("dd"),b=this.selectedIndex;if(!u){var C=function(){var e=t.offset().top+t.outerHeight()+5-y.scrollTop(),i=g.outerHeight();b=p[0].selectedIndex,t.addClass(a+"ed"),x.removeClass(c),x.eq(b).addClass(s).siblings().removeClass(s),e+i>y.height()&&e>=i&&t.addClass(a+"up")},w=function(e){t.removeClass(a+"ed "+a+"up"),k.blur(),h=null,e||$(k.val(),function(e){e&&(d=g.find("."+s).html(),k&&k.val(d))})};m.on("click",function(e){t.hasClass(a+"ed")?w():(v(e,!0),C()),g.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){k.focus()}),k.on("keyup",function(e){var i=e.keyCode;9===i&&C()}).on("keydown",function(e){var i=e.keyCode;9===i&&w();var t=function(i,a){var n,l;if(e.preventDefault(),a=function(){return a&&a[0]?a:h&&h[0]?h:x.eq(b)}(),l=a[i](),n=a[i]("dd"),l[0])return h=a[i](),!n[0]||n.hasClass(o)?t(i,h):void n.addClass(s).siblings().removeClass(s)};38===i&&t("prev"),40===i&&t("next"),13===i&&(e.preventDefault(),g.children("dd."+s).trigger("click"))});var $=function(e,t,a){var n=0;layui.each(x,function(){var t=i(this),l=t.text(),r=l.indexOf(e)===-1;(""===e||"blur"===a?e!==l:r)&&n++,"keyup"===a&&t[r?"addClass":"removeClass"](c)});var l=n===x.length;return t(l),l},T=function(e){var i=this.value,t=e.keyCode;return 9!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&($(i,function(e){e?g.find("."+r)[0]||g.append('

    无匹配项

    '):g.find("."+r).remove()},"keyup"),void(""===i&&g.find("."+r).remove()))};f&&k.on("keyup",T).on("blur",function(t){var a=p[0].selectedIndex;e=k,d=i(p[0].options[a]).html(),setTimeout(function(){$(k.val(),function(e){d||k.val("")},"blur")},200)}),x.on("click",function(){var e=i(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(o)&&(e.hasClass("layui-select-tips")?k.val(""):(k.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:t}),w(!0),!1)}),t.find("dl>dt").on("click",function(e){return!1}),i(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=i(this),c=r.next("."+a),u=this.disabled,d=l.value,f=i(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var y="string"==typeof r.attr("lay-search"),p=v?v.value?t:v.innerHTML||t:t,m=i(['
    ','
    ','','
    ','
    ',function(e){var i=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?i.push("
    "+a.label+"
    "):i.push('
    '+a.innerHTML+"
    "):i.push('
    '+(a.innerHTML||t)+"
    ")}),0===i.length&&i.push('
    没有选项
    '),i.join("")}(r.find("*"))+"
    ","
    "].join(""));c[0]&&c.remove(),r.after(m),h.call(this,m,u,y)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},t=u.find("input[type=checkbox]"),a=function(e,t){var a=i(this);e.on("click",function(){var i=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(t[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(t[1]).find("em").text(n[0])),layui.event.call(a[0],l,t[2]+"("+i+")",{elem:a[0],value:a[0].value,othis:e}))})};t.each(function(t,n){var l=i(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),c=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=i(['
    ",function(){var e=n.title.replace(/\s/g,""),i={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?s[0]:s[1])||"")+""};return i[r]||i.checkbox}(),"
    "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",t=["",""],a=u.find("input[type=radio]"),n=function(a){var n=i(this),s="layui-anim-scaleSpring";a.on("click",function(){var c=n[0].name,o=n.parents(r),u=n.attr("lay-filter"),d=o.find("input[name="+c.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=i(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(t[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(t[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=i(this),s=r.next("."+e),c=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var u=i(['
    ',''+t[l.checked?0:1]+"","
    "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"
    ","
    "].join(""));r.after(u),n.call(this,u)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,i){i()}),n};var d=function(){var e=i(this),a=f.config.verify,s=null,c="layui-form-danger",o={},u=e.parents(r),d=u.find("*[lay-verify]"),v=e.parents("form")[0],y=u.find("input,select,textarea"),h=e.attr("lay-filter");if(layui.each(d,function(e,l){var r=i(this),o=r.attr("lay-verify").split("|"),u=r.attr("lay-verType"),d=r.val();if(r.removeClass(c),layui.each(o,function(e,i){var o,f="",v="function"==typeof a[i];if(a[i]){var o=v?f=a[i](d,l):!a[i][0].test(d);if(f=f||a[i][1],o)return"tips"===u?t.tips(f,function(){return"string"==typeof r.attr("lay-ignore")||"select"!==l.tagName.toLowerCase()&&!/^checkbox|radio$/.test(l.type)?r:r.next()}(),{tips:1}):"alert"===u?t.alert(f,{title:"提示",shadeClose:!0}):t.msg(f,{icon:5,shift:6}),n.android||n.ios||l.focus(),r.addClass(c),s=!0}}),s)return s}),s)return!1;var p={};return layui.each(y,function(e,i){if(i.name=(i.name||"").replace(/^\s*|\s*&/,""),i.name){if(/^.*\[\]$/.test(i.name)){var t=i.name.match(/^(.*)\[\]$/g)[0];p[t]=0|p[t],i.name=i.name.replace(/^(.*)\[\]$/,"$1["+p[t]++ +"]")}/^checkbox|radio$/.test(i.type)&&!i.checked||(o[i.name]=i.value)}}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:v,field:o})},f=new u,v=i(document),y=i(window);f.render(),v.on("reset",r,function(){var e=i(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/jquery.js b/admin/static/layui/layui/lay/modules/jquery.js new file mode 100644 index 0000000..fc46da2 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/jquery.js @@ -0,0 +1,5 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=!!e&&"length"in e&&e.length,n=pe.type(e);return"function"!==n&&!pe.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Ce.test(t))return pe.filter(t,e,n);t=pe.filter(t,e)}return pe.grep(e,function(e){return pe.inArray(e,t)>-1!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function a(){re.addEventListener?(re.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s)):(re.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(re.addEventListener||"load"===e.event.type||"complete"===re.readyState)&&(a(),pe.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(_e,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?pe.parseJSON(n):n)}catch(i){}pe.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=ne.pop()||pe.guid++:a),u[l]||(u[l]=s?{}:{toJSON:pe.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[l]=pe.extend(u[l],t):u[l].data=pe.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[pe.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[pe.camelCase(t)])):i=o,i}}function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe.expando]:pe.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){pe.isArray(t)?t=t.concat(pe.map(t,pe.camelCase)):t in r?t=[t]:(t=pe.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!pe.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?pe.cleanData([e],!0):fe.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return pe.css(e,t,"")},u=s(),l=n&&n[3]||(pe.cssNumber[t]?"":"px"),c=(pe.cssNumber[t]||"px"!==l&&+u)&&Me.exec(pe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,pe.style(e,t,c+l);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||pe.nodeName(r,t)?o.push(r):pe.merge(o,h(r,t));return void 0===t||t&&pe.nodeName(e,t)?pe.merge([e],o):o}function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval",!t||pe._data(t[r],"globalEval"))}function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x"!==f[1]||Ve.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)pe.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(pe.merge(v,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=y.lastChild}else v.push(t.createTextNode(a));for(u&&y.removeChild(u),fe.appendChecked||pe.grep(h(v,"input"),m),x=0;a=v[x++];)if(r&&pe.inArray(a,r)>-1)i&&i.push(a);else if(s=pe.contains(a.ownerDocument,a),u=h(y.appendChild(a),"script"),s&&g(u),n)for(o=0;a=u[o++];)Ie.test(a.type||"")&&n.push(a);return u=null,y}function v(){return!0}function x(){return!1}function b(){try{return re.activeElement}catch(e){}}function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)w(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=x;else if(!i)return e;return 1===o&&(a=i,i=function(e){return pe().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=pe.guid++)),e.each(function(){pe.event.add(this,t,i,r,n)})}function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e),a=pe._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;r1&&"string"==typeof p&&!fe.checkClone&&rt.test(p))return e.each(function(i){var o=e.eq(i);g&&(t[0]=p.call(this,i,o.html())),S(o,t,n,r)});if(f&&(l=y(t,e[0].ownerDocument,!1,e,r),i=l.firstChild,1===l.childNodes.length&&(l=i),i||r)){for(s=pe.map(h(l,"script"),C),a=s.length;c")).appendTo(t.documentElement),t=(ut[0].contentWindow||ut[0].contentDocument).document,t.write(),t.close(),n=D(e,t),ut.detach()),lt[e]=n),n}function L(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Ct.length;n--;)if(e=Ct[n]+t,e in Et)return e}function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==pe.type(e)||e.nodeType||pe.isWindow(e))return!1;try{if(e.constructor&&!ce.call(e,"constructor")&&!ce.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!fe.ownFirst)for(t in e)return ce.call(e,t);for(t in e);return void 0===t||ce.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ue[le.call(e)]||"object":typeof e},globalEval:function(t){t&&pe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ge,"ms-").replace(me,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var r,i=0;if(n(e))for(r=e.length;iT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(a[l]=f))}}else x=m(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",g=r&&[],y=[],v=A,x=r||o&&T.find.TAG("*",l),b=W+=null==v?1:Math.random()||.1,w=x.length;for(l&&(A=a===H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===H||(L(c),s=!_);d=e[f++];)if(d(c,a||H,s)){u.push(c);break}l&&(W=b)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,y,a,s);if(r){if(p>0)for(;h--;)g[h]||y[h]||(y[h]=G.call(u));y=m(y)}Q.apply(u,y),l&&!r&&y.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=b,A=v),g};return i?r(a):a}var b,w,T,C,E,N,k,S,A,D,j,L,H,q,_,F,M,O,R,P="sizzle"+1*new Date,B=e.document,W=0,I=0,$=n(),z=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,Y={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),de=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){L()};try{Q.apply(J=Z.call(B.childNodes),B.childNodes),J[B.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=H.documentElement,_=!E(H),(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(H.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!H.getElementsByName||!H.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&_)return t.getElementsByClassName(e)},M=[],F=[],(w.qsa=me.test(H.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=me.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),M=M.length&&new RegExp(M.join("|")),t=me.test(q.compareDocumentPosition),R=t||me.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===H||e.ownerDocument===B&&R(B,e)?-1:t===H||t.ownerDocument===B&&R(B,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===H?-1:t===H?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(ce,"='$1']"),w.matchesSelector&&_&&!X[n+" "]&&(!M||!M.test(n))&&(!F||!F.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),R(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,we),e[3]=(e[3]||e[4]||e[5]||"").replace(be,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=N(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s,x=!1;if(m){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(d=m,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}), +l=c[e]||[],p=l[0]===W&&l[1],x=p&&l[2],d=p&&m.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[W,p,x];break}}else if(v&&(d=t,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p),x===!1)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(v&&(f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[W,x]),d!==t)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,we).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,we),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,we),ve.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e)return Q.apply(n,r),n;break}}return(l||k(e,f))(r,t,!_,n,!t||ve.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);pe.find=ve,pe.expr=ve.selectors,pe.expr[":"]=pe.expr.pseudos,pe.uniqueSort=pe.unique=ve.uniqueSort,pe.text=ve.getText,pe.isXMLDoc=ve.isXML,pe.contains=ve.contains;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&pe(e).is(n))break;r.push(e)}return r},be=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=pe.expr.match.needsContext,Te=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ce=/^.[^:#\[\.,]*$/;pe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pe.find.matchesSelector(r,e)?[r]:[]:pe.find.matches(e,pe.grep(t,function(e){return 1===e.nodeType}))},pe.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(pe(e).filter(function(){for(t=0;t1?pe.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&we.test(e)?pe(e):e||[],!1).length}});var Ee,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ke=pe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Ne.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof pe?t[0]:t,pe.merge(this,pe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:re,!0)),Te.test(r[1])&&pe.isPlainObject(t))for(r in t)pe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=re.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Ee.find(e);this.length=1,this[0]=i}return this.context=re,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pe.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(pe):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),pe.makeArray(e,this))};ke.prototype=pe.fn,Ee=pe(re);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};pe.fn.extend({has:function(e){var t,n=pe(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:1===n.nodeType&&pe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?pe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?pe.inArray(this[0],pe(e)):pe.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(pe.uniqueSort(pe.merge(this.get(),pe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return be((e.parentNode||{}).firstChild,e)},children:function(e){return be(e.firstChild)},contents:function(e){return pe.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pe.merge([],e.childNodes)}},function(e,t){pe.fn[e]=function(n,r){var i=pe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=pe.filter(r,i)),this.length>1&&(Ae[e]||(i=pe.uniqueSort(i)),Se.test(e)&&(i=i.reverse())),this.pushStack(i)}});var De=/\S+/g;pe.Callbacks=function(e){e="string"==typeof e?o(e):pe.extend({},e);var t,n,r,i,a=[],s=[],u=-1,l=function(){for(i=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u-1;)a.splice(n,1),n<=u&&u--}),this},has:function(e){return e?pe.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=!0,n||c.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},pe.extend({Deferred:function(e){var t=[["resolve","done",pe.Callbacks("once memory"),"resolved"],["reject","fail",pe.Callbacks("once memory"),"rejected"],["notify","progress",pe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pe.Deferred(function(n){pe.each(t,function(t,o){var a=pe.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&pe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pe.extend(e,r):r}},i={};return r.pipe=r.then,pe.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ie.call(arguments),a=o.length,s=1!==a||e&&pe.isFunction(e.promise)?a:0,u=1===s?e:pe.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ie.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);i0||(je.resolveWith(re,[pe]),pe.fn.triggerHandler&&(pe(re).triggerHandler("ready"),pe(re).off("ready"))))}}),pe.ready.promise=function(t){if(!je)if(je=pe.Deferred(),"complete"===re.readyState||"loading"!==re.readyState&&!re.documentElement.doScroll)e.setTimeout(pe.ready);else if(re.addEventListener)re.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s);else{re.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&re.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!pe.isReady){try{n.doScroll("left")}catch(t){return e.setTimeout(i,50)}a(),pe.ready()}}()}return je.promise(t)},pe.ready.promise();var Le;for(Le in pe(fe))break;fe.ownFirst="0"===Le,fe.inlineBlockNeedsLayout=!1,pe(function(){var e,t,n,r;n=re.getElementsByTagName("body")[0],n&&n.style&&(t=re.createElement("div"),r=re.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",fe.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=re.createElement("div");fe.deleteExpando=!0;try{delete e.test}catch(t){fe.deleteExpando=!1}e=null}();var He=function(e){var t=pe.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)},qe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;pe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pe.cache[e[pe.expando]]:e[pe.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return f(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return f(e,t,!0)}}),pe.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=pe.data(o),1===o.nodeType&&!pe._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=pe.camelCase(r.slice(5)),u(o,r,i[r])));pe._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pe.data(this,e)}):arguments.length>1?this.each(function(){pe.data(this,e,t)}):o?u(o,e,pe.data(o,e)):void 0},removeData:function(e){return this.each(function(){pe.removeData(this,e)})}}),pe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=pe._data(e,t),n&&(!r||pe.isArray(n)?r=pe._data(e,t,pe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=pe.queue(e,t),r=n.length,i=n.shift(),o=pe._queueHooks(e,t),a=function(){pe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pe._data(e,n)||pe._data(e,n,{empty:pe.Callbacks("once memory").add(function(){pe._removeData(e,t+"queue"),pe._removeData(e,n)})})}}),pe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length
    a",fe.leadingWhitespace=3===e.firstChild.nodeType,fe.tbody=!e.getElementsByTagName("tbody").length,fe.htmlSerialize=!!e.getElementsByTagName("link").length,fe.html5Clone="<:nav>"!==re.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),fe.appendChecked=n.checked,e.innerHTML="",fe.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=re.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),fe.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.noCloneEvent=!!e.addEventListener,e[pe.expando]=1,fe.attributes=!e.getAttribute(pe.expando)}();var Xe={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:fe.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var Ue=/<|&#?\w+;/,Ve=/-1&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[pe.expando]?t:new pe.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:pe.makeArray(n,[t]),l=pe.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!pe.isWindow(r)){for(u=l.delegateType||p,Ke.test(u+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),c=s;c===(r.ownerDocument||re)&&d.push(c.defaultView||c.parentWindow||e)}for(f=0;(s=d[f++])&&!t.isPropagationStopped();)t.type=f>1?u:l.bindType||p,o=(pe._data(s,"events")||{})[t.type]&&pe._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&He(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&He(r)&&a&&r[p]&&!pe.isWindow(r)){c=r[a],c&&(r[a]=null),pe.event.triggered=p;try{r[p]()}catch(g){}pe.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=pe.event.fix(e);var t,n,r,i,o,a=[],s=ie.call(arguments),u=(pe._data(this,"events")||{})[e.type]||[],l=pe.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=pe.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((pe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;n-1:pe.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s]","i"),tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt=/\s*$/g,at=p(re),st=at.appendChild(re.createElement("div"));pe.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var r,i,o,a,s,u=pe.contains(e.ownerDocument,e);if(fe.html5Clone||pe.isXMLDoc(e)||!et.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(st.innerHTML=e.outerHTML,st.removeChild(o=st.firstChild)),!(fe.noCloneEvent&&fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pe.isXMLDoc(e)))for(r=h(o),s=h(e),a=0;null!=(i=s[a]);++a)r[a]&&k(i,r[a]);if(t)if(n)for(s=s||h(e),r=r||h(o),a=0;null!=(i=s[a]);a++)N(i,r[a]);else N(e,o);return r=h(o,"script"),r.length>0&&g(r,!u&&h(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=pe.expando,u=pe.cache,l=fe.attributes,c=pe.event.special;null!=(n=e[a]);a++)if((t||He(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?pe.event.remove(n,r):pe.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ne.push(i))}}}),pe.fn.extend({domManip:S,detach:function(e){return A(this,e,!0)},remove:function(e){return A(this,e)},text:function(e){return Pe(this,function(e){return void 0===e?pe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||re).createTextNode(e))},null,e,arguments.length)},append:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.appendChild(e)}})},prepend:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&pe.cleanData(h(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pe.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return pe.clone(this,e,t)})},html:function(e){return Pe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ze,""):void 0;if("string"==typeof e&&!nt.test(e)&&(fe.htmlSerialize||!et.test(e))&&(fe.leadingWhitespace||!$e.test(e))&&!Xe[(We.exec(e)||["",""])[1].toLowerCase()]){e=pe.htmlPrefilter(e);try{for(;nt",t=l.getElementsByTagName("td"),t[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===t[0].offsetHeight,o&&(t[0].style.display="",t[1].style.display="none",o=0===t[0].offsetHeight)),f.removeChild(u)}var n,r,i,o,a,s,u=re.createElement("div"),l=re.createElement("div");l.style&&(l.style.cssText="float:left;opacity:.5",fe.opacity="0.5"===l.style.opacity,fe.cssFloat=!!l.style.cssFloat,l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===l.style.backgroundClip,u=re.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",l.innerHTML="",u.appendChild(l),fe.boxSizing=""===l.style.boxSizing||""===l.style.MozBoxSizing||""===l.style.WebkitBoxSizing,pe.extend(fe,{reliableHiddenOffsets:function(){return null==n&&t(),o},boxSizingReliable:function(){return null==n&&t(),i},pixelMarginRight:function(){return null==n&&t(),r},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),a},reliableMarginLeft:function(){return null==n&&t(),s}}))}();var ht,gt,mt=/^(top|right|bottom|left)$/;e.getComputedStyle?(ht=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||pe.contains(e.ownerDocument,e)||(a=pe.style(e,t)),n&&!fe.pixelMarginRight()&&ft.test(a)&&ct.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):pt.currentStyle&&(ht=function(e){return e.currentStyle},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),ft.test(a)&&!mt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var yt=/alpha\([^)]*\)/i,vt=/opacity\s*=\s*([^)]*)/i,xt=/^(none|table(?!-c[ea]).+)/,bt=new RegExp("^("+Fe+")(.*)$","i"),wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"},Ct=["Webkit","O","Moz","ms"],Et=re.createElement("div").style;pe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=gt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":fe.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=pe.camelCase(t),u=e.style;if(t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Me.exec(n))&&i[1]&&(n=d(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(pe.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=pe.camelCase(t);return t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=gt(e,t,r)),"normal"===o&&t in Tt&&(o=Tt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),pe.each(["height","width"],function(e,t){pe.cssHooks[t]={get:function(e,n,r){if(n)return xt.test(pe.css(e,"display"))&&0===e.offsetWidth?dt(e,wt,function(){return M(e,t,r)}):M(e,t,r)},set:function(e,n,r){var i=r&&ht(e);return _(e,n,r?F(e,t,r,fe.boxSizing&&"border-box"===pe.css(e,"boxSizing",!1,i),i):0)}}}),fe.opacity||(pe.cssHooks.opacity={get:function(e,t){return vt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=pe.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pe.trim(o.replace(yt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=yt.test(o)?o.replace(yt,i):o+" "+i)}}),pe.cssHooks.marginRight=L(fe.reliableMarginRight,function(e,t){if(t)return dt(e,{display:"inline-block"},gt,[e,"marginRight"])}),pe.cssHooks.marginLeft=L(fe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(gt(e,"marginLeft"))||(pe.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px"}),pe.each({margin:"",padding:"",border:"Width"},function(e,t){pe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+Oe[r]+t]=o[r]||o[r-2]||o[0];return i}},ct.test(e)||(pe.cssHooks[e+t].set=_)}),pe.fn.extend({css:function(e,t){return Pe(this,function(e,t,n){var r,i,o={},a=0;if(pe.isArray(t)){for(r=ht(e),i=t.length;a1)},show:function(){return q(this,!0)},hide:function(){return q(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Re(this)?pe(this).show():pe(this).hide()})}}),pe.Tween=O,O.prototype={constructor:O,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||pe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(pe.cssNumber[n]?"":"px")},cur:function(){var e=O.propHooks[this.prop];return e&&e.get?e.get(this):O.propHooks._default.get(this)},run:function(e){var t,n=O.propHooks[this.prop];return this.options.duration?this.pos=t=pe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=pe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){pe.fx.step[e.prop]?pe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[pe.cssProps[e.prop]]&&!pe.cssHooks[e.prop]?e.elem[e.prop]=e.now:pe.style(e.elem,e.prop,e.now+e.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},pe.fx=O.prototype.init,pe.fx.step={};var Nt,kt,St=/^(?:toggle|show|hide)$/,At=/queueHooks$/;pe.Animation=pe.extend($,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,Me.exec(t),n),n}]},tweener:function(e,t){pe.isFunction(e)?(t=e,e=["*"]):e=e.match(De);for(var n,r=0,i=e.length;r
    a",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",fe.getSetAttribute="t"!==n.className,fe.style=/top/.test(e.getAttribute("style")),fe.hrefNormalized="/a"===e.getAttribute("href"),fe.checkOn=!!t.value,fe.optSelected=i.selected,fe.enctype=!!re.createElement("form").enctype,r.disabled=!0,fe.optDisabled=!i.disabled,t=re.createElement("input"),t.setAttribute("value",""),fe.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),fe.radioValue="t"===t.value}();var Dt=/\r/g,jt=/[\x20\t\r\n\f]+/g;pe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=pe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,pe(this).val()):e,null==i?i="":"number"==typeof i?i+="":pe.isArray(i)&&(i=pe.map(i,function(e){return null==e?"":e+""})),t=pe.valHooks[this.type]||pe.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=pe.valHooks[i.type]||pe.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Dt,""):null==n?"":n)}}}),pe.extend({valHooks:{option:{get:function(e){var t=pe.find.attr(e,"value");return null!=t?t:pe.trim(pe.text(e)).replace(jt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,a=o?null:[],s=o?i+1:r.length,u=i<0?s:o?i:0;u-1)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),pe.each(["radio","checkbox"],function(){pe.valHooks[this]={set:function(e,t){if(pe.isArray(t))return e.checked=pe.inArray(pe(e).val(),t)>-1}},fe.checkOn||(pe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Lt,Ht,qt=pe.expr.attrHandle,_t=/^(?:checked|selected)$/i,Ft=fe.getSetAttribute,Mt=fe.input;pe.fn.extend({attr:function(e,t){return Pe(this,pe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pe.removeAttr(this,e)})}}),pe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?pe.prop(e,t,n):(1===o&&pe.isXMLDoc(e)||(t=t.toLowerCase(),i=pe.attrHooks[t]||(pe.expr.match.bool.test(t)?Ht:Lt)),void 0!==n?null===n?void pe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=pe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&pe.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(De);if(o&&1===e.nodeType)for(;n=o[i++];)r=pe.propFix[n]||n,pe.expr.match.bool.test(n)?Mt&&Ft||!_t.test(n)?e[r]=!1:e[pe.camelCase("default-"+n)]=e[r]=!1:pe.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Ht={set:function(e,t,n){return t===!1?pe.removeAttr(e,n):Mt&&Ft||!_t.test(n)?e.setAttribute(!Ft&&pe.propFix[n]||n,n):e[pe.camelCase("default-"+n)]=e[n]=!0,n}},pe.each(pe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=qt[t]||pe.find.attr;Mt&&Ft||!_t.test(t)?qt[t]=function(e,t,r){var i,o;return r||(o=qt[t],qt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,qt[t]=o),i}:qt[t]=function(e,t,n){if(!n)return e[pe.camelCase("default-"+t)]?t.toLowerCase():null}}),Mt&&Ft||(pe.attrHooks.value={set:function(e,t,n){return pe.nodeName(e,"input")?void(e.defaultValue=t):Lt&&Lt.set(e,t,n)}}),Ft||(Lt={set:function(e,t,n){var r=e.getAttributeNode(n);if(r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n))return t}},qt.id=qt.name=qt.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},pe.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:Lt.set},pe.attrHooks.contenteditable={set:function(e,t,n){Lt.set(e,""!==t&&t,n)}},pe.each(["width","height"],function(e,t){pe.attrHooks[t]={set:function(e,n){if(""===n)return e.setAttribute(t,"auto"),n}}})),fe.style||(pe.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ot=/^(?:input|select|textarea|button|object)$/i,Rt=/^(?:a|area)$/i;pe.fn.extend({prop:function(e,t){return Pe(this,pe.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pe.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),pe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&pe.isXMLDoc(e)||(t=pe.propFix[t]||t,i=pe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=pe.find.attr(e,"tabindex");return t?parseInt(t,10):Ot.test(e.nodeName)||Rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.hrefNormalized||pe.each(["href","src"],function(e,t){pe.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),fe.optSelected||(pe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),pe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pe.propFix[this.toLowerCase()]=this}),fe.enctype||(pe.propFix.enctype="encoding");var Pt=/[\t\r\n\f]/g;pe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).addClass(e.call(this,t,z(this)))});if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).removeClass(e.call(this,t,z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):pe.isFunction(e)?this.each(function(n){pe(this).toggleClass(e.call(this,n,z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=pe(this),o=e.match(De)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=z(this),t&&pe._data(this,"__className__",t),pe.attr(this,"class",t||e===!1?"":pe._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(n)+" ").replace(Pt," ").indexOf(t)>-1)return!0;return!1}}),pe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){pe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var Bt=e.location,Wt=pe.now(),It=/\?/,$t=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;pe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=pe.trim(t+"");return i&&!pe.trim(i.replace($t,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():pe.error("Invalid JSON: "+t)},pe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new e.DOMParser,n=r.parseFromString(t,"text/xml")):(n=new e.ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||pe.error("Invalid XML: "+t),n};var zt=/#.*$/,Xt=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Vt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Gt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Kt={},Qt={},Zt="*/".concat("*"),en=Bt.href,tn=Gt.exec(en.toLowerCase())||[];pe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:en,type:"GET",isLocal:Vt.test(tn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":pe.parseJSON,"text xml":pe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?V(V(e,pe.ajaxSettings),t):V(pe.ajaxSettings,e)},ajaxPrefilter:X(Kt),ajaxTransport:X(Qt),ajax:function(t,n){function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c=void 0,s=i||"",T.readyState=t>0?4:0,o=t>=200&&t<300||304===t,r&&(x=Y(d,T,r)),x=J(d,x,T,o),o?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pe.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(pe.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,f=x.data,v=x.error,o=!v)):(v=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",o?g.resolveWith(p,[f,C,T]):g.rejectWith(p,[T,C,v]),T.statusCode(y),y=void 0,l&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?f:v]),m.fireWith(p,[T,C]),l&&(h.trigger("ajaxComplete",[T,d]),--pe.active||pe.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,d=pe.ajaxSetup({},n),p=d.context||d,h=d.context&&(p.nodeType||p.jquery)?pe(p):pe.event,g=pe.Deferred(),m=pe.Callbacks("once memory"),y=d.statusCode||{},v={},x={},b=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!f)for(f={};t=Ut.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=x[n]=x[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)y[t]=[y[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(g.promise(T).complete=m.add,T.success=T.done,T.error=T.fail,d.url=((t||d.url||en)+"").replace(zt,"").replace(Jt,tn[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=pe.trim(d.dataType||"*").toLowerCase().match(De)||[""],null==d.crossDomain&&(i=Gt.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===tn[1]&&i[2]===tn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(tn[3]||("http:"===tn[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=pe.param(d.data,d.traditional)),U(Kt,d,n,T),2===b)return T;l=pe.event&&d.global,l&&0===pe.active++&&pe.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Yt.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(It.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Xt.test(a)?a.replace(Xt,"$1_="+Wt++):a+(It.test(a)?"&":"?")+"_="+Wt++)),d.ifModified&&(pe.lastModified[a]&&T.setRequestHeader("If-Modified-Since",pe.lastModified[a]),pe.etag[a]&&T.setRequestHeader("If-None-Match",pe.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Zt+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(p,T,d)===!1||2===b))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=U(Qt,d,n,T)){if(T.readyState=1,l&&h.trigger("ajaxSend",[T,d]),2===b)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{b=1,c.send(v,r)}catch(C){if(!(b<2))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pe.get(e,t,n,"json")},getScript:function(e,t){return pe.get(e,void 0,t,"script")}}),pe.each(["get","post"],function(e,t){pe[t]=function(e,n,r,i){return pe.isFunction(n)&&(i=i||r,r=n,n=void 0),pe.ajax(pe.extend({url:e,type:t,dataType:i,data:n,success:r},pe.isPlainObject(e)&&e))}}),pe._evalUrl=function(e){return pe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},pe.fn.extend({wrapAll:function(e){if(pe.isFunction(e))return this.each(function(t){pe(this).wrapAll(e.call(this,t))});if(this[0]){var t=pe(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return pe.isFunction(e)?this.each(function(t){pe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=pe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pe.isFunction(e);return this.each(function(n){pe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pe.nodeName(this,"body")||pe(this).replaceWith(this.childNodes)}).end()}}),pe.expr.filters.hidden=function(e){return fe.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:K(e)},pe.expr.filters.visible=function(e){return!pe.expr.filters.hidden(e)};var nn=/%20/g,rn=/\[\]$/,on=/\r?\n/g,an=/^(?:submit|button|image|reset|file)$/i,sn=/^(?:input|select|textarea|keygen)/i;pe.param=function(e,t){var n,r=[],i=function(e,t){t=pe.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=pe.ajaxSettings&&pe.ajaxSettings.traditional),pe.isArray(e)||e.jquery&&!pe.isPlainObject(e))pe.each(e,function(){i(this.name,this.value)});else for(n in e)Q(n,e[n],t,i);return r.join("&").replace(nn,"+")},pe.fn.extend({serialize:function(){return pe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pe.prop(this,"elements");return e?pe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pe(this).is(":disabled")&&sn.test(this.nodeName)&&!an.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=pe(this).val();return null==n?null:pe.isArray(n)?pe.map(n,function(e){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),pe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return this.isLocal?ee():re.documentMode>8?Z():/^(get|post|head|put|delete|options)$/i.test(this.type)&&Z()||ee()}:Z;var un=0,ln={},cn=pe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in ln)ln[e](void 0,!0)}),fe.cors=!!cn&&"withCredentials"in cn,cn=fe.ajax=!!cn,cn&&pe.ajaxTransport(function(t){if(!t.crossDomain||fe.cors){var n;return{send:function(r,i){var o,a=t.xhr(),s=++un;if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)a[o]=t.xhrFields[o];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)void 0!==r[o]&&a.setRequestHeader(o,r[o]+"");a.send(t.hasContent&&t.data||null),n=function(e,r){var o,u,l;if(n&&(r||4===a.readyState))if(delete ln[s],n=void 0,a.onreadystatechange=pe.noop,r)4!==a.readyState&&a.abort();else{l={},o=a.status,"string"==typeof a.responseText&&(l.text=a.responseText);try{u=a.statusText}catch(c){u=""}o||!t.isLocal||t.crossDomain?1223===o&&(o=204):o=l.text?200:404}l&&i(o,u,l,a.getAllResponseHeaders())},t.async?4===a.readyState?e.setTimeout(n):a.onreadystatechange=ln[s]=n:n()},abort:function(){n&&n(void 0,!0)}}}}),pe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return pe.globalEval(e),e}}}),pe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=re.head||pe("head")[0]||re.documentElement;return{send:function(r,i){t=re.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||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var fn=[],dn=/(=)\?(?=&|$)|\?\?/;pe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=fn.pop()||pe.expando+"_"+Wt++;return this[e]=!0,e}}),pe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=pe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pe.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?pe(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,fn.push(i)),a&&pe.isFunction(o)&&o(a[0]),a=o=void 0}),"script"}),pe.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||re;var r=Te.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=y([e],t,i),i&&i.length&&pe(i).remove(),pe.merge([],r.childNodes))};var pn=pe.fn.load;return pe.fn.load=function(e,t,n){if("string"!=typeof e&&pn)return pn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=pe.trim(e.slice(s,e.length)),e=e.slice(0,s)),pe.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&pe.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?pe("
    ").append(pe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},pe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pe.fn[t]=function(e){return this.on(t,e)}}),pe.expr.filters.animated=function(e){return pe.grep(pe.timers,function(t){return e===t.elem}).length},pe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=pe.css(e,"position"),f=pe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=pe.css(e,"top"),u=pe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&pe.inArray("auto",[o,u])>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),pe.isFunction(t)&&(t=t.call(e,n,pe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},pe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){pe.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,pe.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=te(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pe.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pe.nodeName(e[0],"html")||(n=e.offset()),n.top+=pe.css(e[0],"borderTopWidth",!0),n.left+=pe.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pe.css(r,"marginTop",!0),left:t.left-n.left-pe.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){ +for(var e=this.offsetParent;e&&!pe.nodeName(e,"html")&&"static"===pe.css(e,"position");)e=e.offsetParent;return e||pt})}}),pe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);pe.fn[e]=function(r){return Pe(this,function(e,r,i){var o=te(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?pe(o).scrollLeft():i,n?i:pe(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),pe.each(["top","left"],function(e,t){pe.cssHooks[t]=L(fe.pixelPosition,function(e,n){if(n)return n=gt(e,t),ft.test(n)?pe(e).position()[t]+"px":n})}),pe.each({Height:"height",Width:"width"},function(e,t){pe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){pe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Pe(this,function(t,n,r){var i;return pe.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?pe.css(t,n,a):pe.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),pe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),pe.fn.size=function(){return this.length},pe.fn.andSelf=pe.fn.addBack,layui.define(function(e){layui.$=pe,e("jquery",pe)}),pe}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/laydate.js b/admin/static/layui/layui/lay/modules/laydate.js new file mode 100644 index 0000000..c84a2d6 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/laydate.js @@ -0,0 +1,221 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ ; +! function() { "use strict"; var e = window.layui && layui.define, + t = { getPath: function() { var e = document.currentScript ? document.currentScript.src : function() { for (var e, t = document.scripts, n = t.length - 1, a = n; a > 0; a--) + if ("interactive" === t[a].readyState) { e = t[a].src; break } + return e || t[n].src }(); return e.substring(0, e.lastIndexOf("/") + 1) }(), getStyle: function(e, t) { var n = e.currentStyle ? e.currentStyle : window.getComputedStyle(e, null); return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](t) }, link: function(e, a, i) { if (n.path) { var r = document.getElementsByTagName("head")[0], + o = document.createElement("link"); "string" == typeof a && (i = a); var s = (i || e).replace(/\.|\//g, ""), + l = "layuicss-" + s, + d = 0; + o.rel = "stylesheet", o.href = n.path + e, o.id = l, document.getElementById(l) || r.appendChild(o), "function" == typeof a && ! function c() { return ++d > 80 ? window.console && console.error("laydate.css: Invalid") : void(1989 === parseInt(t.getStyle(document.getElementById(l), "width")) ? a() : setTimeout(c, 100)) }() } } }, + n = { v: "5.0.9", config: {}, index: window.laydate && window.laydate.v ? 1e5 : 0, path: t.getPath, set: function(e) { var t = this; return t.config = w.extend({}, t.config, e), t }, ready: function(a) { var i = "laydate", + r = "", + o = (e ? "modules/laydate/" : "theme/") + "default/laydate.css?v=" + n.v + r; return e ? layui.addcss(o, a, i) : t.link(o, a, i), this } }, + a = function() { var e = this; return { hint: function(t) { e.hint.call(e, t) }, config: e.config } }, + i = "laydate", + r = ".layui-laydate", + o = "layui-this", + s = "laydate-disabled", + l = "开始日期超出了结束日期
    建议重新选择", + d = [100, 2e5], + c = "layui-laydate-static", + m = "layui-laydate-list", + u = "laydate-selected", + h = "layui-laydate-hint", + y = "laydate-day-prev", + f = "laydate-day-next", + p = "layui-laydate-footer", + g = ".laydate-btns-confirm", + v = "laydate-time-text", + D = ".laydate-btns-time", + T = function(e) { var t = this; + t.index = ++n.index, t.config = w.extend({}, t.config, n.config, e), n.ready(function() { t.init() }) }, + w = function(e) { return new C(e) }, + C = function(e) { for (var t = 0, n = "object" == typeof e ? [e] : (this.selector = e, document.querySelectorAll(e || null)); t < n.length; t++) this.push(n[t]) }; + C.prototype = [], C.prototype.constructor = C, w.extend = function() { var e = 1, + t = arguments, + n = function(e, t) { e = e || (t.constructor === Array ? [] : {}); for (var a in t) e[a] = t[a] && t[a].constructor === Object ? n(e[a], t[a]) : t[a]; return e }; for (t[0] = "object" == typeof t[0] ? t[0] : {}; e < t.length; e++) "object" == typeof t[e] && n(t[0], t[e]); return t[0] }, w.ie = function() { var e = navigator.userAgent.toLowerCase(); return !!(window.ActiveXObject || "ActiveXObject" in window) && ((e.match(/msie\s(\d+)/) || [])[1] || "11") }(), w.stope = function(e) { e = e || window.event, e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0 }, w.each = function(e, t) { var n, a = this; if ("function" != typeof t) return a; if (e = e || [], e.constructor === Object) { for (n in e) + if (t.call(e[n], n, e[n])) break } else + for (n = 0; n < e.length && !t.call(e[n], n, e[n]); n++); return a }, w.digit = function(e, t, n) { var a = ""; + e = String(e), t = t || 2; for (var i = e.length; i < t; i++) a += "0"; return e < Math.pow(10, t) ? a + (0 | e) : e }, w.elem = function(e, t) { var n = document.createElement(e); return w.each(t || {}, function(e, t) { n.setAttribute(e, t) }), n }, C.addStr = function(e, t) { return e = e.replace(/\s+/, " "), t = t.replace(/\s+/, " ").split(" "), w.each(t, function(t, n) { new RegExp("\\b" + n + "\\b").test(e) || (e = e + " " + n) }), e.replace(/^\s|\s$/, "") }, C.removeStr = function(e, t) { return e = e.replace(/\s+/, " "), t = t.replace(/\s+/, " ").split(" "), w.each(t, function(t, n) { var a = new RegExp("\\b" + n + "\\b"); + a.test(e) && (e = e.replace(a, "")) }), e.replace(/\s+/, " ").replace(/^\s|\s$/, "") }, C.prototype.find = function(e) { var t = this, + n = 0, + a = [], + i = "object" == typeof e; return this.each(function(r, o) { for (var s = i ? [e] : o.querySelectorAll(e || null); n < s.length; n++) a.push(s[n]); + t.shift() }), i || (t.selector = (t.selector ? t.selector + " " : "") + e), w.each(a, function(e, n) { t.push(n) }), t }, C.prototype.each = function(e) { return w.each.call(this, this, e) }, C.prototype.addClass = function(e, t) { return this.each(function(n, a) { a.className = C[t ? "removeStr" : "addStr"](a.className, e) }) }, C.prototype.removeClass = function(e) { return this.addClass(e, !0) }, C.prototype.hasClass = function(e) { var t = !1; return this.each(function(n, a) { new RegExp("\\b" + e + "\\b").test(a.className) && (t = !0) }), t }, C.prototype.attr = function(e, t) { var n = this; return void 0 === t ? function() { if (n.length > 0) return n[0].getAttribute(e) }() : n.each(function(n, a) { a.setAttribute(e, t) }) }, C.prototype.removeAttr = function(e) { return this.each(function(t, n) { n.removeAttribute(e) }) }, C.prototype.html = function(e) { return this.each(function(t, n) { n.innerHTML = e }) }, C.prototype.val = function(e) { return this.each(function(t, n) { n.value = e }) }, C.prototype.append = function(e) { return this.each(function(t, n) { "object" == typeof e ? n.appendChild(e) : n.innerHTML = n.innerHTML + e }) }, C.prototype.remove = function(e) { return this.each(function(t, n) { e ? n.removeChild(e) : n.parentNode.removeChild(n) }) }, C.prototype.on = function(e, t) { return this.each(function(n, a) { a.attachEvent ? a.attachEvent("on" + e, function(e) { e.target = e.srcElement, t.call(a, e) }) : a.addEventListener(e, t, !1) }) }, C.prototype.off = function(e, t) { return this.each(function(n, a) { a.detachEvent ? a.detachEvent("on" + e, t) : a.removeEventListener(e, t, !1) }) }, T.isLeapYear = function(e) { return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0 }, T.prototype.config = { type: "date", range: !1, format: "yyyy-MM-dd", value: null, isInitValue: !1, min: "1900-1-1", max: "2099-12-31", trigger: "focus", show: !1, showBottom: !0, btns: ["clear", "now", "confirm"], lang: "cn", theme: "default", position: null, calendar: !1, mark: {}, zIndex: null, done: null, change: null }, T.prototype.lang = function() { var e = this, + t = e.config, + n = { cn: { weeks: ["日", "一", "二", "三", "四", "五", "六"], time: ["时", "分", "秒"], timeTips: "选择时间", startTime: "开始时间", endTime: "结束时间", dateTips: "返回日期", month: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"], tools: { confirm: "确定", clear: "清空", now: "现在" } }, en: { weeks: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], time: ["Hours", "Minutes", "Seconds"], timeTips: "Select Time", startTime: "Start Time", endTime: "End Time", dateTips: "Select Date", month: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], tools: { confirm: "Confirm", clear: "Clear", now: "Now" } } }; return n[t.lang] || n.cn }, T.prototype.init = function() { var e = this, + t = e.config, + n = "yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s", + a = "static" === t.position, + i = { year: "yyyy", month: "yyyy-MM", date: "yyyy-MM-dd", time: "HH:mm:ss", datetime: "yyyy-MM-dd HH:mm:ss" }; + t.elem = w(t.elem), t.eventElem = w(t.eventElem), t.elem[0] && (t.range === !0 && (t.range = "-"), t.format === i.date && (t.format = i[t.type]), e.format = t.format.match(new RegExp(n + "|.", "g")) || [], e.EXP_IF = "", e.EXP_SPLIT = "", w.each(e.format, function(t, a) { var i = new RegExp(n).test(a) ? "\\d{" + function() { return new RegExp(n).test(e.format[0 === t ? t + 1 : t - 1] || "") ? /^yyyy|y$/.test(a) ? 4 : a.length : /^yyyy$/.test(a) ? "1,4" : /^y$/.test(a) ? "1,308" : "1,2" }() + "}" : "\\" + a; + e.EXP_IF = e.EXP_IF + i, e.EXP_SPLIT = e.EXP_SPLIT + "(" + i + ")" }), e.EXP_IF = new RegExp("^" + (t.range ? e.EXP_IF + "\\s\\" + t.range + "\\s" + e.EXP_IF : e.EXP_IF) + "$"), e.EXP_SPLIT = new RegExp("^" + e.EXP_SPLIT + "$", ""), e.isInput(t.elem[0]) || "focus" === t.trigger && (t.trigger = "click"), t.elem.attr("lay-key") || (t.elem.attr("lay-key", e.index), t.eventElem.attr("lay-key", e.index)), t.mark = w.extend({}, t.calendar && "cn" === t.lang ? { "0-1-1": "元旦", "0-2-14": "情人", "0-3-8": "妇女", "0-3-12": "植树", "0-4-1": "愚人", "0-5-1": "劳动", "0-5-4": "青年", "0-6-1": "儿童", "0-9-10": "教师", "0-9-18": "国耻", "0-10-1": "国庆", "0-12-25": "圣诞" } : {}, t.mark), w.each(["min", "max"], function(e, n) { var a = [], + i = []; if ("number" == typeof t[n]) { var r = t[n], + o = (new Date).getTime(), + s = 864e5, + l = new Date(r ? r < s ? o + r * s : r : o); + a = [l.getFullYear(), l.getMonth() + 1, l.getDate()], r < s || (i = [l.getHours(), l.getMinutes(), l.getSeconds()]) } else a = (t[n].match(/\d+-\d+-\d+/) || [""])[0].split("-"), i = (t[n].match(/\d+:\d+:\d+/) || [""])[0].split(":"); + t[n] = { year: 0 | a[0] || (new Date).getFullYear(), month: a[1] ? (0 | a[1]) - 1 : (new Date).getMonth(), date: 0 | a[2] || (new Date).getDate(), hours: 0 | i[0], minutes: 0 | i[1], seconds: 0 | i[2] } }), e.elemID = "layui-laydate" + t.elem.attr("lay-key"), (t.show || a) && e.render(), a || e.events(), t.value && t.isInitValue && (t.value.constructor === Date ? e.setValue(e.parse(0, e.systemDate(t.value))) : e.setValue(t.value))) }, T.prototype.render = function() { var e = this, + t = e.config, + n = e.lang(), + a = "static" === t.position, + i = e.elem = w.elem("div", { id: e.elemID, "class": ["layui-laydate", t.range ? " layui-laydate-range" : "", a ? " " + c : "", t.theme && "default" !== t.theme && !/^#/.test(t.theme) ? " laydate-theme-" + t.theme : ""].join("") }), + r = e.elemMain = [], + o = e.elemHeader = [], + s = e.elemCont = [], + l = e.table = [], + d = e.footer = w.elem("div", { "class": p }); if (t.zIndex && (i.style.zIndex = t.zIndex), w.each(new Array(2), function(e) { if (!t.range && e > 0) return !0; var a = w.elem("div", { "class": "layui-laydate-header" }), + i = [function() { var e = w.elem("i", { "class": "layui-icon laydate-icon laydate-prev-y" }); return e.innerHTML = "", e }(), function() { var e = w.elem("i", { "class": "layui-icon laydate-icon laydate-prev-m" }); return e.innerHTML = "", e }(), function() { var e = w.elem("div", { "class": "laydate-set-ym" }), + t = w.elem("span"), + n = w.elem("span"); return e.appendChild(t), e.appendChild(n), e }(), function() { var e = w.elem("i", { "class": "layui-icon laydate-icon laydate-next-m" }); return e.innerHTML = "", e }(), function() { var e = w.elem("i", { "class": "layui-icon laydate-icon laydate-next-y" }); return e.innerHTML = "", e }()], + d = w.elem("div", { "class": "layui-laydate-content" }), + c = w.elem("table"), + m = w.elem("thead"), + u = w.elem("tr"); + w.each(i, function(e, t) { a.appendChild(t) }), m.appendChild(u), w.each(new Array(6), function(e) { var t = c.insertRow(0); + w.each(new Array(7), function(a) { if (0 === e) { var i = w.elem("th"); + i.innerHTML = n.weeks[a], u.appendChild(i) } + t.insertCell(a) }) }), c.insertBefore(m, c.children[0]), d.appendChild(c), r[e] = w.elem("div", { "class": "layui-laydate-main laydate-main-list-" + e }), r[e].appendChild(a), r[e].appendChild(d), o.push(i), s.push(d), l.push(c) }), w(d).html(function() { var e = [], + i = []; return "datetime" === t.type && e.push('' + n.timeTips + ""), w.each(t.btns, function(e, r) { var o = n.tools[r] || "btn"; + t.range && "now" === r || (a && "clear" === r && (o = "cn" === t.lang ? "重置" : "Reset"), i.push('' + o + "")) }), e.push('"), e.join("") }()), w.each(r, function(e, t) { i.appendChild(t) }), t.showBottom && i.appendChild(d), /^#/.test(t.theme)) { var m = w.elem("style"), + u = ["#{{id}} .layui-laydate-header{background-color:{{theme}};}", "#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g, e.elemID).replace(/{{theme}}/g, t.theme); "styleSheet" in m ? (m.setAttribute("type", "text/css"), m.styleSheet.cssText = u) : m.innerHTML = u, w(i).addClass("laydate-theme-molv"), i.appendChild(m) } + e.remove(T.thisElemDate), a ? t.elem.append(i) : (document.body.appendChild(i), e.position()), e.checkDate().calendar(), e.changeEvent(), T.thisElemDate = e.elemID, "function" == typeof t.ready && t.ready(w.extend({}, t.dateTime, { month: t.dateTime.month + 1 })) }, T.prototype.remove = function(e) { var t = this, + n = (t.config, w("#" + (e || t.elemID))); return n.hasClass(c) || t.checkDate(function() { n.remove() }), t }, T.prototype.position = function() { var e = this, + t = e.config, + n = e.bindElem || t.elem[0], + a = n.getBoundingClientRect(), + i = e.elem.offsetWidth, + r = e.elem.offsetHeight, + o = function(e) { return e = e ? "scrollLeft" : "scrollTop", document.body[e] | document.documentElement[e] }, + s = function(e) { return document.documentElement[e ? "clientWidth" : "clientHeight"] }, + l = 5, + d = a.left, + c = a.bottom; + d + i + l > s("width") && (d = s("width") - i - l), c + r + l > s() && (c = a.top > r ? a.top - r : s() - r, c -= 2 * l), t.position && (e.elem.style.position = t.position), e.elem.style.left = d + ("fixed" === t.position ? 0 : o(1)) + "px", e.elem.style.top = c + ("fixed" === t.position ? 0 : o()) + "px" }, T.prototype.hint = function(e) { var t = this, + n = (t.config, w.elem("div", { "class": h })); + n.innerHTML = e || "", w(t.elem).find("." + h).remove(), t.elem.appendChild(n), clearTimeout(t.hinTimer), t.hinTimer = setTimeout(function() { w(t.elem).find("." + h).remove() }, 3e3) }, T.prototype.getAsYM = function(e, t, n) { return n ? t-- : t++, t < 0 && (t = 11, e--), t > 11 && (t = 0, e++), [e, t] }, T.prototype.systemDate = function(e) { var t = e || new Date; return { year: t.getFullYear(), month: t.getMonth(), date: t.getDate(), hours: e ? e.getHours() : 0, minutes: e ? e.getMinutes() : 0, seconds: e ? e.getSeconds() : 0 } }, T.prototype.checkDate = function(e) { var t, a, i = this, + r = (new Date, i.config), + o = r.dateTime = r.dateTime || i.systemDate(), + s = i.bindElem || r.elem[0], + l = (i.isInput(s) ? "val" : "html", i.isInput(s) ? s.value : "static" === r.position ? "" : s.innerHTML), + c = function(e) { e.year > d[1] && (e.year = d[1], a = !0), e.month > 11 && (e.month = 11, a = !0), e.hours > 23 && (e.hours = 0, a = !0), e.minutes > 59 && (e.minutes = 0, e.hours++, a = !0), e.seconds > 59 && (e.seconds = 0, e.minutes++, a = !0), t = n.getEndDate(e.month + 1, e.year), e.date > t && (e.date = t, a = !0) }, + m = function(e, t, n) { var o = ["startTime", "endTime"]; + t = (t.match(i.EXP_SPLIT) || []).slice(1), n = n || 0, r.range && (i[o[n]] = i[o[n]] || {}), w.each(i.format, function(s, l) { var c = parseFloat(t[s]); + t[s].length < l.length && (a = !0), /yyyy|y/.test(l) ? (c < d[0] && (c = d[0], a = !0), e.year = c) : /MM|M/.test(l) ? (c < 1 && (c = 1, a = !0), e.month = c - 1) : /dd|d/.test(l) ? (c < 1 && (c = 1, a = !0), e.date = c) : /HH|H/.test(l) ? (c < 1 && (c = 0, a = !0), e.hours = c, r.range && (i[o[n]].hours = c)) : /mm|m/.test(l) ? (c < 1 && (c = 0, a = !0), e.minutes = c, r.range && (i[o[n]].minutes = c)) : /ss|s/.test(l) && (c < 1 && (c = 0, a = !0), e.seconds = c, r.range && (i[o[n]].seconds = c)) }), c(e) }; return "limit" === e ? (c(o), i) : (l = l || r.value, "string" == typeof l && (l = l.replace(/\s+/g, " ").replace(/^\s|\s$/g, "")), i.startState && !i.endState && (delete i.startState, i.endState = !0), "string" == typeof l && l ? i.EXP_IF.test(l) ? r.range ? (l = l.split(" " + r.range + " "), i.startDate = i.startDate || i.systemDate(), i.endDate = i.endDate || i.systemDate(), r.dateTime = w.extend({}, i.startDate), w.each([i.startDate, i.endDate], function(e, t) { m(t, l[e], e) })) : m(o, l) : (i.hint("日期格式不合法
    必须遵循下述格式:
    " + (r.range ? r.format + " " + r.range + " " + r.format : r.format) + "
    已为你重置"), a = !0) : l && l.constructor === Date ? r.dateTime = i.systemDate(l) : (r.dateTime = i.systemDate(), delete i.startState, delete i.endState, delete i.startDate, delete i.endDate, delete i.startTime, delete i.endTime), c(o), a && l && i.setValue(r.range ? i.endDate ? i.parse() : "" : i.parse()), e && e(), i) }, T.prototype.mark = function(e, t) { var n, a = this, + i = a.config; return w.each(i.mark, function(e, a) { var i = e.split("-"); + i[0] != t[0] && 0 != i[0] || i[1] != t[1] && 0 != i[1] || i[2] != t[2] || (n = a || t[2]) }), n && e.html('' + n + ""), a }, T.prototype.limit = function(e, t, n, a) { var i, r = this, + o = r.config, + l = {}, + d = o[n > 41 ? "endDate" : "dateTime"], + c = w.extend({}, d, t || {}); return w.each({ now: c, min: o.min, max: o.max }, function(e, t) { l[e] = r.newDate(w.extend({ year: t.year, month: t.month, date: t.date }, function() { var e = {}; return w.each(a, function(n, a) { e[a] = t[a] }), e }())).getTime() }), i = l.now < l.min || l.now > l.max, e && e[i ? "addClass" : "removeClass"](s), i }, T.prototype.calendar = function(e) { var t, a, i, r = this, + s = r.config, + l = e || s.dateTime, + c = new Date, + m = r.lang(), + u = "date" !== s.type && "datetime" !== s.type, + h = e ? 1 : 0, + y = w(r.table[h]).find("td"), + f = w(r.elemHeader[h][2]).find("span"); if (l.year < d[0] && (l.year = d[0], r.hint("最低只能支持到公元" + d[0] + "年")), l.year > d[1] && (l.year = d[1], r.hint("最高只能支持到公元" + d[1] + "年")), r.firstDate || (r.firstDate = w.extend({}, l)), c.setFullYear(l.year, l.month, 1), t = c.getDay(), a = n.getEndDate(l.month || 12, l.year), i = n.getEndDate(l.month + 1, l.year), w.each(y, function(e, n) { var d = [l.year, l.month], + c = 0; + n = w(n), n.removeAttr("class"), e < t ? (c = a - t + e, n.addClass("laydate-day-prev"), d = r.getAsYM(l.year, l.month, "sub")) : e >= t && e < i + t ? (c = e - t, s.range || c + 1 === l.date && n.addClass(o)) : (c = e - i - t, n.addClass("laydate-day-next"), d = r.getAsYM(l.year, l.month)), d[1]++, d[2] = c + 1, n.attr("lay-ymd", d.join("-")).html(d[2]), r.mark(n, d).limit(n, { year: d[0], month: d[1] - 1, date: d[2] }, e) }), w(f[0]).attr("lay-ym", l.year + "-" + (l.month + 1)), w(f[1]).attr("lay-ym", l.year + "-" + (l.month + 1)), "cn" === s.lang ? (w(f[0]).attr("lay-type", "year").html(l.year + "年"), w(f[1]).attr("lay-type", "month").html(l.month + 1 + "月")) : (w(f[0]).attr("lay-type", "month").html(m.month[l.month]), w(f[1]).attr("lay-type", "year").html(l.year)), u && (s.range && (e ? r.endDate = r.endDate || { year: l.year + ("year" === s.type ? 1 : 0), month: l.month + ("month" === s.type ? 0 : -1) } : r.startDate = r.startDate || { year: l.year, month: l.month }, e && (r.listYM = [ + [r.startDate.year, r.startDate.month + 1], + [r.endDate.year, r.endDate.month + 1] + ], r.list(s.type, 0).list(s.type, 1), "time" === s.type ? r.setBtnStatus("时间", w.extend({}, r.systemDate(), r.startTime), w.extend({}, r.systemDate(), r.endTime)) : r.setBtnStatus(!0))), s.range || (r.listYM = [ + [l.year, l.month + 1] + ], r.list(s.type, 0))), s.range && !e) { var p = r.getAsYM(l.year, l.month); + r.calendar(w.extend({}, l, { year: p[0], month: p[1] })) } return s.range || r.limit(w(r.footer).find(g), null, 0, ["hours", "minutes", "seconds"]), s.range && e && !u && r.stampRange(), r }, T.prototype.list = function(e, t) { var n = this, + a = n.config, + i = a.dateTime, + r = n.lang(), + l = a.range && "date" !== a.type && "datetime" !== a.type, + d = w.elem("ul", { "class": m + " " + { year: "laydate-year-list", month: "laydate-month-list", time: "laydate-time-list" }[e] }), + c = n.elemHeader[t], + u = w(c[2]).find("span"), + h = n.elemCont[t || 0], + y = w(h).find("." + m)[0], + f = "cn" === a.lang, + p = f ? "年" : "", + T = n.listYM[t] || {}, + C = ["hours", "minutes", "seconds"], + x = ["startTime", "endTime"][t]; if (T[0] < 1 && (T[0] = 1), "year" === e) { var M, b = M = T[0] - 7; + b < 1 && (b = M = 1), w.each(new Array(15), function(e) { var i = w.elem("li", { "lay-ym": M }), + r = { year: M }; + M == T[0] && w(i).addClass(o), i.innerHTML = M + p, d.appendChild(i), M < n.firstDate.year ? (r.month = a.min.month, r.date = a.min.date) : M >= n.firstDate.year && (r.month = a.max.month, r.date = a.max.date), n.limit(w(i), r, t), M++ }), w(u[f ? 0 : 1]).attr("lay-ym", M - 8 + "-" + T[1]).html(b + p + " - " + (M - 1 + p)) } else if ("month" === e) w.each(new Array(12), function(e) { var i = w.elem("li", { "lay-ym": e }), + s = { year: T[0], month: e }; + e + 1 == T[1] && w(i).addClass(o), i.innerHTML = r.month[e] + (f ? "月" : ""), d.appendChild(i), T[0] < n.firstDate.year ? s.date = a.min.date : T[0] >= n.firstDate.year && (s.date = a.max.date), n.limit(w(i), s, t) }), w(u[f ? 0 : 1]).attr("lay-ym", T[0] + "-" + T[1]).html(T[0] + p); + else if ("time" === e) { var E = function() { w(d).find("ol").each(function(e, a) { w(a).find("li").each(function(a, i) { n.limit(w(i), [{ hours: a }, { hours: n[x].hours, minutes: a }, { hours: n[x].hours, minutes: n[x].minutes, seconds: a }][e], t, [ + ["hours"], + ["hours", "minutes"], + ["hours", "minutes", "seconds"] + ][e]) }) }), a.range || n.limit(w(n.footer).find(g), n[x], 0, ["hours", "minutes", "seconds"]) }; + a.range ? n[x] || (n[x] = { hours: 0, minutes: 0, seconds: 0 }) : n[x] = i, w.each([24, 60, 60], function(e, t) { var a = w.elem("li"), + i = ["

    " + r.time[e] + "

      "]; + w.each(new Array(t), function(t) { i.push("" + w.digit(t, 2) + "") }), a.innerHTML = i.join("") + "
    ", d.appendChild(a) }), E() } if (y && h.removeChild(y), h.appendChild(d), "year" === e || "month" === e) w(n.elemMain[t]).addClass("laydate-ym-show"), w(d).find("li").on("click", function() { var r = 0 | w(this).attr("lay-ym"); if (!w(this).hasClass(s)) { if (0 === t) i[e] = r, l && (n.startDate[e] = r), n.limit(w(n.footer).find(g), null, 0); + else if (l) n.endDate[e] = r; + else { var c = "year" === e ? n.getAsYM(r, T[1] - 1, "sub") : n.getAsYM(T[0], r, "sub"); + w.extend(i, { year: c[0], month: c[1] }) } "year" === a.type || "month" === a.type ? (w(d).find("." + o).removeClass(o), w(this).addClass(o), "month" === a.type && "year" === e && (n.listYM[t][0] = r, l && (n[["startDate", "endDate"][t]].year = r), n.list("month", t))) : (n.checkDate("limit").calendar(), n.closeList()), n.setBtnStatus(), a.range || n.done(null, "change"), w(n.footer).find(D).removeClass(s) } }); + else { var S = w.elem("span", { "class": v }), + k = function() { w(d).find("ol").each(function(e) { var t = this, + a = w(t).find("li"); + t.scrollTop = 30 * (n[x][C[e]] - 2), t.scrollTop <= 0 && a.each(function(e, n) { if (!w(this).hasClass(s)) return t.scrollTop = 30 * (e - 2), !0 }) }) }, + H = w(c[2]).find("." + v); + k(), S.innerHTML = a.range ? [r.startTime, r.endTime][t] : r.timeTips, w(n.elemMain[t]).addClass("laydate-time-show"), H[0] && H.remove(), c[2].appendChild(S), w(d).find("ol").each(function(e) { var t = this; + w(t).find("li").on("click", function() { var r = 0 | this.innerHTML; + w(this).hasClass(s) || (a.range ? n[x][C[e]] = r : i[C[e]] = r, w(t).find("." + o).removeClass(o), w(this).addClass(o), E(), k(), (n.endDate || "time" === a.type) && n.done(null, "change"), n.setBtnStatus()) }) }) } return n }, T.prototype.listYM = [], T.prototype.closeList = function() { var e = this; + e.config; + w.each(e.elemCont, function(t, n) { w(this).find("." + m).remove(), w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show") }), w(e.elem).find("." + v).remove() }, T.prototype.setBtnStatus = function(e, t, n) { var a, i = this, + r = i.config, + o = w(i.footer).find(g), + d = r.range && "date" !== r.type && "time" !== r.type; + d && (t = t || i.startDate, n = n || i.endDate, a = i.newDate(t).getTime() > i.newDate(n).getTime(), i.limit(null, t) || i.limit(null, n) ? o.addClass(s) : o[a ? "addClass" : "removeClass"](s), e && a && i.hint("string" == typeof e ? l.replace(/日期/g, e) : l)) }, T.prototype.parse = function(e, t) { var n = this, + a = n.config, + i = t || (e ? w.extend({}, n.endDate, n.endTime) : a.range ? w.extend({}, n.startDate, n.startTime) : a.dateTime), + r = n.format.concat(); return w.each(r, function(e, t) { /yyyy|y/.test(t) ? r[e] = w.digit(i.year, t.length) : /MM|M/.test(t) ? r[e] = w.digit(i.month + 1, t.length) : /dd|d/.test(t) ? r[e] = w.digit(i.date, t.length) : /HH|H/.test(t) ? r[e] = w.digit(i.hours, t.length) : /mm|m/.test(t) ? r[e] = w.digit(i.minutes, t.length) : /ss|s/.test(t) && (r[e] = w.digit(i.seconds, t.length)) }), a.range && !e ? r.join("") + " " + a.range + " " + n.parse(1) : r.join("") }, T.prototype.newDate = function(e) { return e = e || {}, new Date(e.year || 1, e.month || 0, e.date || 1, e.hours || 0, e.minutes || 0, e.seconds || 0) }, T.prototype.setValue = function(e) { var t = this, + n = t.config, + a = t.bindElem || n.elem[0], + i = t.isInput(a) ? "val" : "html"; return "static" === n.position || w(a)[i](e || ""), this }, T.prototype.stampRange = function() { var e, t, n = this, + a = n.config, + i = w(n.elem).find("td"); if (a.range && !n.endDate && w(n.footer).find(g).addClass(s), n.endDate) return e = n.newDate({ year: n.startDate.year, month: n.startDate.month, date: n.startDate.date }).getTime(), t = n.newDate({ year: n.endDate.year, month: n.endDate.month, date: n.endDate.date }).getTime(), e > t ? n.hint(l) : void w.each(i, function(a, i) { var r = w(i).attr("lay-ymd").split("-"), + s = n.newDate({ year: r[0], month: r[1] - 1, date: r[2] }).getTime(); + w(i).removeClass(u + " " + o), s !== e && s !== t || w(i).addClass(w(i).hasClass(y) || w(i).hasClass(f) ? u : o), s > e && s < t && w(i).addClass(u) }) }, T.prototype.done = function(e, t) { var n = this, + a = n.config, + i = w.extend({}, n.startDate ? w.extend(n.startDate, n.startTime) : a.dateTime), + r = w.extend({}, w.extend(n.endDate, n.endTime)); return w.each([i, r], function(e, t) { "month" in t && w.extend(t, { month: t.month + 1 }) }), e = e || [n.parse(), i, r], "function" == typeof a[t || "done"] && a[t || "done"].apply(a, e), n }, T.prototype.choose = function(e) { var t = this, + n = t.config, + a = n.dateTime, + i = w(t.elem).find("td"), + r = e.attr("lay-ymd").split("-"), + l = function(e) { new Date; + e && w.extend(a, r), n.range && (t.startDate ? w.extend(t.startDate, r) : t.startDate = w.extend({}, r, t.startTime), t.startYMD = r) }; if (r = { year: 0 | r[0], month: (0 | r[1]) - 1, date: 0 | r[2] }, !e.hasClass(s)) + if (n.range) { if (w.each(["startTime", "endTime"], function(e, n) { t[n] = t[n] || { hours: 0, minutes: 0, seconds: 0 } }), t.endState) l(), delete t.endState, delete t.endDate, t.startState = !0, i.removeClass(o + " " + u), e.addClass(o); + else if (t.startState) { if (e.addClass(o), t.endDate ? w.extend(t.endDate, r) : t.endDate = w.extend({}, r, t.endTime), t.newDate(r).getTime() < t.newDate(t.startYMD).getTime()) { var d = w.extend({}, t.endDate, { hours: t.startDate.hours, minutes: t.startDate.minutes, seconds: t.startDate.seconds }); + w.extend(t.endDate, t.startDate, { hours: t.endDate.hours, minutes: t.endDate.minutes, seconds: t.endDate.seconds }), t.startDate = d } + n.showBottom || t.done(), t.stampRange(), t.endState = !0, t.done(null, "change") } else e.addClass(o), l(), t.startState = !0; + w(t.footer).find(g)[t.endDate ? "removeClass" : "addClass"](s) } else "static" === n.position ? (l(!0), t.calendar().done().done(null, "change")) : "date" === n.type ? (l(!0), t.setValue(t.parse()).remove().done()) : "datetime" === n.type && (l(!0), t.calendar().done(null, "change")) }, T.prototype.tool = function(e, t) { var n = this, + a = n.config, + i = a.dateTime, + r = "static" === a.position, + o = { datetime: function() { w(e).hasClass(s) || (n.list("time", 0), a.range && n.list("time", 1), w(e).attr("lay-type", "date").html(n.lang().dateTips)) }, date: function() { n.closeList(), w(e).attr("lay-type", "datetime").html(n.lang().timeTips) }, clear: function() { n.setValue("").remove(), r && (w.extend(i, n.firstDate), n.calendar()), a.range && (delete n.startState, delete n.endState, delete n.endDate, delete n.startTime, delete n.endTime), n.done(["", {}, {}]) }, now: function() { var e = new Date; + w.extend(i, n.systemDate(), { hours: e.getHours(), minutes: e.getMinutes(), seconds: e.getSeconds() }), n.setValue(n.parse()).remove(), r && n.calendar(), n.done() }, confirm: function() { if (a.range) { if (!n.endDate) return n.hint("请先选择日期范围"); if (w(e).hasClass(s)) return n.hint("time" === a.type ? l.replace(/日期/g, "时间") : l) } else if (w(e).hasClass(s)) return n.hint("不在有效日期或时间范围内"); + n.done(), n.setValue(n.parse()).remove() } }; + o[t] && o[t]() }, T.prototype.change = function(e) { var t = this, + n = t.config, + a = n.dateTime, + i = n.range && ("year" === n.type || "month" === n.type), + r = t.elemCont[e || 0], + o = t.listYM[e], + s = function(s) { var l = ["startDate", "endDate"][e], + d = w(r).find(".laydate-year-list")[0], + c = w(r).find(".laydate-month-list")[0]; return d && (o[0] = s ? o[0] - 15 : o[0] + 15, t.list("year", e)), c && (s ? o[0]-- : o[0]++, t.list("month", e)), (d || c) && (w.extend(a, { year: o[0] }), i && (t[l].year = o[0]), n.range || t.done(null, "change"), t.setBtnStatus(), n.range || t.limit(w(t.footer).find(g), { year: o[0] })), d || c }; return { prevYear: function() { s("sub") || (a.year--, t.checkDate("limit").calendar(), n.range || t.done(null, "change")) }, prevMonth: function() { var e = t.getAsYM(a.year, a.month, "sub"); + w.extend(a, { year: e[0], month: e[1] }), t.checkDate("limit").calendar(), n.range || t.done(null, "change") }, nextMonth: function() { var e = t.getAsYM(a.year, a.month); + w.extend(a, { year: e[0], month: e[1] }), t.checkDate("limit").calendar(), n.range || t.done(null, "change") }, nextYear: function() { s() || (a.year++, t.checkDate("limit").calendar(), n.range || t.done(null, "change")) } } }, T.prototype.changeEvent = function() { var e = this; + e.config; + w(e.elem).on("click", function(e) { w.stope(e) }), w.each(e.elemHeader, function(t, n) { w(n[0]).on("click", function(n) { e.change(t).prevYear() }), w(n[1]).on("click", function(n) { e.change(t).prevMonth() }), w(n[2]).find("span").on("click", function(n) { var a = w(this), + i = a.attr("lay-ym"), + r = a.attr("lay-type"); + i && (i = i.split("-"), e.listYM[t] = [0 | i[0], 0 | i[1]], e.list(r, t), w(e.footer).find(D).addClass(s)) }), w(n[3]).on("click", function(n) { e.change(t).nextMonth() }), w(n[4]).on("click", function(n) { e.change(t).nextYear() }) }), w.each(e.table, function(t, n) { var a = w(n).find("td"); + a.on("click", function() { e.choose(w(this)) }) }), w(e.footer).find("span").on("click", function() { var t = w(this).attr("lay-type"); + e.tool(this, t) }) }, T.prototype.isInput = function(e) { return /input|textarea/.test(e.tagName.toLocaleLowerCase()) }, T.prototype.events = function() { var e = this, + t = e.config, + n = function(n, a) { n.on(t.trigger, function() { a && (e.bindElem = this), e.render() }) }; + t.elem[0] && !t.elem[0].eventHandler && (n(t.elem, "bind"), n(t.eventElem), w(document).on("click", function(n) { n.target !== t.elem[0] && n.target !== t.eventElem[0] && n.target !== w(t.closeStop)[0] && e.remove() }).on("keydown", function(t) { 13 === t.keyCode && w("#" + e.elemID)[0] && e.elemID === T.thisElem && (t.preventDefault(), w(e.footer).find(g)[0].click()) }), w(window).on("resize", function() { return !(!e.elem || !w(r)[0]) && void e.position() }), t.elem[0].eventHandler = !0) }, n.render = function(e) { var t = new T(e); return a.call(t) }, n.getEndDate = function(e, t) { var n = new Date; return n.setFullYear(t || n.getFullYear(), e || n.getMonth() + 1, 1), new Date(n.getTime() - 864e5).getDate() }, window.lay = window.lay || w, e ? (n.ready(), layui.define(function(e) { n.path = layui.cache.dir, e(i, n) })) : "function" == typeof define && define.amd ? define(function() { return n }) : function() { n.ready(), window.laydate = n }() }(); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/layedit.js b/admin/static/layui/layui/lay/modules/layedit.js new file mode 100644 index 0000000..48fc9de --- /dev/null +++ b/admin/static/layui/layui/lay/modules/layedit.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
    ','
    '+f+"
    ",'
    ','',"
    ","
    "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

    ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

    "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

    "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

      ','
    • ','','
      ','',"
      ","
    • ",'
    • ','','
      ','",'","
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
  • '+e+'
  • ')}),'
      '+t.join("")+"
    "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
      ','
    • ','','
      ','","
      ","
    • ",'
    • ','','
      ','',"
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/layer.js b/admin/static/layui/layui/lay/modules/layer.js new file mode 100644 index 0000000..965db92 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/layer.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
    '+(f?r.title[0]:r.title)+"
    ":"";return r.zIndex=s,t([r.shade?'
    ':"",'
    '+(e&&2!=r.type?"":u)+'
    '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
    '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
    '+e+"
    "}():"")+(r.resize?'':"")+"
    "],u,i('
    ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
      '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
    • '+(t[0].content||"no content")+"
    • ";i'+(t[i].content||"no content")+"";return a}()+"
    ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
    '+(u.length>1?'':"")+'
    '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
    ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
    是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/laypage.js b/admin/static/layui/layui/lay/modules/laypage.js new file mode 100644 index 0000000..cc74fe1 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/laypage.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
    ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
    "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/laytpl.js b/admin/static/layui/layui/lay/modules/laytpl.js new file mode 100644 index 0000000..eeb1bba --- /dev/null +++ b/admin/static/layui/layui/lay/modules/laytpl.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/mobile.js b/admin/static/layui/layui/lay/modules/mobile.js new file mode 100644 index 0000000..3aaf34d --- /dev/null +++ b/admin/static/layui/layui/lay/modules/mobile.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define(function(i){i("layui.mobile",layui.v)});layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var t=(window,document),i="querySelectorAll",n="getElementsByClassName",a=function(e){return t[i](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var i in e)t[i]=e[i];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var o=0,r=["layui-m-layer"],d=function(e){var t=this;t.config=l.extend(e),t.view()};d.prototype.view=function(){var e=this,i=e.config,s=t.createElement("div");e.id=s.id=r[0]+o,s.setAttribute("class",r[0]+" "+r[0]+(i.type||0)),s.setAttribute("index",o);var l=function(){var e="object"==typeof i.title;return i.title?'

    '+(e?i.title[0]:i.title)+"

    ":""}(),d=function(){"string"==typeof i.btn&&(i.btn=[i.btn]);var e,t=(i.btn||[]).length;return 0!==t&&i.btn?(e=''+i.btn[0]+"",2===t&&(e=''+i.btn[1]+""+e),'
    '+e+"
    "):""}();if(i.fixed||(i.top=i.hasOwnProperty("top")?i.top:100,i.style=i.style||"",i.style+=" top:"+(t.body.scrollTop+i.top)+"px"),2===i.type&&(i.content='

    '+(i.content||"")+"

    "),i.skin&&(i.anim="up"),"msg"===i.skin&&(i.shade=!1),s.innerHTML=(i.shade?"
    ':"")+'
    "+l+'
    '+i.content+"
    "+d+"
    ",!i.type||2===i.type){var y=t[n](r[0]+i.type),u=y.length;u>=1&&c.close(y[0].getAttribute("index"))}document.body.appendChild(s);var m=e.elem=a("#"+e.id)[0];i.success&&i.success(m),e.index=o++,e.action(i,m)},d.prototype.action=function(e,t){var i=this;e.time&&(l.timer[i.index]=setTimeout(function(){c.close(i.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),c.close(i.index)):e.yes?e.yes(i.index):c.close(i.index)};if(e.btn)for(var s=t[n]("layui-m-layerbtn")[0].children,o=s.length,r=0;r0&&e-1 in t)}function s(t){return A.call(t,function(t){return null!=t})}function u(t){return t.length>0?T.fn.concat.apply([],t):t}function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||k[c(t)]?e:e+"px"}function h(t){var e,n;return $[t]||(e=L.createElement(t),L.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),$[t]=n),$[t]}function p(t){return"children"in t?D.call(t.children):T.map(t.childNodes,function(t){if(1==t.nodeType)return t})}function d(t,e){var n,r=t?t.length:0;for(n=0;n]*>/,R=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Z=/^(?:body|html)$/i,q=/([A-Z])/g,H=["val","css","html","text","data","width","height","offset"],I=["after","prepend","before","append"],V=L.createElement("table"),_=L.createElement("tr"),B={tr:L.createElement("tbody"),tbody:V,thead:V,tfoot:V,td:_,th:_,"*":L.createElement("div")},U=/complete|loaded|interactive/,X=/^[\w-]*$/,J={},W=J.toString,Y={},G=L.createElement("div"),K={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return Y.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=G).appendChild(t),r=~Y.qsa(i,e).indexOf(t),o&&G.removeChild(t),r},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return A.call(t,function(e,n){return t.indexOf(e)==n})},Y.fragment=function(t,e,n){var r,i,a;return R.test(t)&&(r=T(L.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(z,"<$1>")),e===E&&(e=M.test(t)&&RegExp.$1),e in B||(e="*"),a=B[e],a.innerHTML=""+t,r=T.each(D.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(i=T(r),T.each(n,function(t,e){H.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},Y.Z=function(t,e){return new d(t,e)},Y.isZ=function(t){return t instanceof Y.Z},Y.init=function(t,n){var r;if(!t)return Y.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=Y.fragment(t,RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}else{if(e(t))return T(L).ready(t);if(Y.isZ(t))return t;if(Q(t))r=s(t);else if(i(t))r=[t],t=null;else if(M.test(t))r=Y.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}}return Y.Z(r,t)},T=function(t,e){return Y.init(t,e)},T.extend=function(t){var e,n=D.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){m(t,n,e)}),t},Y.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,a=X.test(o);return t.getElementById&&a&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:D.call(a&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},T.contains=L.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},T.type=t,T.isFunction=e,T.isWindow=n,T.isArray=Q,T.isPlainObject=o,T.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},T.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},T.inArray=function(t,e,n){return O.indexOf.call(e,t,n)},T.camelCase=C,T.trim=function(t){return null==t?"":String.prototype.trim.call(t)},T.uuid=0,T.support={},T.expr={},T.noop=function(){},T.map=function(t,e){var n,r,i,o=[];if(a(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return O.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):T(A.call(this,function(e){return Y.matches(e,t)}))},add:function(t,e){return T(N(this.concat(T(t,e))))},is:function(t){return this.length>0&&Y.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==E)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?D.call(t):T(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return T(n)},has:function(t){return this.filter(function(){return i(t)?T.contains(this,t):T(this).find(t).size()})},eq:function(t){return t===-1?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:T(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:T(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?T(t).filter(function(){var t=this;return O.some.call(n,function(e){return T.contains(e,t)})}):1==this.length?T(Y.qsa(this[0],t)):this.map(function(){return Y.qsa(this,t)}):T()},closest:function(t,e){var n=[],i="object"==typeof t&&T(t);return this.each(function(o,a){for(;a&&!(i?i.indexOf(a)>=0:Y.matches(a,t));)a=a!==e&&!r(a)&&a.parentNode;a&&n.indexOf(a)<0&&n.push(a)}),T(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=T.map(n,function(t){if((t=t.parentNode)&&!r(t)&&e.indexOf(t)<0)return e.push(t),t});return v(e,t)},parent:function(t){return v(N(this.pluck("parentNode")),t)},children:function(t){return v(this.map(function(){return p(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||D.call(this.childNodes)})},siblings:function(t){return v(this.map(function(t,e){return A.call(p(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return T.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=T(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){T(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){T(this[0]).before(t=T(t));for(var e;(e=t.children()).length;)t=e.first();T(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=T(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){T(this).replaceWith(T(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=T(this);(t===E?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return T(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return T(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;T(this).empty().append(g(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=g(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(j in t)y(this,j,t[j]);else y(this,t,g(this,e,n,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(n=this[0].getAttribute(t))?n:E},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){y(this,t)},this)})},prop:function(t,e){return t=K[t]||t,1 in arguments?this.each(function(n){this[t]=g(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=K[t]||t,this.each(function(){delete this[t]})},data:function(t,e){var n="data-"+t.replace(q,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?b(r):E},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=g(this,t,e,this.value)})):this[0]&&(this[0].multiple?T(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=T(this),r=g(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;if(L.documentElement!==this[0]&&!T.contains(L.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r=this[0];if("string"==typeof e){if(!r)return;return r.style[C(e)]||getComputedStyle(r,"").getPropertyValue(e)}if(Q(e)){if(!r)return;var i={},o=getComputedStyle(r,"");return T.each(e,function(t,e){i[e]=r.style[C(e)]||o.getPropertyValue(e)}),i}}var a="";if("string"==t(e))n||0===n?a=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(j in e)e[j]||0===e[j]?a+=c(j)+":"+f(j,e[j])+";":this.each(function(){this.style.removeProperty(c(j))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(T(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&O.some.call(this,function(t){return this.test(x(t))},l(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){S=[];var n=x(this),r=g(this,t,e,n);r.split(/\s+/g).forEach(function(t){T(this).hasClass(t)||S.push(t)},this),S.length&&x(this,n+(n?" ":"")+S.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===E)return x(this,"");S=x(this),g(this,t,e,S).split(/\s+/g).forEach(function(t){S=S.replace(l(t)," ")}),x(this,S.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=T(this),i=g(this,t,n,x(this));i.split(/\s+/g).forEach(function(t){(e===E?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===E?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===E?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=Z.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(T(t).css("margin-top"))||0,n.left-=parseFloat(T(t).css("margin-left"))||0,r.top+=parseFloat(T(e[0]).css("border-top-width"))||0,r.left+=parseFloat(T(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||L.body;t&&!Z.test(t.nodeName)&&"static"==T(t).css("position");)t=t.offsetParent;return t})}},T.fn.detach=T.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});T.fn[t]=function(i){var o,a=this[0];return i===E?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=T(this),a.css(t,g(this,i,e,a[t]()))})}}),I.forEach(function(e,n){var r=n%2;T.fn[e]=function(){var e,i,o=T.map(arguments,function(n){var r=[];return e=t(n),"array"==e?(n.forEach(function(t){return t.nodeType!==E?r.push(t):T.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(Y.fragment(t)))}),r):"object"==e||null==n?n:Y.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=T.contains(L.documentElement,i);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return T(t).remove();i.insertBefore(t,e),s&&w(t,function(t){if(!(null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src)){var e=t.ownerDocument?t.ownerDocument.defaultView:window;e.eval.call(e,t.innerHTML)}})})})},T.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return T(t)[e](this),this}}),Y.Z.prototype=d.prototype=T.fn,Y.uniq=N,Y.deserializeValue=b,T.zepto=Y,T}();!function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(v[e(t)]||[]).filter(function(t){return t&&(!n.e||t.e==n.e)&&(!n.ns||s.test(t.ns))&&(!o||e(t.fn)===e(o))&&(!a||t.sel==a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in x||!!e}function a(t){return b[t]||y&&x[t]||t}function s(n,i,s,u,l,h,p){var d=e(n),m=v[d]||(v[d]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var i=r(e);i.fn=s,i.sel=l,i.e in b&&(s=function(e){var n=e.relatedTarget;if(!n||n!==this&&!t.contains(this,n))return i.fn.apply(this,arguments)}),i.del=h;var d=h||s;i.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=d.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=m.length,m.push(i),"addEventListener"in n&&n.addEventListener(a(i.e),i.proxy,o(i,p))})}function u(t,r,i,s,u){var c=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,s).forEach(function(e){delete v[c][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,u))})})}function c(e,n){return!n&&e.isDefaultPrevented||(n||(n=e),t.each(T,function(t,r){var i=n[t];e[t]=function(){return this[r]=w,i&&i.apply(n,arguments)},e[r]=E}),e.timeStamp||(e.timeStamp=Date.now()),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,p=Array.prototype.slice,d=t.isFunction,m=function(t){return"string"==typeof t},v={},g={},y="onfocusin"in window,x={focus:"focusin",blur:"focusout"},b={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:s,remove:u},t.proxy=function(n,r){var i=2 in arguments&&p.call(arguments,2);if(d(n)){var o=function(){return n.apply(r,i?i.concat(p.call(arguments)):arguments)};return o._zid=e(n),o}if(m(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var w=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,T={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var a,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,r,e,o)}),h):(m(n)||d(i)||i===!1||(i=r,r=n,n=f),i!==f&&r!==!1||(i=r,r=f),i===!1&&(i=E),h.each(function(f,h){o&&(a=function(t){return u(h,t.type,i),i.apply(this,arguments)}),n&&(c=function(e){var r,o=t(e.target).closest(n,h).get(0);if(o&&o!==h)return r=t.extend(l(e),{currentTarget:o,liveFired:h}),(a||i).apply(o,[r].concat(p.call(arguments,1)))}),s(h,e,i,r,n,c||a)}))},t.fn.off=function(e,n,r){var i=this;return e&&!m(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(m(n)||d(r)||r===!1||(r=n,n=f),r===!1&&(r=E),i.each(function(){u(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){e.type in x&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(a,s){i=l(m(e)?t.Event(e):e),i._args=r,i.target=s,t.each(n(s,e.type||e),function(t,e){if(o=e.proxy(i),i.isImmediatePropagationStopped())return!1})}),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),c(n)}}(e),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){if(t.global)return e(n||x,r,i)}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)!==!1&&n(e,r,"ajaxBeforeSend",[t,e])!==!1&&void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function c(t,e,n){if(n.dataFilter==l)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function l(){}function f(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==j?"json":w.test(t)?"script":E.test(t)&&"xml")||"text"}function h(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function p(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()&&"jsonp"!=e.dataType||(e.url=h(e.url,e.data),e.data=void 0)}function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function m(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),i&&(n=r?i:i+"["+(s||"object"==o||"array"==o?n:"")+"]"),!i&&a?e.add(u.name,u.value):"array"==o||!r&&"object"==o?m(e,u,r,n):e.add(n,u)})}var v,g,y=+new Date,x=window.document,b=/)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,E=/^(?:text|application)\/xml/i,j="application/json",T="text/html",S=/^\s*$/,C=x.createElement("a");C.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"Zepto"+y++,l=x.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},p={abort:h};return n&&n.promise(p),t(l).on("load error",function(o,u){clearTimeout(i),t(l).off().remove(),"error"!=o.type&&r?a(r[0],p,e,n):s(null,u||"error",p,e,n),window[c]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),o(p,e)===!1?(h("abort"),p):(window[c]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),x.head.appendChild(l),e.timeout>0&&(i=setTimeout(function(){h("timeout")},e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:l,success:l,error:l,complete:l,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:j,xml:"application/xml, text/xml",html:T,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:l},t.ajax=function(e){var n,i,u=t.extend({},e||{}),d=t.Deferred&&t.Deferred();for(v in t.ajaxSettings)void 0===u[v]&&(u[v]=t.ajaxSettings[v]);r(u),u.crossDomain||(n=x.createElement("a"),n.href=u.url,n.href=n.href,u.crossDomain=C.protocol+"//"+C.host!=n.protocol+"//"+n.host),u.url||(u.url=window.location.toString()),(i=u.url.indexOf("#"))>-1&&(u.url=u.url.slice(0,i)),p(u);var m=u.dataType,y=/\?.+=\?/.test(u.url);if(y&&(m="jsonp"),u.cache!==!1&&(e&&e.cache===!0||"script"!=m&&"jsonp"!=m)||(u.url=h(u.url,"_="+Date.now())),"jsonp"==m)return y||(u.url=h(u.url,u.jsonp?u.jsonp+"=?":u.jsonp===!1?"":"callback=?")),t.ajaxJSONP(u,d);var b,w=u.accepts[m],E={},j=function(t,e){E[t.toLowerCase()]=[t,e]},T=/^([\w-]+:)\/\//.test(u.url)?RegExp.$1:window.location.protocol,N=u.xhr(),O=N.setRequestHeader;if(d&&d.promise(N),u.crossDomain||j("X-Requested-With","XMLHttpRequest"),j("Accept",w||"*/*"),(w=u.mimeType||w)&&(w.indexOf(",")>-1&&(w=w.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(w)),(u.contentType||u.contentType!==!1&&u.data&&"GET"!=u.type.toUpperCase())&&j("Content-Type",u.contentType||"application/x-www-form-urlencoded"),u.headers)for(g in u.headers)j(g,u.headers[g]);if(N.setRequestHeader=j,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=l,clearTimeout(b);var e,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==T){if(m=m||f(u.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)e=N.response;else{e=N.responseText;try{e=c(e,m,u),"script"==m?(0,eval)(e):"xml"==m?e=N.responseXML:"json"==m&&(e=S.test(e)?null:t.parseJSON(e))}catch(r){n=r}if(n)return s(n,"parsererror",N,u,d)}a(e,N,u,d)}else s(N.statusText||null,N.status?"error":"abort",N,u,d)}},o(N,u)===!1)return N.abort(),s(null,"abort",N,u,d),N;var P=!("async"in u)||u.async;if(N.open(u.type,u.url,P,u.username,u.password),u.xhrFields)for(g in u.xhrFields)N[g]=u.xhrFields[g];for(g in E)O.apply(N,E[g]);return u.timeout>0&&(b=setTimeout(function(){N.onreadystatechange=l,N.abort(),s(null,"timeout",N,u,d)},u.timeout)),N.send(u.data?u.data:null),N},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=d(e,n,r),u=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("
    ").html(e.replace(b,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(s),this};var N=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(e)+"="+N(n))},m(r,e,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(r){return null}}}}(),t("zepto",e)});layui.define(["layer-mobile","zepto"],function(e){"use strict";var t=layui.zepto,a=layui["layer-mobile"],i=(layui.device(),"layui-upload-enter"),n="layui-upload-iframe",r={icon:2,shift:6},o={file:"文件",video:"视频",audio:"音频"};a.msg=function(e){return a.open({content:e||"",skin:"msg",time:2})};var s=function(e){this.options=e};s.prototype.init=function(){var e=this,a=e.options,r=t("body"),s=t(a.elem||".layui-upload-file"),u=t('');return t("#"+n)[0]||r.append(u),s.each(function(r,s){s=t(s);var u='
    ',l=s.attr("lay-type")||a.type;a.unwrap||(u='
    '+u+''+(s.attr("lay-title")||a.title||"上传"+(o[l]||"图片"))+"
    "),u=t(u),a.unwrap||u.on("dragover",function(e){e.preventDefault(),t(this).addClass(i)}).on("dragleave",function(){t(this).removeClass(i)}).on("drop",function(){t(this).removeClass(i)}),s.parent("form").attr("target")===n&&(a.unwrap?s.unwrap():(s.parent().next().remove(),s.unwrap().unwrap())),s.wrap(u),s.off("change").on("change",function(){e.action(this,l)})})},s.prototype.action=function(e,i){var o=this,s=o.options,u=e.value,l=t(e),p=l.attr("lay-ext")||s.ext||"";if(u){switch(i){case"file":if(p&&!RegExp("\\w\\.("+p+")$","i").test(escape(u)))return a.msg("不支持该文件格式",r),e.value="";break;case"video":if(!RegExp("\\w\\.("+(p||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(u)))return a.msg("不支持该视频格式",r),e.value="";break;case"audio":if(!RegExp("\\w\\.("+(p||"mp3|wav|mid")+")$","i").test(escape(u)))return a.msg("不支持该音频格式",r),e.value="";break;default:if(!RegExp("\\w\\.("+(p||"jpg|png|gif|bmp|jpeg")+")$","i").test(escape(u)))return a.msg("不支持该图片格式",r),e.value=""}s.before&&s.before(e),l.parent().submit();var c=t("#"+n),f=setInterval(function(){var t;try{t=c.contents().find("body").text()}catch(i){a.msg("上传接口存在跨域",r),clearInterval(f)}if(t){clearInterval(f),c.contents().find("body").html("");try{t=JSON.parse(t)}catch(i){return t={},a.msg("请对上传接口返回JSON字符",r)}"function"==typeof s.success&&s.success(t,e)}},30);e.value=""}},e("upload-mobile",function(e){var t=new s(e=e||{});t.init()})});layui.define(function(i){i("layim-mobile",layui.v)});layui["layui.mobile"]||layui.config({base:layui.cache.dir+"lay/modules/mobile/"}).extend({"layer-mobile":"layer-mobile",zepto:"zepto","upload-mobile":"upload-mobile","layim-mobile":"layim-mobile"}),layui.define(["layer-mobile","zepto","layim-mobile"],function(l){l("mobile",{layer:layui["layer-mobile"],layim:layui["layim-mobile"]})}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/rate.js b/admin/static/layui/layui/lay/modules/rate.js new file mode 100644 index 0000000..26ecbdc --- /dev/null +++ b/admin/static/layui/layui/lay/modules/rate.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var a=layui.jquery,i={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,a){return layui.onevent.call(this,n,e,a)}},l=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",s="layui-icon-rate-solid",u="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var l=this;l.index=++i.index,l.config=a.extend({},l.config,i.config,e),l.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,i=e.config,l=i.theme?'style="color: '+i.theme+';"':"";i.elem=a(i.elem),parseInt(i.value)!==i.value&&(i.half||(i.value=Math.ceil(i.value)-i.value<.5?Math.ceil(i.value):Math.floor(i.value)));for(var n='
      ",u=1;u<=i.length;u++){var r='
    • ";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+'
    • ":n+=r}n+="
    "+(i.text?''+i.value+"星":"")+"";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/table.js b/admin/static/layui/layui/lay/modules/table.js new file mode 100644 index 0000000..1e8aa3e --- /dev/null +++ b/admin/static/layui/layui/lay/modules/table.js @@ -0,0 +1,1892 @@ +/** + + @Name:layui.table 表格操作 + @Author:贤心 + @License:MIT + + */ + +layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports) { + "use strict"; + + var $ = layui.$, + laytpl = layui.laytpl, + laypage = layui.laypage, + layer = layui.layer, + form = layui.form, + util = layui.util, + hint = layui.hint(), + device = layui.device() + + //外部接口 + , table = { + config: { + checkName: 'LAY_CHECKED' //是否选中状态的字段名 + , + indexName: 'LAY_TABLE_INDEX' //下标索引名 + } //全局配置项 + , + cache: {} //数据缓存 + , + index: layui.table ? (layui.table.index + 10000) : 0 + + //设置全局项 + , + set: function(options) { + var that = this; + that.config = $.extend({}, that.config, options); + return that; + } + + //事件监听 + , + on: function(events, callback) { + return layui.onevent.call(this, MOD_NAME, events, callback); + } + } + + //操作当前实例 + , thisTable = function() { + var that = this, + options = that.config, + id = options.id || options.index; + + if (id) { + thisTable.that[id] = that; //记录当前实例对象 + thisTable.config[id] = options; //记录当前实例配置项 + } + + return { + reload: function(options) { + that.reload.call(that, options); + }, + setColsWidth: function() { + that.setColsWidth.call(that); + }, + resize: function() { //重置表格尺寸/结构 + that.resize.call(that); + }, + config: options + } + } + + //获取当前实例配置项 + , getThisTableConfig = function(id) { + var config = thisTable.config[id]; + if (!config) hint.error('The ID option was not found in the table instance'); + return config || null; + } + + //字符常量 + , MOD_NAME = 'table', ELEM = '.layui-table', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', + DISABLED = 'layui-disabled', NONE = 'layui-none' + + , ELEM_VIEW = 'layui-table-view', ELEM_TOOL = '.layui-table-tool', ELEM_BOX = '.layui-table-box', + ELEM_INIT = '.layui-table-init', ELEM_HEADER = '.layui-table-header', ELEM_BODY = '.layui-table-body', + ELEM_MAIN = '.layui-table-main', ELEM_FIXED = '.layui-table-fixed', ELEM_FIXL = '.layui-table-fixed-l', + ELEM_FIXR = '.layui-table-fixed-r', ELEM_TOTAL = '.layui-table-total', ELEM_PAGE = '.layui-table-page', + ELEM_SORT = '.layui-table-sort', ELEM_EDIT = 'layui-table-edit', ELEM_HOVER = 'layui-table-hover' + + //thead区域模板 + , TPL_HEADER = function(options) { + var rowCols = '{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}'; + + options = options || {}; + return ['', '', '{{# layui.each(d.data.cols, function(i1, item1){ }}', '', '{{# layui.each(item1, function(i2, item2){ }}', '{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}', '{{# if(item2.fixed === "right"){ right = true; } }}', function() { + if (options.fixed && options.fixed !== 'right') { + return '{{# if(item2.fixed && item2.fixed !== "right"){ }}'; + } + if (options.fixed === 'right') { + return '{{# if(item2.fixed === "right"){ }}'; + } + return ''; + }(), '{{# var isSort = !(item2.colGroup) && item2.sort; }}', '', (options.fixed ? '{{# }; }}' : ''), '{{# }); }}', '', '{{# }); }}', '', '
    ', '
    ', '{{# if(item2.type === "checkbox"){ }}' //复选框 + , '', '{{# } else { }}', '{{item2.title||""}}', '{{# if(isSort){ }}', '', '{{# } }}', '{{# } }}', '
    ', '
    ' + ].join(''); + } + + //tbody区域模板 + , TPL_BODY = ['', '', '
    '].join('') + + //主模板 + , + TPL_MAIN = ['
    ' + + , '{{# if(d.data.toolbar){ }}', '
    ', '
    ', '
    ', '
    ', '{{# } }}' + + , '
    ', '{{# if(d.data.loading){ }}', '
    ', '', '
    ', '{{# } }}' + + , '{{# var left, right; }}', '
    ', TPL_HEADER(), '
    ', '
    ', TPL_BODY, '
    ' + + , '{{# if(left){ }}', '
    ', '
    ', TPL_HEADER({ fixed: true }), '
    ', '
    ', TPL_BODY, '
    ', '
    ', '{{# }; }}' + + , '{{# if(right){ }}', '
    ', '
    ', TPL_HEADER({ fixed: 'right' }), '
    ', '
    ', '
    ', TPL_BODY, '
    ', '
    ', '{{# }; }}', '
    ' + + , '{{# if(d.data.totalRow){ }}', '
    ', '', '', '
    ', '
    ', '{{# } }}' + + , '{{# if(d.data.page){ }}', '
    ', '
    ', '
    ', '{{# } }}' + + , '', '
    ' + ].join('') + + , _WIN = $(window), _DOC = $(document) + + //构造器 + , Class = function(options) { + var that = this; + that.index = ++table.index; + that.config = $.extend({}, that.config, table.config, options); + that.render(); + }; + + //默认配置 + Class.prototype.config = { + limit: 10 //每页显示的数量 + , + loading: true //请求数据时,是否显示loading + , + cellMinWidth: 60 //所有单元格默认最小宽度 + , + defaultToolbar: ['filter', 'exports', 'print'] //工具栏右侧图标 + , + autoSort: true //是否前端自动排序。如果否,则需自主排序(通常为服务端处理好排序) + , + text: { + none: '无数据' + } + }; + + //表格渲染 + Class.prototype.render = function() { + var that = this, + options = that.config; + + options.elem = $(options.elem); + options.where = options.where || {}; + options.id = options.id || options.elem.attr('id') || that.index; + + //请求参数的自定义格式 + options.request = $.extend({ + pageName: 'page', + limitName: 'limit' + }, options.request) + + //响应数据的自定义格式 + options.response = $.extend({ + statusName: 'code', + statusCode: 0, + msgName: 'msg', + dataName: 'data', + countName: 'count' + }, options.response); + + //如果 page 传入 laypage 对象 + if (typeof options.page === 'object') { + options.limit = options.page.limit || options.limit; + options.limits = options.page.limits || options.limits; + that.page = options.page.curr = options.page.curr || 1; + delete options.page.elem; + delete options.page.jump; + } + + if (!options.elem[0]) return that; + + //高度铺满:full-差距值 + if (options.height && /^full-\d+$/.test(options.height)) { + that.fullHeightGap = options.height.split('-')[1]; + options.height = _WIN.height() - that.fullHeightGap; + } + + //初始化一些参数 + that.setInit(); + + //开始插入替代元素 + var othis = options.elem, + hasRender = othis.next('.' + ELEM_VIEW) + + //主容器 + , reElem = that.elem = $(laytpl(TPL_MAIN).render({ + VIEW_CLASS: ELEM_VIEW, + data: options, + index: that.index //索引 + })); + + options.index = that.index; + + //生成替代元素 + hasRender[0] && hasRender.remove(); //如果已经渲染,则Rerender + othis.after(reElem); + + //各级容器 + that.layTool = reElem.find(ELEM_TOOL); + that.layBox = reElem.find(ELEM_BOX); + that.layHeader = reElem.find(ELEM_HEADER); + that.layMain = reElem.find(ELEM_MAIN); + that.layBody = reElem.find(ELEM_BODY); + that.layFixed = reElem.find(ELEM_FIXED); + that.layFixLeft = reElem.find(ELEM_FIXL); + that.layFixRight = reElem.find(ELEM_FIXR); + that.layTotal = reElem.find(ELEM_TOTAL); + that.layPage = reElem.find(ELEM_PAGE); + + //初始化工具栏 + that.renderToolbar(); + + //让表格平铺 + that.fullSize(); + + //如果多级表头,则填补表头高度 + if (options.cols.length > 1) { + //补全高度 + var th = that.layFixed.find(ELEM_HEADER).find('th'); + th.height(that.layHeader.height() - 1 - parseFloat(th.css('padding-top')) - parseFloat(th.css('padding-bottom'))); + } + + that.pullData(that.page); //请求数据 + that.events(); //事件 + }; + + //根据列类型,定制化参数 + Class.prototype.initOpts = function(item) { + var that = this, + options = that.config, + initWidth = { + checkbox: 48, + radio: 48, + space: 15, + numbers: 40 + }; + + //让 type 参数兼容旧版本 + if (item.checkbox) item.type = "checkbox"; + if (item.space) item.type = "space"; + if (!item.type) item.type = "normal"; + + if (item.type !== "normal") { + item.unresize = true; + item.width = item.width || initWidth[item.type]; + } + }; + + //初始化一些参数 + Class.prototype.setInit = function(type) { + var that = this, + options = that.config; + + options.clientWidth = options.width || function() { //获取容器宽度 + //如果父元素宽度为0(一般为隐藏元素),则继续查找上层元素,直到找到真实宽度为止 + var getWidth = function(parent) { + var width, isNone; + parent = parent || options.elem.parent() + width = parent.width(); + try { + isNone = parent.css('display') === 'none'; + } catch (e) {} + if (parent[0] && (!width || isNone)) return getWidth(parent.parent()); + return width; + }; + return getWidth(); + }(); + + if (type === 'width') return options.clientWidth; + + //初始化列参数 + layui.each(options.cols, function(i1, item1) { + layui.each(item1, function(i2, item2) { + + //如果列参数为空,则移除 + if (!item2) { + item1.splice(i2, 1); + return; + } + + item2.key = i1 + '-' + i2; + item2.hide = item2.hide || false; + + //设置列的父列索引 + //如果是组合列,则捕获对应的子列 + if (item2.colGroup || item2.colspan > 1) { + var childIndex = 0; + layui.each(options.cols[i1 + 1], function(i22, item22) { + //如果子列已经被标注为{HAS_PARENT},或者子列累计 colspan 数等于父列定义的 colspan,则跳出当前子列循环 + if (item22.HAS_PARENT || (childIndex > 1 && childIndex == item2.colspan)) return; + + item22.HAS_PARENT = true; + item22.parentKey = i1 + '-' + i2; + + childIndex = childIndex + parseInt(item22.colspan > 1 ? item22.colspan : 1); + }); + item2.colGroup = true; //标注是组合列 + } + + //根据列类型,定制化参数 + that.initOpts(item2); + }); + }); + + }; + + //初始工具栏 + Class.prototype.renderToolbar = function() { + var that = this, + options = that.config + + //添加工具栏左侧模板 + var leftDefaultTemp = [ + '
    ', '
    ', '
    ' + ].join(''), + elemToolTemp = that.layTool.find('.layui-table-tool-temp'); + + if (options.toolbar === 'default') { + elemToolTemp.html(leftDefaultTemp); + } else if (typeof options.toolbar === 'string') { + var toolbarHtml = $(options.toolbar).html() || ''; + toolbarHtml && elemToolTemp.html( + laytpl(toolbarHtml).render(options) + ); + } + + //添加工具栏右侧面板 + var layout = { + filter: { + title: '筛选列', + layEvent: 'LAYTABLE_COLS', + icon: 'layui-icon-cols' + }, + exports: { + title: '导出', + layEvent: 'LAYTABLE_EXPORT', + icon: 'layui-icon-export' + }, + print: { + title: '打印', + layEvent: 'LAYTABLE_PRINT', + icon: 'layui-icon-print' + } + }, + iconElem = []; + + if (typeof options.defaultToolbar === 'object') { + layui.each(options.defaultToolbar, function(i, item) { + var thisItem = layout[item]; + if (thisItem) { + iconElem.push('
    ' + + '' + + '
    '); + } + }); + } + that.layTool.find('.layui-table-tool-self').html(iconElem.join('')); + } + + //同步表头父列的相关值 + Class.prototype.setParentCol = function(hide, parentKey) { + var that = this, + options = that.config + + , parentTh = that.layHeader.find('th[data-key="' + options.index + '-' + parentKey + '"]') //获取父列元素 + , parentColspan = parseInt(parentTh.attr('colspan')) || 0; + + if (parentTh[0]) { + var arrParentKey = parentKey.split('-'), + getThisCol = options.cols[arrParentKey[0]][arrParentKey[1]]; + + hide ? parentColspan-- : parentColspan++; + + parentTh.attr('colspan', parentColspan); + parentTh[parentColspan < 1 ? 'addClass' : 'removeClass'](HIDE); + + getThisCol.colspan = parentColspan; //同步 colspan 参数 + getThisCol.hide = parentColspan < 1; //同步 hide 参数 + + //递归,继续往上查询是否有父列 + var nextParentKey = parentTh.data('parentkey'); + nextParentKey && that.setParentCol(hide, nextParentKey); + } + }; + + //多级表头补丁 + Class.prototype.setColsPatch = function() { + var that = this, + options = that.config + + //同步表头父列的相关值 + layui.each(options.cols, function(i1, item1) { + layui.each(item1, function(i2, item2) { + if (item2.hide) { + that.setParentCol(item2.hide, item2.parentKey); + } + }); + }); + }; + + //动态分配列宽 + Class.prototype.setColsWidth = function() { + var that = this, + options = that.config, + colNums = 0 //列个数 + , + autoColNums = 0 //自动列宽的列个数 + , + autoWidth = 0 //自动列分配的宽度 + , + countWidth = 0 //所有列总宽度和 + , + cntrWidth = that.setInit('width'); + + //统计列个数 + that.eachCols(function(i, item) { + item.hide || colNums++; + }); + + //减去边框差和滚动条宽 + cntrWidth = cntrWidth - function() { + return (options.skin === 'line' || options.skin === 'nob') ? 2 : colNums + 1; + }() - that.getScrollWidth(that.layMain[0]) - 1; + + //计算自动分配的宽度 + var getAutoWidth = function(back) { + //遍历所有列 + layui.each(options.cols, function(i1, item1) { + layui.each(item1, function(i2, item2) { + var width = 0, + minWidth = item2.minWidth || options.cellMinWidth; //最小宽度 + + if (!item2) { + item1.splice(i2, 1); + return; + } + + if (item2.colGroup || item2.hide) return; + + if (!back) { + width = item2.width || 0; + if (/\d+%$/.test(width)) { //列宽为百分比 + width = Math.floor((parseFloat(width) / 100) * cntrWidth); + width < minWidth && (width = minWidth); + } else if (!width) { //列宽未填写 + item2.width = width = 0; + autoColNums++; + } + } else if (autoWidth && autoWidth < minWidth) { + autoColNums--; + width = minWidth; + } + + if (item2.hide) width = 0; + countWidth = countWidth + width; + }); + }); + + //如果未填充满,则将剩余宽度平分 + (cntrWidth > countWidth && autoColNums) && ( + autoWidth = (cntrWidth - countWidth) / autoColNums + ); + } + + getAutoWidth(); + getAutoWidth(true); //重新检测分配的宽度是否低于最小列宽 + + //记录自动列数 + that.autoColNums = autoColNums; + + //设置列宽 + that.eachCols(function(i3, item3) { + var minWidth = item3.minWidth || options.cellMinWidth; + if (item3.colGroup || item3.hide) return; + + //给位分配宽的列平均分配宽 + if (item3.width === 0) { + that.getCssRule(options.index + '-' + item3.key, function(item) { + item.style.width = Math.floor(autoWidth >= minWidth ? autoWidth : minWidth) + 'px'; + }); + } + + //给设定百分比的列分配列宽 + else if (/\d+%$/.test(item3.width)) { + that.getCssRule(options.index + '-' + item3.key, function(item) { + item.style.width = Math.floor((parseFloat(item3.width) / 100) * cntrWidth) + 'px'; + }); + } + }); + + //填补 Math.floor 造成的数差 + var patchNums = that.layMain.width() - that.getScrollWidth(that.layMain[0]) - + that.layMain.children('table').outerWidth(); + + if (that.autoColNums && patchNums >= -colNums && patchNums <= colNums) { + var getEndTh = function(th) { + var field; + th = th || that.layHeader.eq(0).find('thead th:last-child') + field = th.data('field'); + if (!field && th.prev()[0]) { + return getEndTh(th.prev()) + } + return th + }, + th = getEndTh(), + key = th.data('key'); + + that.getCssRule(key, function(item) { + var width = item.style.width || th.outerWidth(); + item.style.width = (parseFloat(width) + patchNums) + 'px'; + + //二次校验,如果仍然出现横向滚动条(通常是 1px 的误差导致) + if (that.layMain.height() - that.layMain.prop('clientHeight') > 0) { + item.style.width = (parseFloat(item.style.width) - 1) + 'px'; + } + }); + } + + that.loading(!0); + }; + + //重置表格尺寸/结构 + Class.prototype.resize = function() { + var that = this; + that.fullSize(); //让表格铺满 + that.setColsWidth(); //自适应列宽 + that.scrollPatch(); //滚动条补丁 + + }; + + //表格完整重载 + Class.prototype.reload = function(options) { + var that = this; + if (that.config.data && that.config.data.constructor === Array) delete that.config.data; + that.config = $.extend({}, that.config, options); + that.render(); + }; + + //页码 + Class.prototype.page = 1; + + //获得数据 + Class.prototype.pullData = function(curr) { + var that = this, + options = that.config, + request = options.request, + response = options.response, + sort = function() { + if (typeof options.initSort === 'object') { + that.sort(options.initSort.field, options.initSort.type); + } + }; + console.log(options.contentType) + that.startTime = new Date().getTime(); //渲染开始时间 + + if (options.url) { //Ajax请求 + + var data = options.where; + + + + if (!options.page) { + console.log("options param:", data) + } else { + //添加分页参数 + var params = { pageNum: curr, pageSize: options.limit } + if (data.page) { + data.page = $.extend(data.page, params); + } else { + data.page = params + } + } + + if (data.pageNum && data.pageSize) { + console.log('删除page对象') + delete data.page + } + + console.log(data) + + + //表格请求携带_openx_head 参数 + var tokenName = layui.setter.request.tokenName; + if (tokenName) { + var ssoToken = localStorage.getItem(tokenName) + data._openx_head = {} + if (ssoToken) { + try { + data._openx_head = JSON.parse(ssoToken) + } catch (exception) { + console.log(exception.message); + data._openx_head = {} + } + } + } + //====源码新增部分结束==== + if (options.contentType && options.contentType.indexOf("application/json") == 0) { //提交 json 格式 + data = JSON.stringify(data); + } + $.ajax({ + type: options.method || 'post', + url: options.url, + contentType: options.contentType || 'application/json', + data: data, + dataType: 'json', + headers: options.headers || {}, + success: function(res) { + //如果有数据解析的回调,则获得其返回的数据 + if (typeof options.parseData === 'function') { + res = options.parseData(res) || res; + } + + //检查数据格式是否符合规范 + if (res[response.statusName] != response.statusCode) { + that.renderForm(); + that.layMain.html('
    ' + ( + res[response.msgName] || + ('返回的数据不符合规范,正确的成功状态码 (' + response.statusName + ') 应为:' + response.statusCode) + ) + '
    '); + } else { + that.renderData(res, curr, res[response.countName]), sort(); + options.time = (new Date().getTime() - that.startTime) + ' ms'; //耗时(接口请求+视图渲染) + } + that.setColsWidth(); + typeof options.done === 'function' && options.done(res, curr, res[response.countName]); + + try { + layer.closeAll('loading') + parent.layer.closeAll('loading') + } catch (e) { + console.log(e) + } + }, + error: function(e, m) { + that.layMain.html('
    数据接口请求异常:' + m + '
    '); + that.renderForm(); + that.setColsWidth(); + try { + layer.closeAll('loading') + parent.layer.closeAll('loading') + } catch (e) { + console.log(e) + } + } + }); + } else if (options.data && options.data.constructor === Array) { //已知数据 + var res = {}, + startLimit = curr * options.limit - options.limit + + res[response.dataName] = options.data.concat().splice(startLimit, options.limit); + res[response.countName] = options.data.length; + + that.renderData(res, curr, options.data.length), sort(); + that.setColsWidth(); + typeof options.done === 'function' && options.done(res, curr, res[response.countName]); + } + }; + + //遍历表头 + Class.prototype.eachCols = function(callback) { + var that = this; + table.eachCols(null, callback, that.config.cols); + return that; + }; + + //数据渲染 + Class.prototype.renderData = function(res, curr, count, sort) { + var that = this, + options = that.config, + data = res[options.response.dataName] || [], + trs = [], + trs_fixed = [], + trs_fixed_r = [] + + //渲染视图 + , render = function() { //后续性能提升的重点 + var thisCheckedRowIndex; + if (!sort && that.sortKey) { + return that.sort(that.sortKey.field, that.sortKey.sort, true); + } + layui.each(data, function(i1, item1) { + var tds = [], + tds_fixed = [], + tds_fixed_r = [], + numbers = i1 + options.limit * (curr - 1) + 1; //序号 + + if (item1.length === 0) return; + if (!sort) { + item1[table.config.indexName] = i1; + } + + that.eachCols(function(i3, item3) { + var field = item3.field || i3, + key = options.index + '-' + item3.key, + content = item1[field]; + + if (content === undefined || content === null) content = ''; + if (item3.colGroup) return; + + //td内容 + var td = ['', '
    ' + function() { + var tplData = $.extend(true, { + LAY_INDEX: numbers + }, item1), + checkName = table.config.checkName; + + //渲染不同风格的列 + switch (item3.type) { + case 'checkbox': + return ''; + break; + case 'radio': + if (tplData[checkName]) { + thisCheckedRowIndex = i1; + } + return ''; + break; + case 'numbers': + return numbers; + break; + }; + + //解析工具列模板 + if (item3.toolbar) { + return laytpl($(item3.toolbar).html() || '').render(tplData); + } + return item3.templet ? function() { + return typeof item3.templet === 'function' ? + item3.templet(tplData) : + laytpl($(item3.templet).html() || String(content)).render(tplData) + }() : content; + }(), '
    '].join(''); + + tds.push(td); + if (item3.fixed && item3.fixed !== 'right') tds_fixed.push(td); + if (item3.fixed === 'right') tds_fixed_r.push(td); + }); + + trs.push('' + tds.join('') + ''); + trs_fixed.push('' + tds_fixed.join('') + ''); + trs_fixed_r.push('' + tds_fixed_r.join('') + ''); + }); + + that.layBody.scrollTop(0); + that.layMain.find('.' + NONE).remove(); + that.layMain.find('tbody').html(trs.join('')); + that.layFixLeft.find('tbody').html(trs_fixed.join('')); + that.layFixRight.find('tbody').html(trs_fixed_r.join('')); + + that.renderForm(); + typeof thisCheckedRowIndex === 'number' && that.setThisRowChecked(thisCheckedRowIndex); + that.syncCheckAll(); + + //滚动条补丁 + that.haveInit ? that.scrollPatch() : setTimeout(function() { + that.scrollPatch(); + }, 50); + that.haveInit = true; + + layer.close(that.tipsIndex); + + //同步表头父列的相关值 + options.HAS_SET_COLS_PATCH || that.setColsPatch(); + options.HAS_SET_COLS_PATCH = true; + }; + + that.key = options.id || options.index; + table.cache[that.key] = data; //记录数据 + + //显示隐藏分页栏 + that.layPage[(count == 0 || (data.length === 0 && curr == 1)) ? 'addClass' : 'removeClass'](HIDE); + + //排序 + if (sort) { + return render(); + } + + if (data.length === 0) { + that.renderForm(); + that.layFixed.remove(); + that.layMain.find('tbody').html(''); + that.layMain.find('.' + NONE).remove(); + return that.layMain.append('
    ' + options.text.none + '
    '); + } + + render(); //渲染数据 + that.renderTotal(data); //数据合计 + + //同步分页状态 + if (options.page) { + options.page = $.extend({ + elem: 'layui-table-page' + options.index, + count: count, + limit: options.limit, + limits: options.limits || [10, 20, 30, 40, 50, 60, 70, 80, 90], + groups: 3, + layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'], + prev: '', + next: '', + jump: function(obj, first) { + if (!first) { + //分页本身并非需要做以下更新,下面参数的同步,主要是因为其它处理统一用到了它们 + //而并非用的是 options.page 中的参数(以确保分页未开启的情况仍能正常使用) + that.page = obj.curr; //更新页码 + options.limit = obj.limit; //更新每页条数 + + that.loading(); + that.pullData(obj.curr); + } + } + }, options.page); + options.page.count = count; //更新总条数 + laypage.render(options.page); + } + }; + + //数据合计行 + Class.prototype.renderTotal = function(data) { + var that = this, + options = that.config, + totalNums = {}; + + if (!options.totalRow) return; + + layui.each(data, function(i1, item1) { + if (item1.length === 0) return; + + that.eachCols(function(i3, item3) { + var field = item3.field || i3, + content = item1[field]; + + if (item3.totalRow) { + totalNums[field] = (totalNums[field] || 0) + (parseFloat(content) || 0); + } + }); + }); + + var tds = []; + that.eachCols(function(i3, item3) { + var field = item3.field || i3; + + //td内容 + var td = ['', '
    ' + function() { + var text = item3.totalRowText || ''; + return item3.totalRow ? (parseFloat(totalNums[field]).toFixed(2) || text) : text; + }(), '
    '].join(''); + + tds.push(td); + }); + + that.layTotal.find('tbody').html('' + tds.join('') + ''); + }; + + //找到对应的列元素 + Class.prototype.getColElem = function(parent, key) { + var that = this, + options = that.config; + return parent.eq(0).find('.laytable-cell-' + (options.index + '-' + key) + ':eq(0)'); + }; + + //渲染表单 + Class.prototype.renderForm = function(type) { + form.render(type, 'LAY-table-' + this.index); + }; + + //标记当前行选中状态 + Class.prototype.setThisRowChecked = function(index) { + var that = this, + options = that.config, + ELEM_CLICK = 'layui-table-click', + tr = that.layBody.find('tr[data-index="' + index + '"]'); + + tr.addClass(ELEM_CLICK).siblings('tr').removeClass(ELEM_CLICK); + }; + + //数据排序 + Class.prototype.sort = function(th, type, pull, formEvent) { + var that = this, + field, res = {}, + options = that.config, + filter = options.elem.attr('lay-filter'), + data = table.cache[that.key], + thisData; + + //字段匹配 + if (typeof th === 'string') { + that.layHeader.find('th').each(function(i, item) { + var othis = $(this), + _field = othis.data('field'); + if (_field === th) { + th = othis; + field = _field; + return false; + } + }); + } + + try { + var field = field || th.data('field'), + key = th.data('key'); + + //如果欲执行的排序已在状态中,则不执行渲染 + if (that.sortKey && !pull) { + if (field === that.sortKey.field && type === that.sortKey.sort) { + return; + } + } + + var elemSort = that.layHeader.find('th .laytable-cell-' + key).find(ELEM_SORT); + that.layHeader.find('th').find(ELEM_SORT).removeAttr('lay-sort'); //清除其它标题排序状态 + elemSort.attr('lay-sort', type || null); + that.layFixed.find('th') + } catch (e) { + return hint.error('Table modules: Did not match to field'); + } + + //记录排序索引和类型 + that.sortKey = { + field: field, + sort: type + }; + + //默认为前端自动排序。如果否,则需自主排序(通常为服务端处理好排序) + if (options.autoSort) { + if (type === 'asc') { //升序 + thisData = layui.sort(data, field); + } else if (type === 'desc') { //降序 + thisData = layui.sort(data, field, true); + } else { //清除排序 + thisData = layui.sort(data, table.config.indexName); + delete that.sortKey; + } + } + + res[options.response.dataName] = thisData || data; + that.renderData(res, that.page, that.count, true); + + if (formEvent) { + layui.event.call(th, MOD_NAME, 'sort(' + filter + ')', { + field: field, + type: type + }); + } + }; + + //请求loading + Class.prototype.loading = function(hide) { + var that = this, + options = that.config; + if (options.loading) { + if (hide) { + that.layInit && that.layInit.remove(); + delete that.layInit; + that.layBox.find(ELEM_INIT).remove() + } else { + that.layInit = $(['
    ', '', '
    '].join('')); + that.layBox.append(that.layInit); + } + } + }; + + //同步选中值状态 + Class.prototype.setCheckData = function(index, checked) { + var that = this, + options = that.config, + thisData = table.cache[that.key]; + if (!thisData[index]) return; + if (thisData[index].constructor === Array) return; + thisData[index][options.checkName] = checked; + }; + + //同步全选按钮状态 + Class.prototype.syncCheckAll = function() { + var that = this, + options = that.config, + checkAllElem = that.layHeader.find('input[name="layTableCheckbox"]'), + syncColsCheck = function(checked) { + that.eachCols(function(i, item) { + if (item.type === 'checkbox') { + item[options.checkName] = checked; + } + }); + return checked; + }; + + if (!checkAllElem[0]) return; + + if (table.checkStatus(that.key).isAll) { + if (!checkAllElem[0].checked) { + checkAllElem.prop('checked', true); + that.renderForm('checkbox'); + } + syncColsCheck(true); + } else { + if (checkAllElem[0].checked) { + checkAllElem.prop('checked', false); + that.renderForm('checkbox'); + } + syncColsCheck(false); + } + }; + + //获取cssRule + Class.prototype.getCssRule = function(key, callback) { + var that = this, + style = that.elem.find('style')[0], + sheet = style.sheet || style.styleSheet || {}, + rules = sheet.cssRules || sheet.rules; + layui.each(rules, function(i, item) { + if (item.selectorText === ('.laytable-cell-' + key)) { + return callback(item), true; + } + }); + }; + + //让表格铺满 + Class.prototype.fullSize = function() { + var that = this, + options = that.config, + height = options.height, + bodyHeight; + + if (that.fullHeightGap) { + height = _WIN.height() - that.fullHeightGap; + if (height < 135) height = 135; + that.elem.css('height', height); + } + + if (!height) return; + + //减去列头区域的高度 + bodyHeight = parseFloat(height) - (that.layHeader.outerHeight() || 38); //此处的数字常量是为了防止容器处在隐藏区域无法获得高度的问题,暂时只对默认尺寸的表格做支持。 + + //减去工具栏的高度 + if (options.toolbar) { + bodyHeight = bodyHeight - (that.layTool.outerHeight() || 50); + } + + //减去统计朗的高度 + if (options.totalRow) { + bodyHeight = bodyHeight - (that.layTotal.outerHeight() || 40); + } + + //减去分页栏的高度 + if (options.page) { + bodyHeight = bodyHeight - (that.layPage.outerHeight() || 41) - 2; + } + + that.layMain.css('height', bodyHeight); + }; + + //获取滚动条宽度 + Class.prototype.getScrollWidth = function(elem) { + var width = 0; + if (elem) { + width = elem.offsetWidth - elem.clientWidth; + } else { + elem = document.createElement('div'); + elem.style.width = '100px'; + elem.style.height = '100px'; + elem.style.overflowY = 'scroll'; + + document.body.appendChild(elem); + width = elem.offsetWidth - elem.clientWidth; + document.body.removeChild(elem); + } + return width; + }; + + //滚动条补丁 + Class.prototype.scrollPatch = function() { + var that = this, + layMainTable = that.layMain.children('table'), + scollWidth = that.layMain.width() - that.layMain.prop('clientWidth') //纵向滚动条宽度 + , + scollHeight = that.layMain.height() - that.layMain.prop('clientHeight') //横向滚动条高度 + , + getScrollWidth = that.getScrollWidth(that.layMain[0]) //获取主容器滚动条宽度,如果有的话 + , + outWidth = layMainTable.outerWidth() - that.layMain.width() //表格内容器的超出宽度 + + //添加补丁 + , addPatch = function(elem) { + if (scollWidth && scollHeight) { + elem = elem.eq(0); + if (!elem.find('.layui-table-patch')[0]) { + var patchElem = $('
    '); //补丁元素 + patchElem.find('div').css({ + width: scollWidth + }); + elem.find('tr').append(patchElem); + } + } else { + elem.find('.layui-table-patch').remove(); + } + } + + addPatch(that.layHeader); + addPatch(that.layTotal); + + //固定列区域高度 + var mainHeight = that.layMain.height(), + fixHeight = mainHeight - scollHeight; + that.layFixed.find(ELEM_BODY).css('height', layMainTable.height() >= fixHeight ? fixHeight : 'auto'); + + //表格宽度小于容器宽度时,隐藏固定列 + that.layFixRight[outWidth > 0 ? 'removeClass' : 'addClass'](HIDE); + + //操作栏 + that.layFixRight.css('right', scollWidth - 1); + }; + + //事件处理 + Class.prototype.events = function() { + var that = this, + options = that.config, + _BODY = $('body'), + dict = {}, + th = that.layHeader.find('th'), + resizing, ELEM_CELL = '.layui-table-cell', + filter = options.elem.attr('lay-filter'); + + //工具栏操作事件 + that.layTool.on('click', '*[lay-event]', function(e) { + var othis = $(this), + events = othis.attr('lay-event'), + openPanel = function(sets) { + var list = $(sets.list), + panel = $('
      '); + + panel.html(list); + + //限制最大高度 + if (options.height) { + panel.css('max-height', options.height - (that.layTool.outerHeight() || 50)); + } + + //插入元素 + othis.find('.layui-table-tool-panel')[0] || othis.append(panel); + that.renderForm(); + + panel.on('click', function(e) { + layui.stope(e); + }); + + sets.done && sets.done(panel, list) + }; + + layui.stope(e); + _DOC.trigger('table.tool.panel.remove'); + layer.close(that.tipsIndex); + + switch (events) { + case 'LAYTABLE_COLS': //筛选列 + openPanel({ + list: function() { + var lis = []; + that.eachCols(function(i, item) { + if (item.field && item.type == 'normal') { + lis.push('
    • '); + } + }); + return lis.join(''); + }(), + done: function() { + form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(obj) { + var othis = $(obj.elem), + checked = this.checked, + key = othis.data('key'), + parentKey = othis.data('parentkey'); + + layui.each(options.cols, function(i1, item1) { + layui.each(item1, function(i2, item2) { + if (i1 + '-' + i2 === key) { + var hide = item2.hide; + + //同步勾选列的 hide 值和隐藏样式 + item2.hide = !checked; + that.elem.find('*[data-key="' + options.index + '-' + key + '"]')[checked ? 'removeClass' : 'addClass'](HIDE); + + //根据列的显示隐藏,同步多级表头的父级相关属性值 + if (hide != item2.hide) { + that.setParentCol(!checked, parentKey); + } + + //重新适配尺寸 + that.resize(); + } + }); + }); + }); + } + }); + break; + case 'LAYTABLE_EXPORT': //导出 + if (device.ie) { + layer.tips('导出功能不支持 IE,请用 Chrome 等高级浏览器导出', this, { + tips: 3 + }) + } else { + openPanel({ + list: function() { + return [ + '
    • 导出到 Csv 文件
    • ', '
    • 导出到 Excel 文件
    • ' + ].join('') + }(), + done: function(panel, list) { + list.on('click', function() { + var type = $(this).data('type') + table.exportFile(options.id, null, type); + }); + } + }); + } + break; + case 'LAYTABLE_PRINT': //打印 + var printWin = window.open('打印窗口', '_blank'), + style = [''].join(''), + html = $(that.layHeader.html()); + + html.append(that.layMain.find('table').html()); + + html.find('th.layui-table-patch').remove(); + html.find('.layui-table-col-special').remove(); + + printWin.document.write(style + html.prop('outerHTML')); + printWin.document.close(); + printWin.print(); + printWin.close(); + break; + } + + layui.event.call(this, MOD_NAME, 'toolbar(' + filter + ')', $.extend({ + event: events, + config: options + }, {})); + }); + + //拖拽调整宽度 + th.on('mousemove', function(e) { + var othis = $(this), + oLeft = othis.offset().left, + pLeft = e.clientX - oLeft; + if (othis.data('unresize') || dict.resizeStart) { + return; + } + dict.allowResize = othis.width() - pLeft <= 10; //是否处于拖拽允许区域 + _BODY.css('cursor', (dict.allowResize ? 'col-resize' : '')); + }).on('mouseleave', function() { + var othis = $(this); + if (dict.resizeStart) return; + _BODY.css('cursor', ''); + }).on('mousedown', function(e) { + var othis = $(this); + if (dict.allowResize) { + var key = othis.data('key'); + e.preventDefault(); + dict.resizeStart = true; //开始拖拽 + dict.offset = [e.clientX, e.clientY]; //记录初始坐标 + + that.getCssRule(key, function(item) { + var width = item.style.width || othis.outerWidth(); + dict.rule = item; + dict.ruleWidth = parseFloat(width); + dict.minWidth = othis.data('minwidth') || options.cellMinWidth; + }); + } + }); + + //拖拽中 + _DOC.on('mousemove', function(e) { + if (dict.resizeStart) { + e.preventDefault(); + if (dict.rule) { + var setWidth = dict.ruleWidth + e.clientX - dict.offset[0]; + if (setWidth < dict.minWidth) setWidth = dict.minWidth; + dict.rule.style.width = setWidth + 'px'; + layer.close(that.tipsIndex); + } + resizing = 1 + } + }).on('mouseup', function(e) { + if (dict.resizeStart) { + dict = {}; + _BODY.css('cursor', ''); + that.scrollPatch(); + } + if (resizing === 2) { + resizing = null; + } + }); + + //排序 + th.on('click', function(e) { + var othis = $(this), + elemSort = othis.find(ELEM_SORT), + nowType = elemSort.attr('lay-sort'), + type; + + if (!elemSort[0] || resizing === 1) return resizing = 2; + + if (nowType === 'asc') { + type = 'desc'; + } else if (nowType === 'desc') { + type = null; + } else { + type = 'asc'; + } + that.sort(othis, type, null, true); + }).find(ELEM_SORT + ' .layui-edge ').on('click', function(e) { + var othis = $(this), + index = othis.index(), + field = othis.parents('th').eq(0).data('field') + layui.stope(e); + if (index === 0) { + that.sort(field, 'asc', null, true); + } else { + that.sort(field, 'desc', null, true); + } + }); + + //数据行中的事件监听返回的公共对象成员 + var commonMember = function(sets) { + var othis = $(this), + index = othis.parents('tr').eq(0).data('index'), + tr = that.layBody.find('tr[data-index="' + index + '"]'), + data = table.cache[that.key][index]; + + return $.extend({ + tr: tr //行元素 + , + data: table.clearCacheKey(data) //当前行数据 + , + del: function() { //删除行数据 + table.cache[that.key][index] = []; + tr.remove(); + that.scrollPatch(); + }, + update: function(fields) { //修改行数据 + fields = fields || {}; + layui.each(fields, function(key, value) { + if (key in data) { + var templet, td = tr.children('td[data-field="' + key + '"]'); + data[key] = value; + that.eachCols(function(i, item2) { + if (item2.field == key && item2.templet) { + templet = item2.templet; + } + }); + td.children(ELEM_CELL).html(function() { + return templet ? function() { + return typeof templet === 'function' ? + templet(data) : + laytpl($(templet).html() || value).render(data) + }() : value; + }()); + td.data('content', value); + } + }); + } + }, sets); + }; + + //复选框选择 + that.elem.on('click', 'input[name="layTableCheckbox"]+', function() { //替代元素的 click 事件 + var checkbox = $(this).prev(), + childs = that.layBody.find('input[name="layTableCheckbox"]'), + index = checkbox.parents('tr').eq(0).data('index'), + checked = checkbox[0].checked, + isAll = checkbox.attr('lay-filter') === 'layTableAllChoose'; + + //全选 + if (isAll) { + childs.each(function(i, item) { + item.checked = checked; + that.setCheckData(i, checked); + }); + that.syncCheckAll(); + that.renderForm('checkbox'); + } else { + that.setCheckData(index, checked); + that.syncCheckAll(); + } + + layui.event.call(checkbox[0], MOD_NAME, 'checkbox(' + filter + ')', commonMember.call(checkbox[0], { + checked: checked, + type: isAll ? 'all' : 'one' + })); + }); + + //单选框选择 + that.elem.on('click', 'input[lay-type="layTableRadio"]+', function() { + var radio = $(this).prev(), + checked = radio[0].checked, + thisData = table.cache[that.key], + index = radio.parents('tr').eq(0).data('index'); + + //重置数据单选属性 + layui.each(thisData, function(i, item) { + if (index === i) { + item.LAY_CHECKED = true; + } else { + delete item.LAY_CHECKED; + } + }); + that.setThisRowChecked(index); + + layui.event.call(this, MOD_NAME, 'radio(' + filter + ')', commonMember.call(this, { + checked: checked + })); + }); + + //行事件 + that.layBody.on('mouseenter', 'tr', function() { //鼠标移入行 + var othis = $(this), + index = othis.index(); + that.layBody.find('tr:eq(' + index + ')').addClass(ELEM_HOVER) + }).on('mouseleave', 'tr', function() { //鼠标移出行 + var othis = $(this), + index = othis.index(); + that.layBody.find('tr:eq(' + index + ')').removeClass(ELEM_HOVER) + }).on('click', 'tr', function() { //单击行 + setRowEvent.call(this, 'row'); + }).on('dblclick', 'tr', function() { //双击行 + setRowEvent.call(this, 'rowDouble'); + }); + + //创建行单击、双击事件监听 + var setRowEvent = function(eventType) { + var othis = $(this); + layui.event.call(this, + MOD_NAME, eventType + '(' + filter + ')', commonMember.call(othis.children('td')[0]) + ); + }; + + //单元格编辑 + that.layBody.on('change', '.' + ELEM_EDIT, function() { + var othis = $(this), + value = this.value, + field = othis.parent().data('field'), + index = othis.parents('tr').eq(0).data('index'), + data = table.cache[that.key][index]; + + data[field] = value; //更新缓存中的值 + + layui.event.call(this, MOD_NAME, 'edit(' + filter + ')', commonMember.call(this, { + value: value, + field: field + })); + }).on('blur', '.' + ELEM_EDIT, function() { + var templet, othis = $(this), + field = othis.parent().data('field'), + index = othis.parents('tr').eq(0).data('index'), + data = table.cache[that.key][index]; + that.eachCols(function(i, item) { + if (item.field == field && item.templet) { + templet = item.templet; + } + }); + othis.siblings(ELEM_CELL).html(function(value) { + return templet ? function() { + return typeof templet === 'function' ? + templet(data) : + laytpl($(templet).html() || this.value).render(data) + }() : value; + }(this.value)); + othis.parent().data('content', this.value); + othis.remove(); + }); + + //单元格单击事件 + that.layBody.on('click', 'td', function(e) { + var othis = $(this), + field = othis.data('field'), + editType = othis.data('edit'), + elemCell = othis.children(ELEM_CELL); + + if (othis.data('off')) return; //不触发事件 + + //显示编辑表单 + if (editType) { + var input = $(''); + input[0].value = othis.data('content') || elemCell.text(); + othis.find('.' + ELEM_EDIT)[0] || othis.append(input); + input.focus(); + layui.stope(e); + return; + } + }).on('mouseenter', 'td', function() { + gridExpand.call(this) + }).on('mouseleave', 'td', function() { + gridExpand.call(this, 'hide'); + }); + + //单元格展开图标 + var ELEM_GRID = 'layui-table-grid', + ELEM_GRID_DOWN = 'layui-table-grid-down', + ELEM_GRID_PANEL = 'layui-table-grid-panel', + gridExpand = function(hide) { + var othis = $(this), + elemCell = othis.children(ELEM_CELL); + + if (hide) { + othis.find('.layui-table-grid-down').remove(); + } else if (elemCell.prop('scrollWidth') > elemCell.outerWidth()) { + if (elemCell.find('.' + ELEM_GRID_DOWN)[0]) return; + othis.append('
      '); + } + }; + + //单元格展开事件 + that.layBody.on('click', '.' + ELEM_GRID_DOWN, function(e) { + var othis = $(this), + td = othis.parent(), + elemCell = td.children(ELEM_CELL); + + that.tipsIndex = layer.tips([ + '
      ', elemCell.html(), '
      ', '' + ].join(''), elemCell[0], { + tips: [3, ''], + time: -1, + anim: -1, + maxWidth: (device.ios || device.android) ? 300 : that.elem.width() / 2, + isOutAnim: false, + skin: 'layui-table-tips', + success: function(layero, index) { + layero.find('.layui-table-tips-c').on('click', function() { + layer.close(index); + }); + } + }); + + layui.stope(e); + }); + + //行工具条操作事件 + that.layBody.on('click', '*[lay-event]', function() { + var othis = $(this), + index = othis.parents('tr').eq(0).data('index'); + layui.event.call(this, MOD_NAME, 'tool(' + filter + ')', commonMember.call(this, { + event: othis.attr('lay-event') + })); + that.setThisRowChecked(index); + }); + + //同步滚动条 + that.layMain.on('scroll', function() { + var othis = $(this), + scrollLeft = othis.scrollLeft(), + scrollTop = othis.scrollTop(); + + that.layHeader.scrollLeft(scrollLeft); + that.layTotal.scrollLeft(scrollLeft); + that.layFixed.find(ELEM_BODY).scrollTop(scrollTop); + + layer.close(that.tipsIndex); + }); + + //全局点击 + _DOC.on('click', function() { + _DOC.trigger('table.remove.tool.panel'); + }); + + //工具面板移除事件 + _DOC.on('table.remove.tool.panel', function() { + $('.layui-table-tool-panel').remove(); + }); + + //自适应 + _WIN.on('resize', function() { + that.resize(); + }); + }; + + //初始化 + table.init = function(filter, settings) { + settings = settings || {}; + var that = this, + elemTable = filter ? $('table[lay-filter="' + filter + '"]') : $(ELEM + '[lay-data]'), + errorTips = 'Table element property lay-data configuration item has a syntax error: '; + + //遍历数据表格 + elemTable.each(function() { + var othis = $(this), + tableData = othis.attr('lay-data'); + + try { + tableData = new Function('return ' + tableData)(); + } catch (e) { + hint.error(errorTips + tableData) + } + + var cols = [], + options = $.extend({ + elem: this, + cols: [], + data: [], + skin: othis.attr('lay-skin') //风格 + , + size: othis.attr('lay-size') //尺寸 + , + even: typeof othis.attr('lay-even') === 'string' //偶数行背景 + }, table.config, settings, tableData); + + filter && othis.hide(); + + //获取表头数据 + othis.find('thead>tr').each(function(i) { + options.cols[i] = []; + $(this).children().each(function(ii) { + var th = $(this), + itemData = th.attr('lay-data'); + + try { + itemData = new Function('return ' + itemData)(); + } catch (e) { + return hint.error(errorTips + itemData) + } + + var row = $.extend({ + title: th.text(), + colspan: th.attr('colspan') || 0 //列单元格 + , + rowspan: th.attr('rowspan') || 0 //行单元格 + }, itemData); + + if (row.colspan < 2) cols.push(row); + options.cols[i].push(row); + }); + }); + + //获取表体数据 + othis.find('tbody>tr').each(function(i1) { + var tr = $(this), + row = {}; + //如果定义了字段名 + tr.children('td').each(function(i2, item2) { + var td = $(this), + field = td.data('field'); + if (field) { + return row[field] = td.html(); + } + }); + //如果未定义字段名 + layui.each(cols, function(i3, item3) { + var td = tr.children('td').eq(i3); + row[item3.field] = td.html(); + }); + options.data[i1] = row; + }); + table.render(options); + }); + + return that; + }; + + //记录所有实例 + thisTable.that = {}; //记录所有实例对象 + thisTable.config = {}; //记录所有实例配置项 + + //遍历表头 + table.eachCols = function(id, callback, cols) { + var config = thisTable.config[id] || {}, + arrs = [], + index = 0; + + cols = $.extend(true, [], cols || config.cols); + + //重新整理表头结构 + layui.each(cols, function(i1, item1) { + layui.each(item1, function(i2, item2) { + + //如果是组合列,则捕获对应的子列 + if (item2.colGroup) { + var childIndex = 0; + index++ + item2.CHILD_COLS = []; + + layui.each(cols[i1 + 1], function(i22, item22) { + //如果子列已经被标注为{PARENT_COL_INDEX},或者子列累计 colspan 数等于父列定义的 colspan,则跳出当前子列循环 + if (item22.PARENT_COL_INDEX || (childIndex > 1 && childIndex == item2.colspan)) return; + + item22.PARENT_COL_INDEX = index; + + item2.CHILD_COLS.push(item22); + childIndex = childIndex + parseInt(item22.colspan > 1 ? item22.colspan : 1); + }); + } + + if (item2.PARENT_COL_INDEX) return; //如果是子列,则不进行追加,因为已经存储在父列中 + arrs.push(item2) + }); + }); + + //重新遍历列,如果有子列,则进入递归 + var eachArrs = function(obj) { + layui.each(obj || arrs, function(i, item) { + if (item.CHILD_COLS) return eachArrs(item.CHILD_COLS); + typeof callback === 'function' && callback(i, item); + }); + }; + + eachArrs(); + }; + + //表格选中状态 + table.checkStatus = function(id) { + var nums = 0, + invalidNum = 0, + arr = [], + data = table.cache[id] || []; + //计算全选个数 + layui.each(data, function(i, item) { + if (item.constructor === Array) { + invalidNum++; //无效数据,或已删除的 + return; + } + if (item[table.config.checkName]) { + nums++; + arr.push(table.clearCacheKey(item)); + } + }); + return { + data: arr //选中的数据 + , + isAll: data.length ? (nums === (data.length - invalidNum)) : false //是否全选 + }; + }; + + //表格导出 + table.exportFile = function(id, data, type) { + data = data || table.clearCacheKey(table.cache[id]); + type = type || 'csv'; + + var config = thisTable.config[id] || {}, + textType = ({ + csv: 'text/csv', + xls: 'application/vnd.ms-excel' + })[type], + alink = document.createElement("a"); + + if (device.ie) return hint.error('IE_NOT_SUPPORT_EXPORTS'); + + alink.href = 'data:' + textType + ';charset=utf-8,\ufeff' + encodeURIComponent(function() { + var dataTitle = [], + dataMain = []; + layui.each(data, function(i1, item1) { + var vals = []; + if (typeof id === 'object') { //ID直接为表头数据 + layui.each(id, function(i, item) { + i1 == 0 && dataTitle.push(item || ''); + }); + layui.each(table.clearCacheKey(item1), function(i2, item2) { + vals.push(item2); + }); + } else { + table.eachCols(id, function(i3, item3) { + if (item3.field && item3.type == 'normal' && !item3.hide) { + i1 == 0 && dataTitle.push(item3.title || ''); + vals.push(item1[item3.field]); + } + }); + } + dataMain.push(vals.join(',')) + }); + + return dataTitle.join(',') + '\r\n' + dataMain.join('\r\n'); + }()); + + alink.download = (config.title || 'table_' + (config.index || '')) + '.' + type; + document.body.appendChild(alink); + alink.click(); + document.body.removeChild(alink); + }; + + //重置表格尺寸结构 + table.resize = function(id) { + //如果指定表格唯一 id,则只执行该 id 对应的表格实例 + if (id) { + var config = getThisTableConfig(id); //获取当前实例配置项 + if (!config) return; + + thisTable.that[id].resize(); + + } else { //否则重置所有表格实例尺寸 + layui.each(thisTable.that, function() { + this.resize(); + }); + } + }; + + //表格重载 + table.reload = function(id, options) { + options = options || {}; + + var config = getThisTableConfig(id); //获取当前实例配置项 + if (!config) return; + + if (options.data && options.data.constructor === Array) delete config.data; + return table.render($.extend(true, {}, config, options)); + }; + + //核心入口 + table.render = function(options) { + var inst = new Class(options); + return thisTable.call(inst); + }; + + //清除临时Key + table.clearCacheKey = function(data) { + data = $.extend({}, data); + delete data[table.config.checkName]; + delete data[table.config.indexName]; + return data; + }; + + //自动完成渲染 + table.init(); + + exports(MOD_NAME, table); +}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/tree.js b/admin/static/layui/layui/lay/modules/tree.js new file mode 100644 index 0000000..5fb42d7 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/tree.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('
        '),s=o(["
      • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
      • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
        '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/upload.js b/admin/static/layui/layui/lay/modules/upload.js new file mode 100644 index 0000000..b462890 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/upload.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,n=layui.hint(),a=layui.device(),o={config:{},set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,r,e,i)}},l=function(){var e=this;return{upload:function(i){e.upload.call(e,i)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var t=this;t.config=i.extend({},t.config,o.config,e),t.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var t=this,e=t.config;e.elem=i(e.elem),e.bindAction=i(e.bindAction),t.file(),t.events()},p.prototype.file=function(){var e=this,t=e.config,n=e.elemFile=i(['"].join("")),o=t.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&t.elem.wrap('
        '),e.isFile()?(e.elemFile=t.elem,t.field=t.elem[0].name):t.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,t=e.config,n=i(''),a=i(['
        ',"
        "].join(""));i("#"+f)[0]||i("body").append(n),t.elem.next().hasClass(f)||(e.elemFile.wrap(a),t.elem.next("."+f).append(function(){var e=[];return layui.each(t.data,function(i,t){t="function"==typeof t?t():t,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return t.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var i=this;window.FileReader&&layui.each(i.chooseFiles,function(i,t){var n=new FileReader;n.readAsDataURL(t),n.onload=function(){e&&e(i,t,this.result)}})},p.prototype.upload=function(e,t){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var t=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&t+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:t,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,i){i="function"==typeof i?i():i,r.append(e,i)}),i.ajax({url:l.url,type:l.method,data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(i){t++,d(e,i),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=i("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var i,t=e.contents().find("body");try{i=t.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}i&&(clearInterval(p.timer),t.html(""),d(0,i))},30)},d=function(e,i){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(i,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var i=[];return layui.each(e||o.chooseFiles,function(e,t){i.push(t.name)}),i}(),g={preview:function(e){o.preview(e)},upload:function(e,i){var t={};t[e]=i,o.upload(t)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,i){o.files[e]=i}),o.files}},y=function(){return"choose"===t?l.choose&&l.choose(g):(l.before&&l.before(g),a.ie?a.ie>9?u():c():void u())};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,i){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(i))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var i=0,t=e||o.files||o.chooseFiles||r.files;return layui.each(t,function(){i++}),i}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,i){if(i.size>1024*l.size){var t=l.size/1024;t=t>=1?t.toFixed(2)+"MB":l.size+"KB",r.value="",F=t}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,t=e.config,o=function(i){e.chooseFiles={},layui.each(i,function(i,t){var n=(new Date).getTime();e.chooseFiles[n+"-"+i]=t})},l=function(i,n){var a=e.elemFile,o=i.length>1?i.length+"个文件":(i[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||t.choose||a.after(''+o+"")};t.elem.off("upload.start").on("upload.start",function(){var a=i(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=i.extend({},t,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||t.elem.off("upload.over").on("upload.over",function(){var e=i(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=i(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=i(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),t.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var i=this.files||[];o(i),t.auto?e.upload():l(i)}),t.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),t.elem.data("haveEvents")||(e.elemFile.on("change",function(){i(this).trigger("upload.change")}),t.elem.on("click",function(){e.isFile()||i(this).trigger("upload.start")}),t.drag&&t.elem.on("dragover",function(e){e.preventDefault(),i(this).trigger("upload.over")}).on("dragleave",function(e){i(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),i(this).trigger("upload.drop",e)}),t.bindAction.on("click",function(){i(this).trigger("upload.action")}),t.elem.data("haveEvents",!0))},o.render=function(e){var i=new p(e);return l.call(i)},e(r,o)}); \ No newline at end of file diff --git a/admin/static/layui/layui/lay/modules/util.js b/admin/static/layui/layui/lay/modules/util.js new file mode 100644 index 0000000..3c056a0 --- /dev/null +++ b/admin/static/layui/layui/lay/modules/util.js @@ -0,0 +1,227 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ +; layui.define("jquery", function (t) { + "use strict"; + var e = layui.$, i = { + fixbar: function (t) { + var i, n, a = "layui-fixbar", o = "layui-fixbar-top", r = e(document), l = e("body"); + t = e.extend({ showHeight: 200 }, t), t.bar1 = t.bar1 === !0 ? "" : t.bar1, t.bar2 = t.bar2 === !0 ? "" : t.bar2, t.bgcolor = t.bgcolor ? "background-color:" + t.bgcolor : ""; + var c = [t.bar1, t.bar2, ""], + g = e(['
          ', t.bar1 ? '
        • ' + c[0] + "
        • " : "", t.bar2 ? '
        • ' + c[1] + "
        • " : "", '
        • ' + c[2] + "
        • ", "
        "].join("")), + s = g.find("." + o), u = function () { + var e = r.scrollTop(); + e >= t.showHeight ? i || (s.show(), i = 1) : i && (s.hide(), i = 0) + }; + e("." + a)[0] || ("object" == typeof t.css && g.css(t.css), l.append(g), u(), g.find("li").on("click", function () { + var i = e(this), n = i.attr("lay-type"); + "top" === n && e("html,body").animate({ scrollTop: 0 }, 200), t.click && t.click.call(this, n) + }), r.on("scroll", function () { + clearTimeout(n), n = setTimeout(function () { + u() + }, 100) + })) + }, countdown: function (t, e, i) { + var n = this, a = "function" == typeof e, o = new Date(t).getTime(), + r = new Date(!e || a ? (new Date).getTime() : e).getTime(), l = o - r, + c = [Math.floor(l / 864e5), Math.floor(l / 36e5) % 24, Math.floor(l / 6e4) % 60, Math.floor(l / 1e3) % 60]; + a && (i = e); + var g = setTimeout(function () { + n.countdown(t, r + 1e3, i) + }, 1e3); + return i && i(l > 0 ? c : [0, 0, 0, 0], e, g), l <= 0 && clearTimeout(g), g + }, timeAgo: function (t, e) { + var i = this, n = [[], []], a = (new Date).getTime() - new Date(t).getTime(); + return a > 6912e5 ? (a = new Date(t), n[0][0] = i.digit(a.getFullYear(), 4), n[0][1] = i.digit(a.getMonth() + 1), n[0][2] = i.digit(a.getDate()), e || (n[1][0] = i.digit(a.getHours()), n[1][1] = i.digit(a.getMinutes()), n[1][2] = i.digit(a.getSeconds())), n[0].join("-") + " " + n[1].join(":")) : a >= 864e5 ? (a / 1e3 / 60 / 60 / 24 | 0) + "天前" : a >= 36e5 ? (a / 1e3 / 60 / 60 | 0) + "小时前" : a >= 12e4 ? (a / 1e3 / 60 | 0) + "分钟前" : a < 0 ? "未来" : "刚刚" + }, digit: function (t, e) { + var i = ""; + t = String(t), e = e || 2; + for (var n = t.length; n < e; n++) i += "0"; + return t < Math.pow(10, e) ? i + (0 | t) : t + }, toDateString: function (t, e) { + var i = this, n = new Date(t || new Date), + a = [i.digit(n.getFullYear(), 4), i.digit(n.getMonth() + 1), i.digit(n.getDate())], + o = [i.digit(n.getHours()), i.digit(n.getMinutes()), i.digit(n.getSeconds())]; + return e = e || "yyyy-MM-dd HH:mm:ss", e.replace(/yyyy/g, a[0]).replace(/MM/g, a[1]).replace(/dd/g, a[2]).replace(/HH/g, o[0]).replace(/mm/g, o[1]).replace(/ss/g, o[2]) + }, escape: function (t) { + return String(t || "").replace(/&(?!#?[a-zA-Z0-9]+;)/g, "&").replace(//g, ">").replace(/'/g, "'").replace(/"/g, """) + }, event: function (t, n, a) { + n = i.event[t] = e.extend(!0, i.event[t], n) || {}, e("body").on(a || "click", "*[" + t + "]", function () { + var i = e(this), a = i.attr(t); + n[a] && n[a].call(this, i) + }) + }, + + /** + * 扩展util 类 + * renderTplView 渲染模版视图 + */ + renderTplView: function (options) { + var $options = e.extend({}, options) + layui.laytpl(document.getElementById($options.tplId).innerHTML).render(!$options.data ? {} : $options.data, function (html) { + if ($options.before) { + html = $options.before(html) + } + if ($options.getHtml) { + $options.getHtml(html) + } + var tarId = $options.tarId + if (tarId) { + var tar = document.getElementById(tarId) + if (tar) { + tar.innerHTML = html; + } + } + }); + }, + createRow: function ($this, claz, func) { + claz = claz == undefined || claz == '' ? ".layui-form-item" : claz + var target = e($this).closest(claz) + var clone = target.clone() + e(clone).find("input").each(function (index, item) { + e(item).val("") + }) + e(clone).find("select").each(function (index, item) { + e(item).val("") + }) + target.after(clone) + layui.form.render() + if (func) { + func($this) + } + }, + removeRow: function ($this, claz, func) { + claz = claz == undefined || claz == '' ? ".layui-form-item" : claz + var cuur = e($this).closest(claz); + if (cuur != undefined) { + var prev = cuur.prev(); + if (prev.hasClass('rowclone')) { + cuur.remove() + } else { + layui.layer.msg('本行记录不能进行删除操作'); + } + } + if (func) { + func($this) + } + }, + parseQueryString: function (param) { + var url = window.location.search + var up = new Object() + if (url.indexOf("?") != -1) { + var str = url.substr(1) + var str2 = str.split("&") + for (var i = 0; i < str2.length; i++) { + up[str2[i].split("=")[0]] = decodeURI(str2[i].split("=")[1]) + } + } + return up[param] + }, + mergeStr: function (arrays, merge) { + if (!arrays) { + return ""; + } + var str = ""; + for (var i = 0; i < arrays.length; i++) { + str = str + arrays[i] + (merge ? merge : "") + + } + if (str && str.length > 0) { + str = str.substring(0, str.length - 1) + } + return str; + }, + Map: function () { + this.map = new Object(); + this.length = 0; + + this.size = function () { + return this.length; + }; + + this.put = function (key, value) { + if (!this.map['_' + key]) { + ++this.length; + } + this.map['_' + key] = value; + }; + + this.remove = function (key) { + if (this.map['_' + key]) { + --this.length; + return delete this.map['_' + key]; + } else { + return false; + } + }; + + this.containsKey = function (key) { + return this.map['_' + key] ? true : false; + }; + + this.get = function (key) { + if (key) { + var splitstr = key.substring(0, 1); + if (splitstr === '_') { + return this.map[key] ? this.map[key] : null; + } + } + return this.map['_' + key] ? this.map['_' + key] : null; + }; + + this.poll = function (key) { + var val = this.get(key); + this.remove(key); + return val; + }; + this.eachKey = function () { + var keys = [] + for (var key in this.map) { + keys.push(key.substring(1, key.length)) + } + return keys + }; + this.inspect = function () { + var str = ''; + for (var each in this.map) { + str += '\n' + each + ' Value:' + this.map[each]; + } + return str; + } + } + + }; + !function (t, e, i) { + "$:nomunge"; + + function n() { + a = e[l](function () { + o.each(function () { + var e = t(this), i = e.width(), n = e.height(), a = t.data(this, g); + (i !== a.w || n !== a.h) && e.trigger(c, [a.w = i, a.h = n]) + }), n() + }, r[s]) + } + + var a, o = t([]), r = t.resize = t.extend(t.resize, {}), l = "setTimeout", c = "resize", + g = c + "-special-event", s = "delay", u = "throttleWindow"; + r[s] = 250, r[u] = !0, t.event.special[c] = { + setup: function () { + if (!r[u] && this[l]) return !1; + var e = t(this); + o = o.add(e), t.data(this, g, { w: e.width(), h: e.height() }), 1 === o.length && n() + }, teardown: function () { + if (!r[u] && this[l]) return !1; + var e = t(this); + o = o.not(e), e.removeData(g), o.length || clearTimeout(a) + }, add: function (e) { + function n(e, n, o) { + var r = t(this), l = t.data(this, g) || {}; + l.w = n !== i ? n : r.width(), l.h = o !== i ? o : r.height(), a.apply(this, arguments) + } + + if (!r[u] && this[l]) return !1; + var a; + return t.isFunction(e) ? (a = e, n) : (a = e.handler, void (e.handler = n)) + } + } + }(e, window), t("util", i) +}); \ No newline at end of file diff --git a/admin/static/layui/layui/layui.all.js b/admin/static/layui/layui/layui.all.js new file mode 100644 index 0000000..250395a --- /dev/null +++ b/admin/static/layui/layui/layui.all.js @@ -0,0 +1,5 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;!function(e){"use strict";var t=document,n={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.3.0-rc1"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,o=n.length-1,r=o;r>0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[o].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",rate:"modules/rate",carousel:"modules/carousel",flow:"modules/flow",util:"modules/util",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};o.prototype.cache=n,o.prototype.define=function(e,t){var o=this,r="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(o,r){e(o,r),n.callback[o]=function(){t(e)}}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?a.call(o):(o.use(e,a),o)},o.prototype.use=function(e,o,l){function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||o.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[d]=t,f.removeChild(v),function r(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void(n.status[d]?c():setTimeout(r,4))}())}function c(){l.push(layui[d]),e.length>1?y.use(e.slice(1),o,l):"function"==typeof o&&o.apply(layui,l)}var y=this,p=n.dir=n.dir?n.dir:r,f=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var d=e[0],m=0;if(l=l||[],n.host=n.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[d]||!layui["layui.all"]&&layui["layui.mobile"]&&u[d])return c(),y;if(n.modules[d])!function g(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void("string"==typeof n.modules[d]&&n.status[d]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[d]?p+"lay/":/^\{\/\}/.test(y.modules[d])?"":n.base||"")+(y.modules[d]||d)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),f.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||i?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),n.modules[d]=h}return y},o.prototype.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},o.prototype.link=function(e,o,r){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof o&&(r=o);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof o?i:(function p(){return++y>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(c),"width"))?function(){o()}():setTimeout(p,100))}(),i)},n.callback={},o.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},o.prototype.addcss=function(e,t,o){return layui.link(n.dir+"css/"+e,t,o)},o.prototype.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,"function"==typeof t&&t(o)},void(o.onerror=function(e){o.onerror=null,"function"==typeof n&&n(e)}))},o.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},o.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),o.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},o.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},o.prototype.data=function(t,n,o){if(t=t||"layui",o=o||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete o[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(o[t])}catch(a){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],o[t]=JSON.stringify(r),n.key?r[n.key]:r}},o.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},o.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),o=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:o("micromessenger")};return t&&!r[t]&&(r[t]=o(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r},o.prototype.hint=function(){return{error:a}},o.prototype.each=function(e,t){var n,o=this;if("function"!=typeof t)return o;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;na?1:r/g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
        ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
        "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,n=t.length-1,a=n;a>0;a--)if("interactive"===t[a].readyState){e=t[a].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var t=this;return t.config=w.extend({},t.config,e),t},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!1,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s0&&t-1 in e)}function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Ce.test(t))return pe.filter(t,e,n);t=pe.filter(t,e)}return pe.grep(e,function(e){return pe.inArray(e,t)>-1!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function a(){re.addEventListener?(re.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s)):(re.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(re.addEventListener||"load"===e.event.type||"complete"===re.readyState)&&(a(),pe.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(_e,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?pe.parseJSON(n):n)}catch(i){}pe.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=ne.pop()||pe.guid++:a),u[l]||(u[l]=s?{}:{toJSON:pe.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[l]=pe.extend(u[l],t):u[l].data=pe.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[pe.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[pe.camelCase(t)])):i=o,i}}function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe.expando]:pe.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){pe.isArray(t)?t=t.concat(pe.map(t,pe.camelCase)):t in r?t=[t]:(t=pe.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!pe.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?pe.cleanData([e],!0):fe.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return pe.css(e,t,"")},u=s(),l=n&&n[3]||(pe.cssNumber[t]?"":"px"),c=(pe.cssNumber[t]||"px"!==l&&+u)&&Me.exec(pe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,pe.style(e,t,c+l);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||pe.nodeName(r,t)?o.push(r):pe.merge(o,h(r,t));return void 0===t||t&&pe.nodeName(e,t)?pe.merge([e],o):o}function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval",!t||pe._data(t[r],"globalEval"))}function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x"!==f[1]||Ve.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)pe.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(pe.merge(v,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=y.lastChild}else v.push(t.createTextNode(a));for(u&&y.removeChild(u),fe.appendChecked||pe.grep(h(v,"input"),m),x=0;a=v[x++];)if(r&&pe.inArray(a,r)>-1)i&&i.push(a);else if(s=pe.contains(a.ownerDocument,a),u=h(y.appendChild(a),"script"),s&&g(u),n)for(o=0;a=u[o++];)Ie.test(a.type||"")&&n.push(a);return u=null,y}function v(){return!0}function x(){return!1}function b(){try{return re.activeElement}catch(e){}}function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)w(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=x;else if(!i)return e;return 1===o&&(a=i,i=function(e){return pe().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=pe.guid++)),e.each(function(){pe.event.add(this,t,i,r,n)})}function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e),a=pe._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;r1&&"string"==typeof p&&!fe.checkClone&&rt.test(p))return e.each(function(i){var o=e.eq(i);g&&(t[0]=p.call(this,i,o.html())),S(o,t,n,r)});if(f&&(l=y(t,e[0].ownerDocument,!1,e,r),i=l.firstChild,1===l.childNodes.length&&(l=i),i||r)){for(s=pe.map(h(l,"script"),C),a=s.length;c")).appendTo(t.documentElement),t=(ut[0].contentWindow||ut[0].contentDocument).document,t.write(),t.close(),n=D(e,t),ut.detach()),lt[e]=n),n}function L(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Ct.length;n--;)if(e=Ct[n]+t,e in Et)return e}function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==pe.type(e)||e.nodeType||pe.isWindow(e))return!1;try{if(e.constructor&&!ce.call(e,"constructor")&&!ce.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!fe.ownFirst)for(t in e)return ce.call(e,t);for(t in e);return void 0===t||ce.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ue[le.call(e)]||"object":typeof e},globalEval:function(t){t&&pe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ge,"ms-").replace(me,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var r,i=0;if(n(e))for(r=e.length;iT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(a[l]=f))}}else x=m(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",g=r&&[],y=[],v=A,x=r||o&&T.find.TAG("*",l),b=W+=null==v?1:Math.random()||.1,w=x.length;for(l&&(A=a===H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===H||(L(c),s=!_);d=e[f++];)if(d(c,a||H,s)){u.push(c);break}l&&(W=b)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,y,a,s);if(r){if(p>0)for(;h--;)g[h]||y[h]||(y[h]=G.call(u));y=m(y)}Q.apply(u,y),l&&!r&&y.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=b,A=v),g};return i?r(a):a}var b,w,T,C,E,N,k,S,A,D,j,L,H,q,_,F,M,O,R,P="sizzle"+1*new Date,B=e.document,W=0,I=0,$=n(),z=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,Y={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),de=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){L()};try{Q.apply(J=Z.call(B.childNodes),B.childNodes),J[B.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=H.documentElement,_=!E(H),(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(H.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!H.getElementsByName||!H.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&_)return t.getElementsByClassName(e)},M=[],F=[],(w.qsa=me.test(H.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=me.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),M=M.length&&new RegExp(M.join("|")),t=me.test(q.compareDocumentPosition),R=t||me.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===H||e.ownerDocument===B&&R(B,e)?-1:t===H||t.ownerDocument===B&&R(B,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===H?-1:t===H?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(ce,"='$1']"),w.matchesSelector&&_&&!X[n+" "]&&(!M||!M.test(n))&&(!F||!F.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),R(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,we),e[3]=(e[3]||e[4]||e[5]||"").replace(be,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=N(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s,x=!1;if(m){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(d=m,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}), +l=c[e]||[],p=l[0]===W&&l[1],x=p&&l[2],d=p&&m.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[W,p,x];break}}else if(v&&(d=t,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p),x===!1)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(v&&(f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[W,x]),d!==t)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,we).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,we),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,we),ve.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e)return Q.apply(n,r),n;break}}return(l||k(e,f))(r,t,!_,n,!t||ve.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);pe.find=ve,pe.expr=ve.selectors,pe.expr[":"]=pe.expr.pseudos,pe.uniqueSort=pe.unique=ve.uniqueSort,pe.text=ve.getText,pe.isXMLDoc=ve.isXML,pe.contains=ve.contains;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&pe(e).is(n))break;r.push(e)}return r},be=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=pe.expr.match.needsContext,Te=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ce=/^.[^:#\[\.,]*$/;pe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pe.find.matchesSelector(r,e)?[r]:[]:pe.find.matches(e,pe.grep(t,function(e){return 1===e.nodeType}))},pe.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(pe(e).filter(function(){for(t=0;t1?pe.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&we.test(e)?pe(e):e||[],!1).length}});var Ee,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ke=pe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Ne.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof pe?t[0]:t,pe.merge(this,pe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:re,!0)),Te.test(r[1])&&pe.isPlainObject(t))for(r in t)pe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=re.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Ee.find(e);this.length=1,this[0]=i}return this.context=re,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pe.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(pe):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),pe.makeArray(e,this))};ke.prototype=pe.fn,Ee=pe(re);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};pe.fn.extend({has:function(e){var t,n=pe(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:1===n.nodeType&&pe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?pe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?pe.inArray(this[0],pe(e)):pe.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(pe.uniqueSort(pe.merge(this.get(),pe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return be((e.parentNode||{}).firstChild,e)},children:function(e){return be(e.firstChild)},contents:function(e){return pe.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pe.merge([],e.childNodes)}},function(e,t){pe.fn[e]=function(n,r){var i=pe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=pe.filter(r,i)),this.length>1&&(Ae[e]||(i=pe.uniqueSort(i)),Se.test(e)&&(i=i.reverse())),this.pushStack(i)}});var De=/\S+/g;pe.Callbacks=function(e){e="string"==typeof e?o(e):pe.extend({},e);var t,n,r,i,a=[],s=[],u=-1,l=function(){for(i=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u-1;)a.splice(n,1),n<=u&&u--}),this},has:function(e){return e?pe.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=!0,n||c.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},pe.extend({Deferred:function(e){var t=[["resolve","done",pe.Callbacks("once memory"),"resolved"],["reject","fail",pe.Callbacks("once memory"),"rejected"],["notify","progress",pe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pe.Deferred(function(n){pe.each(t,function(t,o){var a=pe.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&pe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pe.extend(e,r):r}},i={};return r.pipe=r.then,pe.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ie.call(arguments),a=o.length,s=1!==a||e&&pe.isFunction(e.promise)?a:0,u=1===s?e:pe.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ie.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);i0||(je.resolveWith(re,[pe]),pe.fn.triggerHandler&&(pe(re).triggerHandler("ready"),pe(re).off("ready"))))}}),pe.ready.promise=function(t){if(!je)if(je=pe.Deferred(),"complete"===re.readyState||"loading"!==re.readyState&&!re.documentElement.doScroll)e.setTimeout(pe.ready);else if(re.addEventListener)re.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s);else{re.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&re.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!pe.isReady){try{n.doScroll("left")}catch(t){return e.setTimeout(i,50)}a(),pe.ready()}}()}return je.promise(t)},pe.ready.promise();var Le;for(Le in pe(fe))break;fe.ownFirst="0"===Le,fe.inlineBlockNeedsLayout=!1,pe(function(){var e,t,n,r;n=re.getElementsByTagName("body")[0],n&&n.style&&(t=re.createElement("div"),r=re.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",fe.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=re.createElement("div");fe.deleteExpando=!0;try{delete e.test}catch(t){fe.deleteExpando=!1}e=null}();var He=function(e){var t=pe.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)},qe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;pe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pe.cache[e[pe.expando]]:e[pe.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return f(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return f(e,t,!0)}}),pe.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=pe.data(o),1===o.nodeType&&!pe._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=pe.camelCase(r.slice(5)),u(o,r,i[r])));pe._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pe.data(this,e)}):arguments.length>1?this.each(function(){pe.data(this,e,t)}):o?u(o,e,pe.data(o,e)):void 0},removeData:function(e){return this.each(function(){pe.removeData(this,e)})}}),pe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=pe._data(e,t),n&&(!r||pe.isArray(n)?r=pe._data(e,t,pe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=pe.queue(e,t),r=n.length,i=n.shift(),o=pe._queueHooks(e,t),a=function(){pe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pe._data(e,n)||pe._data(e,n,{empty:pe.Callbacks("once memory").add(function(){pe._removeData(e,t+"queue"),pe._removeData(e,n)})})}}),pe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length
        a",fe.leadingWhitespace=3===e.firstChild.nodeType,fe.tbody=!e.getElementsByTagName("tbody").length,fe.htmlSerialize=!!e.getElementsByTagName("link").length,fe.html5Clone="<:nav>"!==re.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),fe.appendChecked=n.checked,e.innerHTML="",fe.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=re.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),fe.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.noCloneEvent=!!e.addEventListener,e[pe.expando]=1,fe.attributes=!e.getAttribute(pe.expando)}();var Xe={option:[1,""],legend:[1,"
        ","
        "],area:[1,"",""],param:[1,"",""],thead:[1,"","
        "],tr:[2,"","
        "],col:[2,"","
        "],td:[3,"","
        "],_default:fe.htmlSerialize?[0,"",""]:[1,"X
        ","
        "]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var Ue=/<|&#?\w+;/,Ve=/-1&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[pe.expando]?t:new pe.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:pe.makeArray(n,[t]),l=pe.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!pe.isWindow(r)){for(u=l.delegateType||p,Ke.test(u+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),c=s;c===(r.ownerDocument||re)&&d.push(c.defaultView||c.parentWindow||e)}for(f=0;(s=d[f++])&&!t.isPropagationStopped();)t.type=f>1?u:l.bindType||p,o=(pe._data(s,"events")||{})[t.type]&&pe._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&He(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&He(r)&&a&&r[p]&&!pe.isWindow(r)){c=r[a],c&&(r[a]=null),pe.event.triggered=p;try{r[p]()}catch(g){}pe.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=pe.event.fix(e);var t,n,r,i,o,a=[],s=ie.call(arguments),u=(pe._data(this,"events")||{})[e.type]||[],l=pe.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=pe.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((pe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;n-1:pe.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s]","i"),tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt=/\s*$/g,at=p(re),st=at.appendChild(re.createElement("div"));pe.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var r,i,o,a,s,u=pe.contains(e.ownerDocument,e);if(fe.html5Clone||pe.isXMLDoc(e)||!et.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(st.innerHTML=e.outerHTML,st.removeChild(o=st.firstChild)),!(fe.noCloneEvent&&fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pe.isXMLDoc(e)))for(r=h(o),s=h(e),a=0;null!=(i=s[a]);++a)r[a]&&k(i,r[a]);if(t)if(n)for(s=s||h(e),r=r||h(o),a=0;null!=(i=s[a]);a++)N(i,r[a]);else N(e,o);return r=h(o,"script"),r.length>0&&g(r,!u&&h(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=pe.expando,u=pe.cache,l=fe.attributes,c=pe.event.special;null!=(n=e[a]);a++)if((t||He(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?pe.event.remove(n,r):pe.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ne.push(i))}}}),pe.fn.extend({domManip:S,detach:function(e){return A(this,e,!0)},remove:function(e){return A(this,e)},text:function(e){return Pe(this,function(e){return void 0===e?pe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||re).createTextNode(e))},null,e,arguments.length)},append:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.appendChild(e)}})},prepend:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&pe.cleanData(h(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pe.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return pe.clone(this,e,t)})},html:function(e){return Pe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ze,""):void 0;if("string"==typeof e&&!nt.test(e)&&(fe.htmlSerialize||!et.test(e))&&(fe.leadingWhitespace||!$e.test(e))&&!Xe[(We.exec(e)||["",""])[1].toLowerCase()]){e=pe.htmlPrefilter(e);try{for(;nt",t=l.getElementsByTagName("td"),t[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===t[0].offsetHeight,o&&(t[0].style.display="",t[1].style.display="none",o=0===t[0].offsetHeight)),f.removeChild(u)}var n,r,i,o,a,s,u=re.createElement("div"),l=re.createElement("div");l.style&&(l.style.cssText="float:left;opacity:.5",fe.opacity="0.5"===l.style.opacity,fe.cssFloat=!!l.style.cssFloat,l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===l.style.backgroundClip,u=re.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",l.innerHTML="",u.appendChild(l),fe.boxSizing=""===l.style.boxSizing||""===l.style.MozBoxSizing||""===l.style.WebkitBoxSizing,pe.extend(fe,{reliableHiddenOffsets:function(){return null==n&&t(),o},boxSizingReliable:function(){return null==n&&t(),i},pixelMarginRight:function(){return null==n&&t(),r},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),a},reliableMarginLeft:function(){return null==n&&t(),s}}))}();var ht,gt,mt=/^(top|right|bottom|left)$/;e.getComputedStyle?(ht=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||pe.contains(e.ownerDocument,e)||(a=pe.style(e,t)),n&&!fe.pixelMarginRight()&&ft.test(a)&&ct.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):pt.currentStyle&&(ht=function(e){return e.currentStyle},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),ft.test(a)&&!mt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var yt=/alpha\([^)]*\)/i,vt=/opacity\s*=\s*([^)]*)/i,xt=/^(none|table(?!-c[ea]).+)/,bt=new RegExp("^("+Fe+")(.*)$","i"),wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"},Ct=["Webkit","O","Moz","ms"],Et=re.createElement("div").style;pe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=gt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":fe.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=pe.camelCase(t),u=e.style;if(t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Me.exec(n))&&i[1]&&(n=d(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(pe.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=pe.camelCase(t);return t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=gt(e,t,r)),"normal"===o&&t in Tt&&(o=Tt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),pe.each(["height","width"],function(e,t){pe.cssHooks[t]={get:function(e,n,r){if(n)return xt.test(pe.css(e,"display"))&&0===e.offsetWidth?dt(e,wt,function(){return M(e,t,r)}):M(e,t,r)},set:function(e,n,r){var i=r&&ht(e);return _(e,n,r?F(e,t,r,fe.boxSizing&&"border-box"===pe.css(e,"boxSizing",!1,i),i):0)}}}),fe.opacity||(pe.cssHooks.opacity={get:function(e,t){return vt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=pe.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pe.trim(o.replace(yt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=yt.test(o)?o.replace(yt,i):o+" "+i)}}),pe.cssHooks.marginRight=L(fe.reliableMarginRight,function(e,t){if(t)return dt(e,{display:"inline-block"},gt,[e,"marginRight"])}),pe.cssHooks.marginLeft=L(fe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(gt(e,"marginLeft"))||(pe.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px"}),pe.each({margin:"",padding:"",border:"Width"},function(e,t){pe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+Oe[r]+t]=o[r]||o[r-2]||o[0];return i}},ct.test(e)||(pe.cssHooks[e+t].set=_)}),pe.fn.extend({css:function(e,t){return Pe(this,function(e,t,n){var r,i,o={},a=0;if(pe.isArray(t)){for(r=ht(e),i=t.length;a1)},show:function(){return q(this,!0)},hide:function(){return q(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Re(this)?pe(this).show():pe(this).hide()})}}),pe.Tween=O,O.prototype={constructor:O,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||pe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(pe.cssNumber[n]?"":"px")},cur:function(){var e=O.propHooks[this.prop];return e&&e.get?e.get(this):O.propHooks._default.get(this)},run:function(e){var t,n=O.propHooks[this.prop];return this.options.duration?this.pos=t=pe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=pe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){pe.fx.step[e.prop]?pe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[pe.cssProps[e.prop]]&&!pe.cssHooks[e.prop]?e.elem[e.prop]=e.now:pe.style(e.elem,e.prop,e.now+e.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},pe.fx=O.prototype.init,pe.fx.step={};var Nt,kt,St=/^(?:toggle|show|hide)$/,At=/queueHooks$/;pe.Animation=pe.extend($,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,Me.exec(t),n),n}]},tweener:function(e,t){pe.isFunction(e)?(t=e,e=["*"]):e=e.match(De);for(var n,r=0,i=e.length;r
        a",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",fe.getSetAttribute="t"!==n.className,fe.style=/top/.test(e.getAttribute("style")),fe.hrefNormalized="/a"===e.getAttribute("href"),fe.checkOn=!!t.value,fe.optSelected=i.selected,fe.enctype=!!re.createElement("form").enctype,r.disabled=!0,fe.optDisabled=!i.disabled,t=re.createElement("input"),t.setAttribute("value",""),fe.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),fe.radioValue="t"===t.value}();var Dt=/\r/g,jt=/[\x20\t\r\n\f]+/g;pe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=pe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,pe(this).val()):e,null==i?i="":"number"==typeof i?i+="":pe.isArray(i)&&(i=pe.map(i,function(e){return null==e?"":e+""})),t=pe.valHooks[this.type]||pe.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=pe.valHooks[i.type]||pe.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Dt,""):null==n?"":n)}}}),pe.extend({valHooks:{option:{get:function(e){var t=pe.find.attr(e,"value");return null!=t?t:pe.trim(pe.text(e)).replace(jt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,a=o?null:[],s=o?i+1:r.length,u=i<0?s:o?i:0;u-1)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),pe.each(["radio","checkbox"],function(){pe.valHooks[this]={set:function(e,t){if(pe.isArray(t))return e.checked=pe.inArray(pe(e).val(),t)>-1}},fe.checkOn||(pe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Lt,Ht,qt=pe.expr.attrHandle,_t=/^(?:checked|selected)$/i,Ft=fe.getSetAttribute,Mt=fe.input;pe.fn.extend({attr:function(e,t){return Pe(this,pe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pe.removeAttr(this,e)})}}),pe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?pe.prop(e,t,n):(1===o&&pe.isXMLDoc(e)||(t=t.toLowerCase(),i=pe.attrHooks[t]||(pe.expr.match.bool.test(t)?Ht:Lt)),void 0!==n?null===n?void pe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=pe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&pe.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(De);if(o&&1===e.nodeType)for(;n=o[i++];)r=pe.propFix[n]||n,pe.expr.match.bool.test(n)?Mt&&Ft||!_t.test(n)?e[r]=!1:e[pe.camelCase("default-"+n)]=e[r]=!1:pe.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Ht={set:function(e,t,n){return t===!1?pe.removeAttr(e,n):Mt&&Ft||!_t.test(n)?e.setAttribute(!Ft&&pe.propFix[n]||n,n):e[pe.camelCase("default-"+n)]=e[n]=!0,n}},pe.each(pe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=qt[t]||pe.find.attr;Mt&&Ft||!_t.test(t)?qt[t]=function(e,t,r){var i,o;return r||(o=qt[t],qt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,qt[t]=o),i}:qt[t]=function(e,t,n){if(!n)return e[pe.camelCase("default-"+t)]?t.toLowerCase():null}}),Mt&&Ft||(pe.attrHooks.value={set:function(e,t,n){return pe.nodeName(e,"input")?void(e.defaultValue=t):Lt&&Lt.set(e,t,n)}}),Ft||(Lt={set:function(e,t,n){var r=e.getAttributeNode(n);if(r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n))return t}},qt.id=qt.name=qt.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},pe.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:Lt.set},pe.attrHooks.contenteditable={set:function(e,t,n){Lt.set(e,""!==t&&t,n)}},pe.each(["width","height"],function(e,t){pe.attrHooks[t]={set:function(e,n){if(""===n)return e.setAttribute(t,"auto"),n}}})),fe.style||(pe.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ot=/^(?:input|select|textarea|button|object)$/i,Rt=/^(?:a|area)$/i;pe.fn.extend({prop:function(e,t){return Pe(this,pe.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pe.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),pe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&pe.isXMLDoc(e)||(t=pe.propFix[t]||t,i=pe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=pe.find.attr(e,"tabindex");return t?parseInt(t,10):Ot.test(e.nodeName)||Rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.hrefNormalized||pe.each(["href","src"],function(e,t){pe.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),fe.optSelected||(pe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),pe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pe.propFix[this.toLowerCase()]=this}),fe.enctype||(pe.propFix.enctype="encoding");var Pt=/[\t\r\n\f]/g;pe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).addClass(e.call(this,t,z(this)))});if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).removeClass(e.call(this,t,z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):pe.isFunction(e)?this.each(function(n){pe(this).toggleClass(e.call(this,n,z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=pe(this),o=e.match(De)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=z(this),t&&pe._data(this,"__className__",t),pe.attr(this,"class",t||e===!1?"":pe._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(n)+" ").replace(Pt," ").indexOf(t)>-1)return!0;return!1}}),pe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){pe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var Bt=e.location,Wt=pe.now(),It=/\?/,$t=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;pe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=pe.trim(t+"");return i&&!pe.trim(i.replace($t,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():pe.error("Invalid JSON: "+t)},pe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new e.DOMParser,n=r.parseFromString(t,"text/xml")):(n=new e.ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||pe.error("Invalid XML: "+t),n};var zt=/#.*$/,Xt=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Vt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Gt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Kt={},Qt={},Zt="*/".concat("*"),en=Bt.href,tn=Gt.exec(en.toLowerCase())||[];pe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:en,type:"GET",isLocal:Vt.test(tn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":pe.parseJSON,"text xml":pe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?V(V(e,pe.ajaxSettings),t):V(pe.ajaxSettings,e)},ajaxPrefilter:X(Kt),ajaxTransport:X(Qt),ajax:function(t,n){function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c=void 0,s=i||"",T.readyState=t>0?4:0,o=t>=200&&t<300||304===t,r&&(x=Y(d,T,r)),x=J(d,x,T,o),o?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pe.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(pe.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,f=x.data,v=x.error,o=!v)):(v=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",o?g.resolveWith(p,[f,C,T]):g.rejectWith(p,[T,C,v]),T.statusCode(y),y=void 0,l&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?f:v]),m.fireWith(p,[T,C]),l&&(h.trigger("ajaxComplete",[T,d]),--pe.active||pe.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,d=pe.ajaxSetup({},n),p=d.context||d,h=d.context&&(p.nodeType||p.jquery)?pe(p):pe.event,g=pe.Deferred(),m=pe.Callbacks("once memory"),y=d.statusCode||{},v={},x={},b=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!f)for(f={};t=Ut.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=x[n]=x[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)y[t]=[y[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(g.promise(T).complete=m.add,T.success=T.done,T.error=T.fail,d.url=((t||d.url||en)+"").replace(zt,"").replace(Jt,tn[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=pe.trim(d.dataType||"*").toLowerCase().match(De)||[""],null==d.crossDomain&&(i=Gt.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===tn[1]&&i[2]===tn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(tn[3]||("http:"===tn[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=pe.param(d.data,d.traditional)),U(Kt,d,n,T),2===b)return T;l=pe.event&&d.global,l&&0===pe.active++&&pe.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Yt.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(It.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Xt.test(a)?a.replace(Xt,"$1_="+Wt++):a+(It.test(a)?"&":"?")+"_="+Wt++)),d.ifModified&&(pe.lastModified[a]&&T.setRequestHeader("If-Modified-Since",pe.lastModified[a]),pe.etag[a]&&T.setRequestHeader("If-None-Match",pe.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Zt+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(p,T,d)===!1||2===b))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=U(Qt,d,n,T)){if(T.readyState=1,l&&h.trigger("ajaxSend",[T,d]),2===b)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{b=1,c.send(v,r)}catch(C){if(!(b<2))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pe.get(e,t,n,"json")},getScript:function(e,t){return pe.get(e,void 0,t,"script")}}),pe.each(["get","post"],function(e,t){pe[t]=function(e,n,r,i){return pe.isFunction(n)&&(i=i||r,r=n,n=void 0),pe.ajax(pe.extend({url:e,type:t,dataType:i,data:n,success:r},pe.isPlainObject(e)&&e))}}),pe._evalUrl=function(e){return pe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},pe.fn.extend({wrapAll:function(e){if(pe.isFunction(e))return this.each(function(t){pe(this).wrapAll(e.call(this,t))});if(this[0]){var t=pe(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return pe.isFunction(e)?this.each(function(t){pe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=pe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pe.isFunction(e);return this.each(function(n){pe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pe.nodeName(this,"body")||pe(this).replaceWith(this.childNodes)}).end()}}),pe.expr.filters.hidden=function(e){return fe.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:K(e)},pe.expr.filters.visible=function(e){return!pe.expr.filters.hidden(e)};var nn=/%20/g,rn=/\[\]$/,on=/\r?\n/g,an=/^(?:submit|button|image|reset|file)$/i,sn=/^(?:input|select|textarea|keygen)/i;pe.param=function(e,t){var n,r=[],i=function(e,t){t=pe.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=pe.ajaxSettings&&pe.ajaxSettings.traditional),pe.isArray(e)||e.jquery&&!pe.isPlainObject(e))pe.each(e,function(){i(this.name,this.value)});else for(n in e)Q(n,e[n],t,i);return r.join("&").replace(nn,"+")},pe.fn.extend({serialize:function(){return pe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pe.prop(this,"elements");return e?pe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pe(this).is(":disabled")&&sn.test(this.nodeName)&&!an.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=pe(this).val();return null==n?null:pe.isArray(n)?pe.map(n,function(e){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),pe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return this.isLocal?ee():re.documentMode>8?Z():/^(get|post|head|put|delete|options)$/i.test(this.type)&&Z()||ee()}:Z;var un=0,ln={},cn=pe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in ln)ln[e](void 0,!0)}),fe.cors=!!cn&&"withCredentials"in cn,cn=fe.ajax=!!cn,cn&&pe.ajaxTransport(function(t){if(!t.crossDomain||fe.cors){var n;return{send:function(r,i){var o,a=t.xhr(),s=++un;if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)a[o]=t.xhrFields[o];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)void 0!==r[o]&&a.setRequestHeader(o,r[o]+"");a.send(t.hasContent&&t.data||null),n=function(e,r){var o,u,l;if(n&&(r||4===a.readyState))if(delete ln[s],n=void 0,a.onreadystatechange=pe.noop,r)4!==a.readyState&&a.abort();else{l={},o=a.status,"string"==typeof a.responseText&&(l.text=a.responseText);try{u=a.statusText}catch(c){u=""}o||!t.isLocal||t.crossDomain?1223===o&&(o=204):o=l.text?200:404}l&&i(o,u,l,a.getAllResponseHeaders())},t.async?4===a.readyState?e.setTimeout(n):a.onreadystatechange=ln[s]=n:n()},abort:function(){n&&n(void 0,!0)}}}}),pe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return pe.globalEval(e),e}}}),pe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=re.head||pe("head")[0]||re.documentElement;return{send:function(r,i){t=re.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||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var fn=[],dn=/(=)\?(?=&|$)|\?\?/;pe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=fn.pop()||pe.expando+"_"+Wt++;return this[e]=!0,e}}),pe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=pe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pe.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?pe(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,fn.push(i)),a&&pe.isFunction(o)&&o(a[0]),a=o=void 0}),"script"}),pe.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||re;var r=Te.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=y([e],t,i),i&&i.length&&pe(i).remove(),pe.merge([],r.childNodes))};var pn=pe.fn.load;return pe.fn.load=function(e,t,n){if("string"!=typeof e&&pn)return pn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=pe.trim(e.slice(s,e.length)),e=e.slice(0,s)),pe.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&pe.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?pe("
        ").append(pe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},pe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pe.fn[t]=function(e){return this.on(t,e)}}),pe.expr.filters.animated=function(e){return pe.grep(pe.timers,function(t){return e===t.elem}).length},pe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=pe.css(e,"position"),f=pe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=pe.css(e,"top"),u=pe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&pe.inArray("auto",[o,u])>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),pe.isFunction(t)&&(t=t.call(e,n,pe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},pe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){pe.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,pe.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=te(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pe.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pe.nodeName(e[0],"html")||(n=e.offset()),n.top+=pe.css(e[0],"borderTopWidth",!0),n.left+=pe.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pe.css(r,"marginTop",!0),left:t.left-n.left-pe.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){ +for(var e=this.offsetParent;e&&!pe.nodeName(e,"html")&&"static"===pe.css(e,"position");)e=e.offsetParent;return e||pt})}}),pe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);pe.fn[e]=function(r){return Pe(this,function(e,r,i){var o=te(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?pe(o).scrollLeft():i,n?i:pe(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),pe.each(["top","left"],function(e,t){pe.cssHooks[t]=L(fe.pixelPosition,function(e,n){if(n)return n=gt(e,t),ft.test(n)?pe(e).position()[t]+"px":n})}),pe.each({Height:"height",Width:"width"},function(e,t){pe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){pe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Pe(this,function(t,n,r){var i;return pe.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?pe.css(t,n,a):pe.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),pe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),pe.fn.size=function(){return this.length},pe.fn.andSelf=pe.fn.addBack,layui.define(function(e){layui.$=pe,e("jquery",pe)}),pe});!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
        '+(f?r.title[0]:r.title)+"
        ":"";return r.zIndex=s,t([r.shade?'
        ':"",'
        '+(e&&2!=r.type?"":u)+'
        '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
        '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
        '+e+"
        "}():"")+(r.resize?'':"")+"
        "],u,i('
        ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
          '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
        • '+(t[0].content||"no content")+"
        • ";i'+(t[i].content||"no content")+"";return a}()+"
        ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
        '+(u.length>1?'':"")+'
        '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
        ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
        是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='
      • "+(i.title||"unnaming")+"
      • ";return s[0]?s.before(r):n.append(r),o.append('
        '+(i.content||"")+"
        "),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a(''),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append(''),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append(''+(l?"":"")+""),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)});layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,n=layui.hint(),a=layui.device(),o={config:{},set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,r,e,i)}},l=function(){var e=this;return{upload:function(i){e.upload.call(e,i)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var t=this;t.config=i.extend({},t.config,o.config,e),t.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var t=this,e=t.config;e.elem=i(e.elem),e.bindAction=i(e.bindAction),t.file(),t.events()},p.prototype.file=function(){var e=this,t=e.config,n=e.elemFile=i(['"].join("")),o=t.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&t.elem.wrap('
        '),e.isFile()?(e.elemFile=t.elem,t.field=t.elem[0].name):t.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,t=e.config,n=i(''),a=i(['
        ',"
        "].join(""));i("#"+f)[0]||i("body").append(n),t.elem.next().hasClass(f)||(e.elemFile.wrap(a),t.elem.next("."+f).append(function(){var e=[];return layui.each(t.data,function(i,t){t="function"==typeof t?t():t,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return t.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var i=this;window.FileReader&&layui.each(i.chooseFiles,function(i,t){var n=new FileReader;n.readAsDataURL(t),n.onload=function(){e&&e(i,t,this.result)}})},p.prototype.upload=function(e,t){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var t=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&t+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:t,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,i){i="function"==typeof i?i():i,r.append(e,i)}),i.ajax({url:l.url,type:l.method,data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(i){t++,d(e,i),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=i("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var i,t=e.contents().find("body");try{i=t.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}i&&(clearInterval(p.timer),t.html(""),d(0,i))},30)},d=function(e,i){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(i,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var i=[];return layui.each(e||o.chooseFiles,function(e,t){i.push(t.name)}),i}(),g={preview:function(e){o.preview(e)},upload:function(e,i){var t={};t[e]=i,o.upload(t)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,i){o.files[e]=i}),o.files}},y=function(){return"choose"===t?l.choose&&l.choose(g):(l.before&&l.before(g),a.ie?a.ie>9?u():c():void u())};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,i){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(i))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var i=0,t=e||o.files||o.chooseFiles||r.files;return layui.each(t,function(){i++}),i}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,i){if(i.size>1024*l.size){var t=l.size/1024;t=t>=1?t.toFixed(2)+"MB":l.size+"KB",r.value="",F=t}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,t=e.config,o=function(i){e.chooseFiles={},layui.each(i,function(i,t){var n=(new Date).getTime();e.chooseFiles[n+"-"+i]=t})},l=function(i,n){var a=e.elemFile,o=i.length>1?i.length+"个文件":(i[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||t.choose||a.after(''+o+"")};t.elem.off("upload.start").on("upload.start",function(){var a=i(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=i.extend({},t,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||t.elem.off("upload.over").on("upload.over",function(){var e=i(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=i(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=i(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),t.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var i=this.files||[];o(i),t.auto?e.upload():l(i)}),t.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),t.elem.data("haveEvents")||(e.elemFile.on("change",function(){i(this).trigger("upload.change")}),t.elem.on("click",function(){e.isFile()||i(this).trigger("upload.start")}),t.drag&&t.elem.on("dragover",function(e){e.preventDefault(),i(this).trigger("upload.over")}).on("dragleave",function(e){i(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),i(this).trigger("upload.drop",e)}),t.bindAction.on("click",function(){i(this).trigger("upload.action")}),t.elem.data("haveEvents",!0))},o.render=function(e){var i=new p(e);return l.call(i)},e(r,o)});layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",c="layui-hide",o="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};u.prototype.set=function(e){var t=this;return i.extend(!0,t.config,e),t},u.prototype.verify=function(e){var t=this;return i.extend(!0,t.config.verify,e),t},u.prototype.on=function(e,i){return layui.onevent.call(this,l,e,i)},u.prototype.val=function(e,t){var a=i(r+'[lay-filter="'+e+'"]');a.each(function(e,a){var n=i(this);layui.each(t,function(e,i){var t,a=n.find('[name="'+e+'"]');a[0]&&(t=a[0].type,"checkbox"===t?a[0].checked=i:"radio"===t?a.each(function(){this.value===i&&(this.checked=!0)}):a.val(i))})}),f.render(null,e)},u.prototype.render=function(e,t){var n=this,u=i(r+function(){return t?'[lay-filter="'+t+'"]':""}()),d={select:function(){var e,t="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=u.find("select"),v=function(t,l){i(t.target).parent().hasClass(n)&&!l||(i("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},h=function(t,u,f){var h,p=i(this),m=t.find("."+n),k=m.find("input"),g=t.find("dl"),x=g.children("dd"),b=this.selectedIndex;if(!u){var C=function(){var e=t.offset().top+t.outerHeight()+5-y.scrollTop(),i=g.outerHeight();b=p[0].selectedIndex,t.addClass(a+"ed"),x.removeClass(c),x.eq(b).addClass(s).siblings().removeClass(s),e+i>y.height()&&e>=i&&t.addClass(a+"up")},w=function(e){t.removeClass(a+"ed "+a+"up"),k.blur(),h=null,e||$(k.val(),function(e){e&&(d=g.find("."+s).html(),k&&k.val(d))})};m.on("click",function(e){t.hasClass(a+"ed")?w():(v(e,!0),C()),g.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){k.focus()}),k.on("keyup",function(e){var i=e.keyCode;9===i&&C()}).on("keydown",function(e){var i=e.keyCode;9===i&&w();var t=function(i,a){var n,l;if(e.preventDefault(),a=function(){return a&&a[0]?a:h&&h[0]?h:x.eq(b)}(),l=a[i](),n=a[i]("dd"),l[0])return h=a[i](),!n[0]||n.hasClass(o)?t(i,h):void n.addClass(s).siblings().removeClass(s)};38===i&&t("prev"),40===i&&t("next"),13===i&&(e.preventDefault(),g.children("dd."+s).trigger("click"))});var $=function(e,t,a){var n=0;layui.each(x,function(){var t=i(this),l=t.text(),r=l.indexOf(e)===-1;(""===e||"blur"===a?e!==l:r)&&n++,"keyup"===a&&t[r?"addClass":"removeClass"](c)});var l=n===x.length;return t(l),l},T=function(e){var i=this.value,t=e.keyCode;return 9!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&($(i,function(e){e?g.find("."+r)[0]||g.append('

        无匹配项

        '):g.find("."+r).remove()},"keyup"),void(""===i&&g.find("."+r).remove()))};f&&k.on("keyup",T).on("blur",function(t){var a=p[0].selectedIndex;e=k,d=i(p[0].options[a]).html(),setTimeout(function(){$(k.val(),function(e){d||k.val("")},"blur")},200)}),x.on("click",function(){var e=i(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(o)&&(e.hasClass("layui-select-tips")?k.val(""):(k.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:t}),w(!0),!1)}),t.find("dl>dt").on("click",function(e){return!1}),i(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=i(this),c=r.next("."+a),u=this.disabled,d=l.value,f=i(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var y="string"==typeof r.attr("lay-search"),p=v?v.value?t:v.innerHTML||t:t,m=i(['
        ','
        ','','
        ','
        ',function(e){var i=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?i.push("
        "+a.label+"
        "):i.push('
        '+a.innerHTML+"
        "):i.push('
        '+(a.innerHTML||t)+"
        ")}),0===i.length&&i.push('
        没有选项
        '),i.join("")}(r.find("*"))+"
        ","
        "].join(""));c[0]&&c.remove(),r.after(m),h.call(this,m,u,y)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},t=u.find("input[type=checkbox]"),a=function(e,t){var a=i(this);e.on("click",function(){var i=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(t[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(t[1]).find("em").text(n[0])),layui.event.call(a[0],l,t[2]+"("+i+")",{elem:a[0],value:a[0].value,othis:e}))})};t.each(function(t,n){var l=i(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),c=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=i(['
        ",function(){var e=n.title.replace(/\s/g,""),i={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?s[0]:s[1])||"")+""};return i[r]||i.checkbox}(),"
        "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",t=["",""],a=u.find("input[type=radio]"),n=function(a){var n=i(this),s="layui-anim-scaleSpring";a.on("click",function(){var c=n[0].name,o=n.parents(r),u=n.attr("lay-filter"),d=o.find("input[name="+c.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=i(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(t[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(t[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=i(this),s=r.next("."+e),c=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var u=i(['
        ',''+t[l.checked?0:1]+"","
        "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"
        ","
        "].join(""));r.after(u),n.call(this,u)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,i){i()}),n};var d=function(){var e=i(this),a=f.config.verify,s=null,c="layui-form-danger",o={},u=e.parents(r),d=u.find("*[lay-verify]"),v=e.parents("form")[0],y=u.find("input,select,textarea"),h=e.attr("lay-filter");if(layui.each(d,function(e,l){var r=i(this),o=r.attr("lay-verify").split("|"),u=r.attr("lay-verType"),d=r.val();if(r.removeClass(c),layui.each(o,function(e,i){var o,f="",v="function"==typeof a[i];if(a[i]){var o=v?f=a[i](d,l):!a[i][0].test(d);if(f=f||a[i][1],o)return"tips"===u?t.tips(f,function(){return"string"==typeof r.attr("lay-ignore")||"select"!==l.tagName.toLowerCase()&&!/^checkbox|radio$/.test(l.type)?r:r.next()}(),{tips:1}):"alert"===u?t.alert(f,{title:"提示",shadeClose:!0}):t.msg(f,{icon:5,shift:6}),n.android||n.ios||l.focus(),r.addClass(c),s=!0}}),s)return s}),s)return!1;var p={};return layui.each(y,function(e,i){if(i.name=(i.name||"").replace(/^\s*|\s*&/,""),i.name){if(/^.*\[\]$/.test(i.name)){var t=i.name.match(/^(.*)\[\]$/g)[0];p[t]=0|p[t],i.name=i.name.replace(/^(.*)\[\]$/,"$1["+p[t]++ +"]")}/^checkbox|radio$/.test(i.type)&&!i.checked||(o[i.name]=i.value)}}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:v,field:o})},f=new u,v=i(document),y=i(window);f.render(),v.on("reset",r,function(){var e=i(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)});layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('
          '),s=o(["
        • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
        • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
          '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})});layui.define(["laytpl","laypage","layer","form"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=layui.hint(),r=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,s,e,t)}},c=function(){var e=this,t=e.config,i=t.id;return i&&(c.config[i]=t),{reload:function(t){e.reload.call(e,t)},config:t}},s="table",u=".layui-table",h="layui-hide",f="layui-none",y="layui-table-view",p=".layui-table-header",m=".layui-table-body",v=".layui-table-main",g=".layui-table-fixed",x=".layui-table-fixed-l",b=".layui-table-fixed-r",k=".layui-table-tool",C=".layui-table-page",w=".layui-table-sort",N="layui-table-edit",T="layui-table-hover",F=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',function(){return e.fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':""}(),'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
          ','
          1){ }}","group","{{# } else { }}","{{d.index}}-{{item2.field || i2}}",'{{# if(item2.type !== "normal"){ }}'," laytable-cell-{{ item2.type }}","{{# } }}","{{# } }}",'" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{item2.title||""}}',"{{# if(!(item2.colspan > 1) && item2.sort){ }}",'',"{{# } }}","{{# } }}","
          ","
          "].join("")},W=['',"","
          "].join(""),z=['
          ',"{{# if(d.data.toolbar){ }}",'
          ',"{{# } }}",'
          ',"{{# var left, right; }}",'
          ',F(),"
          ",'
          ',W,"
          ","{{# if(left){ }}",'
          ','
          ',F({fixed:!0}),"
          ",'
          ',W,"
          ","
          ","{{# }; }}","{{# if(right){ }}",'
          ','
          ',F({fixed:"right"}),'
          ',"
          ",'
          ',W,"
          ","
          ","{{# }; }}","
          ","{{# if(d.data.page){ }}",'
          ','
          ',"
          ","{{# } }}","","
          "].join(""),A=t(window),S=t(document),M=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};M.prototype.config={limit:10,loading:!0,cellMinWidth:60,text:{none:"无数据"}},M.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id"),a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;e.setArea();var l=a.elem,n=l.next("."+y),o=e.elem=t(i(z).render({VIEW_CLASS:y,data:a,index:e.index}));if(a.index=e.index,n[0]&&n.remove(),l.after(o),e.layHeader=o.find(p),e.layMain=o.find(v),e.layBody=o.find(m),e.layFixed=o.find(g),e.layFixLeft=o.find(x),e.layFixRight=o.find(b),e.layTool=o.find(k),e.layPage=o.find(C),e.layTool.html(i(t(a.toolbar).html()||"").render(a)),a.height&&e.fullSize(),a.cols.length>1){var r=e.layFixed.find(p).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},M.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,space:15,numbers:40});e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||i[e.type])},M.prototype.setArea=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=t.width||function(){var e=function(i){var a,l;i=i||t.elem.parent(),a=i.width();try{l="none"===i.css("display")}catch(n){}return!i[0]||a&&!l?a:e(i.parent())};return e()}();e.eachCols(function(){i++}),o-=function(){return"line"===t.skin||"nob"===t.skin?2:i+1}(),layui.each(t.cols,function(t,i){layui.each(i,function(t,l){var r;return l?(e.initOpts(l),r=l.width||0,void(l.colspan>1||(/\d+%$/.test(r)?l.width=r=Math.floor(parseFloat(r)/100*o):r||(l.width=r=0,a++),n+=r))):void i.splice(t,1)})}),e.autoColNums=a,o>n&&a&&(l=(o-n)/a),layui.each(t.cols,function(e,i){layui.each(i,function(e,i){var a=i.minWidth||t.cellMinWidth;i.colspan>1||0===i.width&&(i.width=Math.floor(l>=a?l:a))})}),t.height&&/^full-\d+$/.test(t.height)&&(e.fullHeightGap=t.height.split("-")[1],t.height=A.height()-e.fullHeightGap)},M.prototype.reload=function(e){var i=this;i.config.data&&i.config.data.constructor===Array&&delete i.config.data,i.config=t.extend({},i.config,e),i.render()},M.prototype.page=1,M.prototype.pullData=function(e,i){var a=this,n=a.config,o=n.request,r=n.response,d=function(){"object"==typeof n.initSort&&a.sort(n.initSort.field,n.initSort.type)};if(a.startTime=(new Date).getTime(),n.url){var c={};c[o.pageName]=e,c[o.limitName]=n.limit;var s=t.extend(c,n.where);n.contentType&&0==n.contentType.indexOf("application/json")&&(s=JSON.stringify(s)),t.ajax({type:n.method||"get",url:n.url,contentType:n.contentType,data:s,dataType:"json",headers:n.headers||{},success:function(t){t[r.statusName]!=r.statusCode?(a.renderForm(),a.layMain.html('
          '+(t[r.msgName]||"返回的数据状态异常")+"
          ")):(a.renderData(t,e,t[r.countName]),d(),n.time=(new Date).getTime()-a.startTime+" ms"),i&&l.close(i),"function"==typeof n.done&&n.done(t,e,t[r.countName])},error:function(e,t){a.layMain.html('
          数据接口请求异常
          '),a.renderForm(),i&&l.close(i)}})}else if(n.data&&n.data.constructor===Array){var u={},h=e*n.limit-n.limit;u[r.dataName]=n.data.concat().splice(h,n.limit),u[r.countName]=n.data.length,a.renderData(u,e,n.data.length),d(),"function"==typeof n.done&&n.done(u,e,u[r.countName])}},M.prototype.eachCols=function(e){var i=t.extend(!0,[],this.config.cols),a=[],l=0;layui.each(i,function(e,t){layui.each(t,function(t,n){if(n.colspan>1){var o=0;l++,n.CHILD_COLS=[],layui.each(i[e+1],function(e,t){t.PARENT_COL||o==n.colspan||(t.PARENT_COL=l,n.CHILD_COLS.push(t),o+=t.colspan>1?t.colspan:1)})}n.PARENT_COL||a.push(n)})});var n=function(t){layui.each(t||a,function(t,i){return i.CHILD_COLS?n(i.CHILD_COLS):void e(t,i)})};n()},M.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,u=e[s.response.dataName]||[],y=[],p=[],m=[],v=function(){return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(u,function(e,a){var l=[],o=[],u=[],h=e+s.limit*(n-1)+1;0!==a.length&&(r||(a[d.config.indexName]=e),c.eachCols(function(e,n){var r=n.field||e,f=a[r];c.getColElem(c.layHeader,r);if(void 0!==f&&null!==f||(f=""),!(n.colspan>1)){var y=['",'
          '+function(){var e=t.extend(!0,{LAY_INDEX:h},a);return"checkbox"===n.type?'":"numbers"===n.type?h:n.toolbar?i(t(n.toolbar).html()||"").render(e):n.templet?function(){return"function"==typeof n.templet?n.templet(e):i(t(n.templet).html()||String(f)).render(e)}():f}(),"
          "].join("");l.push(y),n.fixed&&"right"!==n.fixed&&o.push(y),"right"===n.fixed&&u.push(y)}}),y.push(''+l.join("")+""),p.push(''+o.join("")+""),m.push(''+u.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+f).remove(),c.layMain.find("tbody").html(y.join("")),c.layFixLeft.find("tbody").html(p.join("")),c.layFixRight.find("tbody").html(m.join("")),c.renderForm(),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,void l.close(c.tipsIndex))};return c.key=s.id||s.index,d.cache[c.key]=u,c.layPage[0===u.length&&1==n?"addClass":"removeClass"](h),r?v():0===u.length?(c.renderForm(),c.layFixed.remove(),c.layMain.find("tbody").html(""),c.layMain.find("."+f).remove(),c.layMain.append('
          '+s.text.none+"
          ")):(v(),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr,c.loading()))}},s.page),s.page.count=o,a.render(s.page))))},M.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},M.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},M.prototype.sort=function(e,i,a,l){var n,r,c=this,u={},h=c.config,f=h.elem.attr("lay-filter"),y=d.cache[c.key];"string"==typeof e&&c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1});try{var n=n||e.data("field");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var p=c.layHeader.find("th .laytable-cell-"+h.index+"-"+n).find(w);c.layHeader.find("th").find(w).removeAttr("lay-sort"),p.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){return o.error("Table modules: Did not match to field")}c.sortKey={field:n,sort:i},"asc"===i?r=layui.sort(y,n):"desc"===i?r=layui.sort(y,n,!0):(r=layui.sort(y,d.config.indexName),delete c.sortKey),u[h.response.dataName]=r,c.renderData(u,c.page,c.count,!0),l&&layui.event.call(e,s,"sort("+f+")",{field:n,type:i})},M.prototype.loading=function(){var e=this,t=e.config;if(t.loading&&t.url)return l.msg("数据请求中",{icon:16,offset:[e.elem.offset().top+e.elem.height()/2-35-A.scrollTop()+"px",e.elem.offset().left+e.elem.width()/2-90-A.scrollLeft()+"px"],time:-1,anim:-1,fixed:!1})},M.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&l[e].constructor!==Array&&(l[e][a.checkName]=t)},M.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},M.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(a,l){if(l.selectorText===".laytable-cell-"+i.index+"-"+e)return t(l),!0})},M.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=A.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),e=parseFloat(a)-parseFloat(t.layHeader.height())-1,i.toolbar&&(e-=t.layTool.outerHeight()),i.page&&(e=e-t.layPage.outerHeight()-1),t.layMain.css("height",e)},M.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},M.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=e.getScrollWidth(e.layMain[0]),o=i.outerWidth()-e.layMain.width();if(e.autoColNums&&o<5&&!e.scrollPatchWStatus){var r=e.layHeader.eq(0).find("thead th:last-child"),d=r.data("field");e.getCssRule(d,function(t){var i=t.style.width||r.outerWidth();t.style.width=parseFloat(i)-n-o+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px"),e.scrollPatchWStatus=!0})}if(a&&l){if(!e.elem.find(".layui-table-patch")[0]){var c=t('
          ');c.find("div").css({width:a}),e.layHeader.eq(0).find("thead tr").append(c)}}else e.layHeader.eq(0).find(".layui-table-patch").remove();var s=e.layMain.height(),u=s-l;e.layFixed.find(m).css("height",i.height()>u?u:"auto"),e.layFixRight[o>0?"removeClass":"addClass"](h),e.layFixRight.css("right",a-1)},M.prototype.events=function(){var e,a=this,n=a.config,o=t("body"),c={},u=a.layHeader.find("th"),h=".layui-table-cell",f=n.elem.attr("lay-filter");u.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.attr("colspan")>1||i.data("unresize")||c.resizeStart||(c.allowResize=i.width()-l<=10,o.css("cursor",c.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);c.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var i=t(this);if(c.allowResize){var l=i.data("field");e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],a.getCssRule(l,function(e){var t=e.style.width||i.outerWidth();c.rule=e,c.ruleWidth=parseFloat(t),c.minWidth=i.data("minwidth")||n.cellMinWidth})}}),S.on("mousemove",function(t){if(c.resizeStart){if(t.preventDefault(),c.rule){var i=c.ruleWidth+t.clientX-c.offset[0];i');d[0].value=e.data("content")||o.text(),e.find("."+N)[0]||e.append(d),d.focus()}else o.find(".layui-form-switch,.layui-form-checkbox")[0]||Math.round(o.prop("scrollWidth"))>Math.round(o.outerWidth())&&(a.tipsIndex=l.tips(['
          ',o.html(),"
          ",''].join(""),o[0],{tips:[3,""],time:-1,anim:-1,maxWidth:r.ios||r.android?300:600,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}))}),a.layBody.on("click","*[lay-event]",function(){var e=t(this),l=e.parents("tr").eq(0).data("index"),n=a.layBody.find('tr[data-index="'+l+'"]'),o="layui-table-click",r=d.cache[a.key][l];layui.event.call(this,s,"tool("+f+")",{data:d.clearCacheKey(r),event:e.attr("lay-event"),tr:n,del:function(){d.cache[a.key][l]=[],n.remove(),a.scrollPatch()},update:function(e){e=e||{},layui.each(e,function(e,l){if(e in r){var o,d=n.children('td[data-field="'+e+'"]');r[e]=l,a.eachCols(function(t,i){i.field==e&&i.templet&&(o=i.templet)}),d.children(h).html(o?i(t(o).html()||l).render(r):l),d.data("content",l)}})}}),n.addClass(o).siblings("tr").removeClass(o)}),a.layMain.on("scroll",function(){var e=t(this),i=e.scrollLeft(),n=e.scrollTop();a.layHeader.scrollLeft(i),a.layFixed.find(m).scrollTop(n),l.close(a.tipsIndex)}),A.on("resize",function(){a.fullSize(),a.scrollPatch()})},d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':u+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){o.error(n+l)}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){return o.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return l.constructor===Array?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},c.config={},d.reload=function(e,i){var a=c.config[e];return i=i||{},a?(i.data&&i.data.constructor===Array&&delete a.data,d.render(t.extend(!0,{},a,i))):o.error("The ID option was not found in the table instance")},d.render=function(e){var t=new M(e);return c.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},d.init(),e(s,d)});layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
            ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
          "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a',e.bar1?'
        • '+c[0]+"
        • ":"",e.bar2?'
        • '+c[1]+"
        • ":"",'
        • '+c[2]+"
        • ",""].join("")),s=g.find("."+r),u=function(){var t=n.scrollTop();t>=e.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),u(),g.find("li").on("click",function(){var i=t(this),o=i.attr("lay-type");"top"===o&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){u()},100)}))},countdown:function(e,t,i){var o=this,a="function"==typeof t,r=new Date(e).getTime(),n=new Date(!t||a?(new Date).getTime():t).getTime(),l=r-n,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var g=setTimeout(function(){o.countdown(e,n+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>6912e5?(a=new Date(e),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),t||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var o=e.length;o';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
          ','
          '+f+"
          ",'
          ','',"
          ","
          "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

          ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

          "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

          "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

            ','
          • ','','
            ','',"
            ","
          • ",'
          • ','','
            ','",'","
            ","
          • ",'
          • ','','',"
          • ","
          "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
        • '+e+'
        • ')}),'
            '+t.join("")+"
          "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
            ','
          • ','','
            ','","
            ","
          • ",'
          • ','','
            ','',"
            ","
          • ",'
          • ','','',"
          • ","
          "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)});layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
          1. '+o.replace(/[\r\t\n]+/g,"
          2. ")+"
          "),c.find(">.layui-code-h3")[0]||c.prepend('

          '+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

          ");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); \ No newline at end of file diff --git a/admin/static/layui/layui/layui.js b/admin/static/layui/layui/layui.js new file mode 100644 index 0000000..248777f --- /dev/null +++ b/admin/static/layui/layui/layui.js @@ -0,0 +1,2 @@ +/** layui-v2.3.0-rc1 MIT License By https://www.layui.com */ + ;!function(e){"use strict";var t=document,n={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.3.0-rc1"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,o=n.length-1,r=o;r>0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[o].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",rate:"modules/rate",carousel:"modules/carousel",flow:"modules/flow",util:"modules/util",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};o.prototype.cache=n,o.prototype.define=function(e,t){var o=this,r="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(o,r){e(o,r),n.callback[o]=function(){t(e)}}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?a.call(o):(o.use(e,a),o)},o.prototype.use=function(e,o,l){function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||o.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[d]=t,f.removeChild(v),function r(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void(n.status[d]?c():setTimeout(r,4))}())}function c(){l.push(layui[d]),e.length>1?y.use(e.slice(1),o,l):"function"==typeof o&&o.apply(layui,l)}var y=this,p=n.dir=n.dir?n.dir:r,f=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var d=e[0],m=0;if(l=l||[],n.host=n.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[d]||!layui["layui.all"]&&layui["layui.mobile"]&&u[d])return c(),y;if(n.modules[d])!function g(){return++m>1e3*n.timeout/4?a(d+" is not a valid module"):void("string"==typeof n.modules[d]&&n.status[d]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[d]?p+"lay/":/^\{\/\}/.test(y.modules[d])?"":n.base||"")+(y.modules[d]||d)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),f.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||i?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),n.modules[d]=h}return y},o.prototype.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},o.prototype.link=function(e,o,r){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof o&&(r=o);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof o?i:(function p(){return++y>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(c),"width"))?function(){o()}():setTimeout(p,100))}(),i)},n.callback={},o.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},o.prototype.addcss=function(e,t,o){return layui.link(n.dir+"css/"+e,t,o)},o.prototype.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,"function"==typeof t&&t(o)},void(o.onerror=function(e){o.onerror=null,"function"==typeof n&&n(e)}))},o.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},o.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),o.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},o.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},o.prototype.data=function(t,n,o){if(t=t||"layui",o=o||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete o[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(o[t])}catch(a){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],o[t]=JSON.stringify(r),n.key?r[n.key]:r}},o.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},o.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),o=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:o("micromessenger")};return t&&!r[t]&&(r[t]=o(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r},o.prototype.hint=function(){return{error:a}},o.prototype.each=function(e,t){var n,o=this;if("function"!=typeof t)return o;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;na?1:r tr').each(function () { + var line = [] + $(this).find('td,th').each(function () { + line.push($(this).text()) + }) + head.push(line) + }) + + var body = []; + dom.find('tbody > tr').each(function () { + var line = [] + $(this).find('td').each(function () { + line.push($(this).text()) + }) + body.push(line) + }) + + return { + head: head, + body: body + } + }, + // 测试代码: + // for(i=1;i<100;i++){var change = layui.excel.numToTitle(i);console.log(i, change, layui.excel.titleToNum(change));} + // numsToTitle备忘录提效 + numsTitleCache: {}, + // titleToTitle 备忘录提效 + titleNumsCache: {}, + /** + * 将数字(从一开始)转换为 A、B、C...AA、AB + * @param {[int]} num [description] + * @return {[type]} [description] + */ + numToTitle: function(num) { + if (this.numsTitleCache[num]) { + return this.numsTitleCache[num]; + } + var ans = ''; + if (num > 26) { + // 要注意小心 26 的倍数导致的无限递归问题 + var dec = num % 26; + ans = this.numToTitle((num - dec)/26) + this.numToTitle(dec?dec:26); + this.numsTitleCache[num] = ans; + this.titleNumsCache[ans] = num; + return ans; + } else { + // A 的 ascii 为 0,顺位相加 + ans = String.fromCharCode(64 + num); + this.numsTitleCache[num] = ans; + this.titleNumsCache[ans] = num; + return ans; + } + }, + /** + * 将A、B、AA、ABC转换为 1、2、3形式的数字 + * @param {[type]} title [description] + * @return {number} [description] + */ + titleToNum: function(title) { + if (this.titleNumsCache[title]) { + return this.titleNumsCache[title]; + } + var len = title.length; + var total = 0; + for (var index in title) { + if (!title.hasOwnProperty(index)) { + continue; + } + var char = title[index]; + var code = char.charCodeAt() - 64; + total += code * Math.pow(26, len - index - 1); + } + this.numsTitleCache[total] = title; + this.titleNumsCache[title] = total; + return total; + }, + /** + * 获取数据范围内有效范围 + * @param data array sheet级别的数据 + * @param range 范围字符串,如 A1:C12,默认从左上角到右下角 + */ + getDefaultRange: function(data, range) { + // 以 rowIndex 为键,field 为值 + var fieldKeys = Object.keys(data[0]); + var maxCol = fieldKeys.length - 1; + var maxRow = data.length -1; + // 默认 A1 ~ 右下角 + var startPos = {c: 0, r: 0}; + var endPos = {c: maxCol, r: maxRow}; + + if (range && typeof range === 'string') { + var rangeArr = range.split(':'); + if (rangeArr[0].length) { + startPos = this.splitPosition(rangeArr[0]); + } + if (typeof rangeArr[1] !== 'undefined' && rangeArr[1] !== '') { + endPos = this.splitPosition(rangeArr[1]); + } + } else { + // pass + } + // position范围限制 - 考虑到特殊情况取消此限制 + // startPos.c = startPos.c < maxCol ? startPos.c : maxCol; + // endPos.c = endPos.c < maxCol ? endPos.c : maxCol; + // startPos.r = startPos.r < maxRow ? startPos.r : maxRow; + // endPos.r = endPos.r < maxRow ? endPos.r : maxRow; + + if (startPos.c > endPos.c) { + console.error('开始列不得大于结束列'); + } + if (startPos.r > endPos.r) { + console.error('开始行不得大于结束行'); + } + return { + startPos: startPos, + endPos: endPos, + fieldKeys: fieldKeys + } + }, + /** + * 根据 startPos endPos 遍历设置单元格属性,支持 filter 回调处理 + * @param data array sheet级别数据 + * @param startPos object {c: 开始列索引, r: 开始行索引} + * @param endPos object {c: 结束列索引, r: 结束行索引} + * @param fieldKeys ['第一列属性Key', '第二列属性Key'] + * @param config object {s: {样式}, v: '值'} + * @param filter callable 回调函数,入参 cell(原cell),newCell(新cell),row(当前行),config(配置), currentRow(当前行索引), currentCol(当前列索引-数字),currentColKey(当前列索引-对象) + */ + setCellStyle: function (data, startPos, endPos, fieldKeys, config, filter) { + // 遍历范围内的数据,进行样式设置,按从上到下从左到右按行遍历 + for (var currentRow = startPos.r; currentRow <= endPos.r; currentRow++) { + for (var currentCol = startPos.c; currentCol <= endPos.c; currentCol++) { + // 如果有回调则执行回调判断,否则全部更新,如果遇到超出数据范围的,自动置空 + var row = data[currentRow]; + if (!row) { + row = {}; + for (var key = 0; key < fieldKeys.length; key++) { + row[fieldKeys[key]] = ''; + } + data[currentRow] = row; + } + var cell = row[fieldKeys[currentCol]]; + var newCell = null; + if (cell === null || cell === undefined) { + cell = ''; + } + + // 手工合并(相同的则以当前函数config为准) + if (typeof cell === 'object') { + newCell = $.extend(true, {}, cell, config); + } else { + newCell = $.extend(true, {}, {v: cell}, config); + } + + if ( + typeof filter === 'function' + ) { + newCell = filter(cell, newCell, row, config, currentRow, currentCol, fieldKeys[currentCol]); + } else { + } + // 回写 + data[currentRow][fieldKeys[currentCol]] = newCell; + } + } + }, + /** + * 设置范围内环绕的边框 + * @param data [sheet级别的数据] + * @param range [范围字符串,如 A1:C12,默认从左上角到右下角] + * @param config [border 上下左右属性配置信息(对角线的三个属性被下放到left/right/top/bottom下),如:{top: {xxx}, bottom: {}, left: {}, right: {}}] + */ + setRoundBorder: function(data, range, config) { + if (typeof data !== 'object' || !data.length || !data[0] || !Object.keys(data[0]).length) { + return []; + } + + var rangeObj = this.getDefaultRange(data, range); + var startPos = rangeObj.startPos; + var endPos = rangeObj.endPos; + var fieldKeys = rangeObj.fieldKeys; + + // 顶部 border 属性取 config.top + this.setCellStyle(data, startPos, { + c: endPos.c, + r: startPos.r + }, fieldKeys, { + s: { + border: { + top: config.top, + diagonal: config.top.diagonal, + diagonalUp: config.top.diagonalUp, + diagonalDown: config.top.diagonalDown + } + } + }) + // 右侧 border 属性取 config.right + this.setCellStyle(data, { + c: endPos.c, + r: startPos.r + }, endPos, fieldKeys, { + s: { + border: { + right: config.right, + diagonal: config.right.diagonal, + diagonalUp: config.right.diagonalUp, + diagonalDown: config.right.diagonalDown + } + } + }) + // 底部 border 属性取 config.bottom + this.setCellStyle(data, { + c: startPos.c, + r: endPos.r + }, endPos, fieldKeys, { + s: { + border: { + bottom: config.bottom, + diagonal: config.bottom.diagonal, + diagonalUp: config.bottom.diagonalUp, + diagonalDown: config.bottom.diagonalDown + } + } + }) + // 左侧 border 属性取 config.left + this.setCellStyle(data, startPos, { + c: startPos.c, + r: endPos.r + }, fieldKeys, { + s: { + border: { + left: config.left, + diagonal: config.left.diagonal, + diagonalUp: config.left.diagonalUp, + diagonalDown: config.left.diagonalDown + } + } + }) + }, + /** + * 批量设置单元格属性 + * @param {array} data [sheet级别的数据] + * @param {string} range [范围字符串,比如 A1:C12,开始位置默认 A1,结束位置默认整个表格右下角] + * @param {object} config [批量设置的单元格属性] + * @param {function} filter [回调函数,传递函数生效,返回值作为新的值(可用于过滤、规则替换样式等骚操作)] + * @return {array} [重新渲染后的 sheet 数据] + */ + setExportCellStyle: function(data, range, config, filter) { + if (typeof data !== 'object' || !data.length || !data[0] || !Object.keys(data[0]).length) { + return []; + } + + var rangeObj = this.getDefaultRange(data, range); + var startPos = rangeObj.startPos; + var endPos = rangeObj.endPos; + var fieldKeys = rangeObj.fieldKeys; + + this.setCellStyle(data, startPos, endPos, fieldKeys, config, filter); + return data; + }, + /** + * 合并单元格快速生成配置的函数 传入 [ ['开始坐标 A1', '结束坐标 D2'], ['开始坐标 B2', '结束坐标 E3'] ] + * @param {[type]} origin [description] + * @return {[type]} [description] + */ + makeMergeConfig: function(origin) { + var merge = []; + for (var index = 0; index < origin.length; index++) { + merge.push({ + s: this.splitPosition(origin[index][0]), + e: this.splitPosition(origin[index][1]) + }); + } + return merge; + }, + /** + * 自动生成列宽配置 + * @param {$ObjMap} data [A、B、C的宽度映射] + * @param {number} defaultNum [description] + * @return {$ObjMap} [description] + */ + makeColConfig: function(data, defaultNum) { + defaultNum = defaultNum > 0 ? defaultNum : 50; + // 将列的 ABC 转换为 index + var change = []; + var startIndex = 0; + for (var index in data) { + if (!data.hasOwnProperty(index)) { + continue; + } + var item = data[index]; + if (index.match && index.match(/[A-Z]*/)) { + var currentIndex = this.titleToNum(index) - 1; + // 填充未配置的单元格 + while (startIndex < currentIndex) { + change.push({wpx: defaultNum}); + startIndex++; + } + startIndex = currentIndex+1; + change.push({wpx: item > 0 ? item : defaultNum}); + } + }; + return change; + }, + /** + * 自动生成列高配置 + * @param {[type]} data [description] + * @param {[type]} defaultNum [description] + * @return {[type]} [description] + */ + makeRowConfig: function(data, defaultNum) { + defaultNum = defaultNum > 0 ? defaultNum : 10; + // 将列的 ABC 转换为 index + var change = []; + var startIndex = 0; + for (var index in data) { + if (!data.hasOwnProperty(index)) { + continue; + } + var item = data[index]; + if (index.match && index.match(/[0-9]*/)) { + var currentIndex = parseInt(index) - 1; + // 填充未配置的行 + while (startIndex < currentIndex) { + change.push({hpx: defaultNum}); + startIndex++; + } + startIndex = currentIndex+1; + change.push({hpx: item > 0 ? item : defaultNum}); + } + }; + return change; + }, + /** + * 将A1分离成 {c: 0, r: 0} 格式的数据 + * @param {string} pos [description] + * @return {{r: number, c: number}} [description] + */ + splitPosition: function(pos) { + var res = pos.match('^([A-Z]+)([0-9]+)$'); + if (!res) { + return {c: 0, r: 0}; + } + // 转换结果相比需要的结果需要减一转换 + return { + c: this.titleToNum(res[1]) - 1, + r: parseInt(res[2]) - 1 + } + }, + /** + * 将二进制数据转为8位字节 + * @param {[type]} s [description] + * @return {[type]} [description] + */ + s2ab: function(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i < s.length; i++) { + view[i] = s.charCodeAt(i) & 0xFF; + } + return buf; + }, + /** + * 将导出的数据格式,转换为可以aoa导出的格式 + * @return {[type]} [description] + */ + filterDataToAoaData: function(filterData){ + var aoaData = []; + $.each(filterData, function(index, item) { + var itemData = []; + for (var i in item) { + if (!item.hasOwnProperty(i)) { + continue; + } + itemData.push(item[i]); + } + aoaData.push(itemData); + }); + return aoaData; + }, + /** + * 梳理导出的数据,包括字段排序和多余数据过滤,具体功能请参见文档 + * @param {[type]} data [需要梳理的数据] + * @param {[type]} fields [支持数组和对象,用于映射关系和字段排序] + * @return {[type]} [description] + */ + filterExportData: function(data, fields) { + // PS:之所以不直接引用 data 节省内存,是因为担心如果 fields 可能存在如下情况: { "id": 'test_id', 'test_id': 'new_id' },会导致处理异常 + var exportData = []; + var true_fields = []; + // filed 支持两种模式,数组则单纯排序,对象则转换映射关系,为了统一处理,将数组转换为符合要求的映射关系对象 + if (Array.isArray(fields)) { + for (var i = 0; i< fields.length; i++) { + true_fields[fields[i]] = fields[i]; + } + } else { + true_fields = fields; + } + for (var i = 0; i < data.length; i++) { + var item = data[i]; + exportData[i] = {}; + for (var key in true_fields) { + if (!true_fields.hasOwnProperty(key)) { + continue; + } + var new_field_name = key; + var old_field_name = true_fields[key]; + // 如果传入的是回调,则回调的值则为新值 + if (typeof old_field_name === 'function' && old_field_name.apply) { + exportData[i][new_field_name] = old_field_name.apply(window, [item[new_field_name], item, data, i, new_field_name]); + } else { + if (typeof item[old_field_name] !== 'undefined') { + exportData[i][new_field_name] = item[old_field_name]; + } else { + exportData[i][new_field_name] = ''; + } + } + } + } + return exportData; + }, + /** + * 梳理导入的数据,参数意义可参考 filterExportData + * @param {[type]} data [description] + * @param {[type]} fields [description] + * @return {[type]} [description] + */ + filterImportData: function(data, fields) { + var that = this; + $.each(data, function(fileindex, xlsx) { + $.each(xlsx, function(sheetname, content) { + xlsx[sheetname] = that.filterExportData(content, fields); + }); + }); + return data; + }, + /** + * 读取Excel,支持多文件多表格读取 + * @param {[type]} files [description] + * @param {[type]} opt [description] + * @param {Function} callback [description] + * @return {[type]} [description] + */ + importExcel: function(files, opt, callback) { + var option = { + header: 'A', + range: null, + fields: null + }; + $.extend(option, opt); + var that = this; + + if (files.length < 1) { + throw {code: 999, 'message': '传入文件为空'}; + } + + // 按照二进制读取 + var data = {}; + var book = {}; + $.each(files, function(index, item) { + var reader = new FileReader(); + if (!reader) { + throw {code: 999, message: '不支持FileReader,请更换更新的浏览器'}; + } + // 读取excel表格对象 + reader.onload = function(ev) { + var wb = XLSX.read(ev.target.result, { + type: 'binary' + }); + var excelData = {}; + $.each(wb.Sheets, function(sheet, sheetObj) { + // 全为空的去掉 + if (wb.Sheets.hasOwnProperty(sheet)) { + var opt = { + header: option.header, + defval: '' + }; + if (option.range) { + opt.range = option.range; + } + excelData[sheet] = XLSX.utils.sheet_to_json(sheetObj, opt); + // 支持梳理数据 + if (option.fields) { + excelData[sheet] = that.filterExportData(excelData[sheet], option.fields); + } + } + }); + data[index] = excelData; + book[index] = wb; + // 全部读取完毕才执行 + if (index === files.length - 1) { + callback && callback.apply && callback.apply(window, [data, book]); + } + }; + reader.readAsBinaryString(item); + }); + }, + /** + * EXCEL日期码转换为Date对象 + * @param code double excel中存储的日期格式码 + */ + dateCodeToDate: function(code) + { + var obj = XLSX.SSF.parse_date_code(code); + return (new Date(obj.y + '-' + obj.m + '-' + obj.d + ' ' + obj.H + ':' + obj.M + ':' + obj.S)); + }, + /** + * 字符补全函数 + * @param str + * @param maxLength + * @param padString + * @returns {*} + */ + strPad: function(str, maxLength, padString) { + str = str + '' + if (typeof maxLength === 'undefined') { + maxLength = 2 + } + if (typeof padString === 'undefined') { + padString = '0' + } + + if (padString.length <= 0) { + console.error('strPad error'); + return str; + } + + if (str.length < maxLength) { + var repeatCount = Math.floor((maxLength - str.length) / padString.length); + var exceptStr = ''; + if (repeatCount * padString.length < maxLength - 1) { + exceptStr = padString.substr(0, maxLength - 1 - repeatCount * padString.length) + } + return padString * repeatCount + exceptStr + str + } else { + return str + } + }, + /** + * 简易格式转换 + * @param date Date 待转换时间 + * @param format String 日期格式 YYYY-MM-DD HH:ii:ss + */ + dateFormat: function(date, format) + { + if (!(date instanceof Date)) { + console.error(date+'需要是时间日期对象'); + } + if (typeof format === 'undefined') { + format = 'YYYY-MM-DD HH:ii:ss'; + } + // 制造 format 相关参数 + var YYYY = date.getFullYear(); + var YY = (YYYY + '').substr(2, 2) + var M = date.getMonth(); + var MM = this.strPad(M, 2, '0'); + var D = date.getDay(); + var DD = this.strPad(D, 2, '0'); + var H = date.getHours(); + var HH = this.strPad(H, 2, '0'); + var i = date.getMinutes(); + var ii = this.strPad(i, 2, '0'); + var s = date.getSeconds(); + var ss = this.strPad(s, 2, '0'); + + var config = { + 'YYYY': YYYY, + 'YY': YY, + 'MM': MM, + 'M': M, + 'DD': DD, + 'D': D, + 'HH': HH, + 'H': H, + 'ii': ii, + 'i': i, + 'ss': ss, + 's': s + }; + + for (var key in config) { + if (!config.hasOwnProperty(key)) { + continue; + } + + var reg = RegExp(key, 'g'); + + format = format.replace(reg, config[key]); + } + + return format; + }, + /** + * excel的日期CODE格式化 + * @param code + * @param format + * @returns {*|void|string} + */ + dateCodeFormat: function (code, format) { + return this.dateFormat(this.dateCodeToDate(code), format) + } +} + +if (typeof layui !== 'undefined') { + layui.define(['jquery'], function(exports){ + $ = layui.jquery; + exports('excel', LAY_EXCEL); + }); +} +/*---------split--------*//* Blob.js + * A Blob, File, FileReader & URL implementation. + * 2018-08-09 + * + * By Eli Grey, http://eligrey.com + * By Jimmy Wärting, https://github.com/jimmywarting + * License: MIT + * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md + */ + +;(function(){ + + var global = typeof window === 'object' + ? window : typeof self === 'object' + ? self : this + + var BlobBuilder = global.BlobBuilder + || global.WebKitBlobBuilder + || global.MSBlobBuilder + || global.MozBlobBuilder; + + global.URL = global.URL || global.webkitURL || function(href, a) { + a = document.createElement('a') + a.href = href + return a + } + + var origBlob = global.Blob + var createObjectURL = URL.createObjectURL + var revokeObjectURL = URL.revokeObjectURL + var strTag = global.Symbol && global.Symbol.toStringTag + var blobSupported = false + var blobSupportsArrayBufferView = false + var arrayBufferSupported = !!global.ArrayBuffer + var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + + try { + // Check if Blob constructor is supported + blobSupported = new Blob(['ä']).size === 2 + + // Check if Blob constructor supports ArrayBufferViews + // Fails in Safari 6, so we need to map to ArrayBuffers there. + blobSupportsArrayBufferView = new Blob([new Uint8Array([1,2])]).size === 2 + } catch(e) {} + + /** + * Helper function that maps ArrayBufferViews to ArrayBuffers + * Used by BlobBuilder constructor and old browsers that didn't + * support it in the Blob constructor. + */ + function mapArrayBufferViews(ary) { + return ary.map(function(chunk) { + if (chunk.buffer instanceof ArrayBuffer) { + var buf = chunk.buffer; + + // if this is a subarray, make a copy so we only + // include the subarray region from the underlying buffer + if (chunk.byteLength !== buf.byteLength) { + var copy = new Uint8Array(chunk.byteLength); + copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); + buf = copy.buffer; + } + + return buf; + } + + return chunk; + }); + } + + function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + mapArrayBufferViews(ary).forEach(function(part) { + bb.append(part); + }); + + return options.type ? bb.getBlob(options.type) : bb.getBlob(); + }; + + function BlobConstructor(ary, options) { + return new origBlob(mapArrayBufferViews(ary), options || {}); + }; + + if (global.Blob) { + BlobBuilderConstructor.prototype = Blob.prototype; + BlobConstructor.prototype = Blob.prototype; + } + + function FakeBlobBuilder() { + function toUTF8Array(str) { + var utf8 = []; + for (var i=0; i < str.length; i++) { + var charcode = str.charCodeAt(i); + if (charcode < 0x80) utf8.push(charcode); + else if (charcode < 0x800) { + utf8.push(0xc0 | (charcode >> 6), + 0x80 | (charcode & 0x3f)); + } + else if (charcode < 0xd800 || charcode >= 0xe000) { + utf8.push(0xe0 | (charcode >> 12), + 0x80 | ((charcode>>6) & 0x3f), + 0x80 | (charcode & 0x3f)); + } + // surrogate pair + else { + i++; + // UTF-16 encodes 0x10000-0x10FFFF by + // subtracting 0x10000 and splitting the + // 20 bits of 0x0-0xFFFFF into two halves + charcode = 0x10000 + (((charcode & 0x3ff)<<10) + | (str.charCodeAt(i) & 0x3ff)); + utf8.push(0xf0 | (charcode >>18), + 0x80 | ((charcode>>12) & 0x3f), + 0x80 | ((charcode>>6) & 0x3f), + 0x80 | (charcode & 0x3f)); + } + } + return utf8; + } + function fromUtf8Array(array) { + var out, i, len, c; + var char2, char3; + + out = ""; + len = array.length; + i = 0; + while (i < len) { + c = array[i++]; + switch (c >> 4) + { + case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: + // 0xxxxxxx + out += String.fromCharCode(c); + break; + case 12: case 13: + // 110x xxxx 10xx xxxx + char2 = array[i++]; + out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); + break; + case 14: + // 1110 xxxx 10xx xxxx 10xx xxxx + char2 = array[i++]; + char3 = array[i++]; + out += String.fromCharCode(((c & 0x0F) << 12) | + ((char2 & 0x3F) << 6) | + ((char3 & 0x3F) << 0)); + break; + } + } + return out; + } + function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj) + } + function bufferClone(buf) { + var view = new Array(buf.byteLength) + var array = new Uint8Array(buf) + var i = view.length + while(i--) { + view[i] = array[i] + } + return view + } + function encodeByteArray(input) { + var byteToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + + var output = []; + + for (var i = 0; i < input.length; i += 3) { + var byte1 = input[i]; + var haveByte2 = i + 1 < input.length; + var byte2 = haveByte2 ? input[i + 1] : 0; + var haveByte3 = i + 2 < input.length; + var byte3 = haveByte3 ? input[i + 2] : 0; + + var outByte1 = byte1 >> 2; + var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); + var outByte3 = ((byte2 & 0x0F) << 2) | (byte3 >> 6); + var outByte4 = byte3 & 0x3F; + + if (!haveByte3) { + outByte4 = 64; + + if (!haveByte2) { + outByte3 = 64; + } + } + + output.push( + byteToCharMap[outByte1], byteToCharMap[outByte2], + byteToCharMap[outByte3], byteToCharMap[outByte4]) + } + + return output.join('') + } + + var create = Object.create || function (a) { + function c() {} + c.prototype = a; + return new c + } + + if (arrayBufferSupported) { + var viewClasses = [ + '[object Int8Array]', + '[object Uint8Array]', + '[object Uint8ClampedArray]', + '[object Int16Array]', + '[object Uint16Array]', + '[object Int32Array]', + '[object Uint32Array]', + '[object Float32Array]', + '[object Float64Array]' + ] + + var isArrayBufferView = ArrayBuffer.isView || function(obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 + } + } + + + + /********************************************************/ + /* Blob constructor */ + /********************************************************/ + function Blob(chunks, opts) { + chunks = chunks || [] + for (var i = 0, len = chunks.length; i < len; i++) { + var chunk = chunks[i] + if (chunk instanceof Blob) { + chunks[i] = chunk._buffer + } else if (typeof chunk === 'string') { + chunks[i] = toUTF8Array(chunk) + } else if (arrayBufferSupported && (ArrayBuffer.prototype.isPrototypeOf(chunk) || isArrayBufferView(chunk))) { + chunks[i] = bufferClone(chunk) + } else if (arrayBufferSupported && isDataView(chunk)) { + chunks[i] = bufferClone(chunk.buffer) + } else { + chunks[i] = toUTF8Array(String(chunk)) + } + } + + this._buffer = [].concat.apply([], chunks) + this.size = this._buffer.length + this.type = opts ? opts.type || '' : '' + } + + Blob.prototype.slice = function(start, end, type) { + var slice = this._buffer.slice(start || 0, end || this._buffer.length) + return new Blob([slice], {type: type}) + } + + Blob.prototype.toString = function() { + return '[object Blob]' + } + + + + /********************************************************/ + /* File constructor */ + /********************************************************/ + function File(chunks, name, opts) { + opts = opts || {} + var a = Blob.call(this, chunks, opts) || this + a.name = name + a.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date + a.lastModified = +a.lastModifiedDate + + return a + } + + File.prototype = create(Blob.prototype); + File.prototype.constructor = File; + + if (Object.setPrototypeOf) + Object.setPrototypeOf(File, Blob); + else { + try {File.__proto__ = Blob} catch (e) {} + } + + File.prototype.toString = function() { + return '[object File]' + } + + + /********************************************************/ + /* FileReader constructor */ + /********************************************************/ + function FileReader() { + if (!(this instanceof FileReader)) + throw new TypeError("Failed to construct 'FileReader': Please use the 'new' operator, this DOM object constructor cannot be called as a function.") + + var delegate = document.createDocumentFragment() + this.addEventListener = delegate.addEventListener + this.dispatchEvent = function(evt) { + var local = this['on' + evt.type] + if (typeof local === 'function') local(evt) + delegate.dispatchEvent(evt) + } + this.removeEventListener = delegate.removeEventListener + } + + function _read(fr, blob, kind) { + if (!(blob instanceof Blob)) + throw new TypeError("Failed to execute '" + kind + "' on 'FileReader': parameter 1 is not of type 'Blob'.") + + fr.result = '' + + setTimeout(function(){ + this.readyState = FileReader.LOADING + fr.dispatchEvent(new Event('load')) + fr.dispatchEvent(new Event('loadend')) + }) + } + + FileReader.EMPTY = 0 + FileReader.LOADING = 1 + FileReader.DONE = 2 + FileReader.prototype.error = null + FileReader.prototype.onabort = null + FileReader.prototype.onerror = null + FileReader.prototype.onload = null + FileReader.prototype.onloadend = null + FileReader.prototype.onloadstart = null + FileReader.prototype.onprogress = null + + FileReader.prototype.readAsDataURL = function(blob) { + _read(this, blob, 'readAsDataURL') + this.result = 'data:' + blob.type + ';base64,' + encodeByteArray(blob._buffer) + } + + FileReader.prototype.readAsText = function(blob) { + _read(this, blob, 'readAsText') + this.result = fromUtf8Array(blob._buffer) + } + + FileReader.prototype.readAsArrayBuffer = function(blob) { + _read(this, blob, 'readAsText') + this.result = blob._buffer.slice() + } + + FileReader.prototype.abort = function() {} + + + /********************************************************/ + /* URL */ + /********************************************************/ + URL.createObjectURL = function(blob) { + return blob instanceof Blob + ? 'data:' + blob.type + ';base64,' + encodeByteArray(blob._buffer) + : createObjectURL.call(URL, blob) + } + + URL.revokeObjectURL = function(url) { + revokeObjectURL && revokeObjectURL.call(URL, url) + } + + /********************************************************/ + /* XHR */ + /********************************************************/ + var _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send + if (_send) { + XMLHttpRequest.prototype.send = function(data) { + if (data instanceof Blob) { + this.setRequestHeader('Content-Type', data.type) + _send.call(this, fromUtf8Array(data._buffer)) + } else { + _send.call(this, data) + } + } + } + + global.FileReader = FileReader + global.File = File + global.Blob = Blob + } + + if (strTag) { + File.prototype[strTag] = 'File' + Blob.prototype[strTag] = 'Blob' + FileReader.prototype[strTag] = 'FileReader' + } + + function fixFileAndXHR() { + var isIE = !!global.ActiveXObject || ( + '-ms-scroll-limit' in document.documentElement.style && + '-ms-ime-align' in document.documentElement.style + ) + + // Monkey patched + // IE don't set Content-Type header on XHR whose body is a typed Blob + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6047383 + var _send = global.XMLHttpRequest && global.XMLHttpRequest.prototype.send + if (isIE && _send) { + XMLHttpRequest.prototype.send = function(data) { + if (data instanceof Blob) { + this.setRequestHeader('Content-Type', data.type) + _send.call(this, data) + } else { + _send.call(this, data) + } + } + } + + try { + new File([], '') + } catch(e) { + try { + var klass = new Function('class File extends Blob {' + + 'constructor(chunks, name, opts) {' + + 'opts = opts || {};' + + 'super(chunks, opts || {});' + + 'this.name = name;' + + 'this.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date;' + + 'this.lastModified = +this.lastModifiedDate;' + + '}};' + + 'return new File([], ""), File' + )() + global.File = klass + } catch(e) { + var klass = function(b, d, c) { + var blob = new Blob(b, c) + var t = c && void 0 !== c.lastModified ? new Date(c.lastModified) : new Date + + blob.name = d + blob.lastModifiedDate = t + blob.lastModified = +t + blob.toString = function() { + return '[object File]' + } + + if (strTag) + blob[strTag] = 'File' + + return blob + } + global.File = klass + } + } + } + + if (blobSupported) { + fixFileAndXHR() + global.Blob = blobSupportsArrayBufferView ? global.Blob : BlobConstructor + } else if (blobBuilderSupported) { + fixFileAndXHR() + global.Blob = BlobBuilderConstructor; + } else { + FakeBlobBuilder() + } + +})(); +/*---------split--------*/(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Depricated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(b,c,d){var e=new XMLHttpRequest;e.open("GET",b),e.responseType="blob",e.onload=function(){a(e.response,c,d)},e.onerror=function(){console.error("could not download file")},e.send()}function d(a){var b=new XMLHttpRequest;return b.open("HEAD",a,!1),b.send(),200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=f.saveAs||"object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(a,b,d,e){if(e=e||open("","_blank"),e&&(e.document.title=e.document.body.innerText="downloading..."),"string"==typeof a)return c(a,b,d);var g="application/octet-stream"===a.type,h=/constructor/i.test(f.HTMLElement)||f.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||g&&h)&&"object"==typeof FileReader){var j=new FileReader;j.onloadend=function(){var a=j.result;a=i?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),e?e.location.href=a:location=a,e=null},j.readAsDataURL(a)}else{var k=f.URL||f.webkitURL,l=k.createObjectURL(a);e?e.location=l:location.href=l,e=null,setTimeout(function(){k.revokeObjectURL(l)},4E4)}};f.saveAs=a.saveAs=a,"undefined"!=typeof module&&(module.exports=a)}); + +/*---------split--------*//* + +JSZip - A Javascript class for generating and reading zip files + + +(c) 2009-2014 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/master/LICENSE + +Note: since JSZip 3 removed critical functionality, this version assigns to the +`JSZipSync` variable. Another JSZip version can be loaded in parallel. +*/ +(function(e){ + if("object"==typeof exports&&"undefined"!=typeof module&&"undefined"==typeof DO_NOT_EXPORT_JSZIP)module.exports=e(); + else if("function"==typeof define&&define.amd&&"undefined"==typeof DO_NOT_EXPORT_JSZIP){JSZipSync=e();define([],e);} + else{ + var f; + "undefined"!=typeof window?f=window: + "undefined"!=typeof global?f=global: + "undefined"!=typeof $ && $.global?f=$.global: + "undefined"!=typeof self&&(f=self),f.JSZipSync=e() + } +}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } + else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); + + } + + return output; + }; + +// public method for decoding + exports.decode = function(input, utf8) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = _keyStr.indexOf(input.charAt(i++)); + enc2 = _keyStr.indexOf(input.charAt(i++)); + enc3 = _keyStr.indexOf(input.charAt(i++)); + enc4 = _keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + return output; + + }; + + },{}],2:[function(_dereq_,module,exports){ + 'use strict'; + function CompressedObject() { + this.compressedSize = 0; + this.uncompressedSize = 0; + this.crc32 = 0; + this.compressionMethod = null; + this.compressedContent = null; + } + + CompressedObject.prototype = { + /** + * Return the decompressed content in an unspecified format. + * The format will depend on the decompressor. + * @return {Object} the decompressed content. + */ + getContent: function() { + return null; // see implementation + }, + /** + * Return the compressed content in an unspecified format. + * The format will depend on the compressed conten source. + * @return {Object} the compressed content. + */ + getCompressedContent: function() { + return null; // see implementation + } + }; + module.exports = CompressedObject; + + },{}],3:[function(_dereq_,module,exports){ + 'use strict'; + exports.STORE = { + magic: "\x00\x00", + compress: function(content) { + return content; // no compression + }, + uncompress: function(content) { + return content; // no compression + }, + compressInputType: null, + uncompressInputType: null + }; + exports.DEFLATE = _dereq_('./flate'); + + },{"./flate":8}],4:[function(_dereq_,module,exports){ + 'use strict'; + + var utils = _dereq_('./utils'); + + var table = [ + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D + ]; + + /** + * + * Javascript crc32 + * http://www.webtoolkit.info/ + * + */ + module.exports = function crc32(input, crc) { + if (typeof input === "undefined" || !input.length) { + return 0; + } + + var isArray = utils.getTypeOf(input) !== "string"; + + if (typeof(crc) == "undefined") { + crc = 0; + } + var x = 0; + var y = 0; + var b = 0; + + crc = crc ^ (-1); + for (var i = 0, iTop = input.length; i < iTop; i++) { + b = isArray ? input[i] : input.charCodeAt(i); + y = (crc ^ b) & 0xFF; + x = table[y]; + crc = (crc >>> 8) ^ x; + } + + return crc ^ (-1); + }; +// vim: set shiftwidth=4 softtabstop=4: + + },{"./utils":21}],5:[function(_dereq_,module,exports){ + 'use strict'; + var utils = _dereq_('./utils'); + + function DataReader(data) { + this.data = null; // type : see implementation + this.length = 0; + this.index = 0; + } + DataReader.prototype = { + /** + * Check that the offset will not go too far. + * @param {string} offset the additional offset to check. + * @throws {Error} an Error if the offset is out of bounds. + */ + checkOffset: function(offset) { + this.checkIndex(this.index + offset); + }, + /** + * Check that the specifed index will not be too far. + * @param {string} newIndex the index to check. + * @throws {Error} an Error if the index is out of bounds. + */ + checkIndex: function(newIndex) { + if (this.length < newIndex || newIndex < 0) { + throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); + } + }, + /** + * Change the index. + * @param {number} newIndex The new index. + * @throws {Error} if the new index is out of the data. + */ + setIndex: function(newIndex) { + this.checkIndex(newIndex); + this.index = newIndex; + }, + /** + * Skip the next n bytes. + * @param {number} n the number of bytes to skip. + * @throws {Error} if the new index is out of the data. + */ + skip: function(n) { + this.setIndex(this.index + n); + }, + /** + * Get the byte at the specified index. + * @param {number} i the index to use. + * @return {number} a byte. + */ + byteAt: function(i) { + // see implementations + }, + /** + * Get the next number with a given byte size. + * @param {number} size the number of bytes to read. + * @return {number} the corresponding number. + */ + readInt: function(size) { + var result = 0, + i; + this.checkOffset(size); + for (i = this.index + size - 1; i >= this.index; i--) { + result = (result << 8) + this.byteAt(i); + } + this.index += size; + return result; + }, + /** + * Get the next string with a given byte size. + * @param {number} size the number of bytes to read. + * @return {string} the corresponding string. + */ + readString: function(size) { + return utils.transformTo("string", this.readData(size)); + }, + /** + * Get raw data without conversion, bytes. + * @param {number} size the number of bytes to read. + * @return {Object} the raw data, implementation specific. + */ + readData: function(size) { + // see implementations + }, + /** + * Find the last occurence of a zip signature (4 bytes). + * @param {string} sig the signature to find. + * @return {number} the index of the last occurence, -1 if not found. + */ + lastIndexOfSignature: function(sig) { + // see implementations + }, + /** + * Get the next date. + * @return {Date} the date. + */ + readDate: function() { + var dostime = this.readInt(4); + return new Date( + ((dostime >> 25) & 0x7f) + 1980, // year + ((dostime >> 21) & 0x0f) - 1, // month + (dostime >> 16) & 0x1f, // day + (dostime >> 11) & 0x1f, // hour + (dostime >> 5) & 0x3f, // minute + (dostime & 0x1f) << 1); // second + } + }; + module.exports = DataReader; + + },{"./utils":21}],6:[function(_dereq_,module,exports){ + 'use strict'; + exports.base64 = false; + exports.binary = false; + exports.dir = false; + exports.createFolders = false; + exports.date = null; + exports.compression = null; + exports.comment = null; + + },{}],7:[function(_dereq_,module,exports){ + 'use strict'; + var utils = _dereq_('./utils'); + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.string2binary = function(str) { + return utils.string2binary(str); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.string2Uint8Array = function(str) { + return utils.transformTo("uint8array", str); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.uint8Array2String = function(array) { + return utils.transformTo("string", array); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.string2Blob = function(str) { + var buffer = utils.transformTo("arraybuffer", str); + return utils.arrayBuffer2Blob(buffer); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.arrayBuffer2Blob = function(buffer) { + return utils.arrayBuffer2Blob(buffer); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.transformTo = function(outputType, input) { + return utils.transformTo(outputType, input); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.getTypeOf = function(input) { + return utils.getTypeOf(input); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.checkSupport = function(type) { + return utils.checkSupport(type); + }; + + /** + * @deprecated + * This value will be removed in a future version without replacement. + */ + exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; + + /** + * @deprecated + * This value will be removed in a future version without replacement. + */ + exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; + + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.pretty = function(str) { + return utils.pretty(str); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.findCompression = function(compressionMethod) { + return utils.findCompression(compressionMethod); + }; + + /** + * @deprecated + * This function will be removed in a future version without replacement. + */ + exports.isRegExp = function (object) { + return utils.isRegExp(object); + }; + + + },{"./utils":21}],8:[function(_dereq_,module,exports){ + 'use strict'; + var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); + + var pako = _dereq_("pako"); + exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; + exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; + + exports.magic = "\x08\x00"; + exports.compress = function(input) { + return pako.deflateRaw(input); + }; + exports.uncompress = function(input) { + return pako.inflateRaw(input); + }; + + },{"pako":24}],9:[function(_dereq_,module,exports){ + 'use strict'; + + var base64 = _dereq_('./base64'); + + /** + Usage: + zip = new JSZip(); + zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); + zip.folder("images").file("smile.gif", base64Data, {base64: true}); + zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); + zip.remove("tempfile"); + + base64zip = zip.generate(); + + **/ + + /** + * Representation a of zip file in js + * @constructor + * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional). + * @param {Object=} options the options for creating this objects (optional). + */ + function JSZipSync(data, options) { + // if this constructor is used without `new`, it adds `new` before itself: + if(!(this instanceof JSZipSync)) return new JSZipSync(data, options); + + // object containing the files : + // { + // "folder/" : {...}, + // "folder/data.txt" : {...} + // } + this.files = {}; + + this.comment = null; + + // Where we are in the hierarchy + this.root = ""; + if (data) { + this.load(data, options); + } + this.clone = function() { + var newObj = new JSZipSync(); + for (var i in this) { + if (typeof this[i] !== "function") { + newObj[i] = this[i]; + } + } + return newObj; + }; + } + JSZipSync.prototype = _dereq_('./object'); + JSZipSync.prototype.load = _dereq_('./load'); + JSZipSync.support = _dereq_('./support'); + JSZipSync.defaults = _dereq_('./defaults'); + + /** + * @deprecated + * This namespace will be removed in a future version without replacement. + */ + JSZipSync.utils = _dereq_('./deprecatedPublicUtils'); + + JSZipSync.base64 = { + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + encode : function(input) { + return base64.encode(input); + }, + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + decode : function(input) { + return base64.decode(input); + } + }; + JSZipSync.compressions = _dereq_('./compressions'); + module.exports = JSZipSync; + + },{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(_dereq_,module,exports){ + 'use strict'; + var base64 = _dereq_('./base64'); + var ZipEntries = _dereq_('./zipEntries'); + module.exports = function(data, options) { + var files, zipEntries, i, input; + options = options || {}; + if (options.base64) { + data = base64.decode(data); + } + + zipEntries = new ZipEntries(data, options); + files = zipEntries.files; + for (i = 0; i < files.length; i++) { + input = files[i]; + this.file(input.fileName, input.decompressed, { + binary: true, + optimizedBinaryString: true, + date: input.date, + dir: input.dir, + comment : input.fileComment.length ? input.fileComment : null, + createFolders: options.createFolders + }); + } + if (zipEntries.zipComment.length) { + this.comment = zipEntries.zipComment; + } + + return this; + }; + + },{"./base64":1,"./zipEntries":22}],11:[function(_dereq_,module,exports){ + (function (Buffer){ + 'use strict'; + var Buffer_from = /*::(*/function(){}/*:: :any)*/; + if(typeof Buffer !== 'undefined') { + var nbfs = !Buffer.from; + if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; } + Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer); + // $FlowIgnore + if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); }; + } + module.exports = function(data, encoding){ + return typeof data == 'number' ? Buffer.alloc(data) : Buffer_from(data, encoding); + }; + module.exports.test = function(b){ + return Buffer.isBuffer(b); + }; + }).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) + },{}],12:[function(_dereq_,module,exports){ + 'use strict'; + var Uint8ArrayReader = _dereq_('./uint8ArrayReader'); + + function NodeBufferReader(data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + } + NodeBufferReader.prototype = new Uint8ArrayReader(); + + /** + * @see DataReader.readData + */ + NodeBufferReader.prototype.readData = function(size) { + this.checkOffset(size); + var result = this.data.slice(this.index, this.index + size); + this.index += size; + return result; + }; + module.exports = NodeBufferReader; + + },{"./uint8ArrayReader":18}],13:[function(_dereq_,module,exports){ + 'use strict'; + var support = _dereq_('./support'); + var utils = _dereq_('./utils'); + var crc32 = _dereq_('./crc32'); + var signature = _dereq_('./signature'); + var defaults = _dereq_('./defaults'); + var base64 = _dereq_('./base64'); + var compressions = _dereq_('./compressions'); + var CompressedObject = _dereq_('./compressedObject'); + var nodeBuffer = _dereq_('./nodeBuffer'); + var utf8 = _dereq_('./utf8'); + var StringWriter = _dereq_('./stringWriter'); + var Uint8ArrayWriter = _dereq_('./uint8ArrayWriter'); + + /** + * Returns the raw data of a ZipObject, decompress the content if necessary. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ + var getRawData = function(file) { + if (file._data instanceof CompressedObject) { + file._data = file._data.getContent(); + file.options.binary = true; + file.options.base64 = false; + + if (utils.getTypeOf(file._data) === "uint8array") { + var copy = file._data; + // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. + // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). + file._data = new Uint8Array(copy.length); + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + if (copy.length !== 0) { + file._data.set(copy, 0); + } + } + } + return file._data; + }; + + /** + * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ + var getBinaryData = function(file) { + var result = getRawData(file), + type = utils.getTypeOf(result); + if (type === "string") { + if (!file.options.binary) { + // unicode text ! + // unicode string => binary string is a painful process, check if we can avoid it. + if (support.nodebuffer) { + return nodeBuffer(result, "utf-8"); + } + } + return file.asBinary(); + } + return result; + }; + + /** + * Transform this._data into a string. + * @param {function} filter a function String -> String, applied if not null on the result. + * @return {String} the string representing this._data. + */ + var dataToString = function(asUTF8) { + var result = getRawData(this); + if (result === null || typeof result === "undefined") { + return ""; + } + // if the data is a base64 string, we decode it before checking the encoding ! + if (this.options.base64) { + result = base64.decode(result); + } + if (asUTF8 && this.options.binary) { + // JSZip.prototype.utf8decode supports arrays as input + // skip to array => string step, utf8decode will do it. + result = out.utf8decode(result); + } + else { + // no utf8 transformation, do the array => string step. + result = utils.transformTo("string", result); + } + + if (!asUTF8 && !this.options.binary) { + result = utils.transformTo("string", out.utf8encode(result)); + } + return result; + }; + /** + * A simple object representing a file in the zip file. + * @constructor + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data + * @param {Object} options the options of the file + */ + var ZipObject = function(name, data, options) { + this.name = name; + this.dir = options.dir; + this.date = options.date; + this.comment = options.comment; + + this._data = data; + this.options = options; + + /* + * This object contains initial values for dir and date. + * With them, we can check if the user changed the deprecated metadata in + * `ZipObject#options` or not. + */ + this._initialMetadata = { + dir : options.dir, + date : options.date + }; + }; + + ZipObject.prototype = { + /** + * Return the content as UTF8 string. + * @return {string} the UTF8 string. + */ + asText: function() { + return dataToString.call(this, true); + }, + /** + * Returns the binary content. + * @return {string} the content as binary. + */ + asBinary: function() { + return dataToString.call(this, false); + }, + /** + * Returns the content as a nodejs Buffer. + * @return {Buffer} the content as a Buffer. + */ + asNodeBuffer: function() { + var result = getBinaryData(this); + return utils.transformTo("nodebuffer", result); + }, + /** + * Returns the content as an Uint8Array. + * @return {Uint8Array} the content as an Uint8Array. + */ + asUint8Array: function() { + var result = getBinaryData(this); + return utils.transformTo("uint8array", result); + }, + /** + * Returns the content as an ArrayBuffer. + * @return {ArrayBuffer} the content as an ArrayBufer. + */ + asArrayBuffer: function() { + return this.asUint8Array().buffer; + } + }; + + /** + * Transform an integer into a string in hexadecimal. + * @private + * @param {number} dec the number to convert. + * @param {number} bytes the number of bytes to generate. + * @returns {string} the result. + */ + var decToHex = function(dec, bytes) { + var hex = "", + i; + for (i = 0; i < bytes; i++) { + hex += String.fromCharCode(dec & 0xff); + dec = dec >>> 8; + } + return hex; + }; + + /** + * Merge the objects passed as parameters into a new one. + * @private + * @param {...Object} var_args All objects to merge. + * @return {Object} a new object with the data of the others. + */ + var extend = function() { + var result = {}, i, attr; + for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers + for (attr in arguments[i]) { + if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { + result[attr] = arguments[i][attr]; + } + } + } + return result; + }; + + /** + * Transforms the (incomplete) options from the user into the complete + * set of options to create a file. + * @private + * @param {Object} o the options from the user. + * @return {Object} the complete set of options. + */ + var prepareFileAttrs = function(o) { + o = o || {}; + if (o.base64 === true && (o.binary === null || o.binary === undefined)) { + o.binary = true; + } + o = extend(o, defaults); + o.date = o.date || new Date(); + if (o.compression !== null) o.compression = o.compression.toUpperCase(); + + return o; + }; + + /** + * Add a file in the current folder. + * @private + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file + * @param {Object} o the options of the file + * @return {Object} the new file. + */ + var fileAdd = function(name, data, o) { + // be sure sub folders exist + var dataType = utils.getTypeOf(data), + parent; + + o = prepareFileAttrs(o); + + if (o.createFolders && (parent = parentFolder(name))) { + folderAdd.call(this, parent, true); + } + + if (o.dir || data === null || typeof data === "undefined") { + o.base64 = false; + o.binary = false; + data = null; + } + else if (dataType === "string") { + if (o.binary && !o.base64) { + // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask + if (o.optimizedBinaryString !== true) { + // this is a string, not in a base64 format. + // Be sure that this is a correct "binary string" + data = utils.string2binary(data); + } + } + } + else { // arraybuffer, uint8array, ... + o.base64 = false; + o.binary = true; + + if (!dataType && !(data instanceof CompressedObject)) { + throw new Error("The data of '" + name + "' is in an unsupported format !"); + } + + // special case : it's way easier to work with Uint8Array than with ArrayBuffer + if (dataType === "arraybuffer") { + data = utils.transformTo("uint8array", data); + } + } + + var object = new ZipObject(name, data, o); + this.files[name] = object; + return object; + }; + + /** + * Find the parent folder of the path. + * @private + * @param {string} path the path to use + * @return {string} the parent folder, or "" + */ + var parentFolder = function (path) { + if (path.slice(-1) == '/') { + path = path.substring(0, path.length - 1); + } + var lastSlash = path.lastIndexOf('/'); + return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; + }; + + /** + * Add a (sub) folder in the current folder. + * @private + * @param {string} name the folder's name + * @param {boolean=} [createFolders] If true, automatically create sub + * folders. Defaults to false. + * @return {Object} the new folder. + */ + var folderAdd = function(name, createFolders) { + // Check the name ends with a / + if (name.slice(-1) != "/") { + name += "/"; // IE doesn't like substr(-1) + } + + createFolders = (typeof createFolders !== 'undefined') ? createFolders : false; + + // Does this folder already exist? + if (!this.files[name]) { + fileAdd.call(this, name, null, { + dir: true, + createFolders: createFolders + }); + } + return this.files[name]; + }; + + /** + * Generate a JSZip.CompressedObject for a given zipOject. + * @param {ZipObject} file the object to read. + * @param {JSZip.compression} compression the compression to use. + * @return {JSZip.CompressedObject} the compressed result. + */ + var generateCompressedObjectFrom = function(file, compression) { + var result = new CompressedObject(), + content; + + // the data has not been decompressed, we might reuse things ! + if (file._data instanceof CompressedObject) { + result.uncompressedSize = file._data.uncompressedSize; + result.crc32 = file._data.crc32; + + if (result.uncompressedSize === 0 || file.dir) { + compression = compressions['STORE']; + result.compressedContent = ""; + result.crc32 = 0; + } + else if (file._data.compressionMethod === compression.magic) { + result.compressedContent = file._data.getCompressedContent(); + } + else { + content = file._data.getContent(); + // need to decompress / recompress + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content)); + } + } + else { + // have uncompressed data + content = getBinaryData(file); + if (!content || content.length === 0 || file.dir) { + compression = compressions['STORE']; + content = ""; + } + result.uncompressedSize = content.length; + result.crc32 = crc32(content); + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content)); + } + + result.compressedSize = result.compressedContent.length; + result.compressionMethod = compression.magic; + + return result; + }; + + /** + * Generate the various parts used in the construction of the final zip file. + * @param {string} name the file name. + * @param {ZipObject} file the file content. + * @param {JSZip.CompressedObject} compressedObject the compressed object. + * @param {number} offset the current offset from the start of the zip file. + * @return {object} the zip parts. + */ + var generateZipParts = function(name, file, compressedObject, offset) { + var data = compressedObject.compressedContent, + utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), + comment = file.comment || "", + utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), + useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, + useUTF8ForComment = utfEncodedComment.length !== comment.length, + o = file.options, + dosTime, + dosDate, + extraFields = "", + unicodePathExtraField = "", + unicodeCommentExtraField = "", + dir, date; + + + // handle the deprecated options.dir + if (file._initialMetadata.dir !== file.dir) { + dir = file.dir; + } else { + dir = o.dir; + } + + // handle the deprecated options.date + if(file._initialMetadata.date !== file.date) { + date = file.date; + } else { + date = o.date; + } + + + dosTime = date.getHours(); + dosTime = dosTime << 6; + dosTime = dosTime | date.getMinutes(); + dosTime = dosTime << 5; + dosTime = dosTime | date.getSeconds() / 2; + + dosDate = date.getFullYear() - 1980; + dosDate = dosDate << 4; + dosDate = dosDate | (date.getMonth() + 1); + dosDate = dosDate << 5; + dosDate = dosDate | date.getDate(); + + if (useUTF8ForFileName) { + // set the unicode path extra field. unzip needs at least one extra + // field to correctly handle unicode path, so using the path is as good + // as any other information. This could improve the situation with + // other archive managers too. + // This field is usually used without the utf8 flag, with a non + // unicode path in the header (winrar, winzip). This helps (a bit) + // with the messy Windows' default compressed folders feature but + // breaks on p7zip which doesn't seek the unicode path extra field. + // So for now, UTF-8 everywhere ! + unicodePathExtraField = + // Version + decToHex(1, 1) + + // NameCRC32 + decToHex(crc32(utfEncodedFileName), 4) + + // UnicodeName + utfEncodedFileName; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x70" + + // size + decToHex(unicodePathExtraField.length, 2) + + // content + unicodePathExtraField; + } + + if(useUTF8ForComment) { + + unicodeCommentExtraField = + // Version + decToHex(1, 1) + + // CommentCRC32 + decToHex(this.crc32(utfEncodedComment), 4) + + // UnicodeName + utfEncodedComment; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x63" + + // size + decToHex(unicodeCommentExtraField.length, 2) + + // content + unicodeCommentExtraField; + } + + var header = ""; + + // version needed to extract + header += "\x0A\x00"; + // general purpose bit flag + // set bit 11 if utf8 + header += (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00"; + // compression method + header += compressedObject.compressionMethod; + // last mod file time + header += decToHex(dosTime, 2); + // last mod file date + header += decToHex(dosDate, 2); + // crc-32 + header += decToHex(compressedObject.crc32, 4); + // compressed size + header += decToHex(compressedObject.compressedSize, 4); + // uncompressed size + header += decToHex(compressedObject.uncompressedSize, 4); + // file name length + header += decToHex(utfEncodedFileName.length, 2); + // extra field length + header += decToHex(extraFields.length, 2); + + + var fileRecord = signature.LOCAL_FILE_HEADER + header + utfEncodedFileName + extraFields; + + var dirRecord = signature.CENTRAL_FILE_HEADER + + // version made by (00: DOS) + "\x14\x00" + + // file header (common to file and central directory) + header + + // file comment length + decToHex(utfEncodedComment.length, 2) + + // disk number start + "\x00\x00" + + // internal file attributes TODO + "\x00\x00" + + // external file attributes + (dir === true ? "\x10\x00\x00\x00" : "\x00\x00\x00\x00") + + // relative offset of local header + decToHex(offset, 4) + + // file name + utfEncodedFileName + + // extra field + extraFields + + // file comment + utfEncodedComment; + + return { + fileRecord: fileRecord, + dirRecord: dirRecord, + compressedObject: compressedObject + }; + }; + + +// return the actual prototype of JSZip + var out = { + /** + * Read an existing zip and merge the data in the current JSZip object. + * The implementation is in jszip-load.js, don't forget to include it. + * @param {String|ArrayBuffer|Uint8Array|Buffer} stream The stream to load + * @param {Object} options Options for loading the stream. + * options.base64 : is the stream in base64 ? default : false + * @return {JSZip} the current JSZip object + */ + load: function(stream, options) { + throw new Error("Load method is not defined. Is the file jszip-load.js included ?"); + }, + + /** + * Filter nested files/folders with the specified function. + * @param {Function} search the predicate to use : + * function (relativePath, file) {...} + * It takes 2 arguments : the relative path and the file. + * @return {Array} An array of matching elements. + */ + filter: function(search) { + var result = [], + filename, relativePath, file, fileClone; + for (filename in this.files) { + if (!this.files.hasOwnProperty(filename)) { + continue; + } + file = this.files[filename]; + // return a new object, don't let the user mess with our internal objects :) + fileClone = new ZipObject(file.name, file._data, extend(file.options)); + relativePath = filename.slice(this.root.length, filename.length); + if (filename.slice(0, this.root.length) === this.root && // the file is in the current root + search(relativePath, fileClone)) { // and the file matches the function + result.push(fileClone); + } + } + return result; + }, + + /** + * Add a file to the zip file, or search a file. + * @param {string|RegExp} name The name of the file to add (if data is defined), + * the name of the file to find (if no data) or a regex to match files. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded + * @param {Object} o File options + * @return {JSZip|Object|Array} this JSZip object (when adding a file), + * a file (when searching by string) or an array of files (when searching by regex). + */ + file: function(name, data, o) { + if (arguments.length === 1) { + if (utils.isRegExp(name)) { + var regexp = name; + return this.filter(function(relativePath, file) { + return !file.dir && regexp.test(relativePath); + }); + } + else { // text + return this.filter(function(relativePath, file) { + return !file.dir && relativePath === name; + })[0] || null; + } + } + else { // more than one argument : we have data ! + name = this.root + name; + fileAdd.call(this, name, data, o); + } + return this; + }, + + /** + * Add a directory to the zip file, or search. + * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. + * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. + */ + folder: function(arg) { + if (!arg) { + return this; + } + + if (utils.isRegExp(arg)) { + return this.filter(function(relativePath, file) { + return file.dir && arg.test(relativePath); + }); + } + + // else, name is a new folder + var name = this.root + arg; + var newFolder = folderAdd.call(this, name); + + // Allow chaining by returning a new object with this folder as the root + var ret = this.clone(); + ret.root = newFolder.name; + return ret; + }, + + /** + * Delete a file, or a directory and all sub-files, from the zip + * @param {string} name the name of the file to delete + * @return {JSZip} this JSZip object + */ + remove: function(name) { + name = this.root + name; + var file = this.files[name]; + if (!file) { + // Look for any folders + if (name.slice(-1) != "/") { + name += "/"; + } + file = this.files[name]; + } + + if (file && !file.dir) { + // file + delete this.files[name]; + } else { + // maybe a folder, delete recursively + var kids = this.filter(function(relativePath, file) { + return file.name.slice(0, name.length) === name; + }); + for (var i = 0; i < kids.length; i++) { + delete this.files[kids[i].name]; + } + } + + return this; + }, + + /** + * Generate the complete zip file + * @param {Object} options the options to generate the zip file : + * - base64, (deprecated, use type instead) true to generate base64. + * - compression, "STORE" by default. + * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. + * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file + */ + generate: function(options) { + options = extend(options || {}, { + base64: true, + compression: "STORE", + type: "base64", + comment: null + }); + + utils.checkSupport(options.type); + + var zipData = [], + localDirLength = 0, + centralDirLength = 0, + writer, i, + utfEncodedComment = utils.transformTo("string", this.utf8encode(options.comment || this.comment || "")); + + // first, generate all the zip parts. + for (var name in this.files) { + if (!this.files.hasOwnProperty(name)) { + continue; + } + var file = this.files[name]; + + var compressionName = file.options.compression || options.compression.toUpperCase(); + var compression = compressions[compressionName]; + if (!compression) { + throw new Error(compressionName + " is not a valid compression method !"); + } + + var compressedObject = generateCompressedObjectFrom.call(this, file, compression); + + var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); + localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; + centralDirLength += zipPart.dirRecord.length; + zipData.push(zipPart); + } + + var dirEnd = ""; + + // end of central dir signature + dirEnd = signature.CENTRAL_DIRECTORY_END + + // number of this disk + "\x00\x00" + + // number of the disk with the start of the central directory + "\x00\x00" + + // total number of entries in the central directory on this disk + decToHex(zipData.length, 2) + + // total number of entries in the central directory + decToHex(zipData.length, 2) + + // size of the central directory 4 bytes + decToHex(centralDirLength, 4) + + // offset of start of central directory with respect to the starting disk number + decToHex(localDirLength, 4) + + // .ZIP file comment length + decToHex(utfEncodedComment.length, 2) + + // .ZIP file comment + utfEncodedComment; + + + // we have all the parts (and the total length) + // time to create a writer ! + var typeName = options.type.toLowerCase(); + if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { + writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); + }else{ + writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); + } + + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].fileRecord); + writer.append(zipData[i].compressedObject.compressedContent); + } + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].dirRecord); + } + + writer.append(dirEnd); + + var zip = writer.finalize(); + + + + switch(options.type.toLowerCase()) { + // case "zip is an Uint8Array" + case "uint8array" : + case "arraybuffer" : + case "nodebuffer" : + return utils.transformTo(options.type.toLowerCase(), zip); + case "blob" : + return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); + // case "zip is a string" + case "base64" : + return (options.base64) ? base64.encode(zip) : zip; + default : // case "string" : + return zip; + } + + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + crc32: function (input, crc) { + return crc32(input, crc); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8encode: function (string) { + return utils.transformTo("string", utf8.utf8encode(string)); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8decode: function (input) { + return utf8.utf8decode(input); + } + }; + module.exports = out; + + },{"./base64":1,"./compressedObject":2,"./compressions":3,"./crc32":4,"./defaults":6,"./nodeBuffer":11,"./signature":14,"./stringWriter":16,"./support":17,"./uint8ArrayWriter":19,"./utf8":20,"./utils":21}],14:[function(_dereq_,module,exports){ + 'use strict'; + exports.LOCAL_FILE_HEADER = "PK\x03\x04"; + exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; + exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; + exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; + exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; + exports.DATA_DESCRIPTOR = "PK\x07\x08"; + + },{}],15:[function(_dereq_,module,exports){ + 'use strict'; + var DataReader = _dereq_('./dataReader'); + var utils = _dereq_('./utils'); + + function StringReader(data, optimizedBinaryString) { + this.data = data; + if (!optimizedBinaryString) { + this.data = utils.string2binary(this.data); + } + this.length = this.data.length; + this.index = 0; + } + StringReader.prototype = new DataReader(); + /** + * @see DataReader.byteAt + */ + StringReader.prototype.byteAt = function(i) { + return this.data.charCodeAt(i); + }; + /** + * @see DataReader.lastIndexOfSignature + */ + StringReader.prototype.lastIndexOfSignature = function(sig) { + return this.data.lastIndexOf(sig); + }; + /** + * @see DataReader.readData + */ + StringReader.prototype.readData = function(size) { + this.checkOffset(size); + // this will work because the constructor applied the "& 0xff" mask. + var result = this.data.slice(this.index, this.index + size); + this.index += size; + return result; + }; + module.exports = StringReader; + + },{"./dataReader":5,"./utils":21}],16:[function(_dereq_,module,exports){ + 'use strict'; + + var utils = _dereq_('./utils'); + + /** + * An object to write any content to a string. + * @constructor + */ + var StringWriter = function() { + this.data = []; + }; + StringWriter.prototype = { + /** + * Append any content to the current string. + * @param {Object} input the content to add. + */ + append: function(input) { + input = utils.transformTo("string", input); + this.data.push(input); + }, + /** + * Finalize the construction an return the result. + * @return {string} the generated string. + */ + finalize: function() { + return this.data.join(""); + } + }; + + module.exports = StringWriter; + + },{"./utils":21}],17:[function(_dereq_,module,exports){ + (function (Buffer){ + 'use strict'; + exports.base64 = true; + exports.array = true; + exports.string = true; + exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; +// contains true if JSZip can read/generate nodejs Buffer, false otherwise. +// Browserify will provide a Buffer implementation for browsers, which is +// an augmented Uint8Array (i.e., can be used as either Buffer or U8). + exports.nodebuffer = typeof Buffer !== "undefined"; +// contains true if JSZip can read/generate Uint8Array, false otherwise. + exports.uint8array = typeof Uint8Array !== "undefined"; + + if (typeof ArrayBuffer === "undefined") { + exports.blob = false; + } + else { + var buffer = new ArrayBuffer(0); + try { + exports.blob = new Blob([buffer], { + type: "application/zip" + }).size === 0; + } + catch (e) { + try { + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + exports.blob = builder.getBlob('application/zip').size === 0; + } + catch (e) { + exports.blob = false; + } + } + } + + }).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) + },{}],18:[function(_dereq_,module,exports){ + 'use strict'; + var DataReader = _dereq_('./dataReader'); + + function Uint8ArrayReader(data) { + if (data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + } + } + Uint8ArrayReader.prototype = new DataReader(); + /** + * @see DataReader.byteAt + */ + Uint8ArrayReader.prototype.byteAt = function(i) { + return this.data[i]; + }; + /** + * @see DataReader.lastIndexOfSignature + */ + Uint8ArrayReader.prototype.lastIndexOfSignature = function(sig) { + var sig0 = sig.charCodeAt(0), + sig1 = sig.charCodeAt(1), + sig2 = sig.charCodeAt(2), + sig3 = sig.charCodeAt(3); + for (var i = this.length - 4; i >= 0; --i) { + if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { + return i; + } + } + + return -1; + }; + /** + * @see DataReader.readData + */ + Uint8ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. + return new Uint8Array(0); + } + var result = this.data.subarray(this.index, this.index + size); + this.index += size; + return result; + }; + module.exports = Uint8ArrayReader; + + },{"./dataReader":5}],19:[function(_dereq_,module,exports){ + 'use strict'; + + var utils = _dereq_('./utils'); + + /** + * An object to write any content to an Uint8Array. + * @constructor + * @param {number} length The length of the array. + */ + var Uint8ArrayWriter = function(length) { + this.data = new Uint8Array(length); + this.index = 0; + }; + Uint8ArrayWriter.prototype = { + /** + * Append any content to the current array. + * @param {Object} input the content to add. + */ + append: function(input) { + if (input.length !== 0) { + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + input = utils.transformTo("uint8array", input); + this.data.set(input, this.index); + this.index += input.length; + } + }, + /** + * Finalize the construction an return the result. + * @return {Uint8Array} the generated array. + */ + finalize: function() { + return this.data; + } + }; + + module.exports = Uint8ArrayWriter; + + },{"./utils":21}],20:[function(_dereq_,module,exports){ + 'use strict'; + + var utils = _dereq_('./utils'); + var support = _dereq_('./support'); + var nodeBuffer = _dereq_('./nodeBuffer'); + + /** + * The following functions come from pako, from pako/lib/utils/strings + * released under the MIT license, see pako https://github.com/nodeca/pako/ + */ + +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff + var _utf8len = new Array(256); + for (var i=0; i<256; i++) { + _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); + } + _utf8len[254]=_utf8len[254]=1; // Invalid sequence start + +// convert string to array (typed, when possible) + var string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if (((c & 0xfc00) === 0xd800) && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += (c < 0x80) ? 1 : ((c < 0x800) ? 2 : ((c < 0x10000) ? 3 : 4)); + } + + // allocate buffer + if (support.uint8array) { + buf = new Uint8Array(buf_len); + } else { + buf = new Array(buf_len); + } + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | ((c >>> 6) & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | ((c >>> 12) & 0x3f); + buf[i++] = 0x80 | ((c >>> 6) & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; + }; + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); + var utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; + }; + +// convert array to string + var buf2string = function (buf) { + var str, i, out, c, c_len; + var len = buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + // shrinkBuf(utf16buf, out) + if (utf16buf.length !== out) { + if(utf16buf.subarray) { + utf16buf = utf16buf.subarray(0, out); + } else { + utf16buf.length = out; + } + } + + // return String.fromCharCode.apply(null, utf16buf); + return utils.applyFromCharCode(utf16buf); + }; + + +// That's all for the pako functions. + + + /** + * Transform a javascript string into an array (typed if possible) of bytes, + * UTF-8 encoded. + * @param {String} str the string to encode + * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. + */ + exports.utf8encode = function utf8encode(str) { + if (support.nodebuffer) { + return nodeBuffer(str, "utf-8"); + } + + return string2buf(str); + }; + + + /** + * Transform a bytes array (or a representation) representing an UTF-8 encoded + * string into a javascript string. + * @param {Array|Uint8Array|Buffer} buf the data de decode + * @return {String} the decoded string. + */ + exports.utf8decode = function utf8decode(buf) { + if (support.nodebuffer) { + return utils.transformTo("nodebuffer", buf).toString("utf-8"); + } + + buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); + + // return buf2string(buf); + // Chrome prefers to work with "small" chunks of data + // for the method buf2string. + // Firefox and Chrome has their own shortcut, IE doesn't seem to really care. + var result = [], k = 0, len = buf.length, chunk = 65536; + while (k < len) { + var nextBoundary = utf8border(buf, Math.min(k + chunk, len)); + if (support.uint8array) { + result.push(buf2string(buf.subarray(k, nextBoundary))); + } else { + result.push(buf2string(buf.slice(k, nextBoundary))); + } + k = nextBoundary; + } + return result.join(""); + + }; +// vim: set shiftwidth=4 softtabstop=4: + + },{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(_dereq_,module,exports){ + 'use strict'; + var support = _dereq_('./support'); + var compressions = _dereq_('./compressions'); + var nodeBuffer = _dereq_('./nodeBuffer'); + /** + * Convert a string to a "binary string" : a string containing only char codes between 0 and 255. + * @param {string} str the string to transform. + * @return {String} the binary string. + */ + exports.string2binary = function(str) { + var result = ""; + for (var i = 0; i < str.length; i++) { + result += String.fromCharCode(str.charCodeAt(i) & 0xff); + } + return result; + }; + exports.arrayBuffer2Blob = function(buffer) { + exports.checkSupport("blob"); + + try { + // Blob constructor + return new Blob([buffer], { + type: "application/zip" + }); + } + catch (e) { + + try { + // deprecated, browser only, old way + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + return builder.getBlob('application/zip'); + } + catch (e) { + + // well, fuck ?! + throw new Error("Bug : can't construct the Blob."); + } + } + + + }; + /** + * The identity function. + * @param {Object} input the input. + * @return {Object} the same input. + */ + function identity(input) { + return input; + } + + /** + * Fill in an array with a string. + * @param {String} str the string to use. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. + */ + function stringToArrayLike(str, array) { + for (var i = 0; i < str.length; ++i) { + array[i] = str.charCodeAt(i) & 0xFF; + } + return array; + } + + /** + * Transform an array-like object to a string. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @return {String} the result. + */ + function arrayLikeToString(array) { + // Performances notes : + // -------------------- + // String.fromCharCode.apply(null, array) is the fastest, see + // see http://jsperf.com/converting-a-uint8array-to-a-string/2 + // but the stack is limited (and we can get huge arrays !). + // + // result += String.fromCharCode(array[i]); generate too many strings ! + // + // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 + var chunk = 65536; + var result = [], + len = array.length, + type = exports.getTypeOf(array), + k = 0, + canUseApply = true; + try { + switch(type) { + case "uint8array": + String.fromCharCode.apply(null, new Uint8Array(0)); + break; + case "nodebuffer": + String.fromCharCode.apply(null, nodeBuffer(0)); + break; + } + } catch(e) { + canUseApply = false; + } + + // no apply : slow and painful algorithm + // default browser on android 4.* + if (!canUseApply) { + var resultStr = ""; + for(var i = 0; i < array.length;i++) { + resultStr += String.fromCharCode(array[i]); + } + return resultStr; + } + while (k < len && chunk > 1) { + try { + if (type === "array" || type === "nodebuffer") { + result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + } + else { + result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + } + k += chunk; + } + catch (e) { + chunk = Math.floor(chunk / 2); + } + } + return result.join(""); + } + + exports.applyFromCharCode = arrayLikeToString; + + + /** + * Copy the data from an array-like to an other array-like. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. + */ + function arrayLikeToArrayLike(arrayFrom, arrayTo) { + for (var i = 0; i < arrayFrom.length; i++) { + arrayTo[i] = arrayFrom[i]; + } + return arrayTo; + } + +// a matrix containing functions to transform everything into everything. + var transform = {}; + +// string to ? + transform["string"] = { + "string": identity, + "array": function(input) { + return stringToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["string"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return stringToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": function(input) { + return stringToArrayLike(input, nodeBuffer(input.length)); + } + }; + +// array to ? + transform["array"] = { + "string": arrayLikeToString, + "array": identity, + "arraybuffer": function(input) { + return (new Uint8Array(input)).buffer; + }, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(input); + } + }; + +// arraybuffer to ? + transform["arraybuffer"] = { + "string": function(input) { + return arrayLikeToString(new Uint8Array(input)); + }, + "array": function(input) { + return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); + }, + "arraybuffer": identity, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(new Uint8Array(input)); + } + }; + +// uint8array to ? + transform["uint8array"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return input.buffer; + }, + "uint8array": identity, + "nodebuffer": function(input) { + return nodeBuffer(input); + } + }; + +// nodebuffer to ? + transform["nodebuffer"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["nodebuffer"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return arrayLikeToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": identity + }; + + /** + * Transform an input into any type. + * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. + * If no output type is specified, the unmodified input will be returned. + * @param {String} outputType the output type. + * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. + * @throws {Error} an Error if the browser doesn't support the requested output type. + */ + exports.transformTo = function(outputType, input) { + if (!input) { + // undefined, null, etc + // an empty string won't harm. + input = ""; + } + if (!outputType) { + return input; + } + exports.checkSupport(outputType); + var inputType = exports.getTypeOf(input); + var result = transform[inputType][outputType](input); + return result; + }; + + /** + * Return the type of the input. + * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. + * @param {Object} input the input to identify. + * @return {String} the (lowercase) type of the input. + */ + exports.getTypeOf = function(input) { + if (typeof input === "string") { + return "string"; + } + if (Object.prototype.toString.call(input) === "[object Array]") { + return "array"; + } + if (support.nodebuffer && nodeBuffer.test(input)) { + return "nodebuffer"; + } + if (support.uint8array && input instanceof Uint8Array) { + return "uint8array"; + } + if (support.arraybuffer && input instanceof ArrayBuffer) { + return "arraybuffer"; + } + }; + + /** + * Throw an exception if the type is not supported. + * @param {String} type the type to check. + * @throws {Error} an Error if the browser doesn't support the requested type. + */ + exports.checkSupport = function(type) { + var supported = support[type.toLowerCase()]; + if (!supported) { + throw new Error(type + " is not supported by this browser"); + } + }; + exports.MAX_VALUE_16BITS = 65535; + exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 + + /** + * Prettify a string read as binary. + * @param {string} str the string to prettify. + * @return {string} a pretty string. + */ + exports.pretty = function(str) { + var res = '', + code, i; + for (i = 0; i < (str || "").length; i++) { + code = str.charCodeAt(i); + res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); + } + return res; + }; + + /** + * Find a compression registered in JSZip. + * @param {string} compressionMethod the method magic to find. + * @return {Object|null} the JSZip compression object, null if none found. + */ + exports.findCompression = function(compressionMethod) { + for (var method in compressions) { + if (!compressions.hasOwnProperty(method)) { + continue; + } + if (compressions[method].magic === compressionMethod) { + return compressions[method]; + } + } + return null; + }; + /** + * Cross-window, cross-Node-context regular expression detection + * @param {Object} object Anything + * @return {Boolean} true if the object is a regular expression, + * false otherwise + */ + exports.isRegExp = function (object) { + return Object.prototype.toString.call(object) === "[object RegExp]"; + }; + + + },{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(_dereq_,module,exports){ + 'use strict'; + var StringReader = _dereq_('./stringReader'); + var NodeBufferReader = _dereq_('./nodeBufferReader'); + var Uint8ArrayReader = _dereq_('./uint8ArrayReader'); + var utils = _dereq_('./utils'); + var sig = _dereq_('./signature'); + var ZipEntry = _dereq_('./zipEntry'); + var support = _dereq_('./support'); + var jszipProto = _dereq_('./object'); +// class ZipEntries {{{ + /** + * All the entries in the zip file. + * @constructor + * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load. + * @param {Object} loadOptions Options for loading the stream. + */ + function ZipEntries(data, loadOptions) { + this.files = []; + this.loadOptions = loadOptions; + if (data) { + this.load(data); + } + } + ZipEntries.prototype = { + /** + * Check that the reader is on the speficied signature. + * @param {string} expectedSignature the expected signature. + * @throws {Error} if it is an other signature. + */ + checkSignature: function(expectedSignature) { + var signature = this.reader.readString(4); + if (signature !== expectedSignature) { + throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + } + }, + /** + * Read the end of the central directory. + */ + readBlockEndOfCentral: function() { + this.diskNumber = this.reader.readInt(2); + this.diskWithCentralDirStart = this.reader.readInt(2); + this.centralDirRecordsOnThisDisk = this.reader.readInt(2); + this.centralDirRecords = this.reader.readInt(2); + this.centralDirSize = this.reader.readInt(4); + this.centralDirOffset = this.reader.readInt(4); + + this.zipCommentLength = this.reader.readInt(2); + // warning : the encoding depends of the system locale + // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. + // On a windows machine, this field is encoded with the localized windows code page. + this.zipComment = this.reader.readString(this.zipCommentLength); + // To get consistent behavior with the generation part, we will assume that + // this is utf8 encoded. + this.zipComment = jszipProto.utf8decode(this.zipComment); + }, + /** + * Read the end of the Zip 64 central directory. + * Not merged with the method readEndOfCentral : + * The end of central can coexist with its Zip64 brother, + * I don't want to read the wrong number of bytes ! + */ + readBlockZip64EndOfCentral: function() { + this.zip64EndOfCentralSize = this.reader.readInt(8); + this.versionMadeBy = this.reader.readString(2); + this.versionNeeded = this.reader.readInt(2); + this.diskNumber = this.reader.readInt(4); + this.diskWithCentralDirStart = this.reader.readInt(4); + this.centralDirRecordsOnThisDisk = this.reader.readInt(8); + this.centralDirRecords = this.reader.readInt(8); + this.centralDirSize = this.reader.readInt(8); + this.centralDirOffset = this.reader.readInt(8); + + this.zip64ExtensibleData = {}; + var extraDataSize = this.zip64EndOfCentralSize - 44, + index = 0, + extraFieldId, + extraFieldLength, + extraFieldValue; + while (index < extraDataSize) { + extraFieldId = this.reader.readInt(2); + extraFieldLength = this.reader.readInt(4); + extraFieldValue = this.reader.readString(extraFieldLength); + this.zip64ExtensibleData[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Read the end of the Zip 64 central directory locator. + */ + readBlockZip64EndOfCentralLocator: function() { + this.diskWithZip64CentralDirStart = this.reader.readInt(4); + this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); + this.disksCount = this.reader.readInt(4); + if (this.disksCount > 1) { + throw new Error("Multi-volumes zip are not supported"); + } + }, + /** + * Read the local files, based on the offset read in the central part. + */ + readLocalFiles: function() { + var i, file; + for (i = 0; i < this.files.length; i++) { + file = this.files[i]; + this.reader.setIndex(file.localHeaderOffset); + this.checkSignature(sig.LOCAL_FILE_HEADER); + file.readLocalPart(this.reader); + file.handleUTF8(); + } + }, + /** + * Read the central directory. + */ + readCentralDir: function() { + var file; + + this.reader.setIndex(this.centralDirOffset); + while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) { + file = new ZipEntry({ + zip64: this.zip64 + }, this.loadOptions); + file.readCentralPart(this.reader); + this.files.push(file); + } + }, + /** + * Read the end of central directory. + */ + readEndOfCentral: function() { + var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); + if (offset === -1) { + throw new Error("Corrupted zip : can't find end of central directory"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.CENTRAL_DIRECTORY_END); + this.readBlockEndOfCentral(); + + + /* extract from the zip spec : + 4) If one of the fields in the end of central directory + record is too small to hold required data, the field + should be set to -1 (0xFFFF or 0xFFFFFFFF) and the + ZIP64 format record should be created. + 5) The end of central directory record and the + Zip64 end of central directory locator record must + reside on the same disk when splitting or spanning + an archive. + */ + if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { + this.zip64 = true; + + /* + Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from + the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents + all numbers as 64-bit double precision IEEE 754 floating point numbers. + So, we have 53bits for integers and bitwise operations treat everything as 32bits. + see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators + and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 + */ + + // should look for a zip64 EOCD locator + offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + if (offset === -1) { + throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + this.readBlockZip64EndOfCentralLocator(); + + // now the zip64 EOCD record + this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + this.readBlockZip64EndOfCentral(); + } + }, + prepareReader: function(data) { + var type = utils.getTypeOf(data); + if (type === "string" && !support.uint8array) { + this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString); + } + else if (type === "nodebuffer") { + this.reader = new NodeBufferReader(data); + } + else { + this.reader = new Uint8ArrayReader(utils.transformTo("uint8array", data)); + } + }, + /** + * Read a zip file and create ZipEntries. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. + */ + load: function(data) { + this.prepareReader(data); + this.readEndOfCentral(); + this.readCentralDir(); + this.readLocalFiles(); + } + }; +// }}} end of ZipEntries + module.exports = ZipEntries; + + },{"./nodeBufferReader":12,"./object":13,"./signature":14,"./stringReader":15,"./support":17,"./uint8ArrayReader":18,"./utils":21,"./zipEntry":23}],23:[function(_dereq_,module,exports){ + 'use strict'; + var StringReader = _dereq_('./stringReader'); + var utils = _dereq_('./utils'); + var CompressedObject = _dereq_('./compressedObject'); + var jszipProto = _dereq_('./object'); +// class ZipEntry {{{ + /** + * An entry in the zip file. + * @constructor + * @param {Object} options Options of the current file. + * @param {Object} loadOptions Options for loading the stream. + */ + function ZipEntry(options, loadOptions) { + this.options = options; + this.loadOptions = loadOptions; + } + ZipEntry.prototype = { + /** + * say if the file is encrypted. + * @return {boolean} true if the file is encrypted, false otherwise. + */ + isEncrypted: function() { + // bit 1 is set + return (this.bitFlag & 0x0001) === 0x0001; + }, + /** + * say if the file has utf-8 filename/comment. + * @return {boolean} true if the filename/comment is in utf-8, false otherwise. + */ + useUTF8: function() { + // bit 11 is set + return (this.bitFlag & 0x0800) === 0x0800; + }, + /** + * Prepare the function used to generate the compressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @return {Function} the callback to get the compressed content (the type depends of the DataReader class). + */ + prepareCompressedContent: function(reader, from, length) { + return function() { + var previousIndex = reader.index; + reader.setIndex(from); + var compressedFileData = reader.readData(length); + reader.setIndex(previousIndex); + + return compressedFileData; + }; + }, + /** + * Prepare the function used to generate the uncompressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @param {JSZip.compression} compression the compression used on this file. + * @param {number} uncompressedSize the uncompressed size to expect. + * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class). + */ + prepareContent: function(reader, from, length, compression, uncompressedSize) { + return function() { + + var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); + var uncompressedFileData = compression.uncompress(compressedFileData); + + if (uncompressedFileData.length !== uncompressedSize) { + throw new Error("Bug : uncompressed data size mismatch"); + } + + return uncompressedFileData; + }; + }, + /** + * Read the local part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readLocalPart: function(reader) { + var compression, localExtraFieldsLength; + + // we already know everything from the central dir ! + // If the central dir data are false, we are doomed. + // On the bright side, the local part is scary : zip64, data descriptors, both, etc. + // The less data we get here, the more reliable this should be. + // Let's skip the whole header and dash to the data ! + reader.skip(22); + // in some zip created on windows, the filename stored in the central dir contains \ instead of /. + // Strangely, the filename here is OK. + // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes + // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... + // Search "unzip mismatching "local" filename continuing with "central" filename version" on + // the internet. + // + // I think I see the logic here : the central directory is used to display + // content and the local directory is used to extract the files. Mixing / and \ + // may be used to display \ to windows users and use / when extracting the files. + // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 + this.fileNameLength = reader.readInt(2); + localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir + this.fileName = reader.readString(this.fileNameLength); + reader.skip(localExtraFieldsLength); + + if (this.compressedSize == -1 || this.uncompressedSize == -1) { + throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize == -1 || uncompressedSize == -1)"); + } + + compression = utils.findCompression(this.compressionMethod); + if (compression === null) { // no compression found + throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + this.fileName + ")"); + } + this.decompressed = new CompressedObject(); + this.decompressed.compressedSize = this.compressedSize; + this.decompressed.uncompressedSize = this.uncompressedSize; + this.decompressed.crc32 = this.crc32; + this.decompressed.compressionMethod = this.compressionMethod; + this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression); + this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize); + + // we need to compute the crc32... + if (this.loadOptions.checkCRC32) { + this.decompressed = utils.transformTo("string", this.decompressed.getContent()); + if (jszipProto.crc32(this.decompressed) !== this.crc32) { + throw new Error("Corrupted zip : CRC32 mismatch"); + } + } + }, + + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readCentralPart: function(reader) { + this.versionMadeBy = reader.readString(2); + this.versionNeeded = reader.readInt(2); + this.bitFlag = reader.readInt(2); + this.compressionMethod = reader.readString(2); + this.date = reader.readDate(); + this.crc32 = reader.readInt(4); + this.compressedSize = reader.readInt(4); + this.uncompressedSize = reader.readInt(4); + this.fileNameLength = reader.readInt(2); + this.extraFieldsLength = reader.readInt(2); + this.fileCommentLength = reader.readInt(2); + this.diskNumberStart = reader.readInt(2); + this.internalFileAttributes = reader.readInt(2); + this.externalFileAttributes = reader.readInt(4); + this.localHeaderOffset = reader.readInt(4); + + if (this.isEncrypted()) { + throw new Error("Encrypted zip are not supported"); + } + + this.fileName = reader.readString(this.fileNameLength); + this.readExtraFields(reader); + this.parseZIP64ExtraField(reader); + this.fileComment = reader.readString(this.fileCommentLength); + + // warning, this is true only for zip with madeBy == DOS (plateform dependent feature) + this.dir = this.externalFileAttributes & 0x00000010 ? true : false; + }, + /** + * Parse the ZIP64 extra field and merge the info in the current ZipEntry. + * @param {DataReader} reader the reader to use. + */ + parseZIP64ExtraField: function(reader) { + + if (!this.extraFields[0x0001]) { + return; + } + + // should be something, preparing the extra reader + var extraReader = new StringReader(this.extraFields[0x0001].value); + + // I really hope that these 64bits integer can fit in 32 bits integer, because js + // won't let us have more. + if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { + this.uncompressedSize = extraReader.readInt(8); + } + if (this.compressedSize === utils.MAX_VALUE_32BITS) { + this.compressedSize = extraReader.readInt(8); + } + if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { + this.localHeaderOffset = extraReader.readInt(8); + } + if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { + this.diskNumberStart = extraReader.readInt(4); + } + }, + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readExtraFields: function(reader) { + var start = reader.index, + extraFieldId, + extraFieldLength, + extraFieldValue; + + this.extraFields = this.extraFields || {}; + + while (reader.index < start + this.extraFieldsLength) { + extraFieldId = reader.readInt(2); + extraFieldLength = reader.readInt(2); + extraFieldValue = reader.readString(extraFieldLength); + + this.extraFields[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Apply an UTF8 transformation if needed. + */ + handleUTF8: function() { + if (this.useUTF8()) { + this.fileName = jszipProto.utf8decode(this.fileName); + this.fileComment = jszipProto.utf8decode(this.fileComment); + } else { + var upath = this.findExtraFieldUnicodePath(); + if (upath !== null) { + this.fileName = upath; + } + var ucomment = this.findExtraFieldUnicodeComment(); + if (ucomment !== null) { + this.fileComment = ucomment; + } + } + }, + + /** + * Find the unicode path declared in the extra field, if any. + * @return {String} the unicode path, null otherwise. + */ + findExtraFieldUnicodePath: function() { + var upathField = this.extraFields[0x7075]; + if (upathField) { + var extraReader = new StringReader(upathField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the filename changed, this field is out of date. + if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(upathField.length - 5)); + } + return null; + }, + + /** + * Find the unicode comment declared in the extra field, if any. + * @return {String} the unicode comment, null otherwise. + */ + findExtraFieldUnicodeComment: function() { + var ucommentField = this.extraFields[0x6375]; + if (ucommentField) { + var extraReader = new StringReader(ucommentField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the comment changed, this field is out of date. + if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5)); + } + return null; + } + }; + module.exports = ZipEntry; + + },{"./compressedObject":2,"./object":13,"./stringReader":15,"./utils":21}],24:[function(_dereq_,module,exports){ +// Top level file is just a mixin of submodules & constants + 'use strict'; + + var assign = _dereq_('./lib/utils/common').assign; + + var deflate = _dereq_('./lib/deflate'); + var inflate = _dereq_('./lib/inflate'); + var constants = _dereq_('./lib/zlib/constants'); + + var pako = {}; + + assign(pako, deflate, inflate, constants); + + module.exports = pako; + },{"./lib/deflate":25,"./lib/inflate":26,"./lib/utils/common":27,"./lib/zlib/constants":30}],25:[function(_dereq_,module,exports){ + 'use strict'; + + + var zlib_deflate = _dereq_('./zlib/deflate.js'); + var utils = _dereq_('./utils/common'); + var strings = _dereq_('./utils/strings'); + var msg = _dereq_('./zlib/messages'); + var zstream = _dereq_('./zlib/zstream'); + + + /* Public constants ==========================================================*/ + /* ===========================================================================*/ + + var Z_NO_FLUSH = 0; + var Z_FINISH = 4; + + var Z_OK = 0; + var Z_STREAM_END = 1; + + var Z_DEFAULT_COMPRESSION = -1; + + var Z_DEFAULT_STRATEGY = 0; + + var Z_DEFLATED = 8; + + /* ===========================================================================*/ + + + /** + * class Deflate + * + * Generic JS-style wrapper for zlib calls. If you don't need + * streaming behaviour - use more simple functions: [[deflate]], + * [[deflateRaw]] and [[gzip]]. + **/ + + /* internal + * Deflate.chunks -> Array + * + * Chunks of output data, if [[Deflate#onData]] not overriden. + **/ + + /** + * Deflate.result -> Uint8Array|Array + * + * Compressed result, generated by default [[Deflate#onData]] + * and [[Deflate#onEnd]] handlers. Filled after you push last chunk + * (call [[Deflate#push]] with `Z_FINISH` / `true` param). + **/ + + /** + * Deflate.err -> Number + * + * Error code after deflate finished. 0 (Z_OK) on success. + * You will not need it in real life, because deflate errors + * are possible only on wrong options or bad `onData` / `onEnd` + * custom handlers. + **/ + + /** + * Deflate.msg -> String + * + * Error message, if [[Deflate.err]] != 0 + **/ + + + /** + * new Deflate(options) + * - options (Object): zlib deflate options. + * + * Creates new deflator instance with specified params. Throws exception + * on bad params. Supported options: + * + * - `level` + * - `windowBits` + * - `memLevel` + * - `strategy` + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Additional options, for internal needs: + * + * - `chunkSize` - size of generated data chunks (16K by default) + * - `raw` (Boolean) - do raw deflate + * - `gzip` (Boolean) - create gzip wrapper + * - `to` (String) - if equal to 'string', then result will be "binary string" + * (each char code [0..255]) + * - `header` (Object) - custom header for gzip + * - `text` (Boolean) - true if compressed data believed to be text + * - `time` (Number) - modification time, unix timestamp + * - `os` (Number) - operation system code + * - `extra` (Array) - array of bytes with extra data (max 65536) + * - `name` (String) - file name (binary string) + * - `comment` (String) - comment (binary string) + * - `hcrc` (Boolean) - true if header crc should be added + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + * + * var deflate = new pako.Deflate({ level: 3}); + * + * deflate.push(chunk1, false); + * deflate.push(chunk2, true); // true -> last chunk + * + * if (deflate.err) { throw new Error(deflate.err); } + * + * console.log(deflate.result); + * ``` + **/ + var Deflate = function(options) { + + this.options = utils.assign({ + level: Z_DEFAULT_COMPRESSION, + method: Z_DEFLATED, + chunkSize: 16384, + windowBits: 15, + memLevel: 8, + strategy: Z_DEFAULT_STRATEGY, + to: '' + }, options || {}); + + var opt = this.options; + + if (opt.raw && (opt.windowBits > 0)) { + opt.windowBits = -opt.windowBits; + } + + else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { + opt.windowBits += 16; + } + + this.err = 0; // error code, if happens (0 = Z_OK) + this.msg = ''; // error message + this.ended = false; // used to avoid multiple onEnd() calls + this.chunks = []; // chunks of compressed data + + this.strm = new zstream(); + this.strm.avail_out = 0; + + var status = zlib_deflate.deflateInit2( + this.strm, + opt.level, + opt.method, + opt.windowBits, + opt.memLevel, + opt.strategy + ); + + if (status !== Z_OK) { + throw new Error(msg[status]); + } + + if (opt.header) { + zlib_deflate.deflateSetHeader(this.strm, opt.header); + } + }; + + /** + * Deflate#push(data[, mode]) -> Boolean + * - data (Uint8Array|Array|String): input data. Strings will be converted to + * utf8 byte sequence. + * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. + * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. + * + * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with + * new compressed chunks. Returns `true` on success. The last data block must have + * mode Z_FINISH (or `true`). That flush internal pending buffers and call + * [[Deflate#onEnd]]. + * + * On fail call [[Deflate#onEnd]] with error code and return false. + * + * We strongly recommend to use `Uint8Array` on input for best speed (output + * array format is detected automatically). Also, don't skip last param and always + * use the same type in your code (boolean or number). That will improve JS speed. + * + * For regular `Array`-s make sure all elements are [0..255]. + * + * ##### Example + * + * ```javascript + * push(chunk, false); // push one of data chunks + * ... + * push(chunk, true); // push last chunk + * ``` + **/ + Deflate.prototype.push = function(data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var status, _mode; + + if (this.ended) { return false; } + + _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); + + // Convert data if needed + if (typeof data === 'string') { + // If we need to compress text, change encoding to utf8. + strm.input = strings.string2buf(data); + } else { + strm.input = data; + } + + strm.next_in = 0; + strm.avail_in = strm.input.length; + + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ + + if (status !== Z_STREAM_END && status !== Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) { + if (this.options.to === 'string') { + this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); + + // Finalize on the last chunk. + if (_mode === Z_FINISH) { + status = zlib_deflate.deflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === Z_OK; + } + + return true; + }; + + + /** + * Deflate#onData(chunk) -> Void + * - chunk (Uint8Array|Array|String): ouput data. Type of array depends + * on js engine support. When string output requested, each chunk + * will be string. + * + * By default, stores data blocks in `chunks[]` property and glue + * those in `onEnd`. Override this handler, if you need another behaviour. + **/ + Deflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); + }; + + + /** + * Deflate#onEnd(status) -> Void + * - status (Number): deflate status. 0 (Z_OK) on success, + * other if not. + * + * Called once after you tell deflate that input stream complete + * or error happenned. By default - join collected chunks, + * free memory and fill `results` / `err` properties. + **/ + Deflate.prototype.onEnd = function(status) { + // On success - join + if (status === Z_OK) { + if (this.options.to === 'string') { + this.result = this.chunks.join(''); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; + }; + + + /** + * deflate(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * Compress `data` with deflate alrorythm and `options`. + * + * Supported options are: + * + * - level + * - windowBits + * - memLevel + * - strategy + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Sugar (options): + * + * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify + * negative windowBits implicitly. + * - `to` (String) - if equal to 'string', then result will be "binary string" + * (each char code [0..255]) + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); + * + * console.log(pako.deflate(data)); + * ``` + **/ + function deflate(input, options) { + var deflator = new Deflate(options); + + deflator.push(input, true); + + // That will never happens, if you don't cheat with options :) + if (deflator.err) { throw deflator.msg; } + + return deflator.result; + } + + + /** + * deflateRaw(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * The same as [[deflate]], but creates raw data, without wrapper + * (header and adler32 crc). + **/ + function deflateRaw(input, options) { + options = options || {}; + options.raw = true; + return deflate(input, options); + } + + + /** + * gzip(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * The same as [[deflate]], but create gzip wrapper instead of + * deflate one. + **/ + function gzip(input, options) { + options = options || {}; + options.gzip = true; + return deflate(input, options); + } + + + exports.Deflate = Deflate; + exports.deflate = deflate; + exports.deflateRaw = deflateRaw; + exports.gzip = gzip; + },{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(_dereq_,module,exports){ + 'use strict'; + + + var zlib_inflate = _dereq_('./zlib/inflate.js'); + var utils = _dereq_('./utils/common'); + var strings = _dereq_('./utils/strings'); + var c = _dereq_('./zlib/constants'); + var msg = _dereq_('./zlib/messages'); + var zstream = _dereq_('./zlib/zstream'); + var gzheader = _dereq_('./zlib/gzheader'); + + + /** + * class Inflate + * + * Generic JS-style wrapper for zlib calls. If you don't need + * streaming behaviour - use more simple functions: [[inflate]] + * and [[inflateRaw]]. + **/ + + /* internal + * inflate.chunks -> Array + * + * Chunks of output data, if [[Inflate#onData]] not overriden. + **/ + + /** + * Inflate.result -> Uint8Array|Array|String + * + * Uncompressed result, generated by default [[Inflate#onData]] + * and [[Inflate#onEnd]] handlers. Filled after you push last chunk + * (call [[Inflate#push]] with `Z_FINISH` / `true` param). + **/ + + /** + * Inflate.err -> Number + * + * Error code after inflate finished. 0 (Z_OK) on success. + * Should be checked if broken data possible. + **/ + + /** + * Inflate.msg -> String + * + * Error message, if [[Inflate.err]] != 0 + **/ + + + /** + * new Inflate(options) + * - options (Object): zlib inflate options. + * + * Creates new inflator instance with specified params. Throws exception + * on bad params. Supported options: + * + * - `windowBits` + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Additional options, for internal needs: + * + * - `chunkSize` - size of generated data chunks (16K by default) + * - `raw` (Boolean) - do raw inflate + * - `to` (String) - if equal to 'string', then result will be converted + * from utf8 to utf16 (javascript) string. When string output requested, + * chunk length can differ from `chunkSize`, depending on content. + * + * By default, when no options set, autodetect deflate/gzip data format via + * wrapper header. + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + * + * var inflate = new pako.Inflate({ level: 3}); + * + * inflate.push(chunk1, false); + * inflate.push(chunk2, true); // true -> last chunk + * + * if (inflate.err) { throw new Error(inflate.err); } + * + * console.log(inflate.result); + * ``` + **/ + var Inflate = function(options) { + + this.options = utils.assign({ + chunkSize: 16384, + windowBits: 0, + to: '' + }, options || {}); + + var opt = this.options; + + // Force window size for `raw` data, if not set directly, + // because we have no header for autodetect. + if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { + opt.windowBits = -opt.windowBits; + if (opt.windowBits === 0) { opt.windowBits = -15; } + } + + // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate + if ((opt.windowBits >= 0) && (opt.windowBits < 16) && + !(options && options.windowBits)) { + opt.windowBits += 32; + } + + // Gzip header has no info about windows size, we can do autodetect only + // for deflate. So, if window size not set, force it to max when gzip possible + if ((opt.windowBits > 15) && (opt.windowBits < 48)) { + // bit 3 (16) -> gzipped data + // bit 4 (32) -> autodetect gzip/deflate + if ((opt.windowBits & 15) === 0) { + opt.windowBits |= 15; + } + } + + this.err = 0; // error code, if happens (0 = Z_OK) + this.msg = ''; // error message + this.ended = false; // used to avoid multiple onEnd() calls + this.chunks = []; // chunks of compressed data + + this.strm = new zstream(); + this.strm.avail_out = 0; + + var status = zlib_inflate.inflateInit2( + this.strm, + opt.windowBits + ); + + if (status !== c.Z_OK) { + throw new Error(msg[status]); + } + + this.header = new gzheader(); + + zlib_inflate.inflateGetHeader(this.strm, this.header); + }; + + /** + * Inflate#push(data[, mode]) -> Boolean + * - data (Uint8Array|Array|String): input data + * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. + * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. + * + * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with + * new output chunks. Returns `true` on success. The last data block must have + * mode Z_FINISH (or `true`). That flush internal pending buffers and call + * [[Inflate#onEnd]]. + * + * On fail call [[Inflate#onEnd]] with error code and return false. + * + * We strongly recommend to use `Uint8Array` on input for best speed (output + * format is detected automatically). Also, don't skip last param and always + * use the same type in your code (boolean or number). That will improve JS speed. + * + * For regular `Array`-s make sure all elements are [0..255]. + * + * ##### Example + * + * ```javascript + * push(chunk, false); // push one of data chunks + * ... + * push(chunk, true); // push last chunk + * ``` + **/ + Inflate.prototype.push = function(data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var status, _mode; + var next_out_utf8, tail, utf8str; + + if (this.ended) { return false; } + _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); + + // Convert data if needed + if (typeof data === 'string') { + // Only binary strings can be decompressed on practice + strm.input = strings.binstring2buf(data); + } else { + strm.input = data; + } + + strm.next_in = 0; + strm.avail_in = strm.input.length; + + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + + status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ + + if (status !== c.Z_STREAM_END && status !== c.Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + + if (strm.next_out) { + if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) { + + if (this.options.to === 'string') { + + next_out_utf8 = strings.utf8border(strm.output, strm.next_out); + + tail = strm.next_out - next_out_utf8; + utf8str = strings.buf2string(strm.output, next_out_utf8); + + // move tail + strm.next_out = tail; + strm.avail_out = chunkSize - tail; + if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } + + this.onData(utf8str); + + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } + } while ((strm.avail_in > 0) && status !== c.Z_STREAM_END); + + if (status === c.Z_STREAM_END) { + _mode = c.Z_FINISH; + } + // Finalize on the last chunk. + if (_mode === c.Z_FINISH) { + status = zlib_inflate.inflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === c.Z_OK; + } + + return true; + }; + + + /** + * Inflate#onData(chunk) -> Void + * - chunk (Uint8Array|Array|String): ouput data. Type of array depends + * on js engine support. When string output requested, each chunk + * will be string. + * + * By default, stores data blocks in `chunks[]` property and glue + * those in `onEnd`. Override this handler, if you need another behaviour. + **/ + Inflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); + }; + + + /** + * Inflate#onEnd(status) -> Void + * - status (Number): inflate status. 0 (Z_OK) on success, + * other if not. + * + * Called once after you tell inflate that input stream complete + * or error happenned. By default - join collected chunks, + * free memory and fill `results` / `err` properties. + **/ + Inflate.prototype.onEnd = function(status) { + // On success - join + if (status === c.Z_OK) { + if (this.options.to === 'string') { + // Glue & convert here, until we teach pako to send + // utf8 alligned strings to onData + this.result = this.chunks.join(''); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; + }; + + + /** + * inflate(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * Decompress `data` with inflate/ungzip and `options`. Autodetect + * format via wrapper header by default. That's why we don't provide + * separate `ungzip` method. + * + * Supported options are: + * + * - windowBits + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information. + * + * Sugar (options): + * + * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify + * negative windowBits implicitly. + * - `to` (String) - if equal to 'string', then result will be converted + * from utf8 to utf16 (javascript) string. When string output requested, + * chunk length can differ from `chunkSize`, depending on content. + * + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) + * , output; + * + * try { + * output = pako.inflate(input); + * } catch (err) + * console.log(err); + * } + * ``` + **/ + function inflate(input, options) { + var inflator = new Inflate(options); + + inflator.push(input, true); + + // That will never happens, if you don't cheat with options :) + if (inflator.err) { throw inflator.msg; } + + return inflator.result; + } + + + /** + * inflateRaw(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * The same as [[inflate]], but creates raw data, without wrapper + * (header and adler32 crc). + **/ + function inflateRaw(input, options) { + options = options || {}; + options.raw = true; + return inflate(input, options); + } + + + /** + * ungzip(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * Just shortcut to [[inflate]], because it autodetects format + * by header.content. Done for convenience. + **/ + + + exports.Inflate = Inflate; + exports.inflate = inflate; + exports.inflateRaw = inflateRaw; + exports.ungzip = inflate; + + },{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(_dereq_,module,exports){ + 'use strict'; + + + var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + + + exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } + + if (typeof(source) !== 'object') { + throw new TypeError(source + 'must be non-object'); + } + + for (var p in source) { + if (source.hasOwnProperty(p)) { + obj[p] = source[p]; + } + } + } + + return obj; + }; + + +// reduce buffer size, avoiding mem copy + exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; + }; + + + var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs+len), dest_offs); + return; + } + // Fallback to ordinary array + for(var i=0; i= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); + } + _utf8len[254]=_utf8len[254]=1; // Invalid sequence start + + +// convert string to array (typed, when possible) + exports.string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + buf = new utils.Buf8(buf_len); + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; + }; + +// Helper (used in 2 places) + function buf2binstring(buf, len) { + // use fallback for big arrays to avoid stack overflow + if (len < 65537) { + if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { + return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); + } + } + + var result = ''; + for(var i=0; i < len; i++) { + result += String.fromCharCode(buf[i]); + } + return result; + } + + +// Convert byte array to binary string + exports.buf2binstring = function(buf) { + return buf2binstring(buf, buf.length); + }; + + +// Convert binary string (typed, when possible) + exports.binstring2buf = function(str) { + var buf = new utils.Buf8(str.length); + for(var i=0, len=buf.length; i < len; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; + }; + + +// convert array to string + exports.buf2string = function (buf, max) { + var i, out, c, c_len; + var len = max || buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + return buf2binstring(utf16buf, out); + }; + + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); + exports.utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; + }; + + },{"./common":27}],29:[function(_dereq_,module,exports){ + 'use strict'; + +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It doesn't worth to make additional optimizationa as in original. +// Small size is preferable. + + function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0 + , s2 = ((adler >>> 16) & 0xffff) |0 + , n = 0; + + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; + + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); + + s1 %= 65521; + s2 %= 65521; + } + + return (s1 | (s2 << 16)) |0; + } + + + module.exports = adler32; + },{}],30:[function(_dereq_,module,exports){ + module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + + + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type + }; + },{}],31:[function(_dereq_,module,exports){ + 'use strict'; + +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. + + +// Use ordinary array, since untyped makes no boost here + function makeTable() { + var c, table = []; + + for(var n =0; n < 256; n++){ + c = n; + for(var k =0; k < 8; k++){ + c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } + + return table; + } + +// Create table on load. Just 255 signed longs. Not a problem. + var crcTable = makeTable(); + + + function crc32(crc, buf, len, pos) { + var t = crcTable + , end = pos + len; + + crc = crc ^ (-1); + + for (var i = pos; i < end; i++ ) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; + } + + + module.exports = crc32; + },{}],32:[function(_dereq_,module,exports){ + 'use strict'; + + var utils = _dereq_('../utils/common'); + var trees = _dereq_('./trees'); + var adler32 = _dereq_('./adler32'); + var crc32 = _dereq_('./crc32'); + var msg = _dereq_('./messages'); + + /* Public constants ==========================================================*/ + /* ===========================================================================*/ + + + /* Allowed flush values; see deflate() and inflate() below for details */ + var Z_NO_FLUSH = 0; + var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; + var Z_FULL_FLUSH = 3; + var Z_FINISH = 4; + var Z_BLOCK = 5; +//var Z_TREES = 6; + + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + var Z_OK = 0; + var Z_STREAM_END = 1; +//var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; + var Z_STREAM_ERROR = -2; + var Z_DATA_ERROR = -3; +//var Z_MEM_ERROR = -4; + var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + + + /* compression levels */ +//var Z_NO_COMPRESSION = 0; +//var Z_BEST_SPEED = 1; +//var Z_BEST_COMPRESSION = 9; + var Z_DEFAULT_COMPRESSION = -1; + + + var Z_FILTERED = 1; + var Z_HUFFMAN_ONLY = 2; + var Z_RLE = 3; + var Z_FIXED = 4; + var Z_DEFAULT_STRATEGY = 0; + + /* Possible values of the data_type field (though see inflate()) */ +//var Z_BINARY = 0; +//var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT + var Z_UNKNOWN = 2; + + + /* The deflate compression method */ + var Z_DEFLATED = 8; + + /*============================================================================*/ + + + var MAX_MEM_LEVEL = 9; + /* Maximum value for memLevel in deflateInit2 */ + var MAX_WBITS = 15; + /* 32K LZ77 window */ + var DEF_MEM_LEVEL = 8; + + + var LENGTH_CODES = 29; + /* number of length codes, not counting the special END_BLOCK code */ + var LITERALS = 256; + /* number of literal bytes 0..255 */ + var L_CODES = LITERALS + 1 + LENGTH_CODES; + /* number of Literal or Length codes, including the END_BLOCK code */ + var D_CODES = 30; + /* number of distance codes */ + var BL_CODES = 19; + /* number of codes used to transfer the bit lengths */ + var HEAP_SIZE = 2*L_CODES + 1; + /* maximum heap size */ + var MAX_BITS = 15; + /* All codes must not exceed MAX_BITS bits */ + + var MIN_MATCH = 3; + var MAX_MATCH = 258; + var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); + + var PRESET_DICT = 0x20; + + var INIT_STATE = 42; + var EXTRA_STATE = 69; + var NAME_STATE = 73; + var COMMENT_STATE = 91; + var HCRC_STATE = 103; + var BUSY_STATE = 113; + var FINISH_STATE = 666; + + var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ + var BS_BLOCK_DONE = 2; /* block flush performed */ + var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ + var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ + + var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. + + function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; + } + + function rank(f) { + return ((f) << 1) - ((f) > 4 ? 9 : 0); + } + + function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + + + /* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->output buffer and copying into it. + * (See also read_buf()). + */ + function flush_pending(strm) { + var s = strm.state; + + //_tr_flush_bits(s); + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { return; } + + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } + } + + + function flush_block_only (s, last) { + trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); + } + + + function put_byte(s, b) { + s.pending_buf[s.pending++] = b; + } + + + /* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ + function putShortMSB(s, b) { +// put_byte(s, (Byte)(b >> 8)); +// put_byte(s, (Byte)(b & 0xff)); + s.pending_buf[s.pending++] = (b >>> 8) & 0xff; + s.pending_buf[s.pending++] = b & 0xff; + } + + + /* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->input buffer and copying from it. + * (See also flush_pending()). + */ + function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + + if (len > size) { len = size; } + if (len === 0) { return 0; } + + strm.avail_in -= len; + + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } + + else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + + strm.next_in += len; + strm.total_in += len; + + return len; + } + + + /* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ + function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; /* max hash chain length */ + var scan = s.strstart; /* current string */ + var match; /* matched string */ + var len; /* length of current match */ + var best_len = s.prev_length; /* best match length so far */ + var nice_match = s.nice_match; /* stop if match long enough */ + var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? + s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; + + var _win = s.window; // shortcut + + var wmask = s.w_mask; + var prev = s.prev; + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if (nice_match > s.lookahead) { nice_match = s.lookahead; } + + // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + // Assert(cur_match < s->strstart, "no future"); + match = cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ + + if (_win[match + best_len] !== scan_end || + _win[match + best_len - 1] !== scan_end1 || + _win[match] !== _win[scan] || + _win[++match] !== _win[scan + 1]) { + continue; + } + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2; + match++; + // Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + /*jshint noempty:false*/ + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + scan < strend); + + // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; + } + + + /* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ + function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + + //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = s.window_size - s.lookahead - s.strstart; + + // JS ints have 32 bit, block below not needed + /* Deal with !@#$% 64K limit: */ + //if (sizeof(int) <= 2) { + // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + // more = wsize; + // + // } else if (more == (unsigned)(-1)) { + // /* Very unlikely, but possible on 16 bit machine if + // * strstart == 0 && lookahead == 1 (input done a byte at time) + // */ + // more--; + // } + //} + + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + /* we now have strstart >= MAX_DIST */ + s.block_start -= _w_size; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = (m >= _w_size ? m - _w_size : 0); + } while (--n); + + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = (m >= _w_size ? m - _w_size : 0); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); + + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + //Assert(more >= 2, "more < 2"); + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + + /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; +//#if MIN_MATCH != 3 +// Call update_hash() MIN_MATCH-3 more times +//#endif + while (s.insert) { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH-1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ +// if (s.high_water < s.window_size) { +// var curr = s.strstart + s.lookahead; +// var init = 0; +// +// if (s.high_water < curr) { +// /* Previous high water mark below current data -- zero WIN_INIT +// * bytes or up to end of window, whichever is less. +// */ +// init = s.window_size - curr; +// if (init > WIN_INIT) +// init = WIN_INIT; +// zmemzero(s->window + curr, (unsigned)init); +// s->high_water = curr + init; +// } +// else if (s->high_water < (ulg)curr + WIN_INIT) { +// /* High water mark at or above current data, but below current data +// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up +// * to end of window, whichever is less. +// */ +// init = (ulg)curr + WIN_INIT - s->high_water; +// if (init > s->window_size - s->high_water) +// init = s->window_size - s->high_water; +// zmemzero(s->window + s->high_water, (unsigned)init); +// s->high_water += init; +// } +// } +// +// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, +// "not enough room for search"); + } + + /* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ + function deflate_stored(s, flush) { + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + var max_block_size = 0xffff; + + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s.lookahead <= 1) { + + //Assert(s->strstart < s->w_size+MAX_DIST(s) || + // s->block_start >= (long)s->w_size, "slide too late"); +// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || +// s.block_start >= s.w_size)) { +// throw new Error("slide too late"); +// } + + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + + if (s.lookahead === 0) { + break; + } + /* flush the current block */ + } + //Assert(s->block_start >= 0L, "block gone"); +// if (s.block_start < 0) throw new Error("block gone"); + + s.strstart += s.lookahead; + s.lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + var max_start = s.block_start + max_block_size; + + if (s.strstart === 0 || s.strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + + + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + + s.insert = 0; + + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + + if (s.strstart > s.block_start) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_NEED_MORE; + } + + /* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ + function deflate_fast(s, flush) { + var hash_head; /* head of the hash chain */ + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; /* flush the current block */ + } + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + } + if (s.match_length >= MIN_MATCH) { + // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only + + /*** _tr_tally_dist(s, s.strstart - s.match_start, + s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { + s.match_length--; /* string at strstart already in table */ + do { + s.strstart++; + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s.match_length !== 0); + s.strstart++; + } else + { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; + +//#if MIN_MATCH != 3 +// Call UPDATE_HASH() MIN_MATCH-3 more times +//#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s.window[s.strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = ((s.strstart < (MIN_MATCH-1)) ? s.strstart : MIN_MATCH-1); + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; + } + + /* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ + function deflate_slow(s, flush) { + var hash_head; /* head of hash chain */ + var bflush; /* set if current block must be flushed */ + + var max_insert; + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + */ + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH-1; + + if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && + s.strstart - hash_head <= (s.w_size-MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + + if (s.match_length <= 5 && + (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s.match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + //check_match(s, s.strstart-1, s.prev_match, s.prev_length); + + /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, + s.prev_length - MIN_MATCH, bflush);***/ + bflush = trees._tr_tally(s, s.strstart - 1- s.prev_match, s.prev_length - MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s.lookahead -= s.prev_length-1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH-1; + s.strstart++; + + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + } else if (s.match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart-1]); + + if (bflush) { + /*** FLUSH_BLOCK_ONLY(s, 0) ***/ + flush_block_only(s, false); + /***/ + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + //Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s.match_available) { + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart-1]); + + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH-1 ? s.strstart : MIN_MATCH-1; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_BLOCK_DONE; + } + + + /* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ + function deflate_rle(s, flush) { + var bflush; /* set if current block must be flushed */ + var prev; /* byte at distance one to match */ + var scan, strend; /* scan goes up to strend for length of run */ + + var _win = s.window; + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + /*jshint noempty:false*/ + } while (prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s.match_length >= MIN_MATCH) { + //check_match(s, s.strstart, s.strstart - 1, s.match_length); + + /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; + } + + /* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ + function deflate_huff(s, flush) { + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s.match_length = 0; + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; + } + + /* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ + var Config = function (good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; + }; + + var configuration_table; + + configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), /* 3 */ + + new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ + ]; + + + /* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ + function lm_init(s) { + s.window_size = 2 * s.w_size; + + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + + /* Set the default configuration parameters: + */ + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; + } + + + function DeflateState() { + this.strm = null; /* pointer back to this zlib stream */ + this.status = 0; /* as the name implies */ + this.pending_buf = null; /* output still pending */ + this.pending_buf_size = 0; /* size of pending_buf */ + this.pending_out = 0; /* next pending byte to output to the stream */ + this.pending = 0; /* nb of bytes in the pending buffer */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.gzhead = null; /* gzip header information to write */ + this.gzindex = 0; /* where in extra, name, or comment */ + this.method = Z_DEFLATED; /* can only be DEFLATED */ + this.last_flush = -1; /* value of flush param for previous deflate call */ + + this.w_size = 0; /* LZ77 window size (32K by default) */ + this.w_bits = 0; /* log2(w_size) (8..16) */ + this.w_mask = 0; /* w_size - 1 */ + + this.window = null; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. + */ + + this.window_size = 0; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + this.prev = null; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + this.head = null; /* Heads of the hash chains or NIL. */ + + this.ins_h = 0; /* hash index of string to be inserted */ + this.hash_size = 0; /* number of elements in hash table */ + this.hash_bits = 0; /* log2(hash_size) */ + this.hash_mask = 0; /* hash_size-1 */ + + this.hash_shift = 0; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + this.block_start = 0; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + this.match_length = 0; /* length of best match */ + this.prev_match = 0; /* previous match */ + this.match_available = 0; /* set if previous match exists */ + this.strstart = 0; /* start of string to insert */ + this.match_start = 0; /* start of matching string */ + this.lookahead = 0; /* number of valid bytes ahead in window */ + + this.prev_length = 0; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + this.max_chain_length = 0; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + this.max_lazy_match = 0; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ + // That's alias to max_lazy_match, don't use directly + //this.max_insert_length = 0; + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + this.level = 0; /* compression level (1..9) */ + this.strategy = 0; /* favor or force Huffman coding*/ + + this.good_match = 0; + /* Use a faster search when the previous match is longer than this */ + + this.nice_match = 0; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + + /* Didn't use ct_data typedef below to suppress compiler warning */ + + // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + // Use flat array of DOUBLE size, with interleaved fata, + // because JS does not support effective + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2*D_CODES+1) * 2); + this.bl_tree = new utils.Buf16((2*BL_CODES+1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + + this.l_desc = null; /* desc. for literal tree */ + this.d_desc = null; /* desc. for distance tree */ + this.bl_desc = null; /* desc. for bit length tree */ + + //ush bl_count[MAX_BITS+1]; + this.bl_count = new utils.Buf16(MAX_BITS+1); + /* number of codes at each bit length for an optimal tree */ + + //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + this.heap = new utils.Buf16(2*L_CODES+1); /* heap used to build the Huffman trees */ + zero(this.heap); + + this.heap_len = 0; /* number of elements in the heap */ + this.heap_max = 0; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + this.depth = new utils.Buf16(2*L_CODES+1); //uch depth[2*L_CODES+1]; + zero(this.depth); + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + this.l_buf = 0; /* buffer index for literals or lengths */ + + this.lit_bufsize = 0; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + this.last_lit = 0; /* running index in l_buf */ + + this.d_buf = 0; + /* Buffer index for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + this.opt_len = 0; /* bit length of current block with optimal trees */ + this.static_len = 0; /* bit length of current block with static trees */ + this.matches = 0; /* number of string matches in current block */ + this.insert = 0; /* bytes at end of window left to insert */ + + + this.bi_buf = 0; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + this.bi_valid = 0; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + // Used for window memory init. We safely ignore it for JS. That makes + // sense only for pointers and memory check tools. + //this.high_water = 0; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ + } + + + function deflateResetKeep(strm) { + var s; + + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + + s = strm.state; + s.pending = 0; + s.pending_out = 0; + + if (s.wrap < 0) { + s.wrap = -s.wrap; + /* was made negative by deflate(..., Z_FINISH); */ + } + s.status = (s.wrap ? INIT_STATE : BUSY_STATE); + strm.adler = (s.wrap === 2) ? + 0 // crc32(0, Z_NULL, 0) + : + 1; // adler32(0, Z_NULL, 0) + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; + } + + + function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; + } + + + function deflateSetHeader(strm, head) { + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } + strm.state.gzhead = head; + return Z_OK; + } + + + function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { // === Z_NULL + return Z_STREAM_ERROR; + } + var wrap = 1; + + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } + + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } + + + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + + + if (windowBits === 8) { + windowBits = 9; + } + /* until 256-byte window bug fixed */ + + var s = new DeflateState(); + + strm.state = s; + s.strm = strm; + + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + + // Don't need mem init magic for JS. + //s.high_water = 0; /* nothing written to s->window yet */ + + s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + s.pending_buf_size = s.lit_bufsize * 4; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + + s.d_buf = s.lit_bufsize >> 1; + s.l_buf = (1 + 2) * s.lit_bufsize; + + s.level = level; + s.strategy = strategy; + s.method = method; + + return deflateReset(strm); + } + + function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); + } + + + function deflate(strm, flush) { + var old_flush, s; + var beg, val; // for gzip header write only + + if (!strm || !strm.state || + flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + + s = strm.state; + + if (!strm.output || + (!strm.input && strm.avail_in !== 0) || + (s.status === FINISH_STATE && flush !== Z_FINISH)) { + return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + + s.strm = strm; /* just in case */ + old_flush = s.last_flush; + s.last_flush = flush; + + /* Write the header */ + if (s.status === INIT_STATE) { + + if (s.wrap === 2) { // GZIP header + strm.adler = 0; //crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { // s->gzhead == Z_NULL + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } + else { + put_byte(s, (s.gzhead.text ? 1 : 0) + + (s.gzhead.hcrc ? 2 : 0) + + (!s.gzhead.extra ? 0 : 4) + + (!s.gzhead.name ? 0 : 8) + + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 0xff); + put_byte(s, (s.gzhead.time >> 8) & 0xff); + put_byte(s, (s.gzhead.time >> 16) & 0xff); + put_byte(s, (s.gzhead.time >> 24) & 0xff); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, s.gzhead.os & 0xff); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 0xff); + put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + else // DEFLATE header + { + var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; + var level_flags = -1; + + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= (level_flags << 6); + if (s.strstart !== 0) { header |= PRESET_DICT; } + header += 31 - (header % 31); + + s.status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + strm.adler = 1; // adler32(0L, Z_NULL, 0); + } + } + +//#ifdef GZIP + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + + while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } + else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg){ + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } + else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } + else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + strm.adler = 0; //crc32(0L, Z_NULL, 0); + s.status = BUSY_STATE; + } + } + else { + s.status = BUSY_STATE; + } + } +//#endif + + /* Flush as much pending output as possible */ + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s.last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && + flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm.avail_in !== 0 || s.lookahead !== 0 || + (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { + var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : + (s.strategy === Z_RLE ? deflate_rle(s, flush) : + configuration_table[s.level].func(s, flush)); + + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } + else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + + trees._tr_stored_block(s, 0, 0, false); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush === Z_FULL_FLUSH) { + /*** CLEAR_HASH(s); ***/ /* forget history */ + zero(s.head); // Fill with NIL (= 0); + + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + //Assert(strm->avail_out > 0, "bug2"); + //if (strm.avail_out <= 0) { throw new Error("bug2");} + + if (flush !== Z_FINISH) { return Z_OK; } + if (s.wrap <= 0) { return Z_STREAM_END; } + + /* Write the trailer */ + if (s.wrap === 2) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + put_byte(s, (strm.adler >> 16) & 0xff); + put_byte(s, (strm.adler >> 24) & 0xff); + put_byte(s, strm.total_in & 0xff); + put_byte(s, (strm.total_in >> 8) & 0xff); + put_byte(s, (strm.total_in >> 16) & 0xff); + put_byte(s, (strm.total_in >> 24) & 0xff); + } + else + { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s.wrap > 0) { s.wrap = -s.wrap; } + /* write the trailer only once! */ + return s.pending !== 0 ? Z_OK : Z_STREAM_END; + } + + function deflateEnd(strm) { + var status; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + status = strm.state.status; + if (status !== INIT_STATE && + status !== EXTRA_STATE && + status !== NAME_STATE && + status !== COMMENT_STATE && + status !== HCRC_STATE && + status !== BUSY_STATE && + status !== FINISH_STATE + ) { + return err(strm, Z_STREAM_ERROR); + } + + strm.state = null; + + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; + } + + /* ========================================================================= + * Copy the source state to the destination state + */ +//function deflateCopy(dest, source) { +// +//} + + exports.deflateInit = deflateInit; + exports.deflateInit2 = deflateInit2; + exports.deflateReset = deflateReset; + exports.deflateResetKeep = deflateResetKeep; + exports.deflateSetHeader = deflateSetHeader; + exports.deflate = deflate; + exports.deflateEnd = deflateEnd; + exports.deflateInfo = 'pako deflate (from Nodeca project)'; + + /* Not implemented +exports.deflateBound = deflateBound; +exports.deflateCopy = deflateCopy; +exports.deflateSetDictionary = deflateSetDictionary; +exports.deflateParams = deflateParams; +exports.deflatePending = deflatePending; +exports.deflatePrime = deflatePrime; +exports.deflateTune = deflateTune; +*/ + },{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(_dereq_,module,exports){ + 'use strict'; + + + function GZheader() { + /* true if compressed data believed to be text */ + this.text = 0; + /* modification time */ + this.time = 0; + /* extra flags (not used when writing a gzip file) */ + this.xflags = 0; + /* operating system */ + this.os = 0; + /* pointer to extra field or Z_NULL if none */ + this.extra = null; + /* extra field length (valid if extra != Z_NULL) */ + this.extra_len = 0; // Actually, we don't need it in JS, + // but leave for few code modifications + + // + // Setup limits is not necessary because in js we should not preallocate memory + // for inflate use constant limit in 65536 bytes + // + + /* space at extra (only when reading header) */ + // this.extra_max = 0; + /* pointer to zero-terminated file name or Z_NULL */ + this.name = ''; + /* space at name (only when reading header) */ + // this.name_max = 0; + /* pointer to zero-terminated comment or Z_NULL */ + this.comment = ''; + /* space at comment (only when reading header) */ + // this.comm_max = 0; + /* true if there was or will be a header crc */ + this.hcrc = 0; + /* true when done reading gzip header (not used when writing a gzip file) */ + this.done = false; + } + + module.exports = GZheader; + },{}],34:[function(_dereq_,module,exports){ + 'use strict'; + +// See state defs from inflate.js + var BAD = 30; /* got a data error -- remain here until reset */ + var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ + + /* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state.mode === LEN + strm.avail_in >= 6 + strm.avail_out >= 258 + start >= strm.avail_out + state.bits < 8 + + On return, state.mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm.avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm.avail_out >= 258 for each loop to avoid checking for + output space. + */ + module.exports = function inflate_fast(strm, start) { + var state; + var _in; /* local strm.input */ + var last; /* have enough input while in < last */ + var _out; /* local strm.output */ + var beg; /* inflate()'s initial strm.output */ + var end; /* while out < end, enough space available */ +//#ifdef INFLATE_STRICT + var dmax; /* maximum distance from zlib header */ +//#endif + var wsize; /* window size or zero if not using window */ + var whave; /* valid bytes in the window */ + var wnext; /* window write index */ + var window; /* allocated sliding window, if wsize != 0 */ + var hold; /* local strm.hold */ + var bits; /* local strm.bits */ + var lcode; /* local strm.lencode */ + var dcode; /* local strm.distcode */ + var lmask; /* mask for first level of length codes */ + var dmask; /* mask for first level of distance codes */ + var here; /* retrieved table entry */ + var op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + var len; /* match length, unused bytes */ + var dist; /* match distance */ + var from; /* where to copy match from */ + var from_source; + + + var input, output; // JS specific, because we have no pointers + + /* copy state to local variables */ + state = strm.state; + //here = state.here; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); +//#ifdef INFLATE_STRICT + dmax = state.dmax; +//#endif + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; + + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + + here = lcode[hold & lmask]; + + dolen: + for (;;) { // Goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + if (op === 0) { /* literal */ + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + output[_out++] = here & 0xffff/*here.val*/; + } + else if (op & 16) { /* length base */ + len = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & ((1 << op) - 1); + hold >>>= op; + bits -= op; + } + //Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + + dodist: + for (;;) { // goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + + if (op & 16) { /* distance base */ + dist = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & ((1 << op) - 1); +//#ifdef INFLATE_STRICT + if (dist > dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } +//#endif + hold >>>= op; + bits -= op; + //Tracevv((stderr, "inflate: distance %u\n", dist)); + op = _out - beg; /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// if (len <= op - whave) { +// do { +// output[_out++] = 0; +// } while (--len); +// continue top; +// } +// len -= op - whave; +// do { +// output[_out++] = 0; +// } while (--op > whave); +// if (op === 0) { +// from = _out - dist; +// do { +// output[_out++] = output[from++]; +// } while (--len); +// continue top; +// } +//#endif + } + from = 0; // window index + from_source = window; + if (wnext === 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = 0; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } + else { + from = _out - dist; /* copy direct from output */ + do { /* minimum length is three */ + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } + else if ((op & 64) === 0) { /* 2nd level distance code */ + here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dodist; + } + else { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } + else if ((op & 64) === 0) { /* 2nd level length code */ + here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dolen; + } + else if (op & 32) { /* end-of-block */ + //Tracevv((stderr, "inflate: end of block\n")); + state.mode = TYPE; + break top; + } + else { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } while (_in < last && _out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + + /* update state and return */ + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); + strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); + state.hold = hold; + state.bits = bits; + return; + }; + + },{}],35:[function(_dereq_,module,exports){ + 'use strict'; + + + var utils = _dereq_('../utils/common'); + var adler32 = _dereq_('./adler32'); + var crc32 = _dereq_('./crc32'); + var inflate_fast = _dereq_('./inffast'); + var inflate_table = _dereq_('./inftrees'); + + var CODES = 0; + var LENS = 1; + var DISTS = 2; + + /* Public constants ==========================================================*/ + /* ===========================================================================*/ + + + /* Allowed flush values; see deflate() and inflate() below for details */ +//var Z_NO_FLUSH = 0; +//var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +//var Z_FULL_FLUSH = 3; + var Z_FINISH = 4; + var Z_BLOCK = 5; + var Z_TREES = 6; + + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + var Z_OK = 0; + var Z_STREAM_END = 1; + var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; + var Z_STREAM_ERROR = -2; + var Z_DATA_ERROR = -3; + var Z_MEM_ERROR = -4; + var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + + /* The deflate compression method */ + var Z_DEFLATED = 8; + + + /* STATES ====================================================================*/ + /* ===========================================================================*/ + + + var HEAD = 1; /* i: waiting for magic header */ + var FLAGS = 2; /* i: waiting for method and flags (gzip) */ + var TIME = 3; /* i: waiting for modification time (gzip) */ + var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ + var EXLEN = 5; /* i: waiting for extra length (gzip) */ + var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ + var NAME = 7; /* i: waiting for end of file name (gzip) */ + var COMMENT = 8; /* i: waiting for end of comment (gzip) */ + var HCRC = 9; /* i: waiting for header crc (gzip) */ + var DICTID = 10; /* i: waiting for dictionary check value */ + var DICT = 11; /* waiting for inflateSetDictionary() call */ + var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ + var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ + var STORED = 14; /* i: waiting for stored size (length and complement) */ + var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ + var COPY = 16; /* i/o: waiting for input or output to copy stored block */ + var TABLE = 17; /* i: waiting for dynamic block table lengths */ + var LENLENS = 18; /* i: waiting for code length code lengths */ + var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ + var LEN_ = 20; /* i: same as LEN below, but only first time in */ + var LEN = 21; /* i: waiting for length/lit/eob code */ + var LENEXT = 22; /* i: waiting for length extra bits */ + var DIST = 23; /* i: waiting for distance code */ + var DISTEXT = 24; /* i: waiting for distance extra bits */ + var MATCH = 25; /* o: waiting for output space to copy string */ + var LIT = 26; /* o: waiting for output space to write literal */ + var CHECK = 27; /* i: waiting for 32-bit check value */ + var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ + var DONE = 29; /* finished check, done -- remain here until reset */ + var BAD = 30; /* got a data error -- remain here until reset */ + var MEM = 31; /* got an inflate() memory error -- remain here until reset */ + var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ + + /* ===========================================================================*/ + + + + var ENOUGH_LENS = 852; + var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + + var MAX_WBITS = 15; + /* 32K LZ77 window */ + var DEF_WBITS = MAX_WBITS; + + + function ZSWAP32(q) { + return (((q >>> 24) & 0xff) + + ((q >>> 8) & 0xff00) + + ((q & 0xff00) << 8) + + ((q & 0xff) << 24)); + } + + + function InflateState() { + this.mode = 0; /* current inflate mode */ + this.last = false; /* true if processing last block */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.havedict = false; /* true if dictionary provided */ + this.flags = 0; /* gzip header method and flags (0 if zlib) */ + this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ + this.check = 0; /* protected copy of check value */ + this.total = 0; /* protected copy of output count */ + // TODO: may be {} + this.head = null; /* where to save gzip header information */ + + /* sliding window */ + this.wbits = 0; /* log base 2 of requested window size */ + this.wsize = 0; /* window size or zero if not using window */ + this.whave = 0; /* valid bytes in the window */ + this.wnext = 0; /* window write index */ + this.window = null; /* allocated sliding window, if needed */ + + /* bit accumulator */ + this.hold = 0; /* input bit accumulator */ + this.bits = 0; /* number of bits in "in" */ + + /* for string and stored block copying */ + this.length = 0; /* literal or length of data to copy */ + this.offset = 0; /* distance back to copy string from */ + + /* for table and code decoding */ + this.extra = 0; /* extra bits needed */ + + /* fixed and dynamic code tables */ + this.lencode = null; /* starting table for length/literal codes */ + this.distcode = null; /* starting table for distance codes */ + this.lenbits = 0; /* index bits for lencode */ + this.distbits = 0; /* index bits for distcode */ + + /* dynamic table building */ + this.ncode = 0; /* number of code length code lengths */ + this.nlen = 0; /* number of length code lengths */ + this.ndist = 0; /* number of distance code lengths */ + this.have = 0; /* number of code lengths in lens[] */ + this.next = null; /* next available space in codes[] */ + + this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ + this.work = new utils.Buf16(288); /* work area for code table building */ + + /* + because we don't have pointers in js, we use lencode and distcode directly + as buffers so we don't need codes + */ + //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ + this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ + this.distdyn = null; /* dynamic table for distance codes (JS specific) */ + this.sane = 0; /* if false, allow invalid distance too far */ + this.back = 0; /* bits back of last unprocessed length/lit */ + this.was = 0; /* initial length of match */ + } + + function inflateResetKeep(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ''; /*Z_NULL*/ + if (state.wrap) { /* to support ill-conceived Java test suite */ + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.dmax = 32768; + state.head = null/*Z_NULL*/; + state.hold = 0; + state.bits = 0; + //state.lencode = state.distcode = state.next = state.codes; + state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); + state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); + + state.sane = 1; + state.back = -1; + //Tracev((stderr, "inflate: reset\n")); + return Z_OK; + } + + function inflateReset(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); + + } + + function inflateReset2(strm, windowBits) { + var wrap; + var state; + + /* get the state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + + /* update state and reset the rest of it */ + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); + } + + function inflateInit2(strm, windowBits) { + var ret; + var state; + + if (!strm) { return Z_STREAM_ERROR; } + //strm.msg = Z_NULL; /* in case we return an error */ + + state = new InflateState(); + + //if (state === Z_NULL) return Z_MEM_ERROR; + //Tracev((stderr, "inflate: allocated\n")); + strm.state = state; + state.window = null/*Z_NULL*/; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null/*Z_NULL*/; + } + return ret; + } + + function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); + } + + + /* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ + var virgin = true; + + var lenfix, distfix; // We have no pointers in JS, so keep tables separate + + function fixedtables(state) { + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + var sym; + + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + + /* literal/length table */ + sym = 0; + while (sym < 144) { state.lens[sym++] = 8; } + while (sym < 256) { state.lens[sym++] = 9; } + while (sym < 280) { state.lens[sym++] = 7; } + while (sym < 288) { state.lens[sym++] = 8; } + + inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {bits: 9}); + + /* distance table */ + sym = 0; + while (sym < 32) { state.lens[sym++] = 5; } + + inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {bits: 5}); + + /* do this just once */ + virgin = false; + } + + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; + } + + + /* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ + function updatewindow(strm, src, end, copy) { + var dist; + var state = strm.state; + + /* if it hasn't been done already, allocate space for the window */ + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + + state.window = new utils.Buf8(state.wsize); + } + + /* copy state->wsize or less output bytes into the circular window */ + if (copy >= state.wsize) { + utils.arraySet(state.window,src, end - state.wsize, state.wsize, 0); + state.wnext = 0; + state.whave = state.wsize; + } + else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + //zmemcpy(state->window + state->wnext, end - copy, dist); + utils.arraySet(state.window,src, end - copy, dist, state.wnext); + copy -= dist; + if (copy) { + //zmemcpy(state->window, end - copy, copy); + utils.arraySet(state.window,src, end - copy, copy, 0); + state.wnext = copy; + state.whave = state.wsize; + } + else { + state.wnext += dist; + if (state.wnext === state.wsize) { state.wnext = 0; } + if (state.whave < state.wsize) { state.whave += dist; } + } + } + return 0; + } + + function inflate(strm, flush) { + var state; + var input, output; // input/output buffers + var next; /* next input INDEX */ + var put; /* next output INDEX */ + var have, left; /* available input and output */ + var hold; /* bit buffer */ + var bits; /* bits in bit buffer */ + var _in, _out; /* save starting available input and output */ + var copy; /* number of stored or match bytes to copy */ + var from; /* where to copy match bytes from */ + var from_source; + var here = 0; /* current decoding table entry */ + var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) + //var last; /* parent table entry */ + var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) + var len; /* length to copy for repeats, bits to drop */ + var ret; /* return code */ + var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ + var opts; + + var n; // temporary var for NEED_BITS + + var order = /* permutation of code lengths */ + [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + + + if (!strm || !strm.state || !strm.output || + (!strm.input && strm.avail_in !== 0)) { + return Z_STREAM_ERROR; + } + + state = strm.state; + if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ + + + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + _in = have; + _out = left; + ret = Z_OK; + + inf_leave: // goto emulation + for (;;) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + //=== NEEDBITS(16); + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ + state.check = 0/*crc32(0L, Z_NULL, 0)*/; + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = FLAGS; + break; + } + state.flags = 0; /* expect zlib header */ + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { + strm.msg = 'incorrect header check'; + state.mode = BAD; + break; + } + if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// + len = (hold & 0x0f)/*BITS(4)*/ + 8; + if (state.wbits === 0) { + state.wbits = len; + } + else if (len > state.wbits) { + strm.msg = 'invalid window size'; + state.mode = BAD; + break; + } + state.dmax = 1 << len; + //Tracev((stderr, "inflate: zlib header ok\n")); + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = hold & 0x200 ? DICTID : TYPE; + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + break; + case FLAGS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.flags = hold; + if ((state.flags & 0xff) !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + if (state.flags & 0xe000) { + strm.msg = 'unknown header flags set'; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = ((hold >> 8) & 1); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = TIME; + /* falls through */ + case TIME: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.time = hold; + } + if (state.flags & 0x0200) { + //=== CRC4(state.check, hold) + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + hbuf[2] = (hold >>> 16) & 0xff; + hbuf[3] = (hold >>> 24) & 0xff; + state.check = crc32(state.check, hbuf, 4, 0); + //=== + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = OS; + /* falls through */ + case OS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.xflags = (hold & 0xff); + state.head.os = (hold >> 8); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state.flags & 0x0400) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + else if (state.head) { + state.head.extra = null/*Z_NULL*/; + } + state.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state.flags & 0x0400) { + copy = state.length; + if (copy > have) { copy = have; } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + // Use untyped array for more conveniend processing later + state.head.extra = new Array(state.head.extra_len); + } + utils.arraySet( + state.head.extra, + input, + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + //zmemcpy(state.head.extra + len, next, + // len + copy > state.head.extra_max ? + // state.head.extra_max - len : copy); + } + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { break inf_leave; } + } + state.length = 0; + state.mode = NAME; + /* falls through */ + case NAME: + if (state.flags & 0x0800) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + // TODO: 2 or 1 bytes? + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.name_max*/)) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state.flags & 0x1000) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.comm_max*/)) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + /* falls through */ + case HCRC: + if (state.flags & 0x0200) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.check & 0xffff)) { + strm.msg = 'header crc mismatch'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + if (state.head) { + state.head.hcrc = ((state.flags >> 9) & 1); + state.head.done = true; + } + strm.adler = state.check = 0 /*crc32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + break; + case DICTID: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + strm.adler = state.check = ZSWAP32(hold); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = DICT; + /* falls through */ + case DICT: + if (state.havedict === 0) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + return Z_NEED_DICT; + } + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } + /* falls through */ + case TYPEDO: + if (state.last) { + //--- BYTEBITS() ---// + hold >>>= bits & 7; + bits -= bits & 7; + //---// + state.mode = CHECK; + break; + } + //=== NEEDBITS(3); */ + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.last = (hold & 0x01)/*BITS(1)*/; + //--- DROPBITS(1) ---// + hold >>>= 1; + bits -= 1; + //---// + + switch ((hold & 0x03)/*BITS(2)*/) { + case 0: /* stored block */ + //Tracev((stderr, "inflate: stored block%s\n", + // state.last ? " (last)" : "")); + state.mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + //Tracev((stderr, "inflate: fixed codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = LEN_; /* decode codes */ + if (flush === Z_TREES) { + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break inf_leave; + } + break; + case 2: /* dynamic block */ + //Tracev((stderr, "inflate: dynamic codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = TABLE; + break; + case 3: + strm.msg = 'invalid block type'; + state.mode = BAD; + } + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break; + case STORED: + //--- BYTEBITS() ---// /* go to byte boundary */ + hold >>>= bits & 7; + bits -= bits & 7; + //---// + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { + strm.msg = 'invalid stored block lengths'; + state.mode = BAD; + break; + } + state.length = hold & 0xffff; + //Tracev((stderr, "inflate: stored length %u\n", + // state.length)); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = COPY_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case COPY_: + state.mode = COPY; + /* falls through */ + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { copy = have; } + if (copy > left) { copy = left; } + if (copy === 0) { break inf_leave; } + //--- zmemcpy(put, next, copy); --- + utils.arraySet(output, input, next, copy, put); + //---// + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + //Tracev((stderr, "inflate: stored end\n")); + state.mode = TYPE; + break; + case TABLE: + //=== NEEDBITS(14); */ + while (bits < 14) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// +//#ifndef PKZIP_BUG_WORKAROUND + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = 'too many length or distance symbols'; + state.mode = BAD; + break; + } +//#endif + //Tracev((stderr, "inflate: table sizes ok\n")); + state.have = 0; + state.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state.have < state.ncode) { + //=== NEEDBITS(3); + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + // We have separate tables & no pointers. 2 commented lines below not needed. + //state.next = state.codes; + //state.lencode = state.next; + // Switch to use dynamic table + state.lencode = state.lendyn; + state.lenbits = 7; + + opts = {bits: state.lenbits}; + ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + + if (ret) { + strm.msg = 'invalid code lengths set'; + state.mode = BAD; + break; + } + //Tracev((stderr, "inflate: code lengths ok\n")); + state.have = 0; + state.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_val < 16) { + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.lens[state.have++] = here_val; + } + else { + if (here_val === 16) { + //=== NEEDBITS(here.bits + 2); + n = here_bits + 2; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + if (state.have === 0) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 0x03);//BITS(2); + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + } + else if (here_val === 17) { + //=== NEEDBITS(here.bits + 3); + n = here_bits + 3; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 3 + (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + else { + //=== NEEDBITS(here.bits + 7); + n = here_bits + 7; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 11 + (hold & 0x7f);//BITS(7); + //--- DROPBITS(7) ---// + hold >>>= 7; + bits -= 7; + //---// + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + + /* handle error breaks in while */ + if (state.mode === BAD) { break; } + + /* check for end-of-block code (better have one) */ + if (state.lens[256] === 0) { + strm.msg = 'invalid code -- missing end-of-block'; + state.mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state.lenbits = 9; + + opts = {bits: state.lenbits}; + ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.lenbits = opts.bits; + // state.lencode = state.next; + + if (ret) { + strm.msg = 'invalid literal/lengths set'; + state.mode = BAD; + break; + } + + state.distbits = 6; + //state.distcode.copy(state.codes); + // Switch to use dynamic table + state.distcode = state.distdyn; + opts = {bits: state.distbits}; + ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.distbits = opts.bits; + // state.distcode = state.next; + + if (ret) { + strm.msg = 'invalid distances set'; + state.mode = BAD; + break; + } + //Tracev((stderr, 'inflate: codes ok\n')); + state.mode = LEN_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case LEN_: + state.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + inflate_fast(strm, _out); + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) -1)]; /*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if (here_bits <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_op && (here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.lencode[last_val + + ((hold & ((1 << (last_bits + last_op)) -1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + state.mode = LIT; + break; + } + if (here_op & 32) { + //Tracevv((stderr, "inflate: end of block\n")); + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length += hold & ((1 << state.extra) -1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } + //Tracevv((stderr, "inflate: length %u\n", state.length)); + state.was = state.length; + state.mode = DIST; + /* falls through */ + case DIST: + for (;;) { + here = state.distcode[hold & ((1 << state.distbits) -1)];/*BITS(state.distbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if ((here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.distcode[last_val + + ((hold & ((1 << (last_bits + last_op)) -1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + if (here_op & 64) { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = (here_op) & 15; + state.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.offset += hold & ((1 << state.extra) -1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } +//#ifdef INFLATE_STRICT + if (state.offset > state.dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +//#endif + //Tracevv((stderr, "inflate: distance %u\n", state.offset)); + state.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { break inf_leave; } + copy = _out - left; + if (state.offset > copy) { /* copy from window */ + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// Trace((stderr, "inflate.c too far\n")); +// copy -= state.whave; +// if (copy > state.length) { copy = state.length; } +// if (copy > left) { copy = left; } +// left -= copy; +// state.length -= copy; +// do { +// output[put++] = 0; +// } while (--copy); +// if (state.length === 0) { state.mode = LEN; } +// break; +//#endif + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } + else { + from = state.wnext - copy; + } + if (copy > state.length) { copy = state.length; } + from_source = state.window; + } + else { /* copy from output */ + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { copy = left; } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { state.mode = LEN; } + break; + case LIT: + if (left === 0) { break inf_leave; } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + // Use '|' insdead of '+' to make sure that result is signed + hold |= input[next++] << bits; + bits += 8; + } + //===// + _out -= left; + strm.total_out += _out; + state.total += _out; + if (_out) { + strm.adler = state.check = + /*UPDATE(state.check, put - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); + + } + _out = left; + // NB: crc32 stored as signed 32-bit int, ZSWAP32 returns signed too + if ((state.flags ? hold : ZSWAP32(hold)) !== state.check) { + strm.msg = 'incorrect data check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: check matches trailer\n")); + } + state.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state.wrap && state.flags) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.total & 0xffffffff)) { + strm.msg = 'incorrect length check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: length matches trailer\n")); + } + state.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + + // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + + if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && + (state.mode < CHECK || flush !== Z_FINISH))) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap && _out) { + strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + + (state.mode === TYPE ? 128 : 0) + + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; + } + + function inflateEnd(strm) { + + if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { + return Z_STREAM_ERROR; + } + + var state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK; + } + + function inflateGetHeader(strm, head) { + var state; + + /* check state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } + + /* save header structure */ + state.head = head; + head.done = false; + return Z_OK; + } + + + exports.inflateReset = inflateReset; + exports.inflateReset2 = inflateReset2; + exports.inflateResetKeep = inflateResetKeep; + exports.inflateInit = inflateInit; + exports.inflateInit2 = inflateInit2; + exports.inflate = inflate; + exports.inflateEnd = inflateEnd; + exports.inflateGetHeader = inflateGetHeader; + exports.inflateInfo = 'pako inflate (from Nodeca project)'; + + /* Not implemented +exports.inflateCopy = inflateCopy; +exports.inflateGetDictionary = inflateGetDictionary; +exports.inflateMark = inflateMark; +exports.inflatePrime = inflatePrime; +exports.inflateSetDictionary = inflateSetDictionary; +exports.inflateSync = inflateSync; +exports.inflateSyncPoint = inflateSyncPoint; +exports.inflateUndermine = inflateUndermine; +*/ + },{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(_dereq_,module,exports){ + 'use strict'; + + + var utils = _dereq_('../utils/common'); + + var MAXBITS = 15; + var ENOUGH_LENS = 852; + var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + + var CODES = 0; + var LENS = 1; + var DISTS = 2; + + var lbase = [ /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 + ]; + + var lext = [ /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 + ]; + + var dbase = [ /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0 + ]; + + var dext = [ /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64 + ]; + + module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) + { + var bits = opts.bits; + //here = opts.here; /* table entry for duplication */ + + var len = 0; /* a code's length in bits */ + var sym = 0; /* index of code symbols */ + var min = 0, max = 0; /* minimum and maximum code lengths */ + var root = 0; /* number of index bits for root table */ + var curr = 0; /* number of index bits for current table */ + var drop = 0; /* code bits to drop for sub-table */ + var left = 0; /* number of prefix codes available */ + var used = 0; /* code entries in table used */ + var huff = 0; /* Huffman code */ + var incr; /* for incrementing code, index */ + var fill; /* index for replicating entries */ + var low; /* low bits for current root entry */ + var mask; /* mask for low root bits */ + var next; /* next available space in table */ + var base = null; /* base value table to use */ + var base_index = 0; +// var shoextra; /* extra bits table to use */ + var end; /* use base and extra for symbol > end */ + var count = new utils.Buf16(MAXBITS+1); //[MAXBITS+1]; /* number of codes of each length */ + var offs = new utils.Buf16(MAXBITS+1); //[MAXBITS+1]; /* offsets in table for each length */ + var extra = null; + var extra_index = 0; + + var here_bits, here_op, here_val; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + + /* bound code lengths, force root to be within code lengths */ + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { break; } + } + if (root > max) { + root = max; + } + if (max === 0) { /* no symbols to code at all */ + //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ + //table.bits[opts.table_index] = 1; //here.bits = (var char)1; + //table.val[opts.table_index++] = 0; //here.val = (var short)0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + + //table.op[opts.table_index] = 64; + //table.bits[opts.table_index] = 1; + //table.val[opts.table_index++] = 0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + opts.bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { break; } + } + if (root < min) { + root = min; + } + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } /* over-subscribed */ + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; /* incomplete set */ + } + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + // poor man optimization - use if-else instead of switch, + // to avoid deopts in old v8 + if (type === CODES) { + base = extra = work; /* dummy value--not used */ + end = 19; + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + } else { /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize opts for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = table_index; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = -1; /* trigger new sub-table when len > root */ + used = 1 << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + var i=0; + /* process all codes and make table entries */ + for (;;) { + i++; + /* create table entry */ + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } + else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } + else { + here_op = 32 + 64; /* end of block */ + here_val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1 << (len - drop); + fill = 1 << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; + } while (fill !== 0); + + /* backwards increment the len-bit code huff */ + incr = 1 << (len - 1); + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + + /* go to next symbol, update count, len */ + sym++; + if (--count[len] === 0) { + if (len === max) { break; } + len = lens[lens_index + work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) !== low) { + /* if first time, transition to sub-tables */ + if (drop === 0) { + drop = root; + } + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { break; } + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1 << curr; + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* point entry in root table to sub-table */ + low = huff & mask; + /*table.op[low] = curr; + table.bits[low] = root; + table.val[low] = next - opts.table_index;*/ + table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff !== 0) { + //table.op[next + huff] = 64; /* invalid code marker */ + //table.bits[next + huff] = len - drop; + //table.val[next + huff] = 0; + table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; + } + + /* set return parameters */ + //opts.table_index += used; + opts.bits = root; + return 0; + }; + + },{"../utils/common":27}],37:[function(_dereq_,module,exports){ + 'use strict'; + + module.exports = { + '2': 'need dictionary', /* Z_NEED_DICT 2 */ + '1': 'stream end', /* Z_STREAM_END 1 */ + '0': '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ + }; + },{}],38:[function(_dereq_,module,exports){ + 'use strict'; + + + var utils = _dereq_('../utils/common'); + + /* Public constants ==========================================================*/ + /* ===========================================================================*/ + + +//var Z_FILTERED = 1; +//var Z_HUFFMAN_ONLY = 2; +//var Z_RLE = 3; + var Z_FIXED = 4; +//var Z_DEFAULT_STRATEGY = 0; + + /* Possible values of the data_type field (though see inflate()) */ + var Z_BINARY = 0; + var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT + var Z_UNKNOWN = 2; + + /*============================================================================*/ + + + function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + +// From zutil.h + + var STORED_BLOCK = 0; + var STATIC_TREES = 1; + var DYN_TREES = 2; + /* The three kinds of block type */ + + var MIN_MATCH = 3; + var MAX_MATCH = 258; + /* The minimum and maximum match lengths */ + +// From deflate.h + /* =========================================================================== + * Internal compression state. + */ + + var LENGTH_CODES = 29; + /* number of length codes, not counting the special END_BLOCK code */ + + var LITERALS = 256; + /* number of literal bytes 0..255 */ + + var L_CODES = LITERALS + 1 + LENGTH_CODES; + /* number of Literal or Length codes, including the END_BLOCK code */ + + var D_CODES = 30; + /* number of distance codes */ + + var BL_CODES = 19; + /* number of codes used to transfer the bit lengths */ + + var HEAP_SIZE = 2*L_CODES + 1; + /* maximum heap size */ + + var MAX_BITS = 15; + /* All codes must not exceed MAX_BITS bits */ + + var Buf_size = 16; + /* size of bit buffer in bi_buf */ + + + /* =========================================================================== + * Constants + */ + + var MAX_BL_BITS = 7; + /* Bit length codes must not exceed MAX_BL_BITS bits */ + + var END_BLOCK = 256; + /* end of block literal code */ + + var REP_3_6 = 16; + /* repeat previous bit length 3-6 times (2 bits of repeat count) */ + + var REPZ_3_10 = 17; + /* repeat a zero length 3-10 times (3 bits of repeat count) */ + + var REPZ_11_138 = 18; + /* repeat a zero length 11-138 times (7 bits of repeat count) */ + + var extra_lbits = /* extra bits for each length code */ + [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; + + var extra_dbits = /* extra bits for each distance code */ + [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; + + var extra_blbits = /* extra bits for each bit length code */ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; + + var bl_order = + [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; + /* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + + /* =========================================================================== + * Local data. These are initialized only once. + */ + +// We pre-fill arrays with 0 to avoid uninitialized gaps + + var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ + +// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 + var static_ltree = new Array((L_CODES+2) * 2); + zero(static_ltree); + /* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + + var static_dtree = new Array(D_CODES * 2); + zero(static_dtree); + /* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + + var _dist_code = new Array(DIST_CODE_LEN); + zero(_dist_code); + /* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + + var _length_code = new Array(MAX_MATCH-MIN_MATCH+1); + zero(_length_code); + /* length code for each normalized match length (0 == MIN_MATCH) */ + + var base_length = new Array(LENGTH_CODES); + zero(base_length); + /* First normalized length for each code (0 = MIN_MATCH) */ + + var base_dist = new Array(D_CODES); + zero(base_dist); + /* First normalized distance for each code (0 = distance of 1) */ + + + var StaticTreeDesc = function (static_tree, extra_bits, extra_base, elems, max_length) { + + this.static_tree = static_tree; /* static tree or NULL */ + this.extra_bits = extra_bits; /* extra bits for each code or NULL */ + this.extra_base = extra_base; /* base index for extra_bits */ + this.elems = elems; /* max number of elements in the tree */ + this.max_length = max_length; /* max bit length for the codes */ + + // show if `static_tree` has data or dummy - needed for monomorphic objects + this.has_stree = static_tree && static_tree.length; + }; + + + var static_l_desc; + var static_d_desc; + var static_bl_desc; + + + var TreeDesc = function(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; /* the dynamic tree */ + this.max_code = 0; /* largest code with non zero frequency */ + this.stat_desc = stat_desc; /* the corresponding static tree */ + }; + + + + function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; + } + + + /* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ + function put_short (s, w) { +// put_byte(s, (uch)((w) & 0xff)); +// put_byte(s, (uch)((ush)(w) >> 8)); + s.pending_buf[s.pending++] = (w) & 0xff; + s.pending_buf[s.pending++] = (w >>> 8) & 0xff; + } + + + /* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ + function send_bits(s, value, length) { + if (s.bi_valid > (Buf_size - length)) { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + put_short(s, s.bi_buf); + s.bi_buf = value >> (Buf_size - s.bi_valid); + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + s.bi_valid += length; + } + } + + + function send_code(s, c, tree) { + send_bits(s, tree[c*2]/*.Code*/, tree[c*2 + 1]/*.Len*/); + } + + + /* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ + function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; + } + + + /* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ + function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 0xff; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } + } + + + /* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ + function gen_bitlen(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ + { + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; /* heap index */ + var n, m; /* iterate over the tree elements */ + var bits; /* bit length */ + var xbits; /* extra bits */ + var f; /* frequency */ + var overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s.heap[s.heap_max]*2 + 1]/*.Len*/ = 0; /* root of the heap */ + + for (h = s.heap_max+1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n*2 +1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n*2 + 1]/*.Len*/ = bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) { continue; } /* not a leaf node */ + + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n-base]; + } + f = tree[n * 2]/*.Freq*/; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n*2 + 1]/*.Len*/ + xbits); + } + } + if (overflow === 0) { return; } + + // Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s.bl_count[bits] === 0) { bits--; } + s.bl_count[bits]--; /* move one leaf down the tree */ + s.bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s.bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { continue; } + if (tree[m*2 + 1]/*.Len*/ !== bits) { + // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s.opt_len += (bits - tree[m*2 + 1]/*.Len*/)*tree[m*2]/*.Freq*/; + tree[m*2 + 1]/*.Len*/ = bits; + } + n--; + } + } + } + + + /* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ + function gen_codes(tree, max_code, bl_count) +// ct_data *tree; /* the tree to decorate */ +// int max_code; /* largest code with non zero frequency */ +// ushf *bl_count; /* number of codes at each bit length */ + { + var next_code = new Array(MAX_BITS+1); /* next code value for each bit length */ + var code = 0; /* running code value */ + var bits; /* bit index */ + var n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + + n = 0; + while (n <= 143) { + static_ltree[n*2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n*2 + 1]/*.Len*/ = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n*2 + 1]/*.Len*/ = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n*2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes(static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n*2 + 1]/*.Len*/ = 5; + static_dtree[n*2]/*.Code*/ = bi_reverse(n, 5); + } + + // Now data ready and we can init static trees + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc =new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + + //static_init_done = true; + } + + + /* =========================================================================== + * Initialize a new block. + */ + function init_block(s) { + var n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n*2]/*.Freq*/ = 0; } + for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n*2]/*.Freq*/ = 0; } + for (n = 0; n < BL_CODES; n++) { s.bl_tree[n*2]/*.Freq*/ = 0; } + + s.dyn_ltree[END_BLOCK*2]/*.Freq*/ = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; + } + + + /* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ + function bi_windup(s) + { + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + //put_byte(s, (Byte)s->bi_buf); + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; + } + + /* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ + function copy_block(s, buf, len, header) +//DeflateState *s; +//charf *buf; /* the input data */ +//unsigned len; /* its length */ +//int header; /* true if block header must be written */ + { + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, len); + put_short(s, ~len); + } +// while (len--) { +// put_byte(s, *buf++); +// } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; + } + + /* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ + function smaller(tree, n, m, depth) { + var _n2 = n*2; + var _m2 = m*2; + return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || + (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); + } + + /* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ + function pqdownheap(s, tree, k) +// deflate_state *s; +// ct_data *tree; /* the tree to restore */ +// int k; /* node to move down */ + { + var v = s.heap[k]; + var j = k << 1; /* left son of k */ + while (j <= s.heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s.heap_len && + smaller(tree, s.heap[j+1], s.heap[j], s.depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s.heap[j], s.depth)) { break; } + + /* Exchange v with the smallest son */ + s.heap[k] = s.heap[j]; + k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s.heap[k] = v; + } + + +// inlined manually +// var SMALLEST = 1; + + /* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ + function compress_block(s, ltree, dtree) +// deflate_state *s; +// const ct_data *ltree; /* literal tree */ +// const ct_data *dtree; /* distance tree */ + { + var dist; /* distance of matched string */ + var lc; /* match length or unmatched char (if dist == 0) */ + var lx = 0; /* running index in l_buf */ + var code; /* the code to send */ + var extra; /* number of extra bits to send */ + + if (s.last_lit !== 0) { + do { + dist = (s.pending_buf[s.d_buf + lx*2] << 8) | (s.pending_buf[s.d_buf + lx*2 + 1]); + lc = s.pending_buf[s.l_buf + lx]; + lx++; + + if (dist === 0) { + send_code(s, lc, ltree); /* send a literal byte */ + //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + //Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + // "pendingBuf overflow"); + + } while (lx < s.last_lit); + } + + send_code(s, END_BLOCK, ltree); + } + + + /* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ + function build_tree(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ + { + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; /* iterate over heap elements */ + var max_code = -1; /* largest code with non zero frequency */ + var node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n * 2]/*.Freq*/ !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + + } else { + tree[n*2 + 1]/*.Len*/ = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); + tree[node * 2]/*.Freq*/ = 1; + s.depth[node] = 0; + s.opt_len--; + + if (has_stree) { + s.static_len -= stree[node*2 + 1]/*.Len*/; + } + /* node is 0 or 1 so it does not have extra bits */ + } + desc.max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + //pqremove(s, tree, n); /* n = node of least frequency */ + /*** pqremove ***/ + n = s.heap[1/*SMALLEST*/]; + s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; + pqdownheap(s, tree, 1/*SMALLEST*/); + /***/ + + m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ + + s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ + s.heap[--s.heap_max] = m; + + /* Create a new node father of n and m */ + tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n*2 + 1]/*.Dad*/ = tree[m*2 + 1]/*.Dad*/ = node; + + /* and insert the new node in the heap */ + s.heap[1/*SMALLEST*/] = node++; + pqdownheap(s, tree, 1/*SMALLEST*/); + + } while (s.heap_len >= 2); + + s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes(tree, max_code, s.bl_count); + } + + + /* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ + function scan_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ + { + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code+1)*2 + 1]/*.Len*/ = 0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n+1)*2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + s.bl_tree[curlen * 2]/*.Freq*/ += count; + + } else if (curlen !== 0) { + + if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } + s.bl_tree[REP_3_6*2]/*.Freq*/++; + + } else if (count <= 10) { + s.bl_tree[REPZ_3_10*2]/*.Freq*/++; + + } else { + s.bl_tree[REPZ_11_138*2]/*.Freq*/++; + } + + count = 0; + prevlen = curlen; + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } + } + + + /* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ + function send_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ + { + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n+1)*2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); + + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + //Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count-11, 7); + } + + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } + } + + + /* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ + function build_bl_tree(s) { + var max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, s.bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex]*2 + 1]/*.Len*/ !== 0) { + break; + } + } + /* Update opt_len to include the bit length tree and counts */ + s.opt_len += 3*(max_blindex+1) + 5+5+4; + //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // s->opt_len, s->static_len)); + + return max_blindex; + } + + + /* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ + function send_all_trees(s, lcodes, dcodes, blcodes) +// deflate_state *s; +// int lcodes, dcodes, blcodes; /* number of codes for each tree */ + { + var rank; /* index in bl_order */ + + //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + //Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s.bl_tree[bl_order[rank]*2 + 1]/*.Len*/, 3); + } + //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_ltree, lcodes-1); /* literal tree */ + //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_dtree, dcodes-1); /* distance tree */ + //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); + } + + + /* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ + function detect_data_type(s) { + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + var black_mask = 0xf3ffc07f; + var n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if ((black_mask & 1) && (s.dyn_ltree[n*2]/*.Freq*/ !== 0)) { + return Z_BINARY; + } + } + + /* Check for textual ("white-listed") bytes. */ + if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || + s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + } + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; + } + + + var static_init_done = false; + + /* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ + function _tr_init(s) + { + + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + + s.bi_buf = 0; + s.bi_valid = 0; + + /* Initialize the first block of the first file: */ + init_block(s); + } + + + /* =========================================================================== + * Send a stored block + */ + function _tr_stored_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ + { + send_bits(s, (STORED_BLOCK<<1)+(last ? 1 : 0), 3); /* send block type */ + copy_block(s, buf, stored_len, true); /* with header */ + } + + + /* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ + function _tr_align(s) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); + } + + + /* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ + function _tr_flush_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block, or NULL if too old */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ + { + var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + var max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s.level > 0) { + + /* Check if the file is binary or text */ + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + + /* Construct the literal and distance trees */ + build_tree(s, s.l_desc); + // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + + build_tree(s, s.d_desc); + // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s.opt_len+3+7) >>> 3; + static_lenb = (s.static_len+3+7) >>> 3; + + // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + // s->last_lit)); + + if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } + + } else { + // Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + + if ((stored_len+4 <= opt_lenb) && (buf !== -1)) { + /* 4: two words for the lengths */ + + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + + send_bits(s, (STATIC_TREES<<1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + + } else { + send_bits(s, (DYN_TREES<<1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code+1, s.d_desc.max_code+1, max_blindex+1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); + } + // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + // s->compressed_len-7*last)); + } + + /* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ + function _tr_tally(s, dist, lc) +// deflate_state *s; +// unsigned dist; /* distance of matched string */ +// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ + { + //var out_length, in_length, dcode; + + s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; + + s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; + s.last_lit++; + + if (dist === 0) { + /* lc is the unmatched char */ + s.dyn_ltree[lc*2]/*.Freq*/++; + } else { + s.matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + //Assert((ush)dist < (ush)MAX_DIST(s) && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s.dyn_ltree[(_length_code[lc]+LITERALS+1) * 2]/*.Freq*/++; + s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility + +//#ifdef TRUNCATE_BLOCK +// /* Try to guess if it is profitable to stop the current block here */ +// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { +// /* Compute an upper bound for the compressed length */ +// out_length = s.last_lit*8; +// in_length = s.strstart - s.block_start; +// +// for (dcode = 0; dcode < D_CODES; dcode++) { +// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); +// } +// out_length >>>= 3; +// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +// // s->last_lit, in_length, out_length, +// // 100L - out_length*100L/in_length)); +// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { +// return true; +// } +// } +//#endif + + return (s.last_lit === s.lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ + } + + exports._tr_init = _tr_init; + exports._tr_stored_block = _tr_stored_block; + exports._tr_flush_block = _tr_flush_block; + exports._tr_tally = _tr_tally; + exports._tr_align = _tr_align; + },{"../utils/common":27}],39:[function(_dereq_,module,exports){ + 'use strict'; + + + function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; + } + + module.exports = ZStream; + },{}]},{},[9]) +(9) +}));/*---------split--------*//*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*exported XLSX */ +/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */ +var XLSX = {}; +function make_xlsx_lib(XLSX){ + XLSX.version = '0.14.3'; + var current_codepage = 1200, current_ansi = 1252; + /*global cptable:true, window */ + if(typeof module !== "undefined" && typeof require !== 'undefined') { + if(typeof cptable === 'undefined') { + if(typeof global !== 'undefined') global.cptable = undefined; + else if(typeof window !== 'undefined') window.cptable = undefined; + } + } + + var VALID_ANSI = [ 874, 932, 936, 949, 950 ]; + for(var i = 0; i <= 8; ++i) VALID_ANSI.push(1250 + i); + /* ECMA-376 Part I 18.4.1 charset to codepage mapping */ + var CS2CP = ({ + 0: 1252, /* ANSI */ + 1: 65001, /* DEFAULT */ + 2: 65001, /* SYMBOL */ + 77: 10000, /* MAC */ + 128: 932, /* SHIFTJIS */ + 129: 949, /* HANGUL */ + 130: 1361, /* JOHAB */ + 134: 936, /* GB2312 */ + 136: 950, /* CHINESEBIG5 */ + 161: 1253, /* GREEK */ + 162: 1254, /* TURKISH */ + 163: 1258, /* VIETNAMESE */ + 177: 1255, /* HEBREW */ + 178: 1256, /* ARABIC */ + 186: 1257, /* BALTIC */ + 204: 1251, /* RUSSIAN */ + 222: 874, /* THAI */ + 238: 1250, /* EASTEUROPE */ + 255: 1252, /* OEM */ + 69: 6969 /* MISC */ + }); + + var set_ansi = function(cp) { if(VALID_ANSI.indexOf(cp) == -1) return; current_ansi = CS2CP[0] = cp; }; + function reset_ansi() { set_ansi(1252); } + + var set_cp = function(cp) { current_codepage = cp; set_ansi(cp); }; + function reset_cp() { set_cp(1200); reset_ansi(); } + + function char_codes(data) { var o = []; for(var i = 0, len = data.length; i < len; ++i) o[i] = data.charCodeAt(i); return o; } + + function utf16leread(data) { + var o = []; + for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i) + (data.charCodeAt(2*i+1)<<8)); + return o.join(""); + } + function utf16beread(data) { + var o = []; + for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i+1) + (data.charCodeAt(2*i)<<8)); + return o.join(""); + } + + var debom = function(data) { + var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1); + if(c1 == 0xFF && c2 == 0xFE) return utf16leread(data.slice(2)); + if(c1 == 0xFE && c2 == 0xFF) return utf16beread(data.slice(2)); + if(c1 == 0xFEFF) return data.slice(1); + return data; + }; + + var _getchar = function _gc1(x) { return String.fromCharCode(x); }; + if(typeof cptable !== 'undefined') { + set_cp = function(cp) { current_codepage = cp; }; + debom = function(data) { + if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return cptable.utils.decode(1200, char_codes(data.slice(2))); } + return data; + }; + _getchar = function _gc2(x) { + if(current_codepage === 1200) return String.fromCharCode(x); + return cptable.utils.decode(current_codepage, [x&255,x>>8])[0]; + }; + } + var DENSE = null; + var DIF_XL = true; + var Base64 = (function make_b64(){ + var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + return { + encode: function(input) { + var o = ""; + var c1=0, c2=0, c3=0, e1=0, e2=0, e3=0, e4=0; + for(var i = 0; i < input.length; ) { + c1 = input.charCodeAt(i++); + e1 = (c1 >> 2); + + c2 = input.charCodeAt(i++); + e2 = ((c1 & 3) << 4) | (c2 >> 4); + + c3 = input.charCodeAt(i++); + e3 = ((c2 & 15) << 2) | (c3 >> 6); + e4 = (c3 & 63); + if (isNaN(c2)) { e3 = e4 = 64; } + else if (isNaN(c3)) { e4 = 64; } + o += map.charAt(e1) + map.charAt(e2) + map.charAt(e3) + map.charAt(e4); + } + return o; + }, + decode: function b64_decode(input) { + var o = ""; + var c1=0, c2=0, c3=0, e1=0, e2=0, e3=0, e4=0; + input = input.replace(/[^\w\+\/\=]/g, ""); + for(var i = 0; i < input.length;) { + e1 = map.indexOf(input.charAt(i++)); + e2 = map.indexOf(input.charAt(i++)); + c1 = (e1 << 2) | (e2 >> 4); + o += String.fromCharCode(c1); + + e3 = map.indexOf(input.charAt(i++)); + c2 = ((e2 & 15) << 4) | (e3 >> 2); + if (e3 !== 64) { o += String.fromCharCode(c2); } + + e4 = map.indexOf(input.charAt(i++)); + c3 = ((e3 & 3) << 6) | e4; + if (e4 !== 64) { o += String.fromCharCode(c3); } + } + return o; + } + }; + })(); + var has_buf = (typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && !!process.versions.node); + + var Buffer_from = function(){}; + + if(typeof Buffer !== 'undefined') { + var nbfs = !Buffer.from; + if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; } + Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer); + // $FlowIgnore + if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); }; + // $FlowIgnore + if(!Buffer.allocUnsafe) Buffer.allocUnsafe = function(n) { return new Buffer(n); }; + } + + function new_raw_buf(len) { + /* jshint -W056 */ + return has_buf ? Buffer.alloc(len) : new Array(len); + /* jshint +W056 */ + } + + function new_unsafe_buf(len) { + /* jshint -W056 */ + return has_buf ? Buffer.allocUnsafe(len) : new Array(len); + /* jshint +W056 */ + } + + var s2a = function s2a(s) { + // $FlowIgnore + if(has_buf) return Buffer_from(s, "binary"); + return s.split("").map(function(x){ return x.charCodeAt(0) & 0xff; }); + }; + + function s2ab(s) { + if(typeof ArrayBuffer === 'undefined') return s2a(s); + var buf = new ArrayBuffer(s.length), view = new Uint8Array(buf); + for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; + return buf; + } + + function a2s(data) { + if(Array.isArray(data)) return data.map(_chr).join(""); + var o = []; for(var i = 0; i < data.length; ++i) o[i] = _chr(data[i]); return o.join(""); + } + + function a2u(data) { + if(typeof Uint8Array === 'undefined') throw new Error("Unsupported"); + return new Uint8Array(data); + } + + function ab2a(data) { + if(typeof ArrayBuffer == 'undefined') throw new Error("Unsupported"); + if(data instanceof ArrayBuffer) return ab2a(new Uint8Array(data)); + var o = new Array(data.length); + for(var i = 0; i < data.length; ++i) o[i] = data[i]; + return o; + } + + var bconcat = function(bufs) { return [].concat.apply([], bufs); }; + + var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g; + /* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */ + /*jshint -W041 */ + var SSF = ({}); + var make_ssf = function make_ssf(SSF){ + SSF.version = '0.10.2'; + function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; } + function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; } + function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} + function pad_(v,d){var t=""+v;return t.length>=d?t:fill(' ',d-t.length)+t;} + function rpad_(v,d){var t=""+v; return t.length>=d?t:t+fill(' ',d-t.length);} + function pad0r1(v,d){var t=""+Math.round(v); return t.length>=d?t:fill('0',d-t.length)+t;} + function pad0r2(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} + var p2_32 = Math.pow(2,32); + function pad0r(v,d){if(v>p2_32||v<-p2_32) return pad0r1(v,d); var i = Math.round(v); return pad0r2(i,d); } + function isgeneral(s, i) { i = i || 0; return s.length >= 7 + i && (s.charCodeAt(i)|32) === 103 && (s.charCodeAt(i+1)|32) === 101 && (s.charCodeAt(i+2)|32) === 110 && (s.charCodeAt(i+3)|32) === 101 && (s.charCodeAt(i+4)|32) === 114 && (s.charCodeAt(i+5)|32) === 97 && (s.charCodeAt(i+6)|32) === 108; } + var days = [ + ['Sun', 'Sunday'], + ['Mon', 'Monday'], + ['Tue', 'Tuesday'], + ['Wed', 'Wednesday'], + ['Thu', 'Thursday'], + ['Fri', 'Friday'], + ['Sat', 'Saturday'] + ]; + var months = [ + ['J', 'Jan', 'January'], + ['F', 'Feb', 'February'], + ['M', 'Mar', 'March'], + ['A', 'Apr', 'April'], + ['M', 'May', 'May'], + ['J', 'Jun', 'June'], + ['J', 'Jul', 'July'], + ['A', 'Aug', 'August'], + ['S', 'Sep', 'September'], + ['O', 'Oct', 'October'], + ['N', 'Nov', 'November'], + ['D', 'Dec', 'December'] + ]; + function init_table(t) { + t[0]= 'General'; + t[1]= '0'; + t[2]= '0.00'; + t[3]= '#,##0'; + t[4]= '#,##0.00'; + t[9]= '0%'; + t[10]= '0.00%'; + t[11]= '0.00E+00'; + t[12]= '# ?/?'; + t[13]= '# ??/??'; + t[14]= 'm/d/yy'; + t[15]= 'd-mmm-yy'; + t[16]= 'd-mmm'; + t[17]= 'mmm-yy'; + t[18]= 'h:mm AM/PM'; + t[19]= 'h:mm:ss AM/PM'; + t[20]= 'h:mm'; + t[21]= 'h:mm:ss'; + t[22]= 'm/d/yy h:mm'; + t[37]= '#,##0 ;(#,##0)'; + t[38]= '#,##0 ;[Red](#,##0)'; + t[39]= '#,##0.00;(#,##0.00)'; + t[40]= '#,##0.00;[Red](#,##0.00)'; + t[45]= 'mm:ss'; + t[46]= '[h]:mm:ss'; + t[47]= 'mmss.0'; + t[48]= '##0.0E+0'; + t[49]= '@'; + t[56]= '"上午/下午 "hh"時"mm"分"ss"秒 "'; + t[65535]= 'General'; + } + + var table_fmt = {}; + init_table(table_fmt); + function frac(x, D, mixed) { + var sgn = x < 0 ? -1 : 1; + var B = x * sgn; + var P_2 = 0, P_1 = 1, P = 0; + var Q_2 = 1, Q_1 = 0, Q = 0; + var A = Math.floor(B); + while(Q_1 < D) { + A = Math.floor(B); + P = A * P_1 + P_2; + Q = A * Q_1 + Q_2; + if((B - A) < 0.00000005) break; + B = 1 / (B - A); + P_2 = P_1; P_1 = P; + Q_2 = Q_1; Q_1 = Q; + } + if(Q > D) { if(Q_1 > D) { Q = Q_2; P = P_2; } else { Q = Q_1; P = P_1; } } + if(!mixed) return [0, sgn * P, Q]; + var q = Math.floor(sgn * P/Q); + return [q, sgn*P - q*Q, Q]; + } + function parse_date_code(v,opts,b2) { + if(v > 2958465 || v < 0) return null; + var date = (v|0), time = Math.floor(86400 * (v - date)), dow=0; + var dout=[]; + var out={D:date, T:time, u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0}; + if(Math.abs(out.u) < 1e-6) out.u = 0; + if(opts && opts.date1904) date += 1462; + if(out.u > 0.9999) { + out.u = 0; + if(++time == 86400) { out.T = time = 0; ++date; ++out.D; } + } + if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;} + else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;} + else { + if(date > 60) --date; + /* 1 = Jan 1 1900 in Gregorian */ + var d = new Date(1900, 0, 1); + d.setDate(d.getDate() + date - 1); + dout = [d.getFullYear(), d.getMonth()+1,d.getDate()]; + dow = d.getDay(); + if(date < 60) dow = (dow + 6) % 7; + if(b2) dow = fix_hijri(d, dout); + } + out.y = dout[0]; out.m = dout[1]; out.d = dout[2]; + out.S = time % 60; time = Math.floor(time / 60); + out.M = time % 60; time = Math.floor(time / 60); + out.H = time; + out.q = dow; + return out; + } + SSF.parse_date_code = parse_date_code; + var basedate = new Date(1899, 11, 31, 0, 0, 0); + var dnthresh = basedate.getTime(); + var base1904 = new Date(1900, 2, 1, 0, 0, 0); + function datenum_local(v, date1904) { + var epoch = v.getTime(); + if(date1904) epoch -= 1461*24*60*60*1000; + else if(v >= base1904) epoch += 24*60*60*1000; + return (epoch - (dnthresh + (v.getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000)) / (24 * 60 * 60 * 1000); + } + function general_fmt_int(v) { return v.toString(10); } + SSF._general_int = general_fmt_int; + var general_fmt_num = (function make_general_fmt_num() { + var gnr1 = /\.(\d*[1-9])0+$/, gnr2 = /\.0*$/, gnr4 = /\.(\d*[1-9])0+/, gnr5 = /\.0*[Ee]/, gnr6 = /(E[+-])(\d)$/; + function gfn2(v) { + var w = (v<0?12:11); + var o = gfn5(v.toFixed(12)); if(o.length <= w) return o; + o = v.toPrecision(10); if(o.length <= w) return o; + return v.toExponential(5); + } + function gfn3(v) { + var o = v.toFixed(11).replace(gnr1,".$1"); + if(o.length > (v<0?12:11)) o = v.toPrecision(6); + return o; + } + function gfn4(o) { + for(var i = 0; i != o.length; ++i) if((o.charCodeAt(i) | 0x20) === 101) return o.replace(gnr4,".$1").replace(gnr5,"E").replace("e","E").replace(gnr6,"$10$2"); + return o; + } + function gfn5(o) { + return o.indexOf(".") > -1 ? o.replace(gnr2,"").replace(gnr1,".$1") : o; + } + return function general_fmt_num(v) { + var V = Math.floor(Math.log(Math.abs(v))*Math.LOG10E), o; + if(V >= -4 && V <= -1) o = v.toPrecision(10+V); + else if(Math.abs(V) <= 9) o = gfn2(v); + else if(V === 10) o = v.toFixed(10).substr(0,12); + else o = gfn3(v); + return gfn5(gfn4(o)); + };})(); + SSF._general_num = general_fmt_num; + function general_fmt(v, opts) { + switch(typeof v) { + case 'string': return v; + case 'boolean': return v ? "TRUE" : "FALSE"; + case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v); + case 'undefined': return ""; + case 'object': + if(v == null) return ""; + if(v instanceof Date) return format(14, datenum_local(v, opts && opts.date1904), opts); + } + throw new Error("unsupported value in General format: " + v); + } + SSF._general = general_fmt; + function fix_hijri() { return 0; } + /*jshint -W086 */ + function write_date(type, fmt, val, ss0) { + var o="", ss=0, tt=0, y = val.y, out, outl = 0; + switch(type) { + case 98: /* 'b' buddhist year */ + y = val.y + 543; + /* falls through */ + case 121: /* 'y' year */ + switch(fmt.length) { + case 1: case 2: out = y % 100; outl = 2; break; + default: out = y % 10000; outl = 4; break; + } break; + case 109: /* 'm' month */ + switch(fmt.length) { + case 1: case 2: out = val.m; outl = fmt.length; break; + case 3: return months[val.m-1][1]; + case 5: return months[val.m-1][0]; + default: return months[val.m-1][2]; + } break; + case 100: /* 'd' day */ + switch(fmt.length) { + case 1: case 2: out = val.d; outl = fmt.length; break; + case 3: return days[val.q][0]; + default: return days[val.q][1]; + } break; + case 104: /* 'h' 12-hour */ + switch(fmt.length) { + case 1: case 2: out = 1+(val.H+11)%12; outl = fmt.length; break; + default: throw 'bad hour format: ' + fmt; + } break; + case 72: /* 'H' 24-hour */ + switch(fmt.length) { + case 1: case 2: out = val.H; outl = fmt.length; break; + default: throw 'bad hour format: ' + fmt; + } break; + case 77: /* 'M' minutes */ + switch(fmt.length) { + case 1: case 2: out = val.M; outl = fmt.length; break; + default: throw 'bad minute format: ' + fmt; + } break; + case 115: /* 's' seconds */ + if(fmt != 's' && fmt != 'ss' && fmt != '.0' && fmt != '.00' && fmt != '.000') throw 'bad second format: ' + fmt; + if(val.u === 0 && (fmt == "s" || fmt == "ss")) return pad0(val.S, fmt.length); + if(ss0 >= 2) tt = ss0 === 3 ? 1000 : 100; + else tt = ss0 === 1 ? 10 : 1; + ss = Math.round((tt)*(val.S + val.u)); + if(ss >= 60*tt) ss = 0; + if(fmt === 's') return ss === 0 ? "0" : ""+ss/tt; + o = pad0(ss,2 + ss0); + if(fmt === 'ss') return o.substr(0,2); + return "." + o.substr(2,fmt.length-1); + case 90: /* 'Z' absolute time */ + switch(fmt) { + case '[h]': case '[hh]': out = val.D*24+val.H; break; + case '[m]': case '[mm]': out = (val.D*24+val.H)*60+val.M; break; + case '[s]': case '[ss]': out = ((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u); break; + default: throw 'bad abstime format: ' + fmt; + } outl = fmt.length === 3 ? 1 : 2; break; + case 101: /* 'e' era */ + out = y; outl = 1; + } + if(outl > 0) return pad0(out, outl); else return ""; + } + /*jshint +W086 */ + function commaify(s) { + var w = 3; + if(s.length <= w) return s; + var j = (s.length % w), o = s.substr(0,j); + for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w); + return o; + } + var write_num = (function make_write_num(){ + var pct1 = /%/g; + function write_num_pct(type, fmt, val){ + var sfmt = fmt.replace(pct1,""), mul = fmt.length - sfmt.length; + return write_num(type, sfmt, val * Math.pow(10,2*mul)) + fill("%",mul); + } + function write_num_cm(type, fmt, val){ + var idx = fmt.length - 1; + while(fmt.charCodeAt(idx-1) === 44) --idx; + return write_num(type, fmt.substr(0,idx), val / Math.pow(10,3*(fmt.length-idx))); + } + function write_num_exp(fmt, val){ + var o; + var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1; + if(fmt.match(/^#+0.0E\+0$/)) { + if(val == 0) return "0.0E+0"; + else if(val < 0) return "-" + write_num_exp(fmt, -val); + var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E'); + var ee = Math.floor(Math.log(val)*Math.LOG10E)%period; + if(ee < 0) ee += period; + o = (val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period); + if(o.indexOf("e") === -1) { + var fakee = Math.floor(Math.log(val)*Math.LOG10E); + if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee); + else o += "E+" + (fakee - ee); + while(o.substr(0,2) === "0.") { + o = o.charAt(0) + o.substr(2,period) + "." + o.substr(2+period); + o = o.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0."); + } + o = o.replace(/\+-/,"-"); + } + o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3) { return $1 + $2 + $3.substr(0,(period+ee)%period) + "." + $3.substr(ee) + "E"; }); + } else o = val.toExponential(idx); + if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.length-1); + if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e"); + return o.replace("e","E"); + } + var frac1 = /# (\?+)( ?)\/( ?)(\d+)/; + function write_num_f1(r, aval, sign) { + var den = parseInt(r[4],10), rr = Math.round(aval * den), base = Math.floor(rr/den); + var myn = (rr - base*den), myd = den; + return sign + (base === 0 ? "" : ""+base) + " " + (myn === 0 ? fill(" ", r[1].length + 1 + r[4].length) : pad_(myn,r[1].length) + r[2] + "/" + r[3] + pad0(myd,r[4].length)); + } + function write_num_f2(r, aval, sign) { + return sign + (aval === 0 ? "" : ""+aval) + fill(" ", r[1].length + 2 + r[4].length); + } + var dec1 = /^#*0*\.([0#]+)/; + var closeparen = /\).*[0#]/; + var phone = /\(###\) ###\\?-####/; + function hashq(str) { + var o = "", cc; + for(var i = 0; i != str.length; ++i) switch((cc=str.charCodeAt(i))) { + case 35: break; + case 63: o+= " "; break; + case 48: o+= "0"; break; + default: o+= String.fromCharCode(cc); + } + return o; + } + function rnd(val, d) { var dd = Math.pow(10,d); return ""+(Math.round(val * dd)/dd); } + function dec(val, d) { + if (d < ('' + Math.round((val-Math.floor(val))*Math.pow(10,d))).length) { + return 0; + } + return Math.round((val-Math.floor(val))*Math.pow(10,d)); + } + function carry(val, d) { + if (d < ('' + Math.round((val-Math.floor(val))*Math.pow(10,d))).length) { + return 1; + } + return 0; + } + function flr(val) { if(val < 2147483647 && val > -2147483648) return ""+(val >= 0 ? (val|0) : (val-1|0)); return ""+Math.floor(val); } + function write_num_flt(type, fmt, val) { + if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) { + var ffmt = fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,""); + if(val >= 0) return write_num_flt('n', ffmt, val); + return '(' + write_num_flt('n', ffmt, -val) + ')'; + } + if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val); + if(fmt.indexOf('%') !== -1) return write_num_pct(type, fmt, val); + if(fmt.indexOf('E') !== -1) return write_num_exp(fmt, val); + if(fmt.charCodeAt(0) === 36) return "$"+write_num_flt(type,fmt.substr(fmt.charAt(1)==' '?2:1),val); + var o; + var r, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; + if(fmt.match(/^00+$/)) return sign + pad0r(aval,fmt.length); + if(fmt.match(/^[#?]+$/)) { + o = pad0r(val,0); if(o === "0") o = ""; + return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o; + } + if((r = fmt.match(frac1))) return write_num_f1(r, aval, sign); + if(fmt.match(/^#+0+$/)) return sign + pad0r(aval,fmt.length - fmt.indexOf("0")); + if((r = fmt.match(dec1))) { + o = rnd(val, r[1].length).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])).replace(/\.(\d*)$/,function($$, $1) { return "." + $1 + fill("0", hashq(r[1]).length-$1.length); }); + return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,"."); + } + fmt = fmt.replace(/^#+([0.])/, "$1"); + if((r = fmt.match(/^(0*)\.(#*)$/))) { + return sign + rnd(aval, r[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":"."); + } + if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify(pad0r(aval,0)); + if((r = fmt.match(/^#,##0\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(""+(Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length),r[1].length); + } + if((r = fmt.match(/^#,#*,#0/))) return write_num_flt(type,fmt.replace(/^#,#*,/,""),val); + if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { + o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g,""), val)); + ri = 0; + return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri= 0) return write_num_int('n', ffmt, val); + return '(' + write_num_int('n', ffmt, -val) + ')'; + } + if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val); + if(fmt.indexOf('%') !== -1) return write_num_pct2(type, fmt, val); + if(fmt.indexOf('E') !== -1) return write_num_exp2(fmt, val); + if(fmt.charCodeAt(0) === 36) return "$"+write_num_int(type,fmt.substr(fmt.charAt(1)==' '?2:1),val); + var o; + var r, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; + if(fmt.match(/^00+$/)) return sign + pad0(aval,fmt.length); + if(fmt.match(/^[#?]+$/)) { + o = (""+val); if(val === 0) o = ""; + return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o; + } + if((r = fmt.match(frac1))) return write_num_f2(r, aval, sign); + if(fmt.match(/^#+0+$/)) return sign + pad0(aval,fmt.length - fmt.indexOf("0")); + if((r = fmt.match(dec1))) { + o = (""+val).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])); + o = o.replace(/\.(\d*)$/,function($$, $1) { + return "." + $1 + fill("0", hashq(r[1]).length-$1.length); }); + return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,"."); + } + fmt = fmt.replace(/^#+([0.])/, "$1"); + if((r = fmt.match(/^(0*)\.(#*)$/))) { + return sign + (""+aval).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":"."); + } + if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify((""+aval)); + if((r = fmt.match(/^#,##0\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify((""+val)) + "." + fill('0',r[1].length); + } + if((r = fmt.match(/^#,#*,#0/))) return write_num_int(type,fmt.replace(/^#,#*,/,""),val); + if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { + o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g,""), val)); + ri = 0; + return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri -1 || (c=='\\' && fmt.charAt(i+1) == "-" && "0#".indexOf(fmt.charAt(i+2))>-1))){/* empty */} + break; + case '?': while(fmt.charAt(++i) === c){/* empty */} break; + case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; + case '(': case ')': ++i; break; + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1){/* empty */} break; + case ' ': ++i; break; + default: ++i; break; + } + } + return false; + } + SSF.is_date = fmt_is_date; + function eval_fmt(fmt, v, opts, flen) { + var out = [], o = "", i = 0, c = "", lst='t', dt, j, cc; + var hr='H'; + /* Tokenize */ + while(i < fmt.length) { + switch((c = fmt.charAt(i))) { + case 'G': /* General */ + if(!isgeneral(fmt, i)) throw new Error('unrecognized character ' + c + ' in ' +fmt); + out[out.length] = {t:'G', v:'General'}; i+=7; break; + case '"': /* Literal text */ + for(o="";(cc=fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) o += String.fromCharCode(cc); + out[out.length] = {t:'t', v:o}; ++i; break; + case '\\': var w = fmt.charAt(++i), t = (w === "(" || w === ")") ? w : 't'; + out[out.length] = {t:t, v:w}; ++i; break; + case '_': out[out.length] = {t:'t', v:" "}; i+=2; break; + case '@': /* Text Placeholder */ + out[out.length] = {t:'T', v:v}; ++i; break; + case 'B': case 'b': + if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") { + if(dt==null) { dt=parse_date_code(v, opts, fmt.charAt(i+1) === "2"); if(dt==null) return ""; } + out[out.length] = {t:'X', v:fmt.substr(i,2)}; lst = c; i+=2; break; + } + /* falls through */ + case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E': + c = c.toLowerCase(); + /* falls through */ + case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g': + if(v < 0) return ""; + if(dt==null) { dt=parse_date_code(v, opts); if(dt==null) return ""; } + o = c; while(++i < fmt.length && fmt.charAt(i).toLowerCase() === c) o+=c; + if(c === 'm' && lst.toLowerCase() === 'h') c = 'M'; + if(c === 'h') c = hr; + out[out.length] = {t:c, v:o}; lst = c; break; + case 'A': case 'a': + var q={t:c, v:c}; + if(dt==null) dt=parse_date_code(v, opts); + if(fmt.substr(i, 3).toUpperCase() === "A/P") { if(dt!=null) q.v = dt.H >= 12 ? "P" : "A"; q.t = 'T'; hr='h';i+=3;} + else if(fmt.substr(i,5).toUpperCase() === "AM/PM") { if(dt!=null) q.v = dt.H >= 12 ? "PM" : "AM"; q.t = 'T'; i+=5; hr='h'; } + else { q.t = "t"; ++i; } + if(dt==null && q.t === 'T') return ""; + out[out.length] = q; lst = c; break; + case '[': + o = c; + while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i); + if(o.slice(-1) !== ']') throw 'unterminated "[" block: |' + o + '|'; + if(o.match(abstime)) { + if(dt==null) { dt=parse_date_code(v, opts); if(dt==null) return ""; } + out[out.length] = {t:'Z', v:o.toLowerCase()}; + lst = o.charAt(1); + } else if(o.indexOf("$") > -1) { + o = (o.match(/\$([^-\[\]]*)/)||[])[1]||"$"; + if(!fmt_is_date(fmt)) out[out.length] = {t:'t',v:o}; + } + break; + /* Numbers */ + case '.': + if(dt != null) { + o = c; while(++i < fmt.length && (c=fmt.charAt(i)) === "0") o += c; + out[out.length] = {t:'s', v:o}; break; + } + /* falls through */ + case '0': case '#': + o = c; while((++i < fmt.length && "0#?.,E+-%".indexOf(c=fmt.charAt(i)) > -1) || (c=='\\' && fmt.charAt(i+1) == "-" && i < fmt.length - 2 && "0#".indexOf(fmt.charAt(i+2))>-1)) o += c; + out[out.length] = {t:'n', v:o}; break; + case '?': + o = c; while(fmt.charAt(++i) === c) o+=c; + out[out.length] = {t:c, v:o}; lst = c; break; + case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; // ** + case '(': case ')': out[out.length] = {t:(flen===1?'t':c), v:c}; ++i; break; + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i); + out[out.length] = {t:'D', v:o}; break; + case ' ': out[out.length] = {t:c, v:c}; ++i; break; + default: + if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt); + out[out.length] = {t:'t', v:c}; ++i; break; + } + } + var bt = 0, ss0 = 0, ssm; + for(i=out.length-1, lst='t'; i >= 0; --i) { + switch(out[i].t) { + case 'h': case 'H': out[i].t = hr; lst='h'; if(bt < 1) bt = 1; break; + case 's': + if((ssm=out[i].v.match(/\.0+$/))) ss0=Math.max(ss0,ssm[0].length-1); + if(bt < 3) bt = 3; + /* falls through */ + case 'd': case 'y': case 'M': case 'e': lst=out[i].t; break; + case 'm': if(lst === 's') { out[i].t = 'M'; if(bt < 2) bt = 2; } break; + case 'X': /*if(out[i].v === "B2");*/ + break; + case 'Z': + if(bt < 1 && out[i].v.match(/[Hh]/)) bt = 1; + if(bt < 2 && out[i].v.match(/[Mm]/)) bt = 2; + if(bt < 3 && out[i].v.match(/[Ss]/)) bt = 3; + } + } + switch(bt) { + case 0: break; + case 1: + if(dt.u >= 0.5) { dt.u = 0; ++dt.S; } + if(dt.S >= 60) { dt.S = 0; ++dt.M; } + if(dt.M >= 60) { dt.M = 0; ++dt.H; } + break; + case 2: + if(dt.u >= 0.5) { dt.u = 0; ++dt.S; } + if(dt.S >= 60) { dt.S = 0; ++dt.M; } + break; + } + /* replace fields */ + var nstr = "", jj; + for(i=0; i < out.length; ++i) { + switch(out[i].t) { + case 't': case 'T': case ' ': case 'D': break; + case 'X': out[i].v = ""; out[i].t = ";"; break; + case 'd': case 'm': case 'y': case 'h': case 'H': case 'M': case 's': case 'e': case 'b': case 'Z': + out[i].v = write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0); + out[i].t = 't'; break; + case 'n': case '(': case '?': + jj = i+1; + while(out[jj] != null && ( + (c=out[jj].t) === "?" || c === "D" || + ((c === " " || c === "t") && out[jj+1] != null && (out[jj+1].t === '?' || out[jj+1].t === "t" && out[jj+1].v === '/')) || + (out[i].t === '(' && (c === ' ' || c === 'n' || c === ')')) || + (c === 't' && (out[jj].v === '/' || out[jj].v === ' ' && out[jj+1] != null && out[jj+1].t == '?')) + )) { + out[i].v += out[jj].v; + out[jj] = {v:"", t:";"}; ++jj; + } + nstr += out[i].v; + i = jj-1; break; + case 'G': out[i].t = 't'; out[i].v = general_fmt(v,opts); break; + } + } + var vv = "", myv, ostr; + if(nstr.length > 0) { + if(nstr.charCodeAt(0) == 40) /* '(' */ { + myv = (v<0&&nstr.charCodeAt(0) === 45 ? -v : v); + ostr = write_num('(', nstr, myv); + } else { + myv = (v<0 && flen > 1 ? -v : v); + ostr = write_num('n', nstr, myv); + if(myv < 0 && out[0] && out[0].t == 't') { + ostr = ostr.substr(1); + out[0].v = "-" + out[0].v; + } + } + jj=ostr.length-1; + var decpt = out.length; + for(i=0; i < out.length; ++i) if(out[i] != null && out[i].t != 't' && out[i].v.indexOf(".") > -1) { decpt = i; break; } + var lasti=out.length; + if(decpt === out.length && ostr.indexOf("E") === -1) { + for(i=out.length-1; i>= 0;--i) { + if(out[i] == null || 'n?('.indexOf(out[i].t) === -1) continue; + if(jj>=out[i].v.length-1) { jj -= out[i].v.length; out[i].v = ostr.substr(jj+1, out[i].v.length); } + else if(jj < 0) out[i].v = ""; + else { out[i].v = ostr.substr(0, jj+1); jj = -1; } + out[i].t = 't'; + lasti = i; + } + if(jj>=0 && lasti= 0; --i) { + if(out[i] == null || 'n?('.indexOf(out[i].t) === -1) continue; + j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")-1:out[i].v.length-1; + vv = out[i].v.substr(j+1); + for(; j>=0; --j) { + if(jj>=0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) vv = ostr.charAt(jj--) + vv; + } + out[i].v = vv; + out[i].t = 't'; + lasti = i; + } + if(jj>=0 && lasti-1&&i===decpt?out[i].v.indexOf(".")+1:0; + vv = out[i].v.substr(0,j); + for(; j-1) { + myv = (flen >1 && v < 0 && i>0 && out[i-1].v === "-" ? -v:v); + out[i].v = write_num(out[i].t, out[i].v, myv); + out[i].t = 't'; + } + var retval = ""; + for(i=0; i !== out.length; ++i) if(out[i] != null) retval += out[i].v; + return retval; + } + SSF._eval = eval_fmt; + var cfregex = /\[[=<>]/; + var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/; + function chkcond(v, rr) { + if(rr == null) return false; + var thresh = parseFloat(rr[2]); + switch(rr[1]) { + case "=": if(v == thresh) return true; break; + case ">": if(v > thresh) return true; break; + case "<": if(v < thresh) return true; break; + case "<>": if(v != thresh) return true; break; + case ">=": if(v >= thresh) return true; break; + case "<=": if(v <= thresh) return true; break; + } + return false; + } + function choose_fmt(f, v) { + var fmt = split_fmt(f); + var l = fmt.length, lat = fmt[l-1].indexOf("@"); + if(l<4 && lat>-1) --l; + if(fmt.length > 4) throw new Error("cannot find right format for |" + fmt.join("|") + "|"); + if(typeof v !== "number") return [4, fmt.length === 4 || lat>-1?fmt[fmt.length-1]:"@"]; + switch(fmt.length) { + case 1: fmt = lat>-1 ? ["General", "General", "General", fmt[0]] : [fmt[0], fmt[0], fmt[0], "@"]; break; + case 2: fmt = lat>-1 ? [fmt[0], fmt[0], fmt[0], fmt[1]] : [fmt[0], fmt[1], fmt[0], "@"]; break; + case 3: fmt = lat>-1 ? [fmt[0], fmt[1], fmt[0], fmt[2]] : [fmt[0], fmt[1], fmt[2], "@"]; break; + case 4: break; + } + var ff = v > 0 ? fmt[0] : v < 0 ? fmt[1] : fmt[2]; + if(fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) return [l, ff]; + if(fmt[0].match(cfregex) != null || fmt[1].match(cfregex) != null) { + var m1 = fmt[0].match(cfregex2); + var m2 = fmt[1].match(cfregex2); + return chkcond(v, m1) ? [l, fmt[0]] : chkcond(v, m2) ? [l, fmt[1]] : [l, fmt[m1 != null && m2 != null ? 2 : 1]]; + } + return [l, ff]; + } + function format(fmt,v,o) { + if(o == null) o = {}; + var sfmt = ""; + switch(typeof fmt) { + case "string": + if(fmt == "m/d/yy" && o.dateNF) sfmt = o.dateNF; + else sfmt = fmt; + break; + case "number": + if(fmt == 14 && o.dateNF) sfmt = o.dateNF; + else sfmt = (o.table != null ? (o.table) : table_fmt)[fmt]; + break; + } + if(isgeneral(sfmt,0)) return general_fmt(v, o); + if(v instanceof Date) v = datenum_local(v, o.date1904); + var f = choose_fmt(sfmt, v); + if(isgeneral(f[1])) return general_fmt(v, o); + if(v === true) v = "TRUE"; else if(v === false) v = "FALSE"; + else if(v === "" || v == null) return ""; + return eval_fmt(f[1], v, o, f[0]); + } + function load_entry(fmt, idx) { + if(typeof idx != 'number') { + idx = +idx || -1; + for(var i = 0; i < 0x0188; ++i) { + if(table_fmt[i] == undefined) { if(idx < 0) idx = i; continue; } + if(table_fmt[i] == fmt) { idx = i; break; } + } + if(idx < 0) idx = 0x187; + } + table_fmt[idx] = fmt; + return idx; + } + SSF.load = load_entry; + SSF._table = table_fmt; + SSF.get_table = function get_table() { return table_fmt; }; + SSF.load_table = function load_table(tbl) { + for(var i=0; i!=0x0188; ++i) + if(tbl[i] !== undefined) load_entry(tbl[i], i); + }; + SSF.init_table = init_table; + SSF.format = format; + }; + make_ssf(SSF); + /* map from xlml named formats to SSF TODO: localize */ + var XLMLFormatMap/*{[string]:string}*/ = ({ + "General Number": "General", + "General Date": SSF._table[22], + "Long Date": "dddd, mmmm dd, yyyy", + "Medium Date": SSF._table[15], + "Short Date": SSF._table[14], + "Long Time": SSF._table[19], + "Medium Time": SSF._table[18], + "Short Time": SSF._table[20], + "Currency": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "Fixed": SSF._table[2], + "Standard": SSF._table[4], + "Percent": SSF._table[10], + "Scientific": SSF._table[11], + "Yes/No": '"Yes";"Yes";"No";@', + "True/False": '"True";"True";"False";@', + "On/Off": '"Yes";"Yes";"No";@' + }); + + var SSFImplicit/*{[number]:string}*/ = ({ + "5": '"$"#,##0_);\\("$"#,##0\\)', + "6": '"$"#,##0_);[Red]\\("$"#,##0\\)', + "7": '"$"#,##0.00_);\\("$"#,##0.00\\)', + "8": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "23": 'General', "24": 'General', "25": 'General', "26": 'General', + "27": 'm/d/yy', "28": 'm/d/yy', "29": 'm/d/yy', "30": 'm/d/yy', "31": 'm/d/yy', + "32": 'h:mm:ss', "33": 'h:mm:ss', "34": 'h:mm:ss', "35": 'h:mm:ss', + "36": 'm/d/yy', + "41": '_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)', + "42": '_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)', + "43": '_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)', + "44": '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)', + "50": 'm/d/yy', "51": 'm/d/yy', "52": 'm/d/yy', "53": 'm/d/yy', "54": 'm/d/yy', + "55": 'm/d/yy', "56": 'm/d/yy', "57": 'm/d/yy', "58": 'm/d/yy', + "59": '0', + "60": '0.00', + "61": '#,##0', + "62": '#,##0.00', + "63": '"$"#,##0_);\\("$"#,##0\\)', + "64": '"$"#,##0_);[Red]\\("$"#,##0\\)', + "65": '"$"#,##0.00_);\\("$"#,##0.00\\)', + "66": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "67": '0%', + "68": '0.00%', + "69": '# ?/?', + "70": '# ??/??', + "71": 'm/d/yy', + "72": 'm/d/yy', + "73": 'd-mmm-yy', + "74": 'd-mmm', + "75": 'mmm-yy', + "76": 'h:mm', + "77": 'h:mm:ss', + "78": 'm/d/yy h:mm', + "79": 'mm:ss', + "80": '[h]:mm:ss', + "81": 'mmss.0' + }); + + /* dateNF parse TODO: move to SSF */ + var dateNFregex = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g; + function dateNF_regex(dateNF) { + var fmt = typeof dateNF == "number" ? SSF._table[dateNF] : dateNF; + fmt = fmt.replace(dateNFregex, "(\\d+)"); + return new RegExp("^" + fmt + "$"); + } + function dateNF_fix(str, dateNF, match) { + var Y = -1, m = -1, d = -1, H = -1, M = -1, S = -1; + (dateNF.match(dateNFregex)||[]).forEach(function(n, i) { + var v = parseInt(match[i+1], 10); + switch(n.toLowerCase().charAt(0)) { + case 'y': Y = v; break; case 'd': d = v; break; + case 'h': H = v; break; case 's': S = v; break; + case 'm': if(H >= 0) M = v; else m = v; break; + } + }); + if(S >= 0 && M == -1 && m >= 0) { M = m; m = -1; } + var datestr = (("" + (Y>=0?Y: new Date().getFullYear())).slice(-4) + "-" + ("00" + (m>=1?m:1)).slice(-2) + "-" + ("00" + (d>=1?d:1)).slice(-2)); + if(datestr.length == 7) datestr = "0" + datestr; + if(datestr.length == 8) datestr = "20" + datestr; + var timestr = (("00" + (H>=0?H:0)).slice(-2) + ":" + ("00" + (M>=0?M:0)).slice(-2) + ":" + ("00" + (S>=0?S:0)).slice(-2)); + if(H == -1 && M == -1 && S == -1) return datestr; + if(Y == -1 && m == -1 && d == -1) return timestr; + return datestr + "T" + timestr; + } + + var DO_NOT_EXPORT_CFB = true; + /* cfb.js (C) 2013-present SheetJS -- http://sheetjs.com */ + /* vim: set ts=2: */ + /*jshint eqnull:true */ + /*exported CFB */ + /*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */ + + /* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */ + /* vim: set ts=2: */ + /*exported CRC32 */ + var CRC32; + (function (factory) { + /*jshint ignore:start */ + /*eslint-disable */ + factory(CRC32 = {}); + /*eslint-enable */ + /*jshint ignore:end */ + }(function(CRC32) { + CRC32.version = '1.2.0'; + /* see perf/crc32table.js */ + /*global Int32Array */ + function signed_crc_table() { + var c = 0, table = new Array(256); + + for(var n =0; n != 256; ++n){ + c = n; + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + table[n] = c; + } + + return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table; + } + + var T = signed_crc_table(); + function crc32_bstr(bstr, seed) { + var C = seed ^ -1, L = bstr.length - 1; + for(var i = 0; i < L;) { + C = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF]; + C = (C>>>8) ^ T[(C^bstr.charCodeAt(i++))&0xFF]; + } + if(i === L) C = (C>>>8) ^ T[(C ^ bstr.charCodeAt(i))&0xFF]; + return C ^ -1; + } + + function crc32_buf(buf, seed) { + if(buf.length > 10000) return crc32_buf_8(buf, seed); + var C = seed ^ -1, L = buf.length - 3; + for(var i = 0; i < L;) { + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + } + while(i < L+3) C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + return C ^ -1; + } + + function crc32_buf_8(buf, seed) { + var C = seed ^ -1, L = buf.length - 7; + for(var i = 0; i < L;) { + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + } + while(i < L+7) C = (C>>>8) ^ T[(C^buf[i++])&0xFF]; + return C ^ -1; + } + + function crc32_str(str, seed) { + var C = seed ^ -1; + for(var i = 0, L=str.length, c, d; i < L;) { + c = str.charCodeAt(i++); + if(c < 0x80) { + C = (C>>>8) ^ T[(C ^ c)&0xFF]; + } else if(c < 0x800) { + C = (C>>>8) ^ T[(C ^ (192|((c>>6)&31)))&0xFF]; + C = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF]; + } else if(c >= 0xD800 && c < 0xE000) { + c = (c&1023)+64; d = str.charCodeAt(i++)&1023; + C = (C>>>8) ^ T[(C ^ (240|((c>>8)&7)))&0xFF]; + C = (C>>>8) ^ T[(C ^ (128|((c>>2)&63)))&0xFF]; + C = (C>>>8) ^ T[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF]; + C = (C>>>8) ^ T[(C ^ (128|(d&63)))&0xFF]; + } else { + C = (C>>>8) ^ T[(C ^ (224|((c>>12)&15)))&0xFF]; + C = (C>>>8) ^ T[(C ^ (128|((c>>6)&63)))&0xFF]; + C = (C>>>8) ^ T[(C ^ (128|(c&63)))&0xFF]; + } + } + return C ^ -1; + } + CRC32.table = T; + CRC32.bstr = crc32_bstr; + CRC32.buf = crc32_buf; + CRC32.str = crc32_str; + })); + /* [MS-CFB] v20171201 */ + var CFB = (function _CFB(){ + var exports = {}; + exports.version = '1.1.0'; + /* [MS-CFB] 2.6.4 */ + function namecmp(l, r) { + var L = l.split("/"), R = r.split("/"); + for(var i = 0, c = 0, Z = Math.min(L.length, R.length); i < Z; ++i) { + if((c = L[i].length - R[i].length)) return c; + if(L[i] != R[i]) return L[i] < R[i] ? -1 : 1; + } + return L.length - R.length; + } + function dirname(p) { + if(p.charAt(p.length - 1) == "/") return (p.slice(0,-1).indexOf("/") === -1) ? p : dirname(p.slice(0, -1)); + var c = p.lastIndexOf("/"); + return (c === -1) ? p : p.slice(0, c+1); + } + + function filename(p) { + if(p.charAt(p.length - 1) == "/") return filename(p.slice(0, -1)); + var c = p.lastIndexOf("/"); + return (c === -1) ? p : p.slice(c+1); + } + /* -------------------------------------------------------------------------- */ + /* DOS Date format: + high|YYYYYYYm.mmmddddd.HHHHHMMM.MMMSSSSS|low + add 1980 to stored year + stored second should be doubled +*/ + + /* write JS date to buf as a DOS date */ + function write_dos_date(buf, date) { + if(typeof date === "string") date = new Date(date); + var hms = date.getHours(); + hms = hms << 6 | date.getMinutes(); + hms = hms << 5 | (date.getSeconds()>>>1); + buf.write_shift(2, hms); + var ymd = (date.getFullYear() - 1980); + ymd = ymd << 4 | (date.getMonth()+1); + ymd = ymd << 5 | date.getDate(); + buf.write_shift(2, ymd); + } + + /* read four bytes from buf and interpret as a DOS date */ + function parse_dos_date(buf) { + var hms = buf.read_shift(2) & 0xFFFF; + var ymd = buf.read_shift(2) & 0xFFFF; + var val = new Date(); + var d = ymd & 0x1F; ymd >>>= 5; + var m = ymd & 0x0F; ymd >>>= 4; + val.setMilliseconds(0); + val.setFullYear(ymd + 1980); + val.setMonth(m-1); + val.setDate(d); + var S = hms & 0x1F; hms >>>= 5; + var M = hms & 0x3F; hms >>>= 6; + val.setHours(hms); + val.setMinutes(M); + val.setSeconds(S<<1); + return val; + } + function parse_extra_field(blob) { + prep_blob(blob, 0); + var o = {}; + var flags = 0; + while(blob.l <= blob.length - 4) { + var type = blob.read_shift(2); + var sz = blob.read_shift(2), tgt = blob.l + sz; + var p = {}; + switch(type) { + /* UNIX-style Timestamps */ + case 0x5455: { + flags = blob.read_shift(1); + if(flags & 1) p.mtime = blob.read_shift(4); + /* for some reason, CD flag corresponds to LFH */ + if(sz > 5) { + if(flags & 2) p.atime = blob.read_shift(4); + if(flags & 4) p.ctime = blob.read_shift(4); + } + if(p.mtime) p.mt = new Date(p.mtime*1000); + } + break; + } + blob.l = tgt; + o[type] = p; + } + return o; + } + var fs; + function get_fs() { return fs || (fs = require('fs')); } + function parse(file, options) { + if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options); + if(file.length < 512) throw new Error("CFB file size " + file.length + " < 512"); + var mver = 3; + var ssz = 512; + var nmfs = 0; // number of mini FAT sectors + var difat_sec_cnt = 0; + var dir_start = 0; + var minifat_start = 0; + var difat_start = 0; + + var fat_addrs = []; // locations of FAT sectors + + /* [MS-CFB] 2.2 Compound File Header */ + var blob = file.slice(0,512); + prep_blob(blob, 0); + + /* major version */ + var mv = check_get_mver(blob); + mver = mv[0]; + switch(mver) { + case 3: ssz = 512; break; case 4: ssz = 4096; break; + case 0: if(mv[1] == 0) return parse_zip(file, options); + /* falls through */ + default: throw new Error("Major Version: Expected 3 or 4 saw " + mver); + } + + /* reprocess header */ + if(ssz !== 512) { blob = file.slice(0,ssz); prep_blob(blob, 28 /* blob.l */); } + /* Save header for final object */ + var header = file.slice(0,ssz); + + check_shifts(blob, mver); + +// Number of Directory Sectors + var dir_cnt = blob.read_shift(4, 'i'); + if(mver === 3 && dir_cnt !== 0) throw new Error('# Directory Sectors: Expected 0 saw ' + dir_cnt); + +// Number of FAT Sectors + blob.l += 4; + +// First Directory Sector Location + dir_start = blob.read_shift(4, 'i'); + +// Transaction Signature + blob.l += 4; + +// Mini Stream Cutoff Size + blob.chk('00100000', 'Mini Stream Cutoff Size: '); + +// First Mini FAT Sector Location + minifat_start = blob.read_shift(4, 'i'); + +// Number of Mini FAT Sectors + nmfs = blob.read_shift(4, 'i'); + +// First DIFAT sector location + difat_start = blob.read_shift(4, 'i'); + +// Number of DIFAT Sectors + difat_sec_cnt = blob.read_shift(4, 'i'); + +// Grab FAT Sector Locations + for(var q = -1, j = 0; j < 109; ++j) { /* 109 = (512 - blob.l)>>>2; */ + q = blob.read_shift(4, 'i'); + if(q<0) break; + fat_addrs[j] = q; + } + + /** Break the file up into sectors */ + var sectors = sectorify(file, ssz); + + sleuth_fat(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs); + + /** Chains */ + var sector_list = make_sector_list(sectors, dir_start, fat_addrs, ssz); + + sector_list[dir_start].name = "!Directory"; + if(nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT"; + sector_list[fat_addrs[0]].name = "!FAT"; + sector_list.fat_addrs = fat_addrs; + sector_list.ssz = ssz; + + /* [MS-CFB] 2.6.1 Compound File Directory Entry */ + var files = {}, Paths = [], FileIndex = [], FullPaths = []; + read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start); + + build_full_paths(FileIndex, FullPaths, Paths); + Paths.shift(); + + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + +// $FlowIgnore + if(options && options.raw) o.raw = {header: header, sectors: sectors}; + return o; + } // parse + + /* [MS-CFB] 2.2 Compound File Header -- read up to major version */ + function check_get_mver(blob) { + if(blob[blob.l] == 0x50 && blob[blob.l + 1] == 0x4b) return [0, 0]; + // header signature 8 + blob.chk(HEADER_SIGNATURE, 'Header Signature: '); + + // clsid 16 + blob.chk(HEADER_CLSID, 'CLSID: '); + + // minor version 2 + var mver = blob.read_shift(2, 'u'); + + return [blob.read_shift(2,'u'), mver]; + } + function check_shifts(blob, mver) { + var shift = 0x09; + + // Byte Order + //blob.chk('feff', 'Byte Order: '); // note: some writers put 0xffff + blob.l += 2; + + // Sector Shift + switch((shift = blob.read_shift(2))) { + case 0x09: if(mver != 3) throw new Error('Sector Shift: Expected 9 saw ' + shift); break; + case 0x0c: if(mver != 4) throw new Error('Sector Shift: Expected 12 saw ' + shift); break; + default: throw new Error('Sector Shift: Expected 9 or 12 saw ' + shift); + } + + // Mini Sector Shift + blob.chk('0600', 'Mini Sector Shift: '); + + // Reserved + blob.chk('000000000000', 'Reserved: '); + } + + /** Break the file up into sectors */ + function sectorify(file, ssz) { + var nsectors = Math.ceil(file.length/ssz)-1; + var sectors = []; + for(var i=1; i < nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz); + sectors[nsectors-1] = file.slice(nsectors*ssz); + return sectors; + } + + /* [MS-CFB] 2.6.4 Red-Black Tree */ + function build_full_paths(FI, FP, Paths) { + var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length; + var dad = [], q = []; + + for(; i < pl; ++i) { dad[i]=q[i]=i; FP[i]=Paths[i]; } + + for(; j < q.length; ++j) { + i = q[j]; + L = FI[i].L; R = FI[i].R; C = FI[i].C; + if(dad[i] === i) { + if(L !== -1 /*NOSTREAM*/ && dad[L] !== L) dad[i] = dad[L]; + if(R !== -1 && dad[R] !== R) dad[i] = dad[R]; + } + if(C !== -1 /*NOSTREAM*/) dad[C] = i; + if(L !== -1) { dad[L] = dad[i]; if(q.lastIndexOf(L) < j) q.push(L); } + if(R !== -1) { dad[R] = dad[i]; if(q.lastIndexOf(R) < j) q.push(R); } + } + for(i=1; i < pl; ++i) if(dad[i] === i) { + if(R !== -1 /*NOSTREAM*/ && dad[R] !== R) dad[i] = dad[R]; + else if(L !== -1 && dad[L] !== L) dad[i] = dad[L]; + } + + for(i=1; i < pl; ++i) { + if(FI[i].type === 0 /* unknown */) continue; + j = dad[i]; + if(j === 0) FP[i] = FP[0] + "/" + FP[i]; + else while(j !== 0 && j !== dad[j]) { + FP[i] = FP[j] + "/" + FP[i]; + j = dad[j]; + } + dad[i] = 0; + } + + FP[0] += "/"; + for(i=1; i < pl; ++i) { + if(FI[i].type !== 2 /* stream */) FP[i] += "/"; + } + } + + function get_mfat_entry(entry, payload, mini) { + var start = entry.start, size = entry.size; + //return (payload.slice(start*MSSZ, start*MSSZ + size)); + var o = []; + var idx = start; + while(mini && size > 0 && idx >= 0) { + o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ)); + size -= MSSZ; + idx = __readInt32LE(mini, idx * 4); + } + if(o.length === 0) return (new_buf(0)); + return (bconcat(o).slice(0, entry.size)); + } + + /** Chase down the rest of the DIFAT chain to build a comprehensive list + DIFAT chains by storing the next sector number as the last 32 bits */ + function sleuth_fat(idx, cnt, sectors, ssz, fat_addrs) { + var q = ENDOFCHAIN; + if(idx === ENDOFCHAIN) { + if(cnt !== 0) throw new Error("DIFAT chain shorter than expected"); + } else if(idx !== -1 /*FREESECT*/) { + var sector = sectors[idx], m = (ssz>>>2)-1; + if(!sector) return; + for(var i = 0; i < m; ++i) { + if((q = __readInt32LE(sector,i*4)) === ENDOFCHAIN) break; + fat_addrs.push(q); + } + sleuth_fat(__readInt32LE(sector,ssz-4),cnt - 1, sectors, ssz, fat_addrs); + } + } + + /** Follow the linked list of sectors for a given starting point */ + function get_sector_list(sectors, start, fat_addrs, ssz, chkd) { + var buf = [], buf_chain = []; + if(!chkd) chkd = []; + var modulus = ssz - 1, j = 0, jj = 0; + for(j=start; j>=0;) { + chkd[j] = true; + buf[buf.length] = j; + buf_chain.push(sectors[j]); + var addr = fat_addrs[Math.floor(j*4/ssz)]; + jj = ((j*4) & modulus); + if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz); + if(!sectors[addr]) break; + j = __readInt32LE(sectors[addr], jj); + } + return {nodes: buf, data:__toBuffer([buf_chain])}; + } + + /** Chase down the sector linked lists */ + function make_sector_list(sectors, dir_start, fat_addrs, ssz) { + var sl = sectors.length, sector_list = ([]); + var chkd = [], buf = [], buf_chain = []; + var modulus = ssz - 1, i=0, j=0, k=0, jj=0; + for(i=0; i < sl; ++i) { + buf = ([]); + k = (i + dir_start); if(k >= sl) k-=sl; + if(chkd[k]) continue; + buf_chain = []; + for(j=k; j>=0;) { + chkd[j] = true; + buf[buf.length] = j; + buf_chain.push(sectors[j]); + var addr = fat_addrs[Math.floor(j*4/ssz)]; + jj = ((j*4) & modulus); + if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz); + if(!sectors[addr]) break; + j = __readInt32LE(sectors[addr], jj); + } + sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])}); + } + return sector_list; + } + + /* [MS-CFB] 2.6.1 Compound File Directory Entry */ + function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, mini) { + var minifat_store = 0, pl = (Paths.length?2:0); + var sector = sector_list[dir_start].data; + var i = 0, namelen = 0, name; + for(; i < sector.length; i+= 128) { + var blob = sector.slice(i, i+128); + prep_blob(blob, 64); + namelen = blob.read_shift(2); + name = __utf16le(blob,0,namelen-pl); + Paths.push(name); + var o = ({ + name: name, + type: blob.read_shift(1), + color: blob.read_shift(1), + L: blob.read_shift(4, 'i'), + R: blob.read_shift(4, 'i'), + C: blob.read_shift(4, 'i'), + clsid: blob.read_shift(16), + state: blob.read_shift(4, 'i'), + start: 0, + size: 0 + }); + var ctime = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); + if(ctime !== 0) o.ct = read_date(blob, blob.l-8); + var mtime = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); + if(mtime !== 0) o.mt = read_date(blob, blob.l-8); + o.start = blob.read_shift(4, 'i'); + o.size = blob.read_shift(4, 'i'); + if(o.size < 0 && o.start < 0) { o.size = o.type = 0; o.start = ENDOFCHAIN; o.name = ""; } + if(o.type === 5) { /* root */ + minifat_store = o.start; + if(nmfs > 0 && minifat_store !== ENDOFCHAIN) sector_list[minifat_store].name = "!StreamData"; + /*minifat_size = o.size;*/ + } else if(o.size >= 4096 /* MSCSZ */) { + o.storage = 'fat'; + if(sector_list[o.start] === undefined) sector_list[o.start] = get_sector_list(sectors, o.start, sector_list.fat_addrs, sector_list.ssz); + sector_list[o.start].name = o.name; + o.content = (sector_list[o.start].data.slice(0,o.size)); + } else { + o.storage = 'minifat'; + if(o.size < 0) o.size = 0; + else if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) { + o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data); + } + } + if(o.content) prep_blob(o.content, 0); + files[name] = o; + FileIndex.push(o); + } + } + + function read_date(blob, offset) { + return new Date(( ( (__readUInt32LE(blob,offset+4)/1e7)*Math.pow(2,32)+__readUInt32LE(blob,offset)/1e7 ) - 11644473600)*1000); + } + + function read_file(filename, options) { + get_fs(); + return parse(fs.readFileSync(filename), options); + } + + function read(blob, options) { + switch(options && options.type || "base64") { + case "file": return read_file(blob, options); + case "base64": return parse(s2a(Base64.decode(blob)), options); + case "binary": return parse(s2a(blob), options); + } + return parse(blob, options); + } + + function init_cfb(cfb, opts) { + var o = opts || {}, root = o.root || "Root Entry"; + if(!cfb.FullPaths) cfb.FullPaths = []; + if(!cfb.FileIndex) cfb.FileIndex = []; + if(cfb.FullPaths.length !== cfb.FileIndex.length) throw new Error("inconsistent CFB structure"); + if(cfb.FullPaths.length === 0) { + cfb.FullPaths[0] = root + "/"; + cfb.FileIndex[0] = ({ name: root, type: 5 }); + } + if(o.CLSID) cfb.FileIndex[0].clsid = o.CLSID; + seed_cfb(cfb); + } + function seed_cfb(cfb) { + var nm = "\u0001Sh33tJ5"; + if(CFB.find(cfb, "/" + nm)) return; + var p = new_buf(4); p[0] = 55; p[1] = p[3] = 50; p[2] = 54; + cfb.FileIndex.push(({ name: nm, type: 2, content:p, size:4, L:69, R:69, C:69 })); + cfb.FullPaths.push(cfb.FullPaths[0] + nm); + rebuild_cfb(cfb); + } + function rebuild_cfb(cfb, f) { + init_cfb(cfb); + var gc = false, s = false; + for(var i = cfb.FullPaths.length - 1; i >= 0; --i) { + var _file = cfb.FileIndex[i]; + switch(_file.type) { + case 0: + if(s) gc = true; + else { cfb.FileIndex.pop(); cfb.FullPaths.pop(); } + break; + case 1: case 2: case 5: + s = true; + if(isNaN(_file.R * _file.L * _file.C)) gc = true; + if(_file.R > -1 && _file.L > -1 && _file.R == _file.L) gc = true; + break; + default: gc = true; break; + } + } + if(!gc && !f) return; + + var now = new Date(1987, 1, 19), j = 0; + var data = []; + for(i = 0; i < cfb.FullPaths.length; ++i) { + if(cfb.FileIndex[i].type === 0) continue; + data.push([cfb.FullPaths[i], cfb.FileIndex[i]]); + } + for(i = 0; i < data.length; ++i) { + var dad = dirname(data[i][0]); + s = false; + for(j = 0; j < data.length; ++j) if(data[j][0] === dad) s = true; + if(!s) data.push([dad, ({ + name: filename(dad).replace("/",""), + type: 1, + clsid: HEADER_CLSID, + ct: now, mt: now, + content: null + })]); + } + + data.sort(function(x,y) { return namecmp(x[0], y[0]); }); + cfb.FullPaths = []; cfb.FileIndex = []; + for(i = 0; i < data.length; ++i) { cfb.FullPaths[i] = data[i][0]; cfb.FileIndex[i] = data[i][1]; } + for(i = 0; i < data.length; ++i) { + var elt = cfb.FileIndex[i]; + var nm = cfb.FullPaths[i]; + + elt.name = filename(nm).replace("/",""); + elt.L = elt.R = elt.C = -(elt.color = 1); + elt.size = elt.content ? elt.content.length : 0; + elt.start = 0; + elt.clsid = (elt.clsid || HEADER_CLSID); + if(i === 0) { + elt.C = data.length > 1 ? 1 : -1; + elt.size = 0; + elt.type = 5; + } else if(nm.slice(-1) == "/") { + for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==nm) break; + elt.C = j >= data.length ? -1 : j; + for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==dirname(nm)) break; + elt.R = j >= data.length ? -1 : j; + elt.type = 1; + } else { + if(dirname(cfb.FullPaths[i+1]||"") == dirname(nm)) elt.R = i + 1; + elt.type = 2; + } + } + + } + + function _write(cfb, options) { + var _opts = options || {}; + rebuild_cfb(cfb); + if(_opts.fileType == 'zip') return write_zip(cfb, _opts); + var L = (function(cfb){ + var mini_size = 0, fat_size = 0; + for(var i = 0; i < cfb.FileIndex.length; ++i) { + var file = cfb.FileIndex[i]; + if(!file.content) continue; + var flen = file.content.length; + if(flen > 0){ + if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6; + else fat_size += (flen + 0x01FF) >> 9; + } + } + var dir_cnt = (cfb.FullPaths.length +3) >> 2; + var mini_cnt = (mini_size + 7) >> 3; + var mfat_cnt = (mini_size + 0x7F) >> 7; + var fat_base = mini_cnt + fat_size + dir_cnt + mfat_cnt; + var fat_cnt = (fat_base + 0x7F) >> 7; + var difat_cnt = fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt-109)/0x7F); + while(((fat_base + fat_cnt + difat_cnt + 0x7F) >> 7) > fat_cnt) difat_cnt = ++fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt-109)/0x7F); + var L = [1, difat_cnt, fat_cnt, mfat_cnt, dir_cnt, fat_size, mini_size, 0]; + cfb.FileIndex[0].size = mini_size << 6; + L[7] = (cfb.FileIndex[0].start=L[0]+L[1]+L[2]+L[3]+L[4]+L[5])+((L[6]+7) >> 3); + return L; + })(cfb); + var o = new_buf(L[7] << 9); + var i = 0, T = 0; + { + for(i = 0; i < 8; ++i) o.write_shift(1, HEADER_SIG[i]); + for(i = 0; i < 8; ++i) o.write_shift(2, 0); + o.write_shift(2, 0x003E); + o.write_shift(2, 0x0003); + o.write_shift(2, 0xFFFE); + o.write_shift(2, 0x0009); + o.write_shift(2, 0x0006); + for(i = 0; i < 3; ++i) o.write_shift(2, 0); + o.write_shift(4, 0); + o.write_shift(4, L[2]); + o.write_shift(4, L[0] + L[1] + L[2] + L[3] - 1); + o.write_shift(4, 0); + o.write_shift(4, 1<<12); + o.write_shift(4, L[3] ? L[0] + L[1] + L[2] - 1: ENDOFCHAIN); + o.write_shift(4, L[3]); + o.write_shift(-4, L[1] ? L[0] - 1: ENDOFCHAIN); + o.write_shift(4, L[1]); + for(i = 0; i < 109; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1); + } + if(L[1]) { + for(T = 0; T < L[1]; ++T) { + for(; i < 236 + T * 127; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1); + o.write_shift(-4, T === L[1] - 1 ? ENDOFCHAIN : T + 1); + } + } + var chainit = function(w) { + for(T += w; i> 9); + } + chainit((L[6] + 7) >> 3); + while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); + T = i = 0; + for(j = 0; j < cfb.FileIndex.length; ++j) { + file = cfb.FileIndex[j]; + if(!file.content) continue; + flen = file.content.length; + if(!flen || flen >= 0x1000) continue; + file.start = T; + chainit((flen + 0x3F) >> 6); + } + while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); + for(i = 0; i < L[4]<<2; ++i) { + var nm = cfb.FullPaths[i]; + if(!nm || nm.length === 0) { + for(j = 0; j < 17; ++j) o.write_shift(4, 0); + for(j = 0; j < 3; ++j) o.write_shift(4, -1); + for(j = 0; j < 12; ++j) o.write_shift(4, 0); + continue; + } + file = cfb.FileIndex[i]; + if(i === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN; + var _nm = (i === 0 && _opts.root) || file.name; + flen = 2*(_nm.length+1); + o.write_shift(64, _nm, "utf16le"); + o.write_shift(2, flen); + o.write_shift(1, file.type); + o.write_shift(1, file.color); + o.write_shift(-4, file.L); + o.write_shift(-4, file.R); + o.write_shift(-4, file.C); + if(!file.clsid) for(j = 0; j < 4; ++j) o.write_shift(4, 0); + else o.write_shift(16, file.clsid, "hex"); + o.write_shift(4, file.state || 0); + o.write_shift(4, 0); o.write_shift(4, 0); + o.write_shift(4, 0); o.write_shift(4, 0); + o.write_shift(4, file.start); + o.write_shift(4, file.size); o.write_shift(4, 0); + } + for(i = 1; i < cfb.FileIndex.length; ++i) { + file = cfb.FileIndex[i]; + if(file.size >= 0x1000) { + o.l = (file.start+1) << 9; + for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]); + for(; j & 0x1FF; ++j) o.write_shift(1, 0); + } + } + for(i = 1; i < cfb.FileIndex.length; ++i) { + file = cfb.FileIndex[i]; + if(file.size > 0 && file.size < 0x1000) { + for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]); + for(; j & 0x3F; ++j) o.write_shift(1, 0); + } + } + while(o.l < o.length) o.write_shift(1, 0); + return o; + } + /* [MS-CFB] 2.6.4 (Unicode 3.0.1 case conversion) */ + function find(cfb, path) { + var UCFullPaths = cfb.FullPaths.map(function(x) { return x.toUpperCase(); }); + var UCPaths = UCFullPaths.map(function(x) { var y = x.split("/"); return y[y.length - (x.slice(-1) == "/" ? 2 : 1)]; }); + var k = false; + if(path.charCodeAt(0) === 47 /* "/" */) { k = true; path = UCFullPaths[0].slice(0, -1) + path; } + else k = path.indexOf("/") !== -1; + var UCPath = path.toUpperCase(); + var w = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath); + if(w !== -1) return cfb.FileIndex[w]; + + var m = !UCPath.match(chr1); + UCPath = UCPath.replace(chr0,''); + if(m) UCPath = UCPath.replace(chr1,'!'); + for(w = 0; w < UCFullPaths.length; ++w) { + if((m ? UCFullPaths[w].replace(chr1,'!') : UCFullPaths[w]).replace(chr0,'') == UCPath) return cfb.FileIndex[w]; + if((m ? UCPaths[w].replace(chr1,'!') : UCPaths[w]).replace(chr0,'') == UCPath) return cfb.FileIndex[w]; + } + return null; + } + /** CFB Constants */ + var MSSZ = 64; /* Mini Sector Size = 1<<6 */ +//var MSCSZ = 4096; /* Mini Stream Cutoff Size */ + /* 2.1 Compound File Sector Numbers and Types */ + var ENDOFCHAIN = -2; + /* 2.2 Compound File Header */ + var HEADER_SIGNATURE = 'd0cf11e0a1b11ae1'; + var HEADER_SIG = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]; + var HEADER_CLSID = '00000000000000000000000000000000'; + var consts = { + /* 2.1 Compund File Sector Numbers and Types */ + MAXREGSECT: -6, + DIFSECT: -4, + FATSECT: -3, + ENDOFCHAIN: ENDOFCHAIN, + FREESECT: -1, + /* 2.2 Compound File Header */ + HEADER_SIGNATURE: HEADER_SIGNATURE, + HEADER_MINOR_VERSION: '3e00', + MAXREGSID: -6, + NOSTREAM: -1, + HEADER_CLSID: HEADER_CLSID, + /* 2.6.1 Compound File Directory Entry */ + EntryTypes: ['unknown','storage','stream','lockbytes','property','root'] + }; + + function write_file(cfb, filename, options) { + get_fs(); + var o = _write(cfb, options); + fs.writeFileSync(filename, o); + } + + function a2s(o) { + var out = new Array(o.length); + for(var i = 0; i < o.length; ++i) out[i] = String.fromCharCode(o[i]); + return out.join(""); + } + + function write(cfb, options) { + var o = _write(cfb, options); + switch(options && options.type) { + case "file": get_fs(); fs.writeFileSync(options.filename, (o)); return o; + case "binary": return a2s(o); + case "base64": return Base64.encode(a2s(o)); + } + return o; + } + /* node < 8.1 zlib does not expose bytesRead, so default to pure JS */ + var _zlib; + function use_zlib(zlib) { try { + var InflateRaw = zlib.InflateRaw; + var InflRaw = new InflateRaw(); + InflRaw._processChunk(new Uint8Array([3, 0]), InflRaw._finishFlushFlag); + if(InflRaw.bytesRead) _zlib = zlib; + else throw new Error("zlib does not expose bytesRead"); + } catch(e) {console.error("cannot use native zlib: " + (e.message || e)); } } + + function _inflateRawSync(payload, usz) { + if(!_zlib) return _inflate(payload, usz); + var InflateRaw = _zlib.InflateRaw; + var InflRaw = new InflateRaw(); + var out = InflRaw._processChunk(payload.slice(payload.l), InflRaw._finishFlushFlag); + payload.l += InflRaw.bytesRead; + return out; + } + + function _deflateRawSync(payload) { + return _zlib ? _zlib.deflateRawSync(payload) : _deflate(payload); + } + var CLEN_ORDER = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; + + /* LEN_ID = [ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285 ]; */ + var LEN_LN = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13 , 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 ]; + + /* DST_ID = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ]; */ + var DST_LN = [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 ]; + + function bit_swap_8(n) { var t = (((((n<<1)|(n<<11)) & 0x22110) | (((n<<5)|(n<<15)) & 0x88440))); return ((t>>16) | (t>>8) |t)&0xFF; } + + var use_typed_arrays = typeof Uint8Array !== 'undefined'; + + var bitswap8 = use_typed_arrays ? new Uint8Array(1<<8) : []; + for(var q = 0; q < (1<<8); ++q) bitswap8[q] = bit_swap_8(q); + + function bit_swap_n(n, b) { + var rev = bitswap8[n & 0xFF]; + if(b <= 8) return rev >>> (8-b); + rev = (rev << 8) | bitswap8[(n>>8)&0xFF]; + if(b <= 16) return rev >>> (16-b); + rev = (rev << 8) | bitswap8[(n>>16)&0xFF]; + return rev >>> (24-b); + } + + /* helpers for unaligned bit reads */ + function read_bits_2(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 6 ? 0 : buf[h+1]<<8))>>>w)& 0x03; } + function read_bits_3(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 5 ? 0 : buf[h+1]<<8))>>>w)& 0x07; } + function read_bits_4(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 4 ? 0 : buf[h+1]<<8))>>>w)& 0x0F; } + function read_bits_5(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 3 ? 0 : buf[h+1]<<8))>>>w)& 0x1F; } + function read_bits_7(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 1 ? 0 : buf[h+1]<<8))>>>w)& 0x7F; } + + /* works up to n = 3 * 8 + 1 = 25 */ + function read_bits_n(buf, bl, n) { + var w = (bl&7), h = (bl>>>3), f = ((1<>> w; + if(n < 8 - w) return v & f; + v |= buf[h+1]<<(8-w); + if(n < 16 - w) return v & f; + v |= buf[h+2]<<(16-w); + if(n < 24 - w) return v & f; + v |= buf[h+3]<<(24-w); + return v & f; + } + + /* until ArrayBuffer#realloc is a thing, fake a realloc */ + function realloc(b, sz) { + var L = b.length, M = 2*L > sz ? 2*L : sz + 5, i = 0; + if(L >= sz) return b; + if(has_buf) { + var o = new_unsafe_buf(M); + // $FlowIgnore + if(b.copy) b.copy(o); + else for(; i < b.length; ++i) o[i] = b[i]; + return o; + } else if(use_typed_arrays) { + var a = new Uint8Array(M); + if(a.set) a.set(b); + else for(; i < b.length; ++i) a[i] = b[i]; + return a; + } + b.length = M; + return b; + } + + /* zero-filled arrays for older browsers */ + function zero_fill_array(n) { + var o = new Array(n); + for(var i = 0; i < n; ++i) o[i] = 0; + return o; + }var _deflate = (function() { + var _deflateRaw = (function() { + return function deflateRaw(data, out) { + var boff = 0; + while(boff < data.length) { + var L = Math.min(0xFFFF, data.length - boff); + var h = boff + L == data.length; + /* TODO: this is only type 0 stored */ + out.write_shift(1, +h); + out.write_shift(2, L); + out.write_shift(2, (~L) & 0xFFFF); + while(L-- > 0) out[out.l++] = data[boff++]; + } + return out.l; + }; + })(); + + return function(data) { + var buf = new_buf(50+Math.floor(data.length*1.1)); + var off = _deflateRaw(data, buf); + return buf.slice(0, off); + }; + })(); + /* modified inflate function also moves original read head */ + + /* build tree (used for literals and lengths) */ + function build_tree(clens, cmap, MAX) { + var maxlen = 1, w = 0, i = 0, j = 0, ccode = 0, L = clens.length; + + var bl_count = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32); + for(i = 0; i < 32; ++i) bl_count[i] = 0; + + for(i = L; i < MAX; ++i) clens[i] = 0; + L = clens.length; + + var ctree = use_typed_arrays ? new Uint16Array(L) : zero_fill_array(L); // [] + + /* build code tree */ + for(i = 0; i < L; ++i) { + bl_count[(w = clens[i])]++; + if(maxlen < w) maxlen = w; + ctree[i] = 0; + } + bl_count[0] = 0; + for(i = 1; i <= maxlen; ++i) bl_count[i+16] = (ccode = (ccode + bl_count[i-1])<<1); + for(i = 0; i < L; ++i) { + ccode = clens[i]; + if(ccode != 0) ctree[i] = bl_count[ccode+16]++; + } + + /* cmap[maxlen + 4 bits] = (off&15) + (lit<<4) reverse mapping */ + var cleni = 0; + for(i = 0; i < L; ++i) { + cleni = clens[i]; + if(cleni != 0) { + ccode = bit_swap_n(ctree[i], maxlen)>>(maxlen-cleni); + for(j = (1<<(maxlen + 4 - cleni)) - 1; j>=0; --j) + cmap[ccode|(j<>(8-cleni); + for(var j = (1<<(7-cleni))-1; j>=0; --j) dyn_cmap[ccode|(j<>>= 3)) { + case 16: + w = 3 + read_bits_2(data, boff); boff += 2; + ccode = hcodes[hcodes.length - 1]; + while(w-- > 0) hcodes.push(ccode); + break; + case 17: + w = 3 + read_bits_3(data, boff); boff += 3; + while(w-- > 0) hcodes.push(0); + break; + case 18: + w = 11 + read_bits_7(data, boff); boff += 7; + while(w -- > 0) hcodes.push(0); + break; + default: + hcodes.push(ccode); + if(maxlen < ccode) maxlen = ccode; + break; + } + } + + /* build literal / length trees */ + var h1 = hcodes.slice(0, _HLIT), h2 = hcodes.slice(_HLIT); + for(i = _HLIT; i < 286; ++i) h1[i] = 0; + for(i = _HDIST; i < 30; ++i) h2[i] = 0; + dyn_len_1 = build_tree(h1, dyn_lmap, 286); + dyn_len_2 = build_tree(h2, dyn_dmap, 30); + return boff; + } + + /* return [ data, bytesRead ] */ + function inflate(data, usz) { + /* shortcircuit for empty buffer [0x03, 0x00] */ + if(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; } + + /* bit offset */ + var boff = 0; + + /* header includes final bit and type bits */ + var header = 0; + + var outbuf = new_unsafe_buf(usz ? usz : (1<<18)); + var woff = 0; + var OL = outbuf.length>>>0; + var max_len_1 = 0, max_len_2 = 0; + + while((header&1) == 0) { + header = read_bits_3(data, boff); boff += 3; + if((header >>> 1) == 0) { + /* Stored block */ + if(boff & 7) boff += 8 - (boff&7); + /* 2 bytes sz, 2 bytes bit inverse */ + var sz = data[boff>>>3] | data[(boff>>>3)+1]<<8; + boff += 32; + /* push sz bytes */ + if(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; } + if(typeof data.copy === 'function') { + // $FlowIgnore + data.copy(outbuf, woff, boff>>>3, (boff>>>3)+sz); + woff += sz; boff += 8*sz; + } else while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; } + continue; + } else if((header >>> 1) == 1) { + /* Fixed Huffman */ + max_len_1 = 9; max_len_2 = 5; + } else { + /* Dynamic Huffman */ + boff = dyn(data, boff); + max_len_1 = dyn_len_1; max_len_2 = dyn_len_2; + } + if(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; } + for(;;) { // while(true) is apparently out of vogue in modern JS circles + /* ingest code and move read head */ + var bits = read_bits_n(data, boff, max_len_1); + var code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits]; + boff += code & 15; code >>>= 4; + /* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */ + if(((code>>>8)&0xFF) === 0) outbuf[woff++] = code; + else if(code == 256) break; + else { + code -= 257; + var len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0; + var tgt = woff + LEN_LN[code]; + /* length extra bits */ + if(len_eb > 0) { + tgt += read_bits_n(data, boff, len_eb); + boff += len_eb; + } + + /* dist code */ + bits = read_bits_n(data, boff, max_len_2); + code = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits]; + boff += code & 15; code >>>= 4; + var dst_eb = (code < 4 ? 0 : (code-2)>>1); + var dst = DST_LN[code]; + /* dist extra bits */ + if(dst_eb > 0) { + dst += read_bits_n(data, boff, dst_eb); + boff += dst_eb; + } + + /* in the common case, manual byte copy is faster than TA set / Buffer copy */ + if(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt); OL = outbuf.length; } + while(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; } + } + } + } + return [usz ? outbuf : outbuf.slice(0, woff), (boff+7)>>>3]; + } + + function _inflate(payload, usz) { + var data = payload.slice(payload.l||0); + var out = inflate(data, usz); + payload.l += out[1]; + return out[0]; + } + + function warn_or_throw(wrn, msg) { + if(wrn) { if(typeof console !== 'undefined') console.error(msg); } + else throw new Error(msg); + } + + function parse_zip(file, options) { + var blob = file; + prep_blob(blob, 0); + + var FileIndex = [], FullPaths = []; + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + init_cfb(o, { root: options.root }); + + /* find end of central directory, start just after signature */ + var i = blob.length - 4; + while((blob[i] != 0x50 || blob[i+1] != 0x4b || blob[i+2] != 0x05 || blob[i+3] != 0x06) && i >= 0) --i; + blob.l = i + 4; + + /* parse end of central directory */ + blob.l += 4; + var fcnt = blob.read_shift(2); + blob.l += 6; + var start_cd = blob.read_shift(4); + + /* parse central directory */ + blob.l = start_cd; + + for(i = 0; i < fcnt; ++i) { + /* trust local file header instead of CD entry */ + blob.l += 20; + var csz = blob.read_shift(4); + var usz = blob.read_shift(4); + var namelen = blob.read_shift(2); + var efsz = blob.read_shift(2); + var fcsz = blob.read_shift(2); + blob.l += 8; + var offset = blob.read_shift(4); + var EF = parse_extra_field(blob.slice(blob.l+namelen, blob.l+namelen+efsz)); + blob.l += namelen + efsz + fcsz; + + var L = blob.l; + blob.l = offset + 4; + parse_local_file(blob, csz, usz, o, EF); + blob.l = L; + } + + return o; + } + + + /* head starts just after local file header signature */ + function parse_local_file(blob, csz, usz, o, EF) { + /* [local file header] */ + blob.l += 2; + var flags = blob.read_shift(2); + var meth = blob.read_shift(2); + var date = parse_dos_date(blob); + + if(flags & 0x2041) throw new Error("Unsupported ZIP encryption"); + var crc32 = blob.read_shift(4); + var _csz = blob.read_shift(4); + var _usz = blob.read_shift(4); + + var namelen = blob.read_shift(2); + var efsz = blob.read_shift(2); + + // TODO: flags & (1<<11) // UTF8 + var name = ""; for(var i = 0; i < namelen; ++i) name += String.fromCharCode(blob[blob.l++]); + if(efsz) { + var ef = parse_extra_field(blob.slice(blob.l, blob.l + efsz)); + if((ef[0x5455]||{}).mt) date = ef[0x5455].mt; + if(((EF||{})[0x5455]||{}).mt) date = EF[0x5455].mt; + } + blob.l += efsz; + + /* [encryption header] */ + + /* [file data] */ + var data = blob.slice(blob.l, blob.l + _csz); + switch(meth) { + case 8: data = _inflateRawSync(blob, _usz); break; + case 0: break; + default: throw new Error("Unsupported ZIP Compression method " + meth); + } + + /* [data descriptor] */ + var wrn = false; + if(flags & 8) { + crc32 = blob.read_shift(4); + if(crc32 == 0x08074b50) { crc32 = blob.read_shift(4); wrn = true; } + _csz = blob.read_shift(4); + _usz = blob.read_shift(4); + } + + if(_csz != csz) warn_or_throw(wrn, "Bad compressed size: " + csz + " != " + _csz); + if(_usz != usz) warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz); + var _crc32 = CRC32.buf(data, 0); + if(crc32 != _crc32) warn_or_throw(wrn, "Bad CRC32 checksum: " + crc32 + " != " + _crc32); + cfb_add(o, name, data, {unsafe: true, mt: date}); + } + function write_zip(cfb, options) { + var _opts = options || {}; + var out = [], cdirs = []; + var o = new_buf(1); + var method = (_opts.compression ? 8 : 0), flags = 0; + var desc = false; + if(desc) flags |= 8; + var i = 0, j = 0; + + var start_cd = 0, fcnt = 0; + var root = cfb.FullPaths[0], fp = root, fi = cfb.FileIndex[0]; + var crcs = []; + var sz_cd = 0; + + for(i = 1; i < cfb.FullPaths.length; ++i) { + fp = cfb.FullPaths[i].slice(root.length); fi = cfb.FileIndex[i]; + if(!fi.size || !fi.content || fp == "\u0001Sh33tJ5") continue; + var start = start_cd; + + /* TODO: CP437 filename */ + var namebuf = new_buf(fp.length); + for(j = 0; j < fp.length; ++j) namebuf.write_shift(1, fp.charCodeAt(j) & 0x7F); + namebuf = namebuf.slice(0, namebuf.l); + crcs[fcnt] = CRC32.buf(fi.content, 0); + + var outbuf = fi.content; + if(method == 8) outbuf = _deflateRawSync(outbuf); + + /* local file header */ + o = new_buf(30); + o.write_shift(4, 0x04034b50); + o.write_shift(2, 20); + o.write_shift(2, flags); + o.write_shift(2, method); + /* TODO: last mod file time/date */ + if(fi.mt) write_dos_date(o, fi.mt); + else o.write_shift(4, 0); + o.write_shift(-4, (flags & 8) ? 0 : crcs[fcnt]); + o.write_shift(4, (flags & 8) ? 0 : outbuf.length); + o.write_shift(4, (flags & 8) ? 0 : fi.content.length); + o.write_shift(2, namebuf.length); + o.write_shift(2, 0); + + start_cd += o.length; + out.push(o); + start_cd += namebuf.length; + out.push(namebuf); + + /* TODO: encryption header ? */ + start_cd += outbuf.length; + out.push(outbuf); + + /* data descriptor */ + if(flags & 8) { + o = new_buf(12); + o.write_shift(-4, crcs[fcnt]); + o.write_shift(4, outbuf.length); + o.write_shift(4, fi.content.length); + start_cd += o.l; + out.push(o); + } + + /* central directory */ + o = new_buf(46); + o.write_shift(4, 0x02014b50); + o.write_shift(2, 0); + o.write_shift(2, 20); + o.write_shift(2, flags); + o.write_shift(2, method); + o.write_shift(4, 0); /* TODO: last mod file time/date */ + o.write_shift(-4, crcs[fcnt]); + + o.write_shift(4, outbuf.length); + o.write_shift(4, fi.content.length); + o.write_shift(2, namebuf.length); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(4, 0); + o.write_shift(4, start); + + sz_cd += o.l; + cdirs.push(o); + sz_cd += namebuf.length; + cdirs.push(namebuf); + ++fcnt; + } + + /* end of central directory */ + o = new_buf(22); + o.write_shift(4, 0x06054b50); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, fcnt); + o.write_shift(2, fcnt); + o.write_shift(4, sz_cd); + o.write_shift(4, start_cd); + o.write_shift(2, 0); + + return bconcat(([bconcat((out)), bconcat(cdirs), o])); + } + function cfb_new(opts) { + var o = ({}); + init_cfb(o, opts); + return o; + } + + function cfb_add(cfb, name, content, opts) { + var unsafe = opts && opts.unsafe; + if(!unsafe) init_cfb(cfb); + var file = !unsafe && CFB.find(cfb, name); + if(!file) { + var fpath = cfb.FullPaths[0]; + if(name.slice(0, fpath.length) == fpath) fpath = name; + else { + if(fpath.slice(-1) != "/") fpath += "/"; + fpath = (fpath + name).replace("//","/"); + } + file = ({name: filename(name), type: 2}); + cfb.FileIndex.push(file); + cfb.FullPaths.push(fpath); + if(!unsafe) CFB.utils.cfb_gc(cfb); + } + file.content = (content); + file.size = content ? content.length : 0; + if(opts) { + if(opts.CLSID) file.clsid = opts.CLSID; + if(opts.mt) file.mt = opts.mt; + if(opts.ct) file.ct = opts.ct; + } + return file; + } + + function cfb_del(cfb, name) { + init_cfb(cfb); + var file = CFB.find(cfb, name); + if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) { + cfb.FileIndex.splice(j, 1); + cfb.FullPaths.splice(j, 1); + return true; + } + return false; + } + + function cfb_mov(cfb, old_name, new_name) { + init_cfb(cfb); + var file = CFB.find(cfb, old_name); + if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) { + cfb.FileIndex[j].name = filename(new_name); + cfb.FullPaths[j] = new_name; + return true; + } + return false; + } + + function cfb_gc(cfb) { rebuild_cfb(cfb, true); } + + exports.find = find; + exports.read = read; + exports.parse = parse; + exports.write = write; + exports.writeFile = write_file; + exports.utils = { + cfb_new: cfb_new, + cfb_add: cfb_add, + cfb_del: cfb_del, + cfb_mov: cfb_mov, + cfb_gc: cfb_gc, + ReadShift: ReadShift, + CheckField: CheckField, + prep_blob: prep_blob, + bconcat: bconcat, + use_zlib: use_zlib, + _deflateRaw: _deflate, + _inflateRaw: _inflate, + consts: consts + }; + + return exports; + })(); + + if(typeof require !== 'undefined' && typeof module !== 'undefined' && typeof DO_NOT_EXPORT_CFB === 'undefined') { module.exports = CFB; } + var _fs; + if(typeof require !== 'undefined') try { _fs = require('fs'); } catch(e) {} + + /* normalize data for blob ctor */ + function blobify(data) { + if(typeof data === "string") return s2ab(data); + if(Array.isArray(data)) return a2u(data); + return data; + } + /* write or download file */ + function write_dl(fname, payload, enc) { + /*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */ + if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); + var data = (enc == "utf8") ? utf8write(payload) : payload; + if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); + if(typeof Blob !== 'undefined') { + var blob = new Blob([blobify(data)], {type:"application/octet-stream"}); + if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname); + if(typeof saveAs !== 'undefined') return saveAs(blob, fname); + if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) { + var url = URL.createObjectURL(blob); + if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") { + if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); + return chrome.downloads.download({ url: url, filename: fname, saveAs: true}); + } + var a = document.createElement("a"); + if(a.download != null) { + a.download = fname; a.href = url; document.body.appendChild(a); a.click(); + document.body.removeChild(a); + if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); + return url; + } + } + } + // $FlowIgnore + if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript + // $FlowIgnore + var out = File(fname); out.open("w"); out.encoding = "binary"; + if(Array.isArray(payload)) payload = a2s(payload); + out.write(payload); out.close(); return payload; + } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } + throw new Error("cannot save file " + fname); + } + + /* read binary data from file */ + function read_binary(path) { + if(typeof _fs !== 'undefined') return _fs.readFileSync(path); + // $FlowIgnore + if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript + // $FlowIgnore + var infile = File(path); infile.open("r"); infile.encoding = "binary"; + var data = infile.read(); infile.close(); + return data; + } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } + throw new Error("Cannot access file " + path); + } + function keys(o) { + var ks = Object.keys(o), o2 = []; + for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]); + return o2; + } + + function evert_key(obj, key) { + var o = ([]), K = keys(obj); + for(var i = 0; i !== K.length; ++i) if(o[obj[K[i]][key]] == null) o[obj[K[i]][key]] = K[i]; + return o; + } + + function evert(obj) { + var o = ([]), K = keys(obj); + for(var i = 0; i !== K.length; ++i) o[obj[K[i]]] = K[i]; + return o; + } + + function evert_num(obj) { + var o = ([]), K = keys(obj); + for(var i = 0; i !== K.length; ++i) o[obj[K[i]]] = parseInt(K[i],10); + return o; + } + + function evert_arr(obj) { + var o = ([]), K = keys(obj); + for(var i = 0; i !== K.length; ++i) { + if(o[obj[K[i]]] == null) o[obj[K[i]]] = []; + o[obj[K[i]]].push(K[i]); + } + return o; + } + + var basedate = new Date(1899, 11, 30, 0, 0, 0); // 2209161600000 + var dnthresh = basedate.getTime() + (new Date().getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000; + function datenum(v, date1904) { + var epoch = v.getTime(); + if(date1904) epoch -= 1462*24*60*60*1000; + return (epoch - dnthresh) / (24 * 60 * 60 * 1000); + } + function numdate(v) { + var out = new Date(); + out.setTime(v * 24 * 60 * 60 * 1000 + dnthresh); + return out; + } + + /* ISO 8601 Duration */ + function parse_isodur(s) { + var sec = 0, mt = 0, time = false; + var m = s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/); + if(!m) throw new Error("|" + s + "| is not an ISO8601 Duration"); + for(var i = 1; i != m.length; ++i) { + if(!m[i]) continue; + mt = 1; + if(i > 3) time = true; + switch(m[i].slice(m[i].length-1)) { + case 'Y': + throw new Error("Unsupported ISO Duration Field: " + m[i].slice(m[i].length-1)); + case 'D': mt *= 24; + /* falls through */ + case 'H': mt *= 60; + /* falls through */ + case 'M': + if(!time) throw new Error("Unsupported ISO Duration Field: M"); + else mt *= 60; + /* falls through */ + case 'S': break; + } + sec += mt * parseInt(m[i], 10); + } + return sec; + } + + var good_pd_date = new Date('2017-02-19T19:06:09.000Z'); + if(isNaN(good_pd_date.getFullYear())) good_pd_date = new Date('2/19/17'); + var good_pd = good_pd_date.getFullYear() == 2017; + /* parses a date as a local date */ + function parseDate(str, fixdate) { + var d = new Date(str); + if(good_pd) { + if(fixdate > 0) d.setTime(d.getTime() + d.getTimezoneOffset() * 60 * 1000); + else if(fixdate < 0) d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1000); + return d; + } + if(str instanceof Date) return str; + if(good_pd_date.getFullYear() == 1917 && !isNaN(d.getFullYear())) { + var s = d.getFullYear(); + if(str.indexOf("" + s) > -1) return d; + d.setFullYear(d.getFullYear() + 100); return d; + } + var n = str.match(/\d+/g)||["2017","2","19","0","0","0"]; + var out = new Date(+n[0], +n[1] - 1, +n[2], (+n[3]||0), (+n[4]||0), (+n[5]||0)); + if(str.indexOf("Z") > -1) out = new Date(out.getTime() - out.getTimezoneOffset() * 60 * 1000); + return out; + } + + function cc2str(arr) { + var o = ""; + for(var i = 0; i != arr.length; ++i) o += String.fromCharCode(arr[i]); + return o; + } + + function dup(o) { + if(typeof JSON != 'undefined' && !Array.isArray(o)) return JSON.parse(JSON.stringify(o)); + if(typeof o != 'object' || o == null) return o; + if(o instanceof Date) return new Date(o.getTime()); + var out = {}; + for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]); + return out; + } + + function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; } + + /* TODO: stress test */ + function fuzzynum(s) { + var v = Number(s); + if(!isNaN(v)) return v; + var wt = 1; + var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";}); + if(!isNaN(v = Number(ss))) return v / wt; + ss = ss.replace(/[(](.*)[)]/,function($$, $1) { wt = -wt; return $1;}); + if(!isNaN(v = Number(ss))) return v / wt; + return v; + } + function fuzzydate(s) { + var o = new Date(s), n = new Date(NaN); + var y = o.getYear(), m = o.getMonth(), d = o.getDate(); + if(isNaN(d)) return n; + if(y < 0 || y > 8099) return n; + if((m > 0 || d > 1) && y != 101) return o; + if(s.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) return o; + if(s.match(/[^-0-9:,\/\\]/)) return n; + return o; + } + + var safe_split_regex = "abacaba".split(/(:?b)/i).length == 5; + function split_regex(str, re, def) { + if(safe_split_regex || typeof re == "string") return str.split(re); + var p = str.split(re), o = [p[0]]; + for(var i = 1; i < p.length; ++i) { o.push(def); o.push(p[i]); } + return o; + } + function getdatastr(data) { + if(!data) return null; + if(data.data) return debom(data.data); + if(data.asNodeBuffer && has_buf) return debom(data.asNodeBuffer().toString('binary')); + if(data.asBinary) return debom(data.asBinary()); + if(data._data && data._data.getContent) return debom(cc2str(Array.prototype.slice.call(data._data.getContent(),0))); + return null; + } + + function getdatabin(data) { + if(!data) return null; + if(data.data) return char_codes(data.data); + if(data.asNodeBuffer && has_buf) return data.asNodeBuffer(); + if(data._data && data._data.getContent) { + var o = data._data.getContent(); + if(typeof o == "string") return char_codes(o); + return Array.prototype.slice.call(o); + } + return null; + } + + function getdata(data) { return (data && data.name.slice(-4) === ".bin") ? getdatabin(data) : getdatastr(data); } + + /* Part 2 Section 10.1.2 "Mapping Content Types" Names are case-insensitive */ + /* OASIS does not comment on filename case sensitivity */ + function safegetzipfile(zip, file) { + var k = keys(zip.files); + var f = file.toLowerCase(), g = f.replace(/\//g,'\\'); + for(var i=0; i\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g; + var tagregex=/<[\/\?]?[a-zA-Z0-9:]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s?[\/\?]?>/g; + if(!(XML_HEADER.match(tagregex))) tagregex = /<[^>]*>/g; + var nsregex=/<\w*:/, nsregex2 = /<(\/?)\w+:/; + function parsexmltag(tag, skip_root) { + var z = ({}); + var eq = 0, c = 0; + for(; eq !== tag.length; ++eq) if((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) break; + if(!skip_root) z[0] = tag.slice(0, eq); + if(eq === tag.length) return z; + var m = tag.match(attregexg), j=0, v="", i=0, q="", cc="", quot = 1; + if(m) for(i = 0; i != m.length; ++i) { + cc = m[i]; + for(c=0; c != cc.length; ++c) if(cc.charCodeAt(c) === 61) break; + q = cc.slice(0,c).trim(); + while(cc.charCodeAt(c+1) == 32) ++c; + quot = ((eq=cc.charCodeAt(c+1)) == 34 || eq == 39) ? 1 : 0; + v = cc.slice(c+1+quot, cc.length-quot); + for(j=0;j!=q.length;++j) if(q.charCodeAt(j) === 58) break; + if(j===q.length) { + if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods + z[q] = v; + z[q.toLowerCase()] = v; + } + else { + var k = (j===5 && q.slice(0,5)==="xmlns"?"xmlns":"")+q.slice(j+1); + if(z[k] && q.slice(j-3,j) == "ext") continue; // from ods + z[k] = v; + z[k.toLowerCase()] = v; + } + } + return z; + } + function strip_ns(x) { return x.replace(nsregex2, "<$1"); } + + var encodings = { + '"': '"', + ''': "'", + '>': '>', + '<': '<', + '&': '&' + }; + var rencoding = evert(encodings); +//var rencstr = "&<>'\"".split(""); + +// TODO: CP remap (need to read file version to determine OS) + var unescapexml = (function() { + /* 22.4.2.4 bstr (Basic String) */ + var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g; + return function unescapexml(text) { + var s = text + '', i = s.indexOf("-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));}); + var j = s.indexOf("]]>"); + return unescapexml(s.slice(0, i)) + s.slice(i+9,j) + unescapexml(s.slice(j+3)); + }; + })(); + + var decregex=/[&<>'"]/g, charegex = /[\u0000-\u0008\u000b-\u001f]/g; + function escapexml(text){ + var s = text + ''; + return s.replace(decregex, function(y) { return rencoding[y]; }).replace(charegex,function(s) { return "_x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + "_";}); + } + function escapexmltag(text){ return escapexml(text).replace(/ /g,"_x0020_"); } + + var htmlcharegex = /[\u0000-\u001f]/g; + function escapehtml(text){ + var s = text + ''; + return s.replace(decregex, function(y) { return rencoding[y]; }).replace(/\n/g, "
          ").replace(htmlcharegex,function(s) { return "&#x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + ";"; }); + } + + function escapexlml(text){ + var s = text + ''; + return s.replace(decregex, function(y) { return rencoding[y]; }).replace(htmlcharegex,function(s) { return "&#x" + (s.charCodeAt(0).toString(16)).toUpperCase() + ";"; }); + } + + /* TODO: handle codepages */ + var xlml_fixstr = (function() { + var entregex = /&#(\d+);/g; + function entrepl($$,$1) { return String.fromCharCode(parseInt($1,10)); } + return function xlml_fixstr(str) { return str.replace(entregex,entrepl); }; + })(); + var xlml_unfixstr = (function() { + return function xlml_unfixstr(str) { return str.replace(/(\r\n|[\r\n])/g,"\ "); }; + })(); + + function parsexmlbool(value) { + switch(value) { + case 1: case true: case '1': case 'true': case 'TRUE': return true; + /* case '0': case 'false': case 'FALSE':*/ + default: return false; + } + } + + var utf8read = function utf8reada(orig) { + var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0; + while (i < orig.length) { + c = orig.charCodeAt(i++); + if (c < 128) { out += String.fromCharCode(c); continue; } + d = orig.charCodeAt(i++); + if (c>191 && c<224) { f = ((c & 31) << 6); f |= (d & 63); out += String.fromCharCode(f); continue; } + e = orig.charCodeAt(i++); + if (c < 240) { out += String.fromCharCode(((c & 15) << 12) | ((d & 63) << 6) | (e & 63)); continue; } + f = orig.charCodeAt(i++); + w = (((c & 7) << 18) | ((d & 63) << 12) | ((e & 63) << 6) | (f & 63))-65536; + out += String.fromCharCode(0xD800 + ((w>>>10)&1023)); + out += String.fromCharCode(0xDC00 + (w&1023)); + } + return out; + }; + + var utf8write = function(orig) { + var out = [], i = 0, c = 0, d = 0; + while(i < orig.length) { + c = orig.charCodeAt(i++); + switch(true) { + case c < 128: out.push(String.fromCharCode(c)); break; + case c < 2048: + out.push(String.fromCharCode(192 + (c >> 6))); + out.push(String.fromCharCode(128 + (c & 63))); + break; + case c >= 55296 && c < 57344: + c -= 55296; d = orig.charCodeAt(i++) - 56320 + (c<<10); + out.push(String.fromCharCode(240 + ((d >>18) & 7))); + out.push(String.fromCharCode(144 + ((d >>12) & 63))); + out.push(String.fromCharCode(128 + ((d >> 6) & 63))); + out.push(String.fromCharCode(128 + (d & 63))); + break; + default: + out.push(String.fromCharCode(224 + (c >> 12))); + out.push(String.fromCharCode(128 + ((c >> 6) & 63))); + out.push(String.fromCharCode(128 + (c & 63))); + } + } + return out.join(""); + }; + + if(has_buf) { + var utf8readb = function utf8readb(data) { + var out = Buffer.alloc(2*data.length), w, i, j = 1, k = 0, ww=0, c; + for(i = 0; i < data.length; i+=j) { + j = 1; + if((c=data.charCodeAt(i)) < 128) w = c; + else if(c < 224) { w = (c&31)*64+(data.charCodeAt(i+1)&63); j=2; } + else if(c < 240) { w=(c&15)*4096+(data.charCodeAt(i+1)&63)*64+(data.charCodeAt(i+2)&63); j=3; } + else { j = 4; + w = (c & 7)*262144+(data.charCodeAt(i+1)&63)*4096+(data.charCodeAt(i+2)&63)*64+(data.charCodeAt(i+3)&63); + w -= 65536; ww = 0xD800 + ((w>>>10)&1023); w = 0xDC00 + (w&1023); + } + if(ww !== 0) { out[k++] = ww&255; out[k++] = ww>>>8; ww = 0; } + out[k++] = w%256; out[k++] = w>>>8; + } + return out.slice(0,k).toString('ucs2'); + }; + var corpus = "foo bar baz\u00e2\u0098\u0083\u00f0\u009f\u008d\u00a3"; + if(utf8read(corpus) == utf8readb(corpus)) utf8read = utf8readb; + // $FlowIgnore + var utf8readc = function utf8readc(data) { return Buffer_from(data, 'binary').toString('utf8'); }; + if(utf8read(corpus) == utf8readc(corpus)) utf8read = utf8readc; + + // $FlowIgnore + utf8write = function(data) { return Buffer_from(data, 'utf8').toString("binary"); }; + } + +// matches ... extracts content + var matchtag = (function() { + var mtcache = ({}); + return function matchtag(f,g) { + var t = f+"|"+(g||""); + if(mtcache[t]) return mtcache[t]; + return (mtcache[t] = new RegExp('<(?:\\w+:)?'+f+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)',((g||"")))); + }; + })(); + + var htmldecode = (function() { + var entities = [ + ['nbsp', ' '], ['middot', '·'], + ['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&'] + ].map(function(x) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; }); + return function htmldecode(str) { + var o = str.replace(/^[\t\n\r ]+/, "").replace(/[\t\n\r ]+$/,"").replace(/[\t\n\r ]+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g,"\n").replace(/<[^>]*>/g,""); + for(var i = 0; i < entities.length; ++i) o = o.replace(entities[i][0], entities[i][1]); + return o; + }; + })(); + + var vtregex = (function(){ var vt_cache = {}; + return function vt_regex(bt) { + if(vt_cache[bt] !== undefined) return vt_cache[bt]; + return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g') ); + };})(); + var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)' + g + ''; } + + function wxt_helper(h) { return keys(h).map(function(k) { return " " + k + '="' + h[k] + '"';}).join(""); } + function writextag(f,g,h) { return '<' + f + ((h != null) ? wxt_helper(h) : "") + ((g != null) ? (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + '';} + + function write_w3cdtf(d, t) { try { return d.toISOString().replace(/\.\d*/,""); } catch(e) { if(t) throw e; } return ""; } + + function write_vt(s) { + switch(typeof s) { + case 'string': return writextag('vt:lpwstr', s); + case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s)); + case 'boolean': return writextag('vt:bool',s?'true':'false'); + } + if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s)); + throw new Error("Unable to serialize " + s); + } + + var XMLNS = ({ + 'dc': 'http://purl.org/dc/elements/1.1/', + 'dcterms': 'http://purl.org/dc/terms/', + 'dcmitype': 'http://purl.org/dc/dcmitype/', + 'mx': 'http://schemas.microsoft.com/office/mac/excel/2008/main', + 'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', + 'sjs': 'http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties', + 'vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes', + 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', + 'xsd': 'http://www.w3.org/2001/XMLSchema' + }); + + XMLNS.main = [ + 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', + 'http://purl.oclc.org/ooxml/spreadsheetml/main', + 'http://schemas.microsoft.com/office/excel/2006/main', + 'http://schemas.microsoft.com/office/excel/2006/2' + ]; + + var XLMLNS = ({ + 'o': 'urn:schemas-microsoft-com:office:office', + 'x': 'urn:schemas-microsoft-com:office:excel', + 'ss': 'urn:schemas-microsoft-com:office:spreadsheet', + 'dt': 'uuid:C2F41010-65B3-11d1-A29F-00AA00C14882', + 'mv': 'http://macVmlSchemaUri', + 'v': 'urn:schemas-microsoft-com:vml', + 'html': 'http://www.w3.org/TR/REC-html40' + }); + function read_double_le(b, idx) { + var s = 1 - 2 * (b[idx + 7] >>> 7); + var e = ((b[idx + 7] & 0x7f) << 4) + ((b[idx + 6] >>> 4) & 0x0f); + var m = (b[idx+6]&0x0f); + for(var i = 5; i >= 0; --i) m = m * 256 + b[idx + i]; + if(e == 0x7ff) return m == 0 ? (s * Infinity) : NaN; + if(e == 0) e = -1022; + else { e -= 1023; m += Math.pow(2,52); } + return s * Math.pow(2, e - 52) * m; + } + + function write_double_le(b, v, idx) { + var bs = ((((v < 0) || (1/v == -Infinity)) ? 1 : 0) << 7), e = 0, m = 0; + var av = bs ? (-v) : v; + if(!isFinite(av)) { e = 0x7ff; m = isNaN(v) ? 0x6969 : 0; } + else if(av == 0) e = m = 0; + else { + e = Math.floor(Math.log(av) / Math.LN2); + m = av * Math.pow(2, 52 - e); + if((e <= -1023) && (!isFinite(m) || (m < Math.pow(2,52)))) { e = -1022; } + else { m -= Math.pow(2,52); e+=1023; } + } + for(var i = 0; i <= 5; ++i, m/=256) b[idx + i] = m & 0xff; + b[idx + 6] = ((e & 0x0f) << 4) | (m & 0xf); + b[idx + 7] = (e >> 4) | bs; + } + + var __toBuffer = function(bufs) { var x=[],w=10240; for(var i=0;i 0 ? __utf8(b, i+4,i+4+len-1) : "";}; + var ___lpstr = __lpstr; + var __cpstr = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";}; + var ___cpstr = __cpstr; + var __lpwstr = function(b,i) { var len = 2*__readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";}; + var ___lpwstr = __lpwstr; + var __lpp4, ___lpp4; + __lpp4 = ___lpp4 = function lpp4_(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? __utf16le(b, i+4,i+4+len) : "";}; + var __8lpp4 = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len) : "";}; + var ___8lpp4 = __8lpp4; + var __double, ___double; + __double = ___double = function(b, idx) { return read_double_le(b, idx);}; + var is_buf = function is_buf_a(a) { return Array.isArray(a); }; + + if(has_buf) { + __utf16le = function(b,s,e) { if(!Buffer.isBuffer(b)) return ___utf16le(b,s,e); return b.toString('utf16le',s,e).replace(chr0,'')/*.replace(chr1,'!')*/; }; + __hexlify = function(b,s,l) { return Buffer.isBuffer(b) ? b.toString('hex',s,s+l) : ___hexlify(b,s,l); }; + __lpstr = function lpstr_b(b, i) { if(!Buffer.isBuffer(b)) return ___lpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8',i+4,i+4+len-1) : "";}; + __cpstr = function cpstr_b(b, i) { if(!Buffer.isBuffer(b)) return ___cpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8',i+4,i+4+len-1) : "";}; + __lpwstr = function lpwstr_b(b, i) { if(!Buffer.isBuffer(b)) return ___lpwstr(b, i); var len = 2*b.readUInt32LE(i); return b.toString('utf16le',i+4,i+4+len-1);}; + __lpp4 = function lpp4_b(b, i) { if(!Buffer.isBuffer(b)) return ___lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf16le',i+4,i+4+len);}; + __8lpp4 = function lpp4_8b(b, i) { if(!Buffer.isBuffer(b)) return ___8lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf8',i+4,i+4+len);}; + __utf8 = function utf8_b(b, s, e) { return (Buffer.isBuffer(b)) ? b.toString('utf8',s,e) : ___utf8(b,s,e); }; + __toBuffer = function(bufs) { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat(bufs[0]) : ___toBuffer(bufs);}; + bconcat = function(bufs) { return Buffer.isBuffer(bufs[0]) ? Buffer.concat(bufs) : [].concat.apply([], bufs); }; + __double = function double_(b, i) { if(Buffer.isBuffer(b)) return b.readDoubleLE(i); return ___double(b,i); }; + is_buf = function is_buf_b(a) { return Buffer.isBuffer(a) || Array.isArray(a); }; + } + + /* from js-xls */ + if(typeof cptable !== 'undefined') { + __utf16le = function(b,s,e) { return cptable.utils.decode(1200, b.slice(s,e)).replace(chr0, ''); }; + __utf8 = function(b,s,e) { return cptable.utils.decode(65001, b.slice(s,e)); }; + __lpstr = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(current_ansi, b.slice(i+4, i+4+len-1)) : "";}; + __cpstr = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(current_codepage, b.slice(i+4, i+4+len-1)) : "";}; + __lpwstr = function(b,i) { var len = 2*__readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(1200, b.slice(i+4,i+4+len-1)) : "";}; + __lpp4 = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(1200, b.slice(i+4,i+4+len)) : "";}; + __8lpp4 = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(65001, b.slice(i+4,i+4+len)) : "";}; + } + + var __readUInt8 = function(b, idx) { return b[idx]; }; + var __readUInt16LE = function(b, idx) { return (b[idx+1]*(1<<8))+b[idx]; }; + var __readInt16LE = function(b, idx) { var u = (b[idx+1]*(1<<8))+b[idx]; return (u < 0x8000) ? u : ((0xffff - u + 1) * -1); }; + var __readUInt32LE = function(b, idx) { return b[idx+3]*(1<<24)+(b[idx+2]<<16)+(b[idx+1]<<8)+b[idx]; }; + var __readInt32LE = function(b, idx) { return (b[idx+3]<<24)|(b[idx+2]<<16)|(b[idx+1]<<8)|b[idx]; }; + var __readInt32BE = function(b, idx) { return (b[idx]<<24)|(b[idx+1]<<16)|(b[idx+2]<<8)|b[idx+3]; }; + + function ReadShift(size, t) { + var o="", oI, oR, oo=[], w, vv, i, loc; + switch(t) { + case 'dbcs': + loc = this.l; + if(has_buf && Buffer.isBuffer(this)) o = this.slice(this.l, this.l+2*size).toString("utf16le"); + else for(i = 0; i < size; ++i) { o+=String.fromCharCode(__readUInt16LE(this, loc)); loc+=2; } + size *= 2; + break; + + case 'utf8': o = __utf8(this, this.l, this.l + size); break; + case 'utf16le': size *= 2; o = __utf16le(this, this.l, this.l + size); break; + + case 'wstr': + if(typeof cptable !== 'undefined') o = cptable.utils.decode(current_codepage, this.slice(this.l, this.l+2*size)); + else return ReadShift.call(this, size, 'dbcs'); + size = 2 * size; break; + + /* [MS-OLEDS] 2.1.4 LengthPrefixedAnsiString */ + case 'lpstr-ansi': o = __lpstr(this, this.l); size = 4 + __readUInt32LE(this, this.l); break; + case 'lpstr-cp': o = __cpstr(this, this.l); size = 4 + __readUInt32LE(this, this.l); break; + /* [MS-OLEDS] 2.1.5 LengthPrefixedUnicodeString */ + case 'lpwstr': o = __lpwstr(this, this.l); size = 4 + 2 * __readUInt32LE(this, this.l); break; + /* [MS-OFFCRYPTO] 2.1.2 Length-Prefixed Padded Unicode String (UNICODE-LP-P4) */ + case 'lpp4': size = 4 + __readUInt32LE(this, this.l); o = __lpp4(this, this.l); if(size & 0x02) size += 2; break; + /* [MS-OFFCRYPTO] 2.1.3 Length-Prefixed UTF-8 String (UTF-8-LP-P4) */ + case '8lpp4': size = 4 + __readUInt32LE(this, this.l); o = __8lpp4(this, this.l); if(size & 0x03) size += 4 - (size & 0x03); break; + + case 'cstr': size = 0; o = ""; + while((w=__readUInt8(this, this.l + size++))!==0) oo.push(_getchar(w)); + o = oo.join(""); break; + case '_wstr': size = 0; o = ""; + while((w=__readUInt16LE(this,this.l +size))!==0){oo.push(_getchar(w));size+=2;} + size+=2; o = oo.join(""); break; + + /* sbcs and dbcs support continue records in the SST way TODO codepages */ + case 'dbcs-cont': o = ""; loc = this.l; + for(i = 0; i < size; ++i) { + if(this.lens && this.lens.indexOf(loc) !== -1) { + w = __readUInt8(this, loc); + this.l = loc + 1; + vv = ReadShift.call(this, size-i, w ? 'dbcs-cont' : 'sbcs-cont'); + return oo.join("") + vv; + } + oo.push(_getchar(__readUInt16LE(this, loc))); + loc+=2; + } o = oo.join(""); size *= 2; break; + + case 'cpstr': + if(typeof cptable !== 'undefined') { + o = cptable.utils.decode(current_codepage, this.slice(this.l, this.l + size)); + break; + } + /* falls through */ + case 'sbcs-cont': o = ""; loc = this.l; + for(i = 0; i != size; ++i) { + if(this.lens && this.lens.indexOf(loc) !== -1) { + w = __readUInt8(this, loc); + this.l = loc + 1; + vv = ReadShift.call(this, size-i, w ? 'dbcs-cont' : 'sbcs-cont'); + return oo.join("") + vv; + } + oo.push(_getchar(__readUInt8(this, loc))); + loc+=1; + } o = oo.join(""); break; + + default: + switch(size) { + case 1: oI = __readUInt8(this, this.l); this.l++; return oI; + case 2: oI = (t === 'i' ? __readInt16LE : __readUInt16LE)(this, this.l); this.l += 2; return oI; + case 4: case -4: + if(t === 'i' || ((this[this.l+3] & 0x80)===0)) { oI = ((size > 0) ? __readInt32LE : __readInt32BE)(this, this.l); this.l += 4; return oI; } + else { oR = __readUInt32LE(this, this.l); this.l += 4; } return oR; + case 8: case -8: + if(t === 'f') { + if(size == 8) oR = __double(this, this.l); + else oR = __double([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]], 0); + this.l += 8; return oR; + } else size = 8; + /* falls through */ + case 16: o = __hexlify(this, this.l, size); break; + }} + this.l+=size; return o; + } + + var __writeUInt32LE = function(b, val, idx) { b[idx] = (val & 0xFF); b[idx+1] = ((val >>> 8) & 0xFF); b[idx+2] = ((val >>> 16) & 0xFF); b[idx+3] = ((val >>> 24) & 0xFF); }; + var __writeInt32LE = function(b, val, idx) { b[idx] = (val & 0xFF); b[idx+1] = ((val >> 8) & 0xFF); b[idx+2] = ((val >> 16) & 0xFF); b[idx+3] = ((val >> 24) & 0xFF); }; + var __writeUInt16LE = function(b, val, idx) { b[idx] = (val & 0xFF); b[idx+1] = ((val >>> 8) & 0xFF); }; + + function WriteShift(t, val, f) { + var size = 0, i = 0; + if(f === 'dbcs') { + for(i = 0; i != val.length; ++i) __writeUInt16LE(this, val.charCodeAt(i), this.l + 2 * i); + size = 2 * val.length; + } else if(f === 'sbcs') { + /* TODO: codepage */ + val = val.replace(/[^\x00-\x7F]/g, "_"); + for(i = 0; i != val.length; ++i) this[this.l + i] = (val.charCodeAt(i) & 0xFF); + size = val.length; + } else if(f === 'hex') { + for(; i < t; ++i) { + this[this.l++] = (parseInt(val.slice(2*i, 2*i+2), 16)||0); + } return this; + } else if(f === 'utf16le') { + var end = Math.min(this.l + t, this.length); + for(i = 0; i < Math.min(val.length, t); ++i) { + var cc = val.charCodeAt(i); + this[this.l++] = (cc & 0xff); + this[this.l++] = (cc >> 8); + } + while(this.l < end) this[this.l++] = 0; + return this; + } else switch(t) { + case 1: size = 1; this[this.l] = val&0xFF; break; + case 2: size = 2; this[this.l] = val&0xFF; val >>>= 8; this[this.l+1] = val&0xFF; break; + case 3: size = 3; this[this.l] = val&0xFF; val >>>= 8; this[this.l+1] = val&0xFF; val >>>= 8; this[this.l+2] = val&0xFF; break; + case 4: size = 4; __writeUInt32LE(this, val, this.l); break; + case 8: size = 8; if(f === 'f') { write_double_le(this, val, this.l); break; } + /* falls through */ + case 16: break; + case -4: size = 4; __writeInt32LE(this, val, this.l); break; + } + this.l += size; return this; + } + + function CheckField(hexstr, fld) { + var m = __hexlify(this,this.l,hexstr.length>>1); + if(m !== hexstr) throw new Error(fld + 'Expected ' + hexstr + ' saw ' + m); + this.l += hexstr.length>>1; + } + + function prep_blob(blob, pos) { + blob.l = pos; + blob.read_shift = ReadShift; + blob.chk = CheckField; + blob.write_shift = WriteShift; + } + + function parsenoop(blob, length) { blob.l += length; } + + function new_buf(sz) { + var o = new_raw_buf(sz); + prep_blob(o, 0); + return o; + } + + /* [MS-XLSB] 2.1.4 Record */ + function recordhopper(data, cb, opts) { + if(!data) return; + var tmpbyte, cntbyte, length; + prep_blob(data, data.l || 0); + var L = data.length, RT = 0, tgt = 0; + while(data.l < L) { + RT = data.read_shift(1); + if(RT & 0x80) RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F)<<7); + var R = XLSBRecordEnum[RT] || XLSBRecordEnum[0xFFFF]; + tmpbyte = data.read_shift(1); + length = tmpbyte & 0x7F; + for(cntbyte = 1; cntbyte <4 && (tmpbyte & 0x80); ++cntbyte) length += ((tmpbyte = data.read_shift(1)) & 0x7F)<<(7*cntbyte); + tgt = data.l + length; + var d = (R.f||parsenoop)(data, length, opts); + data.l = tgt; + if(cb(d, R.n, RT)) return; + } + } + + /* control buffer usage for fixed-length buffers */ + function buf_array() { + var bufs = [], blksz = has_buf ? 256 : 2048; + var newblk = function ba_newblk(sz) { + var o = (new_buf(sz)); + prep_blob(o, 0); + return o; + }; + + var curbuf = newblk(blksz); + + var endbuf = function ba_endbuf() { + if(!curbuf) return; + if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; } + if(curbuf.length > 0) bufs.push(curbuf); + curbuf = null; + }; + + var next = function ba_next(sz) { + if(curbuf && (sz < (curbuf.length - curbuf.l))) return curbuf; + endbuf(); + return (curbuf = newblk(Math.max(sz+1, blksz))); + }; + + var end = function ba_end() { + endbuf(); + return __toBuffer([bufs]); + }; + + var push = function ba_push(buf) { endbuf(); curbuf = buf; if(curbuf.l == null) curbuf.l = curbuf.length; next(blksz); }; + + return ({ next:next, push:push, end:end, _bufs:bufs }); + } + + function write_record(ba, type, payload, length) { + var t = +XLSBRE[type], l; + if(isNaN(t)) return; // TODO: throw something here? + if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0; + l = 1 + (t >= 0x80 ? 1 : 0) + 1/* + length*/; + if(length >= 0x80) ++l; if(length >= 0x4000) ++l; if(length >= 0x200000) ++l; + var o = ba.next(l); + if(t <= 0x7F) o.write_shift(1, t); + else { + o.write_shift(1, (t & 0x7F) + 0x80); + o.write_shift(1, (t >> 7)); + } + for(var i = 0; i != 4; ++i) { + if(length >= 0x80) { o.write_shift(1, (length & 0x7F)+0x80); length >>= 7; } + else { o.write_shift(1, length); break; } + } + if(length > 0 && is_buf(payload)) ba.push(payload); + } + /* XLS ranges enforced */ + function shift_cell_xls(cell, tgt, opts) { + var out = dup(cell); + if(tgt.s) { + if(out.cRel) out.c += tgt.s.c; + if(out.rRel) out.r += tgt.s.r; + } else { + if(out.cRel) out.c += tgt.c; + if(out.rRel) out.r += tgt.r; + } + if(!opts || opts.biff < 12) { + while(out.c >= 0x100) out.c -= 0x100; + while(out.r >= 0x10000) out.r -= 0x10000; + } + return out; + } + + function shift_range_xls(cell, range, opts) { + var out = dup(cell); + out.s = shift_cell_xls(out.s, range.s, opts); + out.e = shift_cell_xls(out.e, range.s, opts); + return out; + } + + function encode_cell_xls(c, biff) { + if(c.cRel && c.c < 0) { c = dup(c); c.c += (biff > 8) ? 0x4000 : 0x100; } + if(c.rRel && c.r < 0) { c = dup(c); c.r += (biff > 8) ? 0x100000 : ((biff > 5) ? 0x10000 : 0x4000); } + var s = encode_cell(c); + if(c.cRel === 0) s = fix_col(s); + if(c.rRel === 0) s = fix_row(s); + return s; + } + + function encode_range_xls(r, opts) { + if(r.s.r == 0 && !r.s.rRel) { + if(r.e.r == (opts.biff >= 12 ? 0xFFFFF : (opts.biff >= 8 ? 0x10000 : 0x4000)) && !r.e.rRel) { + return (r.s.cRel ? "" : "$") + encode_col(r.s.c) + ":" + (r.e.cRel ? "" : "$") + encode_col(r.e.c); + } + } + if(r.s.c == 0 && !r.s.cRel) { + if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) { + return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r); + } + } + return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff); + } + var OFFCRYPTO = {}; + + var make_offcrypto = function(O, _crypto) { + var crypto; + if(typeof _crypto !== 'undefined') crypto = _crypto; + else if(typeof require !== 'undefined') { + try { crypto = undefined; } + catch(e) { crypto = null; } + } + + O.rc4 = function(key, data) { + var S = new Array(256); + var c = 0, i = 0, j = 0, t = 0; + for(i = 0; i != 256; ++i) S[i] = i; + for(i = 0; i != 256; ++i) { + j = (j + S[i] + (key[i%key.length]).charCodeAt(0))&255; + t = S[i]; S[i] = S[j]; S[j] = t; + } + // $FlowIgnore + i = j = 0; var out = Buffer(data.length); + for(c = 0; c != data.length; ++c) { + i = (i + 1)&255; + j = (j + S[i])%256; + t = S[i]; S[i] = S[j]; S[j] = t; + out[c] = (data[c] ^ S[(S[i]+S[j])&255]); + } + return out; + }; + + O.md5 = function(hex) { + if(!crypto) throw new Error("Unsupported crypto"); + return crypto.createHash('md5').update(hex).digest('hex'); + }; + }; + /*global crypto:true */ + make_offcrypto(OFFCRYPTO, typeof crypto !== "undefined" ? crypto : undefined); + + function decode_row(rowstr) { return parseInt(unfix_row(rowstr),10) - 1; } + function encode_row(row) { return "" + (row + 1); } + function fix_row(cstr) { return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2"); } + function unfix_row(cstr) { return cstr.replace(/\$(\d+)$/,"$1"); } + + function decode_col(colstr) { var c = unfix_col(colstr), d = 0, i = 0; for(; i !== c.length; ++i) d = 26*d + c.charCodeAt(i) - 64; return d - 1; } + function encode_col(col) { var s=""; for(++col; col; col=Math.floor((col-1)/26)) s = String.fromCharCode(((col-1)%26) + 65) + s; return s; } + function fix_col(cstr) { return cstr.replace(/^([A-Z])/,"$$$1"); } + function unfix_col(cstr) { return cstr.replace(/^\$([A-Z])/,"$1"); } + + function split_cell(cstr) { return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(","); } + function decode_cell(cstr) { var splt = split_cell(cstr); return { c:decode_col(splt[0]), r:decode_row(splt[1]) }; } + function encode_cell(cell) { return encode_col(cell.c) + encode_row(cell.r); } + function decode_range(range) { var x =range.split(":").map(decode_cell); return {s:x[0],e:x[x.length-1]}; } + function encode_range(cs,ce) { + if(typeof ce === 'undefined' || typeof ce === 'number') { + return encode_range(cs.s, cs.e); + } + if(typeof cs !== 'string') cs = encode_cell((cs)); + if(typeof ce !== 'string') ce = encode_cell((ce)); + return cs == ce ? cs : cs + ":" + ce; + } + + function safe_decode_range(range) { + var o = {s:{c:0,r:0},e:{c:0,r:0}}; + var idx = 0, i = 0, cc = 0; + var len = range.length; + for(idx = 0; i < len; ++i) { + if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break; + idx = 26*idx + cc; + } + o.s.c = --idx; + + for(idx = 0; i < len; ++i) { + if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break; + idx = 10*idx + cc; + } + o.s.r = --idx; + + if(i === len || range.charCodeAt(++i) === 58) { o.e.c=o.s.c; o.e.r=o.s.r; return o; } + + for(idx = 0; i != len; ++i) { + if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break; + idx = 26*idx + cc; + } + o.e.c = --idx; + + for(idx = 0; i != len; ++i) { + if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break; + idx = 10*idx + cc; + } + o.e.r = --idx; + return o; + } + + function safe_format_cell(cell, v) { + var q = (cell.t == 'd' && v instanceof Date); + if(cell.z != null) try { return (cell.w = SSF.format(cell.z, q ? datenum(v) : v)); } catch(e) { } + try { return (cell.w = SSF.format((cell.XF||{}).numFmtId||(q ? 14 : 0), q ? datenum(v) : v)); } catch(e) { return ''+v; } + } + + function format_cell(cell, v, o) { + if(cell == null || cell.t == null || cell.t == 'z') return ""; + if(cell.w !== undefined) return cell.w; + if(cell.t == 'd' && !cell.z && o && o.dateNF) cell.z = o.dateNF; + if(v == undefined) return safe_format_cell(cell, cell.v); + return safe_format_cell(cell, v); + } + + function sheet_to_workbook(sheet, opts) { + var n = opts && opts.sheet ? opts.sheet : "Sheet1"; + var sheets = {}; sheets[n] = sheet; + return { SheetNames: [n], Sheets: sheets }; + } + + function sheet_add_aoa(_ws, data, opts) { + var o = opts || {}; + var dense = _ws ? Array.isArray(_ws) : o.dense; + if(DENSE != null && dense == null) dense = DENSE; + var ws = _ws || (dense ? ([]) : ({})); + var _R = 0, _C = 0; + if(ws && o.origin != null) { + if(typeof o.origin == 'number') _R = o.origin; + else { + var _origin = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; + _R = _origin.r; _C = _origin.c; + } + } + var range = ({s: {c:10000000, r:10000000}, e: {c:0, r:0}}); + if(ws['!ref']) { + var _range = safe_decode_range(ws['!ref']); + range.s.c = _range.s.c; + range.s.r = _range.s.r; + range.e.c = Math.max(range.e.c, _range.e.c); + range.e.r = Math.max(range.e.r, _range.e.r); + if(_R == -1) range.e.r = _R = _range.e.r + 1; + } + for(var R = 0; R != data.length; ++R) { + if(!data[R]) continue; + if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays"); + for(var C = 0; C != data[R].length; ++C) { + if(typeof data[R][C] === 'undefined') continue; + var cell = ({v: data[R][C] }); + var __R = _R + R, __C = _C + C; + if(range.s.r > __R) range.s.r = __R; + if(range.s.c > __C) range.s.c = __C; + if(range.e.r < __R) range.e.r = __R; + if(range.e.c < __C) range.e.c = __C; + if(data[R][C] && typeof data[R][C] === 'object' && !Array.isArray(data[R][C]) && !(data[R][C] instanceof Date)) cell = data[R][C]; + else { + if(Array.isArray(cell.v)) { cell.f = data[R][C][1]; cell.v = cell.v[0]; } + if(cell.v === null) { if(cell.f) cell.t = 'n'; else if(!o.sheetStubs) continue; else cell.t = 'z'; } + else if(typeof cell.v === 'number') cell.t = 'n'; + else if(typeof cell.v === 'boolean') cell.t = 'b'; + else if(cell.v instanceof Date) { + cell.z = o.dateNF || SSF._table[14]; + if(o.cellDates) { cell.t = 'd'; cell.w = SSF.format(cell.z, datenum(cell.v)); } + else { cell.t = 'n'; cell.v = datenum(cell.v); cell.w = SSF.format(cell.z, cell.v); } + } + else cell.t = 's'; + } + if(dense) { + if(!ws[__R]) ws[__R] = []; + ws[__R][__C] = cell; + } else { + var cell_ref = encode_cell(({c:__C,r:__R})); + ws[cell_ref] = cell; + } + } + } + if(range.s.c < 10000000) ws['!ref'] = encode_range(range); + return ws; + } + function aoa_to_sheet(data, opts) { return sheet_add_aoa(null, data, opts); } + + function write_UInt32LE(x, o) { + if(!o) o = new_buf(4); + o.write_shift(4, x); + return o; + } + + /* [MS-XLSB] 2.5.168 */ + function parse_XLWideString(data) { + var cchCharacters = data.read_shift(4); + return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, 'dbcs'); + } + function write_XLWideString(data, o) { + var _null = false; if(o == null) { _null = true; o = new_buf(4+2*data.length); } + o.write_shift(4, data.length); + if(data.length > 0) o.write_shift(0, data, 'dbcs'); + return _null ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.5.143 */ + function parse_StrRun(data) { + return { ich: data.read_shift(2), ifnt: data.read_shift(2) }; + } + function write_StrRun(run, o) { + if(!o) o = new_buf(4); + o.write_shift(2, run.ich || 0); + o.write_shift(2, run.ifnt || 0); + return o; + } + + /* [MS-XLSB] 2.5.121 */ + function parse_RichStr(data, length) { + var start = data.l; + var flags = data.read_shift(1); + var str = parse_XLWideString(data); + var rgsStrRun = []; + var z = ({ t: str, h: str }); + if((flags & 1) !== 0) { /* fRichStr */ + /* TODO: formatted string */ + var dwSizeStrRun = data.read_shift(4); + for(var i = 0; i != dwSizeStrRun; ++i) rgsStrRun.push(parse_StrRun(data)); + z.r = rgsStrRun; + } + else z.r = [{ich:0, ifnt:0}]; + //if((flags & 2) !== 0) { /* fExtStr */ + // /* TODO: phonetic string */ + //} + data.l = start + length; + return z; + } + function write_RichStr(str, o) { + /* TODO: formatted string */ + var _null = false; if(o == null) { _null = true; o = new_buf(15+4*str.t.length); } + o.write_shift(1,0); + write_XLWideString(str.t, o); + return _null ? o.slice(0, o.l) : o; + } + /* [MS-XLSB] 2.4.328 BrtCommentText (RichStr w/1 run) */ + var parse_BrtCommentText = parse_RichStr; + function write_BrtCommentText(str, o) { + /* TODO: formatted string */ + var _null = false; if(o == null) { _null = true; o = new_buf(23+4*str.t.length); } + o.write_shift(1,1); + write_XLWideString(str.t, o); + o.write_shift(4,1); + write_StrRun({ich:0,ifnt:0}, o); + return _null ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.5.9 */ + function parse_XLSBCell(data) { + var col = data.read_shift(4); + var iStyleRef = data.read_shift(2); + iStyleRef += data.read_shift(1) <<16; + data.l++; //var fPhShow = data.read_shift(1); + return { c:col, iStyleRef: iStyleRef }; + } + function write_XLSBCell(cell, o) { + if(o == null) o = new_buf(8); + o.write_shift(-4, cell.c); + o.write_shift(3, cell.iStyleRef || cell.s); + o.write_shift(1, 0); /* fPhShow */ + return o; + } + + + /* [MS-XLSB] 2.5.21 */ + var parse_XLSBCodeName = parse_XLWideString; + var write_XLSBCodeName = write_XLWideString; + + /* [MS-XLSB] 2.5.166 */ + function parse_XLNullableWideString(data) { + var cchCharacters = data.read_shift(4); + return cchCharacters === 0 || cchCharacters === 0xFFFFFFFF ? "" : data.read_shift(cchCharacters, 'dbcs'); + } + function write_XLNullableWideString(data, o) { + var _null = false; if(o == null) { _null = true; o = new_buf(127); } + o.write_shift(4, data.length > 0 ? data.length : 0xFFFFFFFF); + if(data.length > 0) o.write_shift(0, data, 'dbcs'); + return _null ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.5.165 */ + var parse_XLNameWideString = parse_XLWideString; +//var write_XLNameWideString = write_XLWideString; + + /* [MS-XLSB] 2.5.114 */ + var parse_RelID = parse_XLNullableWideString; + var write_RelID = write_XLNullableWideString; + + + /* [MS-XLS] 2.5.217 ; [MS-XLSB] 2.5.122 */ + function parse_RkNumber(data) { + var b = data.slice(data.l, data.l+4); + var fX100 = (b[0] & 1), fInt = (b[0] & 2); + data.l+=4; + b[0] &= 0xFC; // b[0] &= ~3; + var RK = fInt === 0 ? __double([0,0,0,0,b[0],b[1],b[2],b[3]],0) : __readInt32LE(b,0)>>2; + return fX100 ? (RK/100) : RK; + } + function write_RkNumber(data, o) { + if(o == null) o = new_buf(4); + var fX100 = 0, fInt = 0, d100 = data * 100; + if((data == (data | 0)) && (data >= -(1<<29)) && (data < (1 << 29))) { fInt = 1; } + else if((d100 == (d100 | 0)) && (d100 >= -(1<<29)) && (d100 < (1 << 29))) { fInt = 1; fX100 = 1; } + if(fInt) o.write_shift(-4, ((fX100 ? d100 : data) << 2) + (fX100 + 2)); + else throw new Error("unsupported RkNumber " + data); // TODO + } + + + /* [MS-XLSB] 2.5.117 RfX */ + function parse_RfX(data ) { + var cell = ({s: {}, e: {}}); + cell.s.r = data.read_shift(4); + cell.e.r = data.read_shift(4); + cell.s.c = data.read_shift(4); + cell.e.c = data.read_shift(4); + return cell; + } + function write_RfX(r, o) { + if(!o) o = new_buf(16); + o.write_shift(4, r.s.r); + o.write_shift(4, r.e.r); + o.write_shift(4, r.s.c); + o.write_shift(4, r.e.c); + return o; + } + + /* [MS-XLSB] 2.5.153 UncheckedRfX */ + var parse_UncheckedRfX = parse_RfX; + var write_UncheckedRfX = write_RfX; + + /* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */ + /* TODO: error checking, NaN and Infinity values are not valid Xnum */ + function parse_Xnum(data) { return data.read_shift(8, 'f'); } + function write_Xnum(data, o) { return (o || new_buf(8)).write_shift(8, data, 'f'); } + + /* [MS-XLSB] 2.5.97.2 */ + var BErr = { + 0x00: "#NULL!", + 0x07: "#DIV/0!", + 0x0F: "#VALUE!", + 0x17: "#REF!", + 0x1D: "#NAME?", + 0x24: "#NUM!", + 0x2A: "#N/A", + 0x2B: "#GETTING_DATA", + 0xFF: "#WTF?" + }; + var RBErr = evert_num(BErr); + + /* [MS-XLSB] 2.4.324 BrtColor */ + function parse_BrtColor(data) { + var out = {}; + var d = data.read_shift(1); + + //var fValidRGB = d & 1; + var xColorType = d >>> 1; + + var index = data.read_shift(1); + var nTS = data.read_shift(2, 'i'); + var bR = data.read_shift(1); + var bG = data.read_shift(1); + var bB = data.read_shift(1); + data.l++; //var bAlpha = data.read_shift(1); + + switch(xColorType) { + case 0: out.auto = 1; break; + case 1: + out.index = index; + var icv = XLSIcv[index]; + /* automatic pseudo index 81 */ + if(icv) out.rgb = rgb2Hex(icv); + break; + case 2: + /* if(!fValidRGB) throw new Error("invalid"); */ + out.rgb = rgb2Hex([bR, bG, bB]); + break; + case 3: out.theme = index; break; + } + if(nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768; + + return out; + } + function write_BrtColor(color, o) { + if(!o) o = new_buf(8); + if(!color||color.auto) { o.write_shift(4, 0); o.write_shift(4, 0); return o; } + if(color.index) { + o.write_shift(1, 0x02); + o.write_shift(1, color.index); + } else if(color.theme) { + o.write_shift(1, 0x06); + o.write_shift(1, color.theme); + } else { + o.write_shift(1, 0x05); + o.write_shift(1, 0); + } + var nTS = color.tint || 0; + if(nTS > 0) nTS *= 32767; + else if(nTS < 0) nTS *= 32768; + o.write_shift(2, nTS); + if(!color.rgb) { + o.write_shift(2, 0); + o.write_shift(1, 0); + o.write_shift(1, 0); + } else { + var rgb = (color.rgb || 'FFFFFF'); + o.write_shift(1, parseInt(rgb.slice(0,2),16)); + o.write_shift(1, parseInt(rgb.slice(2,4),16)); + o.write_shift(1, parseInt(rgb.slice(4,6),16)); + o.write_shift(1, 0xFF); + } + return o; + } + + /* [MS-XLSB] 2.5.52 */ + function parse_FontFlags(data) { + var d = data.read_shift(1); + data.l++; + var out = { + /* fBold: d & 0x01 */ + fItalic: d & 0x02, + /* fUnderline: d & 0x04 */ + fStrikeout: d & 0x08, + fOutline: d & 0x10, + fShadow: d & 0x20, + fCondense: d & 0x40, + fExtend: d & 0x80 + }; + return out; + } + function write_FontFlags(font, o) { + if(!o) o = new_buf(2); + var grbit = + (font.italic ? 0x02 : 0) | + (font.strike ? 0x08 : 0) | + (font.outline ? 0x10 : 0) | + (font.shadow ? 0x20 : 0) | + (font.condense ? 0x40 : 0) | + (font.extend ? 0x80 : 0); + o.write_shift(1, grbit); + o.write_shift(1, 0); + return o; + } + + /* [MS-OLEDS] 2.3.1 and 2.3.2 */ + function parse_ClipboardFormatOrString(o, w) { + // $FlowIgnore + var ClipFmt = {2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"}; + var m = o.read_shift(4); + switch(m) { + case 0x00000000: return ""; + case 0xffffffff: case 0xfffffffe: return ClipFmt[o.read_shift(4)]||""; + } + if(m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16)); + o.l -= 4; + return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr"); + } + function parse_ClipboardFormatOrAnsiString(o) { return parse_ClipboardFormatOrString(o, 1); } + function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatOrString(o, 2); } + + /* [MS-OLEPS] 2.2 PropertyType */ +//var VT_EMPTY = 0x0000; +//var VT_NULL = 0x0001; + var VT_I2 = 0x0002; + var VT_I4 = 0x0003; +//var VT_R4 = 0x0004; +//var VT_R8 = 0x0005; +//var VT_CY = 0x0006; +//var VT_DATE = 0x0007; +//var VT_BSTR = 0x0008; +//var VT_ERROR = 0x000A; + var VT_BOOL = 0x000B; + var VT_VARIANT = 0x000C; +//var VT_DECIMAL = 0x000E; +//var VT_I1 = 0x0010; +//var VT_UI1 = 0x0011; +//var VT_UI2 = 0x0012; + var VT_UI4 = 0x0013; +//var VT_I8 = 0x0014; +//var VT_UI8 = 0x0015; +//var VT_INT = 0x0016; +//var VT_UINT = 0x0017; + var VT_LPSTR = 0x001E; +//var VT_LPWSTR = 0x001F; + var VT_FILETIME = 0x0040; + var VT_BLOB = 0x0041; +//var VT_STREAM = 0x0042; +//var VT_STORAGE = 0x0043; +//var VT_STREAMED_Object = 0x0044; +//var VT_STORED_Object = 0x0045; +//var VT_BLOB_Object = 0x0046; + var VT_CF = 0x0047; +//var VT_CLSID = 0x0048; +//var VT_VERSIONED_STREAM = 0x0049; + var VT_VECTOR = 0x1000; +//var VT_ARRAY = 0x2000; + + var VT_STRING = 0x0050; // 2.3.3.1.11 VtString + var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString + var VT_CUSTOM = [VT_STRING, VT_USTR]; + + /* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */ + var DocSummaryPIDDSI = { + 0x01: { n: 'CodePage', t: VT_I2 }, + 0x02: { n: 'Category', t: VT_STRING }, + 0x03: { n: 'PresentationFormat', t: VT_STRING }, + 0x04: { n: 'ByteCount', t: VT_I4 }, + 0x05: { n: 'LineCount', t: VT_I4 }, + 0x06: { n: 'ParagraphCount', t: VT_I4 }, + 0x07: { n: 'SlideCount', t: VT_I4 }, + 0x08: { n: 'NoteCount', t: VT_I4 }, + 0x09: { n: 'HiddenCount', t: VT_I4 }, + 0x0a: { n: 'MultimediaClipCount', t: VT_I4 }, + 0x0b: { n: 'ScaleCrop', t: VT_BOOL }, + 0x0c: { n: 'HeadingPairs', t: VT_VECTOR | VT_VARIANT }, + 0x0d: { n: 'TitlesOfParts', t: VT_VECTOR | VT_LPSTR }, + 0x0e: { n: 'Manager', t: VT_STRING }, + 0x0f: { n: 'Company', t: VT_STRING }, + 0x10: { n: 'LinksUpToDate', t: VT_BOOL }, + 0x11: { n: 'CharacterCount', t: VT_I4 }, + 0x13: { n: 'SharedDoc', t: VT_BOOL }, + 0x16: { n: 'HyperlinksChanged', t: VT_BOOL }, + 0x17: { n: 'AppVersion', t: VT_I4, p: 'version' }, + 0x18: { n: 'DigSig', t: VT_BLOB }, + 0x1A: { n: 'ContentType', t: VT_STRING }, + 0x1B: { n: 'ContentStatus', t: VT_STRING }, + 0x1C: { n: 'Language', t: VT_STRING }, + 0x1D: { n: 'Version', t: VT_STRING }, + 0xFF: {} + }; + + /* [MS-OSHARED] 2.3.3.2.1.1 Summary Information Property Set PIDSI */ + var SummaryPIDSI = { + 0x01: { n: 'CodePage', t: VT_I2 }, + 0x02: { n: 'Title', t: VT_STRING }, + 0x03: { n: 'Subject', t: VT_STRING }, + 0x04: { n: 'Author', t: VT_STRING }, + 0x05: { n: 'Keywords', t: VT_STRING }, + 0x06: { n: 'Comments', t: VT_STRING }, + 0x07: { n: 'Template', t: VT_STRING }, + 0x08: { n: 'LastAuthor', t: VT_STRING }, + 0x09: { n: 'RevNumber', t: VT_STRING }, + 0x0A: { n: 'EditTime', t: VT_FILETIME }, + 0x0B: { n: 'LastPrinted', t: VT_FILETIME }, + 0x0C: { n: 'CreatedDate', t: VT_FILETIME }, + 0x0D: { n: 'ModifiedDate', t: VT_FILETIME }, + 0x0E: { n: 'PageCount', t: VT_I4 }, + 0x0F: { n: 'WordCount', t: VT_I4 }, + 0x10: { n: 'CharCount', t: VT_I4 }, + 0x11: { n: 'Thumbnail', t: VT_CF }, + 0x12: { n: 'Application', t: VT_STRING }, + 0x13: { n: 'DocSecurity', t: VT_I4 }, + 0xFF: {} + }; + + /* [MS-OLEPS] 2.18 */ + var SpecialProperties = { + 0x80000000: { n: 'Locale', t: VT_UI4 }, + 0x80000003: { n: 'Behavior', t: VT_UI4 }, + 0x72627262: {} + }; + + (function() { + for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y)) + DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y]; + })(); + + var DocSummaryRE = evert_key(DocSummaryPIDDSI, "n"); + var SummaryRE = evert_key(SummaryPIDSI, "n"); + + /* [MS-XLS] 2.4.63 Country/Region codes */ + var CountryEnum = { + 0x0001: "US", // United States + 0x0002: "CA", // Canada + 0x0003: "", // Latin America (except Brazil) + 0x0007: "RU", // Russia + 0x0014: "EG", // Egypt + 0x001E: "GR", // Greece + 0x001F: "NL", // Netherlands + 0x0020: "BE", // Belgium + 0x0021: "FR", // France + 0x0022: "ES", // Spain + 0x0024: "HU", // Hungary + 0x0027: "IT", // Italy + 0x0029: "CH", // Switzerland + 0x002B: "AT", // Austria + 0x002C: "GB", // United Kingdom + 0x002D: "DK", // Denmark + 0x002E: "SE", // Sweden + 0x002F: "NO", // Norway + 0x0030: "PL", // Poland + 0x0031: "DE", // Germany + 0x0034: "MX", // Mexico + 0x0037: "BR", // Brazil + 0x003d: "AU", // Australia + 0x0040: "NZ", // New Zealand + 0x0042: "TH", // Thailand + 0x0051: "JP", // Japan + 0x0052: "KR", // Korea + 0x0054: "VN", // Viet Nam + 0x0056: "CN", // China + 0x005A: "TR", // Turkey + 0x0069: "JS", // Ramastan + 0x00D5: "DZ", // Algeria + 0x00D8: "MA", // Morocco + 0x00DA: "LY", // Libya + 0x015F: "PT", // Portugal + 0x0162: "IS", // Iceland + 0x0166: "FI", // Finland + 0x01A4: "CZ", // Czech Republic + 0x0376: "TW", // Taiwan + 0x03C1: "LB", // Lebanon + 0x03C2: "JO", // Jordan + 0x03C3: "SY", // Syria + 0x03C4: "IQ", // Iraq + 0x03C5: "KW", // Kuwait + 0x03C6: "SA", // Saudi Arabia + 0x03CB: "AE", // United Arab Emirates + 0x03CC: "IL", // Israel + 0x03CE: "QA", // Qatar + 0x03D5: "IR", // Iran + 0xFFFF: "US" // United States + }; + + /* [MS-XLS] 2.5.127 */ + var XLSFillPattern = [ + null, + 'solid', + 'mediumGray', + 'darkGray', + 'lightGray', + 'darkHorizontal', + 'darkVertical', + 'darkDown', + 'darkUp', + 'darkGrid', + 'darkTrellis', + 'lightHorizontal', + 'lightVertical', + 'lightDown', + 'lightUp', + 'lightGrid', + 'lightTrellis', + 'gray125', + 'gray0625' + ]; + + function rgbify(arr) { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); } + + /* [MS-XLS] 2.5.161 */ + /* [MS-XLSB] 2.5.75 Icv */ + var XLSIcv = rgbify([ + /* Color Constants */ + 0x000000, + 0xFFFFFF, + 0xFF0000, + 0x00FF00, + 0x0000FF, + 0xFFFF00, + 0xFF00FF, + 0x00FFFF, + + /* Overridable Defaults */ + 0x000000, + 0xFFFFFF, + 0xFF0000, + 0x00FF00, + 0x0000FF, + 0xFFFF00, + 0xFF00FF, + 0x00FFFF, + + 0x800000, + 0x008000, + 0x000080, + 0x808000, + 0x800080, + 0x008080, + 0xC0C0C0, + 0x808080, + 0x9999FF, + 0x993366, + 0xFFFFCC, + 0xCCFFFF, + 0x660066, + 0xFF8080, + 0x0066CC, + 0xCCCCFF, + + 0x000080, + 0xFF00FF, + 0xFFFF00, + 0x00FFFF, + 0x800080, + 0x800000, + 0x008080, + 0x0000FF, + 0x00CCFF, + 0xCCFFFF, + 0xCCFFCC, + 0xFFFF99, + 0x99CCFF, + 0xFF99CC, + 0xCC99FF, + 0xFFCC99, + + 0x3366FF, + 0x33CCCC, + 0x99CC00, + 0xFFCC00, + 0xFF9900, + 0xFF6600, + 0x666699, + 0x969696, + 0x003366, + 0x339966, + 0x003300, + 0x333300, + 0x993300, + 0x993366, + 0x333399, + 0x333333, + + /* Other entries to appease BIFF8/12 */ + 0xFFFFFF, /* 0x40 icvForeground ?? */ + 0x000000, /* 0x41 icvBackground ?? */ + 0x000000, /* 0x42 icvFrame ?? */ + 0x000000, /* 0x43 icv3D ?? */ + 0x000000, /* 0x44 icv3DText ?? */ + 0x000000, /* 0x45 icv3DHilite ?? */ + 0x000000, /* 0x46 icv3DShadow ?? */ + 0x000000, /* 0x47 icvHilite ?? */ + 0x000000, /* 0x48 icvCtlText ?? */ + 0x000000, /* 0x49 icvCtlScrl ?? */ + 0x000000, /* 0x4A icvCtlInv ?? */ + 0x000000, /* 0x4B icvCtlBody ?? */ + 0x000000, /* 0x4C icvCtlFrame ?? */ + 0x000000, /* 0x4D icvCtlFore ?? */ + 0x000000, /* 0x4E icvCtlBack ?? */ + 0x000000, /* 0x4F icvCtlNeutral */ + 0x000000, /* 0x50 icvInfoBk ?? */ + 0x000000 /* 0x51 icvInfoText ?? */ + ]); + + /* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */ + /* 12.3 Part Summary */ + /* 14.2 Part Summary */ + /* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */ + var ct2type/*{[string]:string}*/ = ({ + /* Workbook */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks", + + /* Worksheet */ + "application/vnd.ms-excel.binIndexWs": "TODO", /* Binary Index */ + + /* Macrosheet */ + "application/vnd.ms-excel.intlmacrosheet": "TODO", + "application/vnd.ms-excel.binIndexMs": "TODO", /* Binary Index */ + + /* File Properties */ + "application/vnd.openxmlformats-package.core-properties+xml": "coreprops", + "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops", + "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops", + + /* Custom Data Properties */ + "application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO", + + /* PivotTable */ + "application/vnd.ms-excel.pivotTable": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO", + + /* Chart Colors */ + "application/vnd.ms-office.chartcolorstyle+xml": "TODO", + + /* Chart Style */ + "application/vnd.ms-office.chartstyle+xml": "TODO", + + /* Calculation Chain */ + "application/vnd.ms-excel.calcChain": "calcchains", + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains", + + /* Printer Settings */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings": "TODO", + + /* ActiveX */ + "application/vnd.ms-office.activeX": "TODO", + "application/vnd.ms-office.activeX+xml": "TODO", + + /* Custom Toolbars */ + "application/vnd.ms-excel.attachedToolbars": "TODO", + + /* External Data Connections */ + "application/vnd.ms-excel.connections": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": "TODO", + + /* External Links */ + "application/vnd.ms-excel.externalLink": "links", + "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links", + + /* Metadata */ + "application/vnd.ms-excel.sheetMetadata": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "TODO", + + /* PivotCache */ + "application/vnd.ms-excel.pivotCacheDefinition": "TODO", + "application/vnd.ms-excel.pivotCacheRecords": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml": "TODO", + + /* Query Table */ + "application/vnd.ms-excel.queryTable": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml": "TODO", + + /* Shared Workbook */ + "application/vnd.ms-excel.userNames": "TODO", + "application/vnd.ms-excel.revisionHeaders": "TODO", + "application/vnd.ms-excel.revisionLog": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml": "TODO", + + /* Single Cell Table */ + "application/vnd.ms-excel.tableSingleCells": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml": "TODO", + + /* Slicer */ + "application/vnd.ms-excel.slicer": "TODO", + "application/vnd.ms-excel.slicerCache": "TODO", + "application/vnd.ms-excel.slicer+xml": "TODO", + "application/vnd.ms-excel.slicerCache+xml": "TODO", + + /* Sort Map */ + "application/vnd.ms-excel.wsSortMap": "TODO", + + /* Table */ + "application/vnd.ms-excel.table": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": "TODO", + + /* Themes */ + "application/vnd.openxmlformats-officedocument.theme+xml": "themes", + + /* Theme Override */ + "application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO", + + /* Timeline */ + "application/vnd.ms-excel.Timeline+xml": "TODO", /* verify */ + "application/vnd.ms-excel.TimelineCache+xml": "TODO", /* verify */ + + /* VBA */ + "application/vnd.ms-office.vbaProject": "vba", + "application/vnd.ms-office.vbaProjectSignature": "vba", + + /* Volatile Dependencies */ + "application/vnd.ms-office.volatileDependencies": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml": "TODO", + + /* Control Properties */ + "application/vnd.ms-excel.controlproperties+xml": "TODO", + + /* Data Model */ + "application/vnd.openxmlformats-officedocument.model+data": "TODO", + + /* Survey */ + "application/vnd.ms-excel.Survey+xml": "TODO", + + /* Drawing */ + "application/vnd.openxmlformats-officedocument.drawing+xml": "drawings", + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml": "TODO", + + /* VML */ + "application/vnd.openxmlformats-officedocument.vmlDrawing": "TODO", + + "application/vnd.openxmlformats-package.relationships+xml": "rels", + "application/vnd.openxmlformats-officedocument.oleObject": "TODO", + + /* Image */ + "image/png": "TODO", + + "sheet": "js" + }); + + var CT_LIST = (function(){ + var o = { + workbooks: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", + xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml", + xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main", + xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml", + xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" + }, + strs: { /* Shared Strings */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", + xlsb: "application/vnd.ms-excel.sharedStrings" + }, + comments: { /* Comments */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", + xlsb: "application/vnd.ms-excel.comments" + }, + sheets: { /* Worksheet */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", + xlsb: "application/vnd.ms-excel.worksheet" + }, + charts: { /* Chartsheet */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", + xlsb: "application/vnd.ms-excel.chartsheet" + }, + dialogs: { /* Dialogsheet */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml", + xlsb: "application/vnd.ms-excel.dialogsheet" + }, + macros: { /* Macrosheet (Excel 4.0 Macros) */ + xlsx: "application/vnd.ms-excel.macrosheet+xml", + xlsb: "application/vnd.ms-excel.macrosheet" + }, + styles: { /* Styles */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", + xlsb: "application/vnd.ms-excel.styles" + } + }; + keys(o).forEach(function(k) { ["xlsm", "xlam"].forEach(function(v) { if(!o[k][v]) o[k][v] = o[k].xlsx; }); }); + keys(o).forEach(function(k){ keys(o[k]).forEach(function(v) { ct2type[o[k][v]] = k; }); }); + return o; + })(); + + var type2ct/*{[string]:Array}*/ = evert_arr(ct2type); + + XMLNS.CT = 'http://schemas.openxmlformats.org/package/2006/content-types'; + + function new_ct() { + return ({ + workbooks:[], sheets:[], charts:[], dialogs:[], macros:[], + rels:[], strs:[], comments:[], links:[], + coreprops:[], extprops:[], custprops:[], themes:[], styles:[], + calcchains:[], vba: [], drawings: [], + TODO:[], xmlns: "" }); + } + + function parse_ct(data) { + var ct = new_ct(); + if(!data || !data.match) return ct; + var ctext = {}; + (data.match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(y[0].replace(nsregex,"<")) { + case ' 0 ? ct.calcchains[0] : ""; + ct.sst = ct.strs.length > 0 ? ct.strs[0] : ""; + ct.style = ct.styles.length > 0 ? ct.styles[0] : ""; + ct.defaults = ctext; + delete ct.calcchains; + return ct; + } + + var CTYPE_XML_ROOT = writextag('Types', null, { + 'xmlns': XMLNS.CT, + 'xmlns:xsd': XMLNS.xsd, + 'xmlns:xsi': XMLNS.xsi + }); + + var CTYPE_DEFAULTS = [ + ['xml', 'application/xml'], + ['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'], + ['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'], + /* from test files */ + ['bmp', 'image/bmp'], + ['png', 'image/png'], + ['gif', 'image/gif'], + ['emf', 'image/x-emf'], + ['wmf', 'image/x-wmf'], + ['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'], + ['tif', 'image/tiff'], ['tiff', 'image/tiff'], + ['pdf', 'application/pdf'], + ['rels', type2ct.rels[0]] + ].map(function(x) { + return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]}); + }); + + function write_ct(ct, opts) { + var o = [], v; + o[o.length] = (XML_HEADER); + o[o.length] = (CTYPE_XML_ROOT); + o = o.concat(CTYPE_DEFAULTS); + var f1 = function(w) { + if(ct[w] && ct[w].length > 0) { + v = ct[w][0]; + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "":"/") + v, + 'ContentType': CT_LIST[w][opts.bookType || 'xlsx'] + })); + } + }; + var f2 = function(w) { + (ct[w]||[]).forEach(function(v) { + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "":"/") + v, + 'ContentType': CT_LIST[w][opts.bookType || 'xlsx'] + })); + }); + }; + var f3 = function(t) { + (ct[t]||[]).forEach(function(v) { + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "":"/") + v, + 'ContentType': type2ct[t][0] + })); + }); + }; + f1('workbooks'); + f2('sheets'); + f2('charts'); + f3('themes'); + ['strs', 'styles'].forEach(f1); + ['coreprops', 'extprops', 'custprops'].forEach(f3); + f3('vba'); + f3('comments'); + f3('drawings'); + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* 9.3 Relationships */ + var RELS = ({ + WB: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", + SHEET: "http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument", + HLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", + VML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", + VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject" + }); + + /* 9.3.3 Representing Relationships */ + function get_rels_path(file) { + var n = file.lastIndexOf("/"); + return file.slice(0,n+1) + '_rels/' + file.slice(n+1) + ".rels"; + } + + function parse_rels(data, currentFilePath) { + if (!data) return data; + if (currentFilePath.charAt(0) !== '/') { + currentFilePath = '/'+currentFilePath; + } + var rels = {}; + var hash = {}; + + (data.match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + /* 9.3.2.2 OPC_Relationships */ + if (y[0] === '2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + + function add_rels(rels, rId, f, type, relobj) { + if(!relobj) relobj = {}; + if(!rels['!id']) rels['!id'] = {}; + if(rId < 0) for(rId = 1; rels['!id']['rId' + rId]; ++rId){/* empty */} + relobj.Id = 'rId' + rId; + relobj.Type = type; + relobj.Target = f; + if(relobj.Type == RELS.HLINK) relobj.TargetMode = "External"; + if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId); + rels['!id'][relobj.Id] = relobj; + rels[('/' + relobj.Target).replace("//","/")] = relobj; + return rId; + } + /* Open Document Format for Office Applications (OpenDocument) Version 1.2 */ + /* Part 3 Section 4 Manifest File */ + var CT_ODS = "application/vnd.oasis.opendocument.spreadsheet"; + function parse_manifest(d, opts) { + var str = xlml_normalize(d); + var Rn; + var FEtag; + while((Rn = xlmlregex.exec(str))) switch(Rn[3]) { + case 'manifest': break; // 4.2 + case 'file-entry': // 4.3 + FEtag = parsexmltag(Rn[0], false); + if(FEtag.path == '/' && FEtag.type !== CT_ODS) throw new Error("This OpenDocument is not a spreadsheet"); + break; + case 'encryption-data': // 4.4 + case 'algorithm': // 4.5 + case 'start-key-generation': // 4.6 + case 'key-derivation': // 4.7 + throw new Error("Unsupported ODS Encryption"); + default: if(opts && opts.WTF) throw Rn; + } + } + + function write_manifest(manifest) { + var o = [XML_HEADER]; + o.push('\n'); + o.push(' \n'); + for(var i = 0; i < manifest.length; ++i) o.push(' \n'); + o.push(''); + return o.join(""); + } + + /* Part 3 Section 6 Metadata Manifest File */ + function write_rdf_type(file, res, tag) { + return [ + ' \n', + ' \n', + ' \n' + ].join(""); + } + function write_rdf_has(base, file) { + return [ + ' \n', + ' \n', + ' \n' + ].join(""); + } + function write_rdf(rdf) { + var o = [XML_HEADER]; + o.push('\n'); + for(var i = 0; i != rdf.length; ++i) { + o.push(write_rdf_type(rdf[i][0], rdf[i][1])); + o.push(write_rdf_has("",rdf[i][0])); + } + o.push(write_rdf_type("","Document", "pkg")); + o.push(''); + return o.join(""); + } + /* TODO: pull properties */ + var write_meta_ods = (function() { + var payload = 'Sheet' + 'JS ' + XLSX.version + ''; + return function wmo() { + return payload; + }; + })(); + + /* ECMA-376 Part II 11.1 Core Properties Part */ + /* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ + var CORE_PROPS = [ + ["cp:category", "Category"], + ["cp:contentStatus", "ContentStatus"], + ["cp:keywords", "Keywords"], + ["cp:lastModifiedBy", "LastAuthor"], + ["cp:lastPrinted", "LastPrinted"], + ["cp:revision", "RevNumber"], + ["cp:version", "Version"], + ["dc:creator", "Author"], + ["dc:description", "Comments"], + ["dc:identifier", "Identifier"], + ["dc:language", "Language"], + ["dc:subject", "Subject"], + ["dc:title", "Title"], + ["dcterms:created", "CreatedDate", 'date'], + ["dcterms:modified", "ModifiedDate", 'date'] + ]; + + XMLNS.CORE_PROPS = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"; + RELS.CORE_PROPS = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties'; + + var CORE_PROPS_REGEX = (function() { + var r = new Array(CORE_PROPS.length); + for(var i = 0; i < CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i]; + var g = "(?:"+ f[0].slice(0,f[0].indexOf(":")) +":)"+ f[0].slice(f[0].indexOf(":")+1); + r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)<\/" + g + ">"); + } + return r; + })(); + + function parse_core_props(data) { + var p = {}; + data = utf8read(data); + + for(var i = 0; i < CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]); + if(cur != null && cur.length > 0) p[f[1]] = cur[1]; + if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]); + } + + return p; + } + + var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, { + //'xmlns': XMLNS.CORE_PROPS, + 'xmlns:cp': XMLNS.CORE_PROPS, + 'xmlns:dc': XMLNS.dc, + 'xmlns:dcterms': XMLNS.dcterms, + 'xmlns:dcmitype': XMLNS.dcmitype, + 'xmlns:xsi': XMLNS.xsi + }); + + function cp_doit(f, g, h, o, p) { + if(p[f] != null || g == null || g === "") return; + p[f] = g; + o[o.length] = (h ? writextag(f,g,h) : writetag(f,g)); + } + + function write_core_props(cp, _opts) { + var opts = _opts || {}; + var o = [XML_HEADER, CORE_PROPS_XML_ROOT], p = {}; + if(!cp && !opts.Props) return o.join(""); + + if(cp) { + if(cp.CreatedDate != null) cp_doit("dcterms:created", typeof cp.CreatedDate === "string" ? cp.CreatedDate : write_w3cdtf(cp.CreatedDate, opts.WTF), {"xsi:type":"dcterms:W3CDTF"}, o, p); + if(cp.ModifiedDate != null) cp_doit("dcterms:modified", typeof cp.ModifiedDate === "string" ? cp.ModifiedDate : write_w3cdtf(cp.ModifiedDate, opts.WTF), {"xsi:type":"dcterms:W3CDTF"}, o, p); + } + + for(var i = 0; i != CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i]; + var v = opts.Props && opts.Props[f[1]] != null ? opts.Props[f[1]] : cp ? cp[f[1]] : null; + if(v === true) v = "1"; + else if(v === false) v = "0"; + else if(typeof v == "number") v = String(v); + if(v != null) cp_doit(f[0], v, null, o, p); + } + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* 15.2.12.3 Extended File Properties Part */ + /* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ + var EXT_PROPS = [ + ["Application", "Application", "string"], + ["AppVersion", "AppVersion", "string"], + ["Company", "Company", "string"], + ["DocSecurity", "DocSecurity", "string"], + ["Manager", "Manager", "string"], + ["HyperlinksChanged", "HyperlinksChanged", "bool"], + ["SharedDoc", "SharedDoc", "bool"], + ["LinksUpToDate", "LinksUpToDate", "bool"], + ["ScaleCrop", "ScaleCrop", "bool"], + ["HeadingPairs", "HeadingPairs", "raw"], + ["TitlesOfParts", "TitlesOfParts", "raw"] + ]; + + XMLNS.EXT_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"; + RELS.EXT_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'; + + var PseudoPropsPairs = [ + "Worksheets", "SheetNames", + "NamedRanges", "DefinedNames", + "Chartsheets", "ChartNames" + ]; + function load_props_pairs(HP, TOP, props, opts) { + var v = []; + if(typeof HP == "string") v = parseVector(HP, opts); + else for(var j = 0; j < HP.length; ++j) v = v.concat(HP[j].map(function(hp) { return {v:hp}; })); + var parts = (typeof TOP == "string") ? parseVector(TOP, opts).map(function (x) { return x.v; }) : TOP; + var idx = 0, len = 0; + if(parts.length > 0) for(var i = 0; i !== v.length; i += 2) { + len = +(v[i+1].v); + switch(v[i].v) { + case "Worksheets": + case "工作表": + case "Листы": + case "أوراق العمل": + case "ワークシート": + case "גליונות עבודה": + case "Arbeitsblätter": + case "Çalışma Sayfaları": + case "Feuilles de calcul": + case "Fogli di lavoro": + case "Folhas de cálculo": + case "Planilhas": + case "Regneark": + case "Werkbladen": + props.Worksheets = len; + props.SheetNames = parts.slice(idx, idx + len); + break; + + case "Named Ranges": + case "名前付き一覧": + case "Benannte Bereiche": + case "Navngivne områder": + props.NamedRanges = len; + props.DefinedNames = parts.slice(idx, idx + len); + break; + + case "Charts": + case "Diagramme": + props.Chartsheets = len; + props.ChartNames = parts.slice(idx, idx + len); + break; + } + idx += len; + } + } + + function parse_ext_props(data, p, opts) { + var q = {}; if(!p) p = {}; + data = utf8read(data); + + EXT_PROPS.forEach(function(f) { + switch(f[2]) { + case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break; + case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break; + case "raw": + var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">")); + if(cur && cur.length > 0) q[f[1]] = cur[1]; + break; + } + }); + + if(q.HeadingPairs && q.TitlesOfParts) load_props_pairs(q.HeadingPairs, q.TitlesOfParts, p, opts); + + return p; + } + + var EXT_PROPS_XML_ROOT = writextag('Properties', null, { + 'xmlns': XMLNS.EXT_PROPS, + 'xmlns:vt': XMLNS.vt + }); + + function write_ext_props(cp) { + var o = [], W = writextag; + if(!cp) cp = {}; + cp.Application = "SheetJS"; + o[o.length] = (XML_HEADER); + o[o.length] = (EXT_PROPS_XML_ROOT); + + EXT_PROPS.forEach(function(f) { + if(cp[f[1]] === undefined) return; + var v; + switch(f[2]) { + case 'string': v = String(cp[f[1]]); break; + case 'bool': v = cp[f[1]] ? 'true' : 'false'; break; + } + if(v !== undefined) o[o.length] = (W(f[0], v)); + }); + + /* TODO: HeadingPairs, TitlesOfParts */ + o[o.length] = (W('HeadingPairs', W('vt:vector', W('vt:variant', 'Worksheets')+W('vt:variant', W('vt:i4', String(cp.Worksheets))), {size:2, baseType:"variant"}))); + o[o.length] = (W('TitlesOfParts', W('vt:vector', cp.SheetNames.map(function(s) { return "" + escapexml(s) + ""; }).join(""), {size: cp.Worksheets, baseType:"lpstr"}))); + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* 15.2.12.2 Custom File Properties Part */ + XMLNS.CUST_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"; + RELS.CUST_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties'; + + var custregex = /<[^>]+>[^<]*/g; + function parse_cust_props(data, opts) { + var p = {}, name = ""; + var m = data.match(custregex); + if(m) for(var i = 0; i != m.length; ++i) { + var x = m[i], y = parsexmltag(x); + switch(y[0]) { + case '': name = null; break; + default: if (x.indexOf(''); + var type = toks[0].slice(4), text = toks[1]; + /* 22.4.2.32 (CT_Variant). Omit the binary types from 22.4 (Variant Types) */ + switch(type) { + case 'lpstr': case 'bstr': case 'lpwstr': + p[name] = unescapexml(text); + break; + case 'bool': + p[name] = parsexmlbool(text); + break; + case 'i1': case 'i2': case 'i4': case 'i8': case 'int': case 'uint': + p[name] = parseInt(text, 10); + break; + case 'r4': case 'r8': case 'decimal': + p[name] = parseFloat(text); + break; + case 'filetime': case 'date': + p[name] = parseDate(text); + break; + case 'cy': case 'error': + p[name] = unescapexml(text); + break; + default: + if(type.slice(-1) == '/') break; + if(opts.WTF && typeof console !== 'undefined') console.warn('Unexpected', x, type, toks); + } + } else if(x.slice(0,2) === "2){ o[o.length] = ''; o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* Common Name -> XLML Name */ + var XLMLDocPropsMap = { + Title: 'Title', + Subject: 'Subject', + Author: 'Author', + Keywords: 'Keywords', + Comments: 'Description', + LastAuthor: 'LastAuthor', + RevNumber: 'Revision', + Application: 'AppName', + /* TotalTime: 'TotalTime', */ + LastPrinted: 'LastPrinted', + CreatedDate: 'Created', + ModifiedDate: 'LastSaved', + /* Pages */ + /* Words */ + /* Characters */ + Category: 'Category', + /* PresentationFormat */ + Manager: 'Manager', + Company: 'Company', + /* Guid */ + /* HyperlinkBase */ + /* Bytes */ + /* Lines */ + /* Paragraphs */ + /* CharactersWithSpaces */ + AppVersion: 'Version', + + ContentStatus: 'ContentStatus', /* NOTE: missing from schema */ + Identifier: 'Identifier', /* NOTE: missing from schema */ + Language: 'Language' /* NOTE: missing from schema */ + }; + var evert_XLMLDPM = evert(XLMLDocPropsMap); + + function xlml_set_prop(Props, tag, val) { + tag = evert_XLMLDPM[tag] || tag; + Props[tag] = val; + } + + function xlml_write_docprops(Props, opts) { + var o = []; + keys(XLMLDocPropsMap).map(function(m) { + for(var i = 0; i < CORE_PROPS.length; ++i) if(CORE_PROPS[i][1] == m) return CORE_PROPS[i]; + for(i = 0; i < EXT_PROPS.length; ++i) if(EXT_PROPS[i][1] == m) return EXT_PROPS[i]; + throw m; + }).forEach(function(p) { + if(Props[p[1]] == null) return; + var m = opts && opts.Props && opts.Props[p[1]] != null ? opts.Props[p[1]] : Props[p[1]]; + switch(p[2]) { + case 'date': m = new Date(m).toISOString().replace(/\.\d*Z/,"Z"); break; + } + if(typeof m == 'number') m = String(m); + else if(m === true || m === false) { m = m ? "1" : "0"; } + else if(m instanceof Date) m = new Date(m).toISOString().replace(/\.\d*Z/,""); + o.push(writetag(XLMLDocPropsMap[p[1]] || p[1], m)); + }); + return writextag('DocumentProperties', o.join(""), {xmlns:XLMLNS.o }); + } + function xlml_write_custprops(Props, Custprops) { + var BLACKLIST = ["Worksheets","SheetNames"]; + var T = 'CustomDocumentProperties'; + var o = []; + if(Props) keys(Props).forEach(function(k) { + if(!Props.hasOwnProperty(k)) return; + for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return; + for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return; + for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return; + + var m = Props[k]; + var t = "string"; + if(typeof m == 'number') { t = "float"; m = String(m); } + else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; } + else m = String(m); + o.push(writextag(escapexmltag(k), m, {"dt:dt":t})); + }); + if(Custprops) keys(Custprops).forEach(function(k) { + if(!Custprops.hasOwnProperty(k)) return; + if(Props && Props.hasOwnProperty(k)) return; + var m = Custprops[k]; + var t = "string"; + if(typeof m == 'number') { t = "float"; m = String(m); } + else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; } + else if(m instanceof Date) { t = "dateTime.tz"; m = m.toISOString(); } + else m = String(m); + o.push(writextag(escapexmltag(k), m, {"dt:dt":t})); + }); + return '<' + T + ' xmlns="' + XLMLNS.o + '">' + o.join("") + ''; + } + /* [MS-DTYP] 2.3.3 FILETIME */ + /* [MS-OLEDS] 2.1.3 FILETIME (Packet Version) */ + /* [MS-OLEPS] 2.8 FILETIME (Packet Version) */ + function parse_FILETIME(blob) { + var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4); + return new Date(((dwHighDateTime/1e7*Math.pow(2,32) + dwLowDateTime/1e7) - 11644473600)*1000).toISOString().replace(/\.000/,""); + } + function write_FILETIME(time) { + var date = (typeof time == "string") ? new Date(Date.parse(time)) : time; + var t = date.getTime() / 1000 + 11644473600; + var l = t % Math.pow(2,32), h = (t - l) / Math.pow(2,32); + l *= 1e7; h *= 1e7; + var w = (l / Math.pow(2,32)) | 0; + if(w > 0) { l = l % Math.pow(2,32); h += w; } + var o = new_buf(8); o.write_shift(4, l); o.write_shift(4, h); return o; + } + + /* [MS-OSHARED] 2.3.3.1.4 Lpstr */ + function parse_lpstr(blob, type, pad) { + var start = blob.l; + var str = blob.read_shift(0, 'lpstr-cp'); + if(pad) while((blob.l - start) & 3) ++blob.l; + return str; + } + + /* [MS-OSHARED] 2.3.3.1.6 Lpwstr */ + function parse_lpwstr(blob, type, pad) { + var str = blob.read_shift(0, 'lpwstr'); + if(pad) blob.l += (4 - ((str.length+1) & 3)) & 3; + return str; + } + + + /* [MS-OSHARED] 2.3.3.1.11 VtString */ + /* [MS-OSHARED] 2.3.3.1.12 VtUnalignedString */ + function parse_VtStringBase(blob, stringType, pad) { + if(stringType === 0x1F /*VT_LPWSTR*/) return parse_lpwstr(blob); + return parse_lpstr(blob, stringType, pad); + } + + function parse_VtString(blob, t, pad) { return parse_VtStringBase(blob, t, pad === false ? 0: 4); } + function parse_VtUnalignedString(blob, t) { if(!t) throw new Error("VtUnalignedString must have positive length"); return parse_VtStringBase(blob, t, 0); } + + /* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue */ + function parse_VtVecUnalignedLpstrValue(blob) { + var length = blob.read_shift(4); + var ret = []; + for(var i = 0; i != length; ++i) ret[i] = blob.read_shift(0, 'lpstr-cp').replace(chr0,''); + return ret; + } + + /* [MS-OSHARED] 2.3.3.1.10 VtVecUnalignedLpstr */ + function parse_VtVecUnalignedLpstr(blob) { + return parse_VtVecUnalignedLpstrValue(blob); + } + + /* [MS-OSHARED] 2.3.3.1.13 VtHeadingPair */ + function parse_VtHeadingPair(blob) { + var headingString = parse_TypedPropertyValue(blob, VT_USTR); + var headerParts = parse_TypedPropertyValue(blob, VT_I4); + return [headingString, headerParts]; + } + + /* [MS-OSHARED] 2.3.3.1.14 VtVecHeadingPairValue */ + function parse_VtVecHeadingPairValue(blob) { + var cElements = blob.read_shift(4); + var out = []; + for(var i = 0; i != cElements / 2; ++i) out.push(parse_VtHeadingPair(blob)); + return out; + } + + /* [MS-OSHARED] 2.3.3.1.15 VtVecHeadingPair */ + function parse_VtVecHeadingPair(blob) { + // NOTE: When invoked, wType & padding were already consumed + return parse_VtVecHeadingPairValue(blob); + } + + /* [MS-OLEPS] 2.18.1 Dictionary (uses 2.17, 2.16) */ + function parse_dictionary(blob,CodePage) { + var cnt = blob.read_shift(4); + var dict = ({}); + for(var j = 0; j != cnt; ++j) { + var pid = blob.read_shift(4); + var len = blob.read_shift(4); + dict[pid] = blob.read_shift(len, (CodePage === 0x4B0 ?'utf16le':'utf8')).replace(chr0,'').replace(chr1,'!'); + if(CodePage === 0x4B0 && (len % 2)) blob.l += 2; + } + if(blob.l & 3) blob.l = (blob.l>>2+1)<<2; + return dict; + } + + /* [MS-OLEPS] 2.9 BLOB */ + function parse_BLOB(blob) { + var size = blob.read_shift(4); + var bytes = blob.slice(blob.l,blob.l+size); + blob.l += size; + if((size & 3) > 0) blob.l += (4 - (size & 3)) & 3; + return bytes; + } + + /* [MS-OLEPS] 2.11 ClipboardData */ + function parse_ClipboardData(blob) { + // TODO + var o = {}; + o.Size = blob.read_shift(4); + //o.Format = blob.read_shift(4); + blob.l += o.Size + 3 - (o.Size - 1) % 4; + return o; + } + + /* [MS-OLEPS] 2.15 TypedPropertyValue */ + function parse_TypedPropertyValue(blob, type, _opts) { + var t = blob.read_shift(2), ret, opts = _opts||{}; + blob.l += 2; + if(type !== VT_VARIANT) + if(t !== type && VT_CUSTOM.indexOf(type)===-1) throw new Error('Expected type ' + type + ' saw ' + t); + switch(type === VT_VARIANT ? t : type) { + case 0x02 /*VT_I2*/: ret = blob.read_shift(2, 'i'); if(!opts.raw) blob.l += 2; return ret; + case 0x03 /*VT_I4*/: ret = blob.read_shift(4, 'i'); return ret; + case 0x0B /*VT_BOOL*/: return blob.read_shift(4) !== 0x0; + case 0x13 /*VT_UI4*/: ret = blob.read_shift(4); return ret; + case 0x1E /*VT_LPSTR*/: return parse_lpstr(blob, t, 4).replace(chr0,''); + case 0x1F /*VT_LPWSTR*/: return parse_lpwstr(blob); + case 0x40 /*VT_FILETIME*/: return parse_FILETIME(blob); + case 0x41 /*VT_BLOB*/: return parse_BLOB(blob); + case 0x47 /*VT_CF*/: return parse_ClipboardData(blob); + case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw).replace(chr0,''); + case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,''); + case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPair(blob); + case 0x101E /*VT_LPSTR*/: return parse_VtVecUnalignedLpstr(blob); + default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t); + } + } + function write_TypedPropertyValue(type, value) { + var o = new_buf(4), p = new_buf(4); + o.write_shift(4, type == 0x50 ? 0x1F : type); + switch(type) { + case 0x03 /*VT_I4*/: p.write_shift(-4, value); break; + case 0x05 /*VT_I4*/: p = new_buf(8); p.write_shift(8, value, 'f'); break; + case 0x0B /*VT_BOOL*/: p.write_shift(4, value ? 0x01 : 0x00); break; + case 0x40 /*VT_FILETIME*/: p = write_FILETIME(value); break; + case 0x1F /*VT_LPWSTR*/: + case 0x50 /*VT_STRING*/: + p = new_buf(4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); + p.write_shift(4, value.length + 1); + p.write_shift(0, value, "dbcs"); + while(p.l != p.length) p.write_shift(1, 0); + break; + default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + value); + } + return bconcat([o, p]); + } + + /* [MS-OLEPS] 2.20 PropertySet */ + function parse_PropertySet(blob, PIDSI) { + var start_addr = blob.l; + var size = blob.read_shift(4); + var NumProps = blob.read_shift(4); + var Props = [], i = 0; + var CodePage = 0; + var Dictionary = -1, DictObj = ({}); + for(i = 0; i != NumProps; ++i) { + var PropID = blob.read_shift(4); + var Offset = blob.read_shift(4); + Props[i] = [PropID, Offset + start_addr]; + } + Props.sort(function(x,y) { return x[1] - y[1]; }); + var PropH = {}; + for(i = 0; i != NumProps; ++i) { + if(blob.l !== Props[i][1]) { + var fail = true; + if(i>0 && PIDSI) switch(PIDSI[Props[i-1][0]].t) { + case 0x02 /*VT_I2*/: if(blob.l+2 === Props[i][1]) { blob.l+=2; fail = false; } break; + case 0x50 /*VT_STRING*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break; + case 0x100C /*VT_VECTOR|VT_VARIANT*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break; + } + if((!PIDSI||i==0) && blob.l <= Props[i][1]) { fail=false; blob.l = Props[i][1]; } + if(fail) throw new Error("Read Error: Expected address " + Props[i][1] + ' at ' + blob.l + ' :' + i); + } + if(PIDSI) { + var piddsi = PIDSI[Props[i][0]]; + PropH[piddsi.n] = parse_TypedPropertyValue(blob, piddsi.t, {raw:true}); + if(piddsi.p === 'version') PropH[piddsi.n] = String(PropH[piddsi.n] >> 16) + "." + ("0000" + String(PropH[piddsi.n] & 0xFFFF)).slice(-4); + if(piddsi.n == "CodePage") switch(PropH[piddsi.n]) { + case 0: PropH[piddsi.n] = 1252; + /* falls through */ + case 874: + case 932: + case 936: + case 949: + case 950: + case 1250: + case 1251: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 10000: + case 1200: + case 1201: + case 1252: + case 65000: case -536: + case 65001: case -535: + set_cp(CodePage = (PropH[piddsi.n]>>>0) & 0xFFFF); break; + default: throw new Error("Unsupported CodePage: " + PropH[piddsi.n]); + } + } else { + if(Props[i][0] === 0x1) { + CodePage = PropH.CodePage = (parse_TypedPropertyValue(blob, VT_I2)); + set_cp(CodePage); + if(Dictionary !== -1) { + var oldpos = blob.l; + blob.l = Props[Dictionary][1]; + DictObj = parse_dictionary(blob,CodePage); + blob.l = oldpos; + } + } else if(Props[i][0] === 0) { + if(CodePage === 0) { Dictionary = i; blob.l = Props[i+1][1]; continue; } + DictObj = parse_dictionary(blob,CodePage); + } else { + var name = DictObj[Props[i][0]]; + var val; + /* [MS-OSHARED] 2.3.3.2.3.1.2 + PROPVARIANT */ + switch(blob[blob.l]) { + case 0x41 /*VT_BLOB*/: blob.l += 4; val = parse_BLOB(blob); break; + case 0x1E /*VT_LPSTR*/: blob.l += 4; val = parse_VtString(blob, blob[blob.l-4]).replace(/\u0000+$/,""); break; + case 0x1F /*VT_LPWSTR*/: blob.l += 4; val = parse_VtString(blob, blob[blob.l-4]).replace(/\u0000+$/,""); break; + case 0x03 /*VT_I4*/: blob.l += 4; val = blob.read_shift(4, 'i'); break; + case 0x13 /*VT_UI4*/: blob.l += 4; val = blob.read_shift(4); break; + case 0x05 /*VT_R8*/: blob.l += 4; val = blob.read_shift(8, 'f'); break; + case 0x0B /*VT_BOOL*/: blob.l += 4; val = parsebool(blob, 4); break; + case 0x40 /*VT_FILETIME*/: blob.l += 4; val = parseDate(parse_FILETIME(blob)); break; + default: throw new Error("unparsed value: " + blob[blob.l]); + } + PropH[name] = val; + } + } + } + blob.l = start_addr + size; /* step ahead to skip padding */ + return PropH; + } + var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ].concat(PseudoPropsPairs); + function guess_property_type(val) { + switch(typeof val) { + case "boolean": return 0x0B; + case "number": return ((val|0)==val) ? 0x03 : 0x05; + case "string": return 0x1F; + case "object": if(val instanceof Date) return 0x40; break; + } + return -1; + } + function write_PropertySet(entries, RE, PIDSI) { + var hdr = new_buf(8), piao = [], prop = []; + var sz = 8, i = 0; + + var pr = new_buf(8), pio = new_buf(8); + pr.write_shift(4, 0x0002); + pr.write_shift(4, 0x04B0); + pio.write_shift(4, 0x0001); + prop.push(pr); piao.push(pio); + sz += 8 + pr.length; + + if(!RE) { + pio = new_buf(8); + pio.write_shift(4, 0); + piao.unshift(pio); + + var bufs = [new_buf(4)]; + bufs[0].write_shift(4, entries.length); + for(i = 0; i < entries.length; ++i) { + var value = entries[i][0]; + pr = new_buf(4 + 4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); + pr.write_shift(4, i+2); + pr.write_shift(4, value.length + 1); + pr.write_shift(0, value, "dbcs"); + while(pr.l != pr.length) pr.write_shift(1, 0); + bufs.push(pr); + } + pr = bconcat(bufs); + prop.unshift(pr); + sz += 8 + pr.length; + } + + for(i = 0; i < entries.length; ++i) { + if(RE && !RE[entries[i][0]]) continue; + if(XLSPSSkip.indexOf(entries[i][0]) > -1) continue; + if(entries[i][1] == null) continue; + + var val = entries[i][1], idx = 0; + if(RE) { + idx = +RE[entries[i][0]]; + var pinfo = (PIDSI)[idx]; + if(pinfo.p == "version" && typeof val == "string") { + var arr = val.split("."); + val = ((+arr[0])<<16) + ((+arr[1])||0); + } + pr = write_TypedPropertyValue(pinfo.t, val); + } else { + var T = guess_property_type(val); + if(T == -1) { T = 0x1F; val = String(val); } + pr = write_TypedPropertyValue(T, val); + } + prop.push(pr); + + pio = new_buf(8); + pio.write_shift(4, !RE ? 2+i : idx); + piao.push(pio); + + sz += 8 + pr.length; + } + + var w = 8 * (prop.length + 1); + for(i = 0; i < prop.length; ++i) { piao[i].write_shift(4, w); w += prop[i].length; } + hdr.write_shift(4, sz); + hdr.write_shift(4, prop.length); + return bconcat([hdr].concat(piao).concat(prop)); + } + + /* [MS-OLEPS] 2.21 PropertySetStream */ + function parse_PropertySetStream(file, PIDSI, clsid) { + var blob = file.content; + if(!blob) return ({}); + prep_blob(blob, 0); + + var NumSets, FMTID0, FMTID1, Offset0, Offset1 = 0; + blob.chk('feff', 'Byte Order: '); + + /*var vers = */blob.read_shift(2); // TODO: check version + var SystemIdentifier = blob.read_shift(4); + var CLSID = blob.read_shift(16); + if(CLSID !== CFB.utils.consts.HEADER_CLSID && CLSID !== clsid) throw new Error("Bad PropertySet CLSID " + CLSID); + NumSets = blob.read_shift(4); + if(NumSets !== 1 && NumSets !== 2) throw new Error("Unrecognized #Sets: " + NumSets); + FMTID0 = blob.read_shift(16); Offset0 = blob.read_shift(4); + + if(NumSets === 1 && Offset0 !== blob.l) throw new Error("Length mismatch: " + Offset0 + " !== " + blob.l); + else if(NumSets === 2) { FMTID1 = blob.read_shift(16); Offset1 = blob.read_shift(4); } + var PSet0 = parse_PropertySet(blob, PIDSI); + + var rval = ({ SystemIdentifier: SystemIdentifier }); + for(var y in PSet0) rval[y] = PSet0[y]; + //rval.blob = blob; + rval.FMTID = FMTID0; + //rval.PSet0 = PSet0; + if(NumSets === 1) return rval; + if(Offset1 - blob.l == 2) blob.l += 2; + if(blob.l !== Offset1) throw new Error("Length mismatch 2: " + blob.l + " !== " + Offset1); + var PSet1; + try { PSet1 = parse_PropertySet(blob, null); } catch(e) {/* empty */} + for(y in PSet1) rval[y] = PSet1[y]; + rval.FMTID = [FMTID0, FMTID1]; // TODO: verify FMTID0/1 + return rval; + } + function write_PropertySetStream(entries, clsid, RE, PIDSI, entries2, clsid2) { + var hdr = new_buf(entries2 ? 68 : 48); + var bufs = [hdr]; + hdr.write_shift(2, 0xFFFE); + hdr.write_shift(2, 0x0000); /* TODO: type 1 props */ + hdr.write_shift(4, 0x32363237); + hdr.write_shift(16, CFB.utils.consts.HEADER_CLSID, "hex"); + hdr.write_shift(4, (entries2 ? 2 : 1)); + hdr.write_shift(16, clsid, "hex"); + hdr.write_shift(4, (entries2 ? 68 : 48)); + var ps0 = write_PropertySet(entries, RE, PIDSI); + bufs.push(ps0); + + if(entries2) { + var ps1 = write_PropertySet(entries2, null, null); + hdr.write_shift(16, clsid2, "hex"); + hdr.write_shift(4, 68 + ps0.length); + bufs.push(ps1); + } + return bconcat(bufs); + } + + function parsenoop2(blob, length) { blob.read_shift(length); return null; } + function writezeroes(n, o) { if(!o) o=new_buf(n); for(var j=0; j= 12 ? 2 : 1); + var encoding = 'sbcs-cont'; + var cp = current_codepage; + if(opts && opts.biff >= 8) current_codepage = 1200; + if(!opts || opts.biff == 8 ) { + var fHighByte = blob.read_shift(1); + if(fHighByte) { encoding = 'dbcs-cont'; } + } else if(opts.biff == 12) { + encoding = 'wstr'; + } + if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr'; + var o = cch ? blob.read_shift(cch, encoding) : ""; + current_codepage = cp; + return o; + } + + /* 2.5.293 XLUnicodeRichExtendedString */ + function parse_XLUnicodeRichExtendedString(blob) { + var cp = current_codepage; + current_codepage = 1200; + var cch = blob.read_shift(2), flags = blob.read_shift(1); + var /*fHighByte = flags & 0x1,*/ fExtSt = flags & 0x4, fRichSt = flags & 0x8; + var width = 1 + (flags & 0x1); // 0x0 -> utf8, 0x1 -> dbcs + var cRun = 0, cbExtRst; + var z = {}; + if(fRichSt) cRun = blob.read_shift(2); + if(fExtSt) cbExtRst = blob.read_shift(4); + var encoding = width == 2 ? 'dbcs-cont' : 'sbcs-cont'; + var msg = cch === 0 ? "" : blob.read_shift(cch, encoding); + if(fRichSt) blob.l += 4 * cRun; //TODO: parse this + if(fExtSt) blob.l += cbExtRst; //TODO: parse this + z.t = msg; + if(!fRichSt) { z.raw = "" + z.t + ""; z.r = z.t; } + current_codepage = cp; + return z; + } + + /* 2.5.296 XLUnicodeStringNoCch */ + function parse_XLUnicodeStringNoCch(blob, cch, opts) { + var retval; + if(opts) { + if(opts.biff >= 2 && opts.biff <= 5) return blob.read_shift(cch, 'cpstr'); + if(opts.biff >= 12) return blob.read_shift(cch, 'dbcs-cont'); + } + var fHighByte = blob.read_shift(1); + if(fHighByte===0) { retval = blob.read_shift(cch, 'sbcs-cont'); } + else { retval = blob.read_shift(cch, 'dbcs-cont'); } + return retval; + } + + /* 2.5.294 XLUnicodeString */ + function parse_XLUnicodeString(blob, length, opts) { + var cch = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + if(cch === 0) { blob.l++; return ""; } + return parse_XLUnicodeStringNoCch(blob, cch, opts); + } + /* BIFF5 override */ + function parse_XLUnicodeString2(blob, length, opts) { + if(opts.biff > 5) return parse_XLUnicodeString(blob, length, opts); + var cch = blob.read_shift(1); + if(cch === 0) { blob.l++; return ""; } + return blob.read_shift(cch, (opts.biff <= 4 || !blob.lens ) ? 'cpstr' : 'sbcs-cont'); + } + /* TODO: BIFF5 and lower, codepage awareness */ + function write_XLUnicodeString(str, opts, o) { + if(!o) o = new_buf(3 + 2 * str.length); + o.write_shift(2, str.length); + o.write_shift(1, 1); + o.write_shift(31, str, 'utf16le'); + return o; + } + + /* [MS-XLS] 2.5.61 ControlInfo */ + function parse_ControlInfo(blob) { + var flags = blob.read_shift(1); + blob.l++; + var accel = blob.read_shift(2); + blob.l += 2; + return [flags, accel]; + } + + /* [MS-OSHARED] 2.3.7.6 URLMoniker TODO: flags */ + function parse_URLMoniker(blob) { + var len = blob.read_shift(4), start = blob.l; + var extra = false; + if(len > 24) { + /* look ahead */ + blob.l += len - 24; + if(blob.read_shift(16) === "795881f43b1d7f48af2c825dc4852763") extra = true; + blob.l = start; + } + var url = blob.read_shift((extra?len-24:len)>>1, 'utf16le').replace(chr0,""); + if(extra) blob.l += 24; + return url; + } + + /* [MS-OSHARED] 2.3.7.8 FileMoniker TODO: all fields */ + function parse_FileMoniker(blob) { + blob.l += 2; //var cAnti = blob.read_shift(2); + var ansiPath = blob.read_shift(0, 'lpstr-ansi'); + blob.l += 2; //var endServer = blob.read_shift(2); + if(blob.read_shift(2) != 0xDEAD) throw new Error("Bad FileMoniker"); + var sz = blob.read_shift(4); + if(sz === 0) return ansiPath.replace(/\\/g,"/"); + var bytes = blob.read_shift(4); + if(blob.read_shift(2) != 3) throw new Error("Bad FileMoniker"); + var unicodePath = blob.read_shift(bytes>>1, 'utf16le').replace(chr0,""); + return unicodePath; + } + + /* [MS-OSHARED] 2.3.7.2 HyperlinkMoniker TODO: all the monikers */ + function parse_HyperlinkMoniker(blob, length) { + var clsid = blob.read_shift(16); length -= 16; + switch(clsid) { + case "e0c9ea79f9bace118c8200aa004ba90b": return parse_URLMoniker(blob, length); + case "0303000000000000c000000000000046": return parse_FileMoniker(blob, length); + default: throw new Error("Unsupported Moniker " + clsid); + } + } + + /* [MS-OSHARED] 2.3.7.9 HyperlinkString */ + function parse_HyperlinkString(blob) { + var len = blob.read_shift(4); + var o = len > 0 ? blob.read_shift(len, 'utf16le').replace(chr0, "") : ""; + return o; + } + + /* [MS-OSHARED] 2.3.7.1 Hyperlink Object */ + function parse_Hyperlink(blob, length) { + var end = blob.l + length; + var sVer = blob.read_shift(4); + if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer); + var flags = blob.read_shift(2); + blob.l += 2; + var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime; + if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l); + if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l); + if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l); + if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l); + if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l); + if(flags & 0x0020) guid = blob.read_shift(16); + if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/); + blob.l = end; + var target = targetFrameName||moniker||oleMoniker||""; + if(target && Loc) target+="#"+Loc; + if(!target) target = "#" + Loc; + var out = ({Target:target}); + if(guid) out.guid = guid; + if(fileTime) out.time = fileTime; + if(displayName) out.Tooltip = displayName; + return out; + } + function write_Hyperlink(hl) { + var out = new_buf(512), i = 0; + var Target = hl.Target; + var F = Target.indexOf("#") > -1 ? 0x1f : 0x17; + switch(Target.charAt(0)) { case "#": F=0x1c; break; case ".": F&=~2; break; } + out.write_shift(4,2); out.write_shift(4, F); + var data = [8,6815827,6619237,4849780,83]; for(i = 0; i < data.length; ++i) out.write_shift(4, data[i]); + if(F == 0x1C) { + Target = Target.slice(1); + out.write_shift(4, Target.length + 1); + for(i = 0; i < Target.length; ++i) out.write_shift(2, Target.charCodeAt(i)); + out.write_shift(2, 0); + } else if(F & 0x02) { + data = "e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); + for(i = 0; i < data.length; ++i) out.write_shift(1, parseInt(data[i], 16)); + out.write_shift(4, 2*(Target.length + 1)); + for(i = 0; i < Target.length; ++i) out.write_shift(2, Target.charCodeAt(i)); + out.write_shift(2, 0); + } else { + data = "03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "); + for(i = 0; i < data.length; ++i) out.write_shift(1, parseInt(data[i], 16)); + var P = 0; + while(Target.slice(P*3,P*3+3)=="../"||Target.slice(P*3,P*3+3)=="..\\") ++P; + out.write_shift(2, P); + out.write_shift(4, Target.length + 1); + for(i = 0; i < Target.length; ++i) out.write_shift(1, Target.charCodeAt(i) & 0xFF); + out.write_shift(1, 0); + out.write_shift(2, 0xFFFF); + out.write_shift(2, 0xDEAD); + for(i = 0; i < 6; ++i) out.write_shift(4, 0); + } + return out.slice(0, out.l); + } + + /* 2.5.178 LongRGBA */ + function parse_LongRGBA(blob) { var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1); return [r,g,b,a]; } + + /* 2.5.177 LongRGB */ + function parse_LongRGB(blob, length) { var x = parse_LongRGBA(blob, length); x[3] = 0; return x; } + + + /* [MS-XLS] 2.5.19 */ + function parse_XLSCell(blob) { + var rw = blob.read_shift(2); // 0-indexed + var col = blob.read_shift(2); + var ixfe = blob.read_shift(2); + return ({r:rw, c:col, ixfe:ixfe}); + } + function write_XLSCell(R, C, ixfe, o) { + if(!o) o = new_buf(6); + o.write_shift(2, R); + o.write_shift(2, C); + o.write_shift(2, ixfe||0); + return o; + } + + /* [MS-XLS] 2.5.134 */ + function parse_frtHeader(blob) { + var rt = blob.read_shift(2); + var flags = blob.read_shift(2); // TODO: parse these flags + blob.l += 8; + return {type: rt, flags: flags}; + } + + + + function parse_OptXLUnicodeString(blob, length, opts) { return length === 0 ? "" : parse_XLUnicodeString2(blob, length, opts); } + + /* [MS-XLS] 2.5.344 */ + function parse_XTI(blob, length, opts) { + var w = opts.biff > 8 ? 4 : 2; + var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w,'i'), itabLast = blob.read_shift(w,'i'); + return [iSupBook, itabFirst, itabLast]; + } + + /* [MS-XLS] 2.5.218 */ + function parse_RkRec(blob) { + var ixfe = blob.read_shift(2); + var RK = parse_RkNumber(blob); + return [ixfe, RK]; + } + + /* [MS-XLS] 2.5.1 */ + function parse_AddinUdf(blob, length, opts) { + blob.l += 4; length -= 4; + var l = blob.l + length; + var udfName = parse_ShortXLUnicodeString(blob, length, opts); + var cb = blob.read_shift(2); + l -= blob.l; + if(cb !== l) throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb); + blob.l += cb; + return udfName; + } + + /* [MS-XLS] 2.5.209 TODO: Check sizes */ + function parse_Ref8U(blob) { + var rwFirst = blob.read_shift(2); + var rwLast = blob.read_shift(2); + var colFirst = blob.read_shift(2); + var colLast = blob.read_shift(2); + return {s:{c:colFirst, r:rwFirst}, e:{c:colLast,r:rwLast}}; + } + function write_Ref8U(r, o) { + if(!o) o = new_buf(8); + o.write_shift(2, r.s.r); + o.write_shift(2, r.e.r); + o.write_shift(2, r.s.c); + o.write_shift(2, r.e.c); + return o; + } + + /* [MS-XLS] 2.5.211 */ + function parse_RefU(blob) { + var rwFirst = blob.read_shift(2); + var rwLast = blob.read_shift(2); + var colFirst = blob.read_shift(1); + var colLast = blob.read_shift(1); + return {s:{c:colFirst, r:rwFirst}, e:{c:colLast,r:rwLast}}; + } + + /* [MS-XLS] 2.5.207 */ + var parse_Ref = parse_RefU; + + /* [MS-XLS] 2.5.143 */ + function parse_FtCmo(blob) { + blob.l += 4; + var ot = blob.read_shift(2); + var id = blob.read_shift(2); + var flags = blob.read_shift(2); + blob.l+=12; + return [id, ot, flags]; + } + + /* [MS-XLS] 2.5.149 */ + function parse_FtNts(blob) { + var out = {}; + blob.l += 4; + blob.l += 16; // GUID TODO + out.fSharedNote = blob.read_shift(2); + blob.l += 4; + return out; + } + + /* [MS-XLS] 2.5.142 */ + function parse_FtCf(blob) { + var out = {}; + blob.l += 4; + blob.cf = blob.read_shift(2); + return out; + } + + /* [MS-XLS] 2.5.140 - 2.5.154 and friends */ + function parse_FtSkip(blob) { blob.l += 2; blob.l += blob.read_shift(2); } + var FtTab = { + 0x00: parse_FtSkip, /* FtEnd */ + 0x04: parse_FtSkip, /* FtMacro */ + 0x05: parse_FtSkip, /* FtButton */ + 0x06: parse_FtSkip, /* FtGmo */ + 0x07: parse_FtCf, /* FtCf */ + 0x08: parse_FtSkip, /* FtPioGrbit */ + 0x09: parse_FtSkip, /* FtPictFmla */ + 0x0A: parse_FtSkip, /* FtCbls */ + 0x0B: parse_FtSkip, /* FtRbo */ + 0x0C: parse_FtSkip, /* FtSbs */ + 0x0D: parse_FtNts, /* FtNts */ + 0x0E: parse_FtSkip, /* FtSbsFmla */ + 0x0F: parse_FtSkip, /* FtGboData */ + 0x10: parse_FtSkip, /* FtEdoData */ + 0x11: parse_FtSkip, /* FtRboData */ + 0x12: parse_FtSkip, /* FtCblsData */ + 0x13: parse_FtSkip, /* FtLbsData */ + 0x14: parse_FtSkip, /* FtCblsFmla */ + 0x15: parse_FtCmo + }; + function parse_FtArray(blob, length) { + var tgt = blob.l + length; + var fts = []; + while(blob.l < tgt) { + var ft = blob.read_shift(2); + blob.l-=2; + try { + fts.push(FtTab[ft](blob, tgt - blob.l)); + } catch(e) { blob.l = tgt; return fts; } + } + if(blob.l != tgt) blob.l = tgt; //throw new Error("bad Object Ft-sequence"); + return fts; + } + + /* --- 2.4 Records --- */ + + /* [MS-XLS] 2.4.21 */ + function parse_BOF(blob, length) { + var o = {BIFFVer:0, dt:0}; + o.BIFFVer = blob.read_shift(2); length -= 2; + if(length >= 2) { o.dt = blob.read_shift(2); blob.l -= 2; } + switch(o.BIFFVer) { + case 0x0600: /* BIFF8 */ + case 0x0500: /* BIFF5 */ + case 0x0400: /* BIFF4 */ + case 0x0300: /* BIFF3 */ + case 0x0200: /* BIFF2 */ + case 0x0002: case 0x0007: /* BIFF2 */ + break; + default: if(length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer); + } + + blob.read_shift(length); + return o; + } + function write_BOF(wb, t, o) { + var h = 0x0600, w = 16; + switch(o.bookType) { + case 'biff8': break; + case 'biff5': h = 0x0500; w = 8; break; + case 'biff4': h = 0x0004; w = 6; break; + case 'biff3': h = 0x0003; w = 6; break; + case 'biff2': h = 0x0002; w = 4; break; + case 'xla': break; + default: throw new Error("unsupported BIFF version"); + } + var out = new_buf(w); + out.write_shift(2, h); + out.write_shift(2, t); + if(w > 4) out.write_shift(2, 0x7262); + if(w > 6) out.write_shift(2, 0x07CD); + if(w > 8) { + out.write_shift(2, 0xC009); + out.write_shift(2, 0x0001); + out.write_shift(2, 0x0706); + out.write_shift(2, 0x0000); + } + return out; + } + + + /* [MS-XLS] 2.4.146 */ + function parse_InterfaceHdr(blob, length) { + if(length === 0) return 0x04b0; + if((blob.read_shift(2))!==0x04b0){/* empty */} + return 0x04b0; + } + + + /* [MS-XLS] 2.4.349 */ + function parse_WriteAccess(blob, length, opts) { + if(opts.enc) { blob.l += length; return ""; } + var l = blob.l; + // TODO: make sure XLUnicodeString doesnt overrun + var UserName = parse_XLUnicodeString2(blob, 0, opts); + blob.read_shift(length + l - blob.l); + return UserName; + } + function write_WriteAccess(s, opts) { + var b8 = !opts || opts.biff == 8; + var o = new_buf(b8 ? 112 : 54); + o.write_shift(opts.biff == 8 ? 2 : 1, 7); + if(b8) o.write_shift(1, 0); + o.write_shift(4, 0x33336853); + o.write_shift(4, (0x00534A74 | (b8 ? 0 : 0x20000000))); + while(o.l < o.length) o.write_shift(1, (b8 ? 0 : 32)); + return o; + } + + /* [MS-XLS] 2.4.351 */ + function parse_WsBool(blob, length, opts) { + var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0); + return { fDialog: flags & 0x10 }; + } + + /* [MS-XLS] 2.4.28 */ + function parse_BoundSheet8(blob, length, opts) { + var pos = blob.read_shift(4); + var hidden = blob.read_shift(1) & 0x03; + var dt = blob.read_shift(1); + switch(dt) { + case 0: dt = 'Worksheet'; break; + case 1: dt = 'Macrosheet'; break; + case 2: dt = 'Chartsheet'; break; + case 6: dt = 'VBAModule'; break; + } + var name = parse_ShortXLUnicodeString(blob, 0, opts); + if(name.length === 0) name = "Sheet1"; + return { pos:pos, hs:hidden, dt:dt, name:name }; + } + function write_BoundSheet8(data, opts) { + var w = (!opts || opts.biff >= 8 ? 2 : 1); + var o = new_buf(8 + w * data.name.length); + o.write_shift(4, data.pos); + o.write_shift(1, data.hs || 0); + o.write_shift(1, data.dt); + o.write_shift(1, data.name.length); + if(opts.biff >= 8) o.write_shift(1, 1); + o.write_shift(w * data.name.length, data.name, opts.biff < 8 ? 'sbcs' : 'utf16le'); + var out = o.slice(0, o.l); + out.l = o.l; return out; + } + + /* [MS-XLS] 2.4.265 TODO */ + function parse_SST(blob, length) { + var end = blob.l + length; + var cnt = blob.read_shift(4); + var ucnt = blob.read_shift(4); + var strs = ([]); + for(var i = 0; i != ucnt && blob.l < end; ++i) { + strs.push(parse_XLUnicodeRichExtendedString(blob)); + } + strs.Count = cnt; strs.Unique = ucnt; + return strs; + } + + /* [MS-XLS] 2.4.107 */ + function parse_ExtSST(blob, length) { + var extsst = {}; + extsst.dsst = blob.read_shift(2); + blob.l += length-2; + return extsst; + } + + + /* [MS-XLS] 2.4.221 TODO: check BIFF2-4 */ + function parse_Row(blob) { + var z = ({}); + z.r = blob.read_shift(2); + z.c = blob.read_shift(2); + z.cnt = blob.read_shift(2) - z.c; + var miyRw = blob.read_shift(2); + blob.l += 4; // reserved(2), unused(2) + var flags = blob.read_shift(1); // various flags + blob.l += 3; // reserved(8), ixfe(12), flags(4) + if(flags & 0x07) z.level = flags & 0x07; + // collapsed: flags & 0x10 + if(flags & 0x20) z.hidden = true; + if(flags & 0x40) z.hpt = miyRw / 20; + return z; + } + + + /* [MS-XLS] 2.4.125 */ + function parse_ForceFullCalculation(blob) { + var header = parse_frtHeader(blob); + if(header.type != 0x08A3) throw new Error("Invalid Future Record " + header.type); + var fullcalc = blob.read_shift(4); + return fullcalc !== 0x0; + } + + + + + + /* [MS-XLS] 2.4.215 rt */ + function parse_RecalcId(blob) { + blob.read_shift(2); + return blob.read_shift(4); + } + + /* [MS-XLS] 2.4.87 */ + function parse_DefaultRowHeight(blob, length, opts) { + var f = 0; + if(!(opts && opts.biff == 2)) { + f = blob.read_shift(2); + } + var miyRw = blob.read_shift(2); + if((opts && opts.biff == 2)) { + f = 1 - (miyRw >> 15); miyRw &= 0x7fff; + } + var fl = {Unsynced:f&1,DyZero:(f&2)>>1,ExAsc:(f&4)>>2,ExDsc:(f&8)>>3}; + return [fl, miyRw]; + } + + /* [MS-XLS] 2.4.345 TODO */ + function parse_Window1(blob) { + var xWn = blob.read_shift(2), yWn = blob.read_shift(2), dxWn = blob.read_shift(2), dyWn = blob.read_shift(2); + var flags = blob.read_shift(2), iTabCur = blob.read_shift(2), iTabFirst = blob.read_shift(2); + var ctabSel = blob.read_shift(2), wTabRatio = blob.read_shift(2); + return { Pos: [xWn, yWn], Dim: [dxWn, dyWn], Flags: flags, CurTab: iTabCur, + FirstTab: iTabFirst, Selected: ctabSel, TabRatio: wTabRatio }; + } + function write_Window1() { + var o = new_buf(18); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0x7260); + o.write_shift(2, 0x44c0); + o.write_shift(2, 0x38); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 1); + o.write_shift(2, 0x01f4); + return o; + } + /* [MS-XLS] 2.4.346 TODO */ + function parse_Window2(blob, length, opts) { + if(opts && opts.biff >= 2 && opts.biff < 8) return {}; + var f = blob.read_shift(2); + return { RTL: f & 0x40 }; + } + function write_Window2(view) { + var o = new_buf(18), f = 0x6b6; + if(view && view.RTL) f |= 0x40; + o.write_shift(2, f); + o.write_shift(4, 0); + o.write_shift(4, 64); + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; + } + + /* [MS-XLS] 2.4.122 TODO */ + function parse_Font(blob, length, opts) { + var o = { + dyHeight: blob.read_shift(2), + fl: blob.read_shift(2) + }; + switch((opts && opts.biff) || 8) { + case 2: break; + case 3: case 4: blob.l += 2; break; + default: blob.l += 10; break; + } + o.name = parse_ShortXLUnicodeString(blob, 0, opts); + return o; + } + function write_Font(data, opts) { + var name = data.name || "Arial"; + var b5 = (opts && (opts.biff == 5)), w = (b5 ? (15 + name.length) : (16 + 2 * name.length)); + var o = new_buf(w); + o.write_shift(2, (data.sz || 12) * 20); + o.write_shift(4, 0); + o.write_shift(2, 400); + o.write_shift(4, 0); + o.write_shift(2, 0); + o.write_shift(1, name.length); + if(!b5) o.write_shift(1, 1); + o.write_shift((b5 ? 1 : 2) * name.length, name, (b5 ? "sbcs" : "utf16le")); + return o; + } + + /* [MS-XLS] 2.4.149 */ + function parse_LabelSst(blob) { + var cell = parse_XLSCell(blob); + cell.isst = blob.read_shift(4); + return cell; + } + + /* [MS-XLS] 2.4.148 */ + function parse_Label(blob, length, opts) { + var target = blob.l + length; + var cell = parse_XLSCell(blob, 6); + if(opts.biff == 2) blob.l++; + var str = parse_XLUnicodeString(blob, target - blob.l, opts); + cell.val = str; + return cell; + } + function write_Label(R, C, v, os, opts) { + var b8 = !opts || opts.biff == 8; + var o = new_buf(6 + 2 + (+b8) + (1 + b8) * v.length); + write_XLSCell(R, C, os, o); + o.write_shift(2, v.length); + if(b8) o.write_shift(1, 1); + o.write_shift((1 + b8) * v.length, v, b8 ? 'utf16le' : 'sbcs'); + return o; + } + + + /* [MS-XLS] 2.4.126 Number Formats */ + function parse_Format(blob, length, opts) { + var numFmtId = blob.read_shift(2); + var fmtstr = parse_XLUnicodeString2(blob, 0, opts); + return [numFmtId, fmtstr]; + } + function write_Format(i, f, opts, o) { + var b5 = (opts && (opts.biff == 5)); + if(!o) o = new_buf(b5 ? (3 + f.length) : (5 + 2 * f.length)); + o.write_shift(2, i); + o.write_shift((b5 ? 1 : 2), f.length); + if(!b5) o.write_shift(1, 1); + o.write_shift((b5 ? 1 : 2) * f.length, f, (b5 ? 'sbcs' : 'utf16le')); + var out = (o.length > o.l) ? o.slice(0, o.l) : o; + if(out.l == null) out.l = out.length; + return out; + } + var parse_BIFF2Format = parse_XLUnicodeString2; + + /* [MS-XLS] 2.4.90 */ + function parse_Dimensions(blob, length, opts) { + var end = blob.l + length; + var w = opts.biff == 8 || !opts.biff ? 4 : 2; + var r = blob.read_shift(w), R = blob.read_shift(w); + var c = blob.read_shift(2), C = blob.read_shift(2); + blob.l = end; + return {s: {r:r, c:c}, e: {r:R, c:C}}; + } + function write_Dimensions(range, opts) { + var w = opts.biff == 8 || !opts.biff ? 4 : 2; + var o = new_buf(2*w + 6); + o.write_shift(w, range.s.r); + o.write_shift(w, range.e.r + 1); + o.write_shift(2, range.s.c); + o.write_shift(2, range.e.c + 1); + o.write_shift(2, 0); + return o; + } + + /* [MS-XLS] 2.4.220 */ + function parse_RK(blob) { + var rw = blob.read_shift(2), col = blob.read_shift(2); + var rkrec = parse_RkRec(blob); + return {r:rw, c:col, ixfe:rkrec[0], rknum:rkrec[1]}; + } + + /* [MS-XLS] 2.4.175 */ + function parse_MulRk(blob, length) { + var target = blob.l + length - 2; + var rw = blob.read_shift(2), col = blob.read_shift(2); + var rkrecs = []; + while(blob.l < target) rkrecs.push(parse_RkRec(blob)); + if(blob.l !== target) throw new Error("MulRK read error"); + var lastcol = blob.read_shift(2); + if(rkrecs.length != lastcol - col + 1) throw new Error("MulRK length mismatch"); + return {r:rw, c:col, C:lastcol, rkrec:rkrecs}; + } + /* [MS-XLS] 2.4.174 */ + function parse_MulBlank(blob, length) { + var target = blob.l + length - 2; + var rw = blob.read_shift(2), col = blob.read_shift(2); + var ixfes = []; + while(blob.l < target) ixfes.push(blob.read_shift(2)); + if(blob.l !== target) throw new Error("MulBlank read error"); + var lastcol = blob.read_shift(2); + if(ixfes.length != lastcol - col + 1) throw new Error("MulBlank length mismatch"); + return {r:rw, c:col, C:lastcol, ixfe:ixfes}; + } + + /* [MS-XLS] 2.5.20 2.5.249 TODO: interpret values here */ + function parse_CellStyleXF(blob, length, style, opts) { + var o = {}; + var a = blob.read_shift(4), b = blob.read_shift(4); + var c = blob.read_shift(4), d = blob.read_shift(2); + o.patternType = XLSFillPattern[c >> 26]; + + if(!opts.cellStyles) return o; + o.alc = a & 0x07; + o.fWrap = (a >> 3) & 0x01; + o.alcV = (a >> 4) & 0x07; + o.fJustLast = (a >> 7) & 0x01; + o.trot = (a >> 8) & 0xFF; + o.cIndent = (a >> 16) & 0x0F; + o.fShrinkToFit = (a >> 20) & 0x01; + o.iReadOrder = (a >> 22) & 0x02; + o.fAtrNum = (a >> 26) & 0x01; + o.fAtrFnt = (a >> 27) & 0x01; + o.fAtrAlc = (a >> 28) & 0x01; + o.fAtrBdr = (a >> 29) & 0x01; + o.fAtrPat = (a >> 30) & 0x01; + o.fAtrProt = (a >> 31) & 0x01; + + o.dgLeft = b & 0x0F; + o.dgRight = (b >> 4) & 0x0F; + o.dgTop = (b >> 8) & 0x0F; + o.dgBottom = (b >> 12) & 0x0F; + o.icvLeft = (b >> 16) & 0x7F; + o.icvRight = (b >> 23) & 0x7F; + o.grbitDiag = (b >> 30) & 0x03; + + o.icvTop = c & 0x7F; + o.icvBottom = (c >> 7) & 0x7F; + o.icvDiag = (c >> 14) & 0x7F; + o.dgDiag = (c >> 21) & 0x0F; + + o.icvFore = d & 0x7F; + o.icvBack = (d >> 7) & 0x7F; + o.fsxButton = (d >> 14) & 0x01; + return o; + } +//function parse_CellXF(blob, length, opts) {return parse_CellStyleXF(blob,length,0, opts);} +//function parse_StyleXF(blob, length, opts) {return parse_CellStyleXF(blob,length,1, opts);} + + /* [MS-XLS] 2.4.353 TODO: actually do this right */ + function parse_XF(blob, length, opts) { + var o = {}; + o.ifnt = blob.read_shift(2); o.numFmtId = blob.read_shift(2); o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + length -= 6; + o.data = parse_CellStyleXF(blob, length, o.fStyle, opts); + return o; + } + function write_XF(data, ixfeP, opts, o) { + var b5 = (opts && (opts.biff == 5)); + if(!o) o = new_buf(b5 ? 16 : 20); + o.write_shift(2, 0); + if(data.style) { + o.write_shift(2, (data.numFmtId||0)); + o.write_shift(2, 0xFFF4); + } else { + o.write_shift(2, (data.numFmtId||0)); + o.write_shift(2, (ixfeP<<4)); + } + o.write_shift(4, 0); + o.write_shift(4, 0); + if(!b5) o.write_shift(4, 0); + o.write_shift(2, 0); + return o; + } + + /* [MS-XLS] 2.4.134 */ + function parse_Guts(blob) { + blob.l += 4; + var out = [blob.read_shift(2), blob.read_shift(2)]; + if(out[0] !== 0) out[0]--; + if(out[1] !== 0) out[1]--; + if(out[0] > 7 || out[1] > 7) throw new Error("Bad Gutters: " + out.join("|")); + return out; + } + function write_Guts(guts) { + var o = new_buf(8); + o.write_shift(4, 0); + o.write_shift(2, guts[0] ? guts[0] + 1 : 0); + o.write_shift(2, guts[1] ? guts[1] + 1 : 0); + return o; + } + + /* [MS-XLS] 2.4.24 */ + function parse_BoolErr(blob, length, opts) { + var cell = parse_XLSCell(blob, 6); + if(opts.biff == 2) ++blob.l; + var val = parse_Bes(blob, 2); + cell.val = val; + cell.t = (val === true || val === false) ? 'b' : 'e'; + return cell; + } + function write_BoolErr(R, C, v, os, opts, t) { + var o = new_buf(8); + write_XLSCell(R, C, os, o); + write_Bes(v, t, o); + return o; + } + + /* [MS-XLS] 2.4.180 Number */ + function parse_Number(blob) { + var cell = parse_XLSCell(blob, 6); + var xnum = parse_Xnum(blob, 8); + cell.val = xnum; + return cell; + } + function write_Number(R, C, v, os) { + var o = new_buf(14); + write_XLSCell(R, C, os, o); + write_Xnum(v, o); + return o; + } + + var parse_XLHeaderFooter = parse_OptXLUnicodeString; // TODO: parse 2.4.136 + + /* [MS-XLS] 2.4.271 */ + function parse_SupBook(blob, length, opts) { + var end = blob.l + length; + var ctab = blob.read_shift(2); + var cch = blob.read_shift(2); + opts.sbcch = cch; + if(cch == 0x0401 || cch == 0x3A01) return [cch, ctab]; + if(cch < 0x01 || cch >0xff) throw new Error("Unexpected SupBook type: "+cch); + var virtPath = parse_XLUnicodeStringNoCch(blob, cch); + /* TODO: 2.5.277 Virtual Path */ + var rgst = []; + while(end > blob.l) rgst.push(parse_XLUnicodeString(blob)); + return [cch, ctab, virtPath, rgst]; + } + + /* [MS-XLS] 2.4.105 TODO */ + function parse_ExternName(blob, length, opts) { + var flags = blob.read_shift(2); + var body; + var o = ({ + fBuiltIn: flags & 0x01, + fWantAdvise: (flags >>> 1) & 0x01, + fWantPict: (flags >>> 2) & 0x01, + fOle: (flags >>> 3) & 0x01, + fOleLink: (flags >>> 4) & 0x01, + cf: (flags >>> 5) & 0x3FF, + fIcon: flags >>> 15 & 0x01 + }); + if(opts.sbcch === 0x3A01) body = parse_AddinUdf(blob, length-2, opts); + //else throw new Error("unsupported SupBook cch: " + opts.sbcch); + o.body = body || blob.read_shift(length-2); + if(typeof body === "string") o.Name = body; + return o; + } + + /* [MS-XLS] 2.4.150 TODO */ + var XLSLblBuiltIn = [ + "_xlnm.Consolidate_Area", + "_xlnm.Auto_Open", + "_xlnm.Auto_Close", + "_xlnm.Extract", + "_xlnm.Database", + "_xlnm.Criteria", + "_xlnm.Print_Area", + "_xlnm.Print_Titles", + "_xlnm.Recorder", + "_xlnm.Data_Form", + "_xlnm.Auto_Activate", + "_xlnm.Auto_Deactivate", + "_xlnm.Sheet_Title", + "_xlnm._FilterDatabase" + ]; + function parse_Lbl(blob, length, opts) { + var target = blob.l + length; + var flags = blob.read_shift(2); + var chKey = blob.read_shift(1); + var cch = blob.read_shift(1); + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + var itab = 0; + if(!opts || opts.biff >= 5) { + if(opts.biff != 5) blob.l += 2; + itab = blob.read_shift(2); + if(opts.biff == 5) blob.l += 2; + blob.l += 4; + } + var name = parse_XLUnicodeStringNoCch(blob, cch, opts); + if(flags & 0x20) name = XLSLblBuiltIn[name.charCodeAt(0)]; + var npflen = target - blob.l; if(opts && opts.biff == 2) --npflen; + var rgce = target == blob.l || cce === 0 ? [] : parse_NameParsedFormula(blob, npflen, opts, cce); + return { + chKey: chKey, + Name: name, + itab: itab, + rgce: rgce + }; + } + + /* [MS-XLS] 2.4.106 TODO: verify filename encoding */ + function parse_ExternSheet(blob, length, opts) { + if(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts); + var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2); + while(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts)); + // [iSupBook, itabFirst, itabLast]; + if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target); + return o; + } + function parse_BIFF5ExternSheet(blob, length, opts) { + if(blob[blob.l + 1] == 0x03) blob[blob.l]++; + var o = parse_ShortXLUnicodeString(blob, length, opts); + return o.charCodeAt(0) == 0x03 ? o.slice(1) : o; + } + + /* [MS-XLS] 2.4.176 TODO: check older biff */ + function parse_NameCmt(blob, length, opts) { + if(opts.biff < 8) { blob.l += length; return; } + var cchName = blob.read_shift(2); + var cchComment = blob.read_shift(2); + var name = parse_XLUnicodeStringNoCch(blob, cchName, opts); + var comment = parse_XLUnicodeStringNoCch(blob, cchComment, opts); + return [name, comment]; + } + + /* [MS-XLS] 2.4.260 */ + function parse_ShrFmla(blob, length, opts) { + var ref = parse_RefU(blob, 6); + blob.l++; + var cUse = blob.read_shift(1); + length -= 8; + return [parse_SharedParsedFormula(blob, length, opts), cUse, ref]; + } + + /* [MS-XLS] 2.4.4 TODO */ + function parse_Array(blob, length, opts) { + var ref = parse_Ref(blob, 6); + /* TODO: fAlwaysCalc */ + switch(opts.biff) { + case 2: blob.l ++; length -= 7; break; + case 3: case 4: blob.l += 2; length -= 8; break; + default: blob.l += 6; length -= 12; + } + return [ref, parse_ArrayParsedFormula(blob, length, opts, ref)]; + } + + /* [MS-XLS] 2.4.173 */ + function parse_MTRSettings(blob) { + var fMTREnabled = blob.read_shift(4) !== 0x00; + var fUserSetThreadCount = blob.read_shift(4) !== 0x00; + var cUserThreadCount = blob.read_shift(4); + return [fMTREnabled, fUserSetThreadCount, cUserThreadCount]; + } + + /* [MS-XLS] 2.5.186 TODO: BIFF5 */ + function parse_NoteSh(blob, length, opts) { + if(opts.biff < 8) return; + var row = blob.read_shift(2), col = blob.read_shift(2); + var flags = blob.read_shift(2), idObj = blob.read_shift(2); + var stAuthor = parse_XLUnicodeString2(blob, 0, opts); + if(opts.biff < 8) blob.read_shift(1); + return [{r:row,c:col}, stAuthor, idObj, flags]; + } + + /* [MS-XLS] 2.4.179 */ + function parse_Note(blob, length, opts) { + /* TODO: Support revisions */ + return parse_NoteSh(blob, length, opts); + } + + /* [MS-XLS] 2.4.168 */ + function parse_MergeCells(blob, length) { + var merges = []; + var cmcs = blob.read_shift(2); + while (cmcs--) merges.push(parse_Ref8U(blob,length)); + return merges; + } + function write_MergeCells(merges) { + var o = new_buf(2 + merges.length * 8); + o.write_shift(2, merges.length); + for(var i = 0; i < merges.length; ++i) write_Ref8U(merges[i], o); + return o; + } + + /* [MS-XLS] 2.4.181 TODO: parse all the things! */ + function parse_Obj(blob, length, opts) { + if(opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts); + var cmo = parse_FtCmo(blob, 22); // id, ot, flags + var fts = parse_FtArray(blob, length-22, cmo[1]); + return { cmo: cmo, ft:fts }; + } + /* from older spec */ + var parse_BIFF5OT = []; + parse_BIFF5OT[0x08] = function(blob, length) { + var tgt = blob.l + length; + blob.l += 10; // todo + var cf = blob.read_shift(2); + blob.l += 4; + blob.l += 2; //var cbPictFmla = blob.read_shift(2); + blob.l += 2; + blob.l += 2; //var grbit = blob.read_shift(2); + blob.l += 4; + var cchName = blob.read_shift(1); + blob.l += cchName; // TODO: stName + blob.l = tgt; // TODO: fmla + return { fmt:cf }; + }; + + function parse_BIFF5Obj(blob, length, opts) { + blob.l += 4; //var cnt = blob.read_shift(4); + var ot = blob.read_shift(2); + var id = blob.read_shift(2); + var grbit = blob.read_shift(2); + blob.l += 2; //var colL = blob.read_shift(2); + blob.l += 2; //var dxL = blob.read_shift(2); + blob.l += 2; //var rwT = blob.read_shift(2); + blob.l += 2; //var dyT = blob.read_shift(2); + blob.l += 2; //var colR = blob.read_shift(2); + blob.l += 2; //var dxR = blob.read_shift(2); + blob.l += 2; //var rwB = blob.read_shift(2); + blob.l += 2; //var dyB = blob.read_shift(2); + blob.l += 2; //var cbMacro = blob.read_shift(2); + blob.l += 6; + length -= 36; + var fts = []; + fts.push((parse_BIFF5OT[ot]||parsenoop)(blob, length, opts)); + return { cmo: [id, ot, grbit], ft:fts }; + } + + /* [MS-XLS] 2.4.329 TODO: parse properly */ + function parse_TxO(blob, length, opts) { + var s = blob.l; + var texts = ""; + try { + blob.l += 4; + var ot = (opts.lastobj||{cmo:[0,0]}).cmo[1]; + var controlInfo; // eslint-disable-line no-unused-vars + if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6; + else controlInfo = parse_ControlInfo(blob, 6, opts); + var cchText = blob.read_shift(2); + /*var cbRuns = */blob.read_shift(2); + /*var ifntEmpty = */parseuint16(blob, 2); + var len = blob.read_shift(2); + blob.l += len; + //var fmla = parse_ObjFmla(blob, s + length - blob.l); + + for(var i = 1; i < blob.lens.length-1; ++i) { + if(blob.l-s != blob.lens[i]) throw new Error("TxO: bad continue record"); + var hdr = blob[blob.l]; + var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i+1]-blob.lens[i]-1); + texts += t; + if(texts.length >= (hdr ? cchText : 2*cchText)) break; + } + if(texts.length !== cchText && texts.length !== cchText*2) { + throw new Error("cchText: " + cchText + " != " + texts.length); + } + + blob.l = s + length; + /* [MS-XLS] 2.5.272 TxORuns */ +// var rgTxoRuns = []; +// for(var j = 0; j != cbRuns/8-1; ++j) blob.l += 8; +// var cchText2 = blob.read_shift(2); +// if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText); +// blob.l += 6; +// if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l); + return { t: texts }; + } catch(e) { blob.l = s + length; return { t: texts }; } + } + + /* [MS-XLS] 2.4.140 */ + function parse_HLink(blob, length) { + var ref = parse_Ref8U(blob, 8); + blob.l += 16; /* CLSID */ + var hlink = parse_Hyperlink(blob, length-24); + return [ref, hlink]; + } + function write_HLink(hl) { + var O = new_buf(24); + var ref = decode_cell(hl[0]); + O.write_shift(2, ref.r); O.write_shift(2, ref.r); + O.write_shift(2, ref.c); O.write_shift(2, ref.c); + var clsid = "d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); + for(var i = 0; i < 16; ++i) O.write_shift(1, parseInt(clsid[i], 16)); + return bconcat([O, write_Hyperlink(hl[1])]); + } + + + /* [MS-XLS] 2.4.141 */ + function parse_HLinkTooltip(blob, length) { + blob.read_shift(2); + var ref = parse_Ref8U(blob, 8); + var wzTooltip = blob.read_shift((length-10)/2, 'dbcs-cont'); + wzTooltip = wzTooltip.replace(chr0,""); + return [ref, wzTooltip]; + } + function write_HLinkTooltip(hl) { + var TT = hl[1].Tooltip; + var O = new_buf(10 + 2 * (TT.length + 1)); + O.write_shift(2, 0x0800); + var ref = decode_cell(hl[0]); + O.write_shift(2, ref.r); O.write_shift(2, ref.r); + O.write_shift(2, ref.c); O.write_shift(2, ref.c); + for(var i = 0; i < TT.length; ++i) O.write_shift(2, TT.charCodeAt(i)); + O.write_shift(2, 0); + return O; + } + + /* [MS-XLS] 2.4.63 */ + function parse_Country(blob) { + var o = [0,0], d; + d = blob.read_shift(2); o[0] = CountryEnum[d] || d; + d = blob.read_shift(2); o[1] = CountryEnum[d] || d; + return o; + } + function write_Country(o) { + if(!o) o = new_buf(4); + o.write_shift(2, 0x01); + o.write_shift(2, 0x01); + return o; + } + + /* [MS-XLS] 2.4.50 ClrtClient */ + function parse_ClrtClient(blob) { + var ccv = blob.read_shift(2); + var o = []; + while(ccv-->0) o.push(parse_LongRGB(blob, 8)); + return o; + } + + /* [MS-XLS] 2.4.188 */ + function parse_Palette(blob) { + var ccv = blob.read_shift(2); + var o = []; + while(ccv-->0) o.push(parse_LongRGB(blob, 8)); + return o; + } + + /* [MS-XLS] 2.4.354 */ + function parse_XFCRC(blob) { + blob.l += 2; + var o = {cxfs:0, crc:0}; + o.cxfs = blob.read_shift(2); + o.crc = blob.read_shift(4); + return o; + } + + /* [MS-XLS] 2.4.53 TODO: parse flags */ + /* [MS-XLSB] 2.4.323 TODO: parse flags */ + function parse_ColInfo(blob, length, opts) { + if(!opts.cellStyles) return parsenoop(blob, length); + var w = opts && opts.biff >= 12 ? 4 : 2; + var colFirst = blob.read_shift(w); + var colLast = blob.read_shift(w); + var coldx = blob.read_shift(w); + var ixfe = blob.read_shift(w); + var flags = blob.read_shift(2); + if(w == 2) blob.l += 2; + return {s:colFirst, e:colLast, w:coldx, ixfe:ixfe, flags:flags}; + } + + /* [MS-XLS] 2.4.257 */ + function parse_Setup(blob, length) { + var o = {}; + if(length < 32) return o; + blob.l += 16; + o.header = parse_Xnum(blob, 8); + o.footer = parse_Xnum(blob, 8); + blob.l += 2; + return o; + } + + /* [MS-XLS] 2.4.261 */ + function parse_ShtProps(blob, length, opts) { + var def = {area:false}; + if(opts.biff != 5) { blob.l += length; return def; } + var d = blob.read_shift(1); blob.l += 3; + if((d & 0x10)) def.area = true; + return def; + } + + /* [MS-XLS] 2.4.241 */ + function write_RRTabId(n) { + var out = new_buf(2 * n); + for(var i = 0; i < n; ++i) out.write_shift(2, i+1); + return out; + } + + var parse_Blank = parse_XLSCell; /* [MS-XLS] 2.4.20 Just the cell */ + var parse_Scl = parseuint16a; /* [MS-XLS] 2.4.247 num, den */ + var parse_String = parse_XLUnicodeString; /* [MS-XLS] 2.4.268 */ + + /* --- Specific to versions before BIFF8 --- */ + function parse_ImData(blob) { + var cf = blob.read_shift(2); + var env = blob.read_shift(2); + var lcb = blob.read_shift(4); + var o = {fmt:cf, env:env, len:lcb, data:blob.slice(blob.l,blob.l+lcb)}; + blob.l += lcb; + return o; + } + + /* BIFF2_??? where ??? is the name from [XLS] */ + function parse_BIFF2STR(blob, length, opts) { + var cell = parse_XLSCell(blob, 6); + ++blob.l; + var str = parse_XLUnicodeString2(blob, length-7, opts); + cell.t = 'str'; + cell.val = str; + return cell; + } + + function parse_BIFF2NUM(blob) { + var cell = parse_XLSCell(blob, 6); + ++blob.l; + var num = parse_Xnum(blob, 8); + cell.t = 'n'; + cell.val = num; + return cell; + } + function write_BIFF2NUM(r, c, val) { + var out = new_buf(15); + write_BIFF2Cell(out, r, c); + out.write_shift(8, val, 'f'); + return out; + } + + function parse_BIFF2INT(blob) { + var cell = parse_XLSCell(blob, 6); + ++blob.l; + var num = blob.read_shift(2); + cell.t = 'n'; + cell.val = num; + return cell; + } + function write_BIFF2INT(r, c, val) { + var out = new_buf(9); + write_BIFF2Cell(out, r, c); + out.write_shift(2, val); + return out; + } + + function parse_BIFF2STRING(blob) { + var cch = blob.read_shift(1); + if(cch === 0) { blob.l++; return ""; } + return blob.read_shift(cch, 'sbcs-cont'); + } + + /* TODO: convert to BIFF8 font struct */ + function parse_BIFF2FONTXTRA(blob, length) { + blob.l += 6; // unknown + blob.l += 2; // font weight "bls" + blob.l += 1; // charset + blob.l += 3; // unknown + blob.l += 1; // font family + blob.l += length - 13; + } + + /* TODO: parse rich text runs */ + function parse_RString(blob, length, opts) { + var end = blob.l + length; + var cell = parse_XLSCell(blob, 6); + var cch = blob.read_shift(2); + var str = parse_XLUnicodeStringNoCch(blob, cch, opts); + blob.l = end; + cell.t = 'str'; + cell.val = str; + return cell; + } + /* from js-harb (C) 2014-present SheetJS */ + var DBF = (function() { + var dbf_codepage_map = { + /* Code Pages Supported by Visual FoxPro */ + 0x01: 437, 0x02: 850, + 0x03: 1252, 0x04: 10000, + 0x64: 852, 0x65: 866, + 0x66: 865, 0x67: 861, + 0x68: 895, 0x69: 620, + 0x6A: 737, 0x6B: 857, + 0x78: 950, 0x79: 949, + 0x7A: 936, 0x7B: 932, + 0x7C: 874, 0x7D: 1255, + 0x7E: 1256, 0x96: 10007, + 0x97: 10029, 0x98: 10006, + 0xC8: 1250, 0xC9: 1251, + 0xCA: 1254, 0xCB: 1253, + + /* shapefile DBF extension */ + 0x00: 20127, 0x08: 865, + 0x09: 437, 0x0A: 850, + 0x0B: 437, 0x0D: 437, + 0x0E: 850, 0x0F: 437, + 0x10: 850, 0x11: 437, + 0x12: 850, 0x13: 932, + 0x14: 850, 0x15: 437, + 0x16: 850, 0x17: 865, + 0x18: 437, 0x19: 437, + 0x1A: 850, 0x1B: 437, + 0x1C: 863, 0x1D: 850, + 0x1F: 852, 0x22: 852, + 0x23: 852, 0x24: 860, + 0x25: 850, 0x26: 866, + 0x37: 850, 0x40: 852, + 0x4D: 936, 0x4E: 949, + 0x4F: 950, 0x50: 874, + 0x57: 1252, 0x58: 1252, + 0x59: 1252, + + 0xFF: 16969 + }; + + /* TODO: find an actual specification */ + function dbf_to_aoa(buf, opts) { + var out = []; + /* TODO: browser based */ + var d = (new_raw_buf(1)); + switch(opts.type) { + case 'base64': d = s2a(Base64.decode(buf)); break; + case 'binary': d = s2a(buf); break; + case 'buffer': + case 'array': d = buf; break; + } + prep_blob(d, 0); + /* header */ + var ft = d.read_shift(1); + var memo = false; + var vfp = false, l7 = false; + switch(ft) { + case 0x02: case 0x03: break; + case 0x30: vfp = true; memo = true; break; + case 0x31: vfp = true; break; + case 0x83: memo = true; break; + case 0x8B: memo = true; break; + case 0x8C: memo = true; l7 = true; break; + case 0xF5: memo = true; break; + default: throw new Error("DBF Unsupported Version: " + ft.toString(16)); + } + var /*filedate = new Date(),*/ nrow = 0, fpos = 0; + if(ft == 0x02) nrow = d.read_shift(2); + /*filedate = new Date(d.read_shift(1) + 1900, d.read_shift(1) - 1, d.read_shift(1));*/d.l += 3; + if(ft != 0x02) nrow = d.read_shift(4); + if(ft != 0x02) fpos = d.read_shift(2); + var rlen = d.read_shift(2); + + var /*flags = 0,*/ current_cp = 1252; + if(ft != 0x02) { + d.l+=16; + /*flags = */d.read_shift(1); + //if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16)); + + /* codepage present in FoxPro */ + if(d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]]; + d.l+=1; + + d.l+=2; + } + if(l7) d.l += 36; + var fields = [], field = ({}); + var hend = fpos - 10 - (vfp ? 264 : 0), ww = l7 ? 32 : 11; + while(ft == 0x02 ? d.l < d.length && d[d.l] != 0x0d: d.l < hend) { + field = ({}); + field.name = cptable.utils.decode(current_cp, d.slice(d.l, d.l+ww)).replace(/[\u0000\r\n].*$/g,""); + d.l += ww; + field.type = String.fromCharCode(d.read_shift(1)); + if(ft != 0x02 && !l7) field.offset = d.read_shift(4); + field.len = d.read_shift(1); + if(ft == 0x02) field.offset = d.read_shift(2); + field.dec = d.read_shift(1); + if(field.name.length) fields.push(field); + if(ft != 0x02) d.l += l7 ? 13 : 14; + switch(field.type) { + case 'B': // VFP Double + if((!vfp || field.len != 8) && opts.WTF) console.log('Skipping ' + field.name + ':' + field.type); + break; + case 'G': // General + case 'P': // Picture + if(opts.WTF) console.log('Skipping ' + field.name + ':' + field.type); + break; + case 'C': // character + case 'D': // date + case 'F': // floating point + case 'I': // long + case 'L': // boolean + case 'M': // memo + case 'N': // number + case 'O': // double + case 'T': // datetime + case 'Y': // currency + case '0': // VFP _NullFlags + case '@': // timestamp + case '+': // autoincrement + break; + default: throw new Error('Unknown Field Type: ' + field.type); + } + } + if(d[d.l] !== 0x0D) d.l = fpos-1; + else if(ft == 0x02) d.l = 0x209; + if(ft != 0x02) { + if(d.read_shift(1) !== 0x0D) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]); + d.l = fpos; + } + /* data */ + var R = 0, C = 0; + out[0] = []; + for(C = 0; C != fields.length; ++C) out[0][C] = fields[C].name; + while(nrow-- > 0) { + if(d[d.l] === 0x2A) { d.l+=rlen; continue; } + ++d.l; + out[++R] = []; C = 0; + for(C = 0; C != fields.length; ++C) { + var dd = d.slice(d.l, d.l+fields[C].len); d.l+=fields[C].len; + prep_blob(dd, 0); + var s = cptable.utils.decode(current_cp, dd); + switch(fields[C].type) { + case 'C': + out[R][C] = cptable.utils.decode(current_cp, dd); + out[R][C] = out[R][C].trim(); + break; + case 'D': + if(s.length === 8) out[R][C] = new Date(+s.slice(0,4), +s.slice(4,6)-1, +s.slice(6,8)); + else out[R][C] = s; + break; + case 'F': out[R][C] = parseFloat(s.trim()); break; + case '+': case 'I': out[R][C] = l7 ? dd.read_shift(-4, 'i') ^ 0x80000000 : dd.read_shift(4, 'i'); break; + case 'L': switch(s.toUpperCase()) { + case 'Y': case 'T': out[R][C] = true; break; + case 'N': case 'F': out[R][C] = false; break; + case ' ': case '?': out[R][C] = false; break; /* NOTE: technically uninitialized */ + default: throw new Error("DBF Unrecognized L:|" + s + "|"); + } break; + case 'M': /* TODO: handle memo files */ + if(!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16)); + out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10): dd.read_shift(4)); + break; + case 'N': out[R][C] = +s.replace(/\u0000/g,"").trim(); break; + case '@': out[R][C] = new Date(dd.read_shift(-8, 'f') - 0x388317533400); break; + case 'T': out[R][C] = new Date((dd.read_shift(4) - 0x253D8C) * 0x5265C00 + dd.read_shift(4)); break; + case 'Y': out[R][C] = dd.read_shift(4,'i')/1e4; break; + case 'O': out[R][C] = -dd.read_shift(-8, 'f'); break; + case 'B': if(vfp && fields[C].len == 8) { out[R][C] = dd.read_shift(8,'f'); break; } + /* falls through */ + case 'G': case 'P': dd.l += fields[C].len; break; + case '0': + if(fields[C].name === '_NullFlags') break; + /* falls through */ + default: throw new Error("DBF Unsupported data type " + fields[C].type); + } + } + } + if(ft != 0x02) if(d.l < d.length && d[d.l++] != 0x1A) throw new Error("DBF EOF Marker missing " + (d.l-1) + " of " + d.length + " " + d[d.l-1].toString(16)); + if(opts && opts.sheetRows) out = out.slice(0, opts.sheetRows); + return out; + } + + function dbf_to_sheet(buf, opts) { + var o = opts || {}; + if(!o.dateNF) o.dateNF = "yyyymmdd"; + return aoa_to_sheet(dbf_to_aoa(buf, o), o); + } + + function dbf_to_workbook(buf, opts) { + try { return sheet_to_workbook(dbf_to_sheet(buf, opts), opts); } + catch(e) { if(opts && opts.WTF) throw e; } + return ({SheetNames:[],Sheets:{}}); + } + + var _RLEN = { 'B': 8, 'C': 250, 'L': 1, 'D': 8, '?': 0, '': 0 }; + function sheet_to_dbf(ws, opts) { + var o = opts || {}; + if(o.type == "string") throw new Error("Cannot write DBF to JS string"); + var ba = buf_array(); + var aoa = sheet_to_json(ws, {header:1, cellDates:true}); + var headers = aoa[0], data = aoa.slice(1); + var i = 0, j = 0, hcnt = 0, rlen = 1; + for(i = 0; i < headers.length; ++i) { + if(i == null) continue; + ++hcnt; + if(typeof headers[i] === 'number') headers[i] = headers[i].toString(10); + if(typeof headers[i] !== 'string') throw new Error("DBF Invalid column name " + headers[i] + " |" + (typeof headers[i]) + "|"); + if(headers.indexOf(headers[i]) !== i) for(j=0; j<1024;++j) + if(headers.indexOf(headers[i] + "_" + j) == -1) { headers[i] += "_" + j; break; } + } + var range = safe_decode_range(ws['!ref']); + var coltypes = []; + for(i = 0; i <= range.e.c - range.s.c; ++i) { + var col = []; + for(j=0; j < data.length; ++j) { + if(data[j][i] != null) col.push(data[j][i]); + } + if(col.length == 0 || headers[i] == null) { coltypes[i] = '?'; continue; } + var guess = '', _guess = ''; + for(j = 0; j < col.length; ++j) { + switch(typeof col[j]) { + /* TODO: check if L2 compat is desired */ + case 'number': _guess = 'B'; break; + case 'string': _guess = 'C'; break; + case 'boolean': _guess = 'L'; break; + case 'object': _guess = col[j] instanceof Date ? 'D' : 'C'; break; + default: _guess = 'C'; + } + guess = guess && guess != _guess ? 'C' : _guess; + if(guess == 'C') break; + } + rlen += _RLEN[guess] || 0; + coltypes[i] = guess; + } + + var h = ba.next(32); + h.write_shift(4, 0x13021130); + h.write_shift(4, data.length); + h.write_shift(2, 296 + 32 * hcnt); + h.write_shift(2, rlen); + for(i=0; i < 4; ++i) h.write_shift(4, 0); + h.write_shift(4, 0x00000300); // TODO: CP + + for(i = 0, j = 0; i < headers.length; ++i) { + if(headers[i] == null) continue; + var hf = ba.next(32); + var _f = (headers[i].slice(-10) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00").slice(0, 11); + hf.write_shift(1, _f, "sbcs"); + hf.write_shift(1, coltypes[i] == '?' ? 'C' : coltypes[i], "sbcs"); + hf.write_shift(4, j); + hf.write_shift(1, _RLEN[coltypes[i]] || 0); + hf.write_shift(1, 0); + hf.write_shift(1, 0x02); + hf.write_shift(4, 0); + hf.write_shift(1, 0); + hf.write_shift(4, 0); + hf.write_shift(4, 0); + j += _RLEN[coltypes[i]] || 0; + } + + var hb = ba.next(264); + hb.write_shift(4, 0x0000000D); + for(i=0; i < 65;++i) hb.write_shift(4, 0x00000000); + for(i=0; i < data.length; ++i) { + var rout = ba.next(rlen); + rout.write_shift(1, 0); + for(j=0; j 0) switch(RT) { + case 'ID': break; /* header */ + case 'E': break; /* EOF */ + case 'B': break; /* dimensions */ + case 'O': break; /* options? */ + case 'P': + if(record[1].charAt(0) == 'P') + formats.push(rstr.slice(3).replace(/;;/g, ";")); + break; + case 'C': + var C_seen_K = false, C_seen_X = false; + for(rj=1; rj 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); } + else if(Mval === 0) rowinfo[R].hidden = true; + break; + default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr); + } + if(F_seen < 1) next_cell_format = null; break; + default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr); + } + } + if(rowinfo.length > 0) sht['!rows'] = rowinfo; + if(colinfo.length > 0) sht['!cols'] = colinfo; + if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); + return [arr, sht]; + } + + function sylk_to_sheet(d, opts) { + var aoasht = sylk_to_aoa(d, opts); + var aoa = aoasht[0], ws = aoasht[1]; + var o = aoa_to_sheet(aoa, opts); + keys(ws).forEach(function(k) { o[k] = ws[k]; }); + return o; + } + + function sylk_to_workbook(d, opts) { return sheet_to_workbook(sylk_to_sheet(d, opts), opts); } + + function write_ws_cell_sylk(cell, ws, R, C) { + var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K"; + switch(cell.t) { + case 'n': + o += (cell.v||0); + if(cell.f && !cell.F) o += ";E" + a1_to_rc(cell.f, {r:R, c:C}); break; + case 'b': o += cell.v ? "TRUE" : "FALSE"; break; + case 'e': o += cell.w || cell.v; break; + case 'd': o += '"' + (cell.w || cell.v) + '"'; break; + case 's': o += '"' + cell.v.replace(/"/g,"") + '"'; break; + } + return o; + } + + function write_ws_cols_sylk(out, cols) { + cols.forEach(function(col, i) { + var rec = "F;W" + (i+1) + " " + (i+1) + " "; + if(col.hidden) rec += "0"; + else { + if(typeof col.width == 'number') col.wpx = width2px(col.width); + if(typeof col.wpx == 'number') col.wch = px2char(col.wpx); + if(typeof col.wch == 'number') rec += Math.round(col.wch); + } + if(rec.charAt(rec.length - 1) != " ") out.push(rec); + }); + } + + function write_ws_rows_sylk(out, rows) { + rows.forEach(function(row, i) { + var rec = "F;"; + if(row.hidden) rec += "M0;"; + else if(row.hpt) rec += "M" + 20 * row.hpt + ";"; + else if(row.hpx) rec += "M" + 20 * px2pt(row.hpx) + ";"; + if(rec.length > 2) out.push(rec + "R" + (i+1)); + }); + } + + function sheet_to_sylk(ws, opts) { + var preamble = ["ID;PWXL;N;E"], o = []; + var r = safe_decode_range(ws['!ref']), cell; + var dense = Array.isArray(ws); + var RS = "\r\n"; + + preamble.push("P;PGeneral"); + preamble.push("F;P0;DG0G8;M255"); + if(ws['!cols']) write_ws_cols_sylk(preamble, ws['!cols']); + if(ws['!rows']) write_ws_rows_sylk(preamble, ws['!rows']); + + preamble.push("B;Y" + (r.e.r - r.s.r + 1) + ";X" + (r.e.c - r.s.c + 1) + ";D" + [r.s.c,r.s.r,r.e.c,r.e.r].join(" ")); + for(var R = r.s.r; R <= r.e.r; ++R) { + for(var C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({r:R,c:C}); + cell = dense ? (ws[R]||[])[C]: ws[coord]; + if(!cell || (cell.v == null && (!cell.f || cell.F))) continue; + o.push(write_ws_cell_sylk(cell, ws, R, C, opts)); + } + } + return preamble.join(RS) + RS + o.join(RS) + RS + "E" + RS; + } + + return { + to_workbook: sylk_to_workbook, + to_sheet: sylk_to_sheet, + from_sheet: sheet_to_sylk + }; + })(); + + var DIF = (function() { + function dif_to_aoa(d, opts) { + switch(opts.type) { + case 'base64': return dif_to_aoa_str(Base64.decode(d), opts); + case 'binary': return dif_to_aoa_str(d, opts); + case 'buffer': return dif_to_aoa_str(d.toString('binary'), opts); + case 'array': return dif_to_aoa_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); + } + function dif_to_aoa_str(str, opts) { + var records = str.split('\n'), R = -1, C = -1, ri = 0, arr = []; + for (; ri !== records.length; ++ri) { + if (records[ri].trim() === 'BOT') { arr[++R] = []; C = 0; continue; } + if (R < 0) continue; + var metadata = records[ri].trim().split(","); + var type = metadata[0], value = metadata[1]; + ++ri; + var data = records[ri].trim(); + switch (+type) { + case -1: + if (data === 'BOT') { arr[++R] = []; C = 0; continue; } + else if (data !== 'EOD') throw new Error("Unrecognized DIF special command " + data); + break; + case 0: + if(data === 'TRUE') arr[R][C] = true; + else if(data === 'FALSE') arr[R][C] = false; + else if(!isNaN(fuzzynum(value))) arr[R][C] = fuzzynum(value); + else if(!isNaN(fuzzydate(value).getDate())) arr[R][C] = parseDate(value); + else arr[R][C] = value; + ++C; break; + case 1: + data = data.slice(1,data.length-1); + arr[R][C++] = data !== '' ? data : null; + break; + } + if (data === 'EOD') break; + } + if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); + return arr; + } + + function dif_to_sheet(str, opts) { return aoa_to_sheet(dif_to_aoa(str, opts), opts); } + function dif_to_workbook(str, opts) { return sheet_to_workbook(dif_to_sheet(str, opts), opts); } + + var sheet_to_dif = (function() { + var push_field = function pf(o, topic, v, n, s) { + o.push(topic); + o.push(v + "," + n); + o.push('"' + s.replace(/"/g,'""') + '"'); + }; + var push_value = function po(o, type, v, s) { + o.push(type + "," + v); + o.push(type == 1 ? '"' + s.replace(/"/g,'""') + '"' : s); + }; + return function sheet_to_dif(ws) { + var o = []; + var r = safe_decode_range(ws['!ref']), cell; + var dense = Array.isArray(ws); + push_field(o, "TABLE", 0, 1, "sheetjs"); + push_field(o, "VECTORS", 0, r.e.r - r.s.r + 1,""); + push_field(o, "TUPLES", 0, r.e.c - r.s.c + 1,""); + push_field(o, "DATA", 0, 0,""); + for(var R = r.s.r; R <= r.e.r; ++R) { + push_value(o, -1, 0, "BOT"); + for(var C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({r:R,c:C}); + cell = dense ? (ws[R]||[])[C] : ws[coord]; + if(!cell) { push_value(o, 1, 0, ""); continue;} + switch(cell.t) { + case 'n': + var val = DIF_XL ? cell.w : cell.v; + if(!val && cell.v != null) val = cell.v; + if(val == null) { + if(DIF_XL && cell.f && !cell.F) push_value(o, 1, 0, "=" + cell.f); + else push_value(o, 1, 0, ""); + } + else push_value(o, 0, val, "V"); + break; + case 'b': + push_value(o, 0, cell.v ? 1 : 0, cell.v ? "TRUE" : "FALSE"); + break; + case 's': + push_value(o, 1, 0, (!DIF_XL || isNaN(cell.v)) ? cell.v : '="' + cell.v + '"'); + break; + case 'd': + if(!cell.w) cell.w = SSF.format(cell.z || SSF._table[14], datenum(parseDate(cell.v))); + if(DIF_XL) push_value(o, 0, cell.w, "V"); + else push_value(o, 1, 0, cell.w); + break; + default: push_value(o, 1, 0, ""); + } + } + } + push_value(o, -1, 0, "EOD"); + var RS = "\r\n"; + var oo = o.join(RS); + //while((oo.length & 0x7F) != 0) oo += "\0"; + return oo; + }; + })(); + return { + to_workbook: dif_to_workbook, + to_sheet: dif_to_sheet, + from_sheet: sheet_to_dif + }; + })(); + + var ETH = (function() { + function decode(s) { return s.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,"\n"); } + function encode(s) { return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g,"\\n"); } + + function eth_to_aoa(str, opts) { + var records = str.split('\n'), R = -1, C = -1, ri = 0, arr = []; + for (; ri !== records.length; ++ri) { + var record = records[ri].trim().split(":"); + if(record[0] !== 'cell') continue; + var addr = decode_cell(record[1]); + if(arr.length <= addr.r) for(R = arr.length; R <= addr.r; ++R) if(!arr[R]) arr[R] = []; + R = addr.r; C = addr.c; + switch(record[2]) { + case 't': arr[R][C] = decode(record[3]); break; + case 'v': arr[R][C] = +record[3]; break; + case 'vtf': var _f = record[record.length - 1]; + /* falls through */ + case 'vtc': + switch(record[3]) { + case 'nl': arr[R][C] = +record[4] ? true : false; break; + default: arr[R][C] = +record[4]; break; + } + if(record[2] == 'vtf') arr[R][C] = [arr[R][C], _f]; + } + } + if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); + return arr; + } + + function eth_to_sheet(d, opts) { return aoa_to_sheet(eth_to_aoa(d, opts), opts); } + function eth_to_workbook(d, opts) { return sheet_to_workbook(eth_to_sheet(d, opts), opts); } + + var header = [ + "socialcalc:version:1.5", + "MIME-Version: 1.0", + "Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave" + ].join("\n"); + + var sep = [ + "--SocialCalcSpreadsheetControlSave", + "Content-type: text/plain; charset=UTF-8" + ].join("\n") + "\n"; + + /* TODO: the other parts */ + var meta = [ + "# SocialCalc Spreadsheet Control Save", + "part:sheet" + ].join("\n"); + + var end = "--SocialCalcSpreadsheetControlSave--"; + + function sheet_to_eth_data(ws) { + if(!ws || !ws['!ref']) return ""; + var o = [], oo = [], cell, coord = ""; + var r = decode_range(ws['!ref']); + var dense = Array.isArray(ws); + for(var R = r.s.r; R <= r.e.r; ++R) { + for(var C = r.s.c; C <= r.e.c; ++C) { + coord = encode_cell({r:R,c:C}); + cell = dense ? (ws[R]||[])[C] : ws[coord]; + if(!cell || cell.v == null || cell.t === 'z') continue; + oo = ["cell", coord, 't']; + switch(cell.t) { + case 's': case 'str': oo.push(encode(cell.v)); break; + case 'n': + if(!cell.f) { oo[2]='v'; oo[3]=cell.v; } + else { oo[2]='vtf'; oo[3]='n'; oo[4]=cell.v; oo[5]=encode(cell.f); } + break; + case 'b': + oo[2] = 'vt'+(cell.f?'f':'c'); oo[3]='nl'; oo[4]=cell.v?"1":"0"; + oo[5] = encode(cell.f||(cell.v?'TRUE':'FALSE')); + break; + case 'd': + var t = datenum(parseDate(cell.v)); + oo[2] = 'vtc'; oo[3] = 'nd'; oo[4] = ""+t; + oo[5] = cell.w || SSF.format(cell.z || SSF._table[14], t); + break; + case 'e': continue; + } + o.push(oo.join(":")); + } + } + o.push("sheet:c:" + (r.e.c-r.s.c+1) + ":r:" + (r.e.r-r.s.r+1) + ":tvf:1"); + o.push("valueformat:1:text-wiki"); + //o.push("copiedfrom:" + ws['!ref']); // clipboard only + return o.join("\n"); + } + + function sheet_to_eth(ws) { + return [header, sep, meta, sep, sheet_to_eth_data(ws), end].join("\n"); + // return ["version:1.5", sheet_to_eth_data(ws)].join("\n"); // clipboard form + } + + return { + to_workbook: eth_to_workbook, + to_sheet: eth_to_sheet, + from_sheet: sheet_to_eth + }; + })(); + + var PRN = (function() { + function set_text_arr(data, arr, R, C, o) { + if(o.raw) arr[R][C] = data; + else if(data === 'TRUE') arr[R][C] = true; + else if(data === 'FALSE') arr[R][C] = false; + else if(data === ""){/* empty */} + else if(!isNaN(fuzzynum(data))) arr[R][C] = fuzzynum(data); + else if(!isNaN(fuzzydate(data).getDate())) arr[R][C] = parseDate(data); + else arr[R][C] = data; + } + + function prn_to_aoa_str(f, opts) { + var o = opts || {}; + var arr = ([]); + if(!f || f.length === 0) return arr; + var lines = f.split(/[\r\n]/); + var L = lines.length - 1; + while(L >= 0 && lines[L].length === 0) --L; + var start = 10, idx = 0; + var R = 0; + for(; R <= L; ++R) { + idx = lines[R].indexOf(" "); + if(idx == -1) idx = lines[R].length; else idx++; + start = Math.max(start, idx); + } + for(R = 0; R <= L; ++R) { + arr[R] = []; + /* TODO: confirm that widths are always 10 */ + var C = 0; + set_text_arr(lines[R].slice(0, start).trim(), arr, R, C, o); + for(C = 1; C <= (lines[R].length - start)/10 + 1; ++C) + set_text_arr(lines[R].slice(start+(C-1)*10,start+C*10).trim(),arr,R,C,o); + } + if(o.sheetRows) arr = arr.slice(0, o.sheetRows); + return arr; + } + + // List of accepted CSV separators + var guess_seps = { + 0x2C: ',', + 0x09: "\t", + 0x3B: ';' + }; + + // CSV separator weights to be used in case of equal numbers + var guess_sep_weights = { + 0x2C: 3, + 0x09: 2, + 0x3B: 1 + }; + + function guess_sep(str) { + var cnt = {}, instr = false, end = 0, cc = 0; + for(;end < str.length;++end) { + if((cc=str.charCodeAt(end)) == 0x22) instr = !instr; + else if(!instr && cc in guess_seps) cnt[cc] = (cnt[cc]||0)+1; + } + + cc = []; + for(end in cnt) if ( cnt.hasOwnProperty(end) ) { + cc.push([ cnt[end], end ]); + } + + if ( !cc.length ) { + cnt = guess_sep_weights; + for(end in cnt) if ( cnt.hasOwnProperty(end) ) { + cc.push([ cnt[end], end ]); + } + } + + cc.sort(function(a, b) { return a[0] - b[0] || guess_sep_weights[a[1]] - guess_sep_weights[b[1]]; }); + + return guess_seps[cc.pop()[1]]; + } + + function dsv_to_sheet_str(str, opts) { + var o = opts || {}; + var sep = ""; + if(DENSE != null && o.dense == null) o.dense = DENSE; + var ws = o.dense ? ([]) : ({}); + var range = ({s: {c:0, r:0}, e: {c:0, r:0}}); + + if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); } + else sep = guess_sep(str.slice(0,1024)); + var R = 0, C = 0, v = 0; + var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0; + str = str.replace(/\r\n/mg, "\n"); + var _re = o.dateNF != null ? dateNF_regex(o.dateNF) : null; + function finish_cell() { + var s = str.slice(start, end); + var cell = ({}); + if(s.charAt(0) == '"' && s.charAt(s.length - 1) == '"') s = s.slice(1,-1).replace(/""/g,'"'); + if(s.length === 0) cell.t = 'z'; + else if(o.raw) { cell.t = 's'; cell.v = s; } + else if(s.trim().length === 0) { cell.t = 's'; cell.v = s; } + else if(s.charCodeAt(0) == 0x3D) { + if(s.charCodeAt(1) == 0x22 && s.charCodeAt(s.length - 1) == 0x22) { cell.t = 's'; cell.v = s.slice(2,-1).replace(/""/g,'"'); } + else if(fuzzyfmla(s)) { cell.t = 'n'; cell.f = s.slice(1); } + else { cell.t = 's'; cell.v = s; } } + else if(s == "TRUE") { cell.t = 'b'; cell.v = true; } + else if(s == "FALSE") { cell.t = 'b'; cell.v = false; } + else if(!isNaN(v = fuzzynum(s))) { cell.t = 'n'; if(o.cellText !== false) cell.w = s; cell.v = v; } + else if(!isNaN(fuzzydate(s).getDate()) || _re && s.match(_re)) { + cell.z = o.dateNF || SSF._table[14]; + var k = 0; + if(_re && s.match(_re)){ s=dateNF_fix(s, o.dateNF, (s.match(_re)||[])); k=1; } + if(o.cellDates) { cell.t = 'd'; cell.v = parseDate(s, k); } + else { cell.t = 'n'; cell.v = datenum(parseDate(s, k)); } + if(o.cellText !== false) cell.w = SSF.format(cell.z, cell.v instanceof Date ? datenum(cell.v):cell.v); + if(!o.cellNF) delete cell.z; + } else { + cell.t = 's'; + cell.v = s; + } + if(cell.t == 'z'){} + else if(o.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = cell; } + else ws[encode_cell({c:C,r:R})] = cell; + start = end+1; + if(range.e.c < C) range.e.c = C; + if(range.e.r < R) range.e.r = R; + if(cc == sepcc) ++C; else { C = 0; ++R; if(o.sheetRows && o.sheetRows <= R) return true; } + } + outer: for(;end < str.length;++end) switch((cc=str.charCodeAt(end))) { + case 0x22: instr = !instr; break; + case sepcc: case 0x0a: case 0x0d: if(!instr && finish_cell()) break outer; break; + default: break; + } + if(end - start > 0) finish_cell(); + + ws['!ref'] = encode_range(range); + return ws; + } + + function prn_to_sheet_str(str, opts) { + if(str.slice(0,4) == "sep=") return dsv_to_sheet_str(str, opts); + if(str.indexOf("\t") >= 0 || str.indexOf(",") >= 0 || str.indexOf(";") >= 0) return dsv_to_sheet_str(str, opts); + return aoa_to_sheet(prn_to_aoa_str(str, opts), opts); + } + + function prn_to_sheet(d, opts) { + var str = "", bytes = opts.type == 'string' ? [0,0,0,0] : firstbyte(d, opts); + switch(opts.type) { + case 'base64': str = Base64.decode(d); break; + case 'binary': str = d; break; + case 'buffer': + if(opts.codepage == 65001) str = d.toString('utf8'); + else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d); + else str = d.toString('binary'); + break; + case 'array': str = cc2str(d); break; + case 'string': str = d; break; + default: throw new Error("Unrecognized type " + opts.type); + } + if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3)); + else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str)); + if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts); + return prn_to_sheet_str(str, opts); + } + + function prn_to_workbook(d, opts) { return sheet_to_workbook(prn_to_sheet(d, opts), opts); } + + function sheet_to_prn(ws) { + var o = []; + var r = safe_decode_range(ws['!ref']), cell; + var dense = Array.isArray(ws); + for(var R = r.s.r; R <= r.e.r; ++R) { + var oo = []; + for(var C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({r:R,c:C}); + cell = dense ? (ws[R]||[])[C] : ws[coord]; + if(!cell || cell.v == null) { oo.push(" "); continue; } + var w = (cell.w || (format_cell(cell), cell.w) || "").slice(0,10); + while(w.length < 10) w += " "; + oo.push(w + (C === 0 ? " " : "")); + } + o.push(oo.join("")); + } + return o.join("\n"); + } + + return { + to_workbook: prn_to_workbook, + to_sheet: prn_to_sheet, + from_sheet: sheet_to_prn + }; + })(); + + /* Excel defaults to SYLK but warns if data is not valid */ + function read_wb_ID(d, opts) { + var o = opts || {}, OLD_WTF = !!o.WTF; o.WTF = true; + try { + var out = SYLK.to_workbook(d, o); + o.WTF = OLD_WTF; + return out; + } catch(e) { + o.WTF = OLD_WTF; + if(!e.message.match(/SYLK bad record ID/) && OLD_WTF) throw e; + return PRN.to_workbook(d, opts); + } + } + var WK_ = (function() { + function lotushopper(data, cb, opts) { + if(!data) return; + prep_blob(data, data.l || 0); + var Enum = opts.Enum || WK1Enum; + while(data.l < data.length) { + var RT = data.read_shift(2); + var R = Enum[RT] || Enum[0xFF]; + var length = data.read_shift(2); + var tgt = data.l + length; + var d = (R.f||parsenoop)(data, length, opts); + data.l = tgt; + if(cb(d, R.n, RT)) return; + } + } + + function lotus_to_workbook(d, opts) { + switch(opts.type) { + case 'base64': return lotus_to_workbook_buf(s2a(Base64.decode(d)), opts); + case 'binary': return lotus_to_workbook_buf(s2a(d), opts); + case 'buffer': + case 'array': return lotus_to_workbook_buf(d, opts); + } + throw "Unsupported type " + opts.type; + } + + function lotus_to_workbook_buf(d, opts) { + if(!d) return d; + var o = opts || {}; + if(DENSE != null && o.dense == null) o.dense = DENSE; + var s = ((o.dense ? [] : {})), n = "Sheet1", sidx = 0; + var sheets = {}, snames = [n]; + + var refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; + var sheetRows = o.sheetRows || 0; + + if(d[2] == 0x02) o.Enum = WK1Enum; + else if(d[2] == 0x1a) o.Enum = WK3Enum; + else if(d[2] == 0x0e) { o.Enum = WK3Enum; o.qpro = true; d.l = 0; } + else throw new Error("Unrecognized LOTUS BOF " + d[2]); + lotushopper(d, function(val, Rn, RT) { + if(d[2] == 0x02) switch(RT) { + case 0x00: + o.vers = val; + if(val >= 0x1000) o.qpro = true; + break; + case 0x06: refguess = val; break; /* RANGE */ + case 0x0F: /* LABEL */ + if(!o.qpro) val[1].v = val[1].v.slice(1); + /* falls through */ + case 0x0D: /* INTEGER */ + case 0x0E: /* NUMBER */ + case 0x10: /* FORMULA */ + case 0x33: /* STRING */ + /* TODO: actual translation of the format code */ + if(RT == 0x0E && (val[2] & 0x70) == 0x70 && (val[2] & 0x0F) > 1 && (val[2] & 0x0F) < 15) { + val[1].z = o.dateNF || SSF._table[14]; + if(o.cellDates) { val[1].t = 'd'; val[1].v = numdate(val[1].v); } + } + if(o.dense) { + if(!s[val[0].r]) s[val[0].r] = []; + s[val[0].r][val[0].c] = val[1]; + } else s[encode_cell(val[0])] = val[1]; + break; + } else switch(RT) { + case 0x16: /* LABEL16 */ + val[1].v = val[1].v.slice(1); + /* falls through */ + case 0x17: /* NUMBER17 */ + case 0x18: /* NUMBER18 */ + case 0x19: /* FORMULA19 */ + case 0x25: /* NUMBER25 */ + case 0x27: /* NUMBER27 */ + case 0x28: /* FORMULA28 */ + if(val[3] > sidx) { + s["!ref"] = encode_range(refguess); + sheets[n] = s; + s = (o.dense ? [] : {}); + refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; + sidx = val[3]; n = "Sheet" + (sidx + 1); + snames.push(n); + } + if(sheetRows > 0 && val[0].r >= sheetRows) break; + if(o.dense) { + if(!s[val[0].r]) s[val[0].r] = []; + s[val[0].r][val[0].c] = val[1]; + } else s[encode_cell(val[0])] = val[1]; + if(refguess.e.c < val[0].c) refguess.e.c = val[0].c; + if(refguess.e.r < val[0].r) refguess.e.r = val[0].r; + break; + default: break; + } + }, o); + + s["!ref"] = encode_range(refguess); + sheets[n] = s; + return { SheetNames: snames, Sheets:sheets }; + } + + function parse_RANGE(blob) { + var o = {s:{c:0,r:0},e:{c:0,r:0}}; + o.s.c = blob.read_shift(2); + o.s.r = blob.read_shift(2); + o.e.c = blob.read_shift(2); + o.e.r = blob.read_shift(2); + if(o.s.c == 0xFFFF) o.s.c = o.e.c = o.s.r = o.e.r = 0; + return o; + } + + function parse_cell(blob, length, opts) { + var o = [{c:0,r:0}, {t:'n',v:0}, 0]; + if(opts.qpro && opts.vers != 0x5120) { + o[0].c = blob.read_shift(1); + blob.l++; + o[0].r = blob.read_shift(2); + blob.l+=2; + } else { + o[2] = blob.read_shift(1); + o[0].c = blob.read_shift(2); o[0].r = blob.read_shift(2); + } + return o; + } + + function parse_LABEL(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + o[1].t = 's'; + if(opts.vers == 0x5120) { + blob.l++; + var len = blob.read_shift(1); + o[1].v = blob.read_shift(len, 'utf8'); + return o; + } + if(opts.qpro) blob.l++; + o[1].v = blob.read_shift(tgt - blob.l, 'cstr'); + return o; + } + + function parse_INTEGER(blob, length, opts) { + var o = parse_cell(blob, length, opts); + o[1].v = blob.read_shift(2, 'i'); + return o; + } + + function parse_NUMBER(blob, length, opts) { + var o = parse_cell(blob, length, opts); + o[1].v = blob.read_shift(8, 'f'); + return o; + } + + function parse_FORMULA(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + /* TODO: formula */ + o[1].v = blob.read_shift(8, 'f'); + if(opts.qpro) blob.l = tgt; + else { + var flen = blob.read_shift(2); + blob.l += flen; + } + return o; + } + + function parse_cell_3(blob) { + var o = [{c:0,r:0}, {t:'n',v:0}, 0]; + o[0].r = blob.read_shift(2); o[3] = blob[blob.l++]; o[0].c = blob[blob.l++]; + return o; + } + + function parse_LABEL_16(blob, length) { + var o = parse_cell_3(blob, length); + o[1].t = 's'; + o[1].v = blob.read_shift(length - 4, 'cstr'); + return o; + } + + function parse_NUMBER_18(blob, length) { + var o = parse_cell_3(blob, length); + o[1].v = blob.read_shift(2); + var v = o[1].v >> 1; + /* TODO: figure out all of the corner cases */ + if(o[1].v & 0x1) { + switch(v & 0x07) { + case 1: v = (v >> 3) * 500; break; + case 2: v = (v >> 3) / 20; break; + case 4: v = (v >> 3) / 2000; break; + case 6: v = (v >> 3) / 16; break; + case 7: v = (v >> 3) / 64; break; + default: throw "unknown NUMBER_18 encoding " + (v & 0x07); + } + } + o[1].v = v; + return o; + } + + function parse_NUMBER_17(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(4); + var v2 = blob.read_shift(4); + var e = blob.read_shift(2); + if(e == 0xFFFF) { o[1].v = 0; return o; } + var s = e & 0x8000; e = (e&0x7FFF) - 16446; + o[1].v = (s*2 - 1) * ((e > 0 ? (v2 << e) : (v2 >>> -e)) + (e > -32 ? (v1 << (e + 32)) : (v1 >>> -(e + 32)))); + return o; + } + + function parse_FORMULA_19(blob, length) { + var o = parse_NUMBER_17(blob, 14); + blob.l += length - 14; /* TODO: formula */ + return o; + } + + function parse_NUMBER_25(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(4); + o[1].v = v1 >> 6; + return o; + } + + function parse_NUMBER_27(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(8,'f'); + o[1].v = v1; + return o; + } + + function parse_FORMULA_28(blob, length) { + var o = parse_NUMBER_27(blob, 14); + blob.l += length - 10; /* TODO: formula */ + return o; + } + + var WK1Enum = { + 0x0000: { n:"BOF", f:parseuint16 }, + 0x0001: { n:"EOF" }, + 0x0002: { n:"CALCMODE" }, + 0x0003: { n:"CALCORDER" }, + 0x0004: { n:"SPLIT" }, + 0x0005: { n:"SYNC" }, + 0x0006: { n:"RANGE", f:parse_RANGE }, + 0x0007: { n:"WINDOW1" }, + 0x0008: { n:"COLW1" }, + 0x0009: { n:"WINTWO" }, + 0x000A: { n:"COLW2" }, + 0x000B: { n:"NAME" }, + 0x000C: { n:"BLANK" }, + 0x000D: { n:"INTEGER", f:parse_INTEGER }, + 0x000E: { n:"NUMBER", f:parse_NUMBER }, + 0x000F: { n:"LABEL", f:parse_LABEL }, + 0x0010: { n:"FORMULA", f:parse_FORMULA }, + 0x0018: { n:"TABLE" }, + 0x0019: { n:"ORANGE" }, + 0x001A: { n:"PRANGE" }, + 0x001B: { n:"SRANGE" }, + 0x001C: { n:"FRANGE" }, + 0x001D: { n:"KRANGE1" }, + 0x0020: { n:"HRANGE" }, + 0x0023: { n:"KRANGE2" }, + 0x0024: { n:"PROTEC" }, + 0x0025: { n:"FOOTER" }, + 0x0026: { n:"HEADER" }, + 0x0027: { n:"SETUP" }, + 0x0028: { n:"MARGINS" }, + 0x0029: { n:"LABELFMT" }, + 0x002A: { n:"TITLES" }, + 0x002B: { n:"SHEETJS" }, + 0x002D: { n:"GRAPH" }, + 0x002E: { n:"NGRAPH" }, + 0x002F: { n:"CALCCOUNT" }, + 0x0030: { n:"UNFORMATTED" }, + 0x0031: { n:"CURSORW12" }, + 0x0032: { n:"WINDOW" }, + 0x0033: { n:"STRING", f:parse_LABEL }, + 0x0037: { n:"PASSWORD" }, + 0x0038: { n:"LOCKED" }, + 0x003C: { n:"QUERY" }, + 0x003D: { n:"QUERYNAME" }, + 0x003E: { n:"PRINT" }, + 0x003F: { n:"PRINTNAME" }, + 0x0040: { n:"GRAPH2" }, + 0x0041: { n:"GRAPHNAME" }, + 0x0042: { n:"ZOOM" }, + 0x0043: { n:"SYMSPLIT" }, + 0x0044: { n:"NSROWS" }, + 0x0045: { n:"NSCOLS" }, + 0x0046: { n:"RULER" }, + 0x0047: { n:"NNAME" }, + 0x0048: { n:"ACOMM" }, + 0x0049: { n:"AMACRO" }, + 0x004A: { n:"PARSE" }, + 0x00FF: { n:"", f:parsenoop } + }; + + var WK3Enum = { + 0x0000: { n:"BOF" }, + 0x0001: { n:"EOF" }, + 0x0003: { n:"??" }, + 0x0004: { n:"??" }, + 0x0005: { n:"??" }, + 0x0006: { n:"??" }, + 0x0007: { n:"??" }, + 0x0009: { n:"??" }, + 0x000a: { n:"??" }, + 0x000b: { n:"??" }, + 0x000c: { n:"??" }, + 0x000e: { n:"??" }, + 0x000f: { n:"??" }, + 0x0010: { n:"??" }, + 0x0011: { n:"??" }, + 0x0012: { n:"??" }, + 0x0013: { n:"??" }, + 0x0015: { n:"??" }, + 0x0016: { n:"LABEL16", f:parse_LABEL_16}, + 0x0017: { n:"NUMBER17", f:parse_NUMBER_17 }, + 0x0018: { n:"NUMBER18", f:parse_NUMBER_18 }, + 0x0019: { n:"FORMULA19", f:parse_FORMULA_19}, + 0x001a: { n:"??" }, + 0x001b: { n:"??" }, + 0x001c: { n:"??" }, + 0x001d: { n:"??" }, + 0x001e: { n:"??" }, + 0x001f: { n:"??" }, + 0x0021: { n:"??" }, + 0x0025: { n:"NUMBER25", f:parse_NUMBER_25 }, + 0x0027: { n:"NUMBER27", f:parse_NUMBER_27 }, + 0x0028: { n:"FORMULA28", f:parse_FORMULA_28 }, + 0x00FF: { n:"", f:parsenoop } + }; + return { + to_workbook: lotus_to_workbook + }; + })(); + /* Parse a list of tags */ + var parse_rs = (function parse_rs_factory() { + var tregex = matchtag("t"), rpregex = matchtag("rPr"), rregex = /<(?:\w+:)?r>/g, rend = /<\/(?:\w+:)?r>/, nlregex = /\r\n/g; + /* 18.4.7 rPr CT_RPrElt */ + var parse_rpr = function parse_rpr(rpr, intro, outro) { + var font = {}, cp = 65001, align = ""; + var pass = false; + var m = rpr.match(tagregex), i = 0; + if(m) for(;i!=m.length; ++i) { + var y = parsexmltag(m[i]); + switch(y[0].replace(/\w*:/g,"")) { + /* 18.8.12 condense CT_BooleanProperty */ + /* ** not required . */ + case '': + case '': font.shadow = 1; break; + case '': break; + + /* 18.4.1 charset CT_IntProperty TODO */ + case '': + case '': font.outline = 1; break; + case '': break; + + /* 18.4.5 rFont CT_FontName */ + case '': + case '': font.strike = 1; break; + case '': break; + + /* 18.4.13 u CT_UnderlineProperty */ + case '': + case '': font.u = 1; break; + case '': break; + + /* 18.8.2 b */ + case '': + case '': font.b = 1; break; + case '': break; + + /* 18.8.26 i */ + case '': + case '': font.i = 1; break; + case '': break; + + /* 18.3.1.15 color CT_Color TODO: tint, theme, auto, indexed */ + case '': case '': break; + case '': pass = false; break; + default: + if(y[0].charCodeAt(1) !== 47 && !pass) throw new Error('Unrecognized rich format ' + y[0]); + } + } + var style = []; + + if(font.u) style.push("text-decoration: underline;"); + if(font.uval) style.push("text-underline-style:" + font.uval + ";"); + if(font.sz) style.push("font-size:" + font.sz + "pt;"); + if(font.outline) style.push("text-effect: outline;"); + if(font.shadow) style.push("text-shadow: auto;"); + intro.push(''); + + if(font.b) { intro.push(""); outro.push(""); } + if(font.i) { intro.push(""); outro.push(""); } + if(font.strike) { intro.push(""); outro.push(""); } + + if(align == "superscript") align = "sup"; + else if(align == "subscript") align = "sub"; + if(align != "") { intro.push("<" + align + ">"); outro.push(""); } + + outro.push(""); + return cp; + }; + + /* 18.4.4 r CT_RElt */ + function parse_r(r) { + var terms = [[],"",[]]; + /* 18.4.12 t ST_Xstring */ + var t = r.match(tregex)/*, cp = 65001*/; + if(!t) return ""; + terms[1] = t[1]; + + var rpr = r.match(rpregex); + if(rpr) /*cp = */parse_rpr(rpr[1], terms[0], terms[2]); + + return terms[0].join("") + terms[1].replace(nlregex,'
          ') + terms[2].join(""); + } + return function parse_rs(rs) { + return rs.replace(rregex,"").split(rend).map(parse_r).join(""); + }; + })(); + + /* 18.4.8 si CT_Rst */ + var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g, sirregex = /<(?:\w+:)?r>/; + var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g; + function parse_si(x, opts) { + var html = opts ? opts.cellHTML : true; + var z = {}; + if(!x) return null; + //var y; + /* 18.4.12 t ST_Xstring (Plaintext String) */ + // TODO: is whitespace actually valid here? + if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)) { + z.t = unescapexml(utf8read(x.slice(x.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")); + z.r = utf8read(x); + if(html) z.h = escapehtml(z.t); + } + /* 18.4.4 r CT_RElt (Rich Text Run) */ + else if((/*y = */x.match(sirregex))) { + z.r = utf8read(x); + z.t = unescapexml(utf8read((x.replace(sirphregex, '').match(sitregex)||[]).join("").replace(tagregex,""))); + if(html) z.h = parse_rs(z.r); + } + /* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ + /* 18.4.6 rPh CT_PhoneticRun (TODO: needed for Asian support) */ + return z; + } + + /* 18.4 Shared String Table */ + var sstr0 = /<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/; + var sstr1 = /<(?:\w+:)?(?:si|sstItem)>/g; + var sstr2 = /<\/(?:\w+:)?(?:si|sstItem)>/; + function parse_sst_xml(data, opts) { + var s = ([]), ss = ""; + if(!data) return s; + /* 18.4.9 sst CT_Sst */ + var sst = data.match(sstr0); + if(sst) { + ss = sst[2].replace(sstr1,"").split(sstr2); + for(var i = 0; i != ss.length; ++i) { + var o = parse_si(ss[i].trim(), opts); + if(o != null) s[s.length] = o; + } + sst = parsexmltag(sst[1]); s.Count = sst.count; s.Unique = sst.uniqueCount; + } + return s; + } + + RELS.SST = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"; + var straywsregex = /^\s|\s$|[\t\n\r]/; + function write_sst_xml(sst, opts) { + if(!opts.bookSST) return ""; + var o = [XML_HEADER]; + o[o.length] = (writextag('sst', null, { + xmlns: XMLNS.main[0], + count: sst.Count, + uniqueCount: sst.Unique + })); + for(var i = 0; i != sst.length; ++i) { if(sst[i] == null) continue; + var s = sst[i]; + var sitag = ""; + if(s.r) sitag += s.r; + else { + sitag += ""; + } + sitag += ""; + o[o.length] = (sitag); + } + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* [MS-XLSB] 2.4.221 BrtBeginSst */ + function parse_BrtBeginSst(data) { + return [data.read_shift(4), data.read_shift(4)]; + } + + /* [MS-XLSB] 2.1.7.45 Shared Strings */ + function parse_sst_bin(data, opts) { + var s = ([]); + var pass = false; + recordhopper(data, function hopper_sst(val, R_n, RT) { + switch(RT) { + case 0x009F: /* 'BrtBeginSst' */ + s.Count = val[0]; s.Unique = val[1]; break; + case 0x0013: /* 'BrtSSTItem' */ + s.push(val); break; + case 0x00A0: /* 'BrtEndSst' */ + return true; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + + default: + if(R_n.indexOf("Begin") > 0){/* empty */} + else if(R_n.indexOf("End") > 0){/* empty */} + if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); + } + }); + return s; + } + + function write_BrtBeginSst(sst, o) { + if(!o) o = new_buf(8); + o.write_shift(4, sst.Count); + o.write_shift(4, sst.Unique); + return o; + } + + var write_BrtSSTItem = write_RichStr; + + function write_sst_bin(sst) { + var ba = buf_array(); + write_record(ba, "BrtBeginSst", write_BrtBeginSst(sst)); + for(var i = 0; i < sst.length; ++i) write_record(ba, "BrtSSTItem", write_BrtSSTItem(sst[i])); + /* FRTSST */ + write_record(ba, "BrtEndSst"); + return ba.end(); + } + function _JS2ANSI(str) { + if(typeof cptable !== 'undefined') return cptable.utils.encode(current_ansi, str); + var o = [], oo = str.split(""); + for(var i = 0; i < oo.length; ++i) o[i] = oo[i].charCodeAt(0); + return o; + } + + /* [MS-OFFCRYPTO] 2.1.4 Version */ + function parse_CRYPTOVersion(blob, length) { + var o = {}; + o.Major = blob.read_shift(2); + o.Minor = blob.read_shift(2); + if(length >= 4) blob.l += length - 4; + return o; + } + + /* [MS-OFFCRYPTO] 2.1.5 DataSpaceVersionInfo */ + function parse_DataSpaceVersionInfo(blob) { + var o = {}; + o.id = blob.read_shift(0, 'lpp4'); + o.R = parse_CRYPTOVersion(blob, 4); + o.U = parse_CRYPTOVersion(blob, 4); + o.W = parse_CRYPTOVersion(blob, 4); + return o; + } + + /* [MS-OFFCRYPTO] 2.1.6.1 DataSpaceMapEntry Structure */ + function parse_DataSpaceMapEntry(blob) { + var len = blob.read_shift(4); + var end = blob.l + len - 4; + var o = {}; + var cnt = blob.read_shift(4); + var comps = []; + /* [MS-OFFCRYPTO] 2.1.6.2 DataSpaceReferenceComponent Structure */ + while(cnt-- > 0) comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, 'lpp4') }); + o.name = blob.read_shift(0, 'lpp4'); + o.comps = comps; + if(blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end); + return o; + } + + /* [MS-OFFCRYPTO] 2.1.6 DataSpaceMap */ + function parse_DataSpaceMap(blob) { + var o = []; + blob.l += 4; // must be 0x8 + var cnt = blob.read_shift(4); + while(cnt-- > 0) o.push(parse_DataSpaceMapEntry(blob)); + return o; + } + + /* [MS-OFFCRYPTO] 2.1.7 DataSpaceDefinition */ + function parse_DataSpaceDefinition(blob) { + var o = []; + blob.l += 4; // must be 0x8 + var cnt = blob.read_shift(4); + while(cnt-- > 0) o.push(blob.read_shift(0, 'lpp4')); + return o; + } + + /* [MS-OFFCRYPTO] 2.1.8 DataSpaceDefinition */ + function parse_TransformInfoHeader(blob) { + var o = {}; + /*var len = */blob.read_shift(4); + blob.l += 4; // must be 0x1 + o.id = blob.read_shift(0, 'lpp4'); + o.name = blob.read_shift(0, 'lpp4'); + o.R = parse_CRYPTOVersion(blob, 4); + o.U = parse_CRYPTOVersion(blob, 4); + o.W = parse_CRYPTOVersion(blob, 4); + return o; + } + + function parse_Primary(blob) { + /* [MS-OFFCRYPTO] 2.2.6 IRMDSTransformInfo */ + var hdr = parse_TransformInfoHeader(blob); + /* [MS-OFFCRYPTO] 2.1.9 EncryptionTransformInfo */ + hdr.ename = blob.read_shift(0, '8lpp4'); + hdr.blksz = blob.read_shift(4); + hdr.cmode = blob.read_shift(4); + if(blob.read_shift(4) != 0x04) throw new Error("Bad !Primary record"); + return hdr; + } + + /* [MS-OFFCRYPTO] 2.3.2 Encryption Header */ + function parse_EncryptionHeader(blob, length) { + var tgt = blob.l + length; + var o = {}; + o.Flags = (blob.read_shift(4) & 0x3F); + blob.l += 4; + o.AlgID = blob.read_shift(4); + var valid = false; + switch(o.AlgID) { + case 0x660E: case 0x660F: case 0x6610: valid = (o.Flags == 0x24); break; + case 0x6801: valid = (o.Flags == 0x04); break; + case 0: valid = (o.Flags == 0x10 || o.Flags == 0x04 || o.Flags == 0x24); break; + default: throw 'Unrecognized encryption algorithm: ' + o.AlgID; + } + if(!valid) throw new Error("Encryption Flags/AlgID mismatch"); + o.AlgIDHash = blob.read_shift(4); + o.KeySize = blob.read_shift(4); + o.ProviderType = blob.read_shift(4); + blob.l += 8; + o.CSPName = blob.read_shift((tgt-blob.l)>>1, 'utf16le'); + blob.l = tgt; + return o; + } + + /* [MS-OFFCRYPTO] 2.3.3 Encryption Verifier */ + function parse_EncryptionVerifier(blob, length) { + var o = {}, tgt = blob.l + length; + blob.l += 4; // SaltSize must be 0x10 + o.Salt = blob.slice(blob.l, blob.l+16); blob.l += 16; + o.Verifier = blob.slice(blob.l, blob.l+16); blob.l += 16; + /*var sz = */blob.read_shift(4); + o.VerifierHash = blob.slice(blob.l, tgt); blob.l = tgt; + return o; + } + + /* [MS-OFFCRYPTO] 2.3.4.* EncryptionInfo Stream */ + function parse_EncryptionInfo(blob) { + var vers = parse_CRYPTOVersion(blob); + switch(vers.Minor) { + case 0x02: return [vers.Minor, parse_EncInfoStd(blob, vers)]; + case 0x03: return [vers.Minor, parse_EncInfoExt(blob, vers)]; + case 0x04: return [vers.Minor, parse_EncInfoAgl(blob, vers)]; + } + throw new Error("ECMA-376 Encrypted file unrecognized Version: " + vers.Minor); + } + + /* [MS-OFFCRYPTO] 2.3.4.5 EncryptionInfo Stream (Standard Encryption) */ + function parse_EncInfoStd(blob) { + var flags = blob.read_shift(4); + if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch"); + var sz = blob.read_shift(4); + //var tgt = blob.l + sz; + var hdr = parse_EncryptionHeader(blob, sz); + var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l); + return { t:"Std", h:hdr, v:verifier }; + } + /* [MS-OFFCRYPTO] 2.3.4.6 EncryptionInfo Stream (Extensible Encryption) */ + function parse_EncInfoExt() { throw new Error("File is password-protected: ECMA-376 Extensible"); } + /* [MS-OFFCRYPTO] 2.3.4.10 EncryptionInfo Stream (Agile Encryption) */ + function parse_EncInfoAgl(blob) { + var KeyData = ["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"]; + blob.l+=4; + var xml = blob.read_shift(blob.length - blob.l, 'utf8'); + var o = {}; + xml.replace(tagregex, function xml_agile(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': break; + case '': case '': break; + + case '': break; + case ' 4 || vers.Major < 2) throw new Error('unrecognized major version code: ' + vers.Major); + o.Flags = blob.read_shift(4); length -= 4; + var sz = blob.read_shift(4); length -= 4; + o.EncryptionHeader = parse_EncryptionHeader(blob, sz); length -= sz; + o.EncryptionVerifier = parse_EncryptionVerifier(blob, length); + return o; + } + /* [MS-OFFCRYPTO] 2.3.6.1 RC4 Encryption Header */ + function parse_RC4Header(blob) { + var o = {}; + var vers = o.EncryptionVersionInfo = parse_CRYPTOVersion(blob, 4); + if(vers.Major != 1 || vers.Minor != 1) throw 'unrecognized version code ' + vers.Major + ' : ' + vers.Minor; + o.Salt = blob.read_shift(16); + o.EncryptedVerifier = blob.read_shift(16); + o.EncryptedVerifierHash = blob.read_shift(16); + return o; + } + + /* [MS-OFFCRYPTO] 2.3.7.1 Binary Document Password Verifier Derivation */ + function crypto_CreatePasswordVerifier_Method1(Password) { + var Verifier = 0x0000, PasswordArray; + var PasswordDecoded = _JS2ANSI(Password); + var len = PasswordDecoded.length + 1, i, PasswordByte; + var Intermediate1, Intermediate2, Intermediate3; + PasswordArray = new_raw_buf(len); + PasswordArray[0] = PasswordDecoded.length; + for(i = 1; i != len; ++i) PasswordArray[i] = PasswordDecoded[i-1]; + for(i = len-1; i >= 0; --i) { + PasswordByte = PasswordArray[i]; + Intermediate1 = ((Verifier & 0x4000) === 0x0000) ? 0 : 1; + Intermediate2 = (Verifier << 1) & 0x7FFF; + Intermediate3 = Intermediate1 | Intermediate2; + Verifier = Intermediate3 ^ PasswordByte; + } + return Verifier ^ 0xCE4B; + } + + /* [MS-OFFCRYPTO] 2.3.7.2 Binary Document XOR Array Initialization */ + var crypto_CreateXorArray_Method1 = (function() { + var PadArray = [0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80, 0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00]; + var InitialCode = [0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE, 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A, 0x4EC3]; + var XorMatrix = [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09, 0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF, 0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0, 0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40, 0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5, 0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A, 0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9, 0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0, 0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC, 0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10, 0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168, 0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C, 0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD, 0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC, 0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4]; + var Ror = function(Byte) { return ((Byte/2) | (Byte*128)) & 0xFF; }; + var XorRor = function(byte1, byte2) { return Ror(byte1 ^ byte2); }; + var CreateXorKey_Method1 = function(Password) { + var XorKey = InitialCode[Password.length - 1]; + var CurrentElement = 0x68; + for(var i = Password.length-1; i >= 0; --i) { + var Char = Password[i]; + for(var j = 0; j != 7; ++j) { + if(Char & 0x40) XorKey ^= XorMatrix[CurrentElement]; + Char *= 2; --CurrentElement; + } + } + return XorKey; + }; + return function(password) { + var Password = _JS2ANSI(password); + var XorKey = CreateXorKey_Method1(Password); + var Index = Password.length; + var ObfuscationArray = new_raw_buf(16); + for(var i = 0; i != 16; ++i) ObfuscationArray[i] = 0x00; + var Temp, PasswordLastChar, PadIndex; + if((Index & 1) === 1) { + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(PadArray[0], Temp); + --Index; + Temp = XorKey & 0xFF; + PasswordLastChar = Password[Password.length - 1]; + ObfuscationArray[Index] = XorRor(PasswordLastChar, Temp); + } + while(Index > 0) { + --Index; + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + --Index; + Temp = XorKey & 0xFF; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + } + Index = 15; + PadIndex = 15 - Password.length; + while(PadIndex > 0) { + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(PadArray[PadIndex], Temp); + --Index; + --PadIndex; + Temp = XorKey & 0xFF; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + --Index; + --PadIndex; + } + return ObfuscationArray; + }; + })(); + + /* [MS-OFFCRYPTO] 2.3.7.3 Binary Document XOR Data Transformation Method 1 */ + var crypto_DecryptData_Method1 = function(password, Data, XorArrayIndex, XorArray, O) { + /* If XorArray is set, use it; if O is not set, make changes in-place */ + if(!O) O = Data; + if(!XorArray) XorArray = crypto_CreateXorArray_Method1(password); + var Index, Value; + for(Index = 0; Index != Data.length; ++Index) { + Value = Data[Index]; + Value ^= XorArray[XorArrayIndex]; + Value = ((Value>>5) | (Value<<3)) & 0xFF; + O[Index] = Value; + ++XorArrayIndex; + } + return [O, XorArrayIndex, XorArray]; + }; + + var crypto_MakeXorDecryptor = function(password) { + var XorArrayIndex = 0, XorArray = crypto_CreateXorArray_Method1(password); + return function(Data) { + var O = crypto_DecryptData_Method1("", Data, XorArrayIndex, XorArray); + XorArrayIndex = O[1]; + return O[0]; + }; + }; + + /* 2.5.343 */ + function parse_XORObfuscation(blob, length, opts, out) { + var o = ({ key: parseuint16(blob), verificationBytes: parseuint16(blob) }); + if(opts.password) o.verifier = crypto_CreatePasswordVerifier_Method1(opts.password); + out.valid = o.verificationBytes === o.verifier; + if(out.valid) out.insitu = crypto_MakeXorDecryptor(opts.password); + return o; + } + + /* 2.4.117 */ + function parse_FilePassHeader(blob, length, oo) { + var o = oo || {}; o.Info = blob.read_shift(2); blob.l -= 2; + if(o.Info === 1) o.Data = parse_RC4Header(blob, length); + else o.Data = parse_RC4CryptoHeader(blob, length); + return o; + } + function parse_FilePass(blob, length, opts) { + var o = ({ Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }); /* wEncryptionType */ + if(o.Type) parse_FilePassHeader(blob, length-2, o); + else parse_XORObfuscation(blob, opts.biff >= 8 ? length : length - 2, opts, o); + return o; + } + + + var RTF = (function() { + function rtf_to_sheet(d, opts) { + switch(opts.type) { + case 'base64': return rtf_to_sheet_str(Base64.decode(d), opts); + case 'binary': return rtf_to_sheet_str(d, opts); + case 'buffer': return rtf_to_sheet_str(d.toString('binary'), opts); + case 'array': return rtf_to_sheet_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); + } + + function rtf_to_sheet_str(str, opts) { + var o = opts || {}; + var ws = o.dense ? ([]) : ({}); + var range = ({s: {c:0, r:0}, e: {c:0, r:0}}); + + // TODO: parse + if(!str.match(/\\trowd/)) throw new Error("RTF missing table"); + + ws['!ref'] = encode_range(range); + return ws; + } + + function rtf_to_workbook(d, opts) { return sheet_to_workbook(rtf_to_sheet(d, opts), opts); } + + /* TODO: this is a stub */ + function sheet_to_rtf(ws) { + var o = ["{\\rtf1\\ansi"]; + var r = safe_decode_range(ws['!ref']), cell; + var dense = Array.isArray(ws); + for(var R = r.s.r; R <= r.e.r; ++R) { + o.push("\\trowd\\trautofit1"); + for(var C = r.s.c; C <= r.e.c; ++C) o.push("\\cellx" + (C+1)); + o.push("\\pard\\intbl"); + for(C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({r:R,c:C}); + cell = dense ? (ws[R]||[])[C]: ws[coord]; + if(!cell || cell.v == null && (!cell.f || cell.F)) continue; + o.push(" " + (cell.w || (format_cell(cell), cell.w))); + o.push("\\cell"); + } + o.push("\\pard\\intbl\\row"); + } + return o.join("") + "}"; + } + + return { + to_workbook: rtf_to_workbook, + to_sheet: rtf_to_sheet, + from_sheet: sheet_to_rtf + }; + })(); + function hex2RGB(h) { + var o = h.slice(h[0]==="#"?1:0).slice(0,6); + return [parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16)]; + } + function rgb2Hex(rgb) { + for(var i=0,o=1; i!=3; ++i) o = o*256 + (rgb[i]>255?255:rgb[i]<0?0:rgb[i]); + return o.toString(16).toUpperCase().slice(1); + } + + function rgb2HSL(rgb) { + var R = rgb[0]/255, G = rgb[1]/255, B=rgb[2]/255; + var M = Math.max(R, G, B), m = Math.min(R, G, B), C = M - m; + if(C === 0) return [0, 0, R]; + + var H6 = 0, S = 0, L2 = (M + m); + S = C / (L2 > 1 ? 2 - L2 : L2); + switch(M){ + case R: H6 = ((G - B) / C + 6)%6; break; + case G: H6 = ((B - R) / C + 2); break; + case B: H6 = ((R - G) / C + 4); break; + } + return [H6 / 6, S, L2 / 2]; + } + + function hsl2RGB(hsl){ + var H = hsl[0], S = hsl[1], L = hsl[2]; + var C = S * 2 * (L < 0.5 ? L : 1 - L), m = L - C/2; + var rgb = [m,m,m], h6 = 6*H; + + var X; + if(S !== 0) switch(h6|0) { + case 0: case 6: X = C * h6; rgb[0] += C; rgb[1] += X; break; + case 1: X = C * (2 - h6); rgb[0] += X; rgb[1] += C; break; + case 2: X = C * (h6 - 2); rgb[1] += C; rgb[2] += X; break; + case 3: X = C * (4 - h6); rgb[1] += X; rgb[2] += C; break; + case 4: X = C * (h6 - 4); rgb[2] += C; rgb[0] += X; break; + case 5: X = C * (6 - h6); rgb[2] += X; rgb[0] += C; break; + } + for(var i = 0; i != 3; ++i) rgb[i] = Math.round(rgb[i]*255); + return rgb; + } + + /* 18.8.3 bgColor tint algorithm */ + function rgb_tint(hex, tint) { + if(tint === 0) return hex; + var hsl = rgb2HSL(hex2RGB(hex)); + if (tint < 0) hsl[2] = hsl[2] * (1 + tint); + else hsl[2] = 1 - (1 - hsl[2]) * (1 - tint); + return rgb2Hex(hsl2RGB(hsl)); + } + + /* 18.3.1.13 width calculations */ + /* [MS-OI29500] 2.1.595 Column Width & Formatting */ + var DEF_MDW = 6, MAX_MDW = 15, MIN_MDW = 1, MDW = DEF_MDW; + function width2px(width) { return Math.floor(( width + (Math.round(128/MDW))/256 )* MDW ); } + function px2char(px) { return (Math.floor((px - 5)/MDW * 100 + 0.5))/100; } + function char2width(chr) { return (Math.round((chr * MDW + 5)/MDW*256))/256; } +//function px2char_(px) { return (((px - 5)/MDW * 100 + 0.5))/100; } +//function char2width_(chr) { return (((chr * MDW + 5)/MDW*256))/256; } + function cycle_width(collw) { return char2width(px2char(width2px(collw))); } + /* XLSX/XLSB/XLS specify width in units of MDW */ + function find_mdw_colw(collw) { + var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW; + if(delta > 0.005) for(MDW=MIN_MDW; MDW 0.5) guess--; + if(Math.abs(guess) < delta) { delta = Math.abs(guess); _MDW = MDW; } + } + MDW = _MDW; +}*/ + + function process_col(coll) { + if(coll.width) { + coll.wpx = width2px(coll.width); + coll.wch = px2char(coll.wpx); + coll.MDW = MDW; + } else if(coll.wpx) { + coll.wch = px2char(coll.wpx); + coll.width = char2width(coll.wch); + coll.MDW = MDW; + } else if(typeof coll.wch == 'number') { + coll.width = char2width(coll.wch); + coll.wpx = width2px(coll.width); + coll.MDW = MDW; + } + if(coll.customWidth) delete coll.customWidth; + } + + var DEF_PPI = 96, PPI = DEF_PPI; + function px2pt(px) { return px * 96 / PPI; } + function pt2px(pt) { return pt * PPI / 96; } + + /* [MS-EXSPXML3] 2.4.54 ST_enmPattern */ + var XLMLPatternTypeMap = { + "None": "none", + "Solid": "solid", + "Gray50": "mediumGray", + "Gray75": "darkGray", + "Gray25": "lightGray", + "HorzStripe": "darkHorizontal", + "VertStripe": "darkVertical", + "ReverseDiagStripe": "darkDown", + "DiagStripe": "darkUp", + "DiagCross": "darkGrid", + "ThickDiagCross": "darkTrellis", + "ThinHorzStripe": "lightHorizontal", + "ThinVertStripe": "lightVertical", + "ThinReverseDiagStripe": "lightDown", + "ThinHorzCross": "lightGrid" + }; + + /* 18.8.5 borders CT_Borders */ + function parse_borders(t, styles, themes, opts) { + styles.Borders = []; + var border = {}/*, sub_border = {}*/; + var pass = false; + t[0].match(tagregex).forEach(function(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': case '': break; + + /* 18.8.4 border CT_Border */ + case '': case '': + border = {}; + if (y.diagonalUp) { border.diagonalUp = y.diagonalUp; } + if (y.diagonalDown) { border.diagonalDown = y.diagonalDown; } + styles.Borders.push(border); + break; + case '': break; + + /* note: not in spec, appears to be CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* note: not in spec, appears to be CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* 18.8.43 top CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* 18.8.6 bottom CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* 18.8.13 diagonal CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.25 horizontal CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.44 vertical CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.37 start CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.16 end CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.? color CT_Color */ + case '': break; + case '': case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders'); + } + } + }); + } + + /* 18.8.21 fills CT_Fills */ + function parse_fills(t, styles, themes, opts) { + styles.Fills = []; + var fill = {}; + var pass = false; + t[0].match(tagregex).forEach(function(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': case '': break; + + /* 18.8.20 fill CT_Fill */ + case '': case '': + fill = {}; styles.Fills.push(fill); break; + case '': break; + + /* 18.8.24 gradientFill CT_GradientFill */ + case '': break; + case '': styles.Fills.push(fill); fill = {}; break; + + /* 18.8.32 patternFill CT_PatternFill */ + case '': + if(y.patternType) fill.patternType = y.patternType; + break; + case '': case '': break; + + /* 18.8.3 bgColor CT_Color */ + case '': case '': break; + + /* 18.8.19 fgColor CT_Color */ + case '': case '': break; + + /* 18.8.38 stop CT_GradientStop */ + case '': break; + case '': break; + + /* 18.8.? color CT_Color */ + case '': break; + case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in fills'); + } + } + }); + } + + /* 18.8.23 fonts CT_Fonts */ + function parse_fonts(t, styles, themes, opts) { + styles.Fonts = []; + var font = {}; + var pass = false; + t[0].match(tagregex).forEach(function(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': case '': break; + + /* 18.8.22 font CT_Font */ + case '': break; + case '': case '': + styles.Fonts.push(font); + font = {}; + break; + + /* 18.8.29 name CT_FontName */ + case '': case '': break; + + /* 18.8.2 b CT_BooleanProperty */ + case '': font.bold = 1; break; + + /* 18.8.26 i CT_BooleanProperty */ + case '': font.italic = 1; break; + + /* 18.4.13 u CT_UnderlineProperty */ + case '': font.underline = 1; break; + + /* 18.4.10 strike CT_BooleanProperty */ + case '': font.strike = 1; break; + + /* 18.4.2 outline CT_BooleanProperty */ + case '': font.outline = 1; break; + + /* 18.8.36 shadow CT_BooleanProperty */ + case '': font.shadow = 1; break; + + /* 18.8.12 condense CT_BooleanProperty */ + case '': font.condense = 1; break; + + /* 18.8.17 extend CT_BooleanProperty */ + case '': font.extend = 1; break; + + /* 18.4.11 sz CT_FontSize */ + case '': case '': break; + + /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */ + case '': case '': break; + + /* 18.8.18 family CT_FontFamily */ + case '': case '': break; + + /* 18.8.35 scheme CT_FontScheme */ + case '': case '': break; + + /* 18.4.1 charset CT_IntProperty */ + case '': case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts'); + } + } + }); + } + + /* 18.8.31 numFmts CT_NumFmts */ + function parse_numFmts(t, styles, opts) { + styles.NumberFmt = []; + var k/*Array*/ = (keys(SSF._table)); + for(var i=0; i < k.length; ++i) styles.NumberFmt[k[i]] = SSF._table[k[i]]; + var m = t[0].match(tagregex); + if(!m) return; + for(i=0; i < m.length; ++i) { + var y = parsexmltag(m[i]); + switch(strip_ns(y[0])) { + case '': case '': case '': break; + case '0) { + if(j > 0x188) { + for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break; + styles.NumberFmt[j] = f; + } + SSF.load(f,j); + } + } break; + case '': break; + default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts'); + } + } + } + + function write_numFmts(NF) { + var o = [""]; + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) o[o.length] = (writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])})); + }); + if(o.length === 1) return ""; + o[o.length] = (""); + o[0] = writextag('numFmts', null, { count:o.length-2 }).replace("/>", ">"); + return o.join(""); + } + + /* 18.8.10 cellXfs CT_CellXfs */ + var cellXF_uint = [ "numFmtId", "fillId", "fontId", "borderId", "xfId" ]; + var cellXF_bool = [ "applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix" ]; + function parse_cellXfs(t, styles, opts) { + styles.CellXf = []; + var xf; + var pass = false; + t[0].match(tagregex).forEach(function(x) { + var y = parsexmltag(x), i = 0; + switch(strip_ns(y[0])) { + case '': case '': case '': break; + + /* 18.8.45 xf CT_Xf */ + case '': + xf = y; + delete xf[0]; + for(i = 0; i < cellXF_uint.length; ++i) if(xf[cellXF_uint[i]]) + xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10); + for(i = 0; i < cellXF_bool.length; ++i) if(xf[cellXF_bool[i]]) + xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]); + if(xf.numFmtId > 0x188) { + for(i = 0x188; i > 0x3c; --i) if(styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) { xf.numFmtId = i; break; } + } + styles.CellXf.push(xf); break; + case '': break; + + /* 18.8.1 alignment CT_CellAlignment */ + case '': + var alignment = {}; + if(y.vertical) alignment.vertical = y.vertical; + if(y.horizontal) alignment.horizontal = y.horizontal; + if(y.textRotation != null) alignment.textRotation = y.textRotation; + if(y.indent) alignment.indent = y.indent; + if(y.wrapText) alignment.wrapText = y.wrapText; + xf.alignment = alignment; + break; + case '': break; + + /* 18.8.33 protection CT_CellProtection */ + case '': case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in cellXfs'); + } + } + }); + } + + function write_cellXfs(cellXfs) { + var o = []; + o[o.length] = (writextag('cellXfs',null)); + cellXfs.forEach(function(c) { o[o.length] = (writextag('xf', null, c)); }); + o[o.length] = (""); + if(o.length === 2) return ""; + o[0] = writextag('cellXfs',null, {count:o.length-2}).replace("/>",">"); + return o.join(""); + } + + /* 18.8 Styles CT_Stylesheet*/ + var parse_sty_xml= (function make_pstyx() { + var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/; + var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/; + var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/; + var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/; + var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/; + + return function parse_sty_xml(data, themes, opts) { + var styles = {}; + if(!data) return styles; + data = data.replace(//mg,"").replace(//gm,""); + /* 18.8.39 styleSheet CT_Stylesheet */ + var t; + + /* 18.8.31 numFmts CT_NumFmts ? */ + if((t=data.match(numFmtRegex))) parse_numFmts(t, styles, opts); + + /* 18.8.23 fonts CT_Fonts ? */ + if((t=data.match(fontsRegex))) parse_fonts(t, styles, themes, opts); + + /* 18.8.21 fills CT_Fills ? */ + if((t=data.match(fillsRegex))) parse_fills(t, styles, themes, opts); + + /* 18.8.5 borders CT_Borders ? */ + if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts); + + /* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */ + + /* 18.8.10 cellXfs CT_CellXfs ? */ + if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts); + + /* 18.8.8 cellStyles CT_CellStyles ? */ + /* 18.8.15 dxfs CT_Dxfs ? */ + /* 18.8.42 tableStyles CT_TableStyles ? */ + /* 18.8.11 colors CT_Colors ? */ + /* 18.2.10 extLst CT_ExtensionList ? */ + + return styles; + }; + })(); + + var STYLES_XML_ROOT = writextag('styleSheet', null, { + 'xmlns': XMLNS.main[0], + 'xmlns:vt': XMLNS.vt + }); + + RELS.STY = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + + function write_sty_xml(wb, opts) { + if (typeof style_builder != 'undefined' && typeof 'require' != 'undefined') { + return style_builder.toXml(); + } + var o = [XML_HEADER, STYLES_XML_ROOT], w; + if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w; + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + if((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w); + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* [MS-XLSB] 2.4.657 BrtFmt */ + function parse_BrtFmt(data, length) { + var numFmtId = data.read_shift(2); + var stFmtCode = parse_XLWideString(data,length-2); + return [numFmtId, stFmtCode]; + } + function write_BrtFmt(i, f, o) { + if(!o) o = new_buf(6 + 4 * f.length); + o.write_shift(2, i); + write_XLWideString(f, o); + var out = (o.length > o.l) ? o.slice(0, o.l) : o; + if(o.l == null) o.l = o.length; + return out; + } + + /* [MS-XLSB] 2.4.659 BrtFont TODO */ + function parse_BrtFont(data, length, opts) { + var out = ({}); + + out.sz = data.read_shift(2) / 20; + + var grbit = parse_FontFlags(data, 2, opts); + if(grbit.fCondense) out.condense = 1; + if(grbit.fExtend) out.extend = 1; + if(grbit.fShadow) out.shadow = 1; + if(grbit.fOutline) out.outline = 1; + if(grbit.fStrikeout) out.strike = 1; + if(grbit.fItalic) out.italic = 1; + + var bls = data.read_shift(2); + if(bls === 0x02BC) out.bold = 1; + + switch(data.read_shift(2)) { + /* case 0: out.vertAlign = "baseline"; break; */ + case 1: out.vertAlign = "superscript"; break; + case 2: out.vertAlign = "subscript"; break; + } + + var underline = data.read_shift(1); + if(underline != 0) out.underline = underline; + + var family = data.read_shift(1); + if(family > 0) out.family = family; + + var bCharSet = data.read_shift(1); + if(bCharSet > 0) out.charset = bCharSet; + + data.l++; + out.color = parse_BrtColor(data, 8); + + switch(data.read_shift(1)) { + /* case 0: out.scheme = "none": break; */ + case 1: out.scheme = "major"; break; + case 2: out.scheme = "minor"; break; + } + + out.name = parse_XLWideString(data, length - 21); + + return out; + } + function write_BrtFont(font, o) { + if(!o) o = new_buf(25+4*32); + o.write_shift(2, font.sz * 20); + write_FontFlags(font, o); + o.write_shift(2, font.bold ? 0x02BC : 0x0190); + var sss = 0; + if(font.vertAlign == "superscript") sss = 1; + else if(font.vertAlign == "subscript") sss = 2; + o.write_shift(2, sss); + o.write_shift(1, font.underline || 0); + o.write_shift(1, font.family || 0); + o.write_shift(1, font.charset || 0); + o.write_shift(1, 0); + write_BrtColor(font.color, o); + var scheme = 0; + if(font.scheme == "major") scheme = 1; + if(font.scheme == "minor") scheme = 2; + o.write_shift(1, scheme); + write_XLWideString(font.name, o); + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.650 BrtFill */ + var XLSBFillPTNames = [ + "none", + "solid", + "mediumGray", + "darkGray", + "lightGray", + "darkHorizontal", + "darkVertical", + "darkDown", + "darkUp", + "darkGrid", + "darkTrellis", + "lightHorizontal", + "lightVertical", + "lightDown", + "lightUp", + "lightGrid", + "lightTrellis", + "gray125", + "gray0625" + ]; + var rev_XLSBFillPTNames = (evert(XLSBFillPTNames)); + /* TODO: gradient fill representation */ + var parse_BrtFill = parsenoop; + function write_BrtFill(fill, o) { + if(!o) o = new_buf(4*3 + 8*7 + 16*1); + var fls = rev_XLSBFillPTNames[fill.patternType]; + if(fls == null) fls = 0x28; + o.write_shift(4, fls); + var j = 0; + if(fls != 0x28) { + /* TODO: custom FG Color */ + write_BrtColor({auto:1}, o); + /* TODO: custom BG Color */ + write_BrtColor({auto:1}, o); + + for(; j < 12; ++j) o.write_shift(4, 0); + } else { + for(; j < 4; ++j) o.write_shift(4, 0); + + for(; j < 12; ++j) o.write_shift(4, 0); /* TODO */ + /* iGradientType */ + /* xnumDegree */ + /* xnumFillToLeft */ + /* xnumFillToRight */ + /* xnumFillToTop */ + /* xnumFillToBottom */ + /* cNumStop */ + /* xfillGradientStop */ + } + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.824 BrtXF */ + function parse_BrtXF(data, length) { + var tgt = data.l + length; + var ixfeParent = data.read_shift(2); + var ifmt = data.read_shift(2); + data.l = tgt; + return {ixfe:ixfeParent, numFmtId:ifmt }; + } + function write_BrtXF(data, ixfeP, o) { + if(!o) o = new_buf(16); + o.write_shift(2, ixfeP||0); + o.write_shift(2, data.numFmtId||0); + o.write_shift(2, 0); /* iFont */ + o.write_shift(2, 0); /* iFill */ + o.write_shift(2, 0); /* ixBorder */ + o.write_shift(1, 0); /* trot */ + o.write_shift(1, 0); /* indent */ + o.write_shift(1, 0); /* flags */ + o.write_shift(1, 0); /* flags */ + o.write_shift(1, 0); /* xfGrbitAtr */ + o.write_shift(1, 0); + return o; + } + + /* [MS-XLSB] 2.5.4 Blxf TODO */ + function write_Blxf(data, o) { + if(!o) o = new_buf(10); + o.write_shift(1, 0); /* dg */ + o.write_shift(1, 0); + o.write_shift(4, 0); /* color */ + o.write_shift(4, 0); /* color */ + return o; + } + /* [MS-XLSB] 2.4.302 BrtBorder TODO */ + var parse_BrtBorder = parsenoop; + function write_BrtBorder(border, o) { + if(!o) o = new_buf(51); + o.write_shift(1, 0); /* diagonal */ + write_Blxf(null, o); /* top */ + write_Blxf(null, o); /* bottom */ + write_Blxf(null, o); /* left */ + write_Blxf(null, o); /* right */ + write_Blxf(null, o); /* diag */ + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.763 BrtStyle TODO */ + function write_BrtStyle(style, o) { + if(!o) o = new_buf(12+4*10); + o.write_shift(4, style.xfId); + o.write_shift(2, 1); + o.write_shift(1, +style.builtinId); + o.write_shift(1, 0); /* iLevel */ + write_XLNullableWideString(style.name || "", o); + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.272 BrtBeginTableStyles */ + function write_BrtBeginTableStyles(cnt, defTableStyle, defPivotStyle) { + var o = new_buf(4+256*2*4); + o.write_shift(4, cnt); + write_XLNullableWideString(defTableStyle, o); + write_XLNullableWideString(defPivotStyle, o); + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.1.7.50 Styles */ + function parse_sty_bin(data, themes, opts) { + var styles = {}; + styles.NumberFmt = ([]); + for(var y in SSF._table) styles.NumberFmt[y] = SSF._table[y]; + + styles.CellXf = []; + styles.Fonts = []; + var state = []; + var pass = false; + recordhopper(data, function hopper_sty(val, R_n, RT) { + switch(RT) { + case 0x002C: /* 'BrtFmt' */ + styles.NumberFmt[val[0]] = val[1]; SSF.load(val[1], val[0]); + break; + case 0x002B: /* 'BrtFont' */ + styles.Fonts.push(val); + if(val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) { + val.color.rgb = rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb, val.color.tint || 0); + } + break; + case 0x0401: /* 'BrtKnownFonts' */ break; + case 0x002D: /* 'BrtFill' */ break; + case 0x002E: /* 'BrtBorder' */ break; + case 0x002F: /* 'BrtXF' */ + if(state[state.length - 1] == "BrtBeginCellXFs") { + styles.CellXf.push(val); + } + break; + case 0x0030: /* 'BrtStyle' */ + case 0x01FB: /* 'BrtDXF' */ + case 0x023C: /* 'BrtMRUColor' */ + case 0x01DB: /* 'BrtIndexedColor': */ + break; + + case 0x0493: /* 'BrtDXF14' */ + case 0x0836: /* 'BrtDXF15' */ + case 0x046A: /* 'BrtSlicerStyleElement' */ + case 0x0200: /* 'BrtTableStyleElement' */ + case 0x082F: /* 'BrtTimelineStyleElement' */ + case 0x0C00: /* 'BrtUid' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ + state.push(R_n); break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); break; + + default: + if((R_n||"").indexOf("Begin") > 0) state.push(R_n); + else if((R_n||"").indexOf("End") > 0) state.pop(); + else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); + } + }); + return styles; + } + + function write_FMTS_bin(ba, NF) { + if(!NF) return; + var cnt = 0; + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) ++cnt; + }); + + if(cnt == 0) return; + write_record(ba, "BrtBeginFmts", write_UInt32LE(cnt)); + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, "BrtFmt", write_BrtFmt(i, NF[i])); + }); + write_record(ba, "BrtEndFmts"); + } + + function write_FONTS_bin(ba) { + var cnt = 1; + + if(cnt == 0) return; + write_record(ba, "BrtBeginFonts", write_UInt32LE(cnt)); + write_record(ba, "BrtFont", write_BrtFont({ + sz:12, + color: {theme:1}, + name: "Calibri", + family: 2, + scheme: "minor" + })); + /* 1*65491BrtFont [ACFONTS] */ + write_record(ba, "BrtEndFonts"); + } + + function write_FILLS_bin(ba) { + var cnt = 2; + + if(cnt == 0) return; + write_record(ba, "BrtBeginFills", write_UInt32LE(cnt)); + write_record(ba, "BrtFill", write_BrtFill({patternType:"none"})); + write_record(ba, "BrtFill", write_BrtFill({patternType:"gray125"})); + /* 1*65431BrtFill */ + write_record(ba, "BrtEndFills"); + } + + function write_BORDERS_bin(ba) { + var cnt = 1; + + if(cnt == 0) return; + write_record(ba, "BrtBeginBorders", write_UInt32LE(cnt)); + write_record(ba, "BrtBorder", write_BrtBorder({})); + /* 1*65430BrtBorder */ + write_record(ba, "BrtEndBorders"); + } + + function write_CELLSTYLEXFS_bin(ba) { + var cnt = 1; + write_record(ba, "BrtBeginCellStyleXFs", write_UInt32LE(cnt)); + write_record(ba, "BrtXF", write_BrtXF({ + numFmtId:0, + fontId:0, + fillId:0, + borderId:0 + }, 0xFFFF)); + /* 1*65430(BrtXF *FRT) */ + write_record(ba, "BrtEndCellStyleXFs"); + } + + function write_CELLXFS_bin(ba, data) { + write_record(ba, "BrtBeginCellXFs", write_UInt32LE(data.length)); + data.forEach(function(c) { write_record(ba, "BrtXF", write_BrtXF(c,0)); }); + /* 1*65430(BrtXF *FRT) */ + write_record(ba, "BrtEndCellXFs"); + } + + function write_STYLES_bin(ba) { + var cnt = 1; + + write_record(ba, "BrtBeginStyles", write_UInt32LE(cnt)); + write_record(ba, "BrtStyle", write_BrtStyle({ + xfId:0, + builtinId:0, + name:"Normal" + })); + /* 1*65430(BrtStyle *FRT) */ + write_record(ba, "BrtEndStyles"); + } + + function write_DXFS_bin(ba) { + var cnt = 0; + + write_record(ba, "BrtBeginDXFs", write_UInt32LE(cnt)); + /* *2147483647(BrtDXF *FRT) */ + write_record(ba, "BrtEndDXFs"); + } + + function write_TABLESTYLES_bin(ba) { + var cnt = 0; + + write_record(ba, "BrtBeginTableStyles", write_BrtBeginTableStyles(cnt, "TableStyleMedium9", "PivotStyleMedium4")); + /* *TABLESTYLE */ + write_record(ba, "BrtEndTableStyles"); + } + + function write_COLORPALETTE_bin() { + return; + /* BrtBeginColorPalette [INDEXEDCOLORS] [MRUCOLORS] BrtEndColorPalette */ + } + + /* [MS-XLSB] 2.1.7.50 Styles */ + function write_sty_bin(wb, opts) { + var ba = buf_array(); + write_record(ba, "BrtBeginStyleSheet"); + write_FMTS_bin(ba, wb.SSF); + write_FONTS_bin(ba, wb); + write_FILLS_bin(ba, wb); + write_BORDERS_bin(ba, wb); + write_CELLSTYLEXFS_bin(ba, wb); + write_CELLXFS_bin(ba, opts.cellXfs); + write_STYLES_bin(ba, wb); + write_DXFS_bin(ba, wb); + write_TABLESTYLES_bin(ba, wb); + write_COLORPALETTE_bin(ba, wb); + /* FRTSTYLESHEET*/ + write_record(ba, "BrtEndStyleSheet"); + return ba.end(); + } + RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"; + + /* 20.1.6.2 clrScheme CT_ColorScheme */ + function parse_clrScheme(t, themes, opts) { + themes.themeElements.clrScheme = []; + var color = {}; + (t[0].match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(y[0]) { + /* 20.1.6.2 clrScheme (Color Scheme) CT_ColorScheme */ + case '': break; + + /* 20.1.2.3.32 srgbClr CT_SRgbColor */ + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + if (y[0].charAt(1) === '/') { + themes.themeElements.clrScheme.push(color); + color = {}; + } else { + color.name = y[0].slice(3, y[0].length - 1); + } + break; + + default: if(opts && opts.WTF) throw new Error('Unrecognized ' + y[0] + ' in clrScheme'); + } + }); + } + + /* 20.1.4.1.18 fontScheme CT_FontScheme */ + function parse_fontScheme() { } + + /* 20.1.4.1.15 fmtScheme CT_StyleMatrix */ + function parse_fmtScheme() { } + + var clrsregex = /]*)>[\s\S]*<\/a:clrScheme>/; + var fntsregex = /]*)>[\s\S]*<\/a:fontScheme>/; + var fmtsregex = /]*)>[\s\S]*<\/a:fmtScheme>/; + + /* 20.1.6.10 themeElements CT_BaseStyles */ + function parse_themeElements(data, themes, opts) { + themes.themeElements = {}; + + var t; + + [ + /* clrScheme CT_ColorScheme */ + ['clrScheme', clrsregex, parse_clrScheme], + /* fontScheme CT_FontScheme */ + ['fontScheme', fntsregex, parse_fontScheme], + /* fmtScheme CT_StyleMatrix */ + ['fmtScheme', fmtsregex, parse_fmtScheme] + ].forEach(function(m) { + if(!(t=data.match(m[1]))) throw new Error(m[0] + ' not found in themeElements'); + m[2](t, themes, opts); + }); + } + + var themeltregex = /]*)>[\s\S]*<\/a:themeElements>/; + + /* 14.2.7 Theme Part */ + function parse_theme_xml(data, opts) { + /* 20.1.6.9 theme CT_OfficeStyleSheet */ + if(!data || data.length === 0) return parse_theme_xml(write_theme()); + + var t; + var themes = {}; + + /* themeElements CT_BaseStyles */ + if(!(t=data.match(themeltregex))) throw new Error('themeElements not found in theme'); + parse_themeElements(t[0], themes, opts); + + return themes; + } + + function write_theme(Themes, opts) { + if(opts && opts.themeXLSX) return opts.themeXLSX; + var o = [XML_HEADER]; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + return o.join(""); + } + /* [MS-XLS] 2.4.326 TODO: payload is a zip file */ + function parse_Theme(blob, length, opts) { + var end = blob.l + length; + var dwThemeVersion = blob.read_shift(4); + if(dwThemeVersion === 124226) return; + if(!opts.cellStyles || !jszip) { blob.l = end; return; } + var data = blob.slice(blob.l); + blob.l = end; + var zip; try { zip = new jszip(data); } catch(e) { return; } + var themeXML = getzipstr(zip, "theme/theme/theme1.xml", true); + if(!themeXML) return; + return parse_theme_xml(themeXML, opts); + } + + /* 2.5.49 */ + function parse_ColorTheme(blob) { return blob.read_shift(4); } + + /* 2.5.155 */ + function parse_FullColorExt(blob) { + var o = {}; + o.xclrType = blob.read_shift(2); + o.nTintShade = blob.read_shift(2); + switch(o.xclrType) { + case 0: blob.l += 4; break; + case 1: o.xclrValue = parse_IcvXF(blob, 4); break; + case 2: o.xclrValue = parse_LongRGBA(blob, 4); break; + case 3: o.xclrValue = parse_ColorTheme(blob, 4); break; + case 4: blob.l += 4; break; + } + blob.l += 8; + return o; + } + + /* 2.5.164 TODO: read 7 bits*/ + function parse_IcvXF(blob, length) { + return parsenoop(blob, length); + } + + /* 2.5.280 */ + function parse_XFExtGradient(blob, length) { + return parsenoop(blob, length); + } + + /* [MS-XLS] 2.5.108 */ + function parse_ExtProp(blob) { + var extType = blob.read_shift(2); + var cb = blob.read_shift(2) - 4; + var o = [extType]; + switch(extType) { + case 0x04: case 0x05: case 0x07: case 0x08: + case 0x09: case 0x0A: case 0x0B: case 0x0D: + o[1] = parse_FullColorExt(blob, cb); break; + case 0x06: o[1] = parse_XFExtGradient(blob, cb); break; + case 0x0E: case 0x0F: o[1] = blob.read_shift(cb === 1 ? 1 : 2); break; + default: throw new Error("Unrecognized ExtProp type: " + extType + " " + cb); + } + return o; + } + + /* 2.4.355 */ + function parse_XFExt(blob, length) { + var end = blob.l + length; + blob.l += 2; + var ixfe = blob.read_shift(2); + blob.l += 2; + var cexts = blob.read_shift(2); + var ext = []; + while(cexts-- > 0) ext.push(parse_ExtProp(blob, end-blob.l)); + return {ixfe:ixfe, ext:ext}; + } + + /* xf is an XF, see parse_XFExt for xfext */ + function update_xfext(xf, xfext) { + xfext.forEach(function(xfe) { + switch(xfe[0]) { /* 2.5.108 extPropData */ + case 0x04: break; /* foreground color */ + case 0x05: break; /* background color */ + case 0x06: break; /* gradient fill */ + case 0x07: break; /* top cell border color */ + case 0x08: break; /* bottom cell border color */ + case 0x09: break; /* left cell border color */ + case 0x0a: break; /* right cell border color */ + case 0x0b: break; /* diagonal cell border color */ + case 0x0d: break; /* text color */ + case 0x0e: break; /* font scheme */ + case 0x0f: break; /* indentation level */ + } + }); + } + + /* 18.6 Calculation Chain */ + function parse_cc_xml(data) { + var d = []; + if(!data) return d; + var i = 1; + (data.match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(y[0]) { + case '': case '': break; + /* 18.6.1 c CT_CalcCell 1 */ + case ' 0){/* empty */} + else if((R_n||"").indexOf("End") > 0){/* empty */} + else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); + } + }); + return out; + } + +//function write_cc_bin(data, opts) { } + /* 18.14 Supplementary Workbook Data */ + function parse_xlink_xml() { + //var opts = _opts || {}; + //if(opts.WTF) throw "XLSX External Link"; + } + + /* [MS-XLSB] 2.1.7.25 External Link */ + function parse_xlink_bin(data, name, _opts) { + if(!data) return data; + var opts = _opts || {}; + + var pass = false, end = false; + + recordhopper(data, function xlink_parse(val, R_n, RT) { + if(end) return; + switch(RT) { + case 0x0167: /* 'BrtSupTabs' */ + case 0x016B: /* 'BrtExternTableStart' */ + case 0x016C: /* 'BrtExternTableEnd' */ + case 0x016E: /* 'BrtExternRowHdr' */ + case 0x016F: /* 'BrtExternCellBlank' */ + case 0x0170: /* 'BrtExternCellReal' */ + case 0x0171: /* 'BrtExternCellBool' */ + case 0x0172: /* 'BrtExternCellError' */ + case 0x0173: /* 'BrtExternCellString' */ + case 0x01D8: /* 'BrtExternValueMeta' */ + case 0x0241: /* 'BrtSupNameStart' */ + case 0x0242: /* 'BrtSupNameValueStart' */ + case 0x0243: /* 'BrtSupNameValueEnd' */ + case 0x0244: /* 'BrtSupNameNum' */ + case 0x0245: /* 'BrtSupNameErr' */ + case 0x0246: /* 'BrtSupNameSt' */ + case 0x0247: /* 'BrtSupNameNil' */ + case 0x0248: /* 'BrtSupNameBool' */ + case 0x0249: /* 'BrtSupNameFmla' */ + case 0x024A: /* 'BrtSupNameBits' */ + case 0x024B: /* 'BrtSupNameEnd' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + + default: + if((R_n||"").indexOf("Begin") > 0){/* empty */} + else if((R_n||"").indexOf("End") > 0){/* empty */} + else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT.toString(16) + " " + R_n); + } + }, opts); + } + RELS.IMG = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; + RELS.DRAW = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"; + /* 20.5 DrawingML - SpreadsheetML Drawing */ + function parse_drawing(data, rels) { + if(!data) return "??"; + /* + Chartsheet Drawing: + - 20.5.2.35 wsDr CT_Drawing + - 20.5.2.1 absoluteAnchor CT_AbsoluteAnchor + - 20.5.2.16 graphicFrame CT_GraphicalObjectFrame + - 20.1.2.2.16 graphic CT_GraphicalObject + - 20.1.2.2.17 graphicData CT_GraphicalObjectData + - chart reference + the actual type is based on the URI of the graphicData + TODO: handle embedded charts and other types of graphics + */ + var id = (data.match(/]*r:id="([^"]*)"/)||["",""])[1]; + + return rels['!id'][id].Target; + } + + /* L.5.5.2 SpreadsheetML Comments + VML Schema */ + var _shapeid = 1024; + function write_comments_vml(rId, comments) { + var csize = [21600, 21600]; + /* L.5.2.1.2 Path Attribute */ + var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(","); + var o = [ + writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"), + writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}), + writextag("v:shapetype", [ + writextag("v:stroke", null, {joinstyle:"miter"}), + writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"}) + ].join(""), {id:"_x0000_t202", 'o:spt':202, coordsize:csize.join(","),path:bbox}) + ]; + while(_shapeid < rId * 1000) _shapeid += 1000; + + comments.forEach(function(x) { var c = decode_cell(x[0]); + o = o.concat([ + '', + writextag('v:fill', writextag("o:fill", null, {type:"gradientUnscaled", 'v:ext':"view"}), {'color2':"#BEFF82", 'angle':"-180", 'type':"gradient"}), + writextag("v:shadow", null, {on:"t", 'obscured':"t"}), + writextag("v:path", null, {'o:connecttype':"none"}), + '
          ', + '', + '', + '', + /* Part 4 19.4.2.3 Anchor (Anchor) */ + writetag('x:Anchor', [c.c, 0, c.r, 0, c.c+3, 100, c.r+5, 100].join(",")), + writetag('x:AutoFill', "False"), + writetag('x:Row', String(c.r)), + writetag('x:Column', String(c.c)), + x[1].hidden ? '' : '', + '', + '' + ]); }); + o.push(''); + return o.join(""); + } + + RELS.CMNT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"; + + function parse_comments(zip, dirComments, sheets, sheetRels, opts) { + for(var i = 0; i != dirComments.length; ++i) { + var canonicalpath=dirComments[i]; + var comments=parse_cmnt(getzipdata(zip, canonicalpath.replace(/^\//,''), true), canonicalpath, opts); + if(!comments || !comments.length) continue; + // find the sheets targeted by these comments + var sheetNames = keys(sheets); + for(var j = 0; j != sheetNames.length; ++j) { + var sheetName = sheetNames[j]; + var rels = sheetRels[sheetName]; + if(rels) { + var rel = rels[canonicalpath]; + if(rel) insertCommentsIntoSheet(sheetName, sheets[sheetName], comments); + } + } + } + } + + function insertCommentsIntoSheet(sheetName, sheet, comments) { + var dense = Array.isArray(sheet); + var cell; + comments.forEach(function(comment) { + var r = decode_cell(comment.ref); + if(dense) { + if(!sheet[r.r]) sheet[r.r] = []; + cell = sheet[r.r][r.c]; + } else cell = sheet[comment.ref]; + if (!cell) { + cell = {}; + if(dense) sheet[r.r][r.c] = cell; + else sheet[comment.ref] = cell; + var range = safe_decode_range(sheet["!ref"]||"BDWGO1000001:A1"); + if(range.s.r > r.r) range.s.r = r.r; + if(range.e.r < r.r) range.e.r = r.r; + if(range.s.c > r.c) range.s.c = r.c; + if(range.e.c < r.c) range.e.c = r.c; + var encoded = encode_range(range); + if (encoded !== sheet["!ref"]) sheet["!ref"] = encoded; + } + + if (!cell.c) cell.c = []; + var o = ({a: comment.author, t: comment.t, r: comment.r}); + if(comment.h) o.h = comment.h; + cell.c.push(o); + }); + } + + /* 18.7 Comments */ + function parse_comments_xml(data, opts) { + /* 18.7.6 CT_Comments */ + if(data.match(/<(?:\w+:)?comments *\/>/)) return []; + var authors = []; + var commentList = []; + var authtag = data.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/); + if(authtag && authtag[1]) authtag[1].split(/<\/\w*:?author>/).forEach(function(x) { + if(x === "" || x.trim() === "") return; + var a = x.match(/<(?:\w+:)?author[^>]*>(.*)/); + if(a) authors.push(a[1]); + }); + var cmnttag = data.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/); + if(cmnttag && cmnttag[1]) cmnttag[1].split(/<\/\w*:?comment>/).forEach(function(x) { + if(x === "" || x.trim() === "") return; + var cm = x.match(/<(?:\w+:)?comment[^>]*>/); + if(!cm) return; + var y = parsexmltag(cm[0]); + var comment = ({ author: y.authorId && authors[y.authorId] || "sheetjsghost", ref: y.ref, guid: y.guid }); + var cell = decode_cell(y.ref); + if(opts.sheetRows && opts.sheetRows <= cell.r) return; + var textMatch = x.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/); + var rt = !!textMatch && !!textMatch[1] && parse_si(textMatch[1]) || {r:"",t:"",h:""}; + comment.r = rt.r; + if(rt.r == "") rt.t = rt.h = ""; + comment.t = rt.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"); + if(opts.cellHTML) comment.h = rt.h; + commentList.push(comment); + }); + return commentList; + } + + var CMNT_XML_ROOT = writextag('comments', null, { 'xmlns': XMLNS.main[0] }); + function write_comments_xml(data) { + var o = [XML_HEADER, CMNT_XML_ROOT]; + + var iauthor = []; + o.push(""); + data.forEach(function(x) { x[1].forEach(function(w) { var a = escapexml(w.a); + if(iauthor.indexOf(a) > -1) return; + iauthor.push(a); + o.push("" + a + ""); + }); }); + o.push(""); + o.push(""); + data.forEach(function(d) { + d[1].forEach(function(c) { + /* 18.7.3 CT_Comment */ + o.push(''); + o.push(writetag("t", c.t == null ? "" : escapexml(c.t))); + o.push(''); + }); + }); + o.push(""); + if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* [MS-XLSB] 2.4.28 BrtBeginComment */ + function parse_BrtBeginComment(data) { + var out = {}; + out.iauthor = data.read_shift(4); + var rfx = parse_UncheckedRfX(data, 16); + out.rfx = rfx.s; + out.ref = encode_cell(rfx.s); + data.l += 16; /*var guid = parse_GUID(data); */ + return out; + } + function write_BrtBeginComment(data, o) { + if(o == null) o = new_buf(36); + o.write_shift(4, data[1].iauthor); + write_UncheckedRfX((data[0]), o); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; + } + + /* [MS-XLSB] 2.4.327 BrtCommentAuthor */ + var parse_BrtCommentAuthor = parse_XLWideString; + function write_BrtCommentAuthor(data) { return write_XLWideString(data.slice(0, 54)); } + + /* [MS-XLSB] 2.1.7.8 Comments */ + function parse_comments_bin(data, opts) { + var out = []; + var authors = []; + var c = {}; + var pass = false; + recordhopper(data, function hopper_cmnt(val, R_n, RT) { + switch(RT) { + case 0x0278: /* 'BrtCommentAuthor' */ + authors.push(val); break; + case 0x027B: /* 'BrtBeginComment' */ + c = val; break; + case 0x027D: /* 'BrtCommentText' */ + c.t = val.t; c.h = val.h; c.r = val.r; break; + case 0x027C: /* 'BrtEndComment' */ + c.author = authors[c.iauthor]; + delete c.iauthor; + if(opts.sheetRows && opts.sheetRows <= c.rfx.r) break; + if(!c.t) c.t = ""; + delete c.rfx; out.push(c); break; + + case 0x0C00: /* 'BrtUid' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ break; + case 0x0026: /* 'BrtACEnd' */ break; + + + default: + if((R_n||"").indexOf("Begin") > 0){/* empty */} + else if((R_n||"").indexOf("End") > 0){/* empty */} + else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); + } + }); + return out; + } + + function write_comments_bin(data) { + var ba = buf_array(); + var iauthor = []; + write_record(ba, "BrtBeginComments"); + + write_record(ba, "BrtBeginCommentAuthors"); + data.forEach(function(comment) { + comment[1].forEach(function(c) { + if(iauthor.indexOf(c.a) > -1) return; + iauthor.push(c.a.slice(0,54)); + write_record(ba, "BrtCommentAuthor", write_BrtCommentAuthor(c.a)); + }); + }); + write_record(ba, "BrtEndCommentAuthors"); + + write_record(ba, "BrtBeginCommentList"); + data.forEach(function(comment) { + comment[1].forEach(function(c) { + c.iauthor = iauthor.indexOf(c.a); + var range = {s:decode_cell(comment[0]),e:decode_cell(comment[0])}; + write_record(ba, "BrtBeginComment", write_BrtBeginComment([range, c])); + if(c.t && c.t.length > 0) write_record(ba, "BrtCommentText", write_BrtCommentText(c)); + write_record(ba, "BrtEndComment"); + delete c.iauthor; + }); + }); + write_record(ba, "BrtEndCommentList"); + + write_record(ba, "BrtEndComments"); + return ba.end(); + } + var CT_VBA = "application/vnd.ms-office.vbaProject"; + function make_vba_xls(cfb) { + var newcfb = CFB.utils.cfb_new({root:"R"}); + cfb.FullPaths.forEach(function(p, i) { + if(p.slice(-1) === "/" || !p.match(/_VBA_PROJECT_CUR/)) return; + var newpath = p.replace(/^[^\/]*/,"R").replace(/\/_VBA_PROJECT_CUR\u0000*/, ""); + CFB.utils.cfb_add(newcfb, newpath, cfb.FileIndex[i].content); + }); + return CFB.write(newcfb); + } + + function fill_vba_xls(cfb, vba) { + vba.FullPaths.forEach(function(p, i) { + if(i == 0) return; + var newpath = p.replace(/[^\/]*[\/]/, "/_VBA_PROJECT_CUR/"); + if(newpath.slice(-1) !== "/") CFB.utils.cfb_add(cfb, newpath, vba.FileIndex[i].content); + }); + } + + var VBAFMTS = [ "xlsb", "xlsm", "xlam", "biff8", "xla" ]; + + RELS.DS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet"; + RELS.MS = "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet"; + + /* macro and dialog sheet stubs */ + function parse_ds_bin() { return {'!type':'dialog'}; } + function parse_ds_xml() { return {'!type':'dialog'}; } + function parse_ms_bin() { return {'!type':'macro'}; } + function parse_ms_xml() { return {'!type':'macro'}; } + /* TODO: it will be useful to parse the function str */ + var rc_to_a1 = (function(){ + var rcregex = /(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g; + var rcbase = ({r:0,c:0}); + function rcfunc($$,$1,$2,$3,$4,$5) { + var R = $3.length>0?parseInt($3,10)|0:0, C = $5.length>0?parseInt($5,10)|0:0; + if(C<0 && $4.length === 0) C=0; + var cRel = false, rRel = false; + if($4.length > 0 || $5.length == 0) cRel = true; if(cRel) C += rcbase.c; else --C; + if($2.length > 0 || $3.length == 0) rRel = true; if(rRel) R += rcbase.r; else --R; + return $1 + (cRel ? "" : "$") + encode_col(C) + (rRel ? "" : "$") + encode_row(R); + } + return function rc_to_a1(fstr, base) { + rcbase = base; + return fstr.replace(rcregex, rcfunc); + }; + })(); + + var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g; + var a1_to_rc =(function(){ + return function a1_to_rc(fstr, base) { + return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) { + var c = decode_col($3) - ($2 ? 0 : base.c); + var r = decode_row($5) - ($4 ? 0 : base.r); + var R = (r == 0 ? "" : !$4 ? "[" + r + "]" : (r+1)); + var C = (c == 0 ? "" : !$2 ? "[" + c + "]" : (c+1)); + return $1 + "R" + R + "C" + C; + }); + }; + })(); + + /* no defined name can collide with a valid cell address A1:XFD1048576 ... except LOG10! */ + function shift_formula_str(f, delta) { + return f.replace(crefregex, function($0, $1, $2, $3, $4, $5) { + return $1+($2=="$" ? $2+$3 : encode_col(decode_col($3)+delta.c))+($4=="$" ? $4+$5 : encode_row(decode_row($5) + delta.r)); + }); + } + + function shift_formula_xlsx(f, range, cell) { + var r = decode_range(range), s = r.s, c = decode_cell(cell); + var delta = {r:c.r - s.r, c:c.c - s.c}; + return shift_formula_str(f, delta); + } + + /* TODO: parse formula */ + function fuzzyfmla(f) { + if(f.length == 1) return false; + return true; + } + + function _xlfn(f) { + return f.replace(/_xlfn\./g,""); + } + function parseread1(blob) { blob.l+=1; return; } + + /* [MS-XLS] 2.5.51 */ + function parse_ColRelU(blob, length) { + var c = blob.read_shift(length == 1 ? 1 : 2); + return [c & 0x3FFF, (c >> 14) & 1, (c >> 15) & 1]; + } + + /* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.89 */ + function parse_RgceArea(blob, length, opts) { + var w = 2; + if(opts) { + if(opts.biff >= 2 && opts.biff <= 5) return parse_RgceArea_BIFF2(blob, length, opts); + else if(opts.biff == 12) w = 4; + } + var r=blob.read_shift(w), R=blob.read_shift(w); + var c=parse_ColRelU(blob, 2); + var C=parse_ColRelU(blob, 2); + return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} }; + } + /* BIFF 2-5 encodes flags in the row field */ + function parse_RgceArea_BIFF2(blob) { + var r=parse_ColRelU(blob, 2), R=parse_ColRelU(blob, 2); + var c=blob.read_shift(1); + var C=blob.read_shift(1); + return { s:{r:r[0], c:c, cRel:r[1], rRel:r[2]}, e:{r:R[0], c:C, cRel:R[1], rRel:R[2]} }; + } + + /* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.90 */ + function parse_RgceAreaRel(blob, length, opts) { + if(opts.biff < 8) return parse_RgceArea_BIFF2(blob, length, opts); + var r=blob.read_shift(opts.biff == 12 ? 4 : 2), R=blob.read_shift(opts.biff == 12 ? 4 : 2); + var c=parse_ColRelU(blob, 2); + var C=parse_ColRelU(blob, 2); + return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} }; + } + + /* [MS-XLS] 2.5.198.109 ; [MS-XLSB] 2.5.97.91 */ + function parse_RgceLoc(blob, length, opts) { + if(opts && opts.biff >= 2 && opts.biff <= 5) return parse_RgceLoc_BIFF2(blob, length, opts); + var r = blob.read_shift(opts && opts.biff == 12 ? 4 : 2); + var c = parse_ColRelU(blob, 2); + return {r:r, c:c[0], cRel:c[1], rRel:c[2]}; + } + function parse_RgceLoc_BIFF2(blob) { + var r = parse_ColRelU(blob, 2); + var c = blob.read_shift(1); + return {r:r[0], c:c, cRel:r[1], rRel:r[2]}; + } + + /* [MS-XLS] 2.5.198.107, 2.5.47 */ + function parse_RgceElfLoc(blob) { + var r = blob.read_shift(2); + var c = blob.read_shift(2); + return {r:r, c:c & 0xFF, fQuoted:!!(c & 0x4000), cRel:c>>15, rRel:c>>15 }; + } + + /* [MS-XLS] 2.5.198.111 ; [MS-XLSB] 2.5.97.92 TODO */ + function parse_RgceLocRel(blob, length, opts) { + var biff = opts && opts.biff ? opts.biff : 8; + if(biff >= 2 && biff <= 5) return parse_RgceLocRel_BIFF2(blob, length, opts); + var r = blob.read_shift(biff >= 12 ? 4 : 2); + var cl = blob.read_shift(2); + var cRel = (cl & 0x4000) >> 14, rRel = (cl & 0x8000) >> 15; + cl &= 0x3FFF; + if(rRel == 1) while(r > 0x7FFFF) r -= 0x100000; + if(cRel == 1) while(cl > 0x1FFF) cl = cl - 0x4000; + return {r:r,c:cl,cRel:cRel,rRel:rRel}; + } + function parse_RgceLocRel_BIFF2(blob) { + var rl = blob.read_shift(2); + var c = blob.read_shift(1); + var rRel = (rl & 0x8000) >> 15, cRel = (rl & 0x4000) >> 14; + rl &= 0x3FFF; + if(rRel == 1 && rl >= 0x2000) rl = rl - 0x4000; + if(cRel == 1 && c >= 0x80) c = c - 0x100; + return {r:rl,c:c,cRel:cRel,rRel:rRel}; + } + + /* [MS-XLS] 2.5.198.27 ; [MS-XLSB] 2.5.97.18 */ + function parse_PtgArea(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts); + return [type, area]; + } + + /* [MS-XLS] 2.5.198.28 ; [MS-XLSB] 2.5.97.19 */ + function parse_PtgArea3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2, 'i'); + var w = 8; + if(opts) switch(opts.biff) { + case 5: blob.l += 12; w = 6; break; + case 12: w = 12; break; + } + var area = parse_RgceArea(blob, w, opts); + return [type, ixti, area]; + } + + /* [MS-XLS] 2.5.198.29 ; [MS-XLSB] 2.5.97.20 */ + function parse_PtgAreaErr(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + blob.l += opts && (opts.biff > 8) ? 12 : (opts.biff < 8 ? 6 : 8); + return [type]; + } + /* [MS-XLS] 2.5.198.30 ; [MS-XLSB] 2.5.97.21 */ + function parse_PtgAreaErr3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2); + var w = 8; + if(opts) switch(opts.biff) { + case 5: blob.l += 12; w = 6; break; + case 12: w = 12; break; + } + blob.l += w; + return [type, ixti]; + } + + /* [MS-XLS] 2.5.198.31 ; [MS-XLSB] 2.5.97.22 */ + function parse_PtgAreaN(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var area = parse_RgceAreaRel(blob, length - 1, opts); + return [type, area]; + } + + /* [MS-XLS] 2.5.198.32 ; [MS-XLSB] 2.5.97.23 */ + function parse_PtgArray(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + blob.l += opts.biff == 2 ? 6 : opts.biff == 12 ? 14 : 7; + return [type]; + } + + /* [MS-XLS] 2.5.198.33 ; [MS-XLSB] 2.5.97.24 */ + function parse_PtgAttrBaxcel(blob) { + var bitSemi = blob[blob.l+1] & 0x01; /* 1 = volatile */ + var bitBaxcel = 1; + blob.l += 4; + return [bitSemi, bitBaxcel]; + } + + /* [MS-XLS] 2.5.198.34 ; [MS-XLSB] 2.5.97.25 */ + function parse_PtgAttrChoose(blob, length, opts) { + blob.l +=2; + var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + var o = []; + /* offset is 1 less than the number of elements */ + for(var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2)); + return o; + } + + /* [MS-XLS] 2.5.198.35 ; [MS-XLSB] 2.5.97.26 */ + function parse_PtgAttrGoto(blob, length, opts) { + var bitGoto = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; + } + + /* [MS-XLS] 2.5.198.36 ; [MS-XLSB] 2.5.97.27 */ + function parse_PtgAttrIf(blob, length, opts) { + var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitIf, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; + } + + /* [MS-XLSB] 2.5.97.28 */ + function parse_PtgAttrIfError(blob) { + var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitIf, blob.read_shift(2)]; + } + + /* [MS-XLS] 2.5.198.37 ; [MS-XLSB] 2.5.97.29 */ + function parse_PtgAttrSemi(blob, length, opts) { + var bitSemi = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += opts && opts.biff == 2 ? 3 : 4; + return [bitSemi]; + } + + /* [MS-XLS] 2.5.198.40 ; [MS-XLSB] 2.5.97.32 */ + function parse_PtgAttrSpaceType(blob) { + var type = blob.read_shift(1), cch = blob.read_shift(1); + return [type, cch]; + } + + /* [MS-XLS] 2.5.198.38 ; [MS-XLSB] 2.5.97.30 */ + function parse_PtgAttrSpace(blob) { + blob.read_shift(2); + return parse_PtgAttrSpaceType(blob, 2); + } + + /* [MS-XLS] 2.5.198.39 ; [MS-XLSB] 2.5.97.31 */ + function parse_PtgAttrSpaceSemi(blob) { + blob.read_shift(2); + return parse_PtgAttrSpaceType(blob, 2); + } + + /* [MS-XLS] 2.5.198.84 ; [MS-XLSB] 2.5.97.68 TODO */ + function parse_PtgRef(blob, length, opts) { + //var ptg = blob[blob.l] & 0x1F; + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var loc = parse_RgceLoc(blob, 0, opts); + return [type, loc]; + } + + /* [MS-XLS] 2.5.198.88 ; [MS-XLSB] 2.5.97.72 TODO */ + function parse_PtgRefN(blob, length, opts) { + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var loc = parse_RgceLocRel(blob, 0, opts); + return [type, loc]; + } + + /* [MS-XLS] 2.5.198.85 ; [MS-XLSB] 2.5.97.69 TODO */ + function parse_PtgRef3d(blob, length, opts) { + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var ixti = blob.read_shift(2); // XtiIndex + if(opts && opts.biff == 5) blob.l += 12; + var loc = parse_RgceLoc(blob, 0, opts); // TODO: or RgceLocRel + return [type, ixti, loc]; + } + + + /* [MS-XLS] 2.5.198.62 ; [MS-XLSB] 2.5.97.45 TODO */ + function parse_PtgFunc(blob, length, opts) { + //var ptg = blob[blob.l] & 0x1F; + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var iftab = blob.read_shift(opts && opts.biff <= 3 ? 1 : 2); + return [FtabArgc[iftab], Ftab[iftab], type]; + } + /* [MS-XLS] 2.5.198.63 ; [MS-XLSB] 2.5.97.46 TODO */ + function parse_PtgFuncVar(blob, length, opts) { + var type = blob[blob.l++]; + var cparams = blob.read_shift(1), tab = opts && opts.biff <= 3 ? [(type == 0x58 ? -1 : 0), blob.read_shift(1)]: parsetab(blob); + return [cparams, (tab[0] === 0 ? Ftab : Cetab)[tab[1]]]; + } + + function parsetab(blob) { + return [blob[blob.l+1]>>7, blob.read_shift(2) & 0x7FFF]; + } + + /* [MS-XLS] 2.5.198.41 ; [MS-XLSB] 2.5.97.33 */ + function parse_PtgAttrSum(blob, length, opts) { + blob.l += opts && opts.biff == 2 ? 3 : 4; return; + } + + /* [MS-XLS] 2.5.198.58 ; [MS-XLSB] 2.5.97.40 */ + function parse_PtgExp(blob, length, opts) { + blob.l++; + if(opts && opts.biff == 12) return [blob.read_shift(4, 'i'), 0]; + var row = blob.read_shift(2); + var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [row, col]; + } + + /* [MS-XLS] 2.5.198.57 ; [MS-XLSB] 2.5.97.39 */ + function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; } + + /* [MS-XLS] 2.5.198.66 ; [MS-XLSB] 2.5.97.49 */ + function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); } + + /* [MS-XLS] 2.5.198.42 ; [MS-XLSB] 2.5.97.34 */ + function parse_PtgBool(blob) { blob.l++; return blob.read_shift(1)!==0;} + + /* [MS-XLS] 2.5.198.79 ; [MS-XLSB] 2.5.97.63 */ + function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); } + + /* [MS-XLS] 2.5.198.89 ; [MS-XLSB] 2.5.97.74 */ + function parse_PtgStr(blob, length, opts) { blob.l++; return parse_ShortXLUnicodeString(blob, length-1, opts); } + + /* [MS-XLS] 2.5.192.112 + 2.5.192.11{3,4,5,6,7} */ + /* [MS-XLSB] 2.5.97.93 + 2.5.97.9{4,5,6,7} */ + function parse_SerAr(blob, biff) { + var val = [blob.read_shift(1)]; + if(biff == 12) switch(val[0]) { + case 0x02: val[0] = 0x04; break; /* SerBool */ + case 0x04: val[0] = 0x10; break; /* SerErr */ + case 0x00: val[0] = 0x01; break; /* SerNum */ + case 0x01: val[0] = 0x02; break; /* SerStr */ + } + switch(val[0]) { + case 0x04: /* SerBool -- boolean */ + val[1] = parsebool(blob, 1) ? 'TRUE' : 'FALSE'; + if(biff != 12) blob.l += 7; break; + case 0x25: /* appears to be an alias */ + case 0x10: /* SerErr -- error */ + val[1] = BErr[blob[blob.l]]; + blob.l += ((biff == 12) ? 4 : 8); break; + case 0x00: /* SerNil -- honestly, I'm not sure how to reproduce this */ + blob.l += 8; break; + case 0x01: /* SerNum -- Xnum */ + val[1] = parse_Xnum(blob, 8); break; + case 0x02: /* SerStr -- XLUnicodeString (<256 chars) */ + val[1] = parse_XLUnicodeString2(blob, 0, {biff:biff > 0 && biff < 8 ? 2 : biff}); break; + default: throw new Error("Bad SerAr: " + val[0]); /* Unreachable */ + } + return val; + } + + /* [MS-XLS] 2.5.198.61 ; [MS-XLSB] 2.5.97.44 */ + function parse_PtgExtraMem(blob, cce, opts) { + var count = blob.read_shift((opts.biff == 12) ? 4 : 2); + var out = []; + for(var i = 0; i != count; ++i) out.push(((opts.biff == 12) ? parse_UncheckedRfX : parse_Ref8U)(blob, 8)); + return out; + } + + /* [MS-XLS] 2.5.198.59 ; [MS-XLSB] 2.5.97.41 */ + function parse_PtgExtraArray(blob, length, opts) { + var rows = 0, cols = 0; + if(opts.biff == 12) { + rows = blob.read_shift(4); // DRw + cols = blob.read_shift(4); // DCol + } else { + cols = 1 + blob.read_shift(1); //DColByteU + rows = 1 + blob.read_shift(2); //DRw + } + if(opts.biff >= 2 && opts.biff < 8) { --rows; if(--cols == 0) cols = 0x100; } + // $FlowIgnore + for(var i = 0, o = []; i != rows && (o[i] = []); ++i) + for(var j = 0; j != cols; ++j) o[i][j] = parse_SerAr(blob, opts.biff); + return o; + } + + /* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 */ + function parse_PtgName(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var w = (!opts || (opts.biff >= 8)) ? 4 : 2; + var nameindex = blob.read_shift(w); + switch(opts.biff) { + case 2: blob.l += 5; break; + case 3: case 4: blob.l += 8; break; + case 5: blob.l += 12; break; + } + return [type, 0, nameindex]; + } + + /* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 */ + function parse_PtgNameX(blob, length, opts) { + if(opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts); + var type = (blob.read_shift(1) >>> 5) & 0x03; + var ixti = blob.read_shift(2); // XtiIndex + var nameindex = blob.read_shift(4); + return [type, ixti, nameindex]; + } + function parse_PtgNameX_BIFF5(blob) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var ixti = blob.read_shift(2, 'i'); // XtiIndex + blob.l += 8; + var nameindex = blob.read_shift(2); + blob.l += 12; + return [type, ixti, nameindex]; + } + + /* [MS-XLS] 2.5.198.70 ; [MS-XLSB] 2.5.97.54 */ + function parse_PtgMemArea(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + blob.l += (opts && opts.biff == 2 ? 3 : 4); + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [type, cce]; + } + + /* [MS-XLS] 2.5.198.72 ; [MS-XLSB] 2.5.97.56 */ + function parse_PtgMemFunc(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [type, cce]; + } + + + /* [MS-XLS] 2.5.198.86 ; [MS-XLSB] 2.5.97.69 */ + function parse_PtgRefErr(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + blob.l += 4; + if(opts.biff < 8) blob.l--; + if(opts.biff == 12) blob.l += 2; + return [type]; + } + + /* [MS-XLS] 2.5.198.87 ; [MS-XLSB] 2.5.97.71 */ + function parse_PtgRefErr3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2); + var w = 4; + if(opts) switch(opts.biff) { + case 5: w = 15; break; + case 12: w = 6; break; + } + blob.l += w; + return [type, ixti]; + } + + /* [MS-XLS] 2.5.198.71 ; [MS-XLSB] 2.5.97.55 */ + var parse_PtgMemErr = parsenoop; + /* [MS-XLS] 2.5.198.73 ; [MS-XLSB] 2.5.97.57 */ + var parse_PtgMemNoMem = parsenoop; + /* [MS-XLS] 2.5.198.92 */ + var parse_PtgTbl = parsenoop; + + function parse_PtgElfLoc(blob, length, opts) { + blob.l += 2; + return [parse_RgceElfLoc(blob, 4, opts)]; + } + function parse_PtgElfNoop(blob) { + blob.l += 6; + return []; + } + /* [MS-XLS] 2.5.198.46 */ + var parse_PtgElfCol = parse_PtgElfLoc; + /* [MS-XLS] 2.5.198.47 */ + var parse_PtgElfColS = parse_PtgElfNoop; + /* [MS-XLS] 2.5.198.48 */ + var parse_PtgElfColSV = parse_PtgElfNoop; + /* [MS-XLS] 2.5.198.49 */ + var parse_PtgElfColV = parse_PtgElfLoc; + /* [MS-XLS] 2.5.198.50 */ + function parse_PtgElfLel(blob) { + blob.l += 2; + return [parseuint16(blob), blob.read_shift(2) & 0x01]; + } + /* [MS-XLS] 2.5.198.51 */ + var parse_PtgElfRadical = parse_PtgElfLoc; + /* [MS-XLS] 2.5.198.52 */ + var parse_PtgElfRadicalLel = parse_PtgElfLel; + /* [MS-XLS] 2.5.198.53 */ + var parse_PtgElfRadicalS = parse_PtgElfNoop; + /* [MS-XLS] 2.5.198.54 */ + var parse_PtgElfRw = parse_PtgElfLoc; + /* [MS-XLS] 2.5.198.55 */ + var parse_PtgElfRwV = parse_PtgElfLoc; + + /* [MS-XLSB] 2.5.97.52 TODO */ + var PtgListRT = [ + "Data", + "All", + "Headers", + "??", + "?Data2", + "??", + "?DataHeaders", + "??", + "Totals", + "??", + "??", + "??", + "?DataTotals", + "??", + "??", + "??", + "?Current" + ]; + function parse_PtgList(blob) { + blob.l += 2; + var ixti = blob.read_shift(2); + var flags = blob.read_shift(2); + var idx = blob.read_shift(4); + var c = blob.read_shift(2); + var C = blob.read_shift(2); + var rt = PtgListRT[(flags >> 2) & 0x1F]; + return {ixti: ixti, coltype:(flags&0x3), rt:rt, idx:idx, c:c, C:C}; + } + /* [MS-XLS] 2.5.198.91 ; [MS-XLSB] 2.5.97.76 */ + function parse_PtgSxName(blob) { + blob.l += 2; + return [blob.read_shift(4)]; + } + + /* [XLS] old spec */ + function parse_PtgSheet(blob, length, opts) { + blob.l += 5; + blob.l += 2; + blob.l += (opts.biff == 2 ? 1 : 4); + return ["PTGSHEET"]; + } + function parse_PtgEndSheet(blob, length, opts) { + blob.l += (opts.biff == 2 ? 4 : 5); + return ["PTGENDSHEET"]; + } + function parse_PtgMemAreaN(blob) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(2); + return [type, cce]; + } + function parse_PtgMemNoMemN(blob) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(2); + return [type, cce]; + } + function parse_PtgAttrNoop(blob) { + blob.l += 4; + return [0, 0]; + } + + /* [MS-XLS] 2.5.198.25 ; [MS-XLSB] 2.5.97.16 */ + var PtgTypes = { + 0x01: { n:'PtgExp', f:parse_PtgExp }, + 0x02: { n:'PtgTbl', f:parse_PtgTbl }, + 0x03: { n:'PtgAdd', f:parseread1 }, + 0x04: { n:'PtgSub', f:parseread1 }, + 0x05: { n:'PtgMul', f:parseread1 }, + 0x06: { n:'PtgDiv', f:parseread1 }, + 0x07: { n:'PtgPower', f:parseread1 }, + 0x08: { n:'PtgConcat', f:parseread1 }, + 0x09: { n:'PtgLt', f:parseread1 }, + 0x0A: { n:'PtgLe', f:parseread1 }, + 0x0B: { n:'PtgEq', f:parseread1 }, + 0x0C: { n:'PtgGe', f:parseread1 }, + 0x0D: { n:'PtgGt', f:parseread1 }, + 0x0E: { n:'PtgNe', f:parseread1 }, + 0x0F: { n:'PtgIsect', f:parseread1 }, + 0x10: { n:'PtgUnion', f:parseread1 }, + 0x11: { n:'PtgRange', f:parseread1 }, + 0x12: { n:'PtgUplus', f:parseread1 }, + 0x13: { n:'PtgUminus', f:parseread1 }, + 0x14: { n:'PtgPercent', f:parseread1 }, + 0x15: { n:'PtgParen', f:parseread1 }, + 0x16: { n:'PtgMissArg', f:parseread1 }, + 0x17: { n:'PtgStr', f:parse_PtgStr }, + 0x1A: { n:'PtgSheet', f:parse_PtgSheet }, + 0x1B: { n:'PtgEndSheet', f:parse_PtgEndSheet }, + 0x1C: { n:'PtgErr', f:parse_PtgErr }, + 0x1D: { n:'PtgBool', f:parse_PtgBool }, + 0x1E: { n:'PtgInt', f:parse_PtgInt }, + 0x1F: { n:'PtgNum', f:parse_PtgNum }, + 0x20: { n:'PtgArray', f:parse_PtgArray }, + 0x21: { n:'PtgFunc', f:parse_PtgFunc }, + 0x22: { n:'PtgFuncVar', f:parse_PtgFuncVar }, + 0x23: { n:'PtgName', f:parse_PtgName }, + 0x24: { n:'PtgRef', f:parse_PtgRef }, + 0x25: { n:'PtgArea', f:parse_PtgArea }, + 0x26: { n:'PtgMemArea', f:parse_PtgMemArea }, + 0x27: { n:'PtgMemErr', f:parse_PtgMemErr }, + 0x28: { n:'PtgMemNoMem', f:parse_PtgMemNoMem }, + 0x29: { n:'PtgMemFunc', f:parse_PtgMemFunc }, + 0x2A: { n:'PtgRefErr', f:parse_PtgRefErr }, + 0x2B: { n:'PtgAreaErr', f:parse_PtgAreaErr }, + 0x2C: { n:'PtgRefN', f:parse_PtgRefN }, + 0x2D: { n:'PtgAreaN', f:parse_PtgAreaN }, + 0x2E: { n:'PtgMemAreaN', f:parse_PtgMemAreaN }, + 0x2F: { n:'PtgMemNoMemN', f:parse_PtgMemNoMemN }, + 0x39: { n:'PtgNameX', f:parse_PtgNameX }, + 0x3A: { n:'PtgRef3d', f:parse_PtgRef3d }, + 0x3B: { n:'PtgArea3d', f:parse_PtgArea3d }, + 0x3C: { n:'PtgRefErr3d', f:parse_PtgRefErr3d }, + 0x3D: { n:'PtgAreaErr3d', f:parse_PtgAreaErr3d }, + 0xFF: {} + }; + /* These are duplicated in the PtgTypes table */ + var PtgDupes = { + 0x40: 0x20, 0x60: 0x20, + 0x41: 0x21, 0x61: 0x21, + 0x42: 0x22, 0x62: 0x22, + 0x43: 0x23, 0x63: 0x23, + 0x44: 0x24, 0x64: 0x24, + 0x45: 0x25, 0x65: 0x25, + 0x46: 0x26, 0x66: 0x26, + 0x47: 0x27, 0x67: 0x27, + 0x48: 0x28, 0x68: 0x28, + 0x49: 0x29, 0x69: 0x29, + 0x4A: 0x2A, 0x6A: 0x2A, + 0x4B: 0x2B, 0x6B: 0x2B, + 0x4C: 0x2C, 0x6C: 0x2C, + 0x4D: 0x2D, 0x6D: 0x2D, + 0x4E: 0x2E, 0x6E: 0x2E, + 0x4F: 0x2F, 0x6F: 0x2F, + 0x58: 0x22, 0x78: 0x22, + 0x59: 0x39, 0x79: 0x39, + 0x5A: 0x3A, 0x7A: 0x3A, + 0x5B: 0x3B, 0x7B: 0x3B, + 0x5C: 0x3C, 0x7C: 0x3C, + 0x5D: 0x3D, 0x7D: 0x3D + }; + (function(){for(var y in PtgDupes) PtgTypes[y] = PtgTypes[PtgDupes[y]];})(); + + var Ptg18 = { + 0x01: { n:'PtgElfLel', f:parse_PtgElfLel }, + 0x02: { n:'PtgElfRw', f:parse_PtgElfRw }, + 0x03: { n:'PtgElfCol', f:parse_PtgElfCol }, + 0x06: { n:'PtgElfRwV', f:parse_PtgElfRwV }, + 0x07: { n:'PtgElfColV', f:parse_PtgElfColV }, + 0x0A: { n:'PtgElfRadical', f:parse_PtgElfRadical }, + 0x0B: { n:'PtgElfRadicalS', f:parse_PtgElfRadicalS }, + 0x0D: { n:'PtgElfColS', f:parse_PtgElfColS }, + 0x0F: { n:'PtgElfColSV', f:parse_PtgElfColSV }, + 0x10: { n:'PtgElfRadicalLel', f:parse_PtgElfRadicalLel }, + 0x19: { n:'PtgList', f:parse_PtgList }, + 0x1D: { n:'PtgSxName', f:parse_PtgSxName }, + 0xFF: {} + }; + var Ptg19 = { + 0x00: { n:'PtgAttrNoop', f:parse_PtgAttrNoop }, + 0x01: { n:'PtgAttrSemi', f:parse_PtgAttrSemi }, + 0x02: { n:'PtgAttrIf', f:parse_PtgAttrIf }, + 0x04: { n:'PtgAttrChoose', f:parse_PtgAttrChoose }, + 0x08: { n:'PtgAttrGoto', f:parse_PtgAttrGoto }, + 0x10: { n:'PtgAttrSum', f:parse_PtgAttrSum }, + 0x20: { n:'PtgAttrBaxcel', f:parse_PtgAttrBaxcel }, + 0x40: { n:'PtgAttrSpace', f:parse_PtgAttrSpace }, + 0x41: { n:'PtgAttrSpaceSemi', f:parse_PtgAttrSpaceSemi }, + 0x80: { n:'PtgAttrIfError', f:parse_PtgAttrIfError }, + 0xFF: {} + }; + Ptg19[0x21] = Ptg19[0x20]; + + /* [MS-XLS] 2.5.198.103 ; [MS-XLSB] 2.5.97.87 */ + function parse_RgbExtra(blob, length, rgce, opts) { + if(opts.biff < 8) return parsenoop(blob, length); + var target = blob.l + length; + var o = []; + for(var i = 0; i !== rgce.length; ++i) { + switch(rgce[i][0]) { + case 'PtgArray': /* PtgArray -> PtgExtraArray */ + rgce[i][1] = parse_PtgExtraArray(blob, 0, opts); + o.push(rgce[i][1]); + break; + case 'PtgMemArea': /* PtgMemArea -> PtgExtraMem */ + rgce[i][2] = parse_PtgExtraMem(blob, rgce[i][1], opts); + o.push(rgce[i][2]); + break; + case 'PtgExp': /* PtgExp -> PtgExtraCol */ + if(opts && opts.biff == 12) { + rgce[i][1][1] = blob.read_shift(4); + o.push(rgce[i][1]); + } break; + case 'PtgList': /* TODO: PtgList -> PtgExtraList */ + case 'PtgElfRadicalS': /* TODO: PtgElfRadicalS -> PtgExtraElf */ + case 'PtgElfColS': /* TODO: PtgElfColS -> PtgExtraElf */ + case 'PtgElfColSV': /* TODO: PtgElfColSV -> PtgExtraElf */ + throw "Unsupported " + rgce[i][0]; + default: break; + } + } + length = target - blob.l; + /* note: this is technically an error but Excel disregards */ + //if(target !== blob.l && blob.l !== target - length) throw new Error(target + " != " + blob.l); + if(length !== 0) o.push(parsenoop(blob, length)); + return o; + } + + /* [MS-XLS] 2.5.198.104 ; [MS-XLSB] 2.5.97.88 */ + function parse_Rgce(blob, length, opts) { + var target = blob.l + length; + var R, id, ptgs = []; + while(target != blob.l) { + length = target - blob.l; + id = blob[blob.l]; + R = PtgTypes[id]; + if(id === 0x18 || id === 0x19) R = (id === 0x18 ? Ptg18 : Ptg19)[blob[blob.l + 1]]; + if(!R || !R.f) { /*ptgs.push*/(parsenoop(blob, length)); } + else { ptgs.push([R.n, R.f(blob, length, opts)]); } + } + return ptgs; + } + + function stringify_array(f) { + var o = []; + for(var i = 0; i < f.length; ++i) { + var x = f[i], r = []; + for(var j = 0; j < x.length; ++j) { + var y = x[j]; + if(y) switch(y[0]) { + // TODO: handle embedded quotes + case 0x02: + r.push('"' + y[1].replace(/"/g,'""') + '"'); break; + default: r.push(y[1]); + } else r.push(""); + } + o.push(r.join(",")); + } + return o.join(";"); + } + + /* [MS-XLS] 2.2.2 ; [MS-XLSB] 2.2.2 TODO */ + var PtgBinOp = { + PtgAdd: "+", + PtgConcat: "&", + PtgDiv: "/", + PtgEq: "=", + PtgGe: ">=", + PtgGt: ">", + PtgLe: "<=", + PtgLt: "<", + PtgMul: "*", + PtgNe: "<>", + PtgPower: "^", + PtgSub: "-" + }; + function formula_quote_sheet_name(sname, opts) { + if(!sname && !(opts && opts.biff <= 5 && opts.biff >= 2)) throw new Error("empty sheet name"); + if(sname.indexOf(" ") > -1) return "'" + sname + "'"; + return sname; + } + function get_ixti_raw(supbooks, ixti, opts) { + if(!supbooks) return "SH33TJSERR0"; + if(opts.biff > 8 && (!supbooks.XTI || !supbooks.XTI[ixti])) return supbooks.SheetNames[ixti]; + if(!supbooks.XTI) return "SH33TJSERR6"; + var XTI = supbooks.XTI[ixti]; + if(opts.biff < 8) { + if(ixti > 10000) ixti-= 65536; + if(ixti < 0) ixti = -ixti; + return ixti == 0 ? "" : supbooks.XTI[ixti - 1]; + } + if(!XTI) return "SH33TJSERR1"; + var o = ""; + if(opts.biff > 8) switch(supbooks[XTI[0]][0]) { + case 0x0165: /* 'BrtSupSelf' */ + o = XTI[1] == -1 ? "#REF" : supbooks.SheetNames[XTI[1]]; + return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; + case 0x0166: /* 'BrtSupSame' */ + if(opts.SID != null) return supbooks.SheetNames[opts.SID]; + return "SH33TJSSAME" + supbooks[XTI[0]][0]; + case 0x0163: /* 'BrtSupBookSrc' */ + /* falls through */ + default: return "SH33TJSSRC" + supbooks[XTI[0]][0]; + } + switch(supbooks[XTI[0]][0][0]) { + case 0x0401: + o = XTI[1] == -1 ? "#REF" : (supbooks.SheetNames[XTI[1]] || "SH33TJSERR3"); + return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; + case 0x3A01: return "SH33TJSERR8"; + default: + if(!supbooks[XTI[0]][0][3]) return "SH33TJSERR2"; + o = XTI[1] == -1 ? "#REF" : (supbooks[XTI[0]][0][3][XTI[1]] || "SH33TJSERR4"); + return XTI[1] == XTI[2] ? o : o + ":" + supbooks[XTI[0]][0][3][XTI[2]]; + } + } + function get_ixti(supbooks, ixti, opts) { + return formula_quote_sheet_name(get_ixti_raw(supbooks, ixti, opts), opts); + } + function stringify_formula(formula/*Array*/, range, cell, supbooks, opts) { + var biff = (opts && opts.biff) || 8; + var _range = /*range != null ? range :*/ {s:{c:0, r:0},e:{c:0, r:0}}; + var stack = [], e1, e2, c, ixti=0, nameidx=0, r, sname=""; + if(!formula[0] || !formula[0][0]) return ""; + var last_sp = -1, sp = ""; + for(var ff = 0, fflen = formula[0].length; ff < fflen; ++ff) { + var f = formula[0][ff]; + switch(f[0]) { + case 'PtgUminus': /* [MS-XLS] 2.5.198.93 */ + stack.push("-" + stack.pop()); break; + case 'PtgUplus': /* [MS-XLS] 2.5.198.95 */ + stack.push("+" + stack.pop()); break; + case 'PtgPercent': /* [MS-XLS] 2.5.198.81 */ + stack.push(stack.pop() + "%"); break; + + case 'PtgAdd': /* [MS-XLS] 2.5.198.26 */ + case 'PtgConcat': /* [MS-XLS] 2.5.198.43 */ + case 'PtgDiv': /* [MS-XLS] 2.5.198.45 */ + case 'PtgEq': /* [MS-XLS] 2.5.198.56 */ + case 'PtgGe': /* [MS-XLS] 2.5.198.64 */ + case 'PtgGt': /* [MS-XLS] 2.5.198.65 */ + case 'PtgLe': /* [MS-XLS] 2.5.198.68 */ + case 'PtgLt': /* [MS-XLS] 2.5.198.69 */ + case 'PtgMul': /* [MS-XLS] 2.5.198.75 */ + case 'PtgNe': /* [MS-XLS] 2.5.198.78 */ + case 'PtgPower': /* [MS-XLS] 2.5.198.82 */ + case 'PtgSub': /* [MS-XLS] 2.5.198.90 */ + e1 = stack.pop(); e2 = stack.pop(); + if(last_sp >= 0) { + switch(formula[0][last_sp][1][0]) { + case 0: + // $FlowIgnore + sp = fill(" ", formula[0][last_sp][1][1]); break; + case 1: + // $FlowIgnore + sp = fill("\r", formula[0][last_sp][1][1]); break; + default: + sp = ""; + // $FlowIgnore + if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); + } + e2 = e2 + sp; + last_sp = -1; + } + stack.push(e2+PtgBinOp[f[0]]+e1); + break; + + case 'PtgIsect': /* [MS-XLS] 2.5.198.67 */ + e1 = stack.pop(); e2 = stack.pop(); + stack.push(e2+" "+e1); + break; + case 'PtgUnion': /* [MS-XLS] 2.5.198.94 */ + e1 = stack.pop(); e2 = stack.pop(); + stack.push(e2+","+e1); + break; + case 'PtgRange': /* [MS-XLS] 2.5.198.83 */ + e1 = stack.pop(); e2 = stack.pop(); + stack.push(e2+":"+e1); + break; + + case 'PtgAttrChoose': /* [MS-XLS] 2.5.198.34 */ + break; + case 'PtgAttrGoto': /* [MS-XLS] 2.5.198.35 */ + break; + case 'PtgAttrIf': /* [MS-XLS] 2.5.198.36 */ + break; + case 'PtgAttrIfError': /* [MS-XLSB] 2.5.97.28 */ + break; + + + case 'PtgRef': /* [MS-XLS] 2.5.198.84 */ + c = shift_cell_xls((f[1][1]), _range, opts); + stack.push(encode_cell_xls(c, biff)); + break; + case 'PtgRefN': /* [MS-XLS] 2.5.198.88 */ + c = cell ? shift_cell_xls((f[1][1]), cell, opts) : (f[1][1]); + stack.push(encode_cell_xls(c, biff)); + break; + case 'PtgRef3d': /* [MS-XLS] 2.5.198.85 */ + ixti = f[1][1]; c = shift_cell_xls((f[1][2]), _range, opts); + sname = get_ixti(supbooks, ixti, opts); + var w = sname; /* IE9 fails on defined names */ // eslint-disable-line no-unused-vars + stack.push(sname + "!" + encode_cell_xls(c, biff)); + break; + + case 'PtgFunc': /* [MS-XLS] 2.5.198.62 */ + case 'PtgFuncVar': /* [MS-XLS] 2.5.198.63 */ + /* f[1] = [argc, func, type] */ + var argc = (f[1][0]), func = (f[1][1]); + if(!argc) argc = 0; + argc &= 0x7F; + var args = argc == 0 ? [] : stack.slice(-argc); + stack.length -= argc; + if(func === 'User') func = args.shift(); + stack.push(func + "(" + args.join(",") + ")"); + break; + + case 'PtgBool': /* [MS-XLS] 2.5.198.42 */ + stack.push(f[1] ? "TRUE" : "FALSE"); break; + case 'PtgInt': /* [MS-XLS] 2.5.198.66 */ + stack.push(f[1]); break; + case 'PtgNum': /* [MS-XLS] 2.5.198.79 TODO: precision? */ + stack.push(String(f[1])); break; + case 'PtgStr': /* [MS-XLS] 2.5.198.89 */ + // $FlowIgnore + stack.push('"' + f[1] + '"'); break; + case 'PtgErr': /* [MS-XLS] 2.5.198.57 */ + stack.push(f[1]); break; + case 'PtgAreaN': /* [MS-XLS] 2.5.198.31 TODO */ + r = shift_range_xls(f[1][1], cell ? {s:cell} : _range, opts); + stack.push(encode_range_xls((r), opts)); + break; + case 'PtgArea': /* [MS-XLS] 2.5.198.27 TODO: fixed points */ + r = shift_range_xls(f[1][1], _range, opts); + stack.push(encode_range_xls((r), opts)); + break; + case 'PtgArea3d': /* [MS-XLS] 2.5.198.28 TODO */ + ixti = f[1][1]; r = f[1][2]; + sname = get_ixti(supbooks, ixti, opts); + stack.push(sname + "!" + encode_range_xls((r), opts)); + break; + case 'PtgAttrSum': /* [MS-XLS] 2.5.198.41 */ + stack.push("SUM(" + stack.pop() + ")"); + break; + + case 'PtgAttrBaxcel': /* [MS-XLS] 2.5.198.33 */ + case 'PtgAttrSemi': /* [MS-XLS] 2.5.198.37 */ + break; + + case 'PtgName': /* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 TODO: revisions */ + /* f[1] = type, 0, nameindex */ + nameidx = (f[1][2]); + var lbl = (supbooks.names||[])[nameidx-1] || (supbooks[0]||[])[nameidx]; + var name = lbl ? lbl.Name : "SH33TJSNAME" + String(nameidx); + if(name in XLSXFutureFunctions) name = XLSXFutureFunctions[name]; + stack.push(name); + break; + + case 'PtgNameX': /* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 TODO: revisions */ + /* f[1] = type, ixti, nameindex */ + var bookidx = (f[1][1]); nameidx = (f[1][2]); var externbook; + /* TODO: Properly handle missing values */ + if(opts.biff <= 5) { + if(bookidx < 0) bookidx = -bookidx; + if(supbooks[bookidx]) externbook = supbooks[bookidx][nameidx]; + } else { + var o = ""; + if(((supbooks[bookidx]||[])[0]||[])[0] == 0x3A01){/* empty */} + else if(((supbooks[bookidx]||[])[0]||[])[0] == 0x0401){ + if(supbooks[bookidx][nameidx] && supbooks[bookidx][nameidx].itab > 0) { + o = supbooks.SheetNames[supbooks[bookidx][nameidx].itab-1] + "!"; + } + } + else o = supbooks.SheetNames[nameidx-1]+ "!"; + if(supbooks[bookidx] && supbooks[bookidx][nameidx]) o += supbooks[bookidx][nameidx].Name; + else if(supbooks[0] && supbooks[0][nameidx]) o += supbooks[0][nameidx].Name; + else o += "SH33TJSERRX"; + stack.push(o); + break; + } + if(!externbook) externbook = {Name: "SH33TJSERRY"}; + stack.push(externbook.Name); + break; + + case 'PtgParen': /* [MS-XLS] 2.5.198.80 */ + var lp = '(', rp = ')'; + if(last_sp >= 0) { + sp = ""; + switch(formula[0][last_sp][1][0]) { + // $FlowIgnore + case 2: lp = fill(" ", formula[0][last_sp][1][1]) + lp; break; + // $FlowIgnore + case 3: lp = fill("\r", formula[0][last_sp][1][1]) + lp; break; + // $FlowIgnore + case 4: rp = fill(" ", formula[0][last_sp][1][1]) + rp; break; + // $FlowIgnore + case 5: rp = fill("\r", formula[0][last_sp][1][1]) + rp; break; + default: + // $FlowIgnore + if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); + } + last_sp = -1; + } + stack.push(lp + stack.pop() + rp); break; + + case 'PtgRefErr': /* [MS-XLS] 2.5.198.86 */ + stack.push('#REF!'); break; + + case 'PtgRefErr3d': /* [MS-XLS] 2.5.198.87 */ + stack.push('#REF!'); break; + + case 'PtgExp': /* [MS-XLS] 2.5.198.58 TODO */ + c = {c:(f[1][1]),r:(f[1][0])}; + var q = ({c: cell.c, r:cell.r}); + if(supbooks.sharedf[encode_cell(c)]) { + var parsedf = (supbooks.sharedf[encode_cell(c)]); + stack.push(stringify_formula(parsedf, _range, q, supbooks, opts)); + } + else { + var fnd = false; + for(e1=0;e1!=supbooks.arrayf.length; ++e1) { + /* TODO: should be something like range_has */ + e2 = supbooks.arrayf[e1]; + if(c.c < e2[0].s.c || c.c > e2[0].e.c) continue; + if(c.r < e2[0].s.r || c.r > e2[0].e.r) continue; + stack.push(stringify_formula(e2[1], _range, q, supbooks, opts)); + fnd = true; + break; + } + if(!fnd) stack.push(f[1]); + } + break; + + case 'PtgArray': /* [MS-XLS] 2.5.198.32 TODO */ + stack.push("{" + stringify_array(f[1]) + "}"); + break; + + case 'PtgMemArea': /* [MS-XLS] 2.5.198.70 TODO: confirm this is a non-display */ + //stack.push("(" + f[2].map(encode_range).join(",") + ")"); + break; + + case 'PtgAttrSpace': /* [MS-XLS] 2.5.198.38 */ + case 'PtgAttrSpaceSemi': /* [MS-XLS] 2.5.198.39 */ + last_sp = ff; + break; + + case 'PtgTbl': /* [MS-XLS] 2.5.198.92 TODO */ + break; + + case 'PtgMemErr': /* [MS-XLS] 2.5.198.71 */ + break; + + case 'PtgMissArg': /* [MS-XLS] 2.5.198.74 */ + stack.push(""); + break; + + case 'PtgAreaErr': /* [MS-XLS] 2.5.198.29 */ + stack.push("#REF!"); break; + + case 'PtgAreaErr3d': /* [MS-XLS] 2.5.198.30 */ + stack.push("#REF!"); break; + + case 'PtgList': /* [MS-XLSB] 2.5.97.52 */ + // $FlowIgnore + stack.push("Table" + f[1].idx + "[#" + f[1].rt + "]"); + break; + + case 'PtgMemAreaN': + case 'PtgMemNoMemN': + case 'PtgAttrNoop': + case 'PtgSheet': + case 'PtgEndSheet': + break; + + case 'PtgMemFunc': /* [MS-XLS] 2.5.198.72 TODO */ + break; + case 'PtgMemNoMem': /* [MS-XLS] 2.5.198.73 TODO */ + break; + + case 'PtgElfCol': /* [MS-XLS] 2.5.198.46 */ + case 'PtgElfColS': /* [MS-XLS] 2.5.198.47 */ + case 'PtgElfColSV': /* [MS-XLS] 2.5.198.48 */ + case 'PtgElfColV': /* [MS-XLS] 2.5.198.49 */ + case 'PtgElfLel': /* [MS-XLS] 2.5.198.50 */ + case 'PtgElfRadical': /* [MS-XLS] 2.5.198.51 */ + case 'PtgElfRadicalLel': /* [MS-XLS] 2.5.198.52 */ + case 'PtgElfRadicalS': /* [MS-XLS] 2.5.198.53 */ + case 'PtgElfRw': /* [MS-XLS] 2.5.198.54 */ + case 'PtgElfRwV': /* [MS-XLS] 2.5.198.55 */ + throw new Error("Unsupported ELFs"); + + case 'PtgSxName': /* [MS-XLS] 2.5.198.91 TODO -- find a test case */ + throw new Error('Unrecognized Formula Token: ' + String(f)); + default: throw new Error('Unrecognized Formula Token: ' + String(f)); + } + var PtgNonDisp = ['PtgAttrSpace', 'PtgAttrSpaceSemi', 'PtgAttrGoto']; + if(opts.biff != 3) if(last_sp >= 0 && PtgNonDisp.indexOf(formula[0][ff][0]) == -1) { + f = formula[0][last_sp]; + var _left = true; + switch(f[1][0]) { + /* note: some bad XLSB files omit the PtgParen */ + case 4: _left = false; + /* falls through */ + case 0: + // $FlowIgnore + sp = fill(" ", f[1][1]); break; + case 5: _left = false; + /* falls through */ + case 1: + // $FlowIgnore + sp = fill("\r", f[1][1]); break; + default: + sp = ""; + // $FlowIgnore + if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + f[1][0]); + } + stack.push((_left ? sp : "") + stack.pop() + (_left ? "" : sp)); + last_sp = -1; + } + } + if(stack.length > 1 && opts.WTF) throw new Error("bad formula stack"); + return stack[0]; + } + + /* [MS-XLS] 2.5.198.1 TODO */ + function parse_ArrayParsedFormula(blob, length, opts) { + var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; + var rgcb, cce = blob.read_shift(len); // length of rgce + if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; + var rgce = parse_Rgce(blob, cce, opts); + if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); + blob.l = target; + return [rgce, rgcb]; + } + + /* [MS-XLS] 2.5.198.3 TODO */ + function parse_XLSCellParsedFormula(blob, length, opts) { + var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; + var rgcb, cce = blob.read_shift(len); // length of rgce + if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; + var rgce = parse_Rgce(blob, cce, opts); + if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); + blob.l = target; + return [rgce, rgcb]; + } + + /* [MS-XLS] 2.5.198.21 */ + function parse_NameParsedFormula(blob, length, opts, cce) { + var target = blob.l + length; + var rgce = parse_Rgce(blob, cce, opts); + var rgcb; + if(target !== blob.l) rgcb = parse_RgbExtra(blob, target - blob.l, rgce, opts); + return [rgce, rgcb]; + } + + /* [MS-XLS] 2.5.198.118 TODO */ + function parse_SharedParsedFormula(blob, length, opts) { + var target = blob.l + length; + var rgcb, cce = blob.read_shift(2); // length of rgce + var rgce = parse_Rgce(blob, cce, opts); + if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; + if(length !== cce + 2) rgcb = parse_RgbExtra(blob, target - cce - 2, rgce, opts); + return [rgce, rgcb]; + } + + /* [MS-XLS] 2.5.133 TODO: how to emit empty strings? */ + function parse_FormulaValue(blob) { + var b; + if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n']; + switch(blob[blob.l]) { + case 0x00: blob.l += 8; return ["String", 's']; + case 0x01: b = blob[blob.l+2] === 0x1; blob.l += 8; return [b,'b']; + case 0x02: b = blob[blob.l+2]; blob.l += 8; return [b,'e']; + case 0x03: blob.l += 8; return ["",'s']; + } + return []; + } + + /* [MS-XLS] 2.4.127 TODO */ + function parse_Formula(blob, length, opts) { + var end = blob.l + length; + var cell = parse_XLSCell(blob, 6); + if(opts.biff == 2) ++blob.l; + var val = parse_FormulaValue(blob,8); + var flags = blob.read_shift(1); + if(opts.biff != 2) { + blob.read_shift(1); + if(opts.biff >= 5) { + /*var chn = */blob.read_shift(4); + } + } + var cbf = parse_XLSCellParsedFormula(blob, end - blob.l, opts); + return {cell:cell, val:val[0], formula:cbf, shared: (flags >> 3) & 1, tt:val[1]}; + } + + /* XLSB Parsed Formula records have the same shape */ + function parse_XLSBParsedFormula(data, length, opts) { + var cce = data.read_shift(4); + var rgce = parse_Rgce(data, cce, opts); + var cb = data.read_shift(4); + var rgcb = cb > 0 ? parse_RgbExtra(data, cb, rgce, opts) : null; + return [rgce, rgcb]; + } + + /* [MS-XLSB] 2.5.97.1 ArrayParsedFormula */ + var parse_XLSBArrayParsedFormula = parse_XLSBParsedFormula; + /* [MS-XLSB] 2.5.97.4 CellParsedFormula */ + var parse_XLSBCellParsedFormula = parse_XLSBParsedFormula; + /* [MS-XLSB] 2.5.97.12 NameParsedFormula */ + var parse_XLSBNameParsedFormula = parse_XLSBParsedFormula; + /* [MS-XLSB] 2.5.97.98 SharedParsedFormula */ + var parse_XLSBSharedParsedFormula = parse_XLSBParsedFormula; + /* [MS-XLS] 2.5.198.4 */ + var Cetab = { + 0x0000: 'BEEP', + 0x0001: 'OPEN', + 0x0002: 'OPEN.LINKS', + 0x0003: 'CLOSE.ALL', + 0x0004: 'SAVE', + 0x0005: 'SAVE.AS', + 0x0006: 'FILE.DELETE', + 0x0007: 'PAGE.SETUP', + 0x0008: 'PRINT', + 0x0009: 'PRINTER.SETUP', + 0x000A: 'QUIT', + 0x000B: 'NEW.WINDOW', + 0x000C: 'ARRANGE.ALL', + 0x000D: 'WINDOW.SIZE', + 0x000E: 'WINDOW.MOVE', + 0x000F: 'FULL', + 0x0010: 'CLOSE', + 0x0011: 'RUN', + 0x0016: 'SET.PRINT.AREA', + 0x0017: 'SET.PRINT.TITLES', + 0x0018: 'SET.PAGE.BREAK', + 0x0019: 'REMOVE.PAGE.BREAK', + 0x001A: 'FONT', + 0x001B: 'DISPLAY', + 0x001C: 'PROTECT.DOCUMENT', + 0x001D: 'PRECISION', + 0x001E: 'A1.R1C1', + 0x001F: 'CALCULATE.NOW', + 0x0020: 'CALCULATION', + 0x0022: 'DATA.FIND', + 0x0023: 'EXTRACT', + 0x0024: 'DATA.DELETE', + 0x0025: 'SET.DATABASE', + 0x0026: 'SET.CRITERIA', + 0x0027: 'SORT', + 0x0028: 'DATA.SERIES', + 0x0029: 'TABLE', + 0x002A: 'FORMAT.NUMBER', + 0x002B: 'ALIGNMENT', + 0x002C: 'STYLE', + 0x002D: 'BORDER', + 0x002E: 'CELL.PROTECTION', + 0x002F: 'COLUMN.WIDTH', + 0x0030: 'UNDO', + 0x0031: 'CUT', + 0x0032: 'COPY', + 0x0033: 'PASTE', + 0x0034: 'CLEAR', + 0x0035: 'PASTE.SPECIAL', + 0x0036: 'EDIT.DELETE', + 0x0037: 'INSERT', + 0x0038: 'FILL.RIGHT', + 0x0039: 'FILL.DOWN', + 0x003D: 'DEFINE.NAME', + 0x003E: 'CREATE.NAMES', + 0x003F: 'FORMULA.GOTO', + 0x0040: 'FORMULA.FIND', + 0x0041: 'SELECT.LAST.CELL', + 0x0042: 'SHOW.ACTIVE.CELL', + 0x0043: 'GALLERY.AREA', + 0x0044: 'GALLERY.BAR', + 0x0045: 'GALLERY.COLUMN', + 0x0046: 'GALLERY.LINE', + 0x0047: 'GALLERY.PIE', + 0x0048: 'GALLERY.SCATTER', + 0x0049: 'COMBINATION', + 0x004A: 'PREFERRED', + 0x004B: 'ADD.OVERLAY', + 0x004C: 'GRIDLINES', + 0x004D: 'SET.PREFERRED', + 0x004E: 'AXES', + 0x004F: 'LEGEND', + 0x0050: 'ATTACH.TEXT', + 0x0051: 'ADD.ARROW', + 0x0052: 'SELECT.CHART', + 0x0053: 'SELECT.PLOT.AREA', + 0x0054: 'PATTERNS', + 0x0055: 'MAIN.CHART', + 0x0056: 'OVERLAY', + 0x0057: 'SCALE', + 0x0058: 'FORMAT.LEGEND', + 0x0059: 'FORMAT.TEXT', + 0x005A: 'EDIT.REPEAT', + 0x005B: 'PARSE', + 0x005C: 'JUSTIFY', + 0x005D: 'HIDE', + 0x005E: 'UNHIDE', + 0x005F: 'WORKSPACE', + 0x0060: 'FORMULA', + 0x0061: 'FORMULA.FILL', + 0x0062: 'FORMULA.ARRAY', + 0x0063: 'DATA.FIND.NEXT', + 0x0064: 'DATA.FIND.PREV', + 0x0065: 'FORMULA.FIND.NEXT', + 0x0066: 'FORMULA.FIND.PREV', + 0x0067: 'ACTIVATE', + 0x0068: 'ACTIVATE.NEXT', + 0x0069: 'ACTIVATE.PREV', + 0x006A: 'UNLOCKED.NEXT', + 0x006B: 'UNLOCKED.PREV', + 0x006C: 'COPY.PICTURE', + 0x006D: 'SELECT', + 0x006E: 'DELETE.NAME', + 0x006F: 'DELETE.FORMAT', + 0x0070: 'VLINE', + 0x0071: 'HLINE', + 0x0072: 'VPAGE', + 0x0073: 'HPAGE', + 0x0074: 'VSCROLL', + 0x0075: 'HSCROLL', + 0x0076: 'ALERT', + 0x0077: 'NEW', + 0x0078: 'CANCEL.COPY', + 0x0079: 'SHOW.CLIPBOARD', + 0x007A: 'MESSAGE', + 0x007C: 'PASTE.LINK', + 0x007D: 'APP.ACTIVATE', + 0x007E: 'DELETE.ARROW', + 0x007F: 'ROW.HEIGHT', + 0x0080: 'FORMAT.MOVE', + 0x0081: 'FORMAT.SIZE', + 0x0082: 'FORMULA.REPLACE', + 0x0083: 'SEND.KEYS', + 0x0084: 'SELECT.SPECIAL', + 0x0085: 'APPLY.NAMES', + 0x0086: 'REPLACE.FONT', + 0x0087: 'FREEZE.PANES', + 0x0088: 'SHOW.INFO', + 0x0089: 'SPLIT', + 0x008A: 'ON.WINDOW', + 0x008B: 'ON.DATA', + 0x008C: 'DISABLE.INPUT', + 0x008E: 'OUTLINE', + 0x008F: 'LIST.NAMES', + 0x0090: 'FILE.CLOSE', + 0x0091: 'SAVE.WORKBOOK', + 0x0092: 'DATA.FORM', + 0x0093: 'COPY.CHART', + 0x0094: 'ON.TIME', + 0x0095: 'WAIT', + 0x0096: 'FORMAT.FONT', + 0x0097: 'FILL.UP', + 0x0098: 'FILL.LEFT', + 0x0099: 'DELETE.OVERLAY', + 0x009B: 'SHORT.MENUS', + 0x009F: 'SET.UPDATE.STATUS', + 0x00A1: 'COLOR.PALETTE', + 0x00A2: 'DELETE.STYLE', + 0x00A3: 'WINDOW.RESTORE', + 0x00A4: 'WINDOW.MAXIMIZE', + 0x00A6: 'CHANGE.LINK', + 0x00A7: 'CALCULATE.DOCUMENT', + 0x00A8: 'ON.KEY', + 0x00A9: 'APP.RESTORE', + 0x00AA: 'APP.MOVE', + 0x00AB: 'APP.SIZE', + 0x00AC: 'APP.MINIMIZE', + 0x00AD: 'APP.MAXIMIZE', + 0x00AE: 'BRING.TO.FRONT', + 0x00AF: 'SEND.TO.BACK', + 0x00B9: 'MAIN.CHART.TYPE', + 0x00BA: 'OVERLAY.CHART.TYPE', + 0x00BB: 'SELECT.END', + 0x00BC: 'OPEN.MAIL', + 0x00BD: 'SEND.MAIL', + 0x00BE: 'STANDARD.FONT', + 0x00BF: 'CONSOLIDATE', + 0x00C0: 'SORT.SPECIAL', + 0x00C1: 'GALLERY.3D.AREA', + 0x00C2: 'GALLERY.3D.COLUMN', + 0x00C3: 'GALLERY.3D.LINE', + 0x00C4: 'GALLERY.3D.PIE', + 0x00C5: 'VIEW.3D', + 0x00C6: 'GOAL.SEEK', + 0x00C7: 'WORKGROUP', + 0x00C8: 'FILL.GROUP', + 0x00C9: 'UPDATE.LINK', + 0x00CA: 'PROMOTE', + 0x00CB: 'DEMOTE', + 0x00CC: 'SHOW.DETAIL', + 0x00CE: 'UNGROUP', + 0x00CF: 'OBJECT.PROPERTIES', + 0x00D0: 'SAVE.NEW.OBJECT', + 0x00D1: 'SHARE', + 0x00D2: 'SHARE.NAME', + 0x00D3: 'DUPLICATE', + 0x00D4: 'APPLY.STYLE', + 0x00D5: 'ASSIGN.TO.OBJECT', + 0x00D6: 'OBJECT.PROTECTION', + 0x00D7: 'HIDE.OBJECT', + 0x00D8: 'SET.EXTRACT', + 0x00D9: 'CREATE.PUBLISHER', + 0x00DA: 'SUBSCRIBE.TO', + 0x00DB: 'ATTRIBUTES', + 0x00DC: 'SHOW.TOOLBAR', + 0x00DE: 'PRINT.PREVIEW', + 0x00DF: 'EDIT.COLOR', + 0x00E0: 'SHOW.LEVELS', + 0x00E1: 'FORMAT.MAIN', + 0x00E2: 'FORMAT.OVERLAY', + 0x00E3: 'ON.RECALC', + 0x00E4: 'EDIT.SERIES', + 0x00E5: 'DEFINE.STYLE', + 0x00F0: 'LINE.PRINT', + 0x00F3: 'ENTER.DATA', + 0x00F9: 'GALLERY.RADAR', + 0x00FA: 'MERGE.STYLES', + 0x00FB: 'EDITION.OPTIONS', + 0x00FC: 'PASTE.PICTURE', + 0x00FD: 'PASTE.PICTURE.LINK', + 0x00FE: 'SPELLING', + 0x0100: 'ZOOM', + 0x0103: 'INSERT.OBJECT', + 0x0104: 'WINDOW.MINIMIZE', + 0x0109: 'SOUND.NOTE', + 0x010A: 'SOUND.PLAY', + 0x010B: 'FORMAT.SHAPE', + 0x010C: 'EXTEND.POLYGON', + 0x010D: 'FORMAT.AUTO', + 0x0110: 'GALLERY.3D.BAR', + 0x0111: 'GALLERY.3D.SURFACE', + 0x0112: 'FILL.AUTO', + 0x0114: 'CUSTOMIZE.TOOLBAR', + 0x0115: 'ADD.TOOL', + 0x0116: 'EDIT.OBJECT', + 0x0117: 'ON.DOUBLECLICK', + 0x0118: 'ON.ENTRY', + 0x0119: 'WORKBOOK.ADD', + 0x011A: 'WORKBOOK.MOVE', + 0x011B: 'WORKBOOK.COPY', + 0x011C: 'WORKBOOK.OPTIONS', + 0x011D: 'SAVE.WORKSPACE', + 0x0120: 'CHART.WIZARD', + 0x0121: 'DELETE.TOOL', + 0x0122: 'MOVE.TOOL', + 0x0123: 'WORKBOOK.SELECT', + 0x0124: 'WORKBOOK.ACTIVATE', + 0x0125: 'ASSIGN.TO.TOOL', + 0x0127: 'COPY.TOOL', + 0x0128: 'RESET.TOOL', + 0x0129: 'CONSTRAIN.NUMERIC', + 0x012A: 'PASTE.TOOL', + 0x012E: 'WORKBOOK.NEW', + 0x0131: 'SCENARIO.CELLS', + 0x0132: 'SCENARIO.DELETE', + 0x0133: 'SCENARIO.ADD', + 0x0134: 'SCENARIO.EDIT', + 0x0135: 'SCENARIO.SHOW', + 0x0136: 'SCENARIO.SHOW.NEXT', + 0x0137: 'SCENARIO.SUMMARY', + 0x0138: 'PIVOT.TABLE.WIZARD', + 0x0139: 'PIVOT.FIELD.PROPERTIES', + 0x013A: 'PIVOT.FIELD', + 0x013B: 'PIVOT.ITEM', + 0x013C: 'PIVOT.ADD.FIELDS', + 0x013E: 'OPTIONS.CALCULATION', + 0x013F: 'OPTIONS.EDIT', + 0x0140: 'OPTIONS.VIEW', + 0x0141: 'ADDIN.MANAGER', + 0x0142: 'MENU.EDITOR', + 0x0143: 'ATTACH.TOOLBARS', + 0x0144: 'VBAActivate', + 0x0145: 'OPTIONS.CHART', + 0x0148: 'VBA.INSERT.FILE', + 0x014A: 'VBA.PROCEDURE.DEFINITION', + 0x0150: 'ROUTING.SLIP', + 0x0152: 'ROUTE.DOCUMENT', + 0x0153: 'MAIL.LOGON', + 0x0156: 'INSERT.PICTURE', + 0x0157: 'EDIT.TOOL', + 0x0158: 'GALLERY.DOUGHNUT', + 0x015E: 'CHART.TREND', + 0x0160: 'PIVOT.ITEM.PROPERTIES', + 0x0162: 'WORKBOOK.INSERT', + 0x0163: 'OPTIONS.TRANSITION', + 0x0164: 'OPTIONS.GENERAL', + 0x0172: 'FILTER.ADVANCED', + 0x0175: 'MAIL.ADD.MAILER', + 0x0176: 'MAIL.DELETE.MAILER', + 0x0177: 'MAIL.REPLY', + 0x0178: 'MAIL.REPLY.ALL', + 0x0179: 'MAIL.FORWARD', + 0x017A: 'MAIL.NEXT.LETTER', + 0x017B: 'DATA.LABEL', + 0x017C: 'INSERT.TITLE', + 0x017D: 'FONT.PROPERTIES', + 0x017E: 'MACRO.OPTIONS', + 0x017F: 'WORKBOOK.HIDE', + 0x0180: 'WORKBOOK.UNHIDE', + 0x0181: 'WORKBOOK.DELETE', + 0x0182: 'WORKBOOK.NAME', + 0x0184: 'GALLERY.CUSTOM', + 0x0186: 'ADD.CHART.AUTOFORMAT', + 0x0187: 'DELETE.CHART.AUTOFORMAT', + 0x0188: 'CHART.ADD.DATA', + 0x0189: 'AUTO.OUTLINE', + 0x018A: 'TAB.ORDER', + 0x018B: 'SHOW.DIALOG', + 0x018C: 'SELECT.ALL', + 0x018D: 'UNGROUP.SHEETS', + 0x018E: 'SUBTOTAL.CREATE', + 0x018F: 'SUBTOTAL.REMOVE', + 0x0190: 'RENAME.OBJECT', + 0x019C: 'WORKBOOK.SCROLL', + 0x019D: 'WORKBOOK.NEXT', + 0x019E: 'WORKBOOK.PREV', + 0x019F: 'WORKBOOK.TAB.SPLIT', + 0x01A0: 'FULL.SCREEN', + 0x01A1: 'WORKBOOK.PROTECT', + 0x01A4: 'SCROLLBAR.PROPERTIES', + 0x01A5: 'PIVOT.SHOW.PAGES', + 0x01A6: 'TEXT.TO.COLUMNS', + 0x01A7: 'FORMAT.CHARTTYPE', + 0x01A8: 'LINK.FORMAT', + 0x01A9: 'TRACER.DISPLAY', + 0x01AE: 'TRACER.NAVIGATE', + 0x01AF: 'TRACER.CLEAR', + 0x01B0: 'TRACER.ERROR', + 0x01B1: 'PIVOT.FIELD.GROUP', + 0x01B2: 'PIVOT.FIELD.UNGROUP', + 0x01B3: 'CHECKBOX.PROPERTIES', + 0x01B4: 'LABEL.PROPERTIES', + 0x01B5: 'LISTBOX.PROPERTIES', + 0x01B6: 'EDITBOX.PROPERTIES', + 0x01B7: 'PIVOT.REFRESH', + 0x01B8: 'LINK.COMBO', + 0x01B9: 'OPEN.TEXT', + 0x01BA: 'HIDE.DIALOG', + 0x01BB: 'SET.DIALOG.FOCUS', + 0x01BC: 'ENABLE.OBJECT', + 0x01BD: 'PUSHBUTTON.PROPERTIES', + 0x01BE: 'SET.DIALOG.DEFAULT', + 0x01BF: 'FILTER', + 0x01C0: 'FILTER.SHOW.ALL', + 0x01C1: 'CLEAR.OUTLINE', + 0x01C2: 'FUNCTION.WIZARD', + 0x01C3: 'ADD.LIST.ITEM', + 0x01C4: 'SET.LIST.ITEM', + 0x01C5: 'REMOVE.LIST.ITEM', + 0x01C6: 'SELECT.LIST.ITEM', + 0x01C7: 'SET.CONTROL.VALUE', + 0x01C8: 'SAVE.COPY.AS', + 0x01CA: 'OPTIONS.LISTS.ADD', + 0x01CB: 'OPTIONS.LISTS.DELETE', + 0x01CC: 'SERIES.AXES', + 0x01CD: 'SERIES.X', + 0x01CE: 'SERIES.Y', + 0x01CF: 'ERRORBAR.X', + 0x01D0: 'ERRORBAR.Y', + 0x01D1: 'FORMAT.CHART', + 0x01D2: 'SERIES.ORDER', + 0x01D3: 'MAIL.LOGOFF', + 0x01D4: 'CLEAR.ROUTING.SLIP', + 0x01D5: 'APP.ACTIVATE.MICROSOFT', + 0x01D6: 'MAIL.EDIT.MAILER', + 0x01D7: 'ON.SHEET', + 0x01D8: 'STANDARD.WIDTH', + 0x01D9: 'SCENARIO.MERGE', + 0x01DA: 'SUMMARY.INFO', + 0x01DB: 'FIND.FILE', + 0x01DC: 'ACTIVE.CELL.FONT', + 0x01DD: 'ENABLE.TIPWIZARD', + 0x01DE: 'VBA.MAKE.ADDIN', + 0x01E0: 'INSERTDATATABLE', + 0x01E1: 'WORKGROUP.OPTIONS', + 0x01E2: 'MAIL.SEND.MAILER', + 0x01E5: 'AUTOCORRECT', + 0x01E9: 'POST.DOCUMENT', + 0x01EB: 'PICKLIST', + 0x01ED: 'VIEW.SHOW', + 0x01EE: 'VIEW.DEFINE', + 0x01EF: 'VIEW.DELETE', + 0x01FD: 'SHEET.BACKGROUND', + 0x01FE: 'INSERT.MAP.OBJECT', + 0x01FF: 'OPTIONS.MENONO', + 0x0205: 'MSOCHECKS', + 0x0206: 'NORMAL', + 0x0207: 'LAYOUT', + 0x0208: 'RM.PRINT.AREA', + 0x0209: 'CLEAR.PRINT.AREA', + 0x020A: 'ADD.PRINT.AREA', + 0x020B: 'MOVE.BRK', + 0x0221: 'HIDECURR.NOTE', + 0x0222: 'HIDEALL.NOTES', + 0x0223: 'DELETE.NOTE', + 0x0224: 'TRAVERSE.NOTES', + 0x0225: 'ACTIVATE.NOTES', + 0x026C: 'PROTECT.REVISIONS', + 0x026D: 'UNPROTECT.REVISIONS', + 0x0287: 'OPTIONS.ME', + 0x028D: 'WEB.PUBLISH', + 0x029B: 'NEWWEBQUERY', + 0x02A1: 'PIVOT.TABLE.CHART', + 0x02F1: 'OPTIONS.SAVE', + 0x02F3: 'OPTIONS.SPELL', + 0x0328: 'HIDEALL.INKANNOTS' + }; + + /* [MS-XLS] 2.5.198.17 */ + /* [MS-XLSB] 2.5.97.10 */ + var Ftab = { + 0x0000: 'COUNT', + 0x0001: 'IF', + 0x0002: 'ISNA', + 0x0003: 'ISERROR', + 0x0004: 'SUM', + 0x0005: 'AVERAGE', + 0x0006: 'MIN', + 0x0007: 'MAX', + 0x0008: 'ROW', + 0x0009: 'COLUMN', + 0x000A: 'NA', + 0x000B: 'NPV', + 0x000C: 'STDEV', + 0x000D: 'DOLLAR', + 0x000E: 'FIXED', + 0x000F: 'SIN', + 0x0010: 'COS', + 0x0011: 'TAN', + 0x0012: 'ATAN', + 0x0013: 'PI', + 0x0014: 'SQRT', + 0x0015: 'EXP', + 0x0016: 'LN', + 0x0017: 'LOG10', + 0x0018: 'ABS', + 0x0019: 'INT', + 0x001A: 'SIGN', + 0x001B: 'ROUND', + 0x001C: 'LOOKUP', + 0x001D: 'INDEX', + 0x001E: 'REPT', + 0x001F: 'MID', + 0x0020: 'LEN', + 0x0021: 'VALUE', + 0x0022: 'TRUE', + 0x0023: 'FALSE', + 0x0024: 'AND', + 0x0025: 'OR', + 0x0026: 'NOT', + 0x0027: 'MOD', + 0x0028: 'DCOUNT', + 0x0029: 'DSUM', + 0x002A: 'DAVERAGE', + 0x002B: 'DMIN', + 0x002C: 'DMAX', + 0x002D: 'DSTDEV', + 0x002E: 'VAR', + 0x002F: 'DVAR', + 0x0030: 'TEXT', + 0x0031: 'LINEST', + 0x0032: 'TREND', + 0x0033: 'LOGEST', + 0x0034: 'GROWTH', + 0x0035: 'GOTO', + 0x0036: 'HALT', + 0x0037: 'RETURN', + 0x0038: 'PV', + 0x0039: 'FV', + 0x003A: 'NPER', + 0x003B: 'PMT', + 0x003C: 'RATE', + 0x003D: 'MIRR', + 0x003E: 'IRR', + 0x003F: 'RAND', + 0x0040: 'MATCH', + 0x0041: 'DATE', + 0x0042: 'TIME', + 0x0043: 'DAY', + 0x0044: 'MONTH', + 0x0045: 'YEAR', + 0x0046: 'WEEKDAY', + 0x0047: 'HOUR', + 0x0048: 'MINUTE', + 0x0049: 'SECOND', + 0x004A: 'NOW', + 0x004B: 'AREAS', + 0x004C: 'ROWS', + 0x004D: 'COLUMNS', + 0x004E: 'OFFSET', + 0x004F: 'ABSREF', + 0x0050: 'RELREF', + 0x0051: 'ARGUMENT', + 0x0052: 'SEARCH', + 0x0053: 'TRANSPOSE', + 0x0054: 'ERROR', + 0x0055: 'STEP', + 0x0056: 'TYPE', + 0x0057: 'ECHO', + 0x0058: 'SET.NAME', + 0x0059: 'CALLER', + 0x005A: 'DEREF', + 0x005B: 'WINDOWS', + 0x005C: 'SERIES', + 0x005D: 'DOCUMENTS', + 0x005E: 'ACTIVE.CELL', + 0x005F: 'SELECTION', + 0x0060: 'RESULT', + 0x0061: 'ATAN2', + 0x0062: 'ASIN', + 0x0063: 'ACOS', + 0x0064: 'CHOOSE', + 0x0065: 'HLOOKUP', + 0x0066: 'VLOOKUP', + 0x0067: 'LINKS', + 0x0068: 'INPUT', + 0x0069: 'ISREF', + 0x006A: 'GET.FORMULA', + 0x006B: 'GET.NAME', + 0x006C: 'SET.VALUE', + 0x006D: 'LOG', + 0x006E: 'EXEC', + 0x006F: 'CHAR', + 0x0070: 'LOWER', + 0x0071: 'UPPER', + 0x0072: 'PROPER', + 0x0073: 'LEFT', + 0x0074: 'RIGHT', + 0x0075: 'EXACT', + 0x0076: 'TRIM', + 0x0077: 'REPLACE', + 0x0078: 'SUBSTITUTE', + 0x0079: 'CODE', + 0x007A: 'NAMES', + 0x007B: 'DIRECTORY', + 0x007C: 'FIND', + 0x007D: 'CELL', + 0x007E: 'ISERR', + 0x007F: 'ISTEXT', + 0x0080: 'ISNUMBER', + 0x0081: 'ISBLANK', + 0x0082: 'T', + 0x0083: 'N', + 0x0084: 'FOPEN', + 0x0085: 'FCLOSE', + 0x0086: 'FSIZE', + 0x0087: 'FREADLN', + 0x0088: 'FREAD', + 0x0089: 'FWRITELN', + 0x008A: 'FWRITE', + 0x008B: 'FPOS', + 0x008C: 'DATEVALUE', + 0x008D: 'TIMEVALUE', + 0x008E: 'SLN', + 0x008F: 'SYD', + 0x0090: 'DDB', + 0x0091: 'GET.DEF', + 0x0092: 'REFTEXT', + 0x0093: 'TEXTREF', + 0x0094: 'INDIRECT', + 0x0095: 'REGISTER', + 0x0096: 'CALL', + 0x0097: 'ADD.BAR', + 0x0098: 'ADD.MENU', + 0x0099: 'ADD.COMMAND', + 0x009A: 'ENABLE.COMMAND', + 0x009B: 'CHECK.COMMAND', + 0x009C: 'RENAME.COMMAND', + 0x009D: 'SHOW.BAR', + 0x009E: 'DELETE.MENU', + 0x009F: 'DELETE.COMMAND', + 0x00A0: 'GET.CHART.ITEM', + 0x00A1: 'DIALOG.BOX', + 0x00A2: 'CLEAN', + 0x00A3: 'MDETERM', + 0x00A4: 'MINVERSE', + 0x00A5: 'MMULT', + 0x00A6: 'FILES', + 0x00A7: 'IPMT', + 0x00A8: 'PPMT', + 0x00A9: 'COUNTA', + 0x00AA: 'CANCEL.KEY', + 0x00AB: 'FOR', + 0x00AC: 'WHILE', + 0x00AD: 'BREAK', + 0x00AE: 'NEXT', + 0x00AF: 'INITIATE', + 0x00B0: 'REQUEST', + 0x00B1: 'POKE', + 0x00B2: 'EXECUTE', + 0x00B3: 'TERMINATE', + 0x00B4: 'RESTART', + 0x00B5: 'HELP', + 0x00B6: 'GET.BAR', + 0x00B7: 'PRODUCT', + 0x00B8: 'FACT', + 0x00B9: 'GET.CELL', + 0x00BA: 'GET.WORKSPACE', + 0x00BB: 'GET.WINDOW', + 0x00BC: 'GET.DOCUMENT', + 0x00BD: 'DPRODUCT', + 0x00BE: 'ISNONTEXT', + 0x00BF: 'GET.NOTE', + 0x00C0: 'NOTE', + 0x00C1: 'STDEVP', + 0x00C2: 'VARP', + 0x00C3: 'DSTDEVP', + 0x00C4: 'DVARP', + 0x00C5: 'TRUNC', + 0x00C6: 'ISLOGICAL', + 0x00C7: 'DCOUNTA', + 0x00C8: 'DELETE.BAR', + 0x00C9: 'UNREGISTER', + 0x00CC: 'USDOLLAR', + 0x00CD: 'FINDB', + 0x00CE: 'SEARCHB', + 0x00CF: 'REPLACEB', + 0x00D0: 'LEFTB', + 0x00D1: 'RIGHTB', + 0x00D2: 'MIDB', + 0x00D3: 'LENB', + 0x00D4: 'ROUNDUP', + 0x00D5: 'ROUNDDOWN', + 0x00D6: 'ASC', + 0x00D7: 'DBCS', + 0x00D8: 'RANK', + 0x00DB: 'ADDRESS', + 0x00DC: 'DAYS360', + 0x00DD: 'TODAY', + 0x00DE: 'VDB', + 0x00DF: 'ELSE', + 0x00E0: 'ELSE.IF', + 0x00E1: 'END.IF', + 0x00E2: 'FOR.CELL', + 0x00E3: 'MEDIAN', + 0x00E4: 'SUMPRODUCT', + 0x00E5: 'SINH', + 0x00E6: 'COSH', + 0x00E7: 'TANH', + 0x00E8: 'ASINH', + 0x00E9: 'ACOSH', + 0x00EA: 'ATANH', + 0x00EB: 'DGET', + 0x00EC: 'CREATE.OBJECT', + 0x00ED: 'VOLATILE', + 0x00EE: 'LAST.ERROR', + 0x00EF: 'CUSTOM.UNDO', + 0x00F0: 'CUSTOM.REPEAT', + 0x00F1: 'FORMULA.CONVERT', + 0x00F2: 'GET.LINK.INFO', + 0x00F3: 'TEXT.BOX', + 0x00F4: 'INFO', + 0x00F5: 'GROUP', + 0x00F6: 'GET.OBJECT', + 0x00F7: 'DB', + 0x00F8: 'PAUSE', + 0x00FB: 'RESUME', + 0x00FC: 'FREQUENCY', + 0x00FD: 'ADD.TOOLBAR', + 0x00FE: 'DELETE.TOOLBAR', + 0x00FF: 'User', + 0x0100: 'RESET.TOOLBAR', + 0x0101: 'EVALUATE', + 0x0102: 'GET.TOOLBAR', + 0x0103: 'GET.TOOL', + 0x0104: 'SPELLING.CHECK', + 0x0105: 'ERROR.TYPE', + 0x0106: 'APP.TITLE', + 0x0107: 'WINDOW.TITLE', + 0x0108: 'SAVE.TOOLBAR', + 0x0109: 'ENABLE.TOOL', + 0x010A: 'PRESS.TOOL', + 0x010B: 'REGISTER.ID', + 0x010C: 'GET.WORKBOOK', + 0x010D: 'AVEDEV', + 0x010E: 'BETADIST', + 0x010F: 'GAMMALN', + 0x0110: 'BETAINV', + 0x0111: 'BINOMDIST', + 0x0112: 'CHIDIST', + 0x0113: 'CHIINV', + 0x0114: 'COMBIN', + 0x0115: 'CONFIDENCE', + 0x0116: 'CRITBINOM', + 0x0117: 'EVEN', + 0x0118: 'EXPONDIST', + 0x0119: 'FDIST', + 0x011A: 'FINV', + 0x011B: 'FISHER', + 0x011C: 'FISHERINV', + 0x011D: 'FLOOR', + 0x011E: 'GAMMADIST', + 0x011F: 'GAMMAINV', + 0x0120: 'CEILING', + 0x0121: 'HYPGEOMDIST', + 0x0122: 'LOGNORMDIST', + 0x0123: 'LOGINV', + 0x0124: 'NEGBINOMDIST', + 0x0125: 'NORMDIST', + 0x0126: 'NORMSDIST', + 0x0127: 'NORMINV', + 0x0128: 'NORMSINV', + 0x0129: 'STANDARDIZE', + 0x012A: 'ODD', + 0x012B: 'PERMUT', + 0x012C: 'POISSON', + 0x012D: 'TDIST', + 0x012E: 'WEIBULL', + 0x012F: 'SUMXMY2', + 0x0130: 'SUMX2MY2', + 0x0131: 'SUMX2PY2', + 0x0132: 'CHITEST', + 0x0133: 'CORREL', + 0x0134: 'COVAR', + 0x0135: 'FORECAST', + 0x0136: 'FTEST', + 0x0137: 'INTERCEPT', + 0x0138: 'PEARSON', + 0x0139: 'RSQ', + 0x013A: 'STEYX', + 0x013B: 'SLOPE', + 0x013C: 'TTEST', + 0x013D: 'PROB', + 0x013E: 'DEVSQ', + 0x013F: 'GEOMEAN', + 0x0140: 'HARMEAN', + 0x0141: 'SUMSQ', + 0x0142: 'KURT', + 0x0143: 'SKEW', + 0x0144: 'ZTEST', + 0x0145: 'LARGE', + 0x0146: 'SMALL', + 0x0147: 'QUARTILE', + 0x0148: 'PERCENTILE', + 0x0149: 'PERCENTRANK', + 0x014A: 'MODE', + 0x014B: 'TRIMMEAN', + 0x014C: 'TINV', + 0x014E: 'MOVIE.COMMAND', + 0x014F: 'GET.MOVIE', + 0x0150: 'CONCATENATE', + 0x0151: 'POWER', + 0x0152: 'PIVOT.ADD.DATA', + 0x0153: 'GET.PIVOT.TABLE', + 0x0154: 'GET.PIVOT.FIELD', + 0x0155: 'GET.PIVOT.ITEM', + 0x0156: 'RADIANS', + 0x0157: 'DEGREES', + 0x0158: 'SUBTOTAL', + 0x0159: 'SUMIF', + 0x015A: 'COUNTIF', + 0x015B: 'COUNTBLANK', + 0x015C: 'SCENARIO.GET', + 0x015D: 'OPTIONS.LISTS.GET', + 0x015E: 'ISPMT', + 0x015F: 'DATEDIF', + 0x0160: 'DATESTRING', + 0x0161: 'NUMBERSTRING', + 0x0162: 'ROMAN', + 0x0163: 'OPEN.DIALOG', + 0x0164: 'SAVE.DIALOG', + 0x0165: 'VIEW.GET', + 0x0166: 'GETPIVOTDATA', + 0x0167: 'HYPERLINK', + 0x0168: 'PHONETIC', + 0x0169: 'AVERAGEA', + 0x016A: 'MAXA', + 0x016B: 'MINA', + 0x016C: 'STDEVPA', + 0x016D: 'VARPA', + 0x016E: 'STDEVA', + 0x016F: 'VARA', + 0x0170: 'BAHTTEXT', + 0x0171: 'THAIDAYOFWEEK', + 0x0172: 'THAIDIGIT', + 0x0173: 'THAIMONTHOFYEAR', + 0x0174: 'THAINUMSOUND', + 0x0175: 'THAINUMSTRING', + 0x0176: 'THAISTRINGLENGTH', + 0x0177: 'ISTHAIDIGIT', + 0x0178: 'ROUNDBAHTDOWN', + 0x0179: 'ROUNDBAHTUP', + 0x017A: 'THAIYEAR', + 0x017B: 'RTD', + + 0x017C: 'CUBEVALUE', + 0x017D: 'CUBEMEMBER', + 0x017E: 'CUBEMEMBERPROPERTY', + 0x017F: 'CUBERANKEDMEMBER', + 0x0180: 'HEX2BIN', + 0x0181: 'HEX2DEC', + 0x0182: 'HEX2OCT', + 0x0183: 'DEC2BIN', + 0x0184: 'DEC2HEX', + 0x0185: 'DEC2OCT', + 0x0186: 'OCT2BIN', + 0x0187: 'OCT2HEX', + 0x0188: 'OCT2DEC', + 0x0189: 'BIN2DEC', + 0x018A: 'BIN2OCT', + 0x018B: 'BIN2HEX', + 0x018C: 'IMSUB', + 0x018D: 'IMDIV', + 0x018E: 'IMPOWER', + 0x018F: 'IMABS', + 0x0190: 'IMSQRT', + 0x0191: 'IMLN', + 0x0192: 'IMLOG2', + 0x0193: 'IMLOG10', + 0x0194: 'IMSIN', + 0x0195: 'IMCOS', + 0x0196: 'IMEXP', + 0x0197: 'IMARGUMENT', + 0x0198: 'IMCONJUGATE', + 0x0199: 'IMAGINARY', + 0x019A: 'IMREAL', + 0x019B: 'COMPLEX', + 0x019C: 'IMSUM', + 0x019D: 'IMPRODUCT', + 0x019E: 'SERIESSUM', + 0x019F: 'FACTDOUBLE', + 0x01A0: 'SQRTPI', + 0x01A1: 'QUOTIENT', + 0x01A2: 'DELTA', + 0x01A3: 'GESTEP', + 0x01A4: 'ISEVEN', + 0x01A5: 'ISODD', + 0x01A6: 'MROUND', + 0x01A7: 'ERF', + 0x01A8: 'ERFC', + 0x01A9: 'BESSELJ', + 0x01AA: 'BESSELK', + 0x01AB: 'BESSELY', + 0x01AC: 'BESSELI', + 0x01AD: 'XIRR', + 0x01AE: 'XNPV', + 0x01AF: 'PRICEMAT', + 0x01B0: 'YIELDMAT', + 0x01B1: 'INTRATE', + 0x01B2: 'RECEIVED', + 0x01B3: 'DISC', + 0x01B4: 'PRICEDISC', + 0x01B5: 'YIELDDISC', + 0x01B6: 'TBILLEQ', + 0x01B7: 'TBILLPRICE', + 0x01B8: 'TBILLYIELD', + 0x01B9: 'PRICE', + 0x01BA: 'YIELD', + 0x01BB: 'DOLLARDE', + 0x01BC: 'DOLLARFR', + 0x01BD: 'NOMINAL', + 0x01BE: 'EFFECT', + 0x01BF: 'CUMPRINC', + 0x01C0: 'CUMIPMT', + 0x01C1: 'EDATE', + 0x01C2: 'EOMONTH', + 0x01C3: 'YEARFRAC', + 0x01C4: 'COUPDAYBS', + 0x01C5: 'COUPDAYS', + 0x01C6: 'COUPDAYSNC', + 0x01C7: 'COUPNCD', + 0x01C8: 'COUPNUM', + 0x01C9: 'COUPPCD', + 0x01CA: 'DURATION', + 0x01CB: 'MDURATION', + 0x01CC: 'ODDLPRICE', + 0x01CD: 'ODDLYIELD', + 0x01CE: 'ODDFPRICE', + 0x01CF: 'ODDFYIELD', + 0x01D0: 'RANDBETWEEN', + 0x01D1: 'WEEKNUM', + 0x01D2: 'AMORDEGRC', + 0x01D3: 'AMORLINC', + 0x01D4: 'CONVERT', + 0x02D4: 'SHEETJS', + 0x01D5: 'ACCRINT', + 0x01D6: 'ACCRINTM', + 0x01D7: 'WORKDAY', + 0x01D8: 'NETWORKDAYS', + 0x01D9: 'GCD', + 0x01DA: 'MULTINOMIAL', + 0x01DB: 'LCM', + 0x01DC: 'FVSCHEDULE', + 0x01DD: 'CUBEKPIMEMBER', + 0x01DE: 'CUBESET', + 0x01DF: 'CUBESETCOUNT', + 0x01E0: 'IFERROR', + 0x01E1: 'COUNTIFS', + 0x01E2: 'SUMIFS', + 0x01E3: 'AVERAGEIF', + 0x01E4: 'AVERAGEIFS' + }; + var FtabArgc = { + 0x0002: 1, /* ISNA */ + 0x0003: 1, /* ISERROR */ + 0x000A: 0, /* NA */ + 0x000F: 1, /* SIN */ + 0x0010: 1, /* COS */ + 0x0011: 1, /* TAN */ + 0x0012: 1, /* ATAN */ + 0x0013: 0, /* PI */ + 0x0014: 1, /* SQRT */ + 0x0015: 1, /* EXP */ + 0x0016: 1, /* LN */ + 0x0017: 1, /* LOG10 */ + 0x0018: 1, /* ABS */ + 0x0019: 1, /* INT */ + 0x001A: 1, /* SIGN */ + 0x001B: 2, /* ROUND */ + 0x001E: 2, /* REPT */ + 0x001F: 3, /* MID */ + 0x0020: 1, /* LEN */ + 0x0021: 1, /* VALUE */ + 0x0022: 0, /* TRUE */ + 0x0023: 0, /* FALSE */ + 0x0026: 1, /* NOT */ + 0x0027: 2, /* MOD */ + 0x0028: 3, /* DCOUNT */ + 0x0029: 3, /* DSUM */ + 0x002A: 3, /* DAVERAGE */ + 0x002B: 3, /* DMIN */ + 0x002C: 3, /* DMAX */ + 0x002D: 3, /* DSTDEV */ + 0x002F: 3, /* DVAR */ + 0x0030: 2, /* TEXT */ + 0x0035: 1, /* GOTO */ + 0x003D: 3, /* MIRR */ + 0x003F: 0, /* RAND */ + 0x0041: 3, /* DATE */ + 0x0042: 3, /* TIME */ + 0x0043: 1, /* DAY */ + 0x0044: 1, /* MONTH */ + 0x0045: 1, /* YEAR */ + 0x0046: 1, /* WEEKDAY */ + 0x0047: 1, /* HOUR */ + 0x0048: 1, /* MINUTE */ + 0x0049: 1, /* SECOND */ + 0x004A: 0, /* NOW */ + 0x004B: 1, /* AREAS */ + 0x004C: 1, /* ROWS */ + 0x004D: 1, /* COLUMNS */ + 0x004F: 2, /* ABSREF */ + 0x0050: 2, /* RELREF */ + 0x0053: 1, /* TRANSPOSE */ + 0x0055: 0, /* STEP */ + 0x0056: 1, /* TYPE */ + 0x0059: 0, /* CALLER */ + 0x005A: 1, /* DEREF */ + 0x005E: 0, /* ACTIVE.CELL */ + 0x005F: 0, /* SELECTION */ + 0x0061: 2, /* ATAN2 */ + 0x0062: 1, /* ASIN */ + 0x0063: 1, /* ACOS */ + 0x0065: 3, /* HLOOKUP */ + 0x0066: 3, /* VLOOKUP */ + 0x0069: 1, /* ISREF */ + 0x006A: 1, /* GET.FORMULA */ + 0x006C: 2, /* SET.VALUE */ + 0x006F: 1, /* CHAR */ + 0x0070: 1, /* LOWER */ + 0x0071: 1, /* UPPER */ + 0x0072: 1, /* PROPER */ + 0x0075: 2, /* EXACT */ + 0x0076: 1, /* TRIM */ + 0x0077: 4, /* REPLACE */ + 0x0079: 1, /* CODE */ + 0x007E: 1, /* ISERR */ + 0x007F: 1, /* ISTEXT */ + 0x0080: 1, /* ISNUMBER */ + 0x0081: 1, /* ISBLANK */ + 0x0082: 1, /* T */ + 0x0083: 1, /* N */ + 0x0085: 1, /* FCLOSE */ + 0x0086: 1, /* FSIZE */ + 0x0087: 1, /* FREADLN */ + 0x0088: 2, /* FREAD */ + 0x0089: 2, /* FWRITELN */ + 0x008A: 2, /* FWRITE */ + 0x008C: 1, /* DATEVALUE */ + 0x008D: 1, /* TIMEVALUE */ + 0x008E: 3, /* SLN */ + 0x008F: 4, /* SYD */ + 0x0090: 4, /* DDB */ + 0x00A1: 1, /* DIALOG.BOX */ + 0x00A2: 1, /* CLEAN */ + 0x00A3: 1, /* MDETERM */ + 0x00A4: 1, /* MINVERSE */ + 0x00A5: 2, /* MMULT */ + 0x00AC: 1, /* WHILE */ + 0x00AF: 2, /* INITIATE */ + 0x00B0: 2, /* REQUEST */ + 0x00B1: 3, /* POKE */ + 0x00B2: 2, /* EXECUTE */ + 0x00B3: 1, /* TERMINATE */ + 0x00B8: 1, /* FACT */ + 0x00BA: 1, /* GET.WORKSPACE */ + 0x00BD: 3, /* DPRODUCT */ + 0x00BE: 1, /* ISNONTEXT */ + 0x00C3: 3, /* DSTDEVP */ + 0x00C4: 3, /* DVARP */ + 0x00C5: 1, /* TRUNC */ + 0x00C6: 1, /* ISLOGICAL */ + 0x00C7: 3, /* DCOUNTA */ + 0x00C9: 1, /* UNREGISTER */ + 0x00CF: 4, /* REPLACEB */ + 0x00D2: 3, /* MIDB */ + 0x00D3: 1, /* LENB */ + 0x00D4: 2, /* ROUNDUP */ + 0x00D5: 2, /* ROUNDDOWN */ + 0x00D6: 1, /* ASC */ + 0x00D7: 1, /* DBCS */ + 0x00E1: 0, /* END.IF */ + 0x00E5: 1, /* SINH */ + 0x00E6: 1, /* COSH */ + 0x00E7: 1, /* TANH */ + 0x00E8: 1, /* ASINH */ + 0x00E9: 1, /* ACOSH */ + 0x00EA: 1, /* ATANH */ + 0x00EB: 3, /* DGET */ + 0x00F4: 1, /* INFO */ + 0x00F7: 4, /* DB */ + 0x00FC: 2, /* FREQUENCY */ + 0x0101: 1, /* EVALUATE */ + 0x0105: 1, /* ERROR.TYPE */ + 0x010F: 1, /* GAMMALN */ + 0x0111: 4, /* BINOMDIST */ + 0x0112: 2, /* CHIDIST */ + 0x0113: 2, /* CHIINV */ + 0x0114: 2, /* COMBIN */ + 0x0115: 3, /* CONFIDENCE */ + 0x0116: 3, /* CRITBINOM */ + 0x0117: 1, /* EVEN */ + 0x0118: 3, /* EXPONDIST */ + 0x0119: 3, /* FDIST */ + 0x011A: 3, /* FINV */ + 0x011B: 1, /* FISHER */ + 0x011C: 1, /* FISHERINV */ + 0x011D: 2, /* FLOOR */ + 0x011E: 4, /* GAMMADIST */ + 0x011F: 3, /* GAMMAINV */ + 0x0120: 2, /* CEILING */ + 0x0121: 4, /* HYPGEOMDIST */ + 0x0122: 3, /* LOGNORMDIST */ + 0x0123: 3, /* LOGINV */ + 0x0124: 3, /* NEGBINOMDIST */ + 0x0125: 4, /* NORMDIST */ + 0x0126: 1, /* NORMSDIST */ + 0x0127: 3, /* NORMINV */ + 0x0128: 1, /* NORMSINV */ + 0x0129: 3, /* STANDARDIZE */ + 0x012A: 1, /* ODD */ + 0x012B: 2, /* PERMUT */ + 0x012C: 3, /* POISSON */ + 0x012D: 3, /* TDIST */ + 0x012E: 4, /* WEIBULL */ + 0x012F: 2, /* SUMXMY2 */ + 0x0130: 2, /* SUMX2MY2 */ + 0x0131: 2, /* SUMX2PY2 */ + 0x0132: 2, /* CHITEST */ + 0x0133: 2, /* CORREL */ + 0x0134: 2, /* COVAR */ + 0x0135: 3, /* FORECAST */ + 0x0136: 2, /* FTEST */ + 0x0137: 2, /* INTERCEPT */ + 0x0138: 2, /* PEARSON */ + 0x0139: 2, /* RSQ */ + 0x013A: 2, /* STEYX */ + 0x013B: 2, /* SLOPE */ + 0x013C: 4, /* TTEST */ + 0x0145: 2, /* LARGE */ + 0x0146: 2, /* SMALL */ + 0x0147: 2, /* QUARTILE */ + 0x0148: 2, /* PERCENTILE */ + 0x014B: 2, /* TRIMMEAN */ + 0x014C: 2, /* TINV */ + 0x0151: 2, /* POWER */ + 0x0156: 1, /* RADIANS */ + 0x0157: 1, /* DEGREES */ + 0x015A: 2, /* COUNTIF */ + 0x015B: 1, /* COUNTBLANK */ + 0x015E: 4, /* ISPMT */ + 0x015F: 3, /* DATEDIF */ + 0x0160: 1, /* DATESTRING */ + 0x0161: 2, /* NUMBERSTRING */ + 0x0168: 1, /* PHONETIC */ + 0x0170: 1, /* BAHTTEXT */ + 0x0171: 1, /* THAIDAYOFWEEK */ + 0x0172: 1, /* THAIDIGIT */ + 0x0173: 1, /* THAIMONTHOFYEAR */ + 0x0174: 1, /* THAINUMSOUND */ + 0x0175: 1, /* THAINUMSTRING */ + 0x0176: 1, /* THAISTRINGLENGTH */ + 0x0177: 1, /* ISTHAIDIGIT */ + 0x0178: 1, /* ROUNDBAHTDOWN */ + 0x0179: 1, /* ROUNDBAHTUP */ + 0x017A: 1, /* THAIYEAR */ + 0x017E: 3, /* CUBEMEMBERPROPERTY */ + 0x0181: 1, /* HEX2DEC */ + 0x0188: 1, /* OCT2DEC */ + 0x0189: 1, /* BIN2DEC */ + 0x018C: 2, /* IMSUB */ + 0x018D: 2, /* IMDIV */ + 0x018E: 2, /* IMPOWER */ + 0x018F: 1, /* IMABS */ + 0x0190: 1, /* IMSQRT */ + 0x0191: 1, /* IMLN */ + 0x0192: 1, /* IMLOG2 */ + 0x0193: 1, /* IMLOG10 */ + 0x0194: 1, /* IMSIN */ + 0x0195: 1, /* IMCOS */ + 0x0196: 1, /* IMEXP */ + 0x0197: 1, /* IMARGUMENT */ + 0x0198: 1, /* IMCONJUGATE */ + 0x0199: 1, /* IMAGINARY */ + 0x019A: 1, /* IMREAL */ + 0x019E: 4, /* SERIESSUM */ + 0x019F: 1, /* FACTDOUBLE */ + 0x01A0: 1, /* SQRTPI */ + 0x01A1: 2, /* QUOTIENT */ + 0x01A4: 1, /* ISEVEN */ + 0x01A5: 1, /* ISODD */ + 0x01A6: 2, /* MROUND */ + 0x01A8: 1, /* ERFC */ + 0x01A9: 2, /* BESSELJ */ + 0x01AA: 2, /* BESSELK */ + 0x01AB: 2, /* BESSELY */ + 0x01AC: 2, /* BESSELI */ + 0x01AE: 3, /* XNPV */ + 0x01B6: 3, /* TBILLEQ */ + 0x01B7: 3, /* TBILLPRICE */ + 0x01B8: 3, /* TBILLYIELD */ + 0x01BB: 2, /* DOLLARDE */ + 0x01BC: 2, /* DOLLARFR */ + 0x01BD: 2, /* NOMINAL */ + 0x01BE: 2, /* EFFECT */ + 0x01BF: 6, /* CUMPRINC */ + 0x01C0: 6, /* CUMIPMT */ + 0x01C1: 2, /* EDATE */ + 0x01C2: 2, /* EOMONTH */ + 0x01D0: 2, /* RANDBETWEEN */ + 0x01D4: 3, /* CONVERT */ + 0x01DC: 2, /* FVSCHEDULE */ + 0x01DF: 1, /* CUBESETCOUNT */ + 0x01E0: 2, /* IFERROR */ + 0xFFFF: 0 + }; + /* [MS-XLSX] 2.2.3 Functions */ + /* [MS-XLSB] 2.5.97.10 Ftab */ + var XLSXFutureFunctions = { + "_xlfn.ACOT": "ACOT", + "_xlfn.ACOTH": "ACOTH", + "_xlfn.AGGREGATE": "AGGREGATE", + "_xlfn.ARABIC": "ARABIC", + "_xlfn.AVERAGEIF": "AVERAGEIF", + "_xlfn.AVERAGEIFS": "AVERAGEIFS", + "_xlfn.BASE": "BASE", + "_xlfn.BETA.DIST": "BETA.DIST", + "_xlfn.BETA.INV": "BETA.INV", + "_xlfn.BINOM.DIST": "BINOM.DIST", + "_xlfn.BINOM.DIST.RANGE": "BINOM.DIST.RANGE", + "_xlfn.BINOM.INV": "BINOM.INV", + "_xlfn.BITAND": "BITAND", + "_xlfn.BITLSHIFT": "BITLSHIFT", + "_xlfn.BITOR": "BITOR", + "_xlfn.BITRSHIFT": "BITRSHIFT", + "_xlfn.BITXOR": "BITXOR", + "_xlfn.CEILING.MATH": "CEILING.MATH", + "_xlfn.CEILING.PRECISE": "CEILING.PRECISE", + "_xlfn.CHISQ.DIST": "CHISQ.DIST", + "_xlfn.CHISQ.DIST.RT": "CHISQ.DIST.RT", + "_xlfn.CHISQ.INV": "CHISQ.INV", + "_xlfn.CHISQ.INV.RT": "CHISQ.INV.RT", + "_xlfn.CHISQ.TEST": "CHISQ.TEST", + "_xlfn.COMBINA": "COMBINA", + "_xlfn.CONCAT": "CONCAT", + "_xlfn.CONFIDENCE.NORM": "CONFIDENCE.NORM", + "_xlfn.CONFIDENCE.T": "CONFIDENCE.T", + "_xlfn.COT": "COT", + "_xlfn.COTH": "COTH", + "_xlfn.COUNTIFS": "COUNTIFS", + "_xlfn.COVARIANCE.P": "COVARIANCE.P", + "_xlfn.COVARIANCE.S": "COVARIANCE.S", + "_xlfn.CSC": "CSC", + "_xlfn.CSCH": "CSCH", + "_xlfn.DAYS": "DAYS", + "_xlfn.DECIMAL": "DECIMAL", + "_xlfn.ECMA.CEILING": "ECMA.CEILING", + "_xlfn.ERF.PRECISE": "ERF.PRECISE", + "_xlfn.ERFC.PRECISE": "ERFC.PRECISE", + "_xlfn.EXPON.DIST": "EXPON.DIST", + "_xlfn.F.DIST": "F.DIST", + "_xlfn.F.DIST.RT": "F.DIST.RT", + "_xlfn.F.INV": "F.INV", + "_xlfn.F.INV.RT": "F.INV.RT", + "_xlfn.F.TEST": "F.TEST", + "_xlfn.FILTERXML": "FILTERXML", + "_xlfn.FLOOR.MATH": "FLOOR.MATH", + "_xlfn.FLOOR.PRECISE": "FLOOR.PRECISE", + "_xlfn.FORECAST.ETS": "FORECAST.ETS", + "_xlfn.FORECAST.ETS.CONFINT": "FORECAST.ETS.CONFINT", + "_xlfn.FORECAST.ETS.SEASONALITY": "FORECAST.ETS.SEASONALITY", + "_xlfn.FORECAST.ETS.STAT": "FORECAST.ETS.STAT", + "_xlfn.FORECAST.LINEAR": "FORECAST.LINEAR", + "_xlfn.FORMULATEXT": "FORMULATEXT", + "_xlfn.GAMMA": "GAMMA", + "_xlfn.GAMMA.DIST": "GAMMA.DIST", + "_xlfn.GAMMA.INV": "GAMMA.INV", + "_xlfn.GAMMALN.PRECISE": "GAMMALN.PRECISE", + "_xlfn.GAUSS": "GAUSS", + "_xlfn.HYPGEOM.DIST": "HYPGEOM.DIST", + "_xlfn.IFERROR": "IFERROR", + "_xlfn.IFNA": "IFNA", + "_xlfn.IFS": "IFS", + "_xlfn.IMCOSH": "IMCOSH", + "_xlfn.IMCOT": "IMCOT", + "_xlfn.IMCSC": "IMCSC", + "_xlfn.IMCSCH": "IMCSCH", + "_xlfn.IMSEC": "IMSEC", + "_xlfn.IMSECH": "IMSECH", + "_xlfn.IMSINH": "IMSINH", + "_xlfn.IMTAN": "IMTAN", + "_xlfn.ISFORMULA": "ISFORMULA", + "_xlfn.ISO.CEILING": "ISO.CEILING", + "_xlfn.ISOWEEKNUM": "ISOWEEKNUM", + "_xlfn.LOGNORM.DIST": "LOGNORM.DIST", + "_xlfn.LOGNORM.INV": "LOGNORM.INV", + "_xlfn.MAXIFS": "MAXIFS", + "_xlfn.MINIFS": "MINIFS", + "_xlfn.MODE.MULT": "MODE.MULT", + "_xlfn.MODE.SNGL": "MODE.SNGL", + "_xlfn.MUNIT": "MUNIT", + "_xlfn.NEGBINOM.DIST": "NEGBINOM.DIST", + "_xlfn.NETWORKDAYS.INTL": "NETWORKDAYS.INTL", + "_xlfn.NIGBINOM": "NIGBINOM", + "_xlfn.NORM.DIST": "NORM.DIST", + "_xlfn.NORM.INV": "NORM.INV", + "_xlfn.NORM.S.DIST": "NORM.S.DIST", + "_xlfn.NORM.S.INV": "NORM.S.INV", + "_xlfn.NUMBERVALUE": "NUMBERVALUE", + "_xlfn.PDURATION": "PDURATION", + "_xlfn.PERCENTILE.EXC": "PERCENTILE.EXC", + "_xlfn.PERCENTILE.INC": "PERCENTILE.INC", + "_xlfn.PERCENTRANK.EXC": "PERCENTRANK.EXC", + "_xlfn.PERCENTRANK.INC": "PERCENTRANK.INC", + "_xlfn.PERMUTATIONA": "PERMUTATIONA", + "_xlfn.PHI": "PHI", + "_xlfn.POISSON.DIST": "POISSON.DIST", + "_xlfn.QUARTILE.EXC": "QUARTILE.EXC", + "_xlfn.QUARTILE.INC": "QUARTILE.INC", + "_xlfn.QUERYSTRING": "QUERYSTRING", + "_xlfn.RANK.AVG": "RANK.AVG", + "_xlfn.RANK.EQ": "RANK.EQ", + "_xlfn.RRI": "RRI", + "_xlfn.SEC": "SEC", + "_xlfn.SECH": "SECH", + "_xlfn.SHEET": "SHEET", + "_xlfn.SHEETS": "SHEETS", + "_xlfn.SKEW.P": "SKEW.P", + "_xlfn.STDEV.P": "STDEV.P", + "_xlfn.STDEV.S": "STDEV.S", + "_xlfn.SUMIFS": "SUMIFS", + "_xlfn.SWITCH": "SWITCH", + "_xlfn.T.DIST": "T.DIST", + "_xlfn.T.DIST.2T": "T.DIST.2T", + "_xlfn.T.DIST.RT": "T.DIST.RT", + "_xlfn.T.INV": "T.INV", + "_xlfn.T.INV.2T": "T.INV.2T", + "_xlfn.T.TEST": "T.TEST", + "_xlfn.TEXTJOIN": "TEXTJOIN", + "_xlfn.UNICHAR": "UNICHAR", + "_xlfn.UNICODE": "UNICODE", + "_xlfn.VAR.P": "VAR.P", + "_xlfn.VAR.S": "VAR.S", + "_xlfn.WEBSERVICE": "WEBSERVICE", + "_xlfn.WEIBULL.DIST": "WEIBULL.DIST", + "_xlfn.WORKDAY.INTL": "WORKDAY.INTL", + "_xlfn.XOR": "XOR", + "_xlfn.Z.TEST": "Z.TEST" + }; + + /* Part 3 TODO: actually parse formulae */ + function ods_to_csf_formula(f) { + if(f.slice(0,3) == "of:") f = f.slice(3); + /* 5.2 Basic Expressions */ + if(f.charCodeAt(0) == 61) { + f = f.slice(1); + if(f.charCodeAt(0) == 61) f = f.slice(1); + } + f = f.replace(/COM\.MICROSOFT\./g, ""); + /* Part 3 Section 5.8 References */ + f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function($$, $1) { return $1.replace(/\./g,""); }); + /* TODO: something other than this */ + f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1"); + return f.replace(/[;~]/g,",").replace(/\|/g,";"); + } + + function csf_to_ods_formula(f) { + var o = "of:=" + f.replace(crefregex, "$1[.$2$3$4$5]").replace(/\]:\[/g,":"); + /* TODO: something other than this */ + return o.replace(/;/g, "|").replace(/,/g,";"); + } + + function ods_to_csf_3D(r) { + var a = r.split(":"); + var s = a[0].split(".")[0]; + return [s, a[0].split(".")[1] + (a.length > 1 ? (":" + (a[1].split(".")[1] || a[1].split(".")[0])) : "")]; + } + + function csf_to_ods_3D(r) { + return r.replace(/\./,"!"); + } + + var strs = {}; // shared strings + var _ssfopts = {}; // spreadsheet formatting options + + RELS.WS = [ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", + "http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet" + ]; + + /*global Map */ + var browser_has_Map = typeof Map !== 'undefined'; + + function get_sst_id(sst, str, rev) { + var i = 0, len = sst.length; + if(rev) { + if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) { + var revarr = browser_has_Map ? rev.get(str) : rev[str]; + for(; i < revarr.length; ++i) { + if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; } + } + } + } else for(; i < len; ++i) { + if(sst[i].t === str) { sst.Count ++; return i; } + } + sst[len] = ({t:str}); sst.Count ++; sst.Unique ++; + if(rev) { + if(browser_has_Map) { + if(!rev.has(str)) rev.set(str, []); + rev.get(str).push(len); + } else { + if(!rev.hasOwnProperty(str)) rev[str] = []; + rev[str].push(len); + } + } + return len; + } + + function col_obj_w(C, col) { + var p = ({min:C+1,max:C+1}); + /* wch (chars), wpx (pixels) */ + var wch = -1; + if(col.MDW) MDW = col.MDW; + if(col.width != null) p.customWidth = 1; + else if(col.wpx != null) wch = px2char(col.wpx); + else if(col.wch != null) wch = col.wch; + if(wch > -1) { p.width = char2width(wch); p.customWidth = 1; } + else if(col.width != null) p.width = col.width; + if(col.hidden) p.hidden = true; + return p; + } + + function default_margins(margins, mode) { + if(!margins) return; + var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3]; + if(mode == 'xlml') defs = [1, 1, 1, 1, 0.5, 0.5]; + if(margins.left == null) margins.left = defs[0]; + if(margins.right == null) margins.right = defs[1]; + if(margins.top == null) margins.top = defs[2]; + if(margins.bottom == null) margins.bottom = defs[3]; + if(margins.header == null) margins.header = defs[4]; + if(margins.footer == null) margins.footer = defs[5]; + } + + function get_cell_style(styles, cell, opts) { + if (typeof style_builder != 'undefined') { + if (/^\d+$/.exec(cell.s)) { return cell.s} // if its already an integer index, let it be + if (cell.s && (cell.s == +cell.s)) { return cell.s} // if its already an integer index, let it be + var s = cell.s || {}; + if (cell.z) s.numFmt = cell.z; + return style_builder.addStyle(s); + } + else { + var z = opts.revssf[cell.z != null ? cell.z : "General"]; + var i = 0x3c, len = styles.length; + if (z == null && opts.ssf) { + for (; i < 0x188; ++i) if (opts.ssf[i] == null) { + SSF.load(cell.z, i); + // $FlowIgnore + opts.ssf[i] = cell.z; + opts.revssf[cell.z] = z = i; + break; + } + } + for (i = 0; i != len; ++i) if (styles[i].numFmtId === z) return i; + styles[len] = { + numFmtId: z, + fontId: 0, + fillId: 0, + borderId: 0, + xfId: 0, + applyNumberFormat: 1 + }; + return len; + } + } + + function safe_format(p, fmtid, fillid, opts, themes, styles) { + if(p.t === 'z') return; + if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v); + try { + if(opts.cellNF) p.z = SSF._table[fmtid]; + } catch(e) { if(opts.WTF) throw e; } + if(!opts || opts.cellText !== false) try { + if(SSF._table[fmtid] == null) SSF.load(SSFImplicit[fmtid] || "General", fmtid); + if(p.t === 'e') p.w = p.w || BErr[p.v]; + else if(fmtid === 0) { + if(p.t === 'n') { + if((p.v|0) === p.v) p.w = SSF._general_int(p.v); + else p.w = SSF._general_num(p.v); + } + else if(p.t === 'd') { + var dd = datenum(p.v); + if((dd|0) === dd) p.w = SSF._general_int(dd); + else p.w = SSF._general_num(dd); + } + else if(p.v === undefined) return ""; + else p.w = SSF._general(p.v,_ssfopts); + } + else if(p.t === 'd') p.w = SSF.format(fmtid,datenum(p.v),_ssfopts); + else p.w = SSF.format(fmtid,p.v,_ssfopts); + } catch(e) { if(opts.WTF) throw e; } + if(!opts.cellStyles) return; + if(fillid != null) try { + p.s = styles.Fills[fillid]; + if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) { + p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0); + if(opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb; + } + if (p.s.bgColor && p.s.bgColor.theme) { + p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0); + if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb; + } + } catch(e) { if(opts.WTF && styles.Fills) throw e; } + } + + function check_ws(ws, sname, i) { + if(ws && ws['!ref']) { + var range = safe_decode_range(ws['!ref']); + if(range.e.c < range.s.c || range.e.r < range.s.r) throw new Error("Bad range (" + i + "): " + ws['!ref']); + } + } + function parse_ws_xml_dim(ws, s) { + var d = safe_decode_range(s); + if(d.s.r<=d.e.r && d.s.c<=d.e.c && d.s.r>=0 && d.s.c>=0) ws["!ref"] = encode_range(d); + } + var mergecregex = /<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g; + var sheetdataregex = /<(?:\w+:)?sheetData>([\s\S]*)<\/(?:\w+:)?sheetData>/; + var hlinkregex = /<(?:\w:)?hyperlink [^>]*>/mg; + var dimregex = /"(\w*:\w*)"/; + var colregex = /<(?:\w:)?col\b[^>]*[\/]?>/g; + var afregex = /<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g; + var marginregex= /<(?:\w:)?pageMargins[^>]*\/>/g; + var sheetprregex = /<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/; + var svsregex = /<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/; + /* 18.3 Worksheets */ + function parse_ws_xml(data, opts, idx, rels, wb, themes, styles) { + if(!data) return data; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + + /* 18.3.1.99 worksheet CT_Worksheet */ + var s = opts.dense ? ([]) : ({}); + var refguess = ({s: {r:2000000, c:2000000}, e: {r:0, c:0} }); + + var data1 = "", data2 = ""; + var mtch = data.match(sheetdataregex); + if(mtch) { + data1 = data.slice(0, mtch.index); + data2 = data.slice(mtch.index + mtch[0].length); + } else data1 = data2 = data; + + /* 18.3.1.82 sheetPr CT_SheetPr */ + var sheetPr = data1.match(sheetprregex); + if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); + + /* 18.3.1.35 dimension CT_SheetDimension */ + // $FlowIgnore + var ridx = (data1.match(/<(?:\w*:)?dimension/)||{index:-1}).index; + if(ridx > 0) { + var ref = data1.slice(ridx,ridx+50).match(dimregex); + if(ref) parse_ws_xml_dim(s, ref[1]); + } + + /* 18.3.1.88 sheetViews CT_SheetViews */ + var svs = data1.match(svsregex); + if(svs && svs[1]) parse_ws_xml_sheetviews(svs[1], wb); + + /* 18.3.1.17 cols CT_Cols */ + var columns = []; + if(opts.cellStyles) { + /* 18.3.1.13 col CT_Col */ + var cols = data1.match(colregex); + if(cols) parse_ws_xml_cols(columns, cols); + } + + /* 18.3.1.80 sheetData CT_SheetData ? */ + if(mtch) parse_ws_xml_data(mtch[1], s, opts, refguess, themes, styles); + + /* 18.3.1.2 autoFilter CT_AutoFilter */ + var afilter = data2.match(afregex); + if(afilter) s['!autofilter'] = parse_ws_xml_autofilter(afilter[0]); + + /* 18.3.1.55 mergeCells CT_MergeCells */ + var merges = []; + var _merge = data2.match(mergecregex); + if(_merge) for(ridx = 0; ridx != _merge.length; ++ridx) + merges[ridx] = safe_decode_range(_merge[ridx].slice(_merge[ridx].indexOf("\"")+1)); + + /* 18.3.1.48 hyperlinks CT_Hyperlinks */ + var hlink = data2.match(hlinkregex); + if(hlink) parse_ws_xml_hlinks(s, hlink, rels); + + /* 18.3.1.62 pageMargins CT_PageMargins */ + var margins = data2.match(marginregex); + if(margins) s['!margins'] = parse_ws_xml_margins(parsexmltag(margins[0])); + + if(!s["!ref"] && refguess.e.c >= refguess.s.c && refguess.e.r >= refguess.s.r) s["!ref"] = encode_range(refguess); + if(opts.sheetRows > 0 && s["!ref"]) { + var tmpref = safe_decode_range(s["!ref"]); + if(opts.sheetRows <= +tmpref.e.r) { + tmpref.e.r = opts.sheetRows - 1; + if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r; + if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r; + if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c; + if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c; + s["!fullref"] = s["!ref"]; + s["!ref"] = encode_range(tmpref); + } + } + if(columns.length > 0) s["!cols"] = columns; + if(merges.length > 0) s["!merges"] = merges; + return s; + } + + function write_ws_xml_merges(merges) { + if(merges.length === 0) return ""; + var o = ''; + for(var i = 0; i != merges.length; ++i) o += ''; + return o + ''; + } + + /* 18.3.1.82-3 sheetPr CT_ChartsheetPr / CT_SheetPr */ + function parse_ws_xml_sheetpr(sheetPr, s, wb, idx) { + var data = parsexmltag(sheetPr); + if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; + if(data.codeName) wb.Sheets[idx].CodeName = data.codeName; + } + + /* 18.3.1.85 sheetProtection CT_SheetProtection */ + function write_ws_xml_protection(sp) { + // algorithmName, hashValue, saltValue, spinCountpassword + var o = ({sheet:1}); + var deffalse = ["objects", "scenarios", "selectLockedCells", "selectUnlockedCells"]; + var deftrue = [ + "formatColumns", "formatRows", "formatCells", + "insertColumns", "insertRows", "insertHyperlinks", + "deleteColumns", "deleteRows", + "sort", "autoFilter", "pivotTables" + ]; + deffalse.forEach(function(n) { if(sp[n] != null && sp[n]) o[n] = "1"; }); + deftrue.forEach(function(n) { if(sp[n] != null && !sp[n]) o[n] = "0"; }); + /* TODO: algorithm */ + if(sp.password) o.password = crypto_CreatePasswordVerifier_Method1(sp.password).toString(16).toUpperCase(); + return writextag('sheetProtection', null, o); + } + + function parse_ws_xml_hlinks(s, data, rels) { + var dense = Array.isArray(s); + for(var i = 0; i != data.length; ++i) { + var val = parsexmltag(utf8read(data[i]), true); + if(!val.ref) return; + var rel = ((rels || {})['!id']||[])[val.id]; + if(rel) { + val.Target = rel.Target; + if(val.location) val.Target += "#"+val.location; + } else { + val.Target = "#" + val.location; + rel = {Target: val.Target, TargetMode: 'Internal'}; + } + val.Rel = rel; + if(val.tooltip) { val.Tooltip = val.tooltip; delete val.tooltip; } + var rng = safe_decode_range(val.ref); + for(var R=rng.s.r;R<=rng.e.r;++R) for(var C=rng.s.c;C<=rng.e.c;++C) { + var addr = encode_cell({c:C,r:R}); + if(dense) { + if(!s[R]) s[R] = []; + if(!s[R][C]) s[R][C] = {t:"z",v:undefined}; + s[R][C].l = val; + } else { + if(!s[addr]) s[addr] = {t:"z",v:undefined}; + s[addr].l = val; + } + } + } + } + + function parse_ws_xml_margins(margin) { + var o = {}; + ["left", "right", "top", "bottom", "header", "footer"].forEach(function(k) { + if(margin[k]) o[k] = parseFloat(margin[k]); + }); + return o; + } + function write_ws_xml_margins(margin) { + default_margins(margin); + return writextag('pageMargins', null, margin); + } + + function parse_ws_xml_cols(columns, cols) { + var seencol = false; + for(var coli = 0; coli != cols.length; ++coli) { + var coll = parsexmltag(cols[coli], true); + if(coll.hidden) coll.hidden = parsexmlbool(coll.hidden); + var colm=parseInt(coll.min, 10)-1, colM=parseInt(coll.max,10)-1; + delete coll.min; delete coll.max; coll.width = +coll.width; + if(!seencol && coll.width) { seencol = true; find_mdw_colw(coll.width); } + process_col(coll); + while(colm <= colM) columns[colm++] = dup(coll); + } + } + + function write_ws_xml_cols(ws, cols) { + var o = [""], col; + for(var i = 0; i != cols.length; ++i) { + if(!(col = cols[i])) continue; + o[o.length] = (writextag('col', null, col_obj_w(i, col))); + } + o[o.length] = ""; + return o.join(""); + } + + function parse_ws_xml_autofilter(data) { + var o = { ref: (data.match(/ref="([^"]*)"/)||[])[1]}; + return o; + } + function write_ws_xml_autofilter(data, ws, wb, idx) { + var ref = typeof data.ref == "string" ? data.ref : encode_range(data.ref); + if(!wb.Workbook) wb.Workbook = {}; + if(!wb.Workbook.Names) wb.Workbook.Names = []; + var names = wb.Workbook.Names; + var range = decode_range(ref); + if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); } + for(var i = 0; i < names.length; ++i) { + var name = names[i]; + if(name.Name != '_xlnm._FilterDatabase') continue; + if(name.Sheet != idx) continue; + name.Ref = "'" + wb.SheetNames[idx] + "'!" + ref; break; + } + if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetNames[idx] + "'!" + ref }); + return writextag("autoFilter", null, {ref:ref}); + } + + /* 18.3.1.88 sheetViews CT_SheetViews */ + /* 18.3.1.87 sheetView CT_SheetView */ + var sviewregex = /<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/>/; + function parse_ws_xml_sheetviews(data, wb) { + (data.match(sviewregex)||[]).forEach(function(r) { + var tag = parsexmltag(r); + if(parsexmlbool(tag.rightToLeft)) { + if(!wb.Views) wb.Views = [{}]; + if(!wb.Views[0]) wb.Views[0] = {}; + wb.Views[0].RTL = true; + } + }); + } + function write_ws_xml_sheetviews(ws, opts, idx, wb) { + var sview = {workbookViewId:"0"}; + // $FlowIgnore + if( (((wb||{}).Workbook||{}).Views||[])[0] ) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0"; + return writextag("sheetViews", writextag("sheetView", null, sview), {}); + } + + function write_ws_xml_cell(cell, ref, ws, opts) { + if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return ""; + var vv = ""; + var oldt = cell.t, oldv = cell.v; + switch(cell.t) { + case 'b': vv = cell.v ? "1" : "0"; break; + case 'n': vv = ''+cell.v; break; + case 'e': vv = BErr[cell.v]; break; + case 'd': + if(opts.cellDates) vv = parseDate(cell.v, -1).toISOString(); + else { + cell = dup(cell); + cell.t = 'n'; + vv = ''+(cell.v = datenum(parseDate(cell.v))); + } + if(typeof cell.z === 'undefined') cell.z = SSF._table[14]; + break; + default: vv = cell.v; break; + } + var v = writetag('v', escapexml(vv)), o = ({r:ref}); + /* TODO: cell style */ + var os = get_cell_style(opts.cellXfs, cell, opts); + if(os !== 0) o.s = os; + switch(cell.t) { + case 'n': break; + case 'd': o.t = "d"; break; + case 'b': o.t = "b"; break; + case 'e': o.t = "e"; break; + default: if(cell.v == null) { delete cell.t; break; } + if(opts.bookSST) { + v = writetag('v', ''+get_sst_id(opts.Strings, cell.v, opts.revStrings)); + o.t = "s"; break; + } + o.t = "str"; break; + } + if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; } + if(cell.f) { + var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null; + v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : ""); + } + if(cell.l) ws['!links'].push([ref, cell.l]); + if(cell.c) ws['!comments'].push([ref, cell.c]); + return writextag('c', v, o); + } + + var parse_ws_xml_data = (function() { + var cellregex = /<(?:\w+:)?c[ >]/, rowregex = /<\/(?:\w+:)?row>/; + var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/; + var refregex = /ref=["']([^"']*)["']/; + var match_v = matchtag("v"), match_f = matchtag("f"); + + return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) { + var ri = 0, x = "", cells = [], cref = [], idx=0, i=0, cc=0, d="", p; + var tag, tagr = 0, tagc = 0; + var sstr, ftag; + var fmtid = 0, fillid = 0; + var do_format = Array.isArray(styles.CellXf), cf; + var arrayf = []; + var sharedf = []; + var dense = Array.isArray(s); + var rows = [], rowobj = {}, rowrite = false; + for(var marr = sdata.split(rowregex), mt = 0, marrlen = marr.length; mt != marrlen; ++mt) { + x = marr[mt].trim(); + var xlen = x.length; + if(xlen === 0) continue; + + /* 18.3.1.73 row CT_Row */ + for(ri = 0; ri < xlen; ++ri) if(x.charCodeAt(ri) === 62) break; ++ri; + tag = parsexmltag(x.slice(0,ri), true); + tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; + if(opts.sheetRows && opts.sheetRows < tagr) continue; + if(guess.s.r > tagr - 1) guess.s.r = tagr - 1; + if(guess.e.r < tagr - 1) guess.e.r = tagr - 1; + + if(opts && opts.cellStyles) { + rowobj = {}; rowrite = false; + if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); } + if(tag.hidden == "1") { rowrite = true; rowobj.hidden = true; } + if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; } + if(rowrite) rows[tagr-1] = rowobj; + } + + /* 18.3.1.4 c CT_Cell */ + cells = x.slice(ri).split(cellregex); + for(ri = 0; ri != cells.length; ++ri) { + x = cells[ri].trim(); + if(x.length === 0) continue; + cref = x.match(rregex); idx = ri; i=0; cc=0; + x = "":"") + x; + if(cref != null && cref.length === 2) { + idx = 0; d=cref[1]; + for(i=0; i != d.length; ++i) { + if((cc=d.charCodeAt(i)-64) < 1 || cc > 26) break; + idx = 26*idx + cc; + } + --idx; + tagc = idx; + } else ++tagc; + for(i = 0; i != x.length; ++i) if(x.charCodeAt(i) === 62) break; ++i; + tag = parsexmltag(x.slice(0,i), true); + if(!tag.r) tag.r = encode_cell({r:tagr-1, c:tagc}); + d = x.slice(i); + p = ({t:""}); + + if((cref=d.match(match_v))!= null && cref[1] !== '') p.v=unescapexml(cref[1]); + if(opts.cellFormula) { + if((cref=d.match(match_f))!= null && cref[1] !== '') { + /* TODO: match against XLSXFutureFunctions */ + p.f=_xlfn(unescapexml(utf8read(cref[1]))); + if(cref[0].indexOf('t="array"') > -1) { + p.F = (d.match(refregex)||[])[1]; + if(p.F.indexOf(":") > -1) arrayf.push([safe_decode_range(p.F), p.F]); + } else if(cref[0].indexOf('t="shared"') > -1) { + // TODO: parse formula + ftag = parsexmltag(cref[0]); + sharedf[parseInt(ftag.si, 10)] = [ftag, _xlfn(unescapexml(utf8read(cref[1]))), tag.r]; + } + } else if((cref=d.match(/]*\/>/))) { + ftag = parsexmltag(cref[0]); + if(sharedf[ftag.si]) p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2]/*[0].ref*/, tag.r); + } + /* TODO: factor out contains logic */ + var _tag = decode_cell(tag.r); + for(i = 0; i < arrayf.length; ++i) + if(_tag.r >= arrayf[i][0].s.r && _tag.r <= arrayf[i][0].e.r) + if(_tag.c >= arrayf[i][0].s.c && _tag.c <= arrayf[i][0].e.c) + p.F = arrayf[i][1]; + } + + if(tag.t == null && p.v === undefined) { + if(p.f || p.F) { + p.v = 0; p.t = "n"; + } else if(!opts.sheetStubs) continue; + else p.t = "z"; + } + else p.t = tag.t || "n"; + if(guess.s.c > tagc) guess.s.c = tagc; + if(guess.e.c < tagc) guess.e.c = tagc; + /* 18.18.11 t ST_CellType */ + switch(p.t) { + case 'n': + if(p.v == "" || p.v == null) { + if(!opts.sheetStubs) continue; + p.t = 'z'; + } else p.v = parseFloat(p.v); + break; + case 's': + if(typeof p.v == 'undefined') { + if(!opts.sheetStubs) continue; + p.t = 'z'; + } else { + sstr = strs[parseInt(p.v, 10)]; + p.v = sstr.t; + p.r = sstr.r; + if(opts.cellHTML) p.h = sstr.h; + } + break; + case 'str': + p.t = "s"; + p.v = (p.v!=null) ? utf8read(p.v) : ''; + if(opts.cellHTML) p.h = escapehtml(p.v); + break; + case 'inlineStr': + cref = d.match(isregex); + p.t = 's'; + if(cref != null && (sstr = parse_si(cref[1]))) p.v = sstr.t; else p.v = ""; + break; + case 'b': p.v = parsexmlbool(p.v); break; + case 'd': + if(opts.cellDates) p.v = parseDate(p.v, 1); + else { p.v = datenum(parseDate(p.v, 1)); p.t = 'n'; } + break; + /* error string in .w, number in .v */ + case 'e': + if(!opts || opts.cellText !== false) p.w = p.v; + p.v = RBErr[p.v]; break; + } + /* formatting */ + fmtid = fillid = 0; + if(do_format && tag.s !== undefined) { + cf = styles.CellXf[tag.s]; + if(cf != null) { + if(cf.numFmtId != null) fmtid = cf.numFmtId; + if(opts.cellStyles) { + if(cf.fillId != null) fillid = cf.fillId; + } + } + } + safe_format(p, fmtid, fillid, opts, themes, styles); + if(opts.cellDates && do_format && p.t == 'n' && SSF.is_date(SSF._table[fmtid])) { p.t = 'd'; p.v = numdate(p.v); } + if(dense) { + var _r = decode_cell(tag.r); + if(!s[_r.r]) s[_r.r] = []; + s[_r.r][_r.c] = p; + } else s[tag.r] = p; + } + } + if(rows.length > 0) s['!rows'] = rows; + }; })(); + + function write_ws_xml_data(ws, opts, idx, wb) { + var o = [], r = [], range = safe_decode_range(ws['!ref']), cell="", ref, rr = "", cols = [], R=0, C=0, rows = ws['!rows']; + var dense = Array.isArray(ws); + var params = ({r:rr}), row, height = -1; + for(C = range.s.c; C <= range.e.c; ++C) cols[C] = encode_col(C); + for(R = range.s.r; R <= range.e.r; ++R) { + r = []; + rr = encode_row(R); + for(C = range.s.c; C <= range.e.c; ++C) { + ref = cols[C] + rr; + var _cell = dense ? (ws[R]||[])[C]: ws[ref]; + if(_cell === undefined) continue; + if((cell = write_ws_xml_cell(_cell, ref, ws, opts, idx, wb)) != null) r.push(cell); + } + if(r.length > 0 || (rows && rows[R])) { + params = ({r:rr}); + if(rows && rows[R]) { + row = rows[R]; + if(row.hidden) params.hidden = 1; + height = -1; + if(row.hpx) height = px2pt(row.hpx); + else if(row.hpt) height = row.hpt; + if(height > -1) { params.ht = height; params.customHeight = 1; } + if(row.level) { params.outlineLevel = row.level; } + } + o[o.length] = (writextag('row', r.join(""), params)); + } + } + if(rows) for(; R < rows.length; ++R) { + if(rows && rows[R]) { + params = ({r:R+1}); + row = rows[R]; + if(row.hidden) params.hidden = 1; + height = -1; + if (row.hpx) height = px2pt(row.hpx); + else if (row.hpt) height = row.hpt; + if (height > -1) { params.ht = height; params.customHeight = 1; } + if (row.level) { params.outlineLevel = row.level; } + o[o.length] = (writextag('row', "", params)); + } + } + return o.join(""); + } + + var WS_XML_ROOT = writextag('worksheet', null, { + 'xmlns': XMLNS.main[0], + 'xmlns:r': XMLNS.r + }); + + function write_ws_xml(idx, opts, wb, rels) { + var o = [XML_HEADER, WS_XML_ROOT]; + var s = wb.SheetNames[idx], sidx = 0, rdata = ""; + var ws = wb.Sheets[s]; + if(ws == null) ws = {}; + var ref = ws['!ref'] || 'A1'; + var range = safe_decode_range(ref); + if(range.e.c > 0x3FFF || range.e.r > 0xFFFFF) { + if(opts.WTF) throw new Error("Range " + ref + " exceeds format limit A1:XFD1048576"); + range.e.c = Math.min(range.e.c, 0x3FFF); + range.e.r = Math.min(range.e.c, 0xFFFFF); + ref = encode_range(range); + } + if(!rels) rels = {}; + ws['!comments'] = []; + ws['!drawing'] = []; + + if(opts.bookType !== 'xlsx' && wb.vbaraw) { + var cname = wb.SheetNames[idx]; + try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {} + o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(cname)})); + } + + o[o.length] = (writextag('dimension', null, {'ref': ref})); + + o[o.length] = write_ws_xml_sheetviews(ws, opts, idx, wb); + + /* TODO: store in WB, process styles */ + if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, { + defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', + baseColWidth:opts.sheetFormat.baseColWidth||'10', + outlineLevelRow:opts.sheetFormat.outlineLevelRow||'7' + })); + + if(ws['!cols'] != null && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); + + o[sidx = o.length] = ''; + ws['!links'] = []; + if(ws['!ref'] != null) { + rdata = write_ws_xml_data(ws, opts, idx, wb, rels); + if(rdata.length > 0) o[o.length] = (rdata); + } + if(o.length>sidx+1) { o[o.length] = (''); o[sidx]=o[sidx].replace("/>",">"); } + + /* sheetCalcPr */ + + if(ws['!protect'] != null) o[o.length] = write_ws_xml_protection(ws['!protect']); + + /* protectedRanges */ + /* scenarios */ + + if(ws['!autofilter'] != null) o[o.length] = write_ws_xml_autofilter(ws['!autofilter'], ws, wb, idx); + + /* sortState */ + /* dataConsolidate */ + /* customSheetViews */ + + if(ws['!merges'] != null && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges'])); + + /* phoneticPr */ + /* conditionalFormatting */ + /* dataValidations */ + + var relc = -1, rel, rId = -1; + if(ws['!links'].length > 0) { + o[o.length] = ""; + ws['!links'].forEach(function(l) { + if(!l[1].Target) return; + rel = ({"ref":l[0]}); + if(l[1].Target.charAt(0) != "#") { + rId = add_rels(rels, -1, escapexml(l[1].Target).replace(/#.*$/, ""), RELS.HLINK); + rel["r:id"] = "rId"+rId; + } + if((relc = l[1].Target.indexOf("#")) > -1) rel.location = escapexml(l[1].Target.slice(relc+1)); + if(l[1].Tooltip) rel.tooltip = escapexml(l[1].Tooltip); + o[o.length] = writextag("hyperlink",null,rel); + }); + o[o.length] = ""; + } + delete ws['!links']; + + /* printOptions */ + if (ws['!margins'] != null) o[o.length] = write_ws_xml_margins(ws['!margins']); + /* pageSetup */ + + //var hfidx = o.length; + o[o.length] = ""; + + /* rowBreaks */ + /* colBreaks */ + /* customProperties */ + /* cellWatches */ + + if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref})); + + /* smartTags */ + + if(ws['!drawing'].length > 0) { + rId = add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); + o[o.length] = writextag("drawing", null, {"r:id":"rId" + rId}); + } + else delete ws['!drawing']; + + if(ws['!comments'].length > 0) { + rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML); + o[o.length] = writextag("legacyDrawing", null, {"r:id":"rId" + rId}); + ws['!legacy'] = rId; + } + + /* drawingHF */ + /* picture */ + /* oleObjects */ + /* controls */ + /* webPublishItems */ + /* tableParts */ + /* extList */ + + if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + + /* [MS-XLSB] 2.4.726 BrtRowHdr */ + function parse_BrtRowHdr(data, length) { + var z = ({}); + var tgt = data.l + length; + z.r = data.read_shift(4); + data.l += 4; // TODO: ixfe + var miyRw = data.read_shift(2); + data.l += 1; // TODO: top/bot padding + var flags = data.read_shift(1); + data.l = tgt; + if(flags & 0x07) z.level = flags & 0x07; + if(flags & 0x10) z.hidden = true; + if(flags & 0x20) z.hpt = miyRw / 20; + return z; + } + function write_BrtRowHdr(R, range, ws) { + var o = new_buf(17+8*16); + var row = (ws['!rows']||[])[R]||{}; + o.write_shift(4, R); + + o.write_shift(4, 0); /* TODO: ixfe */ + + var miyRw = 0x0140; + if(row.hpx) miyRw = px2pt(row.hpx) * 20; + else if(row.hpt) miyRw = row.hpt * 20; + o.write_shift(2, miyRw); + + o.write_shift(1, 0); /* top/bot padding */ + + var flags = 0x0; + if(row.level) flags |= row.level; + if(row.hidden) flags |= 0x10; + if(row.hpx || row.hpt) flags |= 0x20; + o.write_shift(1, flags); + + o.write_shift(1, 0); /* phonetic guide */ + + /* [MS-XLSB] 2.5.8 BrtColSpan explains the mechanism */ + var ncolspan = 0, lcs = o.l; + o.l += 4; + + var caddr = {r:R, c:0}; + for(var i = 0; i < 16; ++i) { + if((range.s.c > ((i+1) << 10)) || (range.e.c < (i << 10))) continue; + var first = -1, last = -1; + for(var j = (i<<10); j < ((i+1)<<10); ++j) { + caddr.c = j; + var cell = Array.isArray(ws) ? (ws[caddr.r]||[])[caddr.c] : ws[encode_cell(caddr)]; + if(cell) { if(first < 0) first = j; last = j; } + } + if(first < 0) continue; + ++ncolspan; + o.write_shift(4, first); + o.write_shift(4, last); + } + + var l = o.l; + o.l = lcs; + o.write_shift(4, ncolspan); + o.l = l; + + return o.length > o.l ? o.slice(0, o.l) : o; + } + function write_row_header(ba, ws, range, R) { + var o = write_BrtRowHdr(R, range, ws); + if((o.length > 17) || (ws['!rows']||[])[R]) write_record(ba, 'BrtRowHdr', o); + } + + /* [MS-XLSB] 2.4.820 BrtWsDim */ + var parse_BrtWsDim = parse_UncheckedRfX; + var write_BrtWsDim = write_UncheckedRfX; + + /* [MS-XLSB] 2.4.821 BrtWsFmtInfo */ + function parse_BrtWsFmtInfo() { + } +//function write_BrtWsFmtInfo(ws, o) { } + + /* [MS-XLSB] 2.4.823 BrtWsProp */ + function parse_BrtWsProp(data, length) { + var z = {}; + /* TODO: pull flags */ + data.l += 19; + z.name = parse_XLSBCodeName(data, length - 19); + return z; + } + function write_BrtWsProp(str, o) { + if(o == null) o = new_buf(84+4*str.length); + for(var i = 0; i < 3; ++i) o.write_shift(1,0); + write_BrtColor({auto:1}, o); + o.write_shift(-4,-1); + o.write_shift(-4,-1); + write_XLSBCodeName(str, o); + return o.slice(0, o.l); + } + + /* [MS-XLSB] 2.4.306 BrtCellBlank */ + function parse_BrtCellBlank(data) { + var cell = parse_XLSBCell(data); + return [cell]; + } + function write_BrtCellBlank(cell, ncell, o) { + if(o == null) o = new_buf(8); + return write_XLSBCell(ncell, o); + } + + + /* [MS-XLSB] 2.4.307 BrtCellBool */ + function parse_BrtCellBool(data) { + var cell = parse_XLSBCell(data); + var fBool = data.read_shift(1); + return [cell, fBool, 'b']; + } + function write_BrtCellBool(cell, ncell, o) { + if(o == null) o = new_buf(9); + write_XLSBCell(ncell, o); + o.write_shift(1, cell.v ? 1 : 0); + return o; + } + + /* [MS-XLSB] 2.4.308 BrtCellError */ + function parse_BrtCellError(data) { + var cell = parse_XLSBCell(data); + var bError = data.read_shift(1); + return [cell, bError, 'e']; + } + + /* [MS-XLSB] 2.4.311 BrtCellIsst */ + function parse_BrtCellIsst(data) { + var cell = parse_XLSBCell(data); + var isst = data.read_shift(4); + return [cell, isst, 's']; + } + function write_BrtCellIsst(cell, ncell, o) { + if(o == null) o = new_buf(12); + write_XLSBCell(ncell, o); + o.write_shift(4, ncell.v); + return o; + } + + /* [MS-XLSB] 2.4.313 BrtCellReal */ + function parse_BrtCellReal(data) { + var cell = parse_XLSBCell(data); + var value = parse_Xnum(data); + return [cell, value, 'n']; + } + function write_BrtCellReal(cell, ncell, o) { + if(o == null) o = new_buf(16); + write_XLSBCell(ncell, o); + write_Xnum(cell.v, o); + return o; + } + + /* [MS-XLSB] 2.4.314 BrtCellRk */ + function parse_BrtCellRk(data) { + var cell = parse_XLSBCell(data); + var value = parse_RkNumber(data); + return [cell, value, 'n']; + } + function write_BrtCellRk(cell, ncell, o) { + if(o == null) o = new_buf(12); + write_XLSBCell(ncell, o); + write_RkNumber(cell.v, o); + return o; + } + + + /* [MS-XLSB] 2.4.317 BrtCellSt */ + function parse_BrtCellSt(data) { + var cell = parse_XLSBCell(data); + var value = parse_XLWideString(data); + return [cell, value, 'str']; + } + function write_BrtCellSt(cell, ncell, o) { + if(o == null) o = new_buf(12 + 4 * cell.v.length); + write_XLSBCell(ncell, o); + write_XLWideString(cell.v, o); + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.653 BrtFmlaBool */ + function parse_BrtFmlaBool(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = data.read_shift(1); + var o = [cell, value, 'b']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; + } + + /* [MS-XLSB] 2.4.654 BrtFmlaError */ + function parse_BrtFmlaError(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = data.read_shift(1); + var o = [cell, value, 'e']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; + } + + /* [MS-XLSB] 2.4.655 BrtFmlaNum */ + function parse_BrtFmlaNum(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = parse_Xnum(data); + var o = [cell, value, 'n']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; + } + + /* [MS-XLSB] 2.4.656 BrtFmlaString */ + function parse_BrtFmlaString(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = parse_XLWideString(data); + var o = [cell, value, 'str']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; + } + + /* [MS-XLSB] 2.4.682 BrtMergeCell */ + var parse_BrtMergeCell = parse_UncheckedRfX; + var write_BrtMergeCell = write_UncheckedRfX; + /* [MS-XLSB] 2.4.107 BrtBeginMergeCells */ + function write_BrtBeginMergeCells(cnt, o) { + if(o == null) o = new_buf(4); + o.write_shift(4, cnt); + return o; + } + + /* [MS-XLSB] 2.4.662 BrtHLink */ + function parse_BrtHLink(data, length) { + var end = data.l + length; + var rfx = parse_UncheckedRfX(data, 16); + var relId = parse_XLNullableWideString(data); + var loc = parse_XLWideString(data); + var tooltip = parse_XLWideString(data); + var display = parse_XLWideString(data); + data.l = end; + var o = ({rfx:rfx, relId:relId, loc:loc, display:display}); + if(tooltip) o.Tooltip = tooltip; + return o; + } + function write_BrtHLink(l, rId) { + var o = new_buf(50+4*(l[1].Target.length + (l[1].Tooltip || "").length)); + write_UncheckedRfX({s:decode_cell(l[0]), e:decode_cell(l[0])}, o); + write_RelID("rId" + rId, o); + var locidx = l[1].Target.indexOf("#"); + var loc = locidx == -1 ? "" : l[1].Target.slice(locidx+1); + write_XLWideString(loc || "", o); + write_XLWideString(l[1].Tooltip || "", o); + write_XLWideString("", o); + return o.slice(0, o.l); + } + + /* [MS-XLSB] 2.4.6 BrtArrFmla */ + function parse_BrtArrFmla(data, length, opts) { + var end = data.l + length; + var rfx = parse_RfX(data, 16); + var fAlwaysCalc = data.read_shift(1); + var o = [rfx]; o[2] = fAlwaysCalc; + if(opts.cellFormula) { + var formula = parse_XLSBArrayParsedFormula(data, end - data.l, opts); + o[1] = formula; + } else data.l = end; + return o; + } + + /* [MS-XLSB] 2.4.750 BrtShrFmla */ + function parse_BrtShrFmla(data, length, opts) { + var end = data.l + length; + var rfx = parse_UncheckedRfX(data, 16); + var o = [rfx]; + if(opts.cellFormula) { + var formula = parse_XLSBSharedParsedFormula(data, end - data.l, opts); + o[1] = formula; + data.l = end; + } else data.l = end; + return o; + } + + /* [MS-XLSB] 2.4.323 BrtColInfo */ + /* TODO: once XLS ColInfo is set, combine the functions */ + function write_BrtColInfo(C, col, o) { + if(o == null) o = new_buf(18); + var p = col_obj_w(C, col); + o.write_shift(-4, C); + o.write_shift(-4, C); + o.write_shift(4, (p.width || 10) * 256); + o.write_shift(4, 0/*ixfe*/); // style + var flags = 0; + if(col.hidden) flags |= 0x01; + if(typeof p.width == 'number') flags |= 0x02; + o.write_shift(1, flags); // bit flag + o.write_shift(1, 0); // bit flag + return o; + } + + /* [MS-XLSB] 2.4.678 BrtMargins */ + var BrtMarginKeys = ["left","right","top","bottom","header","footer"]; + function parse_BrtMargins(data) { + var margins = ({}); + BrtMarginKeys.forEach(function(k) { margins[k] = parse_Xnum(data, 8); }); + return margins; + } + function write_BrtMargins(margins, o) { + if(o == null) o = new_buf(6*8); + default_margins(margins); + BrtMarginKeys.forEach(function(k) { write_Xnum((margins)[k], o); }); + return o; + } + + /* [MS-XLSB] 2.4.299 BrtBeginWsView */ + function parse_BrtBeginWsView(data) { + var f = data.read_shift(2); + data.l += 28; + return { RTL: f & 0x20 }; + } + function write_BrtBeginWsView(ws, Workbook, o) { + if(o == null) o = new_buf(30); + var f = 0x39c; + if((((Workbook||{}).Views||[])[0]||{}).RTL) f |= 0x20; + o.write_shift(2, f); // bit flag + o.write_shift(4, 0); + o.write_shift(4, 0); // view first row + o.write_shift(4, 0); // view first col + o.write_shift(1, 0); // gridline color ICV + o.write_shift(1, 0); + o.write_shift(2, 0); + o.write_shift(2, 100); // zoom scale + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(4, 0); // workbook view id + return o; + } + + /* [MS-XLSB] 2.4.309 BrtCellIgnoreEC */ + function write_BrtCellIgnoreEC(ref) { + var o = new_buf(24); + o.write_shift(4, 4); + o.write_shift(4, 1); + write_UncheckedRfX(ref, o); + return o; + } + + /* [MS-XLSB] 2.4.748 BrtSheetProtection */ + function write_BrtSheetProtection(sp, o) { + if(o == null) o = new_buf(16*4+2); + o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0); + o.write_shift(4, 1); // this record should not be written if no protection + [ + ["objects", false], // fObjects + ["scenarios", false], // fScenarios + ["formatCells", true], // fFormatCells + ["formatColumns", true], // fFormatColumns + ["formatRows", true], // fFormatRows + ["insertColumns", true], // fInsertColumns + ["insertRows", true], // fInsertRows + ["insertHyperlinks", true], // fInsertHyperlinks + ["deleteColumns", true], // fDeleteColumns + ["deleteRows", true], // fDeleteRows + ["selectLockedCells", false], // fSelLockedCells + ["sort", true], // fSort + ["autoFilter", true], // fAutoFilter + ["pivotTables", true], // fPivotTables + ["selectUnlockedCells", false] // fSelUnlockedCells + ].forEach(function(n) { + if(n[1]) o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0); + else o.write_shift(4, sp[n[0]] != null && sp[n[0]] ? 0 : 1); + }); + return o; + } + + /* [MS-XLSB] 2.1.7.61 Worksheet */ + function parse_ws_bin(data, _opts, idx, rels, wb, themes, styles) { + if(!data) return data; + var opts = _opts || {}; + if(!rels) rels = {'!id':{}}; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var s = (opts.dense ? [] : {}); + + var ref; + var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + + var pass = false, end = false; + var row, p, cf, R, C, addr, sstr, rr, cell; + var merges = []; + opts.biff = 12; + opts['!row'] = 0; + + var ai = 0, af = false; + + var arrayf = []; + var sharedf = {}; + var supbooks = opts.supbooks || wb.supbooks || ([[]]); + supbooks.sharedf = sharedf; + supbooks.arrayf = arrayf; + supbooks.SheetNames = wb.SheetNames || wb.Sheets.map(function(x) { return x.name; }); + if(!opts.supbooks) { + opts.supbooks = supbooks; + if(wb.Names) for(var i = 0; i < wb.Names.length; ++i) supbooks[0][i+1] = wb.Names[i]; + } + + var colinfo = [], rowinfo = []; + var seencol = false; + + recordhopper(data, function ws_parse(val, R_n, RT) { + if(end) return; + switch(RT) { + case 0x0094: /* 'BrtWsDim' */ + ref = val; break; + case 0x0000: /* 'BrtRowHdr' */ + row = val; + if(opts.sheetRows && opts.sheetRows <= row.r) end=true; + rr = encode_row(R = row.r); + opts['!row'] = row.r; + if(val.hidden || val.hpt || val.level != null) { + if(val.hpt) val.hpx = pt2px(val.hpt); + rowinfo[val.r] = val; + } + break; + + case 0x0002: /* 'BrtCellRk' */ + case 0x0003: /* 'BrtCellError' */ + case 0x0004: /* 'BrtCellBool' */ + case 0x0005: /* 'BrtCellReal' */ + case 0x0006: /* 'BrtCellSt' */ + case 0x0007: /* 'BrtCellIsst' */ + case 0x0008: /* 'BrtFmlaString' */ + case 0x0009: /* 'BrtFmlaNum' */ + case 0x000A: /* 'BrtFmlaBool' */ + case 0x000B: /* 'BrtFmlaError' */ + p = ({t:val[2]}); + switch(val[2]) { + case 'n': p.v = val[1]; break; + case 's': sstr = strs[val[1]]; p.v = sstr.t; p.r = sstr.r; break; + case 'b': p.v = val[1] ? true : false; break; + case 'e': p.v = val[1]; if(opts.cellText !== false) p.w = BErr[p.v]; break; + case 'str': p.t = 's'; p.v = val[1]; break; + } + if((cf = styles.CellXf[val[0].iStyleRef])) safe_format(p,cf.numFmtId,null,opts, themes, styles); + C = val[0].c; + if(opts.dense) { if(!s[R]) s[R] = []; s[R][C] = p; } + else s[encode_col(C) + rr] = p; + if(opts.cellFormula) { + af = false; + for(ai = 0; ai < arrayf.length; ++ai) { + var aii = arrayf[ai]; + if(row.r >= aii[0].s.r && row.r <= aii[0].e.r) + if(C >= aii[0].s.c && C <= aii[0].e.c) { + p.F = encode_range(aii[0]); af = true; + } + } + if(!af && val.length > 3) p.f = val[3]; + } + if(refguess.s.r > row.r) refguess.s.r = row.r; + if(refguess.s.c > C) refguess.s.c = C; + if(refguess.e.r < row.r) refguess.e.r = row.r; + if(refguess.e.c < C) refguess.e.c = C; + if(opts.cellDates && cf && p.t == 'n' && SSF.is_date(SSF._table[cf.numFmtId])) { + var _d = SSF.parse_date_code(p.v); if(_d) { p.t = 'd'; p.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); } + } + break; + + case 0x0001: /* 'BrtCellBlank' */ + if(!opts.sheetStubs || pass) break; + p = ({t:'z',v:undefined}); + C = val[0].c; + if(opts.dense) { if(!s[R]) s[R] = []; s[R][C] = p; } + else s[encode_col(C) + rr] = p; + if(refguess.s.r > row.r) refguess.s.r = row.r; + if(refguess.s.c > C) refguess.s.c = C; + if(refguess.e.r < row.r) refguess.e.r = row.r; + if(refguess.e.c < C) refguess.e.c = C; + break; + + case 0x00B0: /* 'BrtMergeCell' */ + merges.push(val); break; + + case 0x01EE: /* 'BrtHLink' */ + var rel = rels['!id'][val.relId]; + if(rel) { + val.Target = rel.Target; + if(val.loc) val.Target += "#"+val.loc; + val.Rel = rel; + } else if(val.relId == '') { + val.Target = "#" + val.loc; + } + for(R=val.rfx.s.r;R<=val.rfx.e.r;++R) for(C=val.rfx.s.c;C<=val.rfx.e.c;++C) { + if(opts.dense) { + if(!s[R]) s[R] = []; + if(!s[R][C]) s[R][C] = {t:'z',v:undefined}; + s[R][C].l = val; + } else { + addr = encode_cell({c:C,r:R}); + if(!s[addr]) s[addr] = {t:'z',v:undefined}; + s[addr].l = val; + } + } + break; + + case 0x01AA: /* 'BrtArrFmla' */ + if(!opts.cellFormula) break; + arrayf.push(val); + cell = ((opts.dense ? s[R][C] : s[encode_col(C) + rr])); + cell.f = stringify_formula(val[1], refguess, {r:row.r, c:C}, supbooks, opts); + cell.F = encode_range(val[0]); + break; + case 0x01AB: /* 'BrtShrFmla' */ + if(!opts.cellFormula) break; + sharedf[encode_cell(val[0].s)] = val[1]; + cell = (opts.dense ? s[R][C] : s[encode_col(C) + rr]); + cell.f = stringify_formula(val[1], refguess, {r:row.r, c:C}, supbooks, opts); + break; + + /* identical to 'ColInfo' in XLS */ + case 0x003C: /* 'BrtColInfo' */ + if(!opts.cellStyles) break; + while(val.e >= val.s) { + colinfo[val.e--] = { width: val.w/256, hidden: !!(val.flags & 0x01) }; + if(!seencol) { seencol = true; find_mdw_colw(val.w/256); } + process_col(colinfo[val.e+1]); + } + break; + + case 0x00A1: /* 'BrtBeginAFilter' */ + s['!autofilter'] = { ref:encode_range(val) }; + break; + + case 0x01DC: /* 'BrtMargins' */ + s['!margins'] = val; + break; + + case 0x0093: /* 'BrtWsProp' */ + if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; + if(val.name) wb.Sheets[idx].CodeName = val.name; + break; + + case 0x0089: /* 'BrtBeginWsView' */ + if(!wb.Views) wb.Views = [{}]; + if(!wb.Views[0]) wb.Views[0] = {}; + if(val.RTL) wb.Views[0].RTL = true; + break; + + case 0x01E5: /* 'BrtWsFmtInfo' */ + break; + case 0x00AF: /* 'BrtAFilterDateGroupItem' */ + case 0x0284: /* 'BrtActiveX' */ + case 0x0271: /* 'BrtBigName' */ + case 0x0232: /* 'BrtBkHim' */ + case 0x018C: /* 'BrtBrk' */ + case 0x0458: /* 'BrtCFIcon' */ + case 0x047A: /* 'BrtCFRuleExt' */ + case 0x01D7: /* 'BrtCFVO' */ + case 0x041A: /* 'BrtCFVO14' */ + case 0x0289: /* 'BrtCellIgnoreEC' */ + case 0x0451: /* 'BrtCellIgnoreEC14' */ + case 0x0031: /* 'BrtCellMeta' */ + case 0x024D: /* 'BrtCellSmartTagProperty' */ + case 0x025F: /* 'BrtCellWatch' */ + case 0x0234: /* 'BrtColor' */ + case 0x041F: /* 'BrtColor14' */ + case 0x00A8: /* 'BrtColorFilter' */ + case 0x00AE: /* 'BrtCustomFilter' */ + case 0x049C: /* 'BrtCustomFilter14' */ + case 0x01F3: /* 'BrtDRef' */ + case 0x0040: /* 'BrtDVal' */ + case 0x041D: /* 'BrtDVal14' */ + case 0x0226: /* 'BrtDrawing' */ + case 0x00AB: /* 'BrtDynamicFilter' */ + case 0x00A7: /* 'BrtFilter' */ + case 0x0499: /* 'BrtFilter14' */ + case 0x00A9: /* 'BrtIconFilter' */ + case 0x049D: /* 'BrtIconFilter14' */ + case 0x0227: /* 'BrtLegacyDrawing' */ + case 0x0228: /* 'BrtLegacyDrawingHF' */ + case 0x0295: /* 'BrtListPart' */ + case 0x027F: /* 'BrtOleObject' */ + case 0x01DE: /* 'BrtPageSetup' */ + case 0x0097: /* 'BrtPane' */ + case 0x0219: /* 'BrtPhoneticInfo' */ + case 0x01DD: /* 'BrtPrintOptions' */ + case 0x0218: /* 'BrtRangeProtection' */ + case 0x044F: /* 'BrtRangeProtection14' */ + case 0x02A8: /* 'BrtRangeProtectionIso' */ + case 0x0450: /* 'BrtRangeProtectionIso14' */ + case 0x0400: /* 'BrtRwDescent' */ + case 0x0098: /* 'BrtSel' */ + case 0x0297: /* 'BrtSheetCalcProp' */ + case 0x0217: /* 'BrtSheetProtection' */ + case 0x02A6: /* 'BrtSheetProtectionIso' */ + case 0x01F8: /* 'BrtSlc' */ + case 0x0413: /* 'BrtSparkline' */ + case 0x01AC: /* 'BrtTable' */ + case 0x00AA: /* 'BrtTop10Filter' */ + case 0x0C00: /* 'BrtUid' */ + case 0x0032: /* 'BrtValueMeta' */ + case 0x0816: /* 'BrtWebExtension' */ + case 0x0415: /* 'BrtWsFmtInfoEx14' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ break; + case 0x0026: /* 'BrtACEnd' */ break; + + default: + if((R_n||"").indexOf("Begin") > 0){/* empty */} + else if((R_n||"").indexOf("End") > 0){/* empty */} + else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); + } + }, opts); + + delete opts.supbooks; + delete opts['!row']; + + if(!s["!ref"] && (refguess.s.r < 2000000 || ref && (ref.e.r > 0 || ref.e.c > 0 || ref.s.r > 0 || ref.s.c > 0))) s["!ref"] = encode_range(ref || refguess); + if(opts.sheetRows && s["!ref"]) { + var tmpref = safe_decode_range(s["!ref"]); + if(opts.sheetRows <= +tmpref.e.r) { + tmpref.e.r = opts.sheetRows - 1; + if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r; + if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r; + if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c; + if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c; + s["!fullref"] = s["!ref"]; + s["!ref"] = encode_range(tmpref); + } + } + if(merges.length > 0) s["!merges"] = merges; + if(colinfo.length > 0) s["!cols"] = colinfo; + if(rowinfo.length > 0) s["!rows"] = rowinfo; + return s; + } + + /* TODO: something useful -- this is a stub */ + function write_ws_bin_cell(ba, cell, R, C, opts, ws) { + if(cell.v === undefined) return ""; + var vv = ""; + switch(cell.t) { + case 'b': vv = cell.v ? "1" : "0"; break; + case 'd': // no BrtCellDate :( + cell = dup(cell); + cell.z = cell.z || SSF._table[14]; + cell.v = datenum(parseDate(cell.v)); cell.t = 'n'; + break; + /* falls through */ + case 'n': case 'e': vv = ''+cell.v; break; + default: vv = cell.v; break; + } + var o = ({r:R, c:C}); + /* TODO: cell style */ + o.s = get_cell_style(opts.cellXfs, cell, opts); + if(cell.l) ws['!links'].push([encode_cell(o), cell.l]); + if(cell.c) ws['!comments'].push([encode_cell(o), cell.c]); + switch(cell.t) { + case 's': case 'str': + if(opts.bookSST) { + vv = get_sst_id(opts.Strings, (cell.v), opts.revStrings); + o.t = "s"; o.v = vv; + write_record(ba, "BrtCellIsst", write_BrtCellIsst(cell, o)); + } else { + o.t = "str"; + write_record(ba, "BrtCellSt", write_BrtCellSt(cell, o)); + } + return; + case 'n': + /* TODO: determine threshold for Real vs RK */ + if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) write_record(ba, "BrtCellRk", write_BrtCellRk(cell, o)); + else write_record(ba, "BrtCellReal", write_BrtCellReal(cell, o)); + return; + case 'b': + o.t = "b"; + write_record(ba, "BrtCellBool", write_BrtCellBool(cell, o)); + return; + case 'e': /* TODO: error */ o.t = "e"; break; + } + write_record(ba, "BrtCellBlank", write_BrtCellBlank(cell, o)); + } + + function write_CELLTABLE(ba, ws, idx, opts) { + var range = safe_decode_range(ws['!ref'] || "A1"), ref, rr = "", cols = []; + write_record(ba, 'BrtBeginSheetData'); + var dense = Array.isArray(ws); + var cap = range.e.r; + if(ws['!rows']) cap = Math.max(range.e.r, ws['!rows'].length - 1); + for(var R = range.s.r; R <= cap; ++R) { + rr = encode_row(R); + /* [ACCELLTABLE] */ + /* BrtRowHdr */ + write_row_header(ba, ws, range, R); + if(R <= range.e.r) for(var C = range.s.c; C <= range.e.c; ++C) { + /* *16384CELL */ + if(R === range.s.r) cols[C] = encode_col(C); + ref = cols[C] + rr; + var cell = dense ? (ws[R]||[])[C] : ws[ref]; + if(!cell) continue; + /* write cell */ + write_ws_bin_cell(ba, cell, R, C, opts, ws); + } + } + write_record(ba, 'BrtEndSheetData'); + } + + function write_MERGECELLS(ba, ws) { + if(!ws || !ws['!merges']) return; + write_record(ba, 'BrtBeginMergeCells', write_BrtBeginMergeCells(ws['!merges'].length)); + ws['!merges'].forEach(function(m) { write_record(ba, 'BrtMergeCell', write_BrtMergeCell(m)); }); + write_record(ba, 'BrtEndMergeCells'); + } + + function write_COLINFOS(ba, ws) { + if(!ws || !ws['!cols']) return; + write_record(ba, 'BrtBeginColInfos'); + ws['!cols'].forEach(function(m, i) { if(m) write_record(ba, 'BrtColInfo', write_BrtColInfo(i, m)); }); + write_record(ba, 'BrtEndColInfos'); + } + + function write_IGNOREECS(ba, ws) { + if(!ws || !ws['!ref']) return; + write_record(ba, 'BrtBeginCellIgnoreECs'); + write_record(ba, 'BrtCellIgnoreEC', write_BrtCellIgnoreEC(safe_decode_range(ws['!ref']))); + write_record(ba, 'BrtEndCellIgnoreECs'); + } + + function write_HLINKS(ba, ws, rels) { + /* *BrtHLink */ + ws['!links'].forEach(function(l) { + if(!l[1].Target) return; + var rId = add_rels(rels, -1, l[1].Target.replace(/#.*$/, ""), RELS.HLINK); + write_record(ba, "BrtHLink", write_BrtHLink(l, rId)); + }); + delete ws['!links']; + } + function write_LEGACYDRAWING(ba, ws, idx, rels) { + /* [BrtLegacyDrawing] */ + if(ws['!comments'].length > 0) { + var rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML); + write_record(ba, "BrtLegacyDrawing", write_RelID("rId" + rId)); + ws['!legacy'] = rId; + } + } + + function write_AUTOFILTER(ba, ws) { + if(!ws['!autofilter']) return; + write_record(ba, "BrtBeginAFilter", write_UncheckedRfX(safe_decode_range(ws['!autofilter'].ref))); + /* *FILTERCOLUMN */ + /* [SORTSTATE] */ + /* BrtEndAFilter */ + write_record(ba, "BrtEndAFilter"); + } + + function write_WSVIEWS2(ba, ws, Workbook) { + write_record(ba, "BrtBeginWsViews"); + { /* 1*WSVIEW2 */ + /* [ACUID] */ + write_record(ba, "BrtBeginWsView", write_BrtBeginWsView(ws, Workbook)); + /* [BrtPane] */ + /* *4BrtSel */ + /* *4SXSELECT */ + /* *FRT */ + write_record(ba, "BrtEndWsView"); + } + /* *FRT */ + write_record(ba, "BrtEndWsViews"); + } + + function write_WSFMTINFO() { + /* [ACWSFMTINFO] */ + //write_record(ba, "BrtWsFmtInfo", write_BrtWsFmtInfo(ws)); + } + + function write_SHEETPROTECT(ba, ws) { + if(!ws['!protect']) return; + /* [BrtSheetProtectionIso] */ + write_record(ba, "BrtSheetProtection", write_BrtSheetProtection(ws['!protect'])); + } + + function write_ws_bin(idx, opts, wb, rels) { + var ba = buf_array(); + var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {}; + var c = s; try { if(wb && wb.Workbook) c = wb.Workbook.Sheets[idx].CodeName || c; } catch(e) {} + var r = safe_decode_range(ws['!ref'] || "A1"); + if(r.e.c > 0x3FFF || r.e.r > 0xFFFFF) { + if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:XFD1048576"); + r.e.c = Math.min(r.e.c, 0x3FFF); + r.e.r = Math.min(r.e.c, 0xFFFFF); + } + ws['!links'] = []; + /* passed back to write_zip and removed there */ + ws['!comments'] = []; + write_record(ba, "BrtBeginSheet"); + if(wb.vbaraw) write_record(ba, "BrtWsProp", write_BrtWsProp(c)); + write_record(ba, "BrtWsDim", write_BrtWsDim(r)); + write_WSVIEWS2(ba, ws, wb.Workbook); + write_WSFMTINFO(ba, ws); + write_COLINFOS(ba, ws, idx, opts, wb); + write_CELLTABLE(ba, ws, idx, opts, wb); + /* [BrtSheetCalcProp] */ + write_SHEETPROTECT(ba, ws); + /* *([BrtRangeProtectionIso] BrtRangeProtection) */ + /* [SCENMAN] */ + write_AUTOFILTER(ba, ws); + /* [SORTSTATE] */ + /* [DCON] */ + /* [USERSHVIEWS] */ + write_MERGECELLS(ba, ws); + /* [BrtPhoneticInfo] */ + /* *CONDITIONALFORMATTING */ + /* [DVALS] */ + write_HLINKS(ba, ws, rels); + /* [BrtPrintOptions] */ + if(ws['!margins']) write_record(ba, "BrtMargins", write_BrtMargins(ws['!margins'])); + /* [BrtPageSetup] */ + /* [HEADERFOOTER] */ + /* [RWBRK] */ + /* [COLBRK] */ + /* *BrtBigName */ + /* [CELLWATCHES] */ + if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws); + /* [SMARTTAGS] */ + /* [BrtDrawing] */ + write_LEGACYDRAWING(ba, ws, idx, rels); + /* [BrtLegacyDrawingHF] */ + /* [BrtBkHim] */ + /* [OLEOBJECTS] */ + /* [ACTIVEXCONTROLS] */ + /* [WEBPUBITEMS] */ + /* [LISTPARTS] */ + /* FRTWORKSHEET */ + write_record(ba, "BrtEndSheet"); + return ba.end(); + } + function parse_numCache(data) { + var col = []; + + /* 21.2.2.150 pt CT_NumVal */ + (data.match(/(.*?)<\/c:pt>/mg)||[]).forEach(function(pt) { + var q = pt.match(/(.*)<\/c:v><\/c:pt>/); + if(!q) return; + col[+q[1]] = +q[2]; + }); + + /* 21.2.2.71 formatCode CT_Xstring */ + var nf = unescapexml((data.match(/([\s\S]*?)<\/c:formatCode>/) || ["","General"])[1]); + + return [col, nf]; + } + + /* 21.2 DrawingML - Charts */ + function parse_chart(data, name, opts, rels, wb, csheet) { + var cs = ((csheet || {"!type":"chart"})); + if(!data) return csheet; + /* 21.2.2.27 chart CT_Chart */ + + var C = 0, R = 0, col = "A"; + var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + + /* 21.2.2.120 numCache CT_NumData */ + (data.match(/[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) { + var cache = parse_numCache(nc); + refguess.s.r = refguess.s.c = 0; + refguess.e.c = C; + col = encode_col(C); + cache[0].forEach(function(n,i) { + cs[col + encode_row(i)] = {t:'n', v:n, z:cache[1] }; + R = i; + }); + if(refguess.e.r < R) refguess.e.r = R; + ++C; + }); + if(C > 0) cs["!ref"] = encode_range(refguess); + return cs; + } + RELS.CS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet"; + + var CS_XML_ROOT = writextag('chartsheet', null, { + 'xmlns': XMLNS.main[0], + 'xmlns:r': XMLNS.r + }); + + /* 18.3 Worksheets also covers Chartsheets */ + function parse_cs_xml(data, opts, idx, rels, wb) { + if(!data) return data; + /* 18.3.1.12 chartsheet CT_ChartSheet */ + if(!rels) rels = {'!id':{}}; + var s = {'!type':"chart", '!chart':null, '!rel':""}; + var m; + + /* 18.3.1.83 sheetPr CT_ChartsheetPr */ + var sheetPr = data.match(sheetprregex); + if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); + + /* 18.3.1.36 drawing CT_Drawing */ + if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1]; + + if(rels['!id'][s['!rel']]) s['!chart'] = rels['!id'][s['!rel']]; + return s; + } + function write_cs_xml(idx, opts, wb, rels) { + var o = [XML_HEADER, CS_XML_ROOT]; + o[o.length] = writextag("drawing", null, {"r:id": "rId1"}); + add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); + if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + + /* [MS-XLSB] 2.4.331 BrtCsProp */ + function parse_BrtCsProp(data, length) { + data.l += 10; + var name = parse_XLWideString(data, length - 10); + return { name: name }; + } + + /* [MS-XLSB] 2.1.7.7 Chart Sheet */ + function parse_cs_bin(data, opts, idx, rels, wb) { + if(!data) return data; + if(!rels) rels = {'!id':{}}; + var s = {'!type':"chart", '!chart':null, '!rel':""}; + var state = []; + var pass = false; + recordhopper(data, function cs_parse(val, R_n, RT) { + switch(RT) { + + case 0x0226: /* 'BrtDrawing' */ + s['!rel'] = val; break; + + case 0x028B: /* 'BrtCsProp' */ + if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; + if(val.name) wb.Sheets[idx].CodeName = val.name; + break; + + case 0x0232: /* 'BrtBkHim' */ + case 0x028C: /* 'BrtCsPageSetup' */ + case 0x029D: /* 'BrtCsProtection' */ + case 0x02A7: /* 'BrtCsProtectionIso' */ + case 0x0227: /* 'BrtLegacyDrawing' */ + case 0x0228: /* 'BrtLegacyDrawingHF' */ + case 0x01DC: /* 'BrtMargins' */ + case 0x0C00: /* 'BrtUid' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ + state.push(R_n); break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); break; + + default: + if((R_n||"").indexOf("Begin") > 0) state.push(R_n); + else if((R_n||"").indexOf("End") > 0) state.pop(); + else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT + " " + R_n); + } + }, opts); + + if(rels['!id'][s['!rel']]) s['!chart'] = rels['!id'][s['!rel']]; + return s; + } + function write_cs_bin() { + var ba = buf_array(); + write_record(ba, "BrtBeginSheet"); + /* [BrtCsProp] */ + /* CSVIEWS */ + /* [[BrtCsProtectionIso] BrtCsProtection] */ + /* [USERCSVIEWS] */ + /* [BrtMargins] */ + /* [BrtCsPageSetup] */ + /* [HEADERFOOTER] */ + /* BrtDrawing */ + /* [BrtLegacyDrawing] */ + /* [BrtLegacyDrawingHF] */ + /* [BrtBkHim] */ + /* [WEBPUBITEMS] */ + /* FRTCHARTSHEET */ + write_record(ba, "BrtEndSheet"); + return ba.end(); + } + /* 18.2.28 (CT_WorkbookProtection) Defaults */ + var WBPropsDef = [ + ['allowRefreshQuery', false, "bool"], + ['autoCompressPictures', true, "bool"], + ['backupFile', false, "bool"], + ['checkCompatibility', false, "bool"], + ['CodeName', ''], + ['date1904', false, "bool"], + ['defaultThemeVersion', 0, "int"], + ['filterPrivacy', false, "bool"], + ['hidePivotFieldList', false, "bool"], + ['promptedSolutions', false, "bool"], + ['publishItems', false, "bool"], + ['refreshAllConnections', false, "bool"], + ['saveExternalLinkValues', true, "bool"], + ['showBorderUnselectedTables', true, "bool"], + ['showInkAnnotation', true, "bool"], + ['showObjects', 'all'], + ['showPivotChartFilter', false, "bool"], + ['updateLinks', 'userSet'] + ]; + + /* 18.2.30 (CT_BookView) Defaults */ + var WBViewDef = [ + ['activeTab', 0, "int"], + ['autoFilterDateGrouping', true, "bool"], + ['firstSheet', 0, "int"], + ['minimized', false, "bool"], + ['showHorizontalScroll', true, "bool"], + ['showSheetTabs', true, "bool"], + ['showVerticalScroll', true, "bool"], + ['tabRatio', 600, "int"], + ['visibility', 'visible'] + //window{Height,Width}, {x,y}Window + ]; + + /* 18.2.19 (CT_Sheet) Defaults */ + var SheetDef = [ + //['state', 'visible'] + ]; + + /* 18.2.2 (CT_CalcPr) Defaults */ + var CalcPrDef = [ + ['calcCompleted', 'true'], + ['calcMode', 'auto'], + ['calcOnSave', 'true'], + ['concurrentCalc', 'true'], + ['fullCalcOnLoad', 'false'], + ['fullPrecision', 'true'], + ['iterate', 'false'], + ['iterateCount', '100'], + ['iterateDelta', '0.001'], + ['refMode', 'A1'] + ]; + + /* 18.2.3 (CT_CustomWorkbookView) Defaults */ + /*var CustomWBViewDef = [ + ['autoUpdate', 'false'], + ['changesSavedWin', 'false'], + ['includeHiddenRowCol', 'true'], + ['includePrintSettings', 'true'], + ['maximized', 'false'], + ['minimized', 'false'], + ['onlySync', 'false'], + ['personalView', 'false'], + ['showComments', 'commIndicator'], + ['showFormulaBar', 'true'], + ['showHorizontalScroll', 'true'], + ['showObjects', 'all'], + ['showSheetTabs', 'true'], + ['showStatusbar', 'true'], + ['showVerticalScroll', 'true'], + ['tabRatio', '600'], + ['xWindow', '0'], + ['yWindow', '0'] +];*/ + + function push_defaults_array(target, defaults) { + for(var j = 0; j != target.length; ++j) { var w = target[j]; + for(var i=0; i != defaults.length; ++i) { var z = defaults[i]; + if(w[z[0]] == null) w[z[0]] = z[1]; + else switch(z[2]) { + case "bool": if(typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]); break; + case "int": if(typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10); break; + } + } + } + } + function push_defaults(target, defaults) { + for(var i = 0; i != defaults.length; ++i) { var z = defaults[i]; + if(target[z[0]] == null) target[z[0]] = z[1]; + else switch(z[2]) { + case "bool": if(typeof target[z[0]] == "string") target[z[0]] = parsexmlbool(target[z[0]]); break; + case "int": if(typeof target[z[0]] == "string") target[z[0]] = parseInt(target[z[0]], 10); break; + } + } + } + + function parse_wb_defaults(wb) { + push_defaults(wb.WBProps, WBPropsDef); + push_defaults(wb.CalcPr, CalcPrDef); + + push_defaults_array(wb.WBView, WBViewDef); + push_defaults_array(wb.Sheets, SheetDef); + + _ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904); + } + + function safe1904(wb) { + /* TODO: store date1904 somewhere else */ + if(!wb.Workbook) return "false"; + if(!wb.Workbook.WBProps) return "false"; + return parsexmlbool(wb.Workbook.WBProps.date1904) ? "true" : "false"; + } + + var badchars = "][*?\/\\".split(""); + function check_ws_name(n, safe) { + if(n.length > 31) { if(safe) return false; throw new Error("Sheet names cannot exceed 31 chars"); } + var _good = true; + badchars.forEach(function(c) { + if(n.indexOf(c) == -1) return; + if(!safe) throw new Error("Sheet name cannot contain : \\ / ? * [ ]"); + _good = false; + }); + return _good; + } + function check_wb_names(N, S, codes) { + N.forEach(function(n,i) { + check_ws_name(n); + for(var j = 0; j < i; ++j) if(n == N[j]) throw new Error("Duplicate Sheet Name: " + n); + if(codes) { + var cn = (S && S[i] && S[i].CodeName) || n; + if(cn.charCodeAt(0) == 95 && cn.length > 22) throw new Error("Bad Code Name: Worksheet" + cn); + } + }); + } + function check_wb(wb) { + if(!wb || !wb.SheetNames || !wb.Sheets) throw new Error("Invalid Workbook"); + if(!wb.SheetNames.length) throw new Error("Workbook is empty"); + var Sheets = (wb.Workbook && wb.Workbook.Sheets) || []; + check_wb_names(wb.SheetNames, Sheets, !!wb.vbaraw); + for(var i = 0; i < wb.SheetNames.length; ++i) check_ws(wb.Sheets[wb.SheetNames[i]], wb.SheetNames[i], i); + /* TODO: validate workbook */ + } + /* 18.2 Workbook */ + var wbnsregex = /<\w+:workbook/; + function parse_wb_xml(data, opts) { + if(!data) throw new Error("Could not find file"); + var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, Names:[], xmlns: "" }; + var pass = false, xmlns = "xmlns"; + var dname = {}, dnstart = 0; + data.replace(tagregex, function xml_wb(x, idx) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': break; + + /* 18.2.13 fileVersion CT_FileVersion ? */ + case '': case '': break; + + /* 18.2.12 fileSharing CT_FileSharing ? */ + case '': break; + + /* 18.2.28 workbookPr CT_WorkbookPr ? */ + case '': + WBPropsDef.forEach(function(w) { + if(y[w[0]] == null) return; + switch(w[2]) { + case "bool": wb.WBProps[w[0]] = parsexmlbool(y[w[0]]); break; + case "int": wb.WBProps[w[0]] = parseInt(y[w[0]], 10); break; + default: wb.WBProps[w[0]] = y[w[0]]; + } + }); + if(y.codeName) wb.WBProps.CodeName = y.codeName; + break; + case '': break; + + /* 18.2.29 workbookProtection CT_WorkbookProtection ? */ + case '': break; + + /* 18.2.1 bookViews CT_BookViews ? */ + case '': case '': break; + /* 18.2.30 workbookView CT_BookView + */ + case '': delete y[0]; wb.WBView.push(y); break; + case '': break; + + /* 18.2.20 sheets CT_Sheets 1 */ + case '': case '': break; // aggregate sheet + /* 18.2.19 sheet CT_Sheet + */ + case '': break; + + /* 18.2.15 functionGroups CT_FunctionGroups ? */ + case '': break; + /* 18.2.14 functionGroup CT_FunctionGroup + */ + case '': case '': break; + /* 18.2.8 externalReference CT_ExternalReference + */ + case '': break; + case '': case '': pass=false; break; + /* 18.2.5 definedName CT_DefinedName + */ + case '': { + dname.Ref = unescapexml(utf8read(data.slice(dnstart, idx))); + wb.Names.push(dname); + } break; + case '': break; + + /* 18.2.2 calcPr CT_CalcPr ? */ + case '': delete y[0]; wb.CalcPr = y; break; + case '': break; + + /* 18.2.16 oleSize CT_OleSize ? (ref required) */ + case '': case '': case '': break; + + /* 18.2.18 pivotCaches CT_PivotCaches ? */ + case '': case '': case '': break; + + /* 18.2.23 smartTagTypes CT_SmartTagTypes ? */ + case '': case '': break; + /* 18.2.22 smartTagType CT_SmartTagType ? */ + case '': break; + + /* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */ + case '': break; + + /* 18.2.26 webPublishObjects CT_WebPublishObjects ? */ + case '': case '': break; + /* 18.2.25 webPublishObject CT_WebPublishObject ? */ + case '': case '': case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': pass=false; break; + + /* Others */ + case '': pass=true; break; + case '': pass=false; break; + + /* TODO */ + case ' 0); + + /* fileVersion */ + /* fileSharing */ + + var workbookPr = ({codeName:"ThisWorkbook"}); + if(wb.Workbook && wb.Workbook.WBProps) { + WBPropsDef.forEach(function(x) { + if((wb.Workbook.WBProps[x[0]]) == null) return; + if((wb.Workbook.WBProps[x[0]]) == x[1]) return; + workbookPr[x[0]] = (wb.Workbook.WBProps[x[0]]); + }); + if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.CodeName; delete workbookPr.CodeName; } + } + o[o.length] = (writextag('workbookPr', null, workbookPr)); + + /* workbookProtection */ + + var sheets = wb.Workbook && wb.Workbook.Sheets || []; + var i = 0; + + /* bookViews */ + + o[o.length] = ""; + for(i = 0; i != wb.SheetNames.length; ++i) { + var sht = ({name:escapexml(wb.SheetNames[i].slice(0,31))}); + sht.sheetId = ""+(i+1); + sht["r:id"] = "rId"+(i+1); + if(sheets[i]) switch(sheets[i].Hidden) { + case 1: sht.state = "hidden"; break; + case 2: sht.state = "veryHidden"; break; + } + o[o.length] = (writextag('sheet',null,sht)); + } + o[o.length] = ""; + + /* functionGroups */ + /* externalReferences */ + + if(write_names) { + o[o.length] = ""; + if(wb.Workbook && wb.Workbook.Names) wb.Workbook.Names.forEach(function(n) { + var d = {name:n.Name}; + if(n.Comment) d.comment = n.Comment; + if(n.Sheet != null) d.localSheetId = ""+n.Sheet; + if(n.Hidden) d.hidden = "1"; + if(!n.Ref) return; + o[o.length] = writextag('definedName', String(n.Ref).replace(//g, ">"), d); + }); + o[o.length] = ""; + } + + /* calcPr */ + /* oleSize */ + /* customWorkbookViews */ + /* pivotCaches */ + /* smartTagPr */ + /* smartTagTypes */ + /* webPublishing */ + /* fileRecoveryPr */ + /* webPublishObjects */ + /* extLst */ + + if(o.length>2){ o[o.length] = ''; o[1]=o[1].replace("/>",">"); } + return o.join(""); + } + /* [MS-XLSB] 2.4.304 BrtBundleSh */ + function parse_BrtBundleSh(data, length) { + var z = {}; + z.Hidden = data.read_shift(4); //hsState ST_SheetState + z.iTabID = data.read_shift(4); + z.strRelID = parse_RelID(data,length-8); + z.name = parse_XLWideString(data); + return z; + } + function write_BrtBundleSh(data, o) { + if(!o) o = new_buf(127); + o.write_shift(4, data.Hidden); + o.write_shift(4, data.iTabID); + write_RelID(data.strRelID, o); + write_XLWideString(data.name.slice(0,31), o); + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.815 BrtWbProp */ + function parse_BrtWbProp(data, length) { + var o = ({}); + var flags = data.read_shift(4); + o.defaultThemeVersion = data.read_shift(4); + var strName = (length > 8) ? parse_XLWideString(data) : ""; + if(strName.length > 0) o.CodeName = strName; + o.autoCompressPictures = !!(flags & 0x10000); + o.backupFile = !!(flags & 0x40); + o.checkCompatibility = !!(flags & 0x1000); + o.date1904 = !!(flags & 0x01); + o.filterPrivacy = !!(flags & 0x08); + o.hidePivotFieldList = !!(flags & 0x400); + o.promptedSolutions = !!(flags & 0x10); + o.publishItems = !!(flags & 0x800); + o.refreshAllConnections = !!(flags & 0x40000); + o.saveExternalLinkValues = !!(flags & 0x80); + o.showBorderUnselectedTables = !!(flags & 0x04); + o.showInkAnnotation = !!(flags & 0x20); + o.showObjects = ["all", "placeholders", "none"][(flags >> 13) & 0x03]; + o.showPivotChartFilter = !!(flags & 0x8000); + o.updateLinks = ["userSet", "never", "always"][(flags >> 8) & 0x03]; + return o; + } + function write_BrtWbProp(data, o) { + if(!o) o = new_buf(72); + var flags = 0; + if(data) { + /* TODO: mirror parse_BrtWbProp fields */ + if(data.filterPrivacy) flags |= 0x08; + } + o.write_shift(4, flags); + o.write_shift(4, 0); + write_XLSBCodeName(data && data.CodeName || "ThisWorkbook", o); + return o.slice(0, o.l); + } + + function parse_BrtFRTArchID$(data, length) { + var o = {}; + data.read_shift(4); + o.ArchID = data.read_shift(4); + data.l += length - 8; + return o; + } + + /* [MS-XLSB] 2.4.687 BrtName */ + function parse_BrtName(data, length, opts) { + var end = data.l + length; + data.l += 4; //var flags = data.read_shift(4); + data.l += 1; //var chKey = data.read_shift(1); + var itab = data.read_shift(4); + var name = parse_XLNameWideString(data); + var formula = parse_XLSBNameParsedFormula(data, 0, opts); + var comment = parse_XLNullableWideString(data); + //if(0 /* fProc */) { + // unusedstring1: XLNullableWideString + // description: XLNullableWideString + // helpTopic: XLNullableWideString + // unusedstring2: XLNullableWideString + //} + data.l = end; + var out = ({Name:name, Ptg:formula}); + if(itab < 0xFFFFFFF) out.Sheet = itab; + if(comment) out.Comment = comment; + return out; + } + + /* [MS-XLSB] 2.1.7.61 Workbook */ + function parse_wb_bin(data, opts) { + var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" }; + var state = []; + var pass = false; + + if(!opts) opts = {}; + opts.biff = 12; + + var Names = []; + var supbooks = ([[]]); + supbooks.SheetNames = []; + supbooks.XTI = []; + + recordhopper(data, function hopper_wb(val, R_n, RT) { + switch(RT) { + case 0x009C: /* 'BrtBundleSh' */ + supbooks.SheetNames.push(val.name); + wb.Sheets.push(val); break; + + case 0x0099: /* 'BrtWbProp' */ + wb.WBProps = val; break; + + case 0x0027: /* 'BrtName' */ + if(val.Sheet != null) opts.SID = val.Sheet; + val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts); + delete opts.SID; + delete val.Ptg; + Names.push(val); + break; + case 0x040C: /* 'BrtNameExt' */ break; + + case 0x0165: /* 'BrtSupSelf' */ + case 0x0166: /* 'BrtSupSame' */ + case 0x0163: /* 'BrtSupBookSrc' */ + case 0x029B: /* 'BrtSupAddin' */ + if(!supbooks[0].length) supbooks[0] = [RT, val]; + else supbooks.push([RT, val]); + supbooks[supbooks.length - 1].XTI = []; + break; + case 0x016A: /* 'BrtExternSheet' */ + if(supbooks.length === 0) { supbooks[0] = []; supbooks[0].XTI = []; } + supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); + supbooks.XTI = supbooks.XTI.concat(val); + break; + case 0x0169: /* 'BrtPlaceholderName' */ + break; + + /* case 'BrtModelTimeGroupingCalcCol' */ + case 0x0C00: /* 'BrtUid' */ + case 0x0C01: /* 'BrtRevisionPtr' */ + case 0x0817: /* 'BrtAbsPath15' */ + case 0x0216: /* 'BrtBookProtection' */ + case 0x02A5: /* 'BrtBookProtectionIso' */ + case 0x009E: /* 'BrtBookView' */ + case 0x009D: /* 'BrtCalcProp' */ + case 0x0262: /* 'BrtCrashRecErr' */ + case 0x0802: /* 'BrtDecoupledPivotCacheID' */ + case 0x009B: /* 'BrtFileRecover' */ + case 0x0224: /* 'BrtFileSharing' */ + case 0x02A4: /* 'BrtFileSharingIso' */ + case 0x0080: /* 'BrtFileVersion' */ + case 0x0299: /* 'BrtFnGroup' */ + case 0x0850: /* 'BrtModelRelationship' */ + case 0x084D: /* 'BrtModelTable' */ + case 0x0225: /* 'BrtOleSize' */ + case 0x0805: /* 'BrtPivotTableRef' */ + case 0x0254: /* 'BrtSmartTagType' */ + case 0x081C: /* 'BrtTableSlicerCacheID' */ + case 0x081B: /* 'BrtTableSlicerCacheIDs' */ + case 0x0822: /* 'BrtTimelineCachePivotCacheID' */ + case 0x018D: /* 'BrtUserBookView' */ + case 0x009A: /* 'BrtWbFactoid' */ + case 0x045D: /* 'BrtWbProp14' */ + case 0x0229: /* 'BrtWebOpt' */ + case 0x082B: /* 'BrtWorkBookPr15' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + state.push(R_n); pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + state.pop(); pass = false; break; + case 0x0025: /* 'BrtACBegin' */ + state.push(R_n); pass = true; break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); pass = false; break; + + case 0x0010: /* 'BrtFRTArchID$' */ break; + + default: + if((R_n||"").indexOf("Begin") > 0){/* empty */} + else if((R_n||"").indexOf("End") > 0){/* empty */} + else if(!pass || (opts.WTF && state[state.length-1] != "BrtACBegin" && state[state.length-1] != "BrtFRTBegin")) throw new Error("Unexpected record " + RT + " " + R_n); + } + }, opts); + + parse_wb_defaults(wb); + + // $FlowIgnore + wb.Names = Names; + + (wb).supbooks = supbooks; + return wb; + } + + function write_BUNDLESHS(ba, wb) { + write_record(ba, "BrtBeginBundleShs"); + for(var idx = 0; idx != wb.SheetNames.length; ++idx) { + var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].Hidden || 0; + var d = { Hidden: viz, iTabID: idx+1, strRelID: 'rId' + (idx+1), name: wb.SheetNames[idx] }; + write_record(ba, "BrtBundleSh", write_BrtBundleSh(d)); + } + write_record(ba, "BrtEndBundleShs"); + } + + /* [MS-XLSB] 2.4.649 BrtFileVersion */ + function write_BrtFileVersion(data, o) { + if(!o) o = new_buf(127); + for(var i = 0; i != 4; ++i) o.write_shift(4, 0); + write_XLWideString("SheetJS", o); + write_XLWideString(XLSX.version, o); + write_XLWideString(XLSX.version, o); + write_XLWideString("7262", o); + o.length = o.l; + return o.length > o.l ? o.slice(0, o.l) : o; + } + + /* [MS-XLSB] 2.4.301 BrtBookView */ + function write_BrtBookView(idx, o) { + if(!o) o = new_buf(29); + o.write_shift(-4, 0); + o.write_shift(-4, 460); + o.write_shift(4, 28800); + o.write_shift(4, 17600); + o.write_shift(4, 500); + o.write_shift(4, idx); + o.write_shift(4, idx); + var flags = 0x78; + o.write_shift(1, flags); + return o.length > o.l ? o.slice(0, o.l) : o; + } + + function write_BOOKVIEWS(ba, wb) { + /* required if hidden tab appears before visible tab */ + if(!wb.Workbook || !wb.Workbook.Sheets) return; + var sheets = wb.Workbook.Sheets; + var i = 0, vistab = -1, hidden = -1; + for(; i < sheets.length; ++i) { + if(!sheets[i] || !sheets[i].Hidden && vistab == -1) vistab = i; + else if(sheets[i].Hidden == 1 && hidden == -1) hidden = i; + } + if(hidden > vistab) return; + write_record(ba, "BrtBeginBookViews"); + write_record(ba, "BrtBookView", write_BrtBookView(vistab)); + /* 1*(BrtBookView *FRT) */ + write_record(ba, "BrtEndBookViews"); + } + + /* [MS-XLSB] 2.4.305 BrtCalcProp */ + /*function write_BrtCalcProp(data, o) { + if(!o) o = new_buf(26); + o.write_shift(4,0); // force recalc + o.write_shift(4,1); + o.write_shift(4,0); + write_Xnum(0, o); + o.write_shift(-4, 1023); + o.write_shift(1, 0x33); + o.write_shift(1, 0x00); + return o; +}*/ + + /* [MS-XLSB] 2.4.646 BrtFileRecover */ + /*function write_BrtFileRecover(data, o) { + if(!o) o = new_buf(1); + o.write_shift(1,0); + return o; +}*/ + + /* [MS-XLSB] 2.1.7.61 Workbook */ + function write_wb_bin(wb, opts) { + var ba = buf_array(); + write_record(ba, "BrtBeginBook"); + write_record(ba, "BrtFileVersion", write_BrtFileVersion()); + /* [[BrtFileSharingIso] BrtFileSharing] */ + write_record(ba, "BrtWbProp", write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null)); + /* [ACABSPATH] */ + /* [[BrtBookProtectionIso] BrtBookProtection] */ + write_BOOKVIEWS(ba, wb, opts); + write_BUNDLESHS(ba, wb, opts); + /* [FNGROUP] */ + /* [EXTERNALS] */ + /* *BrtName */ + /* write_record(ba, "BrtCalcProp", write_BrtCalcProp()); */ + /* [BrtOleSize] */ + /* *(BrtUserBookView *FRT) */ + /* [PIVOTCACHEIDS] */ + /* [BrtWbFactoid] */ + /* [SMARTTAGTYPES] */ + /* [BrtWebOpt] */ + /* write_record(ba, "BrtFileRecover", write_BrtFileRecover()); */ + /* [WEBPUBITEMS] */ + /* [CRERRS] */ + /* FRTWORKBOOK */ + write_record(ba, "BrtEndBook"); + + return ba.end(); + } + function parse_wb(data, name, opts) { + if(name.slice(-4)===".bin") return parse_wb_bin((data), opts); + return parse_wb_xml((data), opts); + } + + function parse_ws(data, name, idx, opts, rels, wb, themes, styles) { + if(name.slice(-4)===".bin") return parse_ws_bin((data), opts, idx, rels, wb, themes, styles); + return parse_ws_xml((data), opts, idx, rels, wb, themes, styles); + } + + function parse_cs(data, name, idx, opts, rels, wb, themes, styles) { + if(name.slice(-4)===".bin") return parse_cs_bin((data), opts, idx, rels, wb, themes, styles); + return parse_cs_xml((data), opts, idx, rels, wb, themes, styles); + } + + function parse_ms(data, name, idx, opts, rels, wb, themes, styles) { + if(name.slice(-4)===".bin") return parse_ms_bin((data), opts, idx, rels, wb, themes, styles); + return parse_ms_xml((data), opts, idx, rels, wb, themes, styles); + } + + function parse_ds(data, name, idx, opts, rels, wb, themes, styles) { + if(name.slice(-4)===".bin") return parse_ds_bin((data), opts, idx, rels, wb, themes, styles); + return parse_ds_xml((data), opts, idx, rels, wb, themes, styles); + } + + function parse_sty(data, name, themes, opts) { + if(name.slice(-4)===".bin") return parse_sty_bin((data), themes, opts); + return parse_sty_xml((data), themes, opts); + } + + function parse_theme(data, name, opts) { + return parse_theme_xml(data, opts); + } + + function parse_sst(data, name, opts) { + if(name.slice(-4)===".bin") return parse_sst_bin((data), opts); + return parse_sst_xml((data), opts); + } + + function parse_cmnt(data, name, opts) { + if(name.slice(-4)===".bin") return parse_comments_bin((data), opts); + return parse_comments_xml((data), opts); + } + + function parse_cc(data, name, opts) { + if(name.slice(-4)===".bin") return parse_cc_bin((data), name, opts); + return parse_cc_xml((data), name, opts); + } + + function parse_xlink(data, name, opts) { + if(name.slice(-4)===".bin") return parse_xlink_bin((data), name, opts); + return parse_xlink_xml((data), name, opts); + } + + function write_wb(wb, name, opts) { + return (name.slice(-4)===".bin" ? write_wb_bin : write_wb_xml)(wb, opts); + } + + function write_ws(data, name, opts, wb, rels) { + return (name.slice(-4)===".bin" ? write_ws_bin : write_ws_xml)(data, opts, wb, rels); + } + +// eslint-disable-next-line no-unused-vars + function write_cs(data, name, opts, wb, rels) { + return (name.slice(-4)===".bin" ? write_cs_bin : write_cs_xml)(data, opts, wb, rels); + } + + function write_sty(data, name, opts) { + return (name.slice(-4)===".bin" ? write_sty_bin : write_sty_xml)(data, opts); + } + + function write_sst(data, name, opts) { + return (name.slice(-4)===".bin" ? write_sst_bin : write_sst_xml)(data, opts); + } + + function write_cmnt(data, name, opts) { + return (name.slice(-4)===".bin" ? write_comments_bin : write_comments_xml)(data, opts); + } + /* +function write_cc(data, name:string, opts) { + return (name.slice(-4)===".bin" ? write_cc_bin : write_cc_xml)(data, opts); +} +*/ + var attregexg2=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g; + var attregex2=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/; + var _chr = function(c) { return String.fromCharCode(c); }; + function xlml_parsexmltag(tag, skip_root) { + var words = tag.split(/\s+/); + var z = ([]); if(!skip_root) z[0] = words[0]; + if(words.length === 1) return z; + var m = tag.match(attregexg2), y, j, w, i; + if(m) for(i = 0; i != m.length; ++i) { + y = m[i].match(attregex2); + if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1); + else { + if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6); + else w = y[1].slice(j+1); + z[w] = y[2].slice(1,y[2].length-1); + } + } + return z; + } + function xlml_parsexmltagobj(tag) { + var words = tag.split(/\s+/); + var z = {}; + if(words.length === 1) return z; + var m = tag.match(attregexg2), y, j, w, i; + if(m) for(i = 0; i != m.length; ++i) { + y = m[i].match(attregex2); + if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1); + else { + if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6); + else w = y[1].slice(j+1); + z[w] = y[2].slice(1,y[2].length-1); + } + } + return z; + } + +// ---- + + function xlml_format(format, value) { + var fmt = XLMLFormatMap[format] || unescapexml(format); + if(fmt === "General") return SSF._general(value); + return SSF.format(fmt, value); + } + + function xlml_set_custprop(Custprops, key, cp, val) { + var oval = val; + switch((cp[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]) { + case "boolean": oval = parsexmlbool(val); break; + case "i2": case "int": oval = parseInt(val, 10); break; + case "r4": case "float": oval = parseFloat(val); break; + case "date": case "dateTime.tz": oval = parseDate(val); break; + case "i8": case "string": case "fixed": case "uuid": case "bin.base64": break; + default: throw new Error("bad custprop:" + cp[0]); + } + Custprops[unescapexml(key)] = oval; + } + + function safe_format_xlml(cell, nf, o) { + if(cell.t === 'z') return; + if(!o || o.cellText !== false) try { + if(cell.t === 'e') { cell.w = cell.w || BErr[cell.v]; } + else if(nf === "General") { + if(cell.t === 'n') { + if((cell.v|0) === cell.v) cell.w = SSF._general_int(cell.v); + else cell.w = SSF._general_num(cell.v); + } + else cell.w = SSF._general(cell.v); + } + else cell.w = xlml_format(nf||"General", cell.v); + } catch(e) { if(o.WTF) throw e; } + try { + var z = XLMLFormatMap[nf]||nf||"General"; + if(o.cellNF) cell.z = z; + if(o.cellDates && cell.t == 'n' && SSF.is_date(z)) { + var _d = SSF.parse_date_code(cell.v); if(_d) { cell.t = 'd'; cell.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); } + } + } catch(e) { if(o.WTF) throw e; } + } + + function process_style_xlml(styles, stag, opts) { + if(opts.cellStyles) { + if(stag.Interior) { + var I = stag.Interior; + if(I.Pattern) I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern; + } + } + styles[stag.ID] = stag; + } + + /* TODO: there must exist some form of OSP-blessed spec */ + function parse_xlml_data(xml, ss, data, cell, base, styles, csty, row, arrayf, o) { + var nf = "General", sid = cell.StyleID, S = {}; o = o || {}; + var interiors = []; + var i = 0; + if(sid === undefined && row) sid = row.StyleID; + if(sid === undefined && csty) sid = csty.StyleID; + while(styles[sid] !== undefined) { + if(styles[sid].nf) nf = styles[sid].nf; + if(styles[sid].Interior) interiors.push(styles[sid].Interior); + if(!styles[sid].Parent) break; + sid = styles[sid].Parent; + } + switch(data.Type) { + case 'Boolean': + cell.t = 'b'; + cell.v = parsexmlbool(xml); + break; + case 'String': + cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml)); + cell.v = xml.indexOf("<") > -1 ? unescapexml(ss) : cell.r; + break; + case 'DateTime': + if(xml.slice(-1) != "Z") xml += "Z"; + cell.v = (parseDate(xml) - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); + if(cell.v !== cell.v) cell.v = unescapexml(xml); + else if(cell.v<60) cell.v = cell.v -1; + if(!nf || nf == "General") nf = "yyyy-mm-dd"; + /* falls through */ + case 'Number': + if(cell.v === undefined) cell.v=+xml; + if(!cell.t) cell.t = 'n'; + break; + case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break; + default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break; + } + safe_format_xlml(cell, nf, o); + if(o.cellFormula !== false) { + if(cell.Formula) { + var fstr = unescapexml(cell.Formula); + /* strictly speaking, the leading = is required but some writers omit */ + if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1); + cell.f = rc_to_a1(fstr, base); + delete cell.Formula; + if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base); + else if(cell.ArrayRange) { + cell.F = rc_to_a1(cell.ArrayRange, base); + arrayf.push([safe_decode_range(cell.F), cell.F]); + } + } else { + for(i = 0; i < arrayf.length; ++i) + if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r) + if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c) + cell.F = arrayf[i][1]; + } + } + if(o.cellStyles) { + interiors.forEach(function(x) { + if(!S.patternType && x.patternType) S.patternType = x.patternType; + }); + cell.s = S; + } + if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID; + } + + function xlml_clean_comment(comment) { + comment.t = comment.v || ""; + comment.t = comment.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"); + comment.v = comment.w = comment.ixfe = undefined; + } + + function xlml_normalize(d) { + if(has_buf && Buffer.isBuffer(d)) return d.toString('utf8'); + if(typeof d === 'string') return d; + /* duktape */ + if(typeof Uint8Array !== 'undefined' && d instanceof Uint8Array) return utf8read(a2s(ab2a(d))); + throw new Error("Bad input format: expected Buffer or string"); + } + + /* TODO: Everything */ + /* UOS uses CJK in tags */ + var xlmlregex = /<(\/?)([^\s?>!\/:]*:|)([^\s?>:\/]+)[^>]*>/mg; +//var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/mg; + function parse_xlml_xml(d, _opts) { + var opts = _opts || {}; + make_ssf(SSF); + var str = debom(xlml_normalize(d)); + if(opts.type == 'binary' || opts.type == 'array' || opts.type == 'base64') { + if(typeof cptable !== 'undefined') str = cptable.utils.decode(65001, char_codes(str)); + else str = utf8read(str); + } + var opening = str.slice(0, 1024).toLowerCase(), ishtml = false; + if(opening.indexOf("= 0) ishtml = true; }); + if(ishtml) return HTML_.to_workbook(str, opts); + var Rn; + var state = [], tmp; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var sheets = {}, sheetnames = [], cursheet = (opts.dense ? [] : {}), sheetname = ""; + var table = {}, cell = ({}), row = {};// eslint-disable-line no-unused-vars + var dtag = xlml_parsexmltag(''), didx = 0; + var c = 0, r = 0; + var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + var styles = {}, stag = {}; + var ss = "", fidx = 0; + var merges = []; + var Props = {}, Custprops = {}, pidx = 0, cp = []; + var comments = [], comment = ({}); + var cstys = [], csty, seencol = false; + var arrayf = []; + var rowinfo = [], rowobj = {}, cc = 0, rr = 0; + var Workbook = ({ Sheets:[], WBProps:{date1904:false} }), wsprops = {}; + xlmlregex.lastIndex = 0; + str = str.replace(//mg,""); + while((Rn = xlmlregex.exec(str))) switch(Rn[3]) { + case 'Data': + if(state[state.length-1][1]) break; + if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]=="Comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts); + else { ss = ""; dtag = xlml_parsexmltag(Rn[0]); didx = Rn.index + Rn[0].length; } + break; + case 'Cell': + if(Rn[1]==='/'){ + if(comments.length > 0) cell.c = comments; + if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== undefined) { + if(opts.dense) { + if(!cursheet[r]) cursheet[r] = []; + cursheet[r][c] = cell; + } else cursheet[encode_col(c) + encode_row(r)] = cell; + } + if(cell.HRef) { + cell.l = ({Target:cell.HRef}); + if(cell.HRefScreenTip) cell.l.Tooltip = cell.HRefScreenTip; + delete cell.HRef; delete cell.HRefScreenTip; + } + if(cell.MergeAcross || cell.MergeDown) { + cc = c + (parseInt(cell.MergeAcross,10)|0); + rr = r + (parseInt(cell.MergeDown,10)|0); + merges.push({s:{c:c,r:r},e:{c:cc,r:rr}}); + } + if(!opts.sheetStubs) { if(cell.MergeAcross) c = cc + 1; else ++c; } + else if(cell.MergeAcross || cell.MergeDown) { + for(var cma = c; cma <= cc; ++cma) { + for(var cmd = r; cmd <= rr; ++cmd) { + if(cma > c || cmd > r) { + if(opts.dense) { + if(!cursheet[cmd]) cursheet[cmd] = []; + cursheet[cmd][cma] = {t:'z'}; + } else cursheet[encode_col(cma) + encode_row(cmd)] = {t:'z'}; + } + } + } + c = cc + 1; + } + else ++c; + } else { + cell = xlml_parsexmltagobj(Rn[0]); + if(cell.Index) c = +cell.Index - 1; + if(c < refguess.s.c) refguess.s.c = c; + if(c > refguess.e.c) refguess.e.c = c; + if(Rn[0].slice(-2) === "/>") ++c; + comments = []; + } + break; + case 'Row': + if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") { + if(r < refguess.s.r) refguess.s.r = r; + if(r > refguess.e.r) refguess.e.r = r; + if(Rn[0].slice(-2) === "/>") { + row = xlml_parsexmltag(Rn[0]); + if(row.Index) r = +row.Index - 1; + } + c = 0; ++r; + } else { + row = xlml_parsexmltag(Rn[0]); + if(row.Index) r = +row.Index - 1; + rowobj = {}; + if(row.AutoFitHeight == "0" || row.Height) { + rowobj.hpx = parseInt(row.Height, 10); rowobj.hpt = px2pt(rowobj.hpx); + rowinfo[r] = rowobj; + } + if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; } + } + break; + case 'Worksheet': /* TODO: read range from FullRows/FullColumns */ + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); + sheetnames.push(sheetname); + if(refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) { + cursheet["!ref"] = encode_range(refguess); + if(opts.sheetRows && opts.sheetRows <= refguess.e.r) { + cursheet["!fullref"] = cursheet["!ref"]; + refguess.e.r = opts.sheetRows - 1; + cursheet["!ref"] = encode_range(refguess); + } + } + if(merges.length) cursheet["!merges"] = merges; + if(cstys.length > 0) cursheet["!cols"] = cstys; + if(rowinfo.length > 0) cursheet["!rows"] = rowinfo; + sheets[sheetname] = cursheet; + } else { + refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + r = c = 0; + state.push([Rn[3], false]); + tmp = xlml_parsexmltag(Rn[0]); + sheetname = unescapexml(tmp.Name); + cursheet = (opts.dense ? [] : {}); + merges = []; + arrayf = []; + rowinfo = []; + wsprops = {name:sheetname, Hidden:0}; + Workbook.Sheets.push(wsprops); + } + break; + case 'Table': + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].slice(-2) == "/>") break; + else { + table = xlml_parsexmltag(Rn[0]); + state.push([Rn[3], false]); + cstys = []; seencol = false; + } + break; + + case 'Style': + if(Rn[1]==='/') process_style_xlml(styles, stag, opts); + else stag = xlml_parsexmltag(Rn[0]); + break; + + case 'NumberFormat': + stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General"); + if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf]; + for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == stag.nf) break; + if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == null) { SSF.load(stag.nf, ssfidx); break; } + break; + + case 'Column': + if(state[state.length-1][0] !== 'Table') break; + csty = xlml_parsexmltag(Rn[0]); + if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; } + if(csty.Width) csty.wpx = parseInt(csty.Width, 10); + if(!seencol && csty.wpx > 10) { + seencol = true; MDW = DEF_MDW; //find_mdw_wpx(csty.wpx); + for(var _col = 0; _col < cstys.length; ++_col) if(cstys[_col]) process_col(cstys[_col]); + } + if(seencol) process_col(csty); + cstys[(csty.Index-1||cstys.length)] = csty; + for(var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty); + break; + + case 'NamedRange': + if(!Workbook.Names) Workbook.Names = []; + var _NamedRange = parsexmltag(Rn[0]); + var _DefinedName = ({ + Name: _NamedRange.Name, + Ref: rc_to_a1(_NamedRange.RefersTo.slice(1), {r:0, c:0}) + }); + if(Workbook.Sheets.length>0) _DefinedName.Sheet=Workbook.Sheets.length-1; + Workbook.Names.push(_DefinedName); + break; + + case 'NamedCell': break; + case 'B': break; + case 'I': break; + case 'U': break; + case 'S': break; + case 'Sub': break; + case 'Sup': break; + case 'Span': break; + case 'Border': break; + case 'Alignment': break; + case 'Borders': break; + case 'Font': + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index); + else fidx = Rn.index + Rn[0].length; + break; + case 'Interior': + if(!opts.cellStyles) break; + stag.Interior = xlml_parsexmltag(Rn[0]); + break; + case 'Protection': break; + + case 'Author': + case 'Title': + case 'Description': + case 'Created': + case 'Keywords': + case 'Subject': + case 'Category': + case 'Company': + case 'LastAuthor': + case 'LastSaved': + case 'LastPrinted': + case 'Version': + case 'Revision': + case 'TotalTime': + case 'HyperlinkBase': + case 'Manager': + case 'ContentStatus': + case 'Identifier': + case 'Language': + case 'AppName': + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") xlml_set_prop(Props, Rn[3], str.slice(pidx, Rn.index)); + else pidx = Rn.index + Rn[0].length; + break; + case 'Paragraphs': break; + + case 'Styles': + case 'Workbook': + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else state.push([Rn[3], false]); + break; + + case 'Comment': + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); + xlml_clean_comment(comment); + comments.push(comment); + } else { + state.push([Rn[3], false]); + tmp = xlml_parsexmltag(Rn[0]); + comment = ({a:tmp.Author}); + } + break; + + case 'AutoFilter': + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + var AutoFilter = xlml_parsexmltag(Rn[0]); + cursheet['!autofilter'] = { ref:rc_to_a1(AutoFilter.Range).replace(/\$/g,"") }; + state.push([Rn[3], true]); + } + break; + + case 'Name': break; + + case 'ComponentOptions': + case 'DocumentProperties': + case 'CustomDocumentProperties': + case 'OfficeDocumentSettings': + case 'PivotTable': + case 'PivotCache': + case 'Names': + case 'MapInfo': + case 'PageBreaks': + case 'QueryTable': + case 'DataValidation': + case 'Sorting': + case 'Schema': + case 'data': + case 'ConditionalFormatting': + case 'SmartTagType': + case 'SmartTags': + case 'ExcelWorkbook': + case 'WorkbookOptions': + case 'WorksheetOptions': + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); + break; + + default: + /* FODS file root is */ + if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts); + /* UOS file root is */ + if(state.length == 0 && Rn[3] == "UOF") return parse_fods(str, opts); + + var seen = true; + switch(state[state.length-1][0]) { + /* OfficeDocumentSettings */ + case 'OfficeDocumentSettings': switch(Rn[3]) { + case 'AllowPNG': break; + case 'RemovePersonalInformation': break; + case 'DownloadComponents': break; + case 'LocationOfComponents': break; + case 'Colors': break; + case 'Color': break; + case 'Index': break; + case 'RGB': break; + case 'PixelsPerInch': break; // TODO: set PPI + case 'TargetScreenSize': break; + case 'ReadOnlyRecommended': break; + default: seen = false; + } break; + + /* ComponentOptions */ + case 'ComponentOptions': switch(Rn[3]) { + case 'Toolbar': break; + case 'HideOfficeLogo': break; + case 'SpreadsheetAutoFit': break; + case 'Label': break; + case 'Caption': break; + case 'MaxHeight': break; + case 'MaxWidth': break; + case 'NextSheetNumber': break; + default: seen = false; + } break; + + /* ExcelWorkbook */ + case 'ExcelWorkbook': switch(Rn[3]) { + case 'Date1904': + Workbook.WBProps.date1904 = true; + break; + case 'WindowHeight': break; + case 'WindowWidth': break; + case 'WindowTopX': break; + case 'WindowTopY': break; + case 'TabRatio': break; + case 'ProtectStructure': break; + case 'ProtectWindows': break; + case 'ActiveSheet': break; + case 'DisplayInkNotes': break; + case 'FirstVisibleSheet': break; + case 'SupBook': break; + case 'SheetName': break; + case 'SheetIndex': break; + case 'SheetIndexFirst': break; + case 'SheetIndexLast': break; + case 'Dll': break; + case 'AcceptLabelsInFormulas': break; + case 'DoNotSaveLinkValues': break; + case 'Iteration': break; + case 'MaxIterations': break; + case 'MaxChange': break; + case 'Path': break; + case 'Xct': break; + case 'Count': break; + case 'SelectedSheets': break; + case 'Calculation': break; + case 'Uncalced': break; + case 'StartupPrompt': break; + case 'Crn': break; + case 'ExternName': break; + case 'Formula': break; + case 'ColFirst': break; + case 'ColLast': break; + case 'WantAdvise': break; + case 'Boolean': break; + case 'Error': break; + case 'Text': break; + case 'OLE': break; + case 'NoAutoRecover': break; + case 'PublishObjects': break; + case 'DoNotCalculateBeforeSave': break; + case 'Number': break; + case 'RefModeR1C1': break; + case 'EmbedSaveSmartTags': break; + default: seen = false; + } break; + + /* WorkbookOptions */ + case 'WorkbookOptions': switch(Rn[3]) { + case 'OWCVersion': break; + case 'Height': break; + case 'Width': break; + default: seen = false; + } break; + + /* WorksheetOptions */ + case 'WorksheetOptions': switch(Rn[3]) { + case 'Visible': + if(Rn[0].slice(-2) === "/>"){/* empty */} + else if(Rn[1]==="/") switch(str.slice(pidx, Rn.index)) { + case "SheetHidden": wsprops.Hidden = 1; break; + case "SheetVeryHidden": wsprops.Hidden = 2; break; + } + else pidx = Rn.index + Rn[0].length; + break; + case 'Header': + if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml'); + cursheet['!margins'].header = parsexmltag(Rn[0]).Margin; + break; + case 'Footer': + if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml'); + cursheet['!margins'].footer = parsexmltag(Rn[0]).Margin; + break; + case 'PageMargins': + var pagemargins = parsexmltag(Rn[0]); + if(!cursheet['!margins']) default_margins(cursheet['!margins']={},'xlml'); + if(pagemargins.Top) cursheet['!margins'].top = pagemargins.Top; + if(pagemargins.Left) cursheet['!margins'].left = pagemargins.Left; + if(pagemargins.Right) cursheet['!margins'].right = pagemargins.Right; + if(pagemargins.Bottom) cursheet['!margins'].bottom = pagemargins.Bottom; + break; + case 'DisplayRightToLeft': + if(!Workbook.Views) Workbook.Views = []; + if(!Workbook.Views[0]) Workbook.Views[0] = {}; + Workbook.Views[0].RTL = true; + break; + + case 'Unsynced': break; + case 'Print': break; + case 'Panes': break; + case 'Scale': break; + case 'Pane': break; + case 'Number': break; + case 'Layout': break; + case 'PageSetup': break; + case 'Selected': break; + case 'ProtectObjects': break; + case 'EnableSelection': break; + case 'ProtectScenarios': break; + case 'ValidPrinterInfo': break; + case 'HorizontalResolution': break; + case 'VerticalResolution': break; + case 'NumberofCopies': break; + case 'ActiveRow': break; + case 'ActiveCol': break; + case 'ActivePane': break; + case 'TopRowVisible': break; + case 'TopRowBottomPane': break; + case 'LeftColumnVisible': break; + case 'LeftColumnRightPane': break; + case 'FitToPage': break; + case 'RangeSelection': break; + case 'PaperSizeIndex': break; + case 'PageLayoutZoom': break; + case 'PageBreakZoom': break; + case 'FilterOn': break; + case 'DoNotDisplayGridlines': break; + case 'SplitHorizontal': break; + case 'SplitVertical': break; + case 'FreezePanes': break; + case 'FrozenNoSplit': break; + case 'FitWidth': break; + case 'FitHeight': break; + case 'CommentsLayout': break; + case 'Zoom': break; + case 'LeftToRight': break; + case 'Gridlines': break; + case 'AllowSort': break; + case 'AllowFilter': break; + case 'AllowInsertRows': break; + case 'AllowDeleteRows': break; + case 'AllowInsertCols': break; + case 'AllowDeleteCols': break; + case 'AllowInsertHyperlinks': break; + case 'AllowFormatCells': break; + case 'AllowSizeCols': break; + case 'AllowSizeRows': break; + case 'NoSummaryRowsBelowDetail': break; + case 'TabColorIndex': break; + case 'DoNotDisplayHeadings': break; + case 'ShowPageLayoutZoom': break; + case 'NoSummaryColumnsRightDetail': break; + case 'BlackAndWhite': break; + case 'DoNotDisplayZeros': break; + case 'DisplayPageBreak': break; + case 'RowColHeadings': break; + case 'DoNotDisplayOutline': break; + case 'NoOrientation': break; + case 'AllowUsePivotTables': break; + case 'ZeroHeight': break; + case 'ViewableRange': break; + case 'Selection': break; + case 'ProtectContents': break; + default: seen = false; + } break; + + /* PivotTable */ + case 'PivotTable': case 'PivotCache': switch(Rn[3]) { + case 'ImmediateItemsOnDrop': break; + case 'ShowPageMultipleItemLabel': break; + case 'CompactRowIndent': break; + case 'Location': break; + case 'PivotField': break; + case 'Orientation': break; + case 'LayoutForm': break; + case 'LayoutSubtotalLocation': break; + case 'LayoutCompactRow': break; + case 'Position': break; + case 'PivotItem': break; + case 'DataType': break; + case 'DataField': break; + case 'SourceName': break; + case 'ParentField': break; + case 'PTLineItems': break; + case 'PTLineItem': break; + case 'CountOfSameItems': break; + case 'Item': break; + case 'ItemType': break; + case 'PTSource': break; + case 'CacheIndex': break; + case 'ConsolidationReference': break; + case 'FileName': break; + case 'Reference': break; + case 'NoColumnGrand': break; + case 'NoRowGrand': break; + case 'BlankLineAfterItems': break; + case 'Hidden': break; + case 'Subtotal': break; + case 'BaseField': break; + case 'MapChildItems': break; + case 'Function': break; + case 'RefreshOnFileOpen': break; + case 'PrintSetTitles': break; + case 'MergeLabels': break; + case 'DefaultVersion': break; + case 'RefreshName': break; + case 'RefreshDate': break; + case 'RefreshDateCopy': break; + case 'VersionLastRefresh': break; + case 'VersionLastUpdate': break; + case 'VersionUpdateableMin': break; + case 'VersionRefreshableMin': break; + case 'Calculation': break; + default: seen = false; + } break; + + /* PageBreaks */ + case 'PageBreaks': switch(Rn[3]) { + case 'ColBreaks': break; + case 'ColBreak': break; + case 'RowBreaks': break; + case 'RowBreak': break; + case 'ColStart': break; + case 'ColEnd': break; + case 'RowEnd': break; + default: seen = false; + } break; + + /* AutoFilter */ + case 'AutoFilter': switch(Rn[3]) { + case 'AutoFilterColumn': break; + case 'AutoFilterCondition': break; + case 'AutoFilterAnd': break; + case 'AutoFilterOr': break; + default: seen = false; + } break; + + /* QueryTable */ + case 'QueryTable': switch(Rn[3]) { + case 'Id': break; + case 'AutoFormatFont': break; + case 'AutoFormatPattern': break; + case 'QuerySource': break; + case 'QueryType': break; + case 'EnableRedirections': break; + case 'RefreshedInXl9': break; + case 'URLString': break; + case 'HTMLTables': break; + case 'Connection': break; + case 'CommandText': break; + case 'RefreshInfo': break; + case 'NoTitles': break; + case 'NextId': break; + case 'ColumnInfo': break; + case 'OverwriteCells': break; + case 'DoNotPromptForFile': break; + case 'TextWizardSettings': break; + case 'Source': break; + case 'Number': break; + case 'Decimal': break; + case 'ThousandSeparator': break; + case 'TrailingMinusNumbers': break; + case 'FormatSettings': break; + case 'FieldType': break; + case 'Delimiters': break; + case 'Tab': break; + case 'Comma': break; + case 'AutoFormatName': break; + case 'VersionLastEdit': break; + case 'VersionLastRefresh': break; + default: seen = false; + } break; + + case 'Sorting': + case 'ConditionalFormatting': + case 'DataValidation': + switch(Rn[3]) { + case 'Range': break; + case 'Type': break; + case 'Min': break; + case 'Max': break; + case 'Sort': break; + case 'Descending': break; + case 'Order': break; + case 'CaseSensitive': break; + case 'Value': break; + case 'ErrorStyle': break; + case 'ErrorMessage': break; + case 'ErrorTitle': break; + case 'CellRangeList': break; + case 'InputMessage': break; + case 'InputTitle': break; + case 'ComboHide': break; + case 'InputHide': break; + case 'Condition': break; + case 'Qualifier': break; + case 'UseBlank': break; + case 'Value1': break; + case 'Value2': break; + case 'Format': break; + default: seen = false; + } break; + + /* MapInfo (schema) */ + case 'MapInfo': case 'Schema': case 'data': switch(Rn[3]) { + case 'Map': break; + case 'Entry': break; + case 'Range': break; + case 'XPath': break; + case 'Field': break; + case 'XSDType': break; + case 'FilterOn': break; + case 'Aggregate': break; + case 'ElementType': break; + case 'AttributeType': break; + /* These are from xsd (XML Schema Definition) */ + case 'schema': + case 'element': + case 'complexType': + case 'datatype': + case 'all': + case 'attribute': + case 'extends': break; + + case 'row': break; + default: seen = false; + } break; + + /* SmartTags (can be anything) */ + case 'SmartTags': break; + + default: seen = false; break; + } + if(seen) break; + /* CustomDocumentProperties */ + if(!state[state.length-1][1]) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); + if(state[state.length-1][0]==='CustomDocumentProperties') { + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") xlml_set_custprop(Custprops, Rn[3], cp, str.slice(pidx, Rn.index)); + else { cp = Rn; pidx = Rn.index + Rn[0].length; } + break; + } + if(opts.WTF) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); + } + var out = ({}); + if(!opts.bookSheets && !opts.bookProps) out.Sheets = sheets; + out.SheetNames = sheetnames; + out.Workbook = Workbook; + out.SSF = SSF.get_table(); + out.Props = Props; + out.Custprops = Custprops; + return out; + } + + function parse_xlml(data, opts) { + fix_read_opts(opts=opts||{}); + switch(opts.type||"base64") { + case "base64": return parse_xlml_xml(Base64.decode(data), opts); + case "binary": case "buffer": case "file": return parse_xlml_xml(data, opts); + case "array": return parse_xlml_xml(a2s(data), opts); + } + } + + /* TODO */ + function write_props_xlml(wb, opts) { + var o = []; + /* DocumentProperties */ + if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts)); + /* CustomDocumentProperties */ + if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts)); + return o.join(""); + } + /* TODO */ + function write_wb_xlml() { + /* OfficeDocumentSettings */ + /* ExcelWorkbook */ + return ""; + } + /* TODO */ + function write_sty_xlml(wb, opts) { + /* Styles */ + var styles = ['']; + opts.cellXfs.forEach(function(xf, id) { + var payload = []; + payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])})); + styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)})); + }); + return writextag("Styles", styles.join("")); + } + function write_name_xlml(n) { return writextag("NamedRange", null, {"ss:Name": n.Name, "ss:RefersTo":"=" + a1_to_rc(n.Ref, {r:0,c:0})}); } + function write_names_xlml(wb) { + if(!((wb||{}).Workbook||{}).Names) return ""; + var names = wb.Workbook.Names; + var out = []; + for(var i = 0; i < names.length; ++i) { + var n = names[i]; + if(n.Sheet != null) continue; + if(n.Name.match(/^_xlfn\./)) continue; + out.push(write_name_xlml(n)); + } + return writextag("Names", out.join("")); + } + function write_ws_xlml_names(ws, opts, idx, wb) { + if(!ws) return ""; + if(!((wb||{}).Workbook||{}).Names) return ""; + var names = wb.Workbook.Names; + var out = []; + for(var i = 0; i < names.length; ++i) { + var n = names[i]; + if(n.Sheet != idx) continue; + /*switch(n.Name) { + case "_": continue; + }*/ + if(n.Name.match(/^_xlfn\./)) continue; + out.push(write_name_xlml(n)); + } + return out.join(""); + } + /* WorksheetOptions */ + function write_ws_xlml_wsopts(ws, opts, idx, wb) { + if(!ws) return ""; + var o = []; + /* NOTE: spec technically allows any order, but stick with implied order */ + + /* FitToPage */ + /* DoNotDisplayColHeaders */ + /* DoNotDisplayRowHeaders */ + /* ViewableRange */ + /* Selection */ + /* GridlineColor */ + /* Name */ + /* ExcelWorksheetType */ + /* IntlMacro */ + /* Unsynced */ + /* Selected */ + /* CodeName */ + + if(ws['!margins']) { + o.push(""); + if(ws['!margins'].header) o.push(writextag("Header", null, {'x:Margin':ws['!margins'].header})); + if(ws['!margins'].footer) o.push(writextag("Footer", null, {'x:Margin':ws['!margins'].footer})); + o.push(writextag("PageMargins", null, { + 'x:Bottom': ws['!margins'].bottom || "0.75", + 'x:Left': ws['!margins'].left || "0.7", + 'x:Right': ws['!margins'].right || "0.7", + 'x:Top': ws['!margins'].top || "0.75" + })); + o.push(""); + } + + /* PageSetup */ + /* DisplayPageBreak */ + /* TransitionExpressionEvaluation */ + /* TransitionFormulaEntry */ + /* Print */ + /* Zoom */ + /* PageLayoutZoom */ + /* PageBreakZoom */ + /* ShowPageBreakZoom */ + /* DefaultRowHeight */ + /* DefaultColumnWidth */ + /* StandardWidth */ + + if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) { + /* Visible */ + if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == 1 ? "SheetHidden" : "SheetVeryHidden"), {})); + else { + /* Selected */ + for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break; + if(i == idx) o.push(""); + } + } + + /* LeftColumnVisible */ + + if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push(""); + + /* GridlineColorIndex */ + /* DisplayFormulas */ + /* DoNotDisplayGridlines */ + /* DoNotDisplayHeadings */ + /* DoNotDisplayOutline */ + /* ApplyAutomaticOutlineStyles */ + /* NoSummaryRowsBelowDetail */ + /* NoSummaryColumnsRightDetail */ + /* DoNotDisplayZeros */ + /* ActiveRow */ + /* ActiveColumn */ + /* FilterOn */ + /* RangeSelection */ + /* TopRowVisible */ + /* TopRowBottomPane */ + /* LeftColumnRightPane */ + /* ActivePane */ + /* SplitHorizontal */ + /* SplitVertical */ + /* FreezePanes */ + /* FrozenNoSplit */ + /* TabColorIndex */ + /* Panes */ + + /* NOTE: Password not supported in XLML Format */ + if(ws['!protect']) { + o.push(writetag("ProtectContents", "True")); + if(ws['!protect'].objects) o.push(writetag("ProtectObjects", "True")); + if(ws['!protect'].scenarios) o.push(writetag("ProtectScenarios", "True")); + if(ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) o.push(writetag("EnableSelection", "NoSelection")); + else if(ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) o.push(writetag("EnableSelection", "UnlockedCells")); + [ + [ "formatCells", "AllowFormatCells" ], + [ "formatColumns", "AllowSizeCols" ], + [ "formatRows", "AllowSizeRows" ], + [ "insertColumns", "AllowInsertCols" ], + [ "insertRows", "AllowInsertRows" ], + [ "insertHyperlinks", "AllowInsertHyperlinks" ], + [ "deleteColumns", "AllowDeleteCols" ], + [ "deleteRows", "AllowDeleteRows" ], + [ "sort", "AllowSort" ], + [ "autoFilter", "AllowFilter" ], + [ "pivotTables", "AllowUsePivotTables" ] + ].forEach(function(x) { if(ws['!protect'][x[0]]) o.push("<"+x[1]+"/>"); }); + } + + if(o.length == 0) return ""; + return writextag("WorksheetOptions", o.join(""), {xmlns:XLMLNS.x}); + } + function write_ws_xlml_comment(comments) { + return comments.map(function(c) { + // TODO: formatted text + var t = xlml_unfixstr(c.t||""); + var d =writextag("ss:Data", t, {"xmlns":"http://www.w3.org/TR/REC-html40"}); + return writextag("Comment", d, {"ss:Author":c.a}); + }).join(""); + } + function write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr){ + if(!cell || (cell.v == undefined && cell.f == undefined)) return ""; + + var attr = {}; + if(cell.f) attr["ss:Formula"] = "=" + escapexml(a1_to_rc(cell.f, addr)); + if(cell.F && cell.F.slice(0, ref.length) == ref) { + var end = decode_cell(cell.F.slice(ref.length + 1)); + attr["ss:ArrayRange"] = "RC:R" + (end.r == addr.r ? "" : "[" + (end.r - addr.r) + "]") + "C" + (end.c == addr.c ? "" : "[" + (end.c - addr.c) + "]"); + } + + if(cell.l && cell.l.Target) { + attr["ss:HRef"] = escapexml(cell.l.Target); + if(cell.l.Tooltip) attr["x:HRefScreenTip"] = escapexml(cell.l.Tooltip); + } + + if(ws['!merges']) { + var marr = ws['!merges']; + for(var mi = 0; mi != marr.length; ++mi) { + if(marr[mi].s.c != addr.c || marr[mi].s.r != addr.r) continue; + if(marr[mi].e.c > marr[mi].s.c) attr['ss:MergeAcross'] = marr[mi].e.c - marr[mi].s.c; + if(marr[mi].e.r > marr[mi].s.r) attr['ss:MergeDown'] = marr[mi].e.r - marr[mi].s.r; + } + } + + var t = "", p = ""; + switch(cell.t) { + case 'z': return ""; + case 'n': t = 'Number'; p = String(cell.v); break; + case 'b': t = 'Boolean'; p = (cell.v ? "1" : "0"); break; + case 'e': t = 'Error'; p = BErr[cell.v]; break; + case 'd': t = 'DateTime'; p = new Date(cell.v).toISOString(); if(cell.z == null) cell.z = cell.z || SSF._table[14]; break; + case 's': t = 'String'; p = escapexlml(cell.v||""); break; + } + /* TODO: cell style */ + var os = get_cell_style(opts.cellXfs, cell, opts); + attr["ss:StyleID"] = "s" + (21+os); + attr["ss:Index"] = addr.c + 1; + var _v = (cell.v != null ? p : ""); + var m = '' + _v + ''; + + if((cell.c||[]).length > 0) m += write_ws_xlml_comment(cell.c); + + return writextag("Cell", m, attr); + } + function write_ws_xlml_row(R, row) { + var o = ''; + } + /* TODO */ + function write_ws_xlml_table(ws, opts, idx, wb) { + if(!ws['!ref']) return ""; + var range = safe_decode_range(ws['!ref']); + var marr = ws['!merges'] || [], mi = 0; + var o = []; + if(ws['!cols']) ws['!cols'].forEach(function(n, i) { + process_col(n); + var w = !!n.width; + var p = col_obj_w(i, n); + var k = {"ss:Index":i+1}; + if(w) k['ss:Width'] = width2px(p.width); + if(n.hidden) k['ss:Hidden']="1"; + o.push(writextag("Column",null,k)); + }); + var dense = Array.isArray(ws); + for(var R = range.s.r; R <= range.e.r; ++R) { + var row = [write_ws_xlml_row(R, (ws['!rows']||[])[R])]; + for(var C = range.s.c; C <= range.e.c; ++C) { + var skip = false; + for(mi = 0; mi != marr.length; ++mi) { + if(marr[mi].s.c > C) continue; + if(marr[mi].s.r > R) continue; + if(marr[mi].e.c < C) continue; + if(marr[mi].e.r < R) continue; + if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; + break; + } + if(skip) continue; + var addr = {r:R,c:C}; + var ref = encode_cell(addr), cell = dense ? (ws[R]||[])[C] : ws[ref]; + row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr)); + } + row.push(""); + if(row.length > 2) o.push(row.join("")); + } + return o.join(""); + } + function write_ws_xlml(idx, opts, wb) { + var o = []; + var s = wb.SheetNames[idx]; + var ws = wb.Sheets[s]; + + var t = ws ? write_ws_xlml_names(ws, opts, idx, wb) : ""; + if(t.length > 0) o.push("" + t + ""); + + /* Table */ + t = ws ? write_ws_xlml_table(ws, opts, idx, wb) : ""; + if(t.length > 0) o.push("" + t + "
          "); + + /* WorksheetOptions */ + o.push(write_ws_xlml_wsopts(ws, opts, idx, wb)); + + return o.join(""); + } + function write_xlml(wb, opts) { + if(!opts) opts = {}; + if(!wb.SSF) wb.SSF = SSF.get_table(); + if(wb.SSF) { + make_ssf(SSF); SSF.load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); + } + var d = []; + d.push(write_props_xlml(wb, opts)); + d.push(write_wb_xlml(wb, opts)); + d.push(""); + d.push(""); + for(var i = 0; i < wb.SheetNames.length; ++i) + d.push(writextag("Worksheet", write_ws_xlml(i, opts, wb), {"ss:Name":escapexml(wb.SheetNames[i])})); + d[2] = write_sty_xlml(wb, opts); + d[3] = write_names_xlml(wb, opts); + return XML_HEADER + writextag("Workbook", d.join(""), { + 'xmlns': XLMLNS.ss, + 'xmlns:o': XLMLNS.o, + 'xmlns:x': XLMLNS.x, + 'xmlns:ss': XLMLNS.ss, + 'xmlns:dt': XLMLNS.dt, + 'xmlns:html': XLMLNS.html + }); + } + /* [MS-OLEDS] 2.3.8 CompObjStream */ + function parse_compobj(obj) { + var v = {}; + var o = obj.content; + /* [MS-OLEDS] 2.3.7 CompObjHeader -- All fields MUST be ignored */ + o.l = 28; + + v.AnsiUserType = o.read_shift(0, "lpstr-ansi"); + v.AnsiClipboardFormat = parse_ClipboardFormatOrAnsiString(o); + + if(o.length - o.l <= 4) return v; + + var m = o.read_shift(4); + if(m == 0 || m > 40) return v; + o.l-=4; v.Reserved1 = o.read_shift(0, "lpstr-ansi"); + + if(o.length - o.l <= 4) return v; + m = o.read_shift(4); + if(m !== 0x71b239f4) return v; + v.UnicodeClipboardFormat = parse_ClipboardFormatOrUnicodeString(o); + + m = o.read_shift(4); + if(m == 0 || m > 40) return v; + o.l-=4; v.Reserved2 = o.read_shift(0, "lpwstr"); + } + + /* + Continue logic for: + - 2.4.58 Continue + - 2.4.59 ContinueBigName + - 2.4.60 ContinueFrt + - 2.4.61 ContinueFrt11 + - 2.4.62 ContinueFrt12 +*/ + function slurp(R, blob, length, opts) { + var l = length; + var bufs = []; + var d = blob.slice(blob.l,blob.l+l); + if(opts && opts.enc && opts.enc.insitu) switch(R.n) { + case 'BOF': case 'FilePass': case 'FileLock': case 'InterfaceHdr': case 'RRDInfo': case 'RRDHead': case 'UsrExcl': break; + default: + if(d.length === 0) break; + opts.enc.insitu(d); + } + bufs.push(d); + blob.l += l; + var next = (XLSRecordEnum[__readUInt16LE(blob,blob.l)]); + var start = 0; + while(next != null && next.n.slice(0,8) === 'Continue') { + l = __readUInt16LE(blob,blob.l+2); + start = blob.l + 4; + if(next.n == 'ContinueFrt') start += 4; + else if(next.n.slice(0,11) == 'ContinueFrt') start += 12; + bufs.push(blob.slice(start,blob.l+4+l)); + blob.l += 4+l; + next = (XLSRecordEnum[__readUInt16LE(blob, blob.l)]); + } + var b = (bconcat(bufs)); + prep_blob(b, 0); + var ll = 0; b.lens = []; + for(var j = 0; j < bufs.length; ++j) { b.lens.push(ll); ll += bufs[j].length; } + return R.f(b, b.length, opts); + } + + function safe_format_xf(p, opts, date1904) { + if(p.t === 'z') return; + if(!p.XF) return; + var fmtid = 0; + try { + fmtid = p.z || p.XF.numFmtId || 0; + if(opts.cellNF) p.z = SSF._table[fmtid]; + } catch(e) { if(opts.WTF) throw e; } + if(!opts || opts.cellText !== false) try { + if(p.t === 'e') { p.w = p.w || BErr[p.v]; } + else if(fmtid === 0 || fmtid == "General") { + if(p.t === 'n') { + if((p.v|0) === p.v) p.w = SSF._general_int(p.v); + else p.w = SSF._general_num(p.v); + } + else p.w = SSF._general(p.v); + } + else p.w = SSF.format(fmtid,p.v, {date1904:!!date1904}); + } catch(e) { if(opts.WTF) throw e; } + if(opts.cellDates && fmtid && p.t == 'n' && SSF.is_date(SSF._table[fmtid] || String(fmtid))) { + var _d = SSF.parse_date_code(p.v); if(_d) { p.t = 'd'; p.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); } + } + } + + function make_cell(val, ixfe, t) { + return ({v:val, ixfe:ixfe, t:t}); + } + +// 2.3.2 + function parse_workbook(blob, options) { + var wb = ({opts:{}}); + var Sheets = {}; + if(DENSE != null && options.dense == null) options.dense = DENSE; + var out = ((options.dense ? [] : {})); + var Directory = {}; + var range = ({}); + var last_formula = null; + var sst = ([]); + var cur_sheet = ""; + var Preamble = {}; + var lastcell, last_cell = "", cc, cmnt, rngC, rngR; + var sharedf = {}; + var arrayf = []; + var temp_val; + var country; + var cell_valid = true; + var XFs = []; /* XF records */ + var palette = []; + var Workbook = ({ Sheets:[], WBProps:{date1904:false}, Views:[{}] }), wsprops = {}; + var get_rgb = function getrgb(icv) { + if(icv < 8) return XLSIcv[icv]; + if(icv < 64) return palette[icv-8] || XLSIcv[icv]; + return XLSIcv[icv]; + }; + var process_cell_style = function pcs(cell, line, options) { + var xfd = line.XF.data; + if(!xfd || !xfd.patternType || !options || !options.cellStyles) return; + line.s = ({}); + line.s.patternType = xfd.patternType; + var t; + if((t = rgb2Hex(get_rgb(xfd.icvFore)))) { line.s.fgColor = {rgb:t}; } + if((t = rgb2Hex(get_rgb(xfd.icvBack)))) { line.s.bgColor = {rgb:t}; } + }; + var addcell = function addcell(cell, line, options) { + if(file_depth > 1) return; + if(options.sheetRows && cell.r >= options.sheetRows) cell_valid = false; + if(!cell_valid) return; + if(options.cellStyles && line.XF && line.XF.data) process_cell_style(cell, line, options); + delete line.ixfe; delete line.XF; + lastcell = cell; + last_cell = encode_cell(cell); + if(!range || !range.s || !range.e) range = {s:{r:0,c:0},e:{r:0,c:0}}; + if(cell.r < range.s.r) range.s.r = cell.r; + if(cell.c < range.s.c) range.s.c = cell.c; + if(cell.r + 1 > range.e.r) range.e.r = cell.r + 1; + if(cell.c + 1 > range.e.c) range.e.c = cell.c + 1; + if(options.cellFormula && line.f) { + for(var afi = 0; afi < arrayf.length; ++afi) { + if(arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue; + if(arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue; + line.F = encode_range(arrayf[afi][0]); + if(arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) delete line.f; + if(line.f) line.f = "" + stringify_formula(arrayf[afi][1], range, cell, supbooks, opts); + break; + } + } + { + if(options.dense) { + if(!out[cell.r]) out[cell.r] = []; + out[cell.r][cell.c] = line; + } else out[last_cell] = line; + } + }; + var opts = ({ + enc: false, // encrypted + sbcch: 0, // cch in the preceding SupBook + snames: [], // sheetnames + sharedf: sharedf, // shared formulae by address + arrayf: arrayf, // array formulae array + rrtabid: [], // RRTabId + lastuser: "", // Last User from WriteAccess + biff: 8, // BIFF version + codepage: 0, // CP from CodePage record + winlocked: 0, // fLockWn from WinProtect + cellStyles: !!options && !!options.cellStyles, + WTF: !!options && !!options.wtf + }); + if(options.password) opts.password = options.password; + var themes; + var merges = []; + var objects = []; + var colinfo = [], rowinfo = []; + // eslint-disable-next-line no-unused-vars + var defwidth = 0, defheight = 0; // twips / MDW respectively + var seencol = false; + var supbooks = ([]); // 1-indexed, will hold extern names + supbooks.SheetNames = opts.snames; + supbooks.sharedf = opts.sharedf; + supbooks.arrayf = opts.arrayf; + supbooks.names = []; + supbooks.XTI = []; + var last_Rn = ''; + var file_depth = 0; /* TODO: make a real stack */ + var BIFF2Fmt = 0, BIFF2FmtTable = []; + var FilterDatabases = []; /* TODO: sort out supbooks and process elsewhere */ + var last_lbl; + + /* explicit override for some broken writers */ + opts.codepage = 1200; + set_cp(1200); + var seen_codepage = false; + while(blob.l < blob.length - 1) { + var s = blob.l; + var RecordType = blob.read_shift(2); + if(RecordType === 0 && last_Rn === 'EOF') break; + var length = (blob.l === blob.length ? 0 : blob.read_shift(2)); + var R = XLSRecordEnum[RecordType]; + //console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length); + //if(!R) console.log(blob.slice(blob.l, blob.l + length)); + if(R && R.f) { + if(options.bookSheets) { + if(last_Rn === 'BoundSheet8' && R.n !== 'BoundSheet8') break; + } + last_Rn = R.n; + if(R.r === 2 || R.r == 12) { + var rt = blob.read_shift(2); length -= 2; + if(!opts.enc && rt !== RecordType && (((rt&0xFF)<<8)|(rt>>8)) !== RecordType) throw new Error("rt mismatch: " + rt + "!=" + RecordType); + if(R.r == 12){ blob.l += 10; length -= 10; } // skip FRT + } + //console.error(R,blob.l,length,blob.length); + var val; + if(R.n === 'EOF') val = R.f(blob, length, opts); + else val = slurp(R, blob, length, opts); + var Rn = R.n; + if(file_depth == 0 && Rn != 'BOF') continue; + /* nested switch statements to workaround V8 128 limit */ + switch(Rn) { + /* Workbook Options */ + case 'Date1904': + wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break; + case 'WriteProtect': wb.opts.WriteProtect = true; break; + case 'FilePass': + if(!opts.enc) blob.l = 0; + opts.enc = val; + if(!options.password) throw new Error("File is password-protected"); + if(val.valid == null) throw new Error("Encryption scheme unsupported"); + if(!val.valid) throw new Error("Password is incorrect"); + break; + case 'WriteAccess': opts.lastuser = val; break; + case 'FileSharing': break; //TODO + case 'CodePage': + /* overrides based on test cases */ + switch(val) { + case 0x5212: val = 1200; break; + case 0x8000: val = 10000; break; + case 0x8001: val = 1252; break; + } + set_cp(opts.codepage = val); + seen_codepage = true; + break; + case 'RRTabId': opts.rrtabid = val; break; + case 'WinProtect': opts.winlocked = val; break; + case 'Template': break; // TODO + case 'BookBool': break; // TODO + case 'UsesELFs': break; + case 'MTRSettings': break; + case 'RefreshAll': + case 'CalcCount': + case 'CalcDelta': + case 'CalcIter': + case 'CalcMode': + case 'CalcPrecision': + case 'CalcSaveRecalc': + wb.opts[Rn] = val; break; + case 'CalcRefMode': opts.CalcRefMode = val; break; // TODO: implement R1C1 + case 'Uncalced': break; + case 'ForceFullCalculation': wb.opts.FullCalc = val; break; + case 'WsBool': + if(val.fDialog) out["!type"] = "dialog"; + break; // TODO + case 'XF': + XFs.push(val); break; + case 'ExtSST': break; // TODO + case 'BookExt': break; // TODO + case 'RichTextStream': break; + case 'BkHim': break; + + case 'SupBook': + supbooks.push([val]); + supbooks[supbooks.length-1].XTI = []; + break; + case 'ExternName': + supbooks[supbooks.length-1].push(val); + break; + case 'Index': break; // TODO + case 'Lbl': + last_lbl = ({ + Name: val.Name, + Ref: stringify_formula(val.rgce,range,null,supbooks,opts) + }); + if(val.itab > 0) last_lbl.Sheet = val.itab - 1; + supbooks.names.push(last_lbl); + if(!supbooks[0]) { supbooks[0] = []; supbooks[0].XTI = []; } + supbooks[supbooks.length-1].push(val); + if(val.Name == "_xlnm._FilterDatabase" && val.itab > 0) + if(val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d') + FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) }; + break; + case 'ExternCount': opts.ExternCount = val; break; + case 'ExternSheet': + if(supbooks.length == 0) { supbooks[0] = []; supbooks[0].XTI = []; } + supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); supbooks.XTI = supbooks.XTI.concat(val); break; + case 'NameCmt': + /* TODO: search for correct name */ + if(opts.biff < 8) break; + if(last_lbl != null) last_lbl.Comment = val[1]; + break; + + case 'Protect': out["!protect"] = val; break; /* for sheet or book */ + case 'Password': if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break; + case 'Prot4Rev': case 'Prot4RevPass': break; /*TODO: Revision Control*/ + + case 'BoundSheet8': { + Directory[val.pos] = val; + opts.snames.push(val.name); + } break; + case 'EOF': { + if(--file_depth) break; + if(range.e) { + if(range.e.r > 0 && range.e.c > 0) { + range.e.r--; range.e.c--; + out["!ref"] = encode_range(range); + if(options.sheetRows && options.sheetRows <= range.e.r) { + var tmpri = range.e.r; + range.e.r = options.sheetRows - 1; + out["!fullref"] = out["!ref"]; + out["!ref"] = encode_range(range); + range.e.r = tmpri; + } + range.e.r++; range.e.c++; + } + if(merges.length > 0) out["!merges"] = merges; + if(objects.length > 0) out["!objects"] = objects; + if(colinfo.length > 0) out["!cols"] = colinfo; + if(rowinfo.length > 0) out["!rows"] = rowinfo; + Workbook.Sheets.push(wsprops); + } + if(cur_sheet === "") Preamble = out; else Sheets[cur_sheet] = out; + out = ((options.dense ? [] : {})); + } break; + case 'BOF': { + if(opts.biff === 8) opts.biff = { + 0x0009:2, + 0x0209:3, + 0x0409:4 + }[RecordType] || { + 0x0200:2, + 0x0300:3, + 0x0400:4, + 0x0500:5, + 0x0600:8, + 0x0002:2, + 0x0007:2 + }[val.BIFFVer] || 8; + if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2; + if(file_depth++) break; + cell_valid = true; + out = ((options.dense ? [] : {})); + + if(opts.biff < 8 && !seen_codepage) { seen_codepage = true; set_cp(opts.codepage = options.codepage || 1252); } + if(opts.biff < 5) { + if(cur_sheet === "") cur_sheet = "Sheet1"; + range = {s:{r:0,c:0},e:{r:0,c:0}}; + /* fake BoundSheet8 */ + var fakebs8 = {pos: blob.l - length, name:cur_sheet}; + Directory[fakebs8.pos] = fakebs8; + opts.snames.push(cur_sheet); + } + else cur_sheet = (Directory[s] || {name:""}).name; + if(val.dt == 0x20) out["!type"] = "chart"; + if(val.dt == 0x40) out["!type"] = "macro"; + merges = []; + objects = []; + opts.arrayf = arrayf = []; + colinfo = []; rowinfo = []; + defwidth = defheight = 0; + seencol = false; + wsprops = {Hidden:(Directory[s]||{hs:0}).hs, name:cur_sheet }; + } break; + + case 'Number': case 'BIFF2NUM': case 'BIFF2INT': { + if(out["!type"] == "chart") if(options.dense ? (out[val.r]||[])[val.c]: out[encode_cell({c:val.c, r:val.r})]) ++val.c; + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe]||{}, v:val.val, t:'n'}); + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 'BoolErr': { + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.val, t:val.t}); + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 'RK': { + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.rknum, t:'n'}); + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 'MulRk': { + for(var j = val.c; j <= val.C; ++j) { + var ixfe = val.rkrec[j-val.c][0]; + temp_val= ({ixfe:ixfe, XF:XFs[ixfe], v:val.rkrec[j-val.c][1], t:'n'}); + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:j, r:val.r}, temp_val, options); + } + } break; + case 'Formula': { + if(val.val == 'String') { last_formula = val; break; } + temp_val = make_cell(val.val, val.cell.ixfe, val.tt); + temp_val.XF = XFs[temp_val.ixfe]; + if(options.cellFormula) { + var _f = val.formula; + if(_f && _f[0] && _f[0][0] && _f[0][0][0] == 'PtgExp') { + var _fr = _f[0][0][1][0], _fc = _f[0][0][1][1]; + var _fe = encode_cell({r:_fr, c:_fc}); + if(sharedf[_fe]) temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts); + else temp_val.F = ((options.dense ? (out[_fr]||[])[_fc]: out[_fe]) || {}).F; + } else temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts); + } + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell(val.cell, temp_val, options); + last_formula = val; + } break; + case 'String': { + if(last_formula) { /* technically always true */ + last_formula.val = val; + temp_val = make_cell(val, last_formula.cell.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if(options.cellFormula) { + temp_val.f = ""+stringify_formula(last_formula.formula, range, last_formula.cell, supbooks, opts); + } + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell(last_formula.cell, temp_val, options); + last_formula = null; + } else throw new Error("String record expects Formula"); + } break; + case 'Array': { + arrayf.push(val); + var _arraystart = encode_cell(val[0].s); + cc = options.dense ? (out[val[0].s.r]||[])[val[0].s.c] : out[_arraystart]; + if(options.cellFormula && cc) { + if(!last_formula) break; /* technically unreachable */ + if(!_arraystart || !cc) break; + cc.f = ""+stringify_formula(val[1], range, val[0], supbooks, opts); + cc.F = encode_range(val[0]); + } + } break; + case 'ShrFmla': { + if(!cell_valid) break; + if(!options.cellFormula) break; + if(last_cell) { + /* TODO: capture range */ + if(!last_formula) break; /* technically unreachable */ + sharedf[encode_cell(last_formula.cell)]= val[0]; + cc = options.dense ? (out[last_formula.cell.r]||[])[last_formula.cell.c] : out[encode_cell(last_formula.cell)]; + (cc||{}).f = ""+stringify_formula(val[0], range, lastcell, supbooks, opts); + } + } break; + case 'LabelSst': + temp_val=make_cell(sst[val.isst].t, val.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + break; + case 'Blank': if(options.sheetStubs) { + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], t:'z'}); + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 'MulBlank': if(options.sheetStubs) { + for(var _j = val.c; _j <= val.C; ++_j) { + var _ixfe = val.ixfe[_j-val.c]; + temp_val= ({ixfe:_ixfe, XF:XFs[_ixfe], t:'z'}); + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:_j, r:val.r}, temp_val, options); + } + } break; + case 'RString': + case 'Label': case 'BIFF2STR': + temp_val=make_cell(val.val, val.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if(BIFF2Fmt > 0) temp_val.z = BIFF2FmtTable[(temp_val.ixfe>>8) & 0x1F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + break; + + case 'Dimensions': { + if(file_depth === 1) range = val; /* TODO: stack */ + } break; + case 'SST': { + sst = val; + } break; + case 'Format': { /* val = [id, fmt] */ + if(opts.biff == 4) { + BIFF2FmtTable[BIFF2Fmt++] = val[1]; + for(var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if(SSF._table[b4idx] == val[1]) break; + if(b4idx >= 163) SSF.load(val[1], BIFF2Fmt + 163); + } + else SSF.load(val[1], val[0]); + } break; + case 'BIFF2FORMAT': { + BIFF2FmtTable[BIFF2Fmt++] = val; + for(var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if(SSF._table[b2idx] == val) break; + if(b2idx >= 163) SSF.load(val, BIFF2Fmt + 163); + } break; + + case 'MergeCells': merges = merges.concat(val); break; + + case 'Obj': objects[val.cmo[0]] = opts.lastobj = val; break; + case 'TxO': opts.lastobj.TxO = val; break; + case 'ImData': opts.lastobj.ImData = val; break; + + case 'HLink': { + for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) + for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { + cc = options.dense ? (out[rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})]; + if(cc) cc.l = val[1]; + } + } break; + case 'HLinkTooltip': { + for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) + for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { + cc = options.dense ? (out[rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})]; + if(cc && cc.l) cc.l.Tooltip = val[1]; + } + } break; + + /* Comments */ + case 'Note': { + if(opts.biff <= 5 && opts.biff >= 2) break; /* TODO: BIFF5 */ + cc = options.dense ? (out[val[0].r]||[])[val[0].c] : out[encode_cell(val[0])]; + var noteobj = objects[val[2]]; + if(!cc) break; + if(!cc.c) cc.c = []; + cmnt = {a:val[1],t:noteobj.TxO.t}; + cc.c.push(cmnt); + } break; + + default: switch(R.n) { /* nested */ + case 'ClrtClient': break; + case 'XFExt': update_xfext(XFs[val.ixfe], val.ext); break; + + case 'DefColWidth': defwidth = val; break; + case 'DefaultRowHeight': defheight = val[1]; break; // TODO: flags + + case 'ColInfo': { + if(!opts.cellStyles) break; + while(val.e >= val.s) { + colinfo[val.e--] = { width: val.w/256 }; + if(!seencol) { seencol = true; find_mdw_colw(val.w/256); } + process_col(colinfo[val.e+1]); + } + } break; + case 'Row': { + var rowobj = {}; + if(val.level != null) { rowinfo[val.r] = rowobj; rowobj.level = val.level; } + if(val.hidden) { rowinfo[val.r] = rowobj; rowobj.hidden = true; } + if(val.hpt) { + rowinfo[val.r] = rowobj; + rowobj.hpt = val.hpt; rowobj.hpx = pt2px(val.hpt); + } + } break; + + case 'LeftMargin': + case 'RightMargin': + case 'TopMargin': + case 'BottomMargin': + if(!out['!margins']) default_margins(out['!margins'] = {}); + out['!margins'][Rn.slice(0,-6).toLowerCase()] = val; + break; + + case 'Setup': // TODO + if(!out['!margins']) default_margins(out['!margins'] = {}); + out['!margins'].header = val.header; + out['!margins'].footer = val.footer; + break; + + case 'Window2': // TODO + // $FlowIgnore + if(val.RTL) Workbook.Views[0].RTL = true; + break; + + case 'Header': break; // TODO + case 'Footer': break; // TODO + case 'HCenter': break; // TODO + case 'VCenter': break; // TODO + case 'Pls': break; // TODO + case 'GCW': break; + case 'LHRecord': break; + case 'DBCell': break; // TODO + case 'EntExU2': break; // TODO + case 'SxView': break; // TODO + case 'Sxvd': break; // TODO + case 'SXVI': break; // TODO + case 'SXVDEx': break; // TODO + case 'SxIvd': break; // TODO + case 'SXString': break; // TODO + case 'Sync': break; + case 'Addin': break; + case 'SXDI': break; // TODO + case 'SXLI': break; // TODO + case 'SXEx': break; // TODO + case 'QsiSXTag': break; // TODO + case 'Selection': break; + case 'Feat': break; + case 'FeatHdr': case 'FeatHdr11': break; + case 'Feature11': case 'Feature12': case 'List12': break; + case 'Country': country = val; break; + case 'RecalcId': break; + case 'DxGCol': break; // TODO: htmlify + case 'Fbi': case 'Fbi2': case 'GelFrame': break; + case 'Font': break; // TODO + case 'XFCRC': break; // TODO + case 'Style': break; // TODO + case 'StyleExt': break; // TODO + case 'Palette': palette = val; break; + case 'Theme': themes = val; break; + /* Protection */ + case 'ScenarioProtect': break; + case 'ObjProtect': break; + + /* Conditional Formatting */ + case 'CondFmt12': break; + + /* Table */ + case 'Table': break; // TODO + case 'TableStyles': break; // TODO + case 'TableStyle': break; // TODO + case 'TableStyleElement': break; // TODO + + /* PivotTable */ + case 'SXStreamID': break; // TODO + case 'SXVS': break; // TODO + case 'DConRef': break; // TODO + case 'SXAddl': break; // TODO + case 'DConBin': break; // TODO + case 'DConName': break; // TODO + case 'SXPI': break; // TODO + case 'SxFormat': break; // TODO + case 'SxSelect': break; // TODO + case 'SxRule': break; // TODO + case 'SxFilt': break; // TODO + case 'SxItm': break; // TODO + case 'SxDXF': break; // TODO + + /* Scenario Manager */ + case 'ScenMan': break; + + /* Data Consolidation */ + case 'DCon': break; + + /* Watched Cell */ + case 'CellWatch': break; + + /* Print Settings */ + case 'PrintRowCol': break; + case 'PrintGrid': break; + case 'PrintSize': break; + + case 'XCT': break; + case 'CRN': break; + + case 'Scl': { + //console.log("Zoom Level:", val[0]/val[1],val); + } break; + case 'SheetExt': { + /* empty */ + } break; + case 'SheetExtOptional': { + /* empty */ + } break; + + /* VBA */ + case 'ObNoMacros': { + /* empty */ + } break; + case 'ObProj': { + /* empty */ + } break; + case 'CodeName': { + if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook"; + else wsprops.CodeName = val || wsprops.name; + } break; + case 'GUIDTypeLib': { + /* empty */ + } break; + + case 'WOpt': break; // TODO: WTF? + case 'PhoneticInfo': break; + + case 'OleObjectSize': break; + + /* Differential Formatting */ + case 'DXF': case 'DXFN': case 'DXFN12': case 'DXFN12List': case 'DXFN12NoCB': break; + + /* Data Validation */ + case 'Dv': case 'DVal': break; + + /* Data Series */ + case 'BRAI': case 'Series': case 'SeriesText': break; + + /* Data Connection */ + case 'DConn': break; + case 'DbOrParamQry': break; + case 'DBQueryExt': break; + + case 'OleDbConn': break; + case 'ExtString': break; + + /* Formatting */ + case 'IFmtRecord': break; + case 'CondFmt': case 'CF': case 'CF12': case 'CFEx': break; + + /* Explicitly Ignored */ + case 'Excel9File': break; + case 'Units': break; + case 'InterfaceHdr': case 'Mms': case 'InterfaceEnd': case 'DSF': break; + case 'BuiltInFnGroupCount': /* 2.4.30 0x0E or 0x10 but excel 2011 generates 0x11? */ break; + /* View Stuff */ + case 'Window1': case 'HideObj': case 'GridSet': case 'Guts': + case 'UserBView': case 'UserSViewBegin': case 'UserSViewEnd': + case 'Pane': break; + default: switch(R.n) { /* nested */ + /* Chart */ + case 'Dat': + case 'Begin': case 'End': + case 'StartBlock': case 'EndBlock': + case 'Frame': case 'Area': + case 'Axis': case 'AxisLine': case 'Tick': break; + case 'AxesUsed': + case 'CrtLayout12': case 'CrtLayout12A': case 'CrtLink': case 'CrtLine': case 'CrtMlFrt': case 'CrtMlFrtContinue': break; + case 'LineFormat': case 'AreaFormat': + case 'Chart': case 'Chart3d': case 'Chart3DBarShape': case 'ChartFormat': case 'ChartFrtInfo': break; + case 'PlotArea': case 'PlotGrowth': break; + case 'SeriesList': case 'SerParent': case 'SerAuxTrend': break; + case 'DataFormat': case 'SerToCrt': case 'FontX': break; + case 'CatSerRange': case 'AxcExt': case 'SerFmt': break; + case 'ShtProps': break; + case 'DefaultText': case 'Text': case 'CatLab': break; + case 'DataLabExtContents': break; + case 'Legend': case 'LegendException': break; + case 'Pie': case 'Scatter': break; + case 'PieFormat': case 'MarkerFormat': break; + case 'StartObject': case 'EndObject': break; + case 'AlRuns': case 'ObjectLink': break; + case 'SIIndex': break; + case 'AttachedLabel': case 'YMult': break; + + /* Chart Group */ + case 'Line': case 'Bar': break; + case 'Surf': break; + + /* Axis Group */ + case 'AxisParent': break; + case 'Pos': break; + case 'ValueRange': break; + + /* Pivot Chart */ + case 'SXViewEx9': break; // TODO + case 'SXViewLink': break; + case 'PivotChartBits': break; + case 'SBaseRef': break; + case 'TextPropsStream': break; + + /* Chart Misc */ + case 'LnExt': break; + case 'MkrExt': break; + case 'CrtCoopt': break; + + /* Query Table */ + case 'Qsi': case 'Qsif': case 'Qsir': case 'QsiSXTag': break; + case 'TxtQry': break; + + /* Filter */ + case 'FilterMode': break; + case 'AutoFilter': case 'AutoFilterInfo': break; + case 'AutoFilter12': break; + case 'DropDownObjIds': break; + case 'Sort': break; + case 'SortData': break; + + /* Drawing */ + case 'ShapePropsStream': break; + case 'MsoDrawing': case 'MsoDrawingGroup': case 'MsoDrawingSelection': break; + /* Pub Stuff */ + case 'WebPub': case 'AutoWebPub': break; + + /* Print Stuff */ + case 'HeaderFooter': case 'HFPicture': case 'PLV': + case 'HorizontalPageBreaks': case 'VerticalPageBreaks': break; + /* Behavioral */ + case 'Backup': case 'CompressPictures': case 'Compat12': break; + + /* Should not Happen */ + case 'Continue': case 'ContinueFrt12': break; + + /* Future Records */ + case 'FrtFontList': case 'FrtWrapper': break; + + default: switch(R.n) { /* nested */ + /* BIFF5 records */ + case 'TabIdConf': case 'Radar': case 'RadarArea': case 'DropBar': case 'Intl': case 'CoordList': case 'SerAuxErrBar': break; + + /* BIFF2-4 records */ + case 'BIFF2FONTCLR': case 'BIFF2FMTCNT': case 'BIFF2FONTXTRA': break; + case 'BIFF2XF': case 'BIFF3XF': case 'BIFF4XF': break; + case 'BIFF4FMTCNT': case 'BIFF2ROW': case 'BIFF2WINDOW2': break; + + /* Miscellaneous */ + case 'SCENARIO': case 'DConBin': case 'PicF': case 'DataLabExt': + case 'Lel': case 'BopPop': case 'BopPopCustom': case 'RealTimeData': + case 'Name': break; + case 'LHNGraph': case 'FnGroupName': case 'AddMenu': case 'LPr': break; + case 'ListObj': case 'ListField': break; + case 'RRSort': break; + case 'BigName': break; + case 'ToolbarHdr': case 'ToolbarEnd': break; + case 'DDEObjName': break; + case 'FRTArchId$': break; + default: if(options.WTF) throw 'Unrecognized Record ' + R.n; + }}}} + } else blob.l += length; + } + wb.SheetNames=keys(Directory).sort(function(a,b) { return Number(a) - Number(b); }).map(function(x){return Directory[x].name;}); + if(!options.bookSheets) wb.Sheets=Sheets; + if(wb.Sheets) FilterDatabases.forEach(function(r,i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] = r; }); + wb.Preamble=Preamble; + wb.Strings = sst; + wb.SSF = SSF.get_table(); + if(opts.enc) wb.Encryption = opts.enc; + if(themes) wb.Themes = themes; + wb.Metadata = {}; + if(country !== undefined) wb.Metadata.Country = country; + if(supbooks.names.length > 0) Workbook.Names = supbooks.names; + wb.Workbook = Workbook; + return wb; + } + + /* TODO: split props*/ + var PSCLSID = { + SI: "e0859ff2f94f6810ab9108002b27b3d9", + DSI: "02d5cdd59c2e1b10939708002b2cf9ae", + UDI: "05d5cdd59c2e1b10939708002b2cf9ae" + }; + function parse_xls_props(cfb, props, o) { + /* [MS-OSHARED] 2.3.3.2.2 Document Summary Information Property Set */ + var DSI = CFB.find(cfb, '!DocumentSummaryInformation'); + if(DSI && DSI.size > 0) try { + var DocSummary = parse_PropertySetStream(DSI, DocSummaryPIDDSI, PSCLSID.DSI); + for(var d in DocSummary) props[d] = DocSummary[d]; + } catch(e) {if(o.WTF) throw e;/* empty */} + + /* [MS-OSHARED] 2.3.3.2.1 Summary Information Property Set*/ + var SI = CFB.find(cfb, '!SummaryInformation'); + if(SI && SI.size > 0) try { + var Summary = parse_PropertySetStream(SI, SummaryPIDSI, PSCLSID.SI); + for(var s in Summary) if(props[s] == null) props[s] = Summary[s]; + } catch(e) {if(o.WTF) throw e;/* empty */} + + if(props.HeadingPairs && props.TitlesOfParts) { + load_props_pairs(props.HeadingPairs, props.TitlesOfParts, props, o); + delete props.HeadingPairs; delete props.TitlesOfParts; + } + } + function write_xls_props(wb, cfb) { + var DSEntries = [], SEntries = [], CEntries = []; + var i = 0, Keys; + if(wb.Props) { + Keys = keys(wb.Props); + // $FlowIgnore + for(i = 0; i < Keys.length; ++i) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]); + } + if(wb.Custprops) { + Keys = keys(wb.Custprops); + // $FlowIgnore + for(i = 0; i < Keys.length; ++i) if(!(wb.Props||{}).hasOwnProperty(Keys[i])) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]); + } + var CEntries2 = []; + for(i = 0; i < CEntries.length; ++i) { + if(XLSPSSkip.indexOf(CEntries[i][0]) > -1) continue; + if(CEntries[i][1] == null) continue; + CEntries2.push(CEntries[i]); + } + if(SEntries.length) CFB.utils.cfb_add(cfb, "/\u0005SummaryInformation", write_PropertySetStream(SEntries, PSCLSID.SI, SummaryRE, SummaryPIDSI)); + if(DSEntries.length || CEntries2.length) CFB.utils.cfb_add(cfb, "/\u0005DocumentSummaryInformation", write_PropertySetStream(DSEntries, PSCLSID.DSI, DocSummaryRE, DocSummaryPIDDSI, CEntries2.length ? CEntries2 : null, PSCLSID.UDI)); + } + + function parse_xlscfb(cfb, options) { + if(!options) options = {}; + fix_read_opts(options); + reset_cp(); + if(options.codepage) set_ansi(options.codepage); + var CompObj, WB; + if(cfb.FullPaths) { + if(CFB.find(cfb, '/encryption')) throw new Error("File is password-protected"); + CompObj = CFB.find(cfb, '!CompObj'); + WB = CFB.find(cfb, '/Workbook') || CFB.find(cfb, '/Book'); + } else { + switch(options.type) { + case 'base64': cfb = s2a(Base64.decode(cfb)); break; + case 'binary': cfb = s2a(cfb); break; + case 'buffer': break; + case 'array': if(!Array.isArray(cfb)) cfb = Array.prototype.slice.call(cfb); break; + } + prep_blob(cfb, 0); + WB = ({content: cfb}); + } + var WorkbookP; + + var _data; + if(CompObj) parse_compobj(CompObj); + if(options.bookProps && !options.bookSheets) WorkbookP = ({}); + else { + var T = has_buf ? 'buffer' : 'array'; + if(WB && WB.content) WorkbookP = parse_workbook(WB.content, options); + /* Quattro Pro 7-8 */ + else if((_data=CFB.find(cfb, 'PerfectOffice_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); + /* Quattro Pro 9 */ + else if((_data=CFB.find(cfb, 'NativeContent_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); + else throw new Error("Cannot find Workbook stream"); + if(options.bookVBA && cfb.FullPaths && CFB.find(cfb, '/_VBA_PROJECT_CUR/VBA/dir')) WorkbookP.vbaraw = make_vba_xls(cfb); + } + + var props = {}; + if(cfb.FullPaths) parse_xls_props(cfb, props, options); + + WorkbookP.Props = WorkbookP.Custprops = props; /* TODO: split up properties */ + if(options.bookFiles) WorkbookP.cfb = cfb; + /*WorkbookP.CompObjP = CompObjP; // TODO: storage? */ + return WorkbookP; + } + + + function write_xlscfb(wb, opts) { + var o = opts || {}; + var cfb = CFB.utils.cfb_new({root:"R"}); + var wbpath = "/Workbook"; + switch(o.bookType || "xls") { + case "xls": o.bookType = "biff8"; + /* falls through */ + case "xla": if(!o.bookType) o.bookType = "xla"; + /* falls through */ + case "biff8": wbpath = "/Workbook"; o.biff = 8; break; + case "biff5": wbpath = "/Book"; o.biff = 5; break; + default: throw new Error("invalid type " + o.bookType + " for XLS CFB"); + } + CFB.utils.cfb_add(cfb, wbpath, write_biff_buf(wb, o)); + if(o.biff == 8 && (wb.Props || wb.Custprops)) write_xls_props(wb, cfb); + // TODO: SI, DSI, CO + if(o.biff == 8 && wb.vbaraw) fill_vba_xls(cfb, CFB.read(wb.vbaraw, {type: typeof wb.vbaraw == "string" ? "binary" : "buffer"})); + return cfb; + } + /* [MS-XLSB] 2.3 Record Enumeration */ + var XLSBRecordEnum = { + 0x0000: { n:"BrtRowHdr", f:parse_BrtRowHdr }, + 0x0001: { n:"BrtCellBlank", f:parse_BrtCellBlank }, + 0x0002: { n:"BrtCellRk", f:parse_BrtCellRk }, + 0x0003: { n:"BrtCellError", f:parse_BrtCellError }, + 0x0004: { n:"BrtCellBool", f:parse_BrtCellBool }, + 0x0005: { n:"BrtCellReal", f:parse_BrtCellReal }, + 0x0006: { n:"BrtCellSt", f:parse_BrtCellSt }, + 0x0007: { n:"BrtCellIsst", f:parse_BrtCellIsst }, + 0x0008: { n:"BrtFmlaString", f:parse_BrtFmlaString }, + 0x0009: { n:"BrtFmlaNum", f:parse_BrtFmlaNum }, + 0x000A: { n:"BrtFmlaBool", f:parse_BrtFmlaBool }, + 0x000B: { n:"BrtFmlaError", f:parse_BrtFmlaError }, + 0x0010: { n:"BrtFRTArchID$", f:parse_BrtFRTArchID$ }, + 0x0013: { n:"BrtSSTItem", f:parse_RichStr }, + 0x0014: { n:"BrtPCDIMissing" }, + 0x0015: { n:"BrtPCDINumber" }, + 0x0016: { n:"BrtPCDIBoolean" }, + 0x0017: { n:"BrtPCDIError" }, + 0x0018: { n:"BrtPCDIString" }, + 0x0019: { n:"BrtPCDIDatetime" }, + 0x001A: { n:"BrtPCDIIndex" }, + 0x001B: { n:"BrtPCDIAMissing" }, + 0x001C: { n:"BrtPCDIANumber" }, + 0x001D: { n:"BrtPCDIABoolean" }, + 0x001E: { n:"BrtPCDIAError" }, + 0x001F: { n:"BrtPCDIAString" }, + 0x0020: { n:"BrtPCDIADatetime" }, + 0x0021: { n:"BrtPCRRecord" }, + 0x0022: { n:"BrtPCRRecordDt" }, + 0x0023: { n:"BrtFRTBegin" }, + 0x0024: { n:"BrtFRTEnd" }, + 0x0025: { n:"BrtACBegin" }, + 0x0026: { n:"BrtACEnd" }, + 0x0027: { n:"BrtName", f:parse_BrtName }, + 0x0028: { n:"BrtIndexRowBlock" }, + 0x002A: { n:"BrtIndexBlock" }, + 0x002B: { n:"BrtFont", f:parse_BrtFont }, + 0x002C: { n:"BrtFmt", f:parse_BrtFmt }, + 0x002D: { n:"BrtFill", f:parse_BrtFill }, + 0x002E: { n:"BrtBorder", f:parse_BrtBorder }, + 0x002F: { n:"BrtXF", f:parse_BrtXF }, + 0x0030: { n:"BrtStyle" }, + 0x0031: { n:"BrtCellMeta" }, + 0x0032: { n:"BrtValueMeta" }, + 0x0033: { n:"BrtMdb" }, + 0x0034: { n:"BrtBeginFmd" }, + 0x0035: { n:"BrtEndFmd" }, + 0x0036: { n:"BrtBeginMdx" }, + 0x0037: { n:"BrtEndMdx" }, + 0x0038: { n:"BrtBeginMdxTuple" }, + 0x0039: { n:"BrtEndMdxTuple" }, + 0x003A: { n:"BrtMdxMbrIstr" }, + 0x003B: { n:"BrtStr" }, + 0x003C: { n:"BrtColInfo", f:parse_ColInfo }, + 0x003E: { n:"BrtCellRString" }, + 0x003F: { n:"BrtCalcChainItem$", f:parse_BrtCalcChainItem$ }, + 0x0040: { n:"BrtDVal" }, + 0x0041: { n:"BrtSxvcellNum" }, + 0x0042: { n:"BrtSxvcellStr" }, + 0x0043: { n:"BrtSxvcellBool" }, + 0x0044: { n:"BrtSxvcellErr" }, + 0x0045: { n:"BrtSxvcellDate" }, + 0x0046: { n:"BrtSxvcellNil" }, + 0x0080: { n:"BrtFileVersion" }, + 0x0081: { n:"BrtBeginSheet" }, + 0x0082: { n:"BrtEndSheet" }, + 0x0083: { n:"BrtBeginBook", f:parsenoop, p:0 }, + 0x0084: { n:"BrtEndBook" }, + 0x0085: { n:"BrtBeginWsViews" }, + 0x0086: { n:"BrtEndWsViews" }, + 0x0087: { n:"BrtBeginBookViews" }, + 0x0088: { n:"BrtEndBookViews" }, + 0x0089: { n:"BrtBeginWsView", f:parse_BrtBeginWsView }, + 0x008A: { n:"BrtEndWsView" }, + 0x008B: { n:"BrtBeginCsViews" }, + 0x008C: { n:"BrtEndCsViews" }, + 0x008D: { n:"BrtBeginCsView" }, + 0x008E: { n:"BrtEndCsView" }, + 0x008F: { n:"BrtBeginBundleShs" }, + 0x0090: { n:"BrtEndBundleShs" }, + 0x0091: { n:"BrtBeginSheetData" }, + 0x0092: { n:"BrtEndSheetData" }, + 0x0093: { n:"BrtWsProp", f:parse_BrtWsProp }, + 0x0094: { n:"BrtWsDim", f:parse_BrtWsDim, p:16 }, + 0x0097: { n:"BrtPane" }, + 0x0098: { n:"BrtSel" }, + 0x0099: { n:"BrtWbProp", f:parse_BrtWbProp }, + 0x009A: { n:"BrtWbFactoid" }, + 0x009B: { n:"BrtFileRecover" }, + 0x009C: { n:"BrtBundleSh", f:parse_BrtBundleSh }, + 0x009D: { n:"BrtCalcProp" }, + 0x009E: { n:"BrtBookView" }, + 0x009F: { n:"BrtBeginSst", f:parse_BrtBeginSst }, + 0x00A0: { n:"BrtEndSst" }, + 0x00A1: { n:"BrtBeginAFilter", f:parse_UncheckedRfX }, + 0x00A2: { n:"BrtEndAFilter" }, + 0x00A3: { n:"BrtBeginFilterColumn" }, + 0x00A4: { n:"BrtEndFilterColumn" }, + 0x00A5: { n:"BrtBeginFilters" }, + 0x00A6: { n:"BrtEndFilters" }, + 0x00A7: { n:"BrtFilter" }, + 0x00A8: { n:"BrtColorFilter" }, + 0x00A9: { n:"BrtIconFilter" }, + 0x00AA: { n:"BrtTop10Filter" }, + 0x00AB: { n:"BrtDynamicFilter" }, + 0x00AC: { n:"BrtBeginCustomFilters" }, + 0x00AD: { n:"BrtEndCustomFilters" }, + 0x00AE: { n:"BrtCustomFilter" }, + 0x00AF: { n:"BrtAFilterDateGroupItem" }, + 0x00B0: { n:"BrtMergeCell", f:parse_BrtMergeCell }, + 0x00B1: { n:"BrtBeginMergeCells" }, + 0x00B2: { n:"BrtEndMergeCells" }, + 0x00B3: { n:"BrtBeginPivotCacheDef" }, + 0x00B4: { n:"BrtEndPivotCacheDef" }, + 0x00B5: { n:"BrtBeginPCDFields" }, + 0x00B6: { n:"BrtEndPCDFields" }, + 0x00B7: { n:"BrtBeginPCDField" }, + 0x00B8: { n:"BrtEndPCDField" }, + 0x00B9: { n:"BrtBeginPCDSource" }, + 0x00BA: { n:"BrtEndPCDSource" }, + 0x00BB: { n:"BrtBeginPCDSRange" }, + 0x00BC: { n:"BrtEndPCDSRange" }, + 0x00BD: { n:"BrtBeginPCDFAtbl" }, + 0x00BE: { n:"BrtEndPCDFAtbl" }, + 0x00BF: { n:"BrtBeginPCDIRun" }, + 0x00C0: { n:"BrtEndPCDIRun" }, + 0x00C1: { n:"BrtBeginPivotCacheRecords" }, + 0x00C2: { n:"BrtEndPivotCacheRecords" }, + 0x00C3: { n:"BrtBeginPCDHierarchies" }, + 0x00C4: { n:"BrtEndPCDHierarchies" }, + 0x00C5: { n:"BrtBeginPCDHierarchy" }, + 0x00C6: { n:"BrtEndPCDHierarchy" }, + 0x00C7: { n:"BrtBeginPCDHFieldsUsage" }, + 0x00C8: { n:"BrtEndPCDHFieldsUsage" }, + 0x00C9: { n:"BrtBeginExtConnection" }, + 0x00CA: { n:"BrtEndExtConnection" }, + 0x00CB: { n:"BrtBeginECDbProps" }, + 0x00CC: { n:"BrtEndECDbProps" }, + 0x00CD: { n:"BrtBeginECOlapProps" }, + 0x00CE: { n:"BrtEndECOlapProps" }, + 0x00CF: { n:"BrtBeginPCDSConsol" }, + 0x00D0: { n:"BrtEndPCDSConsol" }, + 0x00D1: { n:"BrtBeginPCDSCPages" }, + 0x00D2: { n:"BrtEndPCDSCPages" }, + 0x00D3: { n:"BrtBeginPCDSCPage" }, + 0x00D4: { n:"BrtEndPCDSCPage" }, + 0x00D5: { n:"BrtBeginPCDSCPItem" }, + 0x00D6: { n:"BrtEndPCDSCPItem" }, + 0x00D7: { n:"BrtBeginPCDSCSets" }, + 0x00D8: { n:"BrtEndPCDSCSets" }, + 0x00D9: { n:"BrtBeginPCDSCSet" }, + 0x00DA: { n:"BrtEndPCDSCSet" }, + 0x00DB: { n:"BrtBeginPCDFGroup" }, + 0x00DC: { n:"BrtEndPCDFGroup" }, + 0x00DD: { n:"BrtBeginPCDFGItems" }, + 0x00DE: { n:"BrtEndPCDFGItems" }, + 0x00DF: { n:"BrtBeginPCDFGRange" }, + 0x00E0: { n:"BrtEndPCDFGRange" }, + 0x00E1: { n:"BrtBeginPCDFGDiscrete" }, + 0x00E2: { n:"BrtEndPCDFGDiscrete" }, + 0x00E3: { n:"BrtBeginPCDSDTupleCache" }, + 0x00E4: { n:"BrtEndPCDSDTupleCache" }, + 0x00E5: { n:"BrtBeginPCDSDTCEntries" }, + 0x00E6: { n:"BrtEndPCDSDTCEntries" }, + 0x00E7: { n:"BrtBeginPCDSDTCEMembers" }, + 0x00E8: { n:"BrtEndPCDSDTCEMembers" }, + 0x00E9: { n:"BrtBeginPCDSDTCEMember" }, + 0x00EA: { n:"BrtEndPCDSDTCEMember" }, + 0x00EB: { n:"BrtBeginPCDSDTCQueries" }, + 0x00EC: { n:"BrtEndPCDSDTCQueries" }, + 0x00ED: { n:"BrtBeginPCDSDTCQuery" }, + 0x00EE: { n:"BrtEndPCDSDTCQuery" }, + 0x00EF: { n:"BrtBeginPCDSDTCSets" }, + 0x00F0: { n:"BrtEndPCDSDTCSets" }, + 0x00F1: { n:"BrtBeginPCDSDTCSet" }, + 0x00F2: { n:"BrtEndPCDSDTCSet" }, + 0x00F3: { n:"BrtBeginPCDCalcItems" }, + 0x00F4: { n:"BrtEndPCDCalcItems" }, + 0x00F5: { n:"BrtBeginPCDCalcItem" }, + 0x00F6: { n:"BrtEndPCDCalcItem" }, + 0x00F7: { n:"BrtBeginPRule" }, + 0x00F8: { n:"BrtEndPRule" }, + 0x00F9: { n:"BrtBeginPRFilters" }, + 0x00FA: { n:"BrtEndPRFilters" }, + 0x00FB: { n:"BrtBeginPRFilter" }, + 0x00FC: { n:"BrtEndPRFilter" }, + 0x00FD: { n:"BrtBeginPNames" }, + 0x00FE: { n:"BrtEndPNames" }, + 0x00FF: { n:"BrtBeginPName" }, + 0x0100: { n:"BrtEndPName" }, + 0x0101: { n:"BrtBeginPNPairs" }, + 0x0102: { n:"BrtEndPNPairs" }, + 0x0103: { n:"BrtBeginPNPair" }, + 0x0104: { n:"BrtEndPNPair" }, + 0x0105: { n:"BrtBeginECWebProps" }, + 0x0106: { n:"BrtEndECWebProps" }, + 0x0107: { n:"BrtBeginEcWpTables" }, + 0x0108: { n:"BrtEndECWPTables" }, + 0x0109: { n:"BrtBeginECParams" }, + 0x010A: { n:"BrtEndECParams" }, + 0x010B: { n:"BrtBeginECParam" }, + 0x010C: { n:"BrtEndECParam" }, + 0x010D: { n:"BrtBeginPCDKPIs" }, + 0x010E: { n:"BrtEndPCDKPIs" }, + 0x010F: { n:"BrtBeginPCDKPI" }, + 0x0110: { n:"BrtEndPCDKPI" }, + 0x0111: { n:"BrtBeginDims" }, + 0x0112: { n:"BrtEndDims" }, + 0x0113: { n:"BrtBeginDim" }, + 0x0114: { n:"BrtEndDim" }, + 0x0115: { n:"BrtIndexPartEnd" }, + 0x0116: { n:"BrtBeginStyleSheet" }, + 0x0117: { n:"BrtEndStyleSheet" }, + 0x0118: { n:"BrtBeginSXView" }, + 0x0119: { n:"BrtEndSXVI" }, + 0x011A: { n:"BrtBeginSXVI" }, + 0x011B: { n:"BrtBeginSXVIs" }, + 0x011C: { n:"BrtEndSXVIs" }, + 0x011D: { n:"BrtBeginSXVD" }, + 0x011E: { n:"BrtEndSXVD" }, + 0x011F: { n:"BrtBeginSXVDs" }, + 0x0120: { n:"BrtEndSXVDs" }, + 0x0121: { n:"BrtBeginSXPI" }, + 0x0122: { n:"BrtEndSXPI" }, + 0x0123: { n:"BrtBeginSXPIs" }, + 0x0124: { n:"BrtEndSXPIs" }, + 0x0125: { n:"BrtBeginSXDI" }, + 0x0126: { n:"BrtEndSXDI" }, + 0x0127: { n:"BrtBeginSXDIs" }, + 0x0128: { n:"BrtEndSXDIs" }, + 0x0129: { n:"BrtBeginSXLI" }, + 0x012A: { n:"BrtEndSXLI" }, + 0x012B: { n:"BrtBeginSXLIRws" }, + 0x012C: { n:"BrtEndSXLIRws" }, + 0x012D: { n:"BrtBeginSXLICols" }, + 0x012E: { n:"BrtEndSXLICols" }, + 0x012F: { n:"BrtBeginSXFormat" }, + 0x0130: { n:"BrtEndSXFormat" }, + 0x0131: { n:"BrtBeginSXFormats" }, + 0x0132: { n:"BrtEndSxFormats" }, + 0x0133: { n:"BrtBeginSxSelect" }, + 0x0134: { n:"BrtEndSxSelect" }, + 0x0135: { n:"BrtBeginISXVDRws" }, + 0x0136: { n:"BrtEndISXVDRws" }, + 0x0137: { n:"BrtBeginISXVDCols" }, + 0x0138: { n:"BrtEndISXVDCols" }, + 0x0139: { n:"BrtEndSXLocation" }, + 0x013A: { n:"BrtBeginSXLocation" }, + 0x013B: { n:"BrtEndSXView" }, + 0x013C: { n:"BrtBeginSXTHs" }, + 0x013D: { n:"BrtEndSXTHs" }, + 0x013E: { n:"BrtBeginSXTH" }, + 0x013F: { n:"BrtEndSXTH" }, + 0x0140: { n:"BrtBeginISXTHRws" }, + 0x0141: { n:"BrtEndISXTHRws" }, + 0x0142: { n:"BrtBeginISXTHCols" }, + 0x0143: { n:"BrtEndISXTHCols" }, + 0x0144: { n:"BrtBeginSXTDMPS" }, + 0x0145: { n:"BrtEndSXTDMPs" }, + 0x0146: { n:"BrtBeginSXTDMP" }, + 0x0147: { n:"BrtEndSXTDMP" }, + 0x0148: { n:"BrtBeginSXTHItems" }, + 0x0149: { n:"BrtEndSXTHItems" }, + 0x014A: { n:"BrtBeginSXTHItem" }, + 0x014B: { n:"BrtEndSXTHItem" }, + 0x014C: { n:"BrtBeginMetadata" }, + 0x014D: { n:"BrtEndMetadata" }, + 0x014E: { n:"BrtBeginEsmdtinfo" }, + 0x014F: { n:"BrtMdtinfo" }, + 0x0150: { n:"BrtEndEsmdtinfo" }, + 0x0151: { n:"BrtBeginEsmdb" }, + 0x0152: { n:"BrtEndEsmdb" }, + 0x0153: { n:"BrtBeginEsfmd" }, + 0x0154: { n:"BrtEndEsfmd" }, + 0x0155: { n:"BrtBeginSingleCells" }, + 0x0156: { n:"BrtEndSingleCells" }, + 0x0157: { n:"BrtBeginList" }, + 0x0158: { n:"BrtEndList" }, + 0x0159: { n:"BrtBeginListCols" }, + 0x015A: { n:"BrtEndListCols" }, + 0x015B: { n:"BrtBeginListCol" }, + 0x015C: { n:"BrtEndListCol" }, + 0x015D: { n:"BrtBeginListXmlCPr" }, + 0x015E: { n:"BrtEndListXmlCPr" }, + 0x015F: { n:"BrtListCCFmla" }, + 0x0160: { n:"BrtListTrFmla" }, + 0x0161: { n:"BrtBeginExternals" }, + 0x0162: { n:"BrtEndExternals" }, + 0x0163: { n:"BrtSupBookSrc", f:parse_RelID}, + 0x0165: { n:"BrtSupSelf" }, + 0x0166: { n:"BrtSupSame" }, + 0x0167: { n:"BrtSupTabs" }, + 0x0168: { n:"BrtBeginSupBook" }, + 0x0169: { n:"BrtPlaceholderName" }, + 0x016A: { n:"BrtExternSheet", f:parse_ExternSheet }, + 0x016B: { n:"BrtExternTableStart" }, + 0x016C: { n:"BrtExternTableEnd" }, + 0x016E: { n:"BrtExternRowHdr" }, + 0x016F: { n:"BrtExternCellBlank" }, + 0x0170: { n:"BrtExternCellReal" }, + 0x0171: { n:"BrtExternCellBool" }, + 0x0172: { n:"BrtExternCellError" }, + 0x0173: { n:"BrtExternCellString" }, + 0x0174: { n:"BrtBeginEsmdx" }, + 0x0175: { n:"BrtEndEsmdx" }, + 0x0176: { n:"BrtBeginMdxSet" }, + 0x0177: { n:"BrtEndMdxSet" }, + 0x0178: { n:"BrtBeginMdxMbrProp" }, + 0x0179: { n:"BrtEndMdxMbrProp" }, + 0x017A: { n:"BrtBeginMdxKPI" }, + 0x017B: { n:"BrtEndMdxKPI" }, + 0x017C: { n:"BrtBeginEsstr" }, + 0x017D: { n:"BrtEndEsstr" }, + 0x017E: { n:"BrtBeginPRFItem" }, + 0x017F: { n:"BrtEndPRFItem" }, + 0x0180: { n:"BrtBeginPivotCacheIDs" }, + 0x0181: { n:"BrtEndPivotCacheIDs" }, + 0x0182: { n:"BrtBeginPivotCacheID" }, + 0x0183: { n:"BrtEndPivotCacheID" }, + 0x0184: { n:"BrtBeginISXVIs" }, + 0x0185: { n:"BrtEndISXVIs" }, + 0x0186: { n:"BrtBeginColInfos" }, + 0x0187: { n:"BrtEndColInfos" }, + 0x0188: { n:"BrtBeginRwBrk" }, + 0x0189: { n:"BrtEndRwBrk" }, + 0x018A: { n:"BrtBeginColBrk" }, + 0x018B: { n:"BrtEndColBrk" }, + 0x018C: { n:"BrtBrk" }, + 0x018D: { n:"BrtUserBookView" }, + 0x018E: { n:"BrtInfo" }, + 0x018F: { n:"BrtCUsr" }, + 0x0190: { n:"BrtUsr" }, + 0x0191: { n:"BrtBeginUsers" }, + 0x0193: { n:"BrtEOF" }, + 0x0194: { n:"BrtUCR" }, + 0x0195: { n:"BrtRRInsDel" }, + 0x0196: { n:"BrtRREndInsDel" }, + 0x0197: { n:"BrtRRMove" }, + 0x0198: { n:"BrtRREndMove" }, + 0x0199: { n:"BrtRRChgCell" }, + 0x019A: { n:"BrtRREndChgCell" }, + 0x019B: { n:"BrtRRHeader" }, + 0x019C: { n:"BrtRRUserView" }, + 0x019D: { n:"BrtRRRenSheet" }, + 0x019E: { n:"BrtRRInsertSh" }, + 0x019F: { n:"BrtRRDefName" }, + 0x01A0: { n:"BrtRRNote" }, + 0x01A1: { n:"BrtRRConflict" }, + 0x01A2: { n:"BrtRRTQSIF" }, + 0x01A3: { n:"BrtRRFormat" }, + 0x01A4: { n:"BrtRREndFormat" }, + 0x01A5: { n:"BrtRRAutoFmt" }, + 0x01A6: { n:"BrtBeginUserShViews" }, + 0x01A7: { n:"BrtBeginUserShView" }, + 0x01A8: { n:"BrtEndUserShView" }, + 0x01A9: { n:"BrtEndUserShViews" }, + 0x01AA: { n:"BrtArrFmla", f:parse_BrtArrFmla }, + 0x01AB: { n:"BrtShrFmla", f:parse_BrtShrFmla }, + 0x01AC: { n:"BrtTable" }, + 0x01AD: { n:"BrtBeginExtConnections" }, + 0x01AE: { n:"BrtEndExtConnections" }, + 0x01AF: { n:"BrtBeginPCDCalcMems" }, + 0x01B0: { n:"BrtEndPCDCalcMems" }, + 0x01B1: { n:"BrtBeginPCDCalcMem" }, + 0x01B2: { n:"BrtEndPCDCalcMem" }, + 0x01B3: { n:"BrtBeginPCDHGLevels" }, + 0x01B4: { n:"BrtEndPCDHGLevels" }, + 0x01B5: { n:"BrtBeginPCDHGLevel" }, + 0x01B6: { n:"BrtEndPCDHGLevel" }, + 0x01B7: { n:"BrtBeginPCDHGLGroups" }, + 0x01B8: { n:"BrtEndPCDHGLGroups" }, + 0x01B9: { n:"BrtBeginPCDHGLGroup" }, + 0x01BA: { n:"BrtEndPCDHGLGroup" }, + 0x01BB: { n:"BrtBeginPCDHGLGMembers" }, + 0x01BC: { n:"BrtEndPCDHGLGMembers" }, + 0x01BD: { n:"BrtBeginPCDHGLGMember" }, + 0x01BE: { n:"BrtEndPCDHGLGMember" }, + 0x01BF: { n:"BrtBeginQSI" }, + 0x01C0: { n:"BrtEndQSI" }, + 0x01C1: { n:"BrtBeginQSIR" }, + 0x01C2: { n:"BrtEndQSIR" }, + 0x01C3: { n:"BrtBeginDeletedNames" }, + 0x01C4: { n:"BrtEndDeletedNames" }, + 0x01C5: { n:"BrtBeginDeletedName" }, + 0x01C6: { n:"BrtEndDeletedName" }, + 0x01C7: { n:"BrtBeginQSIFs" }, + 0x01C8: { n:"BrtEndQSIFs" }, + 0x01C9: { n:"BrtBeginQSIF" }, + 0x01CA: { n:"BrtEndQSIF" }, + 0x01CB: { n:"BrtBeginAutoSortScope" }, + 0x01CC: { n:"BrtEndAutoSortScope" }, + 0x01CD: { n:"BrtBeginConditionalFormatting" }, + 0x01CE: { n:"BrtEndConditionalFormatting" }, + 0x01CF: { n:"BrtBeginCFRule" }, + 0x01D0: { n:"BrtEndCFRule" }, + 0x01D1: { n:"BrtBeginIconSet" }, + 0x01D2: { n:"BrtEndIconSet" }, + 0x01D3: { n:"BrtBeginDatabar" }, + 0x01D4: { n:"BrtEndDatabar" }, + 0x01D5: { n:"BrtBeginColorScale" }, + 0x01D6: { n:"BrtEndColorScale" }, + 0x01D7: { n:"BrtCFVO" }, + 0x01D8: { n:"BrtExternValueMeta" }, + 0x01D9: { n:"BrtBeginColorPalette" }, + 0x01DA: { n:"BrtEndColorPalette" }, + 0x01DB: { n:"BrtIndexedColor" }, + 0x01DC: { n:"BrtMargins", f:parse_BrtMargins }, + 0x01DD: { n:"BrtPrintOptions" }, + 0x01DE: { n:"BrtPageSetup" }, + 0x01DF: { n:"BrtBeginHeaderFooter" }, + 0x01E0: { n:"BrtEndHeaderFooter" }, + 0x01E1: { n:"BrtBeginSXCrtFormat" }, + 0x01E2: { n:"BrtEndSXCrtFormat" }, + 0x01E3: { n:"BrtBeginSXCrtFormats" }, + 0x01E4: { n:"BrtEndSXCrtFormats" }, + 0x01E5: { n:"BrtWsFmtInfo", f:parse_BrtWsFmtInfo }, + 0x01E6: { n:"BrtBeginMgs" }, + 0x01E7: { n:"BrtEndMGs" }, + 0x01E8: { n:"BrtBeginMGMaps" }, + 0x01E9: { n:"BrtEndMGMaps" }, + 0x01EA: { n:"BrtBeginMG" }, + 0x01EB: { n:"BrtEndMG" }, + 0x01EC: { n:"BrtBeginMap" }, + 0x01ED: { n:"BrtEndMap" }, + 0x01EE: { n:"BrtHLink", f:parse_BrtHLink }, + 0x01EF: { n:"BrtBeginDCon" }, + 0x01F0: { n:"BrtEndDCon" }, + 0x01F1: { n:"BrtBeginDRefs" }, + 0x01F2: { n:"BrtEndDRefs" }, + 0x01F3: { n:"BrtDRef" }, + 0x01F4: { n:"BrtBeginScenMan" }, + 0x01F5: { n:"BrtEndScenMan" }, + 0x01F6: { n:"BrtBeginSct" }, + 0x01F7: { n:"BrtEndSct" }, + 0x01F8: { n:"BrtSlc" }, + 0x01F9: { n:"BrtBeginDXFs" }, + 0x01FA: { n:"BrtEndDXFs" }, + 0x01FB: { n:"BrtDXF" }, + 0x01FC: { n:"BrtBeginTableStyles" }, + 0x01FD: { n:"BrtEndTableStyles" }, + 0x01FE: { n:"BrtBeginTableStyle" }, + 0x01FF: { n:"BrtEndTableStyle" }, + 0x0200: { n:"BrtTableStyleElement" }, + 0x0201: { n:"BrtTableStyleClient" }, + 0x0202: { n:"BrtBeginVolDeps" }, + 0x0203: { n:"BrtEndVolDeps" }, + 0x0204: { n:"BrtBeginVolType" }, + 0x0205: { n:"BrtEndVolType" }, + 0x0206: { n:"BrtBeginVolMain" }, + 0x0207: { n:"BrtEndVolMain" }, + 0x0208: { n:"BrtBeginVolTopic" }, + 0x0209: { n:"BrtEndVolTopic" }, + 0x020A: { n:"BrtVolSubtopic" }, + 0x020B: { n:"BrtVolRef" }, + 0x020C: { n:"BrtVolNum" }, + 0x020D: { n:"BrtVolErr" }, + 0x020E: { n:"BrtVolStr" }, + 0x020F: { n:"BrtVolBool" }, + 0x0210: { n:"BrtBeginCalcChain$" }, + 0x0211: { n:"BrtEndCalcChain$" }, + 0x0212: { n:"BrtBeginSortState" }, + 0x0213: { n:"BrtEndSortState" }, + 0x0214: { n:"BrtBeginSortCond" }, + 0x0215: { n:"BrtEndSortCond" }, + 0x0216: { n:"BrtBookProtection" }, + 0x0217: { n:"BrtSheetProtection" }, + 0x0218: { n:"BrtRangeProtection" }, + 0x0219: { n:"BrtPhoneticInfo" }, + 0x021A: { n:"BrtBeginECTxtWiz" }, + 0x021B: { n:"BrtEndECTxtWiz" }, + 0x021C: { n:"BrtBeginECTWFldInfoLst" }, + 0x021D: { n:"BrtEndECTWFldInfoLst" }, + 0x021E: { n:"BrtBeginECTwFldInfo" }, + 0x0224: { n:"BrtFileSharing" }, + 0x0225: { n:"BrtOleSize" }, + 0x0226: { n:"BrtDrawing", f:parse_RelID }, + 0x0227: { n:"BrtLegacyDrawing" }, + 0x0228: { n:"BrtLegacyDrawingHF" }, + 0x0229: { n:"BrtWebOpt" }, + 0x022A: { n:"BrtBeginWebPubItems" }, + 0x022B: { n:"BrtEndWebPubItems" }, + 0x022C: { n:"BrtBeginWebPubItem" }, + 0x022D: { n:"BrtEndWebPubItem" }, + 0x022E: { n:"BrtBeginSXCondFmt" }, + 0x022F: { n:"BrtEndSXCondFmt" }, + 0x0230: { n:"BrtBeginSXCondFmts" }, + 0x0231: { n:"BrtEndSXCondFmts" }, + 0x0232: { n:"BrtBkHim" }, + 0x0234: { n:"BrtColor" }, + 0x0235: { n:"BrtBeginIndexedColors" }, + 0x0236: { n:"BrtEndIndexedColors" }, + 0x0239: { n:"BrtBeginMRUColors" }, + 0x023A: { n:"BrtEndMRUColors" }, + 0x023C: { n:"BrtMRUColor" }, + 0x023D: { n:"BrtBeginDVals" }, + 0x023E: { n:"BrtEndDVals" }, + 0x0241: { n:"BrtSupNameStart" }, + 0x0242: { n:"BrtSupNameValueStart" }, + 0x0243: { n:"BrtSupNameValueEnd" }, + 0x0244: { n:"BrtSupNameNum" }, + 0x0245: { n:"BrtSupNameErr" }, + 0x0246: { n:"BrtSupNameSt" }, + 0x0247: { n:"BrtSupNameNil" }, + 0x0248: { n:"BrtSupNameBool" }, + 0x0249: { n:"BrtSupNameFmla" }, + 0x024A: { n:"BrtSupNameBits" }, + 0x024B: { n:"BrtSupNameEnd" }, + 0x024C: { n:"BrtEndSupBook" }, + 0x024D: { n:"BrtCellSmartTagProperty" }, + 0x024E: { n:"BrtBeginCellSmartTag" }, + 0x024F: { n:"BrtEndCellSmartTag" }, + 0x0250: { n:"BrtBeginCellSmartTags" }, + 0x0251: { n:"BrtEndCellSmartTags" }, + 0x0252: { n:"BrtBeginSmartTags" }, + 0x0253: { n:"BrtEndSmartTags" }, + 0x0254: { n:"BrtSmartTagType" }, + 0x0255: { n:"BrtBeginSmartTagTypes" }, + 0x0256: { n:"BrtEndSmartTagTypes" }, + 0x0257: { n:"BrtBeginSXFilters" }, + 0x0258: { n:"BrtEndSXFilters" }, + 0x0259: { n:"BrtBeginSXFILTER" }, + 0x025A: { n:"BrtEndSXFilter" }, + 0x025B: { n:"BrtBeginFills" }, + 0x025C: { n:"BrtEndFills" }, + 0x025D: { n:"BrtBeginCellWatches" }, + 0x025E: { n:"BrtEndCellWatches" }, + 0x025F: { n:"BrtCellWatch" }, + 0x0260: { n:"BrtBeginCRErrs" }, + 0x0261: { n:"BrtEndCRErrs" }, + 0x0262: { n:"BrtCrashRecErr" }, + 0x0263: { n:"BrtBeginFonts" }, + 0x0264: { n:"BrtEndFonts" }, + 0x0265: { n:"BrtBeginBorders" }, + 0x0266: { n:"BrtEndBorders" }, + 0x0267: { n:"BrtBeginFmts" }, + 0x0268: { n:"BrtEndFmts" }, + 0x0269: { n:"BrtBeginCellXFs" }, + 0x026A: { n:"BrtEndCellXFs" }, + 0x026B: { n:"BrtBeginStyles" }, + 0x026C: { n:"BrtEndStyles" }, + 0x0271: { n:"BrtBigName" }, + 0x0272: { n:"BrtBeginCellStyleXFs" }, + 0x0273: { n:"BrtEndCellStyleXFs" }, + 0x0274: { n:"BrtBeginComments" }, + 0x0275: { n:"BrtEndComments" }, + 0x0276: { n:"BrtBeginCommentAuthors" }, + 0x0277: { n:"BrtEndCommentAuthors" }, + 0x0278: { n:"BrtCommentAuthor", f:parse_BrtCommentAuthor }, + 0x0279: { n:"BrtBeginCommentList" }, + 0x027A: { n:"BrtEndCommentList" }, + 0x027B: { n:"BrtBeginComment", f:parse_BrtBeginComment}, + 0x027C: { n:"BrtEndComment" }, + 0x027D: { n:"BrtCommentText", f:parse_BrtCommentText }, + 0x027E: { n:"BrtBeginOleObjects" }, + 0x027F: { n:"BrtOleObject" }, + 0x0280: { n:"BrtEndOleObjects" }, + 0x0281: { n:"BrtBeginSxrules" }, + 0x0282: { n:"BrtEndSxRules" }, + 0x0283: { n:"BrtBeginActiveXControls" }, + 0x0284: { n:"BrtActiveX" }, + 0x0285: { n:"BrtEndActiveXControls" }, + 0x0286: { n:"BrtBeginPCDSDTCEMembersSortBy" }, + 0x0288: { n:"BrtBeginCellIgnoreECs" }, + 0x0289: { n:"BrtCellIgnoreEC" }, + 0x028A: { n:"BrtEndCellIgnoreECs" }, + 0x028B: { n:"BrtCsProp", f:parse_BrtCsProp }, + 0x028C: { n:"BrtCsPageSetup" }, + 0x028D: { n:"BrtBeginUserCsViews" }, + 0x028E: { n:"BrtEndUserCsViews" }, + 0x028F: { n:"BrtBeginUserCsView" }, + 0x0290: { n:"BrtEndUserCsView" }, + 0x0291: { n:"BrtBeginPcdSFCIEntries" }, + 0x0292: { n:"BrtEndPCDSFCIEntries" }, + 0x0293: { n:"BrtPCDSFCIEntry" }, + 0x0294: { n:"BrtBeginListParts" }, + 0x0295: { n:"BrtListPart" }, + 0x0296: { n:"BrtEndListParts" }, + 0x0297: { n:"BrtSheetCalcProp" }, + 0x0298: { n:"BrtBeginFnGroup" }, + 0x0299: { n:"BrtFnGroup" }, + 0x029A: { n:"BrtEndFnGroup" }, + 0x029B: { n:"BrtSupAddin" }, + 0x029C: { n:"BrtSXTDMPOrder" }, + 0x029D: { n:"BrtCsProtection" }, + 0x029F: { n:"BrtBeginWsSortMap" }, + 0x02A0: { n:"BrtEndWsSortMap" }, + 0x02A1: { n:"BrtBeginRRSort" }, + 0x02A2: { n:"BrtEndRRSort" }, + 0x02A3: { n:"BrtRRSortItem" }, + 0x02A4: { n:"BrtFileSharingIso" }, + 0x02A5: { n:"BrtBookProtectionIso" }, + 0x02A6: { n:"BrtSheetProtectionIso" }, + 0x02A7: { n:"BrtCsProtectionIso" }, + 0x02A8: { n:"BrtRangeProtectionIso" }, + 0x0400: { n:"BrtRwDescent" }, + 0x0401: { n:"BrtKnownFonts" }, + 0x0402: { n:"BrtBeginSXTupleSet" }, + 0x0403: { n:"BrtEndSXTupleSet" }, + 0x0404: { n:"BrtBeginSXTupleSetHeader" }, + 0x0405: { n:"BrtEndSXTupleSetHeader" }, + 0x0406: { n:"BrtSXTupleSetHeaderItem" }, + 0x0407: { n:"BrtBeginSXTupleSetData" }, + 0x0408: { n:"BrtEndSXTupleSetData" }, + 0x0409: { n:"BrtBeginSXTupleSetRow" }, + 0x040A: { n:"BrtEndSXTupleSetRow" }, + 0x040B: { n:"BrtSXTupleSetRowItem" }, + 0x040C: { n:"BrtNameExt" }, + 0x040D: { n:"BrtPCDH14" }, + 0x040E: { n:"BrtBeginPCDCalcMem14" }, + 0x040F: { n:"BrtEndPCDCalcMem14" }, + 0x0410: { n:"BrtSXTH14" }, + 0x0411: { n:"BrtBeginSparklineGroup" }, + 0x0412: { n:"BrtEndSparklineGroup" }, + 0x0413: { n:"BrtSparkline" }, + 0x0414: { n:"BrtSXDI14" }, + 0x0415: { n:"BrtWsFmtInfoEx14" }, + 0x0416: { n:"BrtBeginConditionalFormatting14" }, + 0x0417: { n:"BrtEndConditionalFormatting14" }, + 0x0418: { n:"BrtBeginCFRule14" }, + 0x0419: { n:"BrtEndCFRule14" }, + 0x041A: { n:"BrtCFVO14" }, + 0x041B: { n:"BrtBeginDatabar14" }, + 0x041C: { n:"BrtBeginIconSet14" }, + 0x041D: { n:"BrtDVal14" }, + 0x041E: { n:"BrtBeginDVals14" }, + 0x041F: { n:"BrtColor14" }, + 0x0420: { n:"BrtBeginSparklines" }, + 0x0421: { n:"BrtEndSparklines" }, + 0x0422: { n:"BrtBeginSparklineGroups" }, + 0x0423: { n:"BrtEndSparklineGroups" }, + 0x0425: { n:"BrtSXVD14" }, + 0x0426: { n:"BrtBeginSXView14" }, + 0x0427: { n:"BrtEndSXView14" }, + 0x0428: { n:"BrtBeginSXView16" }, + 0x0429: { n:"BrtEndSXView16" }, + 0x042A: { n:"BrtBeginPCD14" }, + 0x042B: { n:"BrtEndPCD14" }, + 0x042C: { n:"BrtBeginExtConn14" }, + 0x042D: { n:"BrtEndExtConn14" }, + 0x042E: { n:"BrtBeginSlicerCacheIDs" }, + 0x042F: { n:"BrtEndSlicerCacheIDs" }, + 0x0430: { n:"BrtBeginSlicerCacheID" }, + 0x0431: { n:"BrtEndSlicerCacheID" }, + 0x0433: { n:"BrtBeginSlicerCache" }, + 0x0434: { n:"BrtEndSlicerCache" }, + 0x0435: { n:"BrtBeginSlicerCacheDef" }, + 0x0436: { n:"BrtEndSlicerCacheDef" }, + 0x0437: { n:"BrtBeginSlicersEx" }, + 0x0438: { n:"BrtEndSlicersEx" }, + 0x0439: { n:"BrtBeginSlicerEx" }, + 0x043A: { n:"BrtEndSlicerEx" }, + 0x043B: { n:"BrtBeginSlicer" }, + 0x043C: { n:"BrtEndSlicer" }, + 0x043D: { n:"BrtSlicerCachePivotTables" }, + 0x043E: { n:"BrtBeginSlicerCacheOlapImpl" }, + 0x043F: { n:"BrtEndSlicerCacheOlapImpl" }, + 0x0440: { n:"BrtBeginSlicerCacheLevelsData" }, + 0x0441: { n:"BrtEndSlicerCacheLevelsData" }, + 0x0442: { n:"BrtBeginSlicerCacheLevelData" }, + 0x0443: { n:"BrtEndSlicerCacheLevelData" }, + 0x0444: { n:"BrtBeginSlicerCacheSiRanges" }, + 0x0445: { n:"BrtEndSlicerCacheSiRanges" }, + 0x0446: { n:"BrtBeginSlicerCacheSiRange" }, + 0x0447: { n:"BrtEndSlicerCacheSiRange" }, + 0x0448: { n:"BrtSlicerCacheOlapItem" }, + 0x0449: { n:"BrtBeginSlicerCacheSelections" }, + 0x044A: { n:"BrtSlicerCacheSelection" }, + 0x044B: { n:"BrtEndSlicerCacheSelections" }, + 0x044C: { n:"BrtBeginSlicerCacheNative" }, + 0x044D: { n:"BrtEndSlicerCacheNative" }, + 0x044E: { n:"BrtSlicerCacheNativeItem" }, + 0x044F: { n:"BrtRangeProtection14" }, + 0x0450: { n:"BrtRangeProtectionIso14" }, + 0x0451: { n:"BrtCellIgnoreEC14" }, + 0x0457: { n:"BrtList14" }, + 0x0458: { n:"BrtCFIcon" }, + 0x0459: { n:"BrtBeginSlicerCachesPivotCacheIDs" }, + 0x045A: { n:"BrtEndSlicerCachesPivotCacheIDs" }, + 0x045B: { n:"BrtBeginSlicers" }, + 0x045C: { n:"BrtEndSlicers" }, + 0x045D: { n:"BrtWbProp14" }, + 0x045E: { n:"BrtBeginSXEdit" }, + 0x045F: { n:"BrtEndSXEdit" }, + 0x0460: { n:"BrtBeginSXEdits" }, + 0x0461: { n:"BrtEndSXEdits" }, + 0x0462: { n:"BrtBeginSXChange" }, + 0x0463: { n:"BrtEndSXChange" }, + 0x0464: { n:"BrtBeginSXChanges" }, + 0x0465: { n:"BrtEndSXChanges" }, + 0x0466: { n:"BrtSXTupleItems" }, + 0x0468: { n:"BrtBeginSlicerStyle" }, + 0x0469: { n:"BrtEndSlicerStyle" }, + 0x046A: { n:"BrtSlicerStyleElement" }, + 0x046B: { n:"BrtBeginStyleSheetExt14" }, + 0x046C: { n:"BrtEndStyleSheetExt14" }, + 0x046D: { n:"BrtBeginSlicerCachesPivotCacheID" }, + 0x046E: { n:"BrtEndSlicerCachesPivotCacheID" }, + 0x046F: { n:"BrtBeginConditionalFormattings" }, + 0x0470: { n:"BrtEndConditionalFormattings" }, + 0x0471: { n:"BrtBeginPCDCalcMemExt" }, + 0x0472: { n:"BrtEndPCDCalcMemExt" }, + 0x0473: { n:"BrtBeginPCDCalcMemsExt" }, + 0x0474: { n:"BrtEndPCDCalcMemsExt" }, + 0x0475: { n:"BrtPCDField14" }, + 0x0476: { n:"BrtBeginSlicerStyles" }, + 0x0477: { n:"BrtEndSlicerStyles" }, + 0x0478: { n:"BrtBeginSlicerStyleElements" }, + 0x0479: { n:"BrtEndSlicerStyleElements" }, + 0x047A: { n:"BrtCFRuleExt" }, + 0x047B: { n:"BrtBeginSXCondFmt14" }, + 0x047C: { n:"BrtEndSXCondFmt14" }, + 0x047D: { n:"BrtBeginSXCondFmts14" }, + 0x047E: { n:"BrtEndSXCondFmts14" }, + 0x0480: { n:"BrtBeginSortCond14" }, + 0x0481: { n:"BrtEndSortCond14" }, + 0x0482: { n:"BrtEndDVals14" }, + 0x0483: { n:"BrtEndIconSet14" }, + 0x0484: { n:"BrtEndDatabar14" }, + 0x0485: { n:"BrtBeginColorScale14" }, + 0x0486: { n:"BrtEndColorScale14" }, + 0x0487: { n:"BrtBeginSxrules14" }, + 0x0488: { n:"BrtEndSxrules14" }, + 0x0489: { n:"BrtBeginPRule14" }, + 0x048A: { n:"BrtEndPRule14" }, + 0x048B: { n:"BrtBeginPRFilters14" }, + 0x048C: { n:"BrtEndPRFilters14" }, + 0x048D: { n:"BrtBeginPRFilter14" }, + 0x048E: { n:"BrtEndPRFilter14" }, + 0x048F: { n:"BrtBeginPRFItem14" }, + 0x0490: { n:"BrtEndPRFItem14" }, + 0x0491: { n:"BrtBeginCellIgnoreECs14" }, + 0x0492: { n:"BrtEndCellIgnoreECs14" }, + 0x0493: { n:"BrtDxf14" }, + 0x0494: { n:"BrtBeginDxF14s" }, + 0x0495: { n:"BrtEndDxf14s" }, + 0x0499: { n:"BrtFilter14" }, + 0x049A: { n:"BrtBeginCustomFilters14" }, + 0x049C: { n:"BrtCustomFilter14" }, + 0x049D: { n:"BrtIconFilter14" }, + 0x049E: { n:"BrtPivotCacheConnectionName" }, + 0x0800: { n:"BrtBeginDecoupledPivotCacheIDs" }, + 0x0801: { n:"BrtEndDecoupledPivotCacheIDs" }, + 0x0802: { n:"BrtDecoupledPivotCacheID" }, + 0x0803: { n:"BrtBeginPivotTableRefs" }, + 0x0804: { n:"BrtEndPivotTableRefs" }, + 0x0805: { n:"BrtPivotTableRef" }, + 0x0806: { n:"BrtSlicerCacheBookPivotTables" }, + 0x0807: { n:"BrtBeginSxvcells" }, + 0x0808: { n:"BrtEndSxvcells" }, + 0x0809: { n:"BrtBeginSxRow" }, + 0x080A: { n:"BrtEndSxRow" }, + 0x080C: { n:"BrtPcdCalcMem15" }, + 0x0813: { n:"BrtQsi15" }, + 0x0814: { n:"BrtBeginWebExtensions" }, + 0x0815: { n:"BrtEndWebExtensions" }, + 0x0816: { n:"BrtWebExtension" }, + 0x0817: { n:"BrtAbsPath15" }, + 0x0818: { n:"BrtBeginPivotTableUISettings" }, + 0x0819: { n:"BrtEndPivotTableUISettings" }, + 0x081B: { n:"BrtTableSlicerCacheIDs" }, + 0x081C: { n:"BrtTableSlicerCacheID" }, + 0x081D: { n:"BrtBeginTableSlicerCache" }, + 0x081E: { n:"BrtEndTableSlicerCache" }, + 0x081F: { n:"BrtSxFilter15" }, + 0x0820: { n:"BrtBeginTimelineCachePivotCacheIDs" }, + 0x0821: { n:"BrtEndTimelineCachePivotCacheIDs" }, + 0x0822: { n:"BrtTimelineCachePivotCacheID" }, + 0x0823: { n:"BrtBeginTimelineCacheIDs" }, + 0x0824: { n:"BrtEndTimelineCacheIDs" }, + 0x0825: { n:"BrtBeginTimelineCacheID" }, + 0x0826: { n:"BrtEndTimelineCacheID" }, + 0x0827: { n:"BrtBeginTimelinesEx" }, + 0x0828: { n:"BrtEndTimelinesEx" }, + 0x0829: { n:"BrtBeginTimelineEx" }, + 0x082A: { n:"BrtEndTimelineEx" }, + 0x082B: { n:"BrtWorkBookPr15" }, + 0x082C: { n:"BrtPCDH15" }, + 0x082D: { n:"BrtBeginTimelineStyle" }, + 0x082E: { n:"BrtEndTimelineStyle" }, + 0x082F: { n:"BrtTimelineStyleElement" }, + 0x0830: { n:"BrtBeginTimelineStylesheetExt15" }, + 0x0831: { n:"BrtEndTimelineStylesheetExt15" }, + 0x0832: { n:"BrtBeginTimelineStyles" }, + 0x0833: { n:"BrtEndTimelineStyles" }, + 0x0834: { n:"BrtBeginTimelineStyleElements" }, + 0x0835: { n:"BrtEndTimelineStyleElements" }, + 0x0836: { n:"BrtDxf15" }, + 0x0837: { n:"BrtBeginDxfs15" }, + 0x0838: { n:"brtEndDxfs15" }, + 0x0839: { n:"BrtSlicerCacheHideItemsWithNoData" }, + 0x083A: { n:"BrtBeginItemUniqueNames" }, + 0x083B: { n:"BrtEndItemUniqueNames" }, + 0x083C: { n:"BrtItemUniqueName" }, + 0x083D: { n:"BrtBeginExtConn15" }, + 0x083E: { n:"BrtEndExtConn15" }, + 0x083F: { n:"BrtBeginOledbPr15" }, + 0x0840: { n:"BrtEndOledbPr15" }, + 0x0841: { n:"BrtBeginDataFeedPr15" }, + 0x0842: { n:"BrtEndDataFeedPr15" }, + 0x0843: { n:"BrtTextPr15" }, + 0x0844: { n:"BrtRangePr15" }, + 0x0845: { n:"BrtDbCommand15" }, + 0x0846: { n:"BrtBeginDbTables15" }, + 0x0847: { n:"BrtEndDbTables15" }, + 0x0848: { n:"BrtDbTable15" }, + 0x0849: { n:"BrtBeginDataModel" }, + 0x084A: { n:"BrtEndDataModel" }, + 0x084B: { n:"BrtBeginModelTables" }, + 0x084C: { n:"BrtEndModelTables" }, + 0x084D: { n:"BrtModelTable" }, + 0x084E: { n:"BrtBeginModelRelationships" }, + 0x084F: { n:"BrtEndModelRelationships" }, + 0x0850: { n:"BrtModelRelationship" }, + 0x0851: { n:"BrtBeginECTxtWiz15" }, + 0x0852: { n:"BrtEndECTxtWiz15" }, + 0x0853: { n:"BrtBeginECTWFldInfoLst15" }, + 0x0854: { n:"BrtEndECTWFldInfoLst15" }, + 0x0855: { n:"BrtBeginECTWFldInfo15" }, + 0x0856: { n:"BrtFieldListActiveItem" }, + 0x0857: { n:"BrtPivotCacheIdVersion" }, + 0x0858: { n:"BrtSXDI15" }, + 0x0859: { n:"BrtBeginModelTimeGroupings" }, + 0x085A: { n:"BrtEndModelTimeGroupings" }, + 0x085B: { n:"BrtBeginModelTimeGrouping" }, + 0x085C: { n:"BrtEndModelTimeGrouping" }, + 0x085D: { n:"BrtModelTimeGroupingCalcCol" }, + 0x0C00: { n:"BrtUid" }, + 0x0C01: { n:"BrtRevisionPtr" }, + 0x13e7: { n:"BrtBeginCalcFeatures" }, + 0x13e8: { n:"BrtEndCalcFeatures" }, + 0x13e9: { n:"BrtCalcFeature" }, + 0xFFFF: { n:"" } + }; + + var XLSBRE = evert_key(XLSBRecordEnum, 'n'); + + /* [MS-XLS] 2.3 Record Enumeration */ + var XLSRecordEnum = { + 0x0003: { n:"BIFF2NUM", f:parse_BIFF2NUM }, + 0x0004: { n:"BIFF2STR", f:parse_BIFF2STR }, + 0x0006: { n:"Formula", f:parse_Formula }, + 0x0009: { n:'BOF', f:parse_BOF }, + 0x000a: { n:'EOF', f:parsenoop2 }, + 0x000c: { n:"CalcCount", f:parseuint16 }, + 0x000d: { n:"CalcMode", f:parseuint16 }, + 0x000e: { n:"CalcPrecision", f:parsebool }, + 0x000f: { n:"CalcRefMode", f:parsebool }, + 0x0010: { n:"CalcDelta", f:parse_Xnum }, + 0x0011: { n:"CalcIter", f:parsebool }, + 0x0012: { n:"Protect", f:parsebool }, + 0x0013: { n:"Password", f:parseuint16 }, + 0x0014: { n:"Header", f:parse_XLHeaderFooter }, + 0x0015: { n:"Footer", f:parse_XLHeaderFooter }, + 0x0017: { n:"ExternSheet", f:parse_ExternSheet }, + 0x0018: { n:"Lbl", f:parse_Lbl }, + 0x0019: { n:"WinProtect", f:parsebool }, + 0x001a: { n:"VerticalPageBreaks" }, + 0x001b: { n:"HorizontalPageBreaks" }, + 0x001c: { n:"Note", f:parse_Note }, + 0x001d: { n:"Selection" }, + 0x0022: { n:"Date1904", f:parsebool }, + 0x0023: { n:"ExternName", f:parse_ExternName }, + 0x0026: { n:"LeftMargin", f:parse_Xnum }, + 0x0027: { n:"RightMargin", f:parse_Xnum }, + 0x0028: { n:"TopMargin", f:parse_Xnum }, + 0x0029: { n:"BottomMargin", f:parse_Xnum }, + 0x002a: { n:"PrintRowCol", f:parsebool }, + 0x002b: { n:"PrintGrid", f:parsebool }, + 0x002f: { n:"FilePass", f:parse_FilePass }, + 0x0031: { n:"Font", f:parse_Font }, + 0x0033: { n:"PrintSize", f:parseuint16 }, + 0x003c: { n:"Continue" }, + 0x003d: { n:"Window1", f:parse_Window1 }, + 0x0040: { n:"Backup", f:parsebool }, + 0x0041: { n:"Pane" }, + 0x0042: { n:'CodePage', f:parseuint16 }, + 0x004d: { n:"Pls" }, + 0x0050: { n:"DCon" }, + 0x0051: { n:"DConRef" }, + 0x0052: { n:"DConName" }, + 0x0055: { n:"DefColWidth", f:parseuint16 }, + 0x0059: { n:"XCT" }, + 0x005a: { n:"CRN" }, + 0x005b: { n:"FileSharing" }, + 0x005c: { n:'WriteAccess', f:parse_WriteAccess }, + 0x005d: { n:"Obj", f:parse_Obj }, + 0x005e: { n:"Uncalced" }, + 0x005f: { n:"CalcSaveRecalc", f:parsebool }, + 0x0060: { n:"Template" }, + 0x0061: { n:"Intl" }, + 0x0063: { n:"ObjProtect", f:parsebool }, + 0x007d: { n:"ColInfo", f:parse_ColInfo }, + 0x0080: { n:"Guts", f:parse_Guts }, + 0x0081: { n:"WsBool", f:parse_WsBool }, + 0x0082: { n:"GridSet", f:parseuint16 }, + 0x0083: { n:"HCenter", f:parsebool }, + 0x0084: { n:"VCenter", f:parsebool }, + 0x0085: { n:'BoundSheet8', f:parse_BoundSheet8 }, + 0x0086: { n:"WriteProtect" }, + 0x008c: { n:"Country", f:parse_Country }, + 0x008d: { n:"HideObj", f:parseuint16 }, + 0x0090: { n:"Sort" }, + 0x0092: { n:"Palette", f:parse_Palette }, + 0x0097: { n:"Sync" }, + 0x0098: { n:"LPr" }, + 0x0099: { n:"DxGCol" }, + 0x009a: { n:"FnGroupName" }, + 0x009b: { n:"FilterMode" }, + 0x009c: { n:"BuiltInFnGroupCount", f:parseuint16 }, + 0x009d: { n:"AutoFilterInfo" }, + 0x009e: { n:"AutoFilter" }, + 0x00a0: { n:"Scl", f:parse_Scl }, + 0x00a1: { n:"Setup", f:parse_Setup }, + 0x00ae: { n:"ScenMan" }, + 0x00af: { n:"SCENARIO" }, + 0x00b0: { n:"SxView" }, + 0x00b1: { n:"Sxvd" }, + 0x00b2: { n:"SXVI" }, + 0x00b4: { n:"SxIvd" }, + 0x00b5: { n:"SXLI" }, + 0x00b6: { n:"SXPI" }, + 0x00b8: { n:"DocRoute" }, + 0x00b9: { n:"RecipName" }, + 0x00bd: { n:"MulRk", f:parse_MulRk }, + 0x00be: { n:"MulBlank", f:parse_MulBlank }, + 0x00c1: { n:'Mms', f:parsenoop2 }, + 0x00c5: { n:"SXDI" }, + 0x00c6: { n:"SXDB" }, + 0x00c7: { n:"SXFDB" }, + 0x00c8: { n:"SXDBB" }, + 0x00c9: { n:"SXNum" }, + 0x00ca: { n:"SxBool", f:parsebool }, + 0x00cb: { n:"SxErr" }, + 0x00cc: { n:"SXInt" }, + 0x00cd: { n:"SXString" }, + 0x00ce: { n:"SXDtr" }, + 0x00cf: { n:"SxNil" }, + 0x00d0: { n:"SXTbl" }, + 0x00d1: { n:"SXTBRGIITM" }, + 0x00d2: { n:"SxTbpg" }, + 0x00d3: { n:"ObProj" }, + 0x00d5: { n:"SXStreamID" }, + 0x00d7: { n:"DBCell" }, + 0x00d8: { n:"SXRng" }, + 0x00d9: { n:"SxIsxoper" }, + 0x00da: { n:"BookBool", f:parseuint16 }, + 0x00dc: { n:"DbOrParamQry" }, + 0x00dd: { n:"ScenarioProtect", f:parsebool }, + 0x00de: { n:"OleObjectSize" }, + 0x00e0: { n:"XF", f:parse_XF }, + 0x00e1: { n:'InterfaceHdr', f:parse_InterfaceHdr }, + 0x00e2: { n:'InterfaceEnd', f:parsenoop2 }, + 0x00e3: { n:"SXVS" }, + 0x00e5: { n:"MergeCells", f:parse_MergeCells }, + 0x00e9: { n:"BkHim" }, + 0x00eb: { n:"MsoDrawingGroup" }, + 0x00ec: { n:"MsoDrawing" }, + 0x00ed: { n:"MsoDrawingSelection" }, + 0x00ef: { n:"PhoneticInfo" }, + 0x00f0: { n:"SxRule" }, + 0x00f1: { n:"SXEx" }, + 0x00f2: { n:"SxFilt" }, + 0x00f4: { n:"SxDXF" }, + 0x00f5: { n:"SxItm" }, + 0x00f6: { n:"SxName" }, + 0x00f7: { n:"SxSelect" }, + 0x00f8: { n:"SXPair" }, + 0x00f9: { n:"SxFmla" }, + 0x00fb: { n:"SxFormat" }, + 0x00fc: { n:"SST", f:parse_SST }, + 0x00fd: { n:"LabelSst", f:parse_LabelSst }, + 0x00ff: { n:"ExtSST", f:parse_ExtSST }, + 0x0100: { n:"SXVDEx" }, + 0x0103: { n:"SXFormula" }, + 0x0122: { n:"SXDBEx" }, + 0x0137: { n:"RRDInsDel" }, + 0x0138: { n:"RRDHead" }, + 0x013b: { n:"RRDChgCell" }, + 0x013d: { n:"RRTabId", f:parseuint16a }, + 0x013e: { n:"RRDRenSheet" }, + 0x013f: { n:"RRSort" }, + 0x0140: { n:"RRDMove" }, + 0x014a: { n:"RRFormat" }, + 0x014b: { n:"RRAutoFmt" }, + 0x014d: { n:"RRInsertSh" }, + 0x014e: { n:"RRDMoveBegin" }, + 0x014f: { n:"RRDMoveEnd" }, + 0x0150: { n:"RRDInsDelBegin" }, + 0x0151: { n:"RRDInsDelEnd" }, + 0x0152: { n:"RRDConflict" }, + 0x0153: { n:"RRDDefName" }, + 0x0154: { n:"RRDRstEtxp" }, + 0x015f: { n:"LRng" }, + 0x0160: { n:"UsesELFs", f:parsebool }, + 0x0161: { n:"DSF", f:parsenoop2 }, + 0x0191: { n:"CUsr" }, + 0x0192: { n:"CbUsr" }, + 0x0193: { n:"UsrInfo" }, + 0x0194: { n:"UsrExcl" }, + 0x0195: { n:"FileLock" }, + 0x0196: { n:"RRDInfo" }, + 0x0197: { n:"BCUsrs" }, + 0x0198: { n:"UsrChk" }, + 0x01a9: { n:"UserBView" }, + 0x01aa: { n:"UserSViewBegin" }, + 0x01ab: { n:"UserSViewEnd" }, + 0x01ac: { n:"RRDUserView" }, + 0x01ad: { n:"Qsi" }, + 0x01ae: { n:"SupBook", f:parse_SupBook }, + 0x01af: { n:"Prot4Rev", f:parsebool }, + 0x01b0: { n:"CondFmt" }, + 0x01b1: { n:"CF" }, + 0x01b2: { n:"DVal" }, + 0x01b5: { n:"DConBin" }, + 0x01b6: { n:"TxO", f:parse_TxO }, + 0x01b7: { n:"RefreshAll", f:parsebool }, + 0x01b8: { n:"HLink", f:parse_HLink }, + 0x01b9: { n:"Lel" }, + 0x01ba: { n:"CodeName", f:parse_XLUnicodeString }, + 0x01bb: { n:"SXFDBType" }, + 0x01bc: { n:"Prot4RevPass", f:parseuint16 }, + 0x01bd: { n:"ObNoMacros" }, + 0x01be: { n:"Dv" }, + 0x01c0: { n:"Excel9File", f:parsenoop2 }, + 0x01c1: { n:"RecalcId", f:parse_RecalcId, r:2}, + 0x01c2: { n:"EntExU2", f:parsenoop2 }, + 0x0200: { n:"Dimensions", f:parse_Dimensions }, + 0x0201: { n:"Blank", f:parse_Blank }, + 0x0203: { n:"Number", f:parse_Number }, + 0x0204: { n:"Label", f:parse_Label }, + 0x0205: { n:"BoolErr", f:parse_BoolErr }, + 0x0206: { n:"Formula", f:parse_Formula }, + 0x0207: { n:"String", f:parse_String }, + 0x0208: { n:'Row', f:parse_Row }, + 0x020b: { n:"Index" }, + 0x0221: { n:"Array", f:parse_Array }, + 0x0225: { n:"DefaultRowHeight", f:parse_DefaultRowHeight }, + 0x0236: { n:"Table" }, + 0x023e: { n:"Window2", f:parse_Window2 }, + 0x027e: { n:"RK", f:parse_RK }, + 0x0293: { n:"Style" }, + 0x0406: { n:"Formula", f:parse_Formula }, + 0x0418: { n:"BigName" }, + 0x041e: { n:"Format", f:parse_Format }, + 0x043c: { n:"ContinueBigName" }, + 0x04bc: { n:"ShrFmla", f:parse_ShrFmla }, + 0x0800: { n:"HLinkTooltip", f:parse_HLinkTooltip }, + 0x0801: { n:"WebPub" }, + 0x0802: { n:"QsiSXTag" }, + 0x0803: { n:"DBQueryExt" }, + 0x0804: { n:"ExtString" }, + 0x0805: { n:"TxtQry" }, + 0x0806: { n:"Qsir" }, + 0x0807: { n:"Qsif" }, + 0x0808: { n:"RRDTQSIF" }, + 0x0809: { n:'BOF', f:parse_BOF }, + 0x080a: { n:"OleDbConn" }, + 0x080b: { n:"WOpt" }, + 0x080c: { n:"SXViewEx" }, + 0x080d: { n:"SXTH" }, + 0x080e: { n:"SXPIEx" }, + 0x080f: { n:"SXVDTEx" }, + 0x0810: { n:"SXViewEx9" }, + 0x0812: { n:"ContinueFrt" }, + 0x0813: { n:"RealTimeData" }, + 0x0850: { n:"ChartFrtInfo" }, + 0x0851: { n:"FrtWrapper" }, + 0x0852: { n:"StartBlock" }, + 0x0853: { n:"EndBlock" }, + 0x0854: { n:"StartObject" }, + 0x0855: { n:"EndObject" }, + 0x0856: { n:"CatLab" }, + 0x0857: { n:"YMult" }, + 0x0858: { n:"SXViewLink" }, + 0x0859: { n:"PivotChartBits" }, + 0x085a: { n:"FrtFontList" }, + 0x0862: { n:"SheetExt" }, + 0x0863: { n:"BookExt", r:12}, + 0x0864: { n:"SXAddl" }, + 0x0865: { n:"CrErr" }, + 0x0866: { n:"HFPicture" }, + 0x0867: { n:'FeatHdr', f:parsenoop2 }, + 0x0868: { n:"Feat" }, + 0x086a: { n:"DataLabExt" }, + 0x086b: { n:"DataLabExtContents" }, + 0x086c: { n:"CellWatch" }, + 0x0871: { n:"FeatHdr11" }, + 0x0872: { n:"Feature11" }, + 0x0874: { n:"DropDownObjIds" }, + 0x0875: { n:"ContinueFrt11" }, + 0x0876: { n:"DConn" }, + 0x0877: { n:"List12" }, + 0x0878: { n:"Feature12" }, + 0x0879: { n:"CondFmt12" }, + 0x087a: { n:"CF12" }, + 0x087b: { n:"CFEx" }, + 0x087c: { n:"XFCRC", f:parse_XFCRC, r:12 }, + 0x087d: { n:"XFExt", f:parse_XFExt, r:12 }, + 0x087e: { n:"AutoFilter12" }, + 0x087f: { n:"ContinueFrt12" }, + 0x0884: { n:"MDTInfo" }, + 0x0885: { n:"MDXStr" }, + 0x0886: { n:"MDXTuple" }, + 0x0887: { n:"MDXSet" }, + 0x0888: { n:"MDXProp" }, + 0x0889: { n:"MDXKPI" }, + 0x088a: { n:"MDB" }, + 0x088b: { n:"PLV" }, + 0x088c: { n:"Compat12", f:parsebool, r:12 }, + 0x088d: { n:"DXF" }, + 0x088e: { n:"TableStyles", r:12 }, + 0x088f: { n:"TableStyle" }, + 0x0890: { n:"TableStyleElement" }, + 0x0892: { n:"StyleExt" }, + 0x0893: { n:"NamePublish" }, + 0x0894: { n:"NameCmt", f:parse_NameCmt, r:12 }, + 0x0895: { n:"SortData" }, + 0x0896: { n:"Theme", f:parse_Theme, r:12 }, + 0x0897: { n:"GUIDTypeLib" }, + 0x0898: { n:"FnGrp12" }, + 0x0899: { n:"NameFnGrp12" }, + 0x089a: { n:"MTRSettings", f:parse_MTRSettings, r:12 }, + 0x089b: { n:"CompressPictures", f:parsenoop2 }, + 0x089c: { n:"HeaderFooter" }, + 0x089d: { n:"CrtLayout12" }, + 0x089e: { n:"CrtMlFrt" }, + 0x089f: { n:"CrtMlFrtContinue" }, + 0x08a3: { n:"ForceFullCalculation", f:parse_ForceFullCalculation }, + 0x08a4: { n:"ShapePropsStream" }, + 0x08a5: { n:"TextPropsStream" }, + 0x08a6: { n:"RichTextStream" }, + 0x08a7: { n:"CrtLayout12A" }, + 0x1001: { n:"Units" }, + 0x1002: { n:"Chart" }, + 0x1003: { n:"Series" }, + 0x1006: { n:"DataFormat" }, + 0x1007: { n:"LineFormat" }, + 0x1009: { n:"MarkerFormat" }, + 0x100a: { n:"AreaFormat" }, + 0x100b: { n:"PieFormat" }, + 0x100c: { n:"AttachedLabel" }, + 0x100d: { n:"SeriesText" }, + 0x1014: { n:"ChartFormat" }, + 0x1015: { n:"Legend" }, + 0x1016: { n:"SeriesList" }, + 0x1017: { n:"Bar" }, + 0x1018: { n:"Line" }, + 0x1019: { n:"Pie" }, + 0x101a: { n:"Area" }, + 0x101b: { n:"Scatter" }, + 0x101c: { n:"CrtLine" }, + 0x101d: { n:"Axis" }, + 0x101e: { n:"Tick" }, + 0x101f: { n:"ValueRange" }, + 0x1020: { n:"CatSerRange" }, + 0x1021: { n:"AxisLine" }, + 0x1022: { n:"CrtLink" }, + 0x1024: { n:"DefaultText" }, + 0x1025: { n:"Text" }, + 0x1026: { n:"FontX", f:parseuint16 }, + 0x1027: { n:"ObjectLink" }, + 0x1032: { n:"Frame" }, + 0x1033: { n:"Begin" }, + 0x1034: { n:"End" }, + 0x1035: { n:"PlotArea" }, + 0x103a: { n:"Chart3d" }, + 0x103c: { n:"PicF" }, + 0x103d: { n:"DropBar" }, + 0x103e: { n:"Radar" }, + 0x103f: { n:"Surf" }, + 0x1040: { n:"RadarArea" }, + 0x1041: { n:"AxisParent" }, + 0x1043: { n:"LegendException" }, + 0x1044: { n:"ShtProps", f:parse_ShtProps }, + 0x1045: { n:"SerToCrt" }, + 0x1046: { n:"AxesUsed" }, + 0x1048: { n:"SBaseRef" }, + 0x104a: { n:"SerParent" }, + 0x104b: { n:"SerAuxTrend" }, + 0x104e: { n:"IFmtRecord" }, + 0x104f: { n:"Pos" }, + 0x1050: { n:"AlRuns" }, + 0x1051: { n:"BRAI" }, + 0x105b: { n:"SerAuxErrBar" }, + 0x105c: { n:"ClrtClient", f:parse_ClrtClient }, + 0x105d: { n:"SerFmt" }, + 0x105f: { n:"Chart3DBarShape" }, + 0x1060: { n:"Fbi" }, + 0x1061: { n:"BopPop" }, + 0x1062: { n:"AxcExt" }, + 0x1063: { n:"Dat" }, + 0x1064: { n:"PlotGrowth" }, + 0x1065: { n:"SIIndex" }, + 0x1066: { n:"GelFrame" }, + 0x1067: { n:"BopPopCustom" }, + 0x1068: { n:"Fbi2" }, + + 0x0000: { n:"Dimensions", f:parse_Dimensions }, + 0x0002: { n:"BIFF2INT", f:parse_BIFF2INT }, + 0x0005: { n:"BoolErr", f:parse_BoolErr }, + 0x0007: { n:"String", f:parse_BIFF2STRING }, + 0x0008: { n:"BIFF2ROW" }, + 0x000b: { n:"Index" }, + 0x0016: { n:"ExternCount", f:parseuint16 }, + 0x001e: { n:"BIFF2FORMAT", f:parse_BIFF2Format }, + 0x001f: { n:"BIFF2FMTCNT" }, /* 16-bit cnt of BIFF2FORMAT records */ + 0x0020: { n:"BIFF2COLINFO" }, + 0x0021: { n:"Array", f:parse_Array }, + 0x0025: { n:"DefaultRowHeight", f:parse_DefaultRowHeight }, + 0x0032: { n:"BIFF2FONTXTRA", f:parse_BIFF2FONTXTRA }, + 0x0034: { n:"DDEObjName" }, + 0x003e: { n:"BIFF2WINDOW2" }, + 0x0043: { n:"BIFF2XF" }, + 0x0045: { n:"BIFF2FONTCLR" }, + 0x0056: { n:"BIFF4FMTCNT" }, /* 16-bit cnt, similar to BIFF2 */ + 0x007e: { n:"RK" }, /* Not necessarily same as 0x027e */ + 0x007f: { n:"ImData", f:parse_ImData }, + 0x0087: { n:"Addin" }, + 0x0088: { n:"Edg" }, + 0x0089: { n:"Pub" }, + 0x0091: { n:"Sub" }, + 0x0094: { n:"LHRecord" }, + 0x0095: { n:"LHNGraph" }, + 0x0096: { n:"Sound" }, + 0x00a9: { n:"CoordList" }, + 0x00ab: { n:"GCW" }, + 0x00bc: { n:"ShrFmla" }, /* Not necessarily same as 0x04bc */ + 0x00bf: { n:"ToolbarHdr" }, + 0x00c0: { n:"ToolbarEnd" }, + 0x00c2: { n:"AddMenu" }, + 0x00c3: { n:"DelMenu" }, + 0x00d6: { n:"RString", f:parse_RString }, + 0x00df: { n:"UDDesc" }, + 0x00ea: { n:"TabIdConf" }, + 0x0162: { n:"XL5Modify" }, + 0x01a5: { n:"FileSharing2" }, + 0x0209: { n:'BOF', f:parse_BOF }, + 0x0218: { n:"Lbl", f:parse_Lbl }, + 0x0223: { n:"ExternName", f:parse_ExternName }, + 0x0231: { n:"Font" }, + 0x0243: { n:"BIFF3XF" }, + 0x0409: { n:'BOF', f:parse_BOF }, + 0x0443: { n:"BIFF4XF" }, + 0x086d: { n:"FeatInfo" }, + 0x0873: { n:"FeatInfo11" }, + 0x0881: { n:"SXAddl12" }, + 0x08c0: { n:"AutoWebPub" }, + 0x08c1: { n:"ListObj" }, + 0x08c2: { n:"ListField" }, + 0x08c3: { n:"ListDV" }, + 0x08c4: { n:"ListCondFmt" }, + 0x08c5: { n:"ListCF" }, + 0x08c6: { n:"FMQry" }, + 0x08c7: { n:"FMSQry" }, + 0x08c8: { n:"PLV" }, + 0x08c9: { n:"LnExt" }, + 0x08ca: { n:"MkrExt" }, + 0x08cb: { n:"CrtCoopt" }, + 0x08d6: { n:"FRTArchId$", r:12 }, + + 0x7262: {} + }; + + var XLSRE = evert_key(XLSRecordEnum, 'n'); + function write_biff_rec(ba, type, payload, length) { + var t = +type || +XLSRE[type]; + if(isNaN(t)) return; + var len = length || (payload||[]).length || 0; + var o = ba.next(4); + o.write_shift(2, t); + o.write_shift(2, len); + if(len > 0 && is_buf(payload)) ba.push(payload); + } + + function write_BIFF2Cell(out, r, c) { + if(!out) out = new_buf(7); + out.write_shift(2, r); + out.write_shift(2, c); + out.write_shift(2, 0); + out.write_shift(1, 0); + return out; + } + + function write_BIFF2BERR(r, c, val, t) { + var out = new_buf(9); + write_BIFF2Cell(out, r, c); + if(t == 'e') { out.write_shift(1, val); out.write_shift(1, 1); } + else { out.write_shift(1, val?1:0); out.write_shift(1, 0); } + return out; + } + + /* TODO: codepage, large strings */ + function write_BIFF2LABEL(r, c, val) { + var out = new_buf(8 + 2*val.length); + write_BIFF2Cell(out, r, c); + out.write_shift(1, val.length); + out.write_shift(val.length, val, 'sbcs'); + return out.l < out.length ? out.slice(0, out.l) : out; + } + + function write_ws_biff2_cell(ba, cell, R, C) { + if(cell.v != null) switch(cell.t) { + case 'd': case 'n': + var v = cell.t == 'd' ? datenum(parseDate(cell.v)) : cell.v; + if((v == (v|0)) && (v >= 0) && (v < 65536)) + write_biff_rec(ba, 0x0002, write_BIFF2INT(R, C, v)); + else + write_biff_rec(ba, 0x0003, write_BIFF2NUM(R,C, v)); + return; + case 'b': case 'e': write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, cell.v, cell.t)); return; + /* TODO: codepage, sst */ + case 's': case 'str': + write_biff_rec(ba, 0x0004, write_BIFF2LABEL(R, C, cell.v)); + return; + } + write_biff_rec(ba, 0x0001, write_BIFF2Cell(null, R, C)); + } + + function write_ws_biff2(ba, ws, idx, opts) { + var dense = Array.isArray(ws); + var range = safe_decode_range(ws['!ref'] || "A1"), ref, rr = "", cols = []; + if(range.e.c > 0xFF || range.e.r > 0x3FFF) { + if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); + range.e.c = Math.min(range.e.c, 0xFF); + range.e.r = Math.min(range.e.c, 0x3FFF); + ref = encode_range(range); + } + for(var R = range.s.r; R <= range.e.r; ++R) { + rr = encode_row(R); + for(var C = range.s.c; C <= range.e.c; ++C) { + if(R === range.s.r) cols[C] = encode_col(C); + ref = cols[C] + rr; + var cell = dense ? (ws[R]||[])[C] : ws[ref]; + if(!cell) continue; + /* write cell */ + write_ws_biff2_cell(ba, cell, R, C, opts); + } + } + } + + /* Based on test files */ + function write_biff2_buf(wb, opts) { + var o = opts || {}; + if(DENSE != null && o.dense == null) o.dense = DENSE; + var ba = buf_array(); + var idx = 0; + for(var i=0;i 0xFF || range.e.r >= MAX_ROWS) { + if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); + range.e.c = Math.min(range.e.c, 0xFF); + range.e.r = Math.min(range.e.c, MAX_ROWS-1); + } + + write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts)); + /* ... */ + write_biff_rec(ba, "CalcMode", writeuint16(1)); + write_biff_rec(ba, "CalcCount", writeuint16(100)); + write_biff_rec(ba, "CalcRefMode", writebool(true)); + write_biff_rec(ba, "CalcIter", writebool(false)); + write_biff_rec(ba, "CalcDelta", write_Xnum(0.001)); + write_biff_rec(ba, "CalcSaveRecalc", writebool(true)); + write_biff_rec(ba, "PrintRowCol", writebool(false)); + write_biff_rec(ba, "PrintGrid", writebool(false)); + write_biff_rec(ba, "GridSet", writeuint16(1)); + write_biff_rec(ba, "Guts", write_Guts([0,0])); + /* ... */ + write_biff_rec(ba, "HCenter", writebool(false)); + write_biff_rec(ba, "VCenter", writebool(false)); + /* ... */ + write_biff_rec(ba, 0x200, write_Dimensions(range, opts)); + /* ... */ + + if(b8) ws['!links'] = []; + for(var R = range.s.r; R <= range.e.r; ++R) { + rr = encode_row(R); + for(var C = range.s.c; C <= range.e.c; ++C) { + if(R === range.s.r) cols[C] = encode_col(C); + ref = cols[C] + rr; + var cell = dense ? (ws[R]||[])[C] : ws[ref]; + if(!cell) continue; + /* write cell */ + write_ws_biff8_cell(ba, cell, R, C, opts); + if(b8 && cell.l) ws['!links'].push([ref, cell.l]); + } + } + var cname = _sheet.CodeName || _sheet.name || s; + /* ... */ + if(b8 && _WB.Views) write_biff_rec(ba, "Window2", write_Window2(_WB.Views[0])); + /* ... */ + if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, "MergeCells", write_MergeCells(ws['!merges'])); + /* ... */ + if(b8) write_ws_biff8_hlinks(ba, ws); + /* ... */ + write_biff_rec(ba, "CodeName", write_XLUnicodeString(cname, opts)); + /* ... */ + if(b8) write_FEAT(ba, ws); + /* ... */ + write_biff_rec(ba, "EOF"); + return ba.end(); + } + + /* [MS-XLS] 2.1.7.20.3 */ + function write_biff8_global(wb, bufs, opts) { + var A = buf_array(); + var _WB = ((wb||{}).Workbook||{}); + var _sheets = (_WB.Sheets||[]); + var _wb = _WB.WBProps||{}; + var b8 = opts.biff == 8, b5 = opts.biff == 5; + write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts)); + if(opts.bookType == "xla") write_biff_rec(A, "Addin"); + write_biff_rec(A, "InterfaceHdr", b8 ? writeuint16(0x04b0) : null); + write_biff_rec(A, "Mms", writezeroes(2)); + if(b5) write_biff_rec(A, "ToolbarHdr"); + if(b5) write_biff_rec(A, "ToolbarEnd"); + write_biff_rec(A, "InterfaceEnd"); + write_biff_rec(A, "WriteAccess", write_WriteAccess("SheetJS", opts)); + write_biff_rec(A, "CodePage", writeuint16(b8 ? 0x04b0 : 0x04E4)); + if(b8) write_biff_rec(A, "DSF", writeuint16(0)); + if(b8) write_biff_rec(A, "Excel9File"); + write_biff_rec(A, "RRTabId", write_RRTabId(wb.SheetNames.length)); + if(b8 && wb.vbaraw) { + write_biff_rec(A, "ObProj"); + var cname = _wb.CodeName || "ThisWorkbook"; + write_biff_rec(A, "CodeName", write_XLUnicodeString(cname, opts)); + } + write_biff_rec(A, "BuiltInFnGroupCount", writeuint16(0x11)); + write_biff_rec(A, "WinProtect", writebool(false)); + write_biff_rec(A, "Protect", writebool(false)); + write_biff_rec(A, "Password", writeuint16(0)); + if(b8) write_biff_rec(A, "Prot4Rev", writebool(false)); + if(b8) write_biff_rec(A, "Prot4RevPass", writeuint16(0)); + write_biff_rec(A, "Window1", write_Window1(opts)); + write_biff_rec(A, "Backup", writebool(false)); + write_biff_rec(A, "HideObj", writeuint16(0)); + write_biff_rec(A, "Date1904", writebool(safe1904(wb)=="true")); + write_biff_rec(A, "CalcPrecision", writebool(true)); + if(b8) write_biff_rec(A, "RefreshAll", writebool(false)); + write_biff_rec(A, "BookBool", writeuint16(0)); + /* ... */ + write_FONTS_biff8(A, wb, opts); + write_FMTS_biff8(A, wb.SSF, opts); + write_CELLXFS_biff8(A, opts); + /* ... */ + if(b8) write_biff_rec(A, "UsesELFs", writebool(false)); + var a = A.end(); + + var C = buf_array(); + if(b8) write_biff_rec(C, "Country", write_Country()); + /* BIFF8: [SST *Continue] ExtSST */ + write_biff_rec(C, "EOF"); + var c = C.end(); + + var B = buf_array(); + var blen = 0, j = 0; + for(j = 0; j < wb.SheetNames.length; ++j) blen += (b8 ? 12 : 11) + (b8 ? 2 : 1) * wb.SheetNames[j].length; + var start = a.length + blen + c.length; + for(j = 0; j < wb.SheetNames.length; ++j) { + var _sheet = _sheets[j] || ({}); + write_biff_rec(B, "BoundSheet8", write_BoundSheet8({pos:start, hs:_sheet.Hidden||0, dt:0, name:wb.SheetNames[j]}, opts)); + start += bufs[j].length; + } + /* 1*BoundSheet8 */ + var b = B.end(); + if(blen != b.length) throw new Error("BS8 " + blen + " != " + b.length); + + var out = []; + if(a.length) out.push(a); + if(b.length) out.push(b); + if(c.length) out.push(c); + return __toBuffer([out]); + } + + /* [MS-XLS] 2.1.7.20 Workbook Stream */ + function write_biff8_buf(wb, opts) { + var o = opts || {}; + var bufs = []; + + if(wb && !wb.SSF) { + wb.SSF = SSF.get_table(); + } + if(wb && wb.SSF) { + make_ssf(SSF); SSF.load_table(wb.SSF); + // $FlowIgnore + o.revssf = evert_num(wb.SSF); o.revssf[wb.SSF[65535]] = 0; + o.ssf = wb.SSF; + } + o.cellXfs = []; + o.Strings = []; o.Strings.Count = 0; o.Strings.Unique = 0; + get_cell_style(o.cellXfs, {}, {revssf:{"General":0}}); + + for(var i = 0; i < wb.SheetNames.length; ++i) bufs[bufs.length] = write_ws_biff8(i, o, wb); + bufs.unshift(write_biff8_global(wb, bufs, o)); + return __toBuffer([bufs]); + } + + function write_biff_buf(wb, opts) { + var o = opts || {}; + switch(o.biff || 2) { + case 8: case 5: return write_biff8_buf(wb, opts); + case 4: case 3: case 2: return write_biff2_buf(wb, opts); + } + throw new Error("invalid type " + o.bookType + " for BIFF"); + } + /* note: browser DOM element cannot see mso- style attrs, must parse */ + var HTML_ = (function() { + function html_to_sheet(str, _opts) { + var opts = _opts || {}; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var ws = opts.dense ? ([]) : ({}); + var mtch = str.match(/"); + var mtch2 = str.match(/<\/table/i); + var i = mtch.index, j = mtch2 && mtch2.index || str.length; + var rows = split_regex(str.slice(i, j), /(:?]*>)/i, ""); + var R = -1, C = 0, RS = 0, CS = 0; + var range = {s:{r:10000000, c:10000000},e:{r:0,c:0}}; + var merges = []; + for(i = 0; i < rows.length; ++i) { + var row = rows[i].trim(); + var hd = row.slice(0,3).toLowerCase(); + if(hd == "/i); + for(j = 0; j < cells.length; ++j) { + var cell = cells[j].trim(); + if(!cell.match(/")) > -1) m = m.slice(cc+1); + var tag = parsexmltag(cell.slice(0, cell.indexOf(">"))); + CS = tag.colspan ? +tag.colspan : 1; + if((RS = +tag.rowspan)>1 || CS>1) merges.push({s:{r:R,c:C},e:{r:R + (RS||1) - 1, c:C + CS - 1}}); + var _t = tag.t || ""; + /* TODO: generate stub cells */ + if(!m.length) { C += CS; continue; } + m = htmldecode(m); + if(range.s.r > R) range.s.r = R; if(range.e.r < R) range.e.r = R; + if(range.s.c > C) range.s.c = C; if(range.e.c < C) range.e.c = C; + if(!m.length) continue; + var o = {t:'s', v:m}; + if(opts.raw || !m.trim().length || _t == 's'){} + else if(m === 'TRUE') o = {t:'b', v:true}; + else if(m === 'FALSE') o = {t:'b', v:false}; + else if(!isNaN(fuzzynum(m))) o = {t:'n', v:fuzzynum(m)}; + else if(!isNaN(fuzzydate(m).getDate())) { + o = ({t:'d', v:parseDate(m)}); + if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}); + o.z = opts.dateNF || SSF._table[14]; + } + if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = o; } + else ws[encode_cell({r:R, c:C})] = o; + C += CS; + } + } + ws['!ref'] = encode_range(range); + return ws; + } + function html_to_book(str, opts) { + return sheet_to_workbook(html_to_sheet(str, opts), opts); + } + function make_html_row(ws, r, R, o) { + var M = (ws['!merges'] ||[]); + var oo = []; + for(var C = r.s.c; C <= r.e.c; ++C) { + var RS = 0, CS = 0; + for(var j = 0; j < M.length; ++j) { + if(M[j].s.r > R || M[j].s.c > C) continue; + if(M[j].e.r < R || M[j].e.c < C) continue; + if(M[j].s.r < R || M[j].s.c < C) { RS = -1; break; } + RS = M[j].e.r - M[j].s.r + 1; CS = M[j].e.c - M[j].s.c + 1; break; + } + if(RS < 0) continue; + var coord = encode_cell({r:R,c:C}); + var cell = o.dense ? (ws[R]||[])[C] : ws[coord]; + var sp = {}; + if(RS > 1) sp.rowspan = RS; + if(CS > 1) sp.colspan = CS; + /* TODO: html entities */ + var w = (cell && cell.v != null) && (cell.h || escapehtml(cell.w || (format_cell(cell), cell.w) || "")) || ""; + sp.t = cell && cell.t || 'z'; + if(o.editable) w = '' + w + ''; + sp.id = "sjs-" + coord; + oo.push(writextag('td', w, sp)); + } + var preamble = ""; + return preamble + oo.join("") + ""; + } + function make_html_preamble(ws, R, o) { + var out = []; + return out.join("") + ''; + } + var _BEGIN = 'SheetJS Table Export'; + var _END = ''; + function sheet_to_html(ws, opts/*, wb:?Workbook*/) { + var o = opts || {}; + var header = o.header != null ? o.header : _BEGIN; + var footer = o.footer != null ? o.footer : _END; + var out = [header]; + var r = decode_range(ws['!ref']); + o.dense = Array.isArray(ws); + out.push(make_html_preamble(ws, r, o)); + for(var R = r.s.r; R <= r.e.r; ++R) out.push(make_html_row(ws, r, R, o)); + out.push("
          " + footer); + return out.join(""); + } + + return { + to_workbook: html_to_book, + to_sheet: html_to_sheet, + _row: make_html_row, + BEGIN: _BEGIN, + END: _END, + _preamble: make_html_preamble, + from_sheet: sheet_to_html + }; + })(); + + function parse_dom_table(table, _opts) { + var opts = _opts || {}; + if(DENSE != null) opts.dense = DENSE; + var ws = opts.dense ? ([]) : ({}); + var rows = table.getElementsByTagName('tr'); + var sheetRows = opts.sheetRows || 10000000; + var range = {s:{r:0,c:0},e:{r:0,c:0}}; + var merges = [], midx = 0; + var rowinfo = []; + var _R = 0, R = 0, _C, C, RS, CS; + for(; _R < rows.length && R < sheetRows; ++_R) { + var row = rows[_R]; + if (is_dom_element_hidden(row)) { + if (opts.display) continue; + rowinfo[R] = {hidden: true}; + } + var elts = (row.children); + for(_C = C = 0; _C < elts.length; ++_C) { + var elt = elts[_C]; + if (opts.display && is_dom_element_hidden(elt)) continue; + var v = htmldecode(elt.innerHTML); + for(midx = 0; midx < merges.length; ++midx) { + var m = merges[midx]; + if(m.s.c == C && m.s.r <= R && R <= m.e.r) { C = m.e.c+1; midx = -1; } + } + /* TODO: figure out how to extract nonstandard mso- style */ + CS = +elt.getAttribute("colspan") || 1; + if((RS = +elt.getAttribute("rowspan"))>0 || CS>1) merges.push({s:{r:R,c:C},e:{r:R + (RS||1) - 1, c:C + CS - 1}}); + var o = {t:'s', v:v}; + var _t = elt.getAttribute("t") || ""; + if(v != null) { + if(v.length == 0) o.t = _t || 'z'; + else if(opts.raw || v.trim().length == 0 || _t == "s"){} + else if(v === 'TRUE') o = {t:'b', v:true}; + else if(v === 'FALSE') o = {t:'b', v:false}; + else if(!isNaN(fuzzynum(v))) o = {t:'n', v:fuzzynum(v)}; + else if(!isNaN(fuzzydate(v).getDate())) { + o = ({t:'d', v:parseDate(v)}); + if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}); + o.z = opts.dateNF || SSF._table[14]; + } + } + if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = o; } + else ws[encode_cell({c:C, r:R})] = o; + if(range.e.c < C) range.e.c = C; + C += CS; + } + ++R; + } + if(merges.length) ws['!merges'] = merges; + if(rowinfo.length) ws['!rows'] = rowinfo; + range.e.r = R - 1; + ws['!ref'] = encode_range(range); + if(R >= sheetRows) ws['!fullref'] = encode_range((range.e.r = rows.length-_R+R-1,range)); // We can count the real number of rows to parse but we don't to improve the performance + return ws; + } + + function table_to_book(table, opts) { + return sheet_to_workbook(parse_dom_table(table, opts), opts); + } + + function is_dom_element_hidden(element) { + var display = ''; + var get_computed_style = get_get_computed_style_function(element); + if(get_computed_style) display = get_computed_style(element).getPropertyValue('display'); + if(!display) display = element.style.display; // Fallback for cases when getComputedStyle is not available (e.g. an old browser or some Node.js environments) or doesn't work (e.g. if the element is not inserted to a document) + return display === 'none'; + } + + /* global getComputedStyle */ + function get_get_computed_style_function(element) { + // The proper getComputedStyle implementation is the one defined in the element window + if(element.ownerDocument.defaultView && typeof element.ownerDocument.defaultView.getComputedStyle === 'function') return element.ownerDocument.defaultView.getComputedStyle; + // If it is not available, try to get one from the global namespace + if(typeof getComputedStyle === 'function') return getComputedStyle; + return null; + } + /* OpenDocument */ + var parse_content_xml = (function() { + + var parse_text_p = function(text) { + /* 6.1.2 White Space Characters */ + var fixed = text + .replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ") + .replace(//g," ") + .replace(//g, function($$,$1) { return Array(parseInt($1,10)+1).join(" "); }) + .replace(/]*\/>/g,"\t") + .replace(//g,"\n"); + var v = unescapexml(fixed.replace(/<[^>]*>/g,"")); + + return [v]; + }; + + var number_formats = { + /* ods name: [short ssf fmt, long ssf fmt] */ + day: ["d", "dd"], + month: ["m", "mm"], + year: ["y", "yy"], + hours: ["h", "hh"], + minutes: ["m", "mm"], + seconds: ["s", "ss"], + "am-pm": ["A/P", "AM/PM"], + "day-of-week": ["ddd", "dddd"], + era: ["e", "ee"], + /* there is no native representation of LO "Q" format */ + quarter: ["\\Qm", "m\\\"th quarter\""] + }; + + return function pcx(d, _opts) { + var opts = _opts || {}; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var str = xlml_normalize(d); + var state = [], tmp; + var tag; + var NFtag = {name:""}, NF = "", pidx = 0; + var sheetag; + var rowtag; + var Sheets = {}, SheetNames = []; + var ws = opts.dense ? ([]) : ({}); + var Rn, q; + var ctag = ({value:""}); + var textp = "", textpidx = 0, textptag; + var textR = []; + var R = -1, C = -1, range = {s: {r:1000000,c:10000000}, e: {r:0, c:0}}; + var row_ol = 0; + var number_format_map = {}; + var merges = [], mrange = {}, mR = 0, mC = 0; + var rowinfo = [], rowpeat = 1, colpeat = 1; + var arrayf = []; + var WB = {Names:[]}; + var atag = ({}); + var _Ref = ["", ""]; + var comments = [], comment = ({}); + var creator = "", creatoridx = 0; + var isstub = false, intable = false; + var i = 0; + xlmlregex.lastIndex = 0; + str = str.replace(//mg,"").replace(//gm,""); + while((Rn = xlmlregex.exec(str))) switch((Rn[3]=Rn[3].replace(/_.*$/,""))) { + + case 'table': case '工作表': // 9.1.2 + if(Rn[1]==='/') { + if(range.e.c >= range.s.c && range.e.r >= range.s.r) ws['!ref'] = encode_range(range); + if(opts.sheetRows > 0 && opts.sheetRows <= range.e.r) { + ws['!fullref'] = ws['!ref']; + range.e.r = opts.sheetRows - 1; + ws['!ref'] = encode_range(range); + } + if(merges.length) ws['!merges'] = merges; + if(rowinfo.length) ws["!rows"] = rowinfo; + sheetag.name = sheetag['名称'] || sheetag.name; + if(typeof JSON !== 'undefined') JSON.stringify(sheetag); + SheetNames.push(sheetag.name); + Sheets[sheetag.name] = ws; + intable = false; + } + else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + sheetag = parsexmltag(Rn[0], false); + R = C = -1; + range.s.r = range.s.c = 10000000; range.e.r = range.e.c = 0; + ws = opts.dense ? ([]) : ({}); merges = []; + rowinfo = []; + intable = true; + } + break; + + case 'table-row-group': // 9.1.9 + if(Rn[1] === "/") --row_ol; else ++row_ol; + break; + case 'table-row': case '行': // 9.1.3 + if(Rn[1] === '/') { R+=rowpeat; rowpeat = 1; break; } + rowtag = parsexmltag(Rn[0], false); + if(rowtag['行号']) R = rowtag['行号'] - 1; else if(R == -1) R = 0; + rowpeat = +rowtag['number-rows-repeated'] || 1; + /* TODO: remove magic */ + if(rowpeat < 10) for(i = 0; i < rowpeat; ++i) if(row_ol > 0) rowinfo[R + i] = {level: row_ol}; + C = -1; break; + case 'covered-table-cell': // 9.1.5 + if(Rn[1] !== '/') ++C; + if(opts.sheetStubs) { + if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = {t:'z'}; } + else ws[encode_cell({r:R,c:C})] = {t:'z'}; + } + textp = ""; textR = []; + break; /* stub */ + case 'table-cell': case '数据': + if(Rn[0].charAt(Rn[0].length-2) === '/') { + ++C; + ctag = parsexmltag(Rn[0], false); + colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); + q = ({t:'z', v:null}); + if(ctag.formula && opts.cellFormula != false) q.f = ods_to_csf_formula(unescapexml(ctag.formula)); + if((ctag['数据类型'] || ctag['value-type']) == "string") { + q.t = "s"; q.v = unescapexml(ctag['string-value'] || ""); + if(opts.dense) { + if(!ws[R]) ws[R] = []; + ws[R][C] = q; + } else { + ws[encode_cell({r:R,c:C})] = q; + } + } + C+= colpeat-1; + } else if(Rn[1]!=='/') { + ++C; + colpeat = 1; + var rptR = rowpeat ? R + rowpeat - 1 : R; + if(C > range.e.c) range.e.c = C; + if(C < range.s.c) range.s.c = C; + if(R < range.s.r) range.s.r = R; + if(rptR > range.e.r) range.e.r = rptR; + ctag = parsexmltag(Rn[0], false); + comments = []; comment = ({}); + q = ({t:ctag['数据类型'] || ctag['value-type'], v:null}); + if(opts.cellFormula) { + if(ctag.formula) ctag.formula = unescapexml(ctag.formula); + if(ctag['number-matrix-columns-spanned'] && ctag['number-matrix-rows-spanned']) { + mR = parseInt(ctag['number-matrix-rows-spanned'],10) || 0; + mC = parseInt(ctag['number-matrix-columns-spanned'],10) || 0; + mrange = {s: {r:R,c:C}, e:{r:R + mR-1,c:C + mC-1}}; + q.F = encode_range(mrange); + arrayf.push([mrange, q.F]); + } + if(ctag.formula) q.f = ods_to_csf_formula(ctag.formula); + else for(i = 0; i < arrayf.length; ++i) + if(R >= arrayf[i][0].s.r && R <= arrayf[i][0].e.r) + if(C >= arrayf[i][0].s.c && C <= arrayf[i][0].e.c) + q.F = arrayf[i][1]; + } + if(ctag['number-columns-spanned'] || ctag['number-rows-spanned']) { + mR = parseInt(ctag['number-rows-spanned'],10) || 0; + mC = parseInt(ctag['number-columns-spanned'],10) || 0; + mrange = {s: {r:R,c:C}, e:{r:R + mR-1,c:C + mC-1}}; + merges.push(mrange); + } + + /* 19.675.2 table:number-columns-repeated */ + if(ctag['number-columns-repeated']) colpeat = parseInt(ctag['number-columns-repeated'], 10); + + /* 19.385 office:value-type */ + switch(q.t) { + case 'boolean': q.t = 'b'; q.v = parsexmlbool(ctag['boolean-value']); break; + case 'float': q.t = 'n'; q.v = parseFloat(ctag.value); break; + case 'percentage': q.t = 'n'; q.v = parseFloat(ctag.value); break; + case 'currency': q.t = 'n'; q.v = parseFloat(ctag.value); break; + case 'date': q.t = 'd'; q.v = parseDate(ctag['date-value']); + if(!opts.cellDates) { q.t = 'n'; q.v = datenum(q.v); } + q.z = 'm/d/yy'; break; + case 'time': q.t = 'n'; q.v = parse_isodur(ctag['time-value'])/86400; break; + case 'number': q.t = 'n'; q.v = parseFloat(ctag['数据数值']); break; + default: + if(q.t === 'string' || q.t === 'text' || !q.t) { + q.t = 's'; + if(ctag['string-value'] != null) { textp = unescapexml(ctag['string-value']); textR = []; } + } else throw new Error('Unsupported value type ' + q.t); + } + } else { + isstub = false; + if(q.t === 's') { + q.v = textp || ''; + if(textR.length) q.R = textR; + isstub = textpidx == 0; + } + if(atag.Target) q.l = atag; + if(comments.length > 0) { q.c = comments; comments = []; } + if(textp && opts.cellText !== false) q.w = textp; + if(!isstub || opts.sheetStubs) { + if(!(opts.sheetRows && opts.sheetRows <= R)) { + for(var rpt = 0; rpt < rowpeat; ++rpt) { + colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); + if(opts.dense) { + if(!ws[R + rpt]) ws[R + rpt] = []; + ws[R + rpt][C] = rpt == 0 ? q : dup(q); + while(--colpeat > 0) ws[R + rpt][C + colpeat] = dup(q); + } else { + ws[encode_cell({r:R + rpt,c:C})] = q; + while(--colpeat > 0) ws[encode_cell({r:R + rpt,c:C + colpeat})] = dup(q); + } + if(range.e.c <= C) range.e.c = C; + } + } + } + colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); + C += colpeat-1; colpeat = 0; + q = {}; + textp = ""; textR = []; + } + atag = ({}); + break; // 9.1.4 + + /* pure state */ + case 'document': // TODO: is the root for FODS + case 'document-content': case '电子表格文档': // 3.1.3.2 + case 'spreadsheet': case '主体': // 3.7 + case 'scripts': // 3.12 + case 'styles': // TODO + case 'font-face-decls': // 3.14 + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); + break; + + case 'annotation': // 14.1 + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp; + comment.t = textp; + if(textR.length) comment.R = textR; + comment.a = creator; + comments.push(comment); + } + else if(Rn[0].charAt(Rn[0].length-2) !== '/') {state.push([Rn[3], false]);} + creator = ""; creatoridx = 0; + textp = ""; textpidx = 0; textR = []; + break; + + case 'creator': // 4.3.2.7 + if(Rn[1]==='/') { creator = str.slice(creatoridx,Rn.index); } + else creatoridx = Rn.index + Rn[0].length; + break; + + /* ignore state */ + case 'meta': case '元数据': // TODO: FODS/UOF + case 'settings': // TODO: + case 'config-item-set': // TODO: + case 'config-item-map-indexed': // TODO: + case 'config-item-map-entry': // TODO: + case 'config-item-map-named': // TODO: + case 'shapes': // 9.2.8 + case 'frame': // 10.4.2 + case 'text-box': // 10.4.3 + case 'image': // 10.4.4 + case 'data-pilot-tables': // 9.6.2 + case 'list-style': // 16.30 + case 'form': // 13.13 + case 'dde-links': // 9.8 + case 'event-listeners': // TODO + case 'chart': // TODO + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], false]); + textp = ""; textpidx = 0; textR = []; + break; + + case 'scientific-number': // TODO: + break; + case 'currency-symbol': // TODO: + break; + case 'currency-style': // TODO: + break; + case 'number-style': // 16.27.2 + case 'percentage-style': // 16.27.9 + case 'date-style': // 16.27.10 + case 'time-style': // 16.27.18 + if(Rn[1]==='/'){ + number_format_map[NFtag.name] = NF; + if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp; + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + NF = ""; + NFtag = parsexmltag(Rn[0], false); + state.push([Rn[3], true]); + } break; + + case 'script': break; // 3.13 + case 'libraries': break; // TODO: + case 'automatic-styles': break; // 3.15.3 + case 'master-styles': break; // TODO: + + case 'default-style': // TODO: + case 'page-layout': break; // TODO: + case 'style': // 16.2 + break; + case 'map': break; // 16.3 + case 'font-face': break; // 16.21 + + case 'paragraph-properties': break; // 17.6 + case 'table-properties': break; // 17.15 + case 'table-column-properties': break; // 17.16 + case 'table-row-properties': break; // 17.17 + case 'table-cell-properties': break; // 17.18 + + case 'number': // 16.27.3 + switch(state[state.length-1][0]) { + case 'time-style': + case 'date-style': + tag = parsexmltag(Rn[0], false); + NF += number_formats[Rn[3]][tag.style==='long'?1:0]; break; + } break; + + case 'fraction': break; // TODO 16.27.6 + + case 'day': // 16.27.11 + case 'month': // 16.27.12 + case 'year': // 16.27.13 + case 'era': // 16.27.14 + case 'day-of-week': // 16.27.15 + case 'week-of-year': // 16.27.16 + case 'quarter': // 16.27.17 + case 'hours': // 16.27.19 + case 'minutes': // 16.27.20 + case 'seconds': // 16.27.21 + case 'am-pm': // 16.27.22 + switch(state[state.length-1][0]) { + case 'time-style': + case 'date-style': + tag = parsexmltag(Rn[0], false); + NF += number_formats[Rn[3]][tag.style==='long'?1:0]; break; + } break; + + case 'boolean-style': break; // 16.27.23 + case 'boolean': break; // 16.27.24 + case 'text-style': break; // 16.27.25 + case 'text': // 16.27.26 + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") switch(state[state.length-1][0]) { + case 'number-style': + case 'date-style': + case 'time-style': + NF += str.slice(pidx, Rn.index); + break; + } + else pidx = Rn.index + Rn[0].length; + break; + + case 'named-range': // 9.4.12 + tag = parsexmltag(Rn[0], false); + _Ref = ods_to_csf_3D(tag['cell-range-address']); + var nrange = ({Name:tag.name, Ref:_Ref[0] + '!' + _Ref[1]}); + if(intable) nrange.Sheet = SheetNames.length; + WB.Names.push(nrange); + break; + + case 'text-content': break; // 16.27.27 + case 'text-properties': break; // 16.27.27 + case 'embedded-text': break; // 16.27.4 + + case 'body': case '电子表格': break; // 3.3 16.9.6 19.726.3 + + case 'forms': break; // 12.25.2 13.2 + case 'table-column': break; // 9.1.6 + case 'table-header-rows': break; // 9.1.7 + case 'table-rows': break; // 9.1.12 + /* TODO: outline levels */ + case 'table-column-group': break; // 9.1.10 + case 'table-header-columns': break; // 9.1.11 + case 'table-columns': break; // 9.1.12 + + case 'null-date': break; // 9.4.2 TODO: date1904 + + case 'graphic-properties': break; // 17.21 + case 'calculation-settings': break; // 9.4.1 + case 'named-expressions': break; // 9.4.11 + case 'label-range': break; // 9.4.9 + case 'label-ranges': break; // 9.4.10 + case 'named-expression': break; // 9.4.13 + case 'sort': break; // 9.4.19 + case 'sort-by': break; // 9.4.20 + case 'sort-groups': break; // 9.4.22 + + case 'tab': break; // 6.1.4 + case 'line-break': break; // 6.1.5 + case 'span': break; // 6.1.7 + case 'p': case '文本串': // 5.1.3 + if(Rn[1]==='/' && (!ctag || !ctag['string-value'])) { + var ptp = parse_text_p(str.slice(textpidx,Rn.index), textptag); + textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0]; + } else { textptag = parsexmltag(Rn[0], false); textpidx = Rn.index + Rn[0].length; } + break; // + case 's': break; // + + case 'database-range': // 9.4.15 + if(Rn[1]==='/') break; + try { + _Ref = ods_to_csf_3D(parsexmltag(Rn[0])['target-range-address']); + Sheets[_Ref[0]]['!autofilter'] = { ref:_Ref[1] }; + } catch(e) {/* empty */} + break; + + case 'date': break; // <*:date> + + case 'object': break; // 10.4.6.2 + case 'title': case '标题': break; // <*:title> OR + case 'desc': break; // <*:desc> + case 'binary-data': break; // 10.4.5 TODO: b64 blob + + /* 9.2 Advanced Tables */ + case 'table-source': break; // 9.2.6 + case 'scenario': break; // 9.2.6 + + case 'iteration': break; // 9.4.3 + case 'content-validations': break; // 9.4.4 + case 'filter': break; // 9.5.2 + case 'filter-and': break; // 9.5.3 + case 'filter-or': break; // 9.5.4 + case 'filter-condition': break; // 9.5.5 + + case 'list-level-style-bullet': break; // 16.31 + case 'page-count': break; // TODO + case 'time': break; // TODO + + /* 9.3 Advanced Table Cells */ + case 'cell-range-source': break; // 9.3.1 + case 'property': break; // 13.8 + + case 'a': // 6.1.8 hyperlink + if(Rn[1]!== '/') { + atag = parsexmltag(Rn[0], false); + if(!atag.href) break; + atag.Target = atag.href; delete atag.href; + if(atag.Target.charAt(0) == "#" && atag.Target.indexOf(".") > -1) { + _Ref = ods_to_csf_3D(atag.Target.slice(1)); + atag.Target = "#" + _Ref[0] + "!" + _Ref[1]; + } + } + break; + + /* non-standard */ + case 'table-protection': break; + case 'data-pilot-grand-total': break; // '; + return function wso() { + return XML_HEADER + payload; + }; + })(); + var write_content_ods = (function() { + /* 6.1.2 White Space Characters */ + var write_text_p = function(text) { + return escapexml(text) + .replace(/ +/g, function($$){return '';}) + .replace(/\t/g, "") + .replace(/\n/g, "") + .replace(/^ /, "").replace(/ $/, ""); + }; + + var null_cell_xml = ' \n'; + var covered_cell_xml = ' \n'; + var write_ws = function(ws, wb, i) { + /* Section 9 Tables */ + var o = []; + o.push(' \n'); + var R=0,C=0, range = decode_range(ws['!ref']); + var marr = ws['!merges'] || [], mi = 0; + var dense = Array.isArray(ws); + for(R = 0; R < range.s.r; ++R) o.push(' \n'); + for(; R <= range.e.r; ++R) { + o.push(' \n'); + for(C=0; C < range.s.c; ++C) o.push(null_cell_xml); + for(; C <= range.e.c; ++C) { + var skip = false, ct = {}, textp = ""; + for(mi = 0; mi != marr.length; ++mi) { + if(marr[mi].s.c > C) continue; + if(marr[mi].s.r > R) continue; + if(marr[mi].e.c < C) continue; + if(marr[mi].e.r < R) continue; + if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; + ct['table:number-columns-spanned'] = (marr[mi].e.c - marr[mi].s.c + 1); + ct['table:number-rows-spanned'] = (marr[mi].e.r - marr[mi].s.r + 1); + break; + } + if(skip) { o.push(covered_cell_xml); continue; } + var ref = encode_cell({r:R, c:C}), cell = dense ? (ws[R]||[])[C]: ws[ref]; + if(cell && cell.f) { + ct['table:formula'] = escapexml(csf_to_ods_formula(cell.f)); + if(cell.F) { + if(cell.F.slice(0, ref.length) == ref) { + var _Fref = decode_range(cell.F); + ct['table:number-matrix-columns-spanned'] = (_Fref.e.c - _Fref.s.c + 1); + ct['table:number-matrix-rows-spanned'] = (_Fref.e.r - _Fref.s.r + 1); + } + } + } + if(!cell) { o.push(null_cell_xml); continue; } + switch(cell.t) { + case 'b': + textp = (cell.v ? 'TRUE' : 'FALSE'); + ct['office:value-type'] = "boolean"; + ct['office:boolean-value'] = (cell.v ? 'true' : 'false'); + break; + case 'n': + textp = (cell.w||String(cell.v||0)); + ct['office:value-type'] = "float"; + ct['office:value'] = (cell.v||0); + break; + case 's': case 'str': + textp = cell.v; + ct['office:value-type'] = "string"; + break; + case 'd': + textp = (cell.w||(parseDate(cell.v).toISOString())); + ct['office:value-type'] = "date"; + ct['office:date-value'] = (parseDate(cell.v).toISOString()); + ct['table:style-name'] = "ce1"; + break; + //case 'e': + default: o.push(null_cell_xml); continue; + } + var text_p = write_text_p(textp); + if(cell.l && cell.l.Target) { + var _tgt = cell.l.Target; _tgt = _tgt.charAt(0) == "#" ? "#" + csf_to_ods_3D(_tgt.slice(1)) : _tgt; + text_p = writextag('text:a', text_p, {'xlink:href': _tgt}); + } + o.push(' ' + writextag('table:table-cell', writextag('text:p', text_p, {}), ct) + '\n'); + } + o.push(' \n'); + } + o.push(' \n'); + return o.join(""); + }; + + var write_automatic_styles_ods = function(o) { + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + o.push(' /\n'); + o.push(' \n'); + o.push(' /\n'); + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + }; + + return function wcx(wb, opts) { + var o = [XML_HEADER]; + /* 3.1.3.2 */ + var attr = wxt_helper({ + 'xmlns:office': "urn:oasis:names:tc:opendocument:xmlns:office:1.0", + 'xmlns:table': "urn:oasis:names:tc:opendocument:xmlns:table:1.0", + 'xmlns:style': "urn:oasis:names:tc:opendocument:xmlns:style:1.0", + 'xmlns:text': "urn:oasis:names:tc:opendocument:xmlns:text:1.0", + 'xmlns:draw': "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", + 'xmlns:fo': "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", + 'xmlns:xlink': "http://www.w3.org/1999/xlink", + 'xmlns:dc': "http://purl.org/dc/elements/1.1/", + 'xmlns:meta': "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", + 'xmlns:number': "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", + 'xmlns:presentation': "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", + 'xmlns:svg': "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", + 'xmlns:chart': "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", + 'xmlns:dr3d': "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", + 'xmlns:math': "http://www.w3.org/1998/Math/MathML", + 'xmlns:form': "urn:oasis:names:tc:opendocument:xmlns:form:1.0", + 'xmlns:script': "urn:oasis:names:tc:opendocument:xmlns:script:1.0", + 'xmlns:ooo': "http://openoffice.org/2004/office", + 'xmlns:ooow': "http://openoffice.org/2004/writer", + 'xmlns:oooc': "http://openoffice.org/2004/calc", + 'xmlns:dom': "http://www.w3.org/2001/xml-events", + 'xmlns:xforms': "http://www.w3.org/2002/xforms", + 'xmlns:xsd': "http://www.w3.org/2001/XMLSchema", + 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", + 'xmlns:sheet': "urn:oasis:names:tc:opendocument:sh33tjs:1.0", + 'xmlns:rpt': "http://openoffice.org/2005/report", + 'xmlns:of': "urn:oasis:names:tc:opendocument:xmlns:of:1.2", + 'xmlns:xhtml': "http://www.w3.org/1999/xhtml", + 'xmlns:grddl': "http://www.w3.org/2003/g/data-view#", + 'xmlns:tableooo': "http://openoffice.org/2009/table", + 'xmlns:drawooo': "http://openoffice.org/2010/draw", + 'xmlns:calcext': "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", + 'xmlns:loext': "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", + 'xmlns:field': "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", + 'xmlns:formx': "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", + 'xmlns:css3t': "http://www.w3.org/TR/css3-text/", + 'office:version': "1.2" + }); + + var fods = wxt_helper({ + 'xmlns:config': "urn:oasis:names:tc:opendocument:xmlns:config:1.0", + 'office:mimetype': "application/vnd.oasis.opendocument.spreadsheet" + }); + + if(opts.bookType == "fods") o.push('\n'); + else o.push('\n'); + write_automatic_styles_ods(o); + o.push(' \n'); + o.push(' \n'); + for(var i = 0; i != wb.SheetNames.length; ++i) o.push(write_ws(wb.Sheets[wb.SheetNames[i]], wb, i, opts)); + o.push(' \n'); + o.push(' \n'); + if(opts.bookType == "fods") o.push(''); + else o.push(''); + return o.join(""); + }; + })(); + + function write_ods(wb, opts) { + if(opts.bookType == "fods") return write_content_ods(wb, opts); + + var zip = new jszip(); + var f = ""; + + var manifest = []; + var rdf = []; + + /* Part 3 Section 3.3 MIME Media Type */ + f = "mimetype"; + zip.file(f, "application/vnd.oasis.opendocument.spreadsheet"); + + /* Part 1 Section 2.2 Documents */ + f = "content.xml"; + zip.file(f, write_content_ods(wb, opts)); + manifest.push([f, "text/xml"]); + rdf.push([f, "ContentFile"]); + + /* TODO: these are hard-coded styles to satiate excel */ + f = "styles.xml"; + zip.file(f, write_styles_ods(wb, opts)); + manifest.push([f, "text/xml"]); + rdf.push([f, "StylesFile"]); + + /* TODO: this is hard-coded to satiate excel */ + f = "meta.xml"; + zip.file(f, write_meta_ods()); + manifest.push([f, "text/xml"]); + rdf.push([f, "MetadataFile"]); + + /* Part 3 Section 6 Metadata Manifest File */ + f = "manifest.rdf"; + zip.file(f, write_rdf(rdf/*, opts*/)); + manifest.push([f, "application/rdf+xml"]); + + /* Part 3 Section 4 Manifest File */ + f = "META-INF/manifest.xml"; + zip.file(f, write_manifest(manifest/*, opts*/)); + + return zip; + } + + function write_sheet_index(wb, sheet) { + if(!sheet) return 0; + var idx = wb.SheetNames.indexOf(sheet); + if(idx == -1) throw new Error("Sheet not found: " + sheet); + return idx; + } + + function write_obj_str(factory) { + return function write_str(wb, o) { + var idx = write_sheet_index(wb, o.sheet); + return factory.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb); + }; + } + + var write_htm_str = write_obj_str(HTML_); + var write_csv_str = write_obj_str({from_sheet:sheet_to_csv}); + var write_slk_str = write_obj_str(SYLK); + var write_dif_str = write_obj_str(DIF); + var write_prn_str = write_obj_str(PRN); + var write_rtf_str = write_obj_str(RTF); + var write_txt_str = write_obj_str({from_sheet:sheet_to_txt}); + var write_dbf_buf = write_obj_str(DBF); + var write_eth_str = write_obj_str(ETH); + + function fix_opts_func(defaults) { + return function fix_opts(opts) { + for(var i = 0; i != defaults.length; ++i) { + var d = defaults[i]; + if(opts[d[0]] === undefined) opts[d[0]] = d[1]; + if(d[2] === 'n') opts[d[0]] = Number(opts[d[0]]); + } + }; + } + + var fix_read_opts = fix_opts_func([ + ['cellNF', false], /* emit cell number format string as .z */ + ['cellHTML', true], /* emit html string as .h */ + ['cellFormula', true], /* emit formulae as .f */ + ['cellStyles', false], /* emits style/theme as .s */ + ['cellText', true], /* emit formatted text as .w */ + ['cellDates', false], /* emit date cells with type `d` */ + + ['sheetStubs', false], /* emit empty cells */ + ['sheetRows', 0, 'n'], /* read n rows (0 = read all rows) */ + + ['bookDeps', false], /* parse calculation chains */ + ['bookSheets', false], /* only try to get sheet names (no Sheets) */ + ['bookProps', false], /* only try to get properties (no Sheets) */ + ['bookFiles', false], /* include raw file structure (keys, files, cfb) */ + ['bookVBA', false], /* include vba raw data (vbaraw) */ + + ['password',''], /* password */ + ['WTF', false] /* WTF mode (throws errors) */ + ]); + + + var fix_write_opts = fix_opts_func([ + ['cellDates', false], /* write date cells with type `d` */ + + ['bookSST', false], /* Generate Shared String Table */ + + ['bookType', 'xlsx'], /* Type of workbook (xlsx/m/b) */ + + ['compression', false], /* Use file compression */ + + ['WTF', false] /* WTF mode (throws errors) */ + ]); + function get_sheet_type(n) { + if(RELS.WS.indexOf(n) > -1) return "sheet"; + if(RELS.CS && n == RELS.CS) return "chart"; + if(RELS.DS && n == RELS.DS) return "dialog"; + if(RELS.MS && n == RELS.MS) return "macro"; + return (n && n.length) ? n : "sheet"; + } + function safe_parse_wbrels(wbrels, sheets) { + if(!wbrels) return 0; + try { + wbrels = sheets.map(function pwbr(w) { if(!w.id) w.id = w.strRelID; return [w.name, wbrels['!id'][w.id].Target, get_sheet_type(wbrels['!id'][w.id].Type)]; }); + } catch(e) { return null; } + return !wbrels || wbrels.length === 0 ? null : wbrels; + } + + function safe_parse_sheet(zip, path, relsPath, sheet, idx, sheetRels, sheets, stype, opts, wb, themes, styles) { + try { + sheetRels[sheet]=parse_rels(getzipstr(zip, relsPath, true), path); + var data = getzipdata(zip, path); + var _ws; + switch(stype) { + case 'sheet': _ws = parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; + case 'chart': _ws = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); + if(!_ws || !_ws['!chart']) break; + var dfile = resolve_path(_ws['!chart'].Target, path); + var drelsp = get_rels_path(dfile); + var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip, drelsp, true), dfile)); + var chartp = resolve_path(draw, dfile); + var crelsp = get_rels_path(chartp); + _ws = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, _ws); + break; + case 'macro': _ws = parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; + case 'dialog': _ws = parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; + } + sheets[sheet] = _ws; + } catch(e) { if(opts.WTF) throw e; } + } + + function strip_front_slash(x) { return x.charAt(0) == '/' ? x.slice(1) : x; } + + function parse_zip(zip, opts) { + make_ssf(SSF); + opts = opts || {}; + fix_read_opts(opts); + + /* OpenDocument Part 3 Section 2.2.1 OpenDocument Package */ + if(safegetzipfile(zip, 'META-INF/manifest.xml')) return parse_ods(zip, opts); + /* UOC */ + if(safegetzipfile(zip, 'objectdata.xml')) return parse_ods(zip, opts); + /* Numbers */ + if(safegetzipfile(zip, 'Index/Document.iwa')) throw new Error('Unsupported NUMBERS file'); + + var entries = zipentries(zip); + var dir = parse_ct((getzipstr(zip, '[Content_Types].xml'))); + var xlsb = false; + var sheets, binname; + if(dir.workbooks.length === 0) { + binname = "xl/workbook.xml"; + if(getzipdata(zip,binname, true)) dir.workbooks.push(binname); + } + if(dir.workbooks.length === 0) { + binname = "xl/workbook.bin"; + if(!getzipdata(zip,binname,true)) throw new Error("Could not find workbook"); + dir.workbooks.push(binname); + xlsb = true; + } + if(dir.workbooks[0].slice(-3) == "bin") xlsb = true; + + var themes = ({}); + var styles = ({}); + if(!opts.bookSheets && !opts.bookProps) { + strs = []; + if(dir.sst) try { strs=parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts); } catch(e) { if(opts.WTF) throw e; } + + if(opts.cellStyles && dir.themes.length) themes = parse_theme(getzipstr(zip, dir.themes[0].replace(/^\//,''), true)||"",dir.themes[0], opts); + + if(dir.style) styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes, opts); + } + + /*var externbooks = */dir.links.map(function(link) { + return parse_xlink(getzipdata(zip, strip_front_slash(link)), link, opts); + }); + + var wb = parse_wb(getzipdata(zip, strip_front_slash(dir.workbooks[0])), dir.workbooks[0], opts); + + var props = {}, propdata = ""; + + if(dir.coreprops.length) { + propdata = getzipdata(zip, strip_front_slash(dir.coreprops[0]), true); + if(propdata) props = parse_core_props(propdata); + if(dir.extprops.length !== 0) { + propdata = getzipdata(zip, strip_front_slash(dir.extprops[0]), true); + if(propdata) parse_ext_props(propdata, props, opts); + } + } + + var custprops = {}; + if(!opts.bookSheets || opts.bookProps) { + if (dir.custprops.length !== 0) { + propdata = getzipstr(zip, strip_front_slash(dir.custprops[0]), true); + if(propdata) custprops = parse_cust_props(propdata, opts); + } + } + + var out = ({}); + if(opts.bookSheets || opts.bookProps) { + if(wb.Sheets) sheets = wb.Sheets.map(function pluck(x){ return x.name; }); + else if(props.Worksheets && props.SheetNames.length > 0) sheets=props.SheetNames; + if(opts.bookProps) { out.Props = props; out.Custprops = custprops; } + if(opts.bookSheets && typeof sheets !== 'undefined') out.SheetNames = sheets; + if(opts.bookSheets ? out.SheetNames : opts.bookProps) return out; + } + sheets = {}; + + var deps = {}; + if(opts.bookDeps && dir.calcchain) deps=parse_cc(getzipdata(zip, strip_front_slash(dir.calcchain)),dir.calcchain,opts); + + var i=0; + var sheetRels = ({}); + var path, relsPath; + + { + var wbsheets = wb.Sheets; + props.Worksheets = wbsheets.length; + props.SheetNames = []; + for(var j = 0; j != wbsheets.length; ++j) { + props.SheetNames[j] = wbsheets[j].name; + } + } + + var wbext = xlsb ? "bin" : "xml"; + var wbrelsi = dir.workbooks[0].lastIndexOf("/"); + var wbrelsfile = (dir.workbooks[0].slice(0, wbrelsi+1) + "_rels/" + dir.workbooks[0].slice(wbrelsi+1) + ".rels").replace(/^\//,""); + if(!safegetzipfile(zip, wbrelsfile)) wbrelsfile = 'xl/_rels/workbook.' + wbext + '.rels'; + var wbrels = parse_rels(getzipstr(zip, wbrelsfile, true), wbrelsfile); + if(wbrels) wbrels = safe_parse_wbrels(wbrels, wb.Sheets); + + /* Numbers iOS hack */ + var nmode = (getzipdata(zip,"xl/worksheets/sheet.xml",true))?1:0; + for(i = 0; i != props.Worksheets; ++i) { + var stype = "sheet"; + if(wbrels && wbrels[i]) { + path = 'xl/' + (wbrels[i][1]).replace(/[\/]?xl\//, ""); + if(!safegetzipfile(zip, path)) path = wbrels[i][1]; + if(!safegetzipfile(zip, path)) path = wbrelsfile.replace(/_rels\/.*$/,"") + wbrels[i][1]; + stype = wbrels[i][2]; + } else { + path = 'xl/worksheets/sheet'+(i+1-nmode)+"." + wbext; + path = path.replace(/sheet0\./,"sheet."); + } + relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); + safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, themes, styles); + } + + if(dir.comments) parse_comments(zip, dir.comments, sheets, sheetRels, opts); + + out = ({ + Directory: dir, + Workbook: wb, + Props: props, + Custprops: custprops, + Deps: deps, + Sheets: sheets, + SheetNames: props.SheetNames, + Strings: strs, + Styles: styles, + Themes: themes, + SSF: SSF.get_table() + }); + if(opts.bookFiles) { + out.keys = entries; + out.files = zip.files; + } + if(opts.bookVBA) { + if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true); + else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true); + } + return out; + } + + /* [MS-OFFCRYPTO] 2.1.1 */ + function parse_xlsxcfb(cfb, _opts) { + var opts = _opts || {}; + var f = 'Workbook', data = CFB.find(cfb, f); + try { + f = '/!DataSpaces/Version'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + /*var version = */parse_DataSpaceVersionInfo(data.content); + + /* 2.3.4.1 */ + f = '/!DataSpaces/DataSpaceMap'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + var dsm = parse_DataSpaceMap(data.content); + if(dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage") + throw new Error("ECMA-376 Encrypted file bad " + f); + + /* 2.3.4.2 */ + f = '/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + var seds = parse_DataSpaceDefinition(data.content); + if(seds.length != 1 || seds[0] != "StrongEncryptionTransform") + throw new Error("ECMA-376 Encrypted file bad " + f); + + /* 2.3.4.3 */ + f = '/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + /*var hdr = */parse_Primary(data.content); + } catch(e) {} + + f = '/EncryptionInfo'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + var einfo = parse_EncryptionInfo(data.content); + + /* 2.3.4.4 */ + f = '/EncryptedPackage'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + + /*global decrypt_agile */ + if(einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') return decrypt_agile(einfo[1], data.content, opts.password || "", opts); + /*global decrypt_std76 */ + if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std76(einfo[1], data.content, opts.password || "", opts); + throw new Error("File is password-protected"); + } + + function write_zip(wb, opts) { + _shapeid = 1024; + if(opts.bookType == "ods") return write_ods(wb, opts); + if(wb && !wb.SSF) { + wb.SSF = SSF.get_table(); + } + if(wb && wb.SSF) { + make_ssf(SSF); SSF.load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + } + opts.rels = {}; opts.wbrels = {}; + opts.Strings = []; opts.Strings.Count = 0; opts.Strings.Unique = 0; + if(browser_has_Map) opts.revStrings = new Map(); + else { opts.revStrings = {}; opts.revStrings.foo = []; delete opts.revStrings.foo; } + var wbext = opts.bookType == "xlsb" ? "bin" : "xml"; + var vbafmt = VBAFMTS.indexOf(opts.bookType) > -1; + var ct = new_ct(); + fix_write_opts(opts = opts || {}); + var zip = new jszip(); + var f = "", rId = 0; + + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); + + if(!wb.Props) wb.Props = {}; + + f = "docProps/core.xml"; + zip.file(f, write_core_props(wb.Props, opts)); + ct.coreprops.push(f); + add_rels(opts.rels, 2, f, RELS.CORE_PROPS); + + f = "docProps/app.xml"; + if(wb.Props && wb.Props.SheetNames){/* empty */} + else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames; + else { + var _sn = []; + for(var _i = 0; _i < wb.SheetNames.length; ++_i) + if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]); + wb.Props.SheetNames = _sn; + } + wb.Props.Worksheets = wb.Props.SheetNames.length; + zip.file(f, write_ext_props(wb.Props, opts)); + ct.extprops.push(f); + add_rels(opts.rels, 3, f, RELS.EXT_PROPS); + + if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) { + f = "docProps/custom.xml"; + zip.file(f, write_cust_props(wb.Custprops, opts)); + ct.custprops.push(f); + add_rels(opts.rels, 4, f, RELS.CUST_PROPS); + } + + for(rId=1;rId <= wb.SheetNames.length; ++rId) { + var wsrels = {'!id':{}}; + var ws = wb.Sheets[wb.SheetNames[rId-1]]; + var _type = (ws || {})["!type"] || "sheet"; + switch(_type) { + case "chart": /* + f = "xl/chartsheets/sheet" + rId + "." + wbext; + zip.file(f, write_cs(rId-1, f, opts, wb, wsrels)); + ct.charts.push(f); + add_rels(wsrels, -1, "chartsheets/sheet" + rId + "." + wbext, RELS.CS); + break; */ + /* falls through */ + default: + f = "xl/worksheets/sheet" + rId + "." + wbext; + zip.file(f, write_ws(rId-1, f, opts, wb, wsrels)); + ct.sheets.push(f); + add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]); + } + + if(ws) { + var comments = ws['!comments']; + var need_vml = false; + if(comments && comments.length > 0) { + var cf = "xl/comments" + rId + "." + wbext; + zip.file(cf, write_cmnt(comments, cf, opts)); + ct.comments.push(cf); + add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT); + need_vml = true; + } + if(ws['!legacy']) { + if(need_vml) zip.file("xl/drawings/vmlDrawing" + (rId) + ".vml", write_comments_vml(rId, ws['!comments'])); + } + delete ws['!comments']; + delete ws['!legacy']; + } + + if(wsrels['!id'].rId1) zip.file(get_rels_path(f), write_rels(wsrels)); + } + + if(opts.Strings != null && opts.Strings.length > 0) { + f = "xl/sharedStrings." + wbext; + zip.file(f, write_sst(opts.Strings, f, opts)); + ct.strs.push(f); + add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST); + } + + f = "xl/workbook." + wbext; + zip.file(f, write_wb(wb, f, opts)); + ct.workbooks.push(f); + add_rels(opts.rels, 1, f, RELS.WB); + + /* TODO: something more intelligent with themes */ + + f = "xl/theme/theme1.xml"; + zip.file(f, write_theme(wb.Themes, opts)); + ct.themes.push(f); + add_rels(opts.wbrels, -1, "theme/theme1.xml", RELS.THEME); + + /* TODO: something more intelligent with styles */ + + f = "xl/styles." + wbext; + zip.file(f, write_sty(wb, f, opts)); + ct.styles.push(f); + add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY); + + if(wb.vbaraw && vbafmt) { + f = "xl/vbaProject.bin"; + zip.file(f, wb.vbaraw); + ct.vba.push(f); + add_rels(opts.wbrels, -1, "vbaProject.bin", RELS.VBA); + } + + zip.file("[Content_Types].xml", write_ct(ct, opts)); + zip.file('_rels/.rels', write_rels(opts.rels)); + zip.file('xl/_rels/workbook.' + wbext + '.rels', write_rels(opts.wbrels)); + + delete opts.revssf; delete opts.ssf; + return zip; + } + function firstbyte(f,o) { + var x = ""; + switch((o||{}).type || "base64") { + case 'buffer': return [f[0], f[1], f[2], f[3]]; + case 'base64': x = Base64.decode(f.slice(0,24)); break; + case 'binary': x = f; break; + case 'array': return [f[0], f[1], f[2], f[3]]; + default: throw new Error("Unrecognized type " + (o && o.type || "undefined")); + } + return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3)]; + } + + function read_cfb(cfb, opts) { + if(CFB.find(cfb, "EncryptedPackage")) return parse_xlsxcfb(cfb, opts); + return parse_xlscfb(cfb, opts); + } + + function read_zip(data, opts) { + var zip, d = data; + var o = opts||{}; + if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; + switch(o.type) { + case "base64": zip = new jszip(d, { base64:true }); break; + case "binary": case "array": zip = new jszip(d, { base64:false }); break; + case "buffer": zip = new jszip(d); break; + default: throw new Error("Unrecognized type " + o.type); + } + return parse_zip(zip, o); + } + + function read_plaintext(data, o) { + var i = 0; + main: while(i < data.length) switch(data.charCodeAt(i)) { + case 0x0A: case 0x0D: case 0x20: ++i; break; + case 0x3C: return parse_xlml(data.slice(i),o); + default: break main; + } + return PRN.to_workbook(data, o); + } + + function read_plaintext_raw(data, o) { + var str = "", bytes = firstbyte(data, o); + switch(o.type) { + case 'base64': str = Base64.decode(data); break; + case 'binary': str = data; break; + case 'buffer': str = data.toString('binary'); break; + case 'array': str = cc2str(data); break; + default: throw new Error("Unrecognized type " + o.type); + } + if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str); + return read_plaintext(str, o); + } + + function read_utf16(data, o) { + var d = data; + if(o.type == 'base64') d = Base64.decode(d); + d = cptable.utils.decode(1200, d.slice(2), 'str'); + o.type = "binary"; + return read_plaintext(d, o); + } + + function bstrify(data) { + return !data.match(/[^\x00-\x7F]/) ? data : utf8write(data); + } + + function read_prn(data, d, o, str) { + if(str) { o.type = "string"; return PRN.to_workbook(data, o); } + return PRN.to_workbook(d, o); + } + + function readSync(data, opts) { + reset_cp(); + if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts); + var d = data, n = [0,0,0,0], str = false; + var o = opts||{}; + _ssfopts = {}; + if(o.dateNF) _ssfopts.dateNF = o.dateNF; + if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; + if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); } + if(o.type == "string") { str = true; o.type = "binary"; o.codepage = 65001; d = bstrify(data); } + if(o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof ArrayBuffer !== 'undefined') { + // $FlowIgnore + var ab=new ArrayBuffer(3), vu=new Uint8Array(ab); vu.foo="bar"; + // $FlowIgnore + if(!vu.foo) {o=dup(o); o.type='array'; return readSync(ab2a(d), o);} + } + switch((n = firstbyte(d, o))[0]) { + case 0xD0: return read_cfb(CFB.read(d, o), o); + case 0x09: return parse_xlscfb(d, o); + case 0x3C: return parse_xlml(d, o); + case 0x49: if(n[1] === 0x44) return read_wb_ID(d, o); break; + case 0x54: if(n[1] === 0x41 && n[2] === 0x42 && n[3] === 0x4C) return DIF.to_workbook(d, o); break; + case 0x50: return (n[1] === 0x4B && n[2] < 0x09 && n[3] < 0x09) ? read_zip(d, o) : read_prn(data, d, o, str); + case 0xEF: return n[3] === 0x3C ? parse_xlml(d, o) : read_prn(data, d, o, str); + case 0xFF: if(n[1] === 0xFE) { return read_utf16(d, o); } break; + case 0x00: if(n[1] === 0x00 && n[2] >= 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o); break; + case 0x03: case 0x83: case 0x8B: case 0x8C: return DBF.to_workbook(d, o); + case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break; + case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o); + } + if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o); + return read_prn(data, d, o, str); + } + + function readFileSync(filename, opts) { + var o = opts||{}; o.type = 'file'; + return readSync(filename, o); + } + function write_cfb_ctr(cfb, o) { + switch(o.type) { + case "base64": case "binary": break; + case "buffer": case "array": o.type = ""; break; + case "file": return write_dl(o.file, CFB.write(cfb, {type:has_buf ? 'buffer' : ""})); + case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); + default: throw new Error("Unrecognized type " + o.type); + } + return CFB.write(cfb, o); + } + + /*global encrypt_agile */ + function write_zip_type(wb, opts) { + var o = opts||{}; + style_builder = new StyleBuilder(opts); + var z = write_zip(wb, o); + var oopts = {}; + if(o.compression) oopts.compression = 'DEFLATE'; + if(o.password) oopts.type = has_buf ? "nodebuffer" : "string"; + else switch(o.type) { + case "base64": oopts.type = "base64"; break; + case "binary": oopts.type = "string"; break; + case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); + case "buffer": + case "file": oopts.type = has_buf ? "nodebuffer" : "string"; break; + default: throw new Error("Unrecognized type " + o.type); + } + var out = z.generate(oopts); + if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); + if(o.type === "file") return write_dl(o.file, out); + return o.type == "string" ? utf8read(out) : out; + } + + function write_cfb_type(wb, opts) { + var o = opts||{}; + var cfb = write_xlscfb(wb, o); + return write_cfb_ctr(cfb, o); + } + + function write_string_type(out, opts, bom) { + if(!bom) bom = ""; + var o = bom + out; + switch(opts.type) { + case "base64": return Base64.encode(utf8write(o)); + case "binary": return utf8write(o); + case "string": return out; + case "file": return write_dl(opts.file, o, 'utf8'); + case "buffer": { + // $FlowIgnore + if(has_buf) return Buffer_from(o, 'utf8'); + else return write_string_type(o, {type:'binary'}).split("").map(function(c) { return c.charCodeAt(0); }); + } + } + throw new Error("Unrecognized type " + opts.type); + } + + function write_stxt_type(out, opts) { + switch(opts.type) { + case "base64": return Base64.encode(out); + case "binary": return out; + case "string": return out; /* override in sheet_to_txt */ + case "file": return write_dl(opts.file, out, 'binary'); + case "buffer": { + // $FlowIgnore + if(has_buf) return Buffer_from(out, 'binary'); + else return out.split("").map(function(c) { return c.charCodeAt(0); }); + } + } + throw new Error("Unrecognized type " + opts.type); + } + + /* TODO: test consistency */ + function write_binary_type(out, opts) { + switch(opts.type) { + case "string": + case "base64": + case "binary": + var bstr = ""; + // $FlowIgnore + for(var i = 0; i < out.length; ++i) bstr += String.fromCharCode(out[i]); + return opts.type == 'base64' ? Base64.encode(bstr) : opts.type == 'string' ? utf8read(bstr) : bstr; + case "file": return write_dl(opts.file, out); + case "buffer": return out; + default: throw new Error("Unrecognized type " + opts.type); + } + } + + function writeSync(wb, opts) { + check_wb(wb); + var o = opts||{}; + if(o.type == "array") { o.type = "binary"; var out = (writeSync(wb, o)); o.type = "array"; return s2ab(out); } + switch(o.bookType || 'xlsb') { + case 'xml': + case 'xlml': return write_string_type(write_xlml(wb, o), o); + case 'slk': + case 'sylk': return write_string_type(write_slk_str(wb, o), o); + case 'htm': + case 'html': return write_string_type(write_htm_str(wb, o), o); + case 'txt': return write_stxt_type(write_txt_str(wb, o), o); + case 'csv': return write_string_type(write_csv_str(wb, o), o, "\ufeff"); + case 'dif': return write_string_type(write_dif_str(wb, o), o); + case 'dbf': return write_binary_type(write_dbf_buf(wb, o), o); + case 'prn': return write_string_type(write_prn_str(wb, o), o); + case 'rtf': return write_string_type(write_rtf_str(wb, o), o); + case 'eth': return write_string_type(write_eth_str(wb, o), o); + case 'fods': return write_string_type(write_ods(wb, o), o); + case 'biff2': if(!o.biff) o.biff = 2; /* falls through */ + case 'biff3': if(!o.biff) o.biff = 3; /* falls through */ + case 'biff4': if(!o.biff) o.biff = 4; return write_binary_type(write_biff_buf(wb, o), o); + case 'biff5': if(!o.biff) o.biff = 5; /* falls through */ + case 'biff8': + case 'xla': + case 'xls': if(!o.biff) o.biff = 8; return write_cfb_type(wb, o); + case 'xlsx': + case 'xlsm': + case 'xlam': + case 'xlsb': + case 'ods': return write_zip_type(wb, o); + default: throw new Error ("Unrecognized bookType |" + o.bookType + "|"); + } + } + + function resolve_book_type(o) { + if(o.bookType) return; + var _BT = { + "xls": "biff8", + "htm": "html", + "slk": "sylk", + "socialcalc": "eth", + "Sh33tJS": "WTF" + }; + var ext = o.file.slice(o.file.lastIndexOf(".")).toLowerCase(); + if(ext.match(/^\.[a-z]+$/)) o.bookType = ext.slice(1); + o.bookType = _BT[o.bookType] || o.bookType; + } + + function writeFileSync(wb, filename, opts) { + var o = opts||{}; o.type = 'file'; + o.file = filename; + resolve_book_type(o); + return writeSync(wb, o); + } + + function writeFileAsync(filename, wb, opts, cb) { + var o = opts||{}; o.type = 'file'; + o.file = filename; + resolve_book_type(o); + o.type = 'buffer'; + var _cb = cb; if(!(_cb instanceof Function)) _cb = (opts); + return _fs.writeFile(filename, writeSync(wb, o), _cb); + } + function make_json_row(sheet, r, R, cols, header, hdr, dense, o) { + var rr = encode_row(R); + var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw"); + var isempty = true; + var row = (header === 1) ? [] : {}; + if(header !== 1) { + if(Object.defineProperty) try { Object.defineProperty(row, '__rowNum__', {value:R, enumerable:false}); } catch(e) { row.__rowNum__ = R; } + else row.__rowNum__ = R; + } + if(!dense || sheet[R]) for (var C = r.s.c; C <= r.e.c; ++C) { + var val = dense ? sheet[R][C] : sheet[cols[C] + rr]; + if(val === undefined || val.t === undefined) { + if(defval === undefined) continue; + if(hdr[C] != null) { row[hdr[C]] = defval; } + continue; + } + var v = val.v; + switch(val.t){ + case 'z': if(v == null) break; continue; + case 'e': v = void 0; break; + case 's': case 'd': case 'b': case 'n': break; + default: throw new Error('unrecognized type ' + val.t); + } + if(hdr[C] != null) { + if(v == null) { + if(defval !== undefined) row[hdr[C]] = defval; + else if(raw && v === null) row[hdr[C]] = null; + else continue; + } else { + row[hdr[C]] = raw ? v : format_cell(val,v,o); + } + if(v != null) isempty = false; + } + } + return { row: row, isempty: isempty }; + } + + + function sheet_to_json(sheet, opts) { + if(sheet == null || sheet["!ref"] == null) return []; + var val = {t:'n',v:0}, header = 0, offset = 1, hdr = [], v=0, vv=""; + var r = {s:{r:0,c:0},e:{r:0,c:0}}; + var o = opts || {}; + var range = o.range != null ? o.range : sheet["!ref"]; + if(o.header === 1) header = 1; + else if(o.header === "A") header = 2; + else if(Array.isArray(o.header)) header = 3; + switch(typeof range) { + case 'string': r = safe_decode_range(range); break; + case 'number': r = safe_decode_range(sheet["!ref"]); r.s.r = range; break; + default: r = range; + } + if(header > 0) offset = 0; + var rr = encode_row(r.s.r); + var cols = []; + var out = []; + var outi = 0, counter = 0; + var dense = Array.isArray(sheet); + var R = r.s.r, C = 0, CC = 0; + if(dense && !sheet[R]) sheet[R] = []; + for(C = r.s.c; C <= r.e.c; ++C) { + cols[C] = encode_col(C); + val = dense ? sheet[R][C] : sheet[cols[C] + rr]; + switch(header) { + case 1: hdr[C] = C - r.s.c; break; + case 2: hdr[C] = cols[C]; break; + case 3: hdr[C] = o.header[C - r.s.c]; break; + default: + if(val == null) val = {w: "__EMPTY", t: "s"}; + vv = v = format_cell(val, null, o); + counter = 0; + for(CC = 0; CC < hdr.length; ++CC) if(hdr[CC] == vv) vv = v + "_" + (++counter); + hdr[C] = vv; + } + } + for (R = r.s.r + offset; R <= r.e.r; ++R) { + var row = make_json_row(sheet, r, R, cols, header, hdr, dense, o); + if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) out[outi++] = row.row; + } + out.length = outi; + return out; + } + + var qreg = /"/g; + function make_csv_row(sheet, r, R, cols, fs, rs, FS, o) { + var isempty = true; + var row = [], txt = "", rr = encode_row(R); + for(var C = r.s.c; C <= r.e.c; ++C) { + if (!cols[C]) continue; + var val = o.dense ? (sheet[R]||[])[C]: sheet[cols[C] + rr]; + if(val == null) txt = ""; + else if(val.v != null) { + isempty = false; + txt = ''+format_cell(val, null, o); + for(var i = 0, cc = 0; i !== txt.length; ++i) if((cc = txt.charCodeAt(i)) === fs || cc === rs || cc === 34) {txt = "\"" + txt.replace(qreg, '""') + "\""; break; } + if(txt == "ID") txt = '"ID"'; + } else if(val.f != null && !val.F) { + isempty = false; + txt = '=' + val.f; if(txt.indexOf(",") >= 0) txt = '"' + txt.replace(qreg, '""') + '"'; + } else txt = ""; + /* NOTE: Excel CSV does not support array formulae */ + row.push(txt); + } + if(o.blankrows === false && isempty) return null; + return row.join(FS); + } + + function sheet_to_csv(sheet, opts) { + var out = []; + var o = opts == null ? {} : opts; + if(sheet == null || sheet["!ref"] == null) return ""; + var r = safe_decode_range(sheet["!ref"]); + var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); + var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); + var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$"); + var row = "", cols = []; + o.dense = Array.isArray(sheet); + var colinfo = o.skipHidden && sheet["!cols"] || []; + var rowinfo = o.skipHidden && sheet["!rows"] || []; + for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C); + for(var R = r.s.r; R <= r.e.r; ++R) { + if ((rowinfo[R]||{}).hidden) continue; + row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o); + if(row == null) { continue; } + if(o.strip) row = row.replace(endregex,""); + out.push(row + RS); + } + delete o.dense; + return out.join(""); + } + + function sheet_to_txt(sheet, opts) { + if(!opts) opts = {}; opts.FS = "\t"; opts.RS = "\n"; + var s = sheet_to_csv(sheet, opts); + if(typeof cptable == 'undefined' || opts.type == 'string') return s; + var o = cptable.utils.encode(1200, s, 'str'); + return String.fromCharCode(255) + String.fromCharCode(254) + o; + } + + function sheet_to_formulae(sheet) { + var y = "", x, val=""; + if(sheet == null || sheet["!ref"] == null) return []; + var r = safe_decode_range(sheet['!ref']), rr = "", cols = [], C; + var cmds = []; + var dense = Array.isArray(sheet); + for(C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C); + for(var R = r.s.r; R <= r.e.r; ++R) { + rr = encode_row(R); + for(C = r.s.c; C <= r.e.c; ++C) { + y = cols[C] + rr; + x = dense ? (sheet[R]||[])[C] : sheet[y]; + val = ""; + if(x === undefined) continue; + else if(x.F != null) { + y = x.F; + if(!x.f) continue; + val = x.f; + if(y.indexOf(":") == -1) y = y + ":" + y; + } + if(x.f != null) val = x.f; + else if(x.t == 'z') continue; + else if(x.t == 'n' && x.v != null) val = "" + x.v; + else if(x.t == 'b') val = x.v ? "TRUE" : "FALSE"; + else if(x.w !== undefined) val = "'" + x.w; + else if(x.v === undefined) continue; + else if(x.t == 's') val = "'" + x.v; + else val = ""+x.v; + cmds[cmds.length] = y + "=" + val; + } + } + return cmds; + } + + function sheet_add_json(_ws, js, opts) { + var o = opts || {}; + var offset = +!o.skipHeader; + var ws = _ws || ({}); + var _R = 0, _C = 0; + if(ws && o.origin != null) { + if(typeof o.origin == 'number') _R = o.origin; + else { + var _origin = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; + _R = _origin.r; _C = _origin.c; + } + } + var cell; + var range = ({s: {c:0, r:0}, e: {c:_C, r:_R + js.length - 1 + offset}}); + if(ws['!ref']) { + var _range = safe_decode_range(ws['!ref']); + range.e.c = Math.max(range.e.c, _range.e.c); + range.e.r = Math.max(range.e.r, _range.e.r); + if(_R == -1) { _R = range.e.r + 1; range.e.r = _R + js.length - 1 + offset; } + } + var hdr = o.header || [], C = 0; + + js.forEach(function (JS, R) { + keys(JS).forEach(function(k) { + if((C=hdr.indexOf(k)) == -1) hdr[C=hdr.length] = k; + var v = JS[k]; + var t = 'z'; + var z = ""; + if(v && typeof v === 'object' && !(v instanceof Date)){ + ws[encode_cell({c:_C + C,r:_R + R + offset})] = v; + } else { + if(typeof v == 'number') t = 'n'; + else if(typeof v == 'boolean') t = 'b'; + else if(typeof v == 'string') t = 's'; + else if(v instanceof Date) { + t = 'd'; + if(!o.cellDates) { t = 'n'; v = datenum(v); } + z = o.dateNF || SSF._table[14]; + } + ws[encode_cell({c:_C + C,r:_R + R + offset})] = cell = ({t:t, v:v}); + if(z) cell.z = z; + } + }); + }); + range.e.c = Math.max(range.e.c, _C + hdr.length - 1); + var __R = encode_row(_R); + if(offset) for(C = 0; C < hdr.length; ++C) ws[encode_col(C + _C) + __R] = {t:'s', v:hdr[C]}; + ws['!ref'] = encode_range(range); + return ws; + } + function json_to_sheet(js, opts) { return sheet_add_json(null, js, opts); } + + var utils = { + encode_col: encode_col, + encode_row: encode_row, + encode_cell: encode_cell, + encode_range: encode_range, + decode_col: decode_col, + decode_row: decode_row, + split_cell: split_cell, + decode_cell: decode_cell, + decode_range: decode_range, + format_cell: format_cell, + get_formulae: sheet_to_formulae, + make_csv: sheet_to_csv, + make_json: sheet_to_json, + make_formulae: sheet_to_formulae, + sheet_add_aoa: sheet_add_aoa, + sheet_add_json: sheet_add_json, + aoa_to_sheet: aoa_to_sheet, + json_to_sheet: json_to_sheet, + table_to_sheet: parse_dom_table, + table_to_book: table_to_book, + sheet_to_csv: sheet_to_csv, + sheet_to_txt: sheet_to_txt, + sheet_to_json: sheet_to_json, + sheet_to_html: HTML_.from_sheet, + sheet_to_dif: DIF.from_sheet, + sheet_to_slk: SYLK.from_sheet, + sheet_to_eth: ETH.from_sheet, + sheet_to_formulae: sheet_to_formulae, + sheet_to_row_object_array: sheet_to_json + }; + + (function(utils) { + utils.consts = utils.consts || {}; + function add_consts(R/*Array*/) { R.forEach(function(a){ utils.consts[a[0]] = a[1]; }); } + + function get_default(x, y, z) { return x[y] != null ? x[y] : (x[y] = z); } + + /* get cell, creating a stub if necessary */ + function ws_get_cell_stub(ws, R, C) { + /* A1 cell address */ + if(typeof R == "string") return ws[R] || (ws[R] = {t:'z'}); + /* cell address object */ + if(typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R)); + /* R and C are 0-based indices */ + return ws_get_cell_stub(ws, encode_cell({r:R,c:C||0})); + } + + /* find sheet index for given name / validate index */ + function wb_sheet_idx(wb, sh) { + if(typeof sh == "number") { + if(sh >= 0 && wb.SheetNames.length > sh) return sh; + throw new Error("Cannot find sheet # " + sh); + } else if(typeof sh == "string") { + var idx = wb.SheetNames.indexOf(sh); + if(idx > -1) return idx; + throw new Error("Cannot find sheet name |" + sh + "|"); + } else throw new Error("Cannot find sheet |" + sh + "|"); + } + + /* simple blank workbook object */ + utils.book_new = function() { + return { SheetNames: [], Sheets: {} }; + }; + + /* add a worksheet to the end of a given workbook */ + utils.book_append_sheet = function(wb, ws, name) { + if(!name) for(var i = 1; i <= 0xFFFF; ++i) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break; + if(!name) throw new Error("Too many worksheets"); + check_ws_name(name); + if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already exists!"); + + wb.SheetNames.push(name); + wb.Sheets[name] = ws; + }; + + /* set sheet visibility (visible/hidden/very hidden) */ + utils.book_set_sheet_visibility = function(wb, sh, vis) { + get_default(wb,"Workbook",{}); + get_default(wb.Workbook,"Sheets",[]); + + var idx = wb_sheet_idx(wb, sh); + // $FlowIgnore + get_default(wb.Workbook.Sheets,idx, {}); + + switch(vis) { + case 0: case 1: case 2: break; + default: throw new Error("Bad sheet visibility setting " + vis); + } + // $FlowIgnore + wb.Workbook.Sheets[idx].Hidden = vis; + }; + add_consts([ + ["SHEET_VISIBLE", 0], + ["SHEET_HIDDEN", 1], + ["SHEET_VERY_HIDDEN", 2] + ]); + + /* set number format */ + utils.cell_set_number_format = function(cell, fmt) { + cell.z = fmt; + return cell; + }; + + /* set cell hyperlink */ + utils.cell_set_hyperlink = function(cell, target, tooltip) { + if(!target) { + delete cell.l; + } else { + cell.l = ({ Target: target }); + if(tooltip) cell.l.Tooltip = tooltip; + } + return cell; + }; + utils.cell_set_internal_link = function(cell, range, tooltip) { return utils.cell_set_hyperlink(cell, "#" + range, tooltip); }; + + /* add to cell comments */ + utils.cell_add_comment = function(cell, text, author) { + if(!cell.c) cell.c = []; + cell.c.push({t:text, a:author||"SheetJS"}); + }; + + /* set array formula and flush related cells */ + utils.sheet_set_array_formula = function(ws, range, formula) { + var rng = typeof range != "string" ? range : safe_decode_range(range); + var rngstr = typeof range == "string" ? range : encode_range(range); + for(var R = rng.s.r; R <= rng.e.r; ++R) for(var C = rng.s.c; C <= rng.e.c; ++C) { + var cell = ws_get_cell_stub(ws, R, C); + cell.t = 'n'; + cell.F = rngstr; + delete cell.v; + if(R == rng.s.r && C == rng.s.c) cell.f = formula; + } + return ws; + }; + + return utils; + })(utils); + + if(has_buf && typeof require != 'undefined') (function() { + var Readable = {}.Readable; + + var write_csv_stream = function(sheet, opts) { + var stream = Readable(); + var o = opts == null ? {} : opts; + if(sheet == null || sheet["!ref"] == null) { stream.push(null); return stream; } + var r = safe_decode_range(sheet["!ref"]); + var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); + var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); + var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$"); + var row = "", cols = []; + o.dense = Array.isArray(sheet); + var colinfo = o.skipHidden && sheet["!cols"] || []; + var rowinfo = o.skipHidden && sheet["!rows"] || []; + for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C); + var R = r.s.r; + var BOM = false; + stream._read = function() { + if(!BOM) { BOM = true; return stream.push("\uFEFF"); } + if(R > r.e.r) return stream.push(null); + while(R <= r.e.r) { + ++R; + if ((rowinfo[R-1]||{}).hidden) continue; + row = make_csv_row(sheet, r, R-1, cols, fs, rs, FS, o); + if(row != null) { + if(o.strip) row = row.replace(endregex,""); + stream.push(row + RS); + break; + } + } + }; + return stream; + }; + + var write_html_stream = function(ws, opts) { + var stream = Readable(); + + var o = opts || {}; + var header = o.header != null ? o.header : HTML_.BEGIN; + var footer = o.footer != null ? o.footer : HTML_.END; + stream.push(header); + var r = decode_range(ws['!ref']); + o.dense = Array.isArray(ws); + stream.push(HTML_._preamble(ws, r, o)); + var R = r.s.r; + var end = false; + stream._read = function() { + if(R > r.e.r) { + if(!end) { end = true; stream.push("" + footer); } + return stream.push(null); + } + while(R <= r.e.r) { + stream.push(HTML_._row(ws, r, R, o)); + ++R; + break; + } + }; + return stream; + }; + + var write_json_stream = function(sheet, opts) { + var stream = Readable({objectMode:true}); + + if(sheet == null || sheet["!ref"] == null) { stream.push(null); return stream; } + var val = {t:'n',v:0}, header = 0, offset = 1, hdr = [], v=0, vv=""; + var r = {s:{r:0,c:0},e:{r:0,c:0}}; + var o = opts || {}; + var range = o.range != null ? o.range : sheet["!ref"]; + if(o.header === 1) header = 1; + else if(o.header === "A") header = 2; + else if(Array.isArray(o.header)) header = 3; + switch(typeof range) { + case 'string': r = safe_decode_range(range); break; + case 'number': r = safe_decode_range(sheet["!ref"]); r.s.r = range; break; + default: r = range; + } + if(header > 0) offset = 0; + var rr = encode_row(r.s.r); + var cols = []; + var counter = 0; + var dense = Array.isArray(sheet); + var R = r.s.r, C = 0, CC = 0; + if(dense && !sheet[R]) sheet[R] = []; + for(C = r.s.c; C <= r.e.c; ++C) { + cols[C] = encode_col(C); + val = dense ? sheet[R][C] : sheet[cols[C] + rr]; + switch(header) { + case 1: hdr[C] = C - r.s.c; break; + case 2: hdr[C] = cols[C]; break; + case 3: hdr[C] = o.header[C - r.s.c]; break; + default: + if(val == null) val = {w: "__EMPTY", t: "s"}; + vv = v = format_cell(val, null, o); + counter = 0; + for(CC = 0; CC < hdr.length; ++CC) if(hdr[CC] == vv) vv = v + "_" + (++counter); + hdr[C] = vv; + } + } + R = r.s.r + offset; + stream._read = function() { + if(R > r.e.r) return stream.push(null); + while(R <= r.e.r) { + //if ((rowinfo[R-1]||{}).hidden) continue; + var row = make_json_row(sheet, r, R, cols, header, hdr, dense, o); + ++R; + if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) { + stream.push(row.row); + break; + } + } + }; + return stream; + }; + + XLSX.stream = { + to_json: write_json_stream, + to_html: write_html_stream, + to_csv: write_csv_stream + }; + })(); + /** + * 样式魔改区 -- start + */ + ///////////////////////////////////////////////////////////////////////////////////////////////////// + var XmlNode = (function () { + function XmlNode(tagName, attributes, children) { + + if (!(this instanceof XmlNode)) { + return new XmlNode(tagName, attributes, children); + } + this.tagName = tagName; + this._attributes = attributes || {}; + this._children = children || []; + this._prefix = ''; + return this; + } + + XmlNode.prototype.createElement = function () { + return new XmlNode(arguments) + } + + XmlNode.prototype.children = function() { + return this._children; + } + + XmlNode.prototype.append = function (node) { + this._children.push(node); + return this; + } + + XmlNode.prototype.prefix = function (prefix) { + if (arguments.length==0) { return this._prefix;} + this._prefix = prefix; + return this; + } + + XmlNode.prototype.attr = function (attr, value) { + if (value == undefined) { + delete this._attributes[attr]; + return this; + } + if (arguments.length == 0) { + return this._attributes; + } + else if (typeof attr == 'string' && arguments.length == 1) { + return this._attributes.attr[attr]; + } + if (typeof attr == 'object' && arguments.length == 1) { + for (var key in attr) { + this._attributes[key] = attr[key]; + } + } + else if (arguments.length == 2 && typeof attr == 'string') { + this._attributes[attr] = value; + } + return this; + } + + var APOS = "'"; QUOTE = '"' + var ESCAPED_QUOTE = { } + ESCAPED_QUOTE[QUOTE] = '"' + ESCAPED_QUOTE[APOS] = ''' + + XmlNode.prototype.escapeAttributeValue = function(att_value) { + return '"' + att_value.replace(/\"/g,'"') + '"';// TODO Extend with four other codes + + } + + XmlNode.prototype.toXml = function (node) { + if (!node) node = this; + var xml = node._prefix; + xml += '<' + node.tagName; + if (node._attributes) { + for (var key in node._attributes) { + xml += ' ' + key + '=' + this.escapeAttributeValue(''+node._attributes[key]) + '' + } + } + if (node._children && node._children.length > 0) { + xml += ">"; + for (var i = 0; i < node._children.length; i++) { + xml += this.toXml(node._children[i]); + } + xml += ''; + } + else { + xml += '/>'; + } + return xml; + } + return XmlNode; + })(); + ///////////////////////////////////////////////////////////////////////////////////////////////////// + var StyleBuilder = function (options) { + + var customNumFmtId = 164; + + + + var table_fmt = { + 0: 'General', + 1: '0', + 2: '0.00', + 3: '#,##0', + 4: '#,##0.00', + 9: '0%', + 10: '0.00%', + 11: '0.00E+00', + 12: '# ?/?', + 13: '# ??/??', + 14: 'm/d/yy', + 15: 'd-mmm-yy', + 16: 'd-mmm', + 17: 'mmm-yy', + 18: 'h:mm AM/PM', + 19: 'h:mm:ss AM/PM', + 20: 'h:mm', + 21: 'h:mm:ss', + 22: 'm/d/yy h:mm', + 37: '#,##0 ;(#,##0)', + 38: '#,##0 ;[Red](#,##0)', + 39: '#,##0.00;(#,##0.00)', + 40: '#,##0.00;[Red](#,##0.00)', + 45: 'mm:ss', + 46: '[h]:mm:ss', + 47: 'mmss.0', + 48: '##0.0E+0', + 49: '@', + 56: '"上午/下午 "hh"時"mm"分"ss"秒 "' }; + var fmt_table = {}; + + for (var idx in table_fmt) { + fmt_table[table_fmt[idx]] = idx; + } + + + // cache style specs to avoid excessive duplication + _hashIndex = {}; + _listIndex = []; + + return { + + initialize: function (options) { + + this.$fonts = XmlNode('fonts').attr('count',0).attr("x14ac:knownFonts","1"); + this.$fills = XmlNode('fills').attr('count',0); + this.$borders = XmlNode('borders').attr('count',0); + this.$numFmts = XmlNode('numFmts').attr('count',0); + this.$cellStyleXfs = XmlNode('cellStyleXfs'); + this.$xf = XmlNode('xf') + .attr('numFmtId', 0) + .attr('fontId', 0) + .attr('fillId', 0) + .attr('borderId', 0); + + this.$cellXfs = XmlNode('cellXfs').attr('count',0); + this.$cellStyles = XmlNode('cellStyles') + .append(XmlNode('cellStyle') + .attr('name', 'Normal') + .attr('xfId',0) + .attr('builtinId',0) + ); + this.$dxfs = XmlNode('dxfs').attr('count', "0"); + this.$tableStyles = XmlNode('tableStyles') + .attr('count','0') + .attr('defaultTableStyle','TableStyleMedium9') + .attr('defaultPivotStyle','PivotStyleMedium4') + + + this.$styles = XmlNode('styleSheet') + .attr('xmlns:mc','http://schemas.openxmlformats.org/markup-compatibility/2006') + .attr('xmlns:x14ac','http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac') + .attr('xmlns','http://schemas.openxmlformats.org/spreadsheetml/2006/main') + .attr('mc:Ignorable','x14ac') + .prefix('') + .append(this.$numFmts) + .append(this.$fonts) + .append(this.$fills) + .append(this.$borders) + .append(this.$cellStyleXfs.append(this.$xf)) + .append(this.$cellXfs) + .append(this.$cellStyles) + .append(this.$dxfs) + .append(this.$tableStyles); + + + // need to specify styles at index 0 and 1. + // the second style MUST be gray125 for some reason + + var defaultStyle = options.defaultCellStyle || {}; + if (!defaultStyle.font) defaultStyle.font = {name: 'Calibri', sz: '12'}; + if (!defaultStyle.font.name) defaultStyle.font.name = 'Calibri'; + if (!defaultStyle.font.sz) defaultStyle.font.sz = 11; + if (!defaultStyle.fill) defaultStyle.fill = { patternType: "none", fgColor: {}}; + if (!defaultStyle.border) defaultStyle.border = {}; + if (!defaultStyle.numFmt) defaultStyle.numFmt = 0; + + this.defaultStyle = defaultStyle; + + var gray125Style = JSON.parse(JSON.stringify(defaultStyle)); + gray125Style.fill = {patternType: "gray125", fgColor: { }} + + this.addStyles([defaultStyle, gray125Style]); + return this; + }, + + // create a style entry and returns an integer index that can be used in the cell .s property + // these format of this object follows the emerging Common Spreadsheet Format + addStyle: function (attributes) { + + var hashKey = JSON.stringify(attributes); + var index = _hashIndex[hashKey]; + if (index == undefined) { + + index = this._addXf(attributes); //_listIndex.push(attributes) -1; + _hashIndex[hashKey] = index; + } + else { + index = _hashIndex[hashKey]; + } + return index; + }, + + // create style entries and returns array of integer indexes that can be used in cell .s property + addStyles: function (styles) { + var self = this; + return styles.map(function (style) { + return self.addStyle(style); + }) + }, + + _duckTypeStyle: function(attributes) { + + if (typeof attributes == 'object' && (attributes.patternFill || attributes.fgColor)) { + return {fill: attributes }; // this must be read via XLSX.parseFile(...) + } + else if (attributes.font || attributes.numFmt || attributes.border || attributes.fill) { + return attributes; + } + else { + return this._getStyleCSS(attributes) + } + }, + + _getStyleCSS: function(css) { + return css; //TODO + }, + + // Create an record for the style as well as corresponding , , , + // Right now this is simple and creates a , , , for every + // We could perhaps get fancier and avoid duplicating auxiliary entries as Excel presumably intended, but bother. + _addXf: function (attributes) { + + + var fontId = this._addFont(attributes.font); + var fillId = this._addFill(attributes.fill); + var borderId = this._addBorder(attributes.border); + var numFmtId = this._addNumFmt(attributes.numFmt); + + var $xf = XmlNode('xf') + .attr("numFmtId", numFmtId) + .attr("fontId", fontId) + .attr("fillId", fillId) + .attr("borderId", borderId) + .attr("xfId", "0"); + + if (fontId > 0) { + $xf.attr('applyFont', "1"); + } + if (fillId > 0) { + $xf.attr('applyFill', "1"); + } + if (borderId > 0) { + $xf.attr('applyBorder', "1"); + } + if (numFmtId > 0) { + $xf.attr('applyNumberFormat', "1"); + } + + if (attributes.alignment) { + var $alignment = XmlNode('alignment'); + if (attributes.alignment.horizontal) { $alignment.attr('horizontal', attributes.alignment.horizontal);} + if (attributes.alignment.vertical) { $alignment.attr('vertical', attributes.alignment.vertical);} + if (attributes.alignment.indent) { $alignment.attr('indent', attributes.alignment.indent);} + if (attributes.alignment.readingOrder) { $alignment.attr('readingOrder', attributes.alignment.readingOrder);} + if (attributes.alignment.wrapText) { $alignment.attr('wrapText', attributes.alignment.wrapText);} + if (attributes.alignment.textRotation!=undefined) { $alignment.attr('textRotation', attributes.alignment.textRotation);} + + $xf.append($alignment).attr('applyAlignment',1) + + } + this.$cellXfs.append($xf); + var count = +this.$cellXfs.children().length; + + this.$cellXfs.attr('count', count); + return count - 1; + }, + + _addFont: function (attributes) { + + if (!attributes) { return 0; } + + var $font = XmlNode('font') + .append(XmlNode('sz').attr('val', attributes.sz || this.defaultStyle.font.sz)) + .append(XmlNode('name').attr('val', attributes.name || this.defaultStyle.font.name)) + + if (attributes.bold) $font.append(XmlNode('b')); + if (attributes.underline) $font.append(XmlNode('u')); + if (attributes.italic) $font.append(XmlNode('i')); + if (attributes.strike) $font.append(XmlNode('strike')); + if (attributes.outline) $font.append(XmlNode('outline')); + if (attributes.shadow) $font.append(XmlNode('shadow')); + + if (attributes.vertAlign) { + $font.append(XmlNode('vertAlign').attr('val', attributes.vertAlign)) + } + + + if (attributes.color) { + if (attributes.color.theme) { + $font.append(XmlNode('color').attr('theme', attributes.color.theme)) + + if (attributes.color.tint) { //tint only if theme + $font.append(XmlNode('tint').attr('theme', attributes.color.tint)) + } + + } else if (attributes.color.rgb) { // not both rgb and theme + $font.append(XmlNode('color').attr('rgb', attributes.color.rgb)) + } + } + + this.$fonts.append($font); + + var count = this.$fonts.children().length; + this.$fonts.attr('count', count); + return count - 1; + }, + + _addNumFmt: function (numFmt) { + if (!numFmt) { return 0; } + + if (typeof numFmt == 'string') { + var numFmtIdx = fmt_table[numFmt]; + if (numFmtIdx >= 0) { + return numFmtIdx; // we found a match against built in formats + } + } + + if (/^[0-9]+$/.exec(numFmt)) { + return numFmt; // we're matching an integer against some known code + } + numFmt = numFmt + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + + var $numFmt = XmlNode('numFmt') + .attr('numFmtId', (++customNumFmtId)) + .attr('formatCode', numFmt); + + this.$numFmts.append($numFmt); + + var count = this.$numFmts.children().length; + this.$numFmts.attr('count', count); + return customNumFmtId ; + }, + + _addFill: function (attributes) { + + if (!attributes) { return 0; } + + var $patternFill = XmlNode('patternFill') + .attr('patternType', attributes.patternType || 'solid'); + + if (attributes.fgColor) { + var $fgColor = XmlNode('fgColor'); + + //Excel doesn't like it when we set both rgb and theme+tint, but xlsx.parseFile() sets both + //var $fgColor = createElement('', null, null, {xmlMode: true}).attr(attributes.fgColor) + if (attributes.fgColor.rgb) { + + if (attributes.fgColor.rgb.length == 6) { + attributes.fgColor.rgb = "FF" + attributes.fgColor.rgb /// add alpha to an RGB as Excel expects aRGB + } + + $fgColor.attr('rgb', attributes.fgColor.rgb); + $patternFill.append($fgColor); + } + else if (attributes.fgColor.theme) { + $fgColor.attr('theme', attributes.fgColor.theme); + if (attributes.fgColor.tint) { + $fgColor.attr('tint', attributes.fgColor.tint); + } + $patternFill.append($fgColor); + } + + if (!attributes.bgColor) { + attributes.bgColor = { "indexed": "64"} + } + } + + if (attributes.bgColor) { + var $bgColor = XmlNode('bgColor').attr(attributes.bgColor); + $patternFill.append($bgColor); + } + + var $fill = XmlNode('fill') + .append($patternFill); + + this.$fills.append($fill); + + var count = this.$fills.children().length; + this.$fills.attr('count', count); + return count - 1; + }, + + _getSubBorder: function(direction, spec) { + + var $direction = XmlNode(direction); + if (spec){ + if (spec.style) $direction.attr('style', spec.style); + if (spec.color) { + var $color = XmlNode('color'); + if (spec.color.auto) { + $color.attr('auto', spec.color.auto); + } + else if (spec.color.rgb) { + $color.attr('rgb', spec.color.rgb); + } + else if (spec.color.theme || spec.color.tint) { + $color.attr('theme', spec.color.theme || "1"); + $color.attr('tint', spec.color.tint || "0"); + } + $direction.append($color) + } + } + return $direction; + }, + + _addBorder: function (attributes) { + if (!attributes) { return 0; } + + var self = this; + + var $border = XmlNode('border') + .attr("diagonalUp",attributes.diagonalUp) + .attr("diagonalDown",attributes.diagonalDown); + + var directions = ["left","right","top","bottom","diagonal"]; + + directions.forEach(function(direction) { + $border.append(self._getSubBorder(direction, attributes[direction])) + }); + this.$borders.append($border); + + var count = this.$borders.children().length; + this.$borders.attr('count', count); + return count -1; + }, + + toXml: function () { + return this.$styles.toXml(); + } + }.initialize(options||{}); + } + /** + * 样式魔改区 -- end + */ + + XLSX.parse_xlscfb = parse_xlscfb; + XLSX.parse_ods = parse_ods; + XLSX.parse_fods = parse_fods; + XLSX.write_ods = write_ods; + XLSX.parse_zip = parse_zip; + XLSX.read = readSync; //xlsread + XLSX.readFile = readFileSync; //readFile + XLSX.readFileSync = readFileSync; + XLSX.write = writeSync; + XLSX.writeFile = writeFileSync; + XLSX.writeFileSync = writeFileSync; + XLSX.writeFileAsync = writeFileAsync; + XLSX.utils = utils; + XLSX.SSF = SSF; + XLSX.CFB = CFB; +} +/*global define */ +if(typeof exports !== 'undefined') make_xlsx_lib(exports); +else if(typeof module !== 'undefined' && module.exports) make_xlsx_lib(module.exports); +else if(typeof define === 'function' && define.amd) define('xlsx', function() { if(!XLSX.version) make_xlsx_lib(XLSX); return XLSX; }); +else make_xlsx_lib(XLSX); +/*exported XLS, ODS */ +var XLS = XLSX, ODS = XLSX;/*---------split--------*//* + Copyright (c) 2010, Linden Research, Inc. + Copyright (c) 2014, Joshua Bell + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + $/LicenseInfo$ + */ + +// Original can be found at: +// https://bitbucket.org/lindenlab/llsd +// Modifications by Joshua Bell inexorabletash@gmail.com +// https://github.com/inexorabletash/polyfill + +// ES3/ES5 implementation of the Krhonos Typed Array Specification +// Ref: http://www.khronos.org/registry/typedarray/specs/latest/ +// Date: 2011-02-01 +// +// Variations: +// * Allows typed_array.get/set() as alias for subscripts (typed_array[]) +// * Gradually migrating structure from Khronos spec to ES2015 spec +// +// Caveats: +// * Beyond 10000 or so entries, polyfilled array accessors (ta[0], +// etc) become memory-prohibitive, so array creation will fail. Set +// self.TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS=true to disable +// creation of accessors. Your code will need to use the +// non-standard get()/set() instead, and will need to add those to +// native arrays for interop. +(function(global) { + 'use strict'; + var undefined = (void 0); // Paranoia + + // Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to + // create, and consume so much memory, that the browser appears frozen. + var MAX_ARRAY_LENGTH = 1e5; + + // Approximations of internal ECMAScript conversion functions + function Type(v) { + switch(typeof v) { + case 'undefined': return 'undefined'; + case 'boolean': return 'boolean'; + case 'number': return 'number'; + case 'string': return 'string'; + default: return v === null ? 'null' : 'object'; + } + } + + // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues: + function Class(v) { return Object.prototype.toString.call(v).replace(/^\[object *|\]$/g, ''); } + function IsCallable(o) { return typeof o === 'function'; } + function ToObject(v) { + if (v === null || v === undefined) throw TypeError(); + return Object(v); + } + function ToInt32(v) { return v >> 0; } + function ToUint32(v) { return v >>> 0; } + + // Snapshot intrinsics + var LN2 = Math.LN2, + abs = Math.abs, + floor = Math.floor, + log = Math.log, + max = Math.max, + min = Math.min, + pow = Math.pow, + round = Math.round; + + // emulate ES5 getter/setter API using legacy APIs + // http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx + // (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but + // note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless) + + (function() { + var orig = Object.defineProperty; + var dom_only = !(function(){try{return Object.defineProperty({},'x',{});}catch(_){return false;}}()); + + if (!orig || dom_only) { + Object.defineProperty = function (o, prop, desc) { + // In IE8 try built-in implementation for defining properties on DOM prototypes. + if (orig) + try { return orig(o, prop, desc); } catch (_) {} + if (o !== Object(o)) + throw TypeError('Object.defineProperty called on non-object'); + if (Object.prototype.__defineGetter__ && ('get' in desc)) + Object.prototype.__defineGetter__.call(o, prop, desc.get); + if (Object.prototype.__defineSetter__ && ('set' in desc)) + Object.prototype.__defineSetter__.call(o, prop, desc.set); + if ('value' in desc) + o[prop] = desc.value; + return o; + }; + } + }()); + + // ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value) + // for index in 0 ... obj.length + function makeArrayAccessors(obj) { + if ('TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS' in global) + return; + + if (obj.length > MAX_ARRAY_LENGTH) throw RangeError('Array too large for polyfill'); + + function makeArrayAccessor(index) { + Object.defineProperty(obj, index, { + 'get': function() { return obj._getter(index); }, + 'set': function(v) { obj._setter(index, v); }, + enumerable: true, + configurable: false + }); + } + + var i; + for (i = 0; i < obj.length; i += 1) { + makeArrayAccessor(i); + } + } + + // Internal conversion functions: + // pack() - take a number (interpreted as Type), output a byte array + // unpack() - take a byte array, output a Type-like number + + function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; } + function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; } + + function packI8(n) { return [n & 0xff]; } + function unpackI8(bytes) { return as_signed(bytes[0], 8); } + + function packU8(n) { return [n & 0xff]; } + function unpackU8(bytes) { return as_unsigned(bytes[0], 8); } + + function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; } + + function packI16(n) { return [n & 0xff, (n >> 8) & 0xff]; } + function unpackI16(bytes) { return as_signed(bytes[1] << 8 | bytes[0], 16); } + + function packU16(n) { return [n & 0xff, (n >> 8) & 0xff]; } + function unpackU16(bytes) { return as_unsigned(bytes[1] << 8 | bytes[0], 16); } + + function packI32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; } + function unpackI32(bytes) { return as_signed(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); } + + function packU32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; } + function unpackU32(bytes) { return as_unsigned(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); } + + function packIEEE754(v, ebits, fbits) { + + var bias = (1 << (ebits - 1)) - 1; + + function roundToEven(n) { + var w = floor(n), f = n - w; + if (f < 0.5) + return w; + if (f > 0.5) + return w + 1; + return w % 2 ? w + 1 : w; + } + + // Compute sign, exponent, fraction + var s, e, f; + if (v !== v) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + // Normalized + e = min(floor(log(v) / LN2), 1023); + var significand = v / pow(2, e); + if (significand < 1) { + e -= 1; + significand *= 2; + } + if (significand >= 2) { + e += 1; + significand /= 2; + } + var d = pow(2, fbits); + f = roundToEven(significand * d) - d; + e += bias; + if (f / d >= 1) { + e += 1; + f = 0; + } + if (e > 2 * bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } + } else { + // Denormalized + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + var bits = [], i; + for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); } + for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); } + bits.push(s ? 1 : 0); + bits.reverse(); + var str = bits.join(''); + + // Bits to bytes + var bytes = []; + while (str.length) { + bytes.unshift(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; + } + + function unpackIEEE754(bytes, ebits, fbits) { + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = 0; i < bytes.length; ++i) { + b = bytes[i]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) { + return f !== 0 ? NaN : s * Infinity; + } else if (e > 0) { + // Normalized + return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + } else if (f !== 0) { + // Denormalized + return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + } else { + return s < 0 ? -0 : 0; + } + } + + function unpackF64(b) { return unpackIEEE754(b, 11, 52); } + function packF64(v) { return packIEEE754(v, 11, 52); } + function unpackF32(b) { return unpackIEEE754(b, 8, 23); } + function packF32(v) { return packIEEE754(v, 8, 23); } + + // + // 3 The ArrayBuffer Type + // + + (function() { + + function ArrayBuffer(length) { + length = ToInt32(length); + if (length < 0) throw RangeError('ArrayBuffer size is not a small enough positive integer.'); + Object.defineProperty(this, 'byteLength', {value: length}); + Object.defineProperty(this, '_bytes', {value: Array(length)}); + + for (var i = 0; i < length; i += 1) + this._bytes[i] = 0; + } + + global.ArrayBuffer = global.ArrayBuffer || ArrayBuffer; + + // + // 5 The Typed Array View Types + // + + function $TypedArray$() { + + // %TypedArray% ( length ) + if (!arguments.length || typeof arguments[0] !== 'object') { + return (function(length) { + length = ToInt32(length); + if (length < 0) throw RangeError('length is not a small enough positive integer.'); + Object.defineProperty(this, 'length', {value: length}); + Object.defineProperty(this, 'byteLength', {value: length * this.BYTES_PER_ELEMENT}); + Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(this.byteLength)}); + Object.defineProperty(this, 'byteOffset', {value: 0}); + + }).apply(this, arguments); + } + + // %TypedArray% ( typedArray ) + if (arguments.length >= 1 && + Type(arguments[0]) === 'object' && + arguments[0] instanceof $TypedArray$) { + return (function(typedArray){ + if (this.constructor !== typedArray.constructor) throw TypeError(); + + var byteLength = typedArray.length * this.BYTES_PER_ELEMENT; + Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: 0}); + Object.defineProperty(this, 'length', {value: typedArray.length}); + + for (var i = 0; i < this.length; i += 1) + this._setter(i, typedArray._getter(i)); + + }).apply(this, arguments); + } + + // %TypedArray% ( array ) + if (arguments.length >= 1 && + Type(arguments[0]) === 'object' && + !(arguments[0] instanceof $TypedArray$) && + !(arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) { + return (function(array) { + + var byteLength = array.length * this.BYTES_PER_ELEMENT; + Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: 0}); + Object.defineProperty(this, 'length', {value: array.length}); + + for (var i = 0; i < this.length; i += 1) { + var s = array[i]; + this._setter(i, Number(s)); + } + }).apply(this, arguments); + } + + // %TypedArray% ( buffer, byteOffset=0, length=undefined ) + if (arguments.length >= 1 && + Type(arguments[0]) === 'object' && + (arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) { + return (function(buffer, byteOffset, length) { + + byteOffset = ToUint32(byteOffset); + if (byteOffset > buffer.byteLength) + throw RangeError('byteOffset out of range'); + + // The given byteOffset must be a multiple of the element + // size of the specific type, otherwise an exception is raised. + if (byteOffset % this.BYTES_PER_ELEMENT) + throw RangeError('buffer length minus the byteOffset is not a multiple of the element size.'); + + if (length === undefined) { + var byteLength = buffer.byteLength - byteOffset; + if (byteLength % this.BYTES_PER_ELEMENT) + throw RangeError('length of buffer minus byteOffset not a multiple of the element size'); + length = byteLength / this.BYTES_PER_ELEMENT; + + } else { + length = ToUint32(length); + byteLength = length * this.BYTES_PER_ELEMENT; + } + + if ((byteOffset + byteLength) > buffer.byteLength) + throw RangeError('byteOffset and length reference an area beyond the end of the buffer'); + + Object.defineProperty(this, 'buffer', {value: buffer}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: byteOffset}); + Object.defineProperty(this, 'length', {value: length}); + + }).apply(this, arguments); + } + + // %TypedArray% ( all other argument combinations ) + throw TypeError(); + } + + // Properties of the %TypedArray Instrinsic Object + + // %TypedArray%.from ( source , mapfn=undefined, thisArg=undefined ) + Object.defineProperty($TypedArray$, 'from', {value: function(iterable) { + return new this(iterable); + }}); + + // %TypedArray%.of ( ...items ) + Object.defineProperty($TypedArray$, 'of', {value: function(/*...items*/) { + return new this(arguments); + }}); + + // %TypedArray%.prototype + var $TypedArrayPrototype$ = {}; + $TypedArray$.prototype = $TypedArrayPrototype$; + + // WebIDL: getter type (unsigned long index); + Object.defineProperty($TypedArray$.prototype, '_getter', {value: function(index) { + if (arguments.length < 1) throw SyntaxError('Not enough arguments'); + + index = ToUint32(index); + if (index >= this.length) + return undefined; + + var bytes = [], i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + bytes.push(this.buffer._bytes[o]); + } + return this._unpack(bytes); + }}); + + // NONSTANDARD: convenience alias for getter: type get(unsigned long index); + Object.defineProperty($TypedArray$.prototype, 'get', {value: $TypedArray$.prototype._getter}); + + // WebIDL: setter void (unsigned long index, type value); + Object.defineProperty($TypedArray$.prototype, '_setter', {value: function(index, value) { + if (arguments.length < 2) throw SyntaxError('Not enough arguments'); + + index = ToUint32(index); + if (index >= this.length) + return; + + var bytes = this._pack(value), i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + this.buffer._bytes[o] = bytes[i]; + } + }}); + + // get %TypedArray%.prototype.buffer + // get %TypedArray%.prototype.byteLength + // get %TypedArray%.prototype.byteOffset + // -- applied directly to the object in the constructor + + // %TypedArray%.prototype.constructor + Object.defineProperty($TypedArray$.prototype, 'constructor', {value: $TypedArray$}); + + // %TypedArray%.prototype.copyWithin (target, start, end = this.length ) + Object.defineProperty($TypedArray$.prototype, 'copyWithin', {value: function(target, start) { + var end = arguments[2]; + + var o = ToObject(this); + var lenVal = o.length; + var len = ToUint32(lenVal); + len = max(len, 0); + var relativeTarget = ToInt32(target); + var to; + if (relativeTarget < 0) + to = max(len + relativeTarget, 0); + else + to = min(relativeTarget, len); + var relativeStart = ToInt32(start); + var from; + if (relativeStart < 0) + from = max(len + relativeStart, 0); + else + from = min(relativeStart, len); + var relativeEnd; + if (end === undefined) + relativeEnd = len; + else + relativeEnd = ToInt32(end); + var final; + if (relativeEnd < 0) + final = max(len + relativeEnd, 0); + else + final = min(relativeEnd, len); + var count = min(final - from, len - to); + var direction; + if (from < to && to < from + count) { + direction = -1; + from = from + count - 1; + to = to + count - 1; + } else { + direction = 1; + } + while (count > 0) { + o._setter(to, o._getter(from)); + from = from + direction; + to = to + direction; + count = count - 1; + } + return o; + }}); + + // %TypedArray%.prototype.entries ( ) + // -- defined in es6.js to shim browsers w/ native TypedArrays + + // %TypedArray%.prototype.every ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'every', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var thisArg = arguments[1]; + for (var i = 0; i < len; i++) { + if (!callbackfn.call(thisArg, t._getter(i), i, t)) + return false; + } + return true; + }}); + + // %TypedArray%.prototype.fill (value, start = 0, end = this.length ) + Object.defineProperty($TypedArray$.prototype, 'fill', {value: function(value) { + var start = arguments[1], + end = arguments[2]; + + var o = ToObject(this); + var lenVal = o.length; + var len = ToUint32(lenVal); + len = max(len, 0); + var relativeStart = ToInt32(start); + var k; + if (relativeStart < 0) + k = max((len + relativeStart), 0); + else + k = min(relativeStart, len); + var relativeEnd; + if (end === undefined) + relativeEnd = len; + else + relativeEnd = ToInt32(end); + var final; + if (relativeEnd < 0) + final = max((len + relativeEnd), 0); + else + final = min(relativeEnd, len); + while (k < final) { + o._setter(k, value); + k += 1; + } + return o; + }}); + + // %TypedArray%.prototype.filter ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'filter', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var res = []; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + var val = t._getter(i); // in case fun mutates this + if (callbackfn.call(thisp, val, i, t)) + res.push(val); + } + return new this.constructor(res); + }}); + + // %TypedArray%.prototype.find (predicate, thisArg = undefined) + Object.defineProperty($TypedArray$.prototype, 'find', {value: function(predicate) { + var o = ToObject(this); + var lenValue = o.length; + var len = ToUint32(lenValue); + if (!IsCallable(predicate)) throw TypeError(); + var t = arguments.length > 1 ? arguments[1] : undefined; + var k = 0; + while (k < len) { + var kValue = o._getter(k); + var testResult = predicate.call(t, kValue, k, o); + if (Boolean(testResult)) + return kValue; + ++k; + } + return undefined; + }}); + + // %TypedArray%.prototype.findIndex ( predicate, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'findIndex', {value: function(predicate) { + var o = ToObject(this); + var lenValue = o.length; + var len = ToUint32(lenValue); + if (!IsCallable(predicate)) throw TypeError(); + var t = arguments.length > 1 ? arguments[1] : undefined; + var k = 0; + while (k < len) { + var kValue = o._getter(k); + var testResult = predicate.call(t, kValue, k, o); + if (Boolean(testResult)) + return k; + ++k; + } + return -1; + }}); + + // %TypedArray%.prototype.forEach ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'forEach', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) + callbackfn.call(thisp, t._getter(i), i, t); + }}); + + // %TypedArray%.prototype.indexOf (searchElement, fromIndex = 0 ) + Object.defineProperty($TypedArray$.prototype, 'indexOf', {value: function(searchElement) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (len === 0) return -1; + var n = 0; + if (arguments.length > 0) { + n = Number(arguments[1]); + if (n !== n) { + n = 0; + } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { + n = (n > 0 || -1) * floor(abs(n)); + } + } + if (n >= len) return -1; + var k = n >= 0 ? n : max(len - abs(n), 0); + for (; k < len; k++) { + if (t._getter(k) === searchElement) { + return k; + } + } + return -1; + }}); + + // %TypedArray%.prototype.join ( separator ) + Object.defineProperty($TypedArray$.prototype, 'join', {value: function(separator) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + var tmp = Array(len); + for (var i = 0; i < len; ++i) + tmp[i] = t._getter(i); + return tmp.join(separator === undefined ? ',' : separator); // Hack for IE7 + }}); + + // %TypedArray%.prototype.keys ( ) + // -- defined in es6.js to shim browsers w/ native TypedArrays + + // %TypedArray%.prototype.lastIndexOf ( searchElement, fromIndex = this.length-1 ) + Object.defineProperty($TypedArray$.prototype, 'lastIndexOf', {value: function(searchElement) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (len === 0) return -1; + var n = len; + if (arguments.length > 1) { + n = Number(arguments[1]); + if (n !== n) { + n = 0; + } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { + n = (n > 0 || -1) * floor(abs(n)); + } + } + var k = n >= 0 ? min(n, len - 1) : len - abs(n); + for (; k >= 0; k--) { + if (t._getter(k) === searchElement) + return k; + } + return -1; + }}); + + // get %TypedArray%.prototype.length + // -- applied directly to the object in the constructor + + // %TypedArray%.prototype.map ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'map', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var res = []; res.length = len; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) + res[i] = callbackfn.call(thisp, t._getter(i), i, t); + return new this.constructor(res); + }}); + + // %TypedArray%.prototype.reduce ( callbackfn [, initialValue] ) + Object.defineProperty($TypedArray$.prototype, 'reduce', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + // no value to return if no initial value and an empty array + if (len === 0 && arguments.length === 1) throw TypeError(); + var k = 0; + var accumulator; + if (arguments.length >= 2) { + accumulator = arguments[1]; + } else { + accumulator = t._getter(k++); + } + while (k < len) { + accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t); + k++; + } + return accumulator; + }}); + + // %TypedArray%.prototype.reduceRight ( callbackfn [, initialValue] ) + Object.defineProperty($TypedArray$.prototype, 'reduceRight', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + // no value to return if no initial value, empty array + if (len === 0 && arguments.length === 1) throw TypeError(); + var k = len - 1; + var accumulator; + if (arguments.length >= 2) { + accumulator = arguments[1]; + } else { + accumulator = t._getter(k--); + } + while (k >= 0) { + accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t); + k--; + } + return accumulator; + }}); + + // %TypedArray%.prototype.reverse ( ) + Object.defineProperty($TypedArray$.prototype, 'reverse', {value: function() { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + var half = floor(len / 2); + for (var i = 0, j = len - 1; i < half; ++i, --j) { + var tmp = t._getter(i); + t._setter(i, t._getter(j)); + t._setter(j, tmp); + } + return t; + }}); + + // %TypedArray%.prototype.set(array, offset = 0 ) + // %TypedArray%.prototype.set(typedArray, offset = 0 ) + // WebIDL: void set(TypedArray array, optional unsigned long offset); + // WebIDL: void set(sequence array, optional unsigned long offset); + Object.defineProperty($TypedArray$.prototype, 'set', {value: function(index, value) { + if (arguments.length < 1) throw SyntaxError('Not enough arguments'); + var array, sequence, offset, len, + i, s, d, + byteOffset, byteLength, tmp; + + if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) { + // void set(TypedArray array, optional unsigned long offset); + array = arguments[0]; + offset = ToUint32(arguments[1]); + + if (offset + array.length > this.length) { + throw RangeError('Offset plus length of array is out of range'); + } + + byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT; + byteLength = array.length * this.BYTES_PER_ELEMENT; + + if (array.buffer === this.buffer) { + tmp = []; + for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) { + tmp[i] = array.buffer._bytes[s]; + } + for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) { + this.buffer._bytes[d] = tmp[i]; + } + } else { + for (i = 0, s = array.byteOffset, d = byteOffset; + i < byteLength; i += 1, s += 1, d += 1) { + this.buffer._bytes[d] = array.buffer._bytes[s]; + } + } + } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') { + // void set(sequence array, optional unsigned long offset); + sequence = arguments[0]; + len = ToUint32(sequence.length); + offset = ToUint32(arguments[1]); + + if (offset + len > this.length) { + throw RangeError('Offset plus length of array is out of range'); + } + + for (i = 0; i < len; i += 1) { + s = sequence[i]; + this._setter(offset + i, Number(s)); + } + } else { + throw TypeError('Unexpected argument type(s)'); + } + }}); + + // %TypedArray%.prototype.slice ( start, end ) + Object.defineProperty($TypedArray$.prototype, 'slice', {value: function(start, end) { + var o = ToObject(this); + var lenVal = o.length; + var len = ToUint32(lenVal); + var relativeStart = ToInt32(start); + var k = (relativeStart < 0) ? max(len + relativeStart, 0) : min(relativeStart, len); + var relativeEnd = (end === undefined) ? len : ToInt32(end); + var final = (relativeEnd < 0) ? max(len + relativeEnd, 0) : min(relativeEnd, len); + var count = final - k; + var c = o.constructor; + var a = new c(count); + var n = 0; + while (k < final) { + var kValue = o._getter(k); + a._setter(n, kValue); + ++k; + ++n; + } + return a; + }}); + + // %TypedArray%.prototype.some ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'some', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (callbackfn.call(thisp, t._getter(i), i, t)) { + return true; + } + } + return false; + }}); + + // %TypedArray%.prototype.sort ( comparefn ) + Object.defineProperty($TypedArray$.prototype, 'sort', {value: function(comparefn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + var tmp = Array(len); + for (var i = 0; i < len; ++i) + tmp[i] = t._getter(i); + function sortCompare(x, y) { + if (x !== x && y !== y) return +0; + if (x !== x) return 1; + if (y !== y) return -1; + if (comparefn !== undefined) { + return comparefn(x, y); + } + if (x < y) return -1; + if (x > y) return 1; + return +0; + } + tmp.sort(sortCompare); + for (i = 0; i < len; ++i) + t._setter(i, tmp[i]); + return t; + }}); + + // %TypedArray%.prototype.subarray(begin = 0, end = this.length ) + // WebIDL: TypedArray subarray(long begin, optional long end); + Object.defineProperty($TypedArray$.prototype, 'subarray', {value: function(start, end) { + function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } + + start = ToInt32(start); + end = ToInt32(end); + + if (arguments.length < 1) { start = 0; } + if (arguments.length < 2) { end = this.length; } + + if (start < 0) { start = this.length + start; } + if (end < 0) { end = this.length + end; } + + start = clamp(start, 0, this.length); + end = clamp(end, 0, this.length); + + var len = end - start; + if (len < 0) { + len = 0; + } + + return new this.constructor( + this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len); + }}); + + // %TypedArray%.prototype.toLocaleString ( ) + // %TypedArray%.prototype.toString ( ) + // %TypedArray%.prototype.values ( ) + // %TypedArray%.prototype [ @@iterator ] ( ) + // get %TypedArray%.prototype [ @@toStringTag ] + // -- defined in es6.js to shim browsers w/ native TypedArrays + + function makeTypedArray(elementSize, pack, unpack) { + // Each TypedArray type requires a distinct constructor instance with + // identical logic, which this produces. + var TypedArray = function() { + Object.defineProperty(this, 'constructor', {value: TypedArray}); + $TypedArray$.apply(this, arguments); + makeArrayAccessors(this); + }; + if ('__proto__' in TypedArray) { + TypedArray.__proto__ = $TypedArray$; + } else { + TypedArray.from = $TypedArray$.from; + TypedArray.of = $TypedArray$.of; + } + + TypedArray.BYTES_PER_ELEMENT = elementSize; + + var TypedArrayPrototype = function() {}; + TypedArrayPrototype.prototype = $TypedArrayPrototype$; + + TypedArray.prototype = new TypedArrayPrototype(); + + Object.defineProperty(TypedArray.prototype, 'BYTES_PER_ELEMENT', {value: elementSize}); + Object.defineProperty(TypedArray.prototype, '_pack', {value: pack}); + Object.defineProperty(TypedArray.prototype, '_unpack', {value: unpack}); + + return TypedArray; + } + + var Int8Array = makeTypedArray(1, packI8, unpackI8); + var Uint8Array = makeTypedArray(1, packU8, unpackU8); + var Uint8ClampedArray = makeTypedArray(1, packU8Clamped, unpackU8); + var Int16Array = makeTypedArray(2, packI16, unpackI16); + var Uint16Array = makeTypedArray(2, packU16, unpackU16); + var Int32Array = makeTypedArray(4, packI32, unpackI32); + var Uint32Array = makeTypedArray(4, packU32, unpackU32); + var Float32Array = makeTypedArray(4, packF32, unpackF32); + var Float64Array = makeTypedArray(8, packF64, unpackF64); + + global.Int8Array = global.Int8Array || Int8Array; + global.Uint8Array = global.Uint8Array || Uint8Array; + global.Uint8ClampedArray = global.Uint8ClampedArray || Uint8ClampedArray; + global.Int16Array = global.Int16Array || Int16Array; + global.Uint16Array = global.Uint16Array || Uint16Array; + global.Int32Array = global.Int32Array || Int32Array; + global.Uint32Array = global.Uint32Array || Uint32Array; + global.Float32Array = global.Float32Array || Float32Array; + global.Float64Array = global.Float64Array || Float64Array; + }()); + + // + // 6 The DataView View Type + // + + (function() { + function r(array, index) { + return IsCallable(array.get) ? array.get(index) : array[index]; + } + + var IS_BIG_ENDIAN = (function() { + var u16array = new Uint16Array([0x1234]), + u8array = new Uint8Array(u16array.buffer); + return r(u8array, 0) === 0x12; + }()); + + // DataView(buffer, byteOffset=0, byteLength=undefined) + // WebIDL: Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, + // optional unsigned long byteLength) + function DataView(buffer, byteOffset, byteLength) { + if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError(); + + byteOffset = ToUint32(byteOffset); + if (byteOffset > buffer.byteLength) + throw RangeError('byteOffset out of range'); + + if (byteLength === undefined) + byteLength = buffer.byteLength - byteOffset; + else + byteLength = ToUint32(byteLength); + + if ((byteOffset + byteLength) > buffer.byteLength) + throw RangeError('byteOffset and length reference an area beyond the end of the buffer'); + + Object.defineProperty(this, 'buffer', {value: buffer}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: byteOffset}); + }; + + // get DataView.prototype.buffer + // get DataView.prototype.byteLength + // get DataView.prototype.byteOffset + // -- applied directly to instances by the constructor + + function makeGetter(arrayType) { + return function GetViewValue(byteOffset, littleEndian) { + byteOffset = ToUint32(byteOffset); + + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) + throw RangeError('Array index out of range'); + + byteOffset += this.byteOffset; + + var uint8Array = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT), + bytes = []; + for (var i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) + bytes.push(r(uint8Array, i)); + + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) + bytes.reverse(); + + return r(new arrayType(new Uint8Array(bytes).buffer), 0); + }; + } + + Object.defineProperty(DataView.prototype, 'getUint8', {value: makeGetter(Uint8Array)}); + Object.defineProperty(DataView.prototype, 'getInt8', {value: makeGetter(Int8Array)}); + Object.defineProperty(DataView.prototype, 'getUint16', {value: makeGetter(Uint16Array)}); + Object.defineProperty(DataView.prototype, 'getInt16', {value: makeGetter(Int16Array)}); + Object.defineProperty(DataView.prototype, 'getUint32', {value: makeGetter(Uint32Array)}); + Object.defineProperty(DataView.prototype, 'getInt32', {value: makeGetter(Int32Array)}); + Object.defineProperty(DataView.prototype, 'getFloat32', {value: makeGetter(Float32Array)}); + Object.defineProperty(DataView.prototype, 'getFloat64', {value: makeGetter(Float64Array)}); + + function makeSetter(arrayType) { + return function SetViewValue(byteOffset, value, littleEndian) { + byteOffset = ToUint32(byteOffset); + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) + throw RangeError('Array index out of range'); + + // Get bytes + var typeArray = new arrayType([value]), + byteArray = new Uint8Array(typeArray.buffer), + bytes = [], i, byteView; + + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) + bytes.push(r(byteArray, i)); + + // Flip if necessary + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) + bytes.reverse(); + + // Write them + byteView = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT); + byteView.set(bytes); + }; + } + + Object.defineProperty(DataView.prototype, 'setUint8', {value: makeSetter(Uint8Array)}); + Object.defineProperty(DataView.prototype, 'setInt8', {value: makeSetter(Int8Array)}); + Object.defineProperty(DataView.prototype, 'setUint16', {value: makeSetter(Uint16Array)}); + Object.defineProperty(DataView.prototype, 'setInt16', {value: makeSetter(Int16Array)}); + Object.defineProperty(DataView.prototype, 'setUint32', {value: makeSetter(Uint32Array)}); + Object.defineProperty(DataView.prototype, 'setInt32', {value: makeSetter(Int32Array)}); + Object.defineProperty(DataView.prototype, 'setFloat32', {value: makeSetter(Float32Array)}); + Object.defineProperty(DataView.prototype, 'setFloat64', {value: makeSetter(Float64Array)}); + + global.DataView = global.DataView || DataView; + + }()); + +}(self)); diff --git a/admin/static/layui/layui_exts/excel.min.js b/admin/static/layui/layui_exts/excel.min.js new file mode 100644 index 0000000..b988cc3 --- /dev/null +++ b/admin/static/layui/layui_exts/excel.min.js @@ -0,0 +1,2 @@ +/* JeffreyWang压缩打包 lay-excel 1.6.0*/ +function make_xlsx_lib(a){function b(){Fl(1252)}function c(){Gl(1200),b()}function d(a){for(var b=[],c=0,d=a.length;c>1;++c)b[c]=String.fromCharCode(a.charCodeAt(2*c)+(a.charCodeAt(2*c+1)<<8));return b.join("")}function f(a){for(var b=[],c=0;c>1;++c)b[c]=String.fromCharCode(a.charCodeAt(2*c+1)+(a.charCodeAt(2*c)<<8));return b.join("")}function g(a){return Ml?Buffer.alloc(a):new Array(a)}function h(a){return Ml?Buffer.allocUnsafe(a):new Array(a)}function i(a){if("undefined"==typeof ArrayBuffer)return Pl(a);for(var b=new ArrayBuffer(a.length),c=new Uint8Array(b),d=0;d!=a.length;++d)c[d]=255&a.charCodeAt(d);return b}function j(a){if(Array.isArray(a))return a.map(kq).join("");for(var b=[],c=0;c=0?h=j:e=j}}),i>=0&&-1==h&&e>=0&&(h=e,e=-1);var j=(""+(d>=0?d:(new Date).getFullYear())).slice(-4)+"-"+("00"+(e>=1?e:1)).slice(-2)+"-"+("00"+(f>=1?f:1)).slice(-2);7==j.length&&(j="0"+j),8==j.length&&(j="20"+j);var k=("00"+(g>=0?g:0)).slice(-2)+":"+("00"+(h>=0?h:0)).slice(-2)+":"+("00"+(i>=0?i:0)).slice(-2);return-1==g&&-1==h&&-1==i?j:-1==d&&-1==e&&-1==f?k:j+"T"+k}function o(a){return"string"==typeof a?i(a):Array.isArray(a)?k(a):a}function p(a,b,c){if(void 0!==_l&&_l.writeFileSync)return c?_l.writeFileSync(a,b,c):_l.writeFileSync(a,b);var d="utf8"==c?um(b):b;if("undefined"!=typeof IE_SaveFile)return IE_SaveFile(d,a);if("undefined"!=typeof Blob){var e=new Blob([o(d)],{type:"application/octet-stream"});if("undefined"!=typeof navigator&&navigator.msSaveBlob)return navigator.msSaveBlob(e,a);if("undefined"!=typeof saveAs)return saveAs(e,a);if("undefined"!=typeof URL&&"undefined"!=typeof document&&document.createElement&&URL.createObjectURL){var f=URL.createObjectURL(e);if("object"==typeof chrome&&"function"==typeof(chrome.downloads||{}).download)return URL.revokeObjectURL&&"undefined"!=typeof setTimeout&&setTimeout(function(){URL.revokeObjectURL(f)},6e4),chrome.downloads.download({url:f,filename:a,saveAs:!0});var g=document.createElement("a");if(null!=g.download)return g.download=a,g.href=f,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL&&"undefined"!=typeof setTimeout&&setTimeout(function(){URL.revokeObjectURL(f)},6e4),f}}if("undefined"!=typeof $&&"undefined"!=typeof File&&"undefined"!=typeof Folder)try{var h=File(a);return h.open("w"),h.encoding="binary",Array.isArray(b)&&(b=j(b)),h.write(b),h.close(),b}catch(a){if(!a.message||!a.message.match(/onstruct/))throw a}throw new Error("cannot save file "+a)}function q(a){if(void 0!==_l)return _l.readFileSync(a);if("undefined"!=typeof $&&"undefined"!=typeof File&&"undefined"!=typeof Folder)try{var b=File(a);b.open("r"),b.encoding="binary";var c=b.read();return b.close(),c}catch(a){if(!a.message||!a.message.match(/onstruct/))throw a}throw new Error("Cannot access file "+a)}function r(a){for(var b=Object.keys(a),c=[],d=0;d3&&(d=!0),e[f].slice(e[f].length-1)){case"Y":throw new Error("Unsupported ISO Duration Field: "+e[f].slice(e[f].length-1));case"D":c*=24;case"H":c*=60;case"M":if(!d)throw new Error("Unsupported ISO Duration Field: M");c*=60}b+=c*parseInt(e[f],10)}return b}function z(a,b){var c=new Date(a);if(em)return b>0?c.setTime(c.getTime()+60*c.getTimezoneOffset()*1e3):b<0&&c.setTime(c.getTime()-60*c.getTimezoneOffset()*1e3),c;if(a instanceof Date)return a;if(1917==cm.getFullYear()&&!isNaN(c.getFullYear())){var d=c.getFullYear();return a.indexOf(""+d)>-1?c:(c.setFullYear(c.getFullYear()+100),c)}var e=a.match(/\d+/g)||["2017","2","19","0","0","0"],f=new Date(+e[0],+e[1]-1,+e[2],+e[3]||0,+e[4]||0,+e[5]||0);return a.indexOf("Z")>-1&&(f=new Date(f.getTime()-60*f.getTimezoneOffset()*1e3)),f}function A(a){for(var b="",c=0;c!=a.length;++c)b+=String.fromCharCode(a[c]);return b}function B(a){if("undefined"!=typeof JSON&&!Array.isArray(a))return JSON.parse(JSON.stringify(a));if("object"!=typeof a||null==a)return a;if(a instanceof Date)return new Date(a.getTime());var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=B(a[c]));return b}function C(a,b){for(var c="";c.length8099?c:(e>0||f>1)&&101!=d?b:a.toLowerCase().match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)?b:a.match(/[^-0-9:,\/\\]/)?c:b}function F(a,b,c){if(fm||"string"==typeof b)return a.split(b);for(var d=a.split(b),e=[d[0]],f=1;f0&&(j=j.slice(0,j.indexOf("_"))),c[j]=h,c[j.toLowerCase()]=h;else{var m=(5===g&&"xmlns"===j.slice(0,5)?"xmlns":"")+j.slice(g+1);if(c[m]&&"ext"==j.slice(g-3,g))continue;c[m]=h,c[m.toLowerCase()]=h}}return c}function Q(a){return a.replace(km,"<$1")}function R(a){return(a+"").replace(om,function(a){return mm[a]}).replace(pm,function(a){return"_x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+"_"})}function S(a){return R(a).replace(/ /g,"_x0020_")}function T(a){return(a+"").replace(om,function(a){return mm[a]}).replace(/\n/g,"
          ").replace(qm,function(a){return"&#x"+("000"+a.charCodeAt(0).toString(16)).slice(-4)+";"})}function U(a){return(a+"").replace(om,function(a){return mm[a]}).replace(qm,function(a){return"&#x"+a.charCodeAt(0).toString(16).toUpperCase()+";"})}function V(a){switch(a){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function W(a,b){var c=P(a),d=a.match(Am(c.baseType))||[],e=[];if(d.length!=c.size){if(b.WTF)throw new Error("unexpected vector length "+d.length+" != "+c.size);return e}return d.forEach(function(a){var b=a.replace(Bm,"").match(Cm);b&&e.push({v:tm(b[2]),t:b[1]})}),e}function X(a,b){return"<"+a+(b.match(Dm)?' xml:space="preserve"':"")+">"+b+""}function Y(a){return r(a).map(function(b){return" "+b+'="'+a[b]+'"'}).join("")}function Z(a,b,c){return"<"+a+(null!=c?Y(c):"")+(null!=b?(b.match(Dm)?' xml:space="preserve"':"")+">"+b+""}function _(a,b){try{return a.toISOString().replace(/\.\d*/,"")}catch(a){if(b)throw a}return""}function aa(a){switch(typeof a){case"string":return Z("vt:lpwstr",a);case"number":return Z((0|a)==a?"vt:i4":"vt:r8",String(a));case"boolean":return Z("vt:bool",a?"true":"false")}if(a instanceof Date)return Z("vt:filetime",_(a));throw new Error("Unable to serialize "+a)}function ba(a,b){for(var c=1-2*(a[b+7]>>>7),d=((127&a[b+7])<<4)+(a[b+6]>>>4&15),e=15&a[b+6],f=5;f>=0;--f)e=256*e+a[b+f];return 2047==d?0==e?c*(1/0):NaN:(0==d?d=-1022:(d-=1023,e+=Math.pow(2,52)),c*Math.pow(2,d-52)*e)}function ca(a,b,c){var d=(b<0||1/b==-1/0?1:0)<<7,e=0,f=0,g=d?-b:b;isFinite(g)?0==g?e=f=0:(e=Math.floor(Math.log(g)/Math.LN2),f=g*Math.pow(2,52-e),e<=-1023&&(!isFinite(f)||f>4|d}function da(a,b){var c,d,e,f,g,h,i="",j=[];switch(b){case"dbcs":if(h=this.l,Ml&&Buffer.isBuffer(this))i=this.slice(this.l,this.l+2*a).toString("utf16le");else for(g=0;g0?dn:en)(this,this.l),this.l+=4,c):(d=cn(this,this.l),this.l+=4,d);case 8:case-8:if("f"===b)return d=8==a?Wm(this,this.l):Wm([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]],0),this.l+=8,d;a=8;case 16:i=Mm(this,this.l,a)}}return this.l+=a,i}function ea(a,b,c){var d=0,e=0;if("dbcs"===c){for(e=0;e!=b.length;++e)hn(this,b.charCodeAt(e),this.l+2*e);d=2*b.length}else if("sbcs"===c){for(b=b.replace(/[^\x00-\x7F]/g,"_"),e=0;e!=b.length;++e)this[this.l+e]=255&b.charCodeAt(e);d=b.length}else{if("hex"===c){for(;e>8}for(;this.l>>=8,this[this.l+1]=255&b;break;case 3:d=3,this[this.l]=255&b,b>>>=8,this[this.l+1]=255&b,b>>>=8,this[this.l+2]=255&b;break;case 4:d=4,fn(this,b,this.l);break;case 8:if(d=8,"f"===c){ca(this,b,this.l);break}case 16:break;case-4:d=4,gn(this,b,this.l)}}return this.l+=d,this}function fa(a,b){var c=Mm(this,this.l,a.length>>1);if(c!==a)throw new Error(b+"Expected "+a+" saw "+c);this.l+=a.length>>1}function ga(a,b){a.l=b,a.read_shift=da,a.chk=fa,a.write_shift=ea}function ha(a,b){a.l+=b}function ia(a){var b=g(a);return ga(b,0),b}function ja(a,b,c){if(a){var d,e,f;ga(a,a.l||0);for(var g=a.length,h=0,i=0;a.ld.l&&(d=d.slice(0,d.l),d.l=d.length),d.length>0&&a.push(d),d=null)},f=function(a){return d&&a=128?1:0)+1,d>=128&&++e,d>=16384&&++e,d>=2097152&&++e;var g=a.next(e);f<=127?g.write_shift(1,f):(g.write_shift(1,128+(127&f)),g.write_shift(1,f>>7));for(var h=0;4!=h;++h){if(!(d>=128)){g.write_shift(1,d);break}g.write_shift(1,128+(127&d)),d>>=7}d>0&&$m(c)&&a.push(c)}}function ma(a,b,c){var d=B(a);if(b.s?(d.cRel&&(d.c+=b.s.c),d.rRel&&(d.r+=b.s.r)):(d.cRel&&(d.c+=b.c),d.rRel&&(d.r+=b.r)),!c||c.biff<12){for(;d.c>=256;)d.c-=256;for(;d.r>=65536;)d.r-=65536}return d}function na(a,b,c){var d=B(a);return d.s=ma(d.s,b.s,c),d.e=ma(d.e,b.s,c),d}function oa(a,b){a.cRel&&a.c<0&&(a=B(a),a.c+=b>8?16384:256),a.rRel&&a.r<0&&(a=B(a),a.r+=b>8?1048576:b>5?65536:16384);var c=Aa(a);return 0===a.cRel&&(c=wa(c)),0===a.rRel&&(c=sa(c)),c}function pa(a,b){return 0!=a.s.r||a.s.rRel||a.e.r!=(b.biff>=12?1048575:b.biff>=8?65536:16384)||a.e.rRel?0!=a.s.c||a.s.cRel||a.e.c!=(b.biff>=12?65535:255)||a.e.cRel?oa(a.s,b.biff)+":"+oa(a.e,b.biff):(a.s.rRel?"":"$")+ra(a.s.r)+":"+(a.e.rRel?"":"$")+ra(a.e.r):(a.s.cRel?"":"$")+va(a.s.c)+":"+(a.e.cRel?"":"$")+va(a.e.c)}function qa(a){return parseInt(ta(a),10)-1}function ra(a){return""+(a+1)}function sa(a){return a.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function ta(a){return a.replace(/\$(\d+)$/,"$1")}function ua(a){for(var b=xa(a),c=0,d=0;d!==b.length;++d)c=26*c+b.charCodeAt(d)-64;return c-1}function va(a){var b="";for(++a;a;a=Math.floor((a-1)/26))b=String.fromCharCode((a-1)%26+65)+b;return b}function wa(a){return a.replace(/^([A-Z])/,"$$$1")}function xa(a){return a.replace(/^\$([A-Z])/,"$1")}function ya(a){return a.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function za(a){var b=ya(a);return{c:ua(b[0]),r:qa(b[1])}}function Aa(a){return va(a.c)+ra(a.r)}function Ba(a){var b=a.split(":").map(za);return{s:b[0],e:b[b.length-1]}}function Ca(a,b){return void 0===b||"number"==typeof b?Ca(a.s,a.e):("string"!=typeof a&&(a=Aa(a)),"string"!=typeof b&&(b=Aa(b)),a==b?a:a+":"+b)}function Da(a){var b={s:{c:0,r:0},e:{c:0,r:0}},c=0,d=0,e=0,f=a.length;for(c=0;d26);++d)c=26*c+e;for(b.s.c=--c,c=0;d9);++d)c=10*c+e;if(b.s.r=--c,d===f||58===a.charCodeAt(++d))return b.e.c=b.s.c,b.e.r=b.s.r,b;for(c=0;d!=f&&!((e=a.charCodeAt(d)-64)<1||e>26);++d)c=26*c+e;for(b.e.c=--c,c=0;d!=f&&!((e=a.charCodeAt(d)-48)<0||e>9);++d)c=10*c+e;return b.e.r=--c,b}function Ea(a,b){var c="d"==a.t&&b instanceof Date;if(null!=a.z)try{return a.w=Tl.format(a.z,c?w(b):b)}catch(a){}try{return a.w=Tl.format((a.XF||{}).numFmtId||(c?14:0),c?w(b):b)}catch(a){return""+b}}function Fa(a,b,c){return null==a||null==a.t||"z"==a.t?"":void 0!==a.w?a.w:("d"==a.t&&!a.z&&c&&c.dateNF&&(a.z=c.dateNF),void 0==b?Ea(a,a.v):Ea(a,b))}function Ga(a,b){var c=b&&b.sheet?b.sheet:"Sheet1",d={};return d[c]=a,{SheetNames:[c],Sheets:d}}function Ha(a,b,c){var d=c||{},e=a?Array.isArray(a):d.dense;null!=Jl&&null==e&&(e=Jl);var f=a||(e?[]:{}),g=0,h=0;if(f&&null!=d.origin)if("number"==typeof d.origin)g=d.origin;else{var i="string"==typeof d.origin?za(d.origin):d.origin;g=i.r,h=i.c}var j={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(f["!ref"]){var k=Da(f["!ref"]);j.s.c=k.s.c,j.s.r=k.s.r,j.e.c=Math.max(j.e.c,k.e.c),j.e.r=Math.max(j.e.r,k.e.r),-1==g&&(j.e.r=g=k.e.r+1)}for(var l=0;l!=b.length;++l)if(b[l]){if(!Array.isArray(b[l]))throw new Error("aoa_to_sheet expects an array of arrays");for(var m=0;m!=b[l].length;++m)if(void 0!==b[l][m]){var n={v:b[l][m]},o=g+l,p=h+m;if(j.s.r>o&&(j.s.r=o),j.s.c>p&&(j.s.c=p),j.e.r0&&b.write_shift(0,a,"dbcs"),c?b.slice(0,b.l):b}function Ma(a){return{ich:a.read_shift(2),ifnt:a.read_shift(2)}}function Na(a,b){return b||(b=ia(4)),b.write_shift(2,a.ich||0),b.write_shift(2,a.ifnt||0),b}function Oa(a,b){var c=a.l,d=a.read_shift(1),e=Ka(a),f=[],g={t:e,h:e};if(0!=(1&d)){for(var h=a.read_shift(4),i=0;i!=h;++i)f.push(Ma(a));g.r=f}else g.r=[{ich:0,ifnt:0}];return a.l=c+b,g}function Pa(a,b){var c=!1;return null==b&&(c=!0,b=ia(15+4*a.t.length)),b.write_shift(1,0),La(a.t,b),c?b.slice(0,b.l):b}function Qa(a,b){var c=!1;return null==b&&(c=!0,b=ia(23+4*a.t.length)),b.write_shift(1,1),La(a.t,b),b.write_shift(4,1),Na({ich:0,ifnt:0},b),c?b.slice(0,b.l):b}function Ra(a){var b=a.read_shift(4),c=a.read_shift(2);return c+=a.read_shift(1)<<16,a.l++,{c:b,iStyleRef:c}}function Sa(a,b){return null==b&&(b=ia(8)),b.write_shift(-4,a.c),b.write_shift(3,a.iStyleRef||a.s),b.write_shift(1,0),b}function Ta(a){var b=a.read_shift(4);return 0===b||4294967295===b?"":a.read_shift(b,"dbcs")}function Ua(a,b){var c=!1;return null==b&&(c=!0,b=ia(127)),b.write_shift(4,a.length>0?a.length:4294967295),a.length>0&&b.write_shift(0,a,"dbcs"),c?b.slice(0,b.l):b}function Va(a){var b=a.slice(a.l,a.l+4),c=1&b[0],d=2&b[0];a.l+=4,b[0]&=252;var e=0===d?Wm([0,0,0,0,b[0],b[1],b[2],b[3]],0):dn(b,0)>>2;return c?e/100:e}function Wa(a,b){null==b&&(b=ia(4));var c=0,d=0,e=100*a;if(a==(0|a)&&a>=-(1<<29)&&a<1<<29?d=1:e==(0|e)&&e>=-(1<<29)&&e<1<<29&&(d=1,c=1),!d)throw new Error("unsupported RkNumber "+a);b.write_shift(-4,((c?e:a)<<2)+(c+2))}function Xa(a){var b={s:{},e:{}};return b.s.r=a.read_shift(4),b.e.r=a.read_shift(4),b.s.c=a.read_shift(4),b.e.c=a.read_shift(4),b}function Ya(a,b){return b||(b=ia(16)),b.write_shift(4,a.s.r),b.write_shift(4,a.e.r),b.write_shift(4,a.s.c),b.write_shift(4,a.e.c),b}function Za(a){return a.read_shift(8,"f")}function $a(a,b){return(b||ia(8)).write_shift(8,a,"f")}function _a(a){var b={},c=a.read_shift(1),d=c>>>1,e=a.read_shift(1),f=a.read_shift(2,"i"),g=a.read_shift(1),h=a.read_shift(1),i=a.read_shift(1);switch(a.l++,d){case 0:b.auto=1;break;case 1:b.index=e;var j=On[e];j&&(b.rgb=Ke(j));break;case 2:b.rgb=Ke([g,h,i]);break;case 3:b.theme=e}return 0!=f&&(b.tint=f>0?f/32767:f/32768),b}function ab(a,b){if(b||(b=ia(8)),!a||a.auto)return b.write_shift(4,0),b.write_shift(4,0),b;a.index?(b.write_shift(1,2),b.write_shift(1,a.index)):a.theme?(b.write_shift(1,6),b.write_shift(1,a.theme)):(b.write_shift(1,5),b.write_shift(1,0));var c=a.tint||0;if(c>0?c*=32767:c<0&&(c*=32768),b.write_shift(2,c),a.rgb){var d=a.rgb||"FFFFFF";b.write_shift(1,parseInt(d.slice(0,2),16)),b.write_shift(1,parseInt(d.slice(2,4),16)),b.write_shift(1,parseInt(d.slice(4,6),16)),b.write_shift(1,255)}else b.write_shift(2,0),b.write_shift(1,0),b.write_shift(1,0);return b}function bb(a){var b=a.read_shift(1);return a.l++,{fItalic:2&b,fStrikeout:8&b,fOutline:16&b,fShadow:32&b,fCondense:64&b,fExtend:128&b}}function cb(a,b){b||(b=ia(2));var c=(a.italic?2:0)|(a.strike?8:0)|(a.outline?16:0)|(a.shadow?32:0)|(a.condense?64:0)|(a.extend?128:0);return b.write_shift(1,c),b.write_shift(1,0),b}function db(a,b){var c={2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"},d=a.read_shift(4);switch(d){case 0:return"";case 4294967295:case 4294967294:return c[a.read_shift(4)]||""}if(d>400)throw new Error("Unsupported Clipboard: "+d.toString(16));return a.l-=4,a.read_shift(0,1==b?"lpstr":"lpwstr")}function eb(a){return db(a,1)}function fb(a){return db(a,2)}function gb(a){return a.map(function(a){return[a>>16&255,a>>8&255,255&a]})}function hb(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],TODO:[],xmlns:""}}function ib(a){var b=hb();if(!a||!a.match)return b;var c={};if((a.match(im)||[]).forEach(function(a){var d=P(a);switch(d[0].replace(jm,"<")){case"0?b.calcchains[0]:"",b.sst=b.strs.length>0?b.strs[0]:"",b.style=b.styles.length>0?b.styles[0]:"",b.defaults=c,delete b.calcchains,b}function jb(a,b){var c,d=[];d[d.length]=gm,d[d.length]=Sn,d=d.concat(Tn);var e=function(e){a[e]&&a[e].length>0&&(c=a[e][0],d[d.length]=Z("Override",null,{PartName:("/"==c[0]?"":"/")+c,ContentType:Qn[e][b.bookType||"xlsx"]}))},f=function(c){(a[c]||[]).forEach(function(a){d[d.length]=Z("Override",null,{PartName:("/"==a[0]?"":"/")+a,ContentType:Qn[c][b.bookType||"xlsx"]})})},g=function(b){(a[b]||[]).forEach(function(a){d[d.length]=Z("Override",null,{PartName:("/"==a[0]?"":"/")+a,ContentType:Rn[b][0]})})};return e("workbooks"),f("sheets"),f("charts"),g("themes"),["strs","styles"].forEach(e),["coreprops","extprops","custprops"].forEach(g),g("vba"),g("comments"),g("drawings"),d.length>2&&(d[d.length]="",d[1]=d[1].replace("/>",">")),d.join("")}function kb(a){var b=a.lastIndexOf("/");return a.slice(0,b+1)+"_rels/"+a.slice(b+1)+".rels"}function lb(a,b){if(!a)return a;"/"!==b.charAt(0)&&(b="/"+b);var c={},d={};return(a.match(im)||[]).forEach(function(a){var e=P(a);if("2&&(b[b.length]="",b[1]=b[1].replace("/>",">")),b.join("")}function nb(a,b,c,d,e){if(e||(e={}),a["!id"]||(a["!id"]={}),b<0)for(b=1;a["!id"]["rId"+b];++b);if(e.Id="rId"+b,e.Type=d,e.Target=c,e.Type==Un.HLINK&&(e.TargetMode="External"),a["!id"][e.Id])throw new Error("Cannot rewrite rId "+b);return a["!id"][e.Id]=e,a[("/"+e.Target).replace("//","/")]=e,b}function ob(a,b){for(var c,d,e=Vj(a);c=lq.exec(e);)switch(c[3]){case"manifest":break;case"file-entry":if(d=P(c[0],!1),"/"==d.path&&d.type!==Wn)throw new Error("This OpenDocument is not a spreadsheet");break;case"encryption-data":case"algorithm":case"start-key-generation":case"key-derivation":throw new Error("Unsupported ODS Encryption");default:if(b&&b.WTF)throw c}}function pb(a){var b=[gm];b.push('\n'),b.push(' \n');for(var c=0;c\n');return b.push(""),b.join("")}function qb(a,b,c){return[' \n',' \n'," \n"].join("")}function rb(a,b){return[' \n',' \n'," \n"].join("")}function sb(a){var b=[gm];b.push('\n');for(var c=0;c!=a.length;++c)b.push(qb(a[c][0],a[c][1])),b.push(rb("",a[c][0]));return b.push(qb("","Document","pkg")),b.push(""),b.join("")}function tb(a){var b={};a=tm(a);for(var c=0;c0&&(b[d[1]]=e[1]),"date"===d[2]&&b[d[1]]&&(b[d[1]]=z(b[d[1]]))}return b}function ub(a,b,c,d,e){null==e[a]&&null!=b&&""!==b&&(e[a]=b,d[d.length]=c?Z(a,b,c):X(a,b))}function vb(a,b){var c=b||{},d=[gm,$n],e={};if(!a&&!c.Props)return d.join("");a&&(null!=a.CreatedDate&&ub("dcterms:created","string"==typeof a.CreatedDate?a.CreatedDate:_(a.CreatedDate,c.WTF),{"xsi:type":"dcterms:W3CDTF"},d,e),null!=a.ModifiedDate&&ub("dcterms:modified","string"==typeof a.ModifiedDate?a.ModifiedDate:_(a.ModifiedDate,c.WTF),{"xsi:type":"dcterms:W3CDTF"},d,e));for(var f=0;f!=Yn.length;++f){var g=Yn[f],h=c.Props&&null!=c.Props[g[1]]?c.Props[g[1]]:a?a[g[1]]:null;!0===h?h="1":!1===h?h="0":"number"==typeof h&&(h=String(h)),null!=h&&ub(g[0],h,null,d,e)}return d.length>2&&(d[d.length]="",d[1]=d[1].replace("/>",">")),d.join("")}function wb(a,b,c,d){var e=[];if("string"==typeof a)e=W(a,d);else for(var f=0;f0)for(var j=0;j!==e.length;j+=2){switch(i=+e[j+1].v,e[j].v){case"Worksheets":case"工作表":case"Листы":case"أوراق العمل":case"ワークシート":case"גליונות עבודה":case"Arbeitsblätter":case"Çalışma Sayfaları":case"Feuilles de calcul":case"Fogli di lavoro":case"Folhas de cálculo":case"Planilhas":case"Regneark":case"Werkbladen":c.Worksheets=i,c.SheetNames=g.slice(h,h+i);break;case"Named Ranges":case"名前付き一覧":case"Benannte Bereiche":case"Navngivne områder":c.NamedRanges=i,c.DefinedNames=g.slice(h,h+i);break;case"Charts":case"Diagramme":c.Chartsheets=i,c.ChartNames=g.slice(h,h+i)}h+=i}}function xb(a,b,c){var d={};return b||(b={}),a=tm(a),_n.forEach(function(c){switch(c[2]){case"string":b[c[1]]=(a.match(ym(c[0]))||[])[1];break;case"bool":b[c[1]]="true"===(a.match(ym(c[0]))||[])[1];break;case"raw":var e=a.match(new RegExp("<"+c[0]+"[^>]*>([\\s\\S]*?)"));e&&e.length>0&&(d[c[1]]=e[1])}}),d.HeadingPairs&&d.TitlesOfParts&&wb(d.HeadingPairs,d.TitlesOfParts,b,c),b}function yb(a){var b=[],c=Z;return a||(a={}),a.Application="SheetJS",b[b.length]=gm,b[b.length]=bo,_n.forEach(function(d){if(void 0!==a[d[1]]){var e;switch(d[2]){case"string":e=String(a[d[1]]);break;case"bool":e=a[d[1]]?"true":"false"}void 0!==e&&(b[b.length]=c(d[0],e))}}),b[b.length]=c("HeadingPairs",c("vt:vector",c("vt:variant","Worksheets")+c("vt:variant",c("vt:i4",String(a.Worksheets))),{size:2,baseType:"variant"})),b[b.length]=c("TitlesOfParts",c("vt:vector",a.SheetNames.map(function(a){return""+R(a)+""}).join(""),{size:a.Worksheets,baseType:"lpstr"})),b.length>2&&(b[b.length]="",b[1]=b[1].replace("/>",">")),b.join("")}function zb(a,b){var c={},d="",e=a.match(co);if(e)for(var f=0;f!=e.length;++f){var g=e[f],h=P(g);switch(h[0]){case"":d=null;break;default:if(0===g.indexOf(""),j=i[0].slice(4),k=i[1];switch(j){case"lpstr":case"bstr":case"lpwstr":c[d]=nm(k);break;case"bool":c[d]=V(k);break;case"i1":case"i2":case"i4":case"i8":case"int":case"uint":c[d]=parseInt(k,10);break;case"r4":case"r8":case"decimal":c[d]=parseFloat(k);break;case"filetime":case"date":c[d]=z(k);break;case"cy":case"error":c[d]=nm(k);break;default:if("/"==j.slice(-1))break;b.WTF&&"undefined"!=typeof console&&console.warn("Unexpected",g,j,i)}}else if("2&&(b[b.length]="",b[1]=b[1].replace("/>",">")),b.join("")}function Bb(a,b,c){b=go[b]||b,a[b]=c}function Cb(a,b){var c=[];return r(fo).map(function(a){for(var b=0;b'+e.join("")+""}function Eb(a){var b=a.read_shift(4),c=a.read_shift(4);return new Date(1e3*(c/1e7*Math.pow(2,32)+b/1e7-11644473600)).toISOString().replace(/\.000/,"")}function Fb(a){var b="string"==typeof a?new Date(Date.parse(a)):a,c=b.getTime()/1e3+11644473600,d=c%Math.pow(2,32),e=(c-d)/Math.pow(2,32);d*=1e7,e*=1e7;var f=d/Math.pow(2,32)|0;f>0&&(d%=Math.pow(2,32),e+=f);var g=ia(8);return g.write_shift(4,d),g.write_shift(4,e),g}function Gb(a,b,c){var d=a.l,e=a.read_shift(0,"lpstr-cp");if(c)for(;a.l-d&3;)++a.l;return e}function Hb(a,b,c){var d=a.read_shift(0,"lpwstr");return c&&(a.l+=4-(d.length+1&3)&3),d}function Ib(a,b,c){return 31===b?Hb(a):Gb(a,b,c)}function Jb(a,b,c){return Ib(a,b,!1===c?0:4)}function Kb(a,b){if(!b)throw new Error("VtUnalignedString must have positive length");return Ib(a,b,0)}function Lb(a){for(var b=a.read_shift(4),c=[],d=0;d!=b;++d)c[d]=a.read_shift(0,"lpstr-cp").replace(Rl,"");return c}function Mb(a){return Lb(a)}function Nb(a){return[Tb(a,Fn),Tb(a,vn)]}function Ob(a){for(var b=a.read_shift(4),c=[],d=0;d!=b/2;++d)c.push(Nb(a));return c}function Pb(a){return Ob(a)}function Qb(a,b){for(var c=a.read_shift(4),d={},e=0;e!=c;++e){var f=a.read_shift(4),g=a.read_shift(4);d[f]=a.read_shift(g,1200===b?"utf16le":"utf8").replace(Rl,"").replace(Sl,"!"),1200===b&&g%2&&(a.l+=2)}return 3&a.l&&(a.l=a.l>>3<<2),d}function Rb(a){var b=a.read_shift(4),c=a.slice(a.l,a.l+b);return a.l+=b,(3&b)>0&&(a.l+=4-(3&b)&3),c}function Sb(a){var b={};return b.Size=a.read_shift(4),a.l+=b.Size+3-(b.Size-1)%4,b}function Tb(a,b,c){var d,e=a.read_shift(2),f=c||{};if(a.l+=2,b!==xn&&e!==b&&-1===Gn.indexOf(b))throw new Error("Expected type "+b+" saw "+e);switch(b===xn?e:b){case 2:return d=a.read_shift(2,"i"),f.raw||(a.l+=2),d;case 3:return d=a.read_shift(4,"i");case 11:return 0!==a.read_shift(4);case 19:return d=a.read_shift(4);case 30:return Gb(a,e,4).replace(Rl,"");case 31:return Hb(a);case 64:return Eb(a);case 65:return Rb(a);case 71:return Sb(a);case 80:return Jb(a,e,!f.raw).replace(Rl,"");case 81:return Kb(a,e).replace(Rl,"");case 4108:return Pb(a);case 4126:return Mb(a);default:throw new Error("TypedPropertyValue unrecognized type "+b+" "+e)}}function Ub(a,b){var c=ia(4),d=ia(4);switch(c.write_shift(4,80==a?31:a),a){case 3:d.write_shift(-4,b);break;case 5:d=ia(8),d.write_shift(8,b,"f");break;case 11:d.write_shift(4,b?1:0);break;case 64:d=Fb(b);break;case 31:case 80:for(d=ia(4+2*(b.length+1)+(b.length%2?0:2)),d.write_shift(4,b.length+1),d.write_shift(0,b,"dbcs");d.l!=d.length;)d.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+a+" "+b)}return Ql([c,d])}function Vb(a,b){var c=a.l,d=a.read_shift(4),e=a.read_shift(4),f=[],g=0,h=0,i=-1,j={};for(g=0;g!=e;++g){var k=a.read_shift(4),l=a.read_shift(4);f[g]=[k,l+c]}f.sort(function(a,b){return a[1]-b[1]});var m={};for(g=0;g!=e;++g){if(a.l!==f[g][1]){var n=!0;if(g>0&&b)switch(b[f[g-1][0]].t){case 2:a.l+2===f[g][1]&&(a.l+=2,n=!1);break;case 80:case 4108:a.l<=f[g][1]&&(a.l=f[g][1],n=!1)}if((!b||0==g)&&a.l<=f[g][1]&&(n=!1,a.l=f[g][1]),n)throw new Error("Read Error: Expected address "+f[g][1]+" at "+a.l+" :"+g)}if(b){var o=b[f[g][0]];if(m[o.n]=Tb(a,o.t,{raw:!0}),"version"===o.p&&(m[o.n]=String(m[o.n]>>16)+"."+("0000"+String(65535&m[o.n])).slice(-4)),"CodePage"==o.n)switch(m[o.n]){case 0:m[o.n]=1252;case 874:case 932:case 936:case 949:case 950:case 1250:case 1251:case 1253:case 1254:case 1255:case 1256:case 1257:case 1258:case 1e4:case 1200:case 1201:case 1252:case 65e3:case-536:case 65001:case-535:Gl(h=m[o.n]>>>0&65535);break;default:throw new Error("Unsupported CodePage: "+m[o.n])}}else if(1===f[g][0]){if(h=m.CodePage=Tb(a,un),Gl(h),-1!==i){var p=a.l;a.l=f[i][1],j=Qb(a,h),a.l=p}}else if(0===f[g][0]){if(0===h){i=g,a.l=f[g+1][1];continue}j=Qb(a,h)}else{var q,r=j[f[g][0]];switch(a[a.l]){case 65:a.l+=4,q=Rb(a);break;case 30:case 31:a.l+=4,q=Jb(a,a[a.l-4]).replace(/\u0000+$/,"");break;case 3:a.l+=4,q=a.read_shift(4,"i");break;case 19:a.l+=4,q=a.read_shift(4);break;case 5:a.l+=4,q=a.read_shift(8,"f");break;case 11:a.l+=4,q=bc(a,4);break;case 64:a.l+=4,q=z(Eb(a));break;default:throw new Error("unparsed value: "+a[a.l])}m[r]=q}}return a.l=c+d,m}function Wb(a){switch(typeof a){case"boolean":return 11;case"number":return(0|a)==a?3:5;case"string":return 31;case"object":if(a instanceof Date)return 64}return-1}function Xb(a,b,c){var d=ia(8),e=[],f=[],g=8,h=0,i=ia(8),j=ia(8);if(i.write_shift(4,2),i.write_shift(4,1200),j.write_shift(4,1),f.push(i),e.push(j),g+=8+i.length,!b){j=ia(8),j.write_shift(4,0),e.unshift(j);var k=[ia(4)];for(k[0].write_shift(4,a.length),h=0;h-1)&&null!=a[h][1]){var m=a[h][1],n=0;if(b){n=+b[a[h][0]];var o=c[n];if("version"==o.p&&"string"==typeof m){var p=m.split(".");m=(+p[0]<<16)+(+p[1]||0)}i=Ub(o.t,m)}else{var q=Wb(m);-1==q&&(q=31,m=String(m)),i=Ub(q,m)}f.push(i),j=ia(8),j.write_shift(4,b?n:2+h),e.push(j),g+=8+i.length}var r=8*(f.length+1);for(h=0;h=12?2:1),e="sbcs-cont",f=Al;if(c&&c.biff>=8&&(Al=1200),c&&8!=c.biff)12==c.biff&&(e="wstr");else{a.read_shift(1)&&(e="dbcs-cont")}c.biff>=2&&c.biff<=5&&(e="cpstr");var g=d?a.read_shift(d,e):"";return Al=f,g}function jc(a){var b=Al;Al=1200;var c,d=a.read_shift(2),e=a.read_shift(1),f=4&e,g=8&e,h=1+(1&e),i=0,j={};g&&(i=a.read_shift(2)),f&&(c=a.read_shift(4));var k=2==h?"dbcs-cont":"sbcs-cont",l=0===d?"":a.read_shift(d,k);return g&&(a.l+=4*i),f&&(a.l+=c),j.t=l,g||(j.raw=""+j.t+"",j.r=j.t),Al=b,j}function kc(a,b,c){if(c){if(c.biff>=2&&c.biff<=5)return a.read_shift(b,"cpstr");if(c.biff>=12)return a.read_shift(b,"dbcs-cont")}return 0===a.read_shift(1)?a.read_shift(b,"sbcs-cont"):a.read_shift(b,"dbcs-cont")}function lc(a,b,c){var d=a.read_shift(c&&2==c.biff?1:2);return 0===d?(a.l++,""):kc(a,d,c)}function mc(a,b,c){if(c.biff>5)return lc(a,b,c);var d=a.read_shift(1);return 0===d?(a.l++,""):a.read_shift(d,c.biff<=4||!a.lens?"cpstr":"sbcs-cont")}function nc(a,b,c){return c||(c=ia(3+2*a.length)),c.write_shift(2,a.length),c.write_shift(1,1),c.write_shift(31,a,"utf16le"),c}function oc(a){var b=a.read_shift(1);a.l++;var c=a.read_shift(2);return a.l+=2,[b,c]}function pc(a){var b=a.read_shift(4),c=a.l,d=!1;b>24&&(a.l+=b-24,"795881f43b1d7f48af2c825dc4852763"===a.read_shift(16)&&(d=!0),a.l=c);var e=a.read_shift((d?b-24:b)>>1,"utf16le").replace(Rl,"");return d&&(a.l+=24),e}function qc(a){a.l+=2;var b=a.read_shift(0,"lpstr-ansi");if(a.l+=2,57005!=a.read_shift(2))throw new Error("Bad FileMoniker");if(0===a.read_shift(4))return b.replace(/\\/g,"/");var c=a.read_shift(4);if(3!=a.read_shift(2))throw new Error("Bad FileMoniker");return a.read_shift(c>>1,"utf16le").replace(Rl,"")}function rc(a,b){var c=a.read_shift(16);switch(b-=16,c){case"e0c9ea79f9bace118c8200aa004ba90b":return pc(a,b);case"0303000000000000c000000000000046":return qc(a,b);default:throw new Error("Unsupported Moniker "+c)}}function sc(a){var b=a.read_shift(4);return b>0?a.read_shift(b,"utf16le").replace(Rl,""):""}function tc(a,b){var c=a.l+b,d=a.read_shift(4);if(2!==d)throw new Error("Unrecognized streamVersion: "+d);var e=a.read_shift(2);a.l+=2;var f,g,h,i,j,k,l="";16&e&&(f=sc(a,c-a.l)),128&e&&(g=sc(a,c-a.l)),257==(257&e)&&(h=sc(a,c-a.l)),1==(257&e)&&(i=rc(a,c-a.l)),8&e&&(l=sc(a,c-a.l)),32&e&&(j=a.read_shift(16)),64&e&&(k=Eb(a)),a.l=c;var m=g||h||i||"";m&&l&&(m+="#"+l),m||(m="#"+l);var n={Target:m};return j&&(n.guid=j),k&&(n.time=k),f&&(n.Tooltip=f),n}function uc(a){var b=ia(512),c=0,d=a.Target,e=d.indexOf("#")>-1?31:23;switch(d.charAt(0)){case"#":e=28;break;case".":e&=-3}b.write_shift(4,2),b.write_shift(4,e);var f=[8,6815827,6619237,4849780,83];for(c=0;c8?4:2;return[a.read_shift(d),a.read_shift(d,"i"),a.read_shift(d,"i")]}function Cc(a){return[a.read_shift(2),Va(a)]}function Dc(a,b,c){a.l+=4,b-=4;var d=a.l+b,e=ic(a,b,c),f=a.read_shift(2);if(d-=a.l,f!==d)throw new Error("Malformed AddinUdf: padding = "+d+" != "+f);return a.l+=f,e}function Ec(a){var b=a.read_shift(2),c=a.read_shift(2);return{s:{c:a.read_shift(2),r:b},e:{c:a.read_shift(2),r:c}}}function Fc(a,b){return b||(b=ia(8)),b.write_shift(2,a.s.r),b.write_shift(2,a.e.r),b.write_shift(2,a.s.c),b.write_shift(2,a.e.c),b}function Gc(a){var b=a.read_shift(2),c=a.read_shift(2);return{s:{c:a.read_shift(1),r:b},e:{c:a.read_shift(1),r:c}}}function Hc(a){a.l+=4;var b=a.read_shift(2),c=a.read_shift(2),d=a.read_shift(2);return a.l+=12,[c,b,d]}function Ic(a){var b={};return a.l+=4,a.l+=16,b.fSharedNote=a.read_shift(2),a.l+=4,b}function Jc(a){var b={};return a.l+=4,a.cf=a.read_shift(2),b}function Kc(a){a.l+=2,a.l+=a.read_shift(2)}function Lc(a,b){for(var c=a.l+b,d=[];a.l=2&&(c.dt=a.read_shift(2),a.l-=2),c.BIFFVer){case 1536:case 1280:case 1024:case 768:case 512:case 2:case 7:break;default:if(b>6)throw new Error("Unexpected BIFF Ver "+c.BIFFVer)}return a.read_shift(b),c}function Nc(a,b,c){var d=1536,e=16;switch(c.bookType){case"biff8":break;case"biff5":d=1280,e=8;break;case"biff4":d=4,e=6;break;case"biff3":d=3,e=6;break;case"biff2":d=2,e=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var f=ia(e);return f.write_shift(2,d),f.write_shift(2,b),e>4&&f.write_shift(2,29282),e>6&&f.write_shift(2,1997),e>8&&(f.write_shift(2,49161),f.write_shift(2,1),f.write_shift(2,1798),f.write_shift(2,0)),f}function Oc(a,b){return 0===b?1200:(a.read_shift(2),1200)}function Pc(a,b,c){if(c.enc)return a.l+=b,"";var d=a.l,e=mc(a,0,c);return a.read_shift(b+d-a.l),e}function Qc(a,b){var c=!b||8==b.biff,d=ia(c?112:54);for(d.write_shift(8==b.biff?2:1,7),c&&d.write_shift(1,0),d.write_shift(4,859007059),d.write_shift(4,5458548|(c?0:536870912));d.l=8?2:1,d=ia(8+c*a.name.length);d.write_shift(4,a.pos),d.write_shift(1,a.hs||0),d.write_shift(1,a.dt),d.write_shift(1,a.name.length),b.biff>=8&&d.write_shift(1,1),d.write_shift(c*a.name.length,a.name,b.biff<8?"sbcs":"utf16le");var e=d.slice(0,d.l);return e.l=d.l,e}function Uc(a,b){for(var c=a.l+b,d=a.read_shift(4),e=a.read_shift(4),f=[],g=0;g!=e&&a.l>15),e&=32767),[{Unsynced:1&d,DyZero:(2&d)>>1,ExAsc:(4&d)>>2,ExDsc:(8&d)>>3},e]}function $c(a){return{Pos:[a.read_shift(2),a.read_shift(2)],Dim:[a.read_shift(2),a.read_shift(2)],Flags:a.read_shift(2),CurTab:a.read_shift(2),FirstTab:a.read_shift(2),Selected:a.read_shift(2),TabRatio:a.read_shift(2)}}function _c(){var a=ia(18);return a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,29280),a.write_shift(2,17600),a.write_shift(2,56),a.write_shift(2,0),a.write_shift(2,0),a.write_shift(2,1),a.write_shift(2,500),a}function ad(a,b,c){return c&&c.biff>=2&&c.biff<8?{}:{RTL:64&a.read_shift(2)}}function bd(a){var b=ia(18),c=1718;return a&&a.RTL&&(c|=64),b.write_shift(2,c),b.write_shift(4,0),b.write_shift(4,64),b.write_shift(4,0),b.write_shift(4,0),b}function cd(a,b,c){var d={dyHeight:a.read_shift(2),fl:a.read_shift(2)};switch(c&&c.biff||8){case 2:break;case 3:case 4:a.l+=2;break;default:a.l+=10}return d.name=ic(a,0,c),d}function dd(a,b){var c=a.name||"Arial",d=b&&5==b.biff,e=d?15+c.length:16+2*c.length,f=ia(e);return f.write_shift(2,20*(a.sz||12)),f.write_shift(4,0),f.write_shift(2,400),f.write_shift(4,0),f.write_shift(2,0),f.write_shift(1,c.length),d||f.write_shift(1,1),f.write_shift((d?1:2)*c.length,c,d?"sbcs":"utf16le"),f}function ed(a){var b=xc(a);return b.isst=a.read_shift(4),b}function fd(a,b,c){var d=a.l+b,e=xc(a,6);2==c.biff&&a.l++;var f=lc(a,d-a.l,c);return e.val=f,e}function gd(a,b,c,d,e){var f=!e||8==e.biff,g=ia(+f+8+(1+f)*c.length);return yc(a,b,d,g),g.write_shift(2,c.length),f&&g.write_shift(1,1),g.write_shift((1+f)*c.length,c,f?"utf16le":"sbcs"),g}function hd(a,b,c){return[a.read_shift(2),mc(a,0,c)]}function id(a,b,c,d){var e=c&&5==c.biff;d||(d=ia(e?3+b.length:5+2*b.length)),d.write_shift(2,a),d.write_shift(e?1:2,b.length),e||d.write_shift(1,1),d.write_shift((e?1:2)*b.length,b,e?"sbcs":"utf16le");var f=d.length>d.l?d.slice(0,d.l):d;return null==f.l&&(f.l=f.length),f}function jd(a,b,c){var d=a.l+b,e=8!=c.biff&&c.biff?2:4,f=a.read_shift(e),g=a.read_shift(e),h=a.read_shift(2),i=a.read_shift(2);return a.l=d,{s:{r:f,c:h},e:{r:g,c:i}}}function kd(a,b){var c=8!=b.biff&&b.biff?2:4,d=ia(2*c+6);return d.write_shift(c,a.s.r),d.write_shift(c,a.e.r+1),d.write_shift(2,a.s.c),d.write_shift(2,a.e.c+1),d.write_shift(2,0),d}function ld(a){var b=a.read_shift(2),c=a.read_shift(2),d=Cc(a);return{r:b,c:c,ixfe:d[0],rknum:d[1]}}function md(a,b){for(var c=a.l+b-2,d=a.read_shift(2),e=a.read_shift(2),f=[];a.l>26],d.cellStyles?(e.alc=7&f,e.fWrap=f>>3&1,e.alcV=f>>4&7,e.fJustLast=f>>7&1,e.trot=f>>8&255,e.cIndent=f>>16&15,e.fShrinkToFit=f>>20&1,e.iReadOrder=f>>22&2,e.fAtrNum=f>>26&1,e.fAtrFnt=f>>27&1,e.fAtrAlc=f>>28&1,e.fAtrBdr=f>>29&1,e.fAtrPat=f>>30&1,e.fAtrProt=f>>31&1,e.dgLeft=15&g,e.dgRight=g>>4&15,e.dgTop=g>>8&15,e.dgBottom=g>>12&15,e.icvLeft=g>>16&127,e.icvRight=g>>23&127,e.grbitDiag=g>>30&3,e.icvTop=127&h,e.icvBottom=h>>7&127,e.icvDiag=h>>14&127,e.dgDiag=h>>21&15,e.icvFore=127&i,e.icvBack=i>>7&127,e.fsxButton=i>>14&1,e):e}function pd(a,b,c){var d={};return d.ifnt=a.read_shift(2),d.numFmtId=a.read_shift(2),d.flags=a.read_shift(2),d.fStyle=d.flags>>2&1,b-=6,d.data=od(a,b,d.fStyle,c),d}function qd(a,b,c,d){var e=c&&5==c.biff;return d||(d=ia(e?16:20)),d.write_shift(2,0),a.style?(d.write_shift(2,a.numFmtId||0),d.write_shift(2,65524)):(d.write_shift(2,a.numFmtId||0),d.write_shift(2,b<<4)),d.write_shift(4,0),d.write_shift(4,0),e||d.write_shift(4,0),d.write_shift(2,0),d}function rd(a){a.l+=4;var b=[a.read_shift(2),a.read_shift(2)];if(0!==b[0]&&b[0]--,0!==b[1]&&b[1]--,b[0]>7||b[1]>7)throw new Error("Bad Gutters: "+b.join("|"));return b}function sd(a){var b=ia(8);return b.write_shift(4,0),b.write_shift(2,a[0]?a[0]+1:0),b.write_shift(2,a[1]?a[1]+1:0),b}function td(a,b,c){var d=xc(a,6);2==c.biff&&++a.l;var e=gc(a,2);return d.val=e,d.t=!0===e||!1===e?"b":"e",d}function ud(a,b,c,d,e,f){var g=ia(8);return yc(a,b,d,g),hc(c,f,g),g}function vd(a){var b=xc(a,6),c=Za(a,8);return b.val=c,b}function wd(a,b,c,d){var e=ia(14);return yc(a,b,d,e),$a(c,e),e}function xd(a,b,c){var d=a.l+b,e=a.read_shift(2),f=a.read_shift(2);if(c.sbcch=f,1025==f||14849==f)return[f,e];if(f<1||f>255)throw new Error("Unexpected SupBook type: "+f);for(var g=kc(a,f),h=[];d>a.l;)h.push(lc(a));return[f,e,g,h]}function yd(a,b,c){var d,e=a.read_shift(2),f={fBuiltIn:1&e,fWantAdvise:e>>>1&1,fWantPict:e>>>2&1,fOle:e>>>3&1,fOleLink:e>>>4&1,cf:e>>>5&1023,fIcon:e>>>15&1};return 14849===c.sbcch&&(d=Dc(a,b-2,c)),f.body=d||a.read_shift(b-2),"string"==typeof d&&(f.Name=d),f}function zd(a,b,c){var d=a.l+b,e=a.read_shift(2),f=a.read_shift(1),g=a.read_shift(1),h=a.read_shift(c&&2==c.biff?1:2),i=0;(!c||c.biff>=5)&&(5!=c.biff&&(a.l+=2),i=a.read_shift(2),5==c.biff&&(a.l+=2),a.l+=4);var j=kc(a,g,c);32&e&&(j=mo[j.charCodeAt(0)]);var k=d-a.l;return c&&2==c.biff&&--k,{chKey:f,Name:j,itab:i,rgce:d==a.l||0===h?[]:zh(a,k,c,h)}}function Ad(a,b,c){if(c.biff<8)return Bd(a,b,c);for(var d=[],e=a.l+b,f=a.read_shift(c.biff>8?4:2);0!=f--;)d.push(Bc(a,c.biff>8?12:6,c));if(a.l!=e)throw new Error("Bad ExternSheet: "+a.l+" != "+e);return d}function Bd(a,b,c){3==a[a.l+1]&&a[a.l]++;var d=ic(a,b,c);return 3==d.charCodeAt(0)?d.slice(1):d}function Cd(a,b,c){if(c.biff<8)return void(a.l+=b);var d=a.read_shift(2),e=a.read_shift(2);return[kc(a,d,c),kc(a,e,c)]}function Dd(a,b,c){var d=Gc(a,6);a.l++;var e=a.read_shift(1);return b-=8,[Ah(a,b,c),e,d]}function Ed(a,b,c){var d=io(a,6);switch(c.biff){case 2:a.l++,b-=7;break;case 3:case 4:a.l+=2,b-=8;break;default:a.l+=6,b-=12}return[d,xh(a,b,c,d)]}function Fd(a){return[0!==a.read_shift(4),0!==a.read_shift(4),a.read_shift(4)]}function Gd(a,b,c){if(!(c.biff<8)){var d=a.read_shift(2),e=a.read_shift(2),f=a.read_shift(2),g=a.read_shift(2),h=mc(a,0,c);return c.biff<8&&a.read_shift(1),[{r:d,c:e},h,g,f]}}function Hd(a,b,c){return Gd(a,b,c)}function Id(a,b){for(var c=[],d=a.read_shift(2);d--;)c.push(Ec(a,b));return c}function Jd(a){var b=ia(2+8*a.length);b.write_shift(2,a.length);for(var c=0;c=(j?g:2*g))break}if(e.length!==g&&e.length!==2*g)throw new Error("cchText: "+g+" != "+e.length);return a.l=d+b,{t:e}}catch(c){return a.l=d+b,{t:e}}}function Nd(a,b){var c=Ec(a,8);return a.l+=16,[c,tc(a,b-24)]}function Od(a){var b=ia(24),c=za(a[0]);b.write_shift(2,c.r),b.write_shift(2,c.r),b.write_shift(2,c.c),b.write_shift(2,c.c);for(var d="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),e=0;e<16;++e)b.write_shift(1,parseInt(d[e],16));return Ql([b,uc(a[1])])}function Pd(a,b){a.read_shift(2);var c=Ec(a,8),d=a.read_shift((b-10)/2,"dbcs-cont");return d=d.replace(Rl,""),[c,d]}function Qd(a){var b=a[1].Tooltip,c=ia(10+2*(b.length+1));c.write_shift(2,2048);var d=za(a[0]);c.write_shift(2,d.r),c.write_shift(2,d.r),c.write_shift(2,d.c),c.write_shift(2,d.c);for(var e=0;e0;)c.push(wc(a,8));return c}function Ud(a){for(var b=a.read_shift(2),c=[];b-- >0;)c.push(wc(a,8));return c}function Vd(a){a.l+=2;var b={cxfs:0,crc:0};return b.cxfs=a.read_shift(2),b.crc=a.read_shift(4),b}function Wd(a,b,c){if(!c.cellStyles)return ha(a,b);var d=c&&c.biff>=12?4:2,e=a.read_shift(d),f=a.read_shift(d),g=a.read_shift(d),h=a.read_shift(d),i=a.read_shift(2);return 2==d&&(a.l+=2),{s:e,e:f,w:g,ixfe:h,flags:i}}function Xd(a,b){var c={};return b<32?c:(a.l+=16,c.header=Za(a,8),c.footer=Za(a,8),a.l+=2,c)}function Yd(a,b,c){var d={area:!1};if(5!=c.biff)return a.l+=b,d;var e=a.read_shift(1);return a.l+=3,16&e&&(d.area=!0),d}function Zd(a){for(var b=ia(2*a),c=0;c]*>/)?(d.t=nm(tm(a.slice(a.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")),d.r=tm(a),c&&(d.h=T(d.t))):a.match(zo)&&(d.r=tm(a),d.t=nm(tm((a.replace(Ao,"").match(yo)||[]).join("").replace(im,""))),c&&(d.h=xo(d.r))),d):null}function je(a,b){var c=[],d="";if(!a)return c;var e=a.match(Bo);if(e){d=e[2].replace(Co,"").split(Do);for(var f=0;f!=d.length;++f){var g=ie(d[f].trim(),b);null!=g&&(c[c.length]=g)}e=P(e[1]),c.Count=e.count,c.Unique=e.uniqueCount}return c}function ke(a,b){if(!b.bookSST)return"";var c=[gm];c[c.length]=Z("sst",null,{xmlns:Em.main[0],count:a.Count,uniqueCount:a.Unique});for(var d=0;d!=a.length;++d)if(null!=a[d]){var e=a[d],f="";e.r?f+=e.r:(f+=""),f+="",c[c.length]=f}return c.length>2&&(c[c.length]="",c[1]=c[1].replace("/>",">")),c.join("")}function le(a){return[a.read_shift(4),a.read_shift(4)]}function me(a,b){var c=[],d=!1;return ja(a,function(a,e,f){switch(f){case 159:c.Count=a[0],c.Unique=a[1];break;case 19:c.push(a);break;case 160:return!0;case 35:d=!0;break;case 36:d=!1;break;default:if(e.indexOf("Begin")>0||e.indexOf("End"),!d||b.WTF)throw new Error("Unexpected record "+f+" "+e)}}),c}function ne(a,b){return b||(b=ia(8)),b.write_shift(4,a.Count),b.write_shift(4,a.Unique),b}function oe(a){var b=ka();la(b,"BrtBeginSst",ne(a));for(var c=0;c=4&&(a.l+=b-4),c}function re(a){var b={};return b.id=a.read_shift(0,"lpp4"),b.R=qe(a,4),b.U=qe(a,4),b.W=qe(a,4),b}function se(a){for(var b=a.read_shift(4),c=a.l+b-4,d={},e=a.read_shift(4),f=[];e-- >0;)f.push({t:a.read_shift(4),v:a.read_shift(0,"lpp4")});if(d.name=a.read_shift(0,"lpp4"),d.comps=f,a.l!=c)throw new Error("Bad DataSpaceMapEntry: "+a.l+" != "+c);return d}function te(a){var b=[];a.l+=4;for(var c=a.read_shift(4);c-- >0;)b.push(se(a));return b}function ue(a){var b=[];a.l+=4;for(var c=a.read_shift(4);c-- >0;)b.push(a.read_shift(0,"lpp4"));return b}function ve(a){var b={};return a.read_shift(4),a.l+=4,b.id=a.read_shift(0,"lpp4"),b.name=a.read_shift(0,"lpp4"),b.R=qe(a,4),b.U=qe(a,4),b.W=qe(a,4),b}function we(a){var b=ve(a);if(b.ename=a.read_shift(0,"8lpp4"),b.blksz=a.read_shift(4),b.cmode=a.read_shift(4),4!=a.read_shift(4))throw new Error("Bad !Primary record");return b}function xe(a,b){var c=a.l+b,d={};d.Flags=63&a.read_shift(4),a.l+=4,d.AlgID=a.read_shift(4);var e=!1;switch(d.AlgID){case 26126:case 26127:case 26128:e=36==d.Flags;break;case 26625:e=4==d.Flags;break;case 0:e=16==d.Flags||4==d.Flags||36==d.Flags;break;default:throw"Unrecognized encryption algorithm: "+d.AlgID}if(!e)throw new Error("Encryption Flags/AlgID mismatch");return d.AlgIDHash=a.read_shift(4),d.KeySize=a.read_shift(4),d.ProviderType=a.read_shift(4),a.l+=8,d.CSPName=a.read_shift(c-a.l>>1,"utf16le"),a.l=c,d}function ye(a,b){var c={},d=a.l+b;return a.l+=4,c.Salt=a.slice(a.l,a.l+16),a.l+=16,c.Verifier=a.slice(a.l,a.l+16),a.l+=16,a.read_shift(4),c.VerifierHash=a.slice(a.l,d),a.l=d,c}function ze(a){var b=qe(a);switch(b.Minor){case 2:return[b.Minor,Ae(a,b)];case 3:return[b.Minor,Be(a,b)];case 4:return[b.Minor,Ce(a,b)]}throw new Error("ECMA-376 Encrypted file unrecognized Version: "+b.Minor)}function Ae(a){if(36!=(63&a.read_shift(4)))throw new Error("EncryptionInfo mismatch");return{t:"Std",h:xe(a,a.read_shift(4)),v:ye(a,a.length-a.l)}}function Be(){throw new Error("File is password-protected: ECMA-376 Extensible")}function Ce(a){var b=["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"];a.l+=4;var c=a.read_shift(a.length-a.l,"utf8"),d={};return c.replace(im,function(a){var c=P(a);switch(Q(c[0])){case"":break;case"":case"":break;case"":break;case"4||d.Major<2)throw new Error("unrecognized major version code: "+d.Major);c.Flags=a.read_shift(4),b-=4;var e=a.read_shift(4);return b-=4,c.EncryptionHeader=xe(a,e),b-=e,c.EncryptionVerifier=ye(a,b),c}function Ee(a){var b={},c=b.EncryptionVersionInfo=qe(a,4);if(1!=c.Major||1!=c.Minor)throw"unrecognized version code "+c.Major+" : "+c.Minor;return b.Salt=a.read_shift(16),b.EncryptedVerifier=a.read_shift(16),b.EncryptedVerifierHash=a.read_shift(16),b}function Fe(a){var b,c,d,e,f,h,i=0,j=pe(a),k=j.length+1;for(b=g(k),b[0]=j.length,c=1;c!=k;++c)b[c]=j[c-1];for(c=k-1;c>=0;--c)d=b[c],e=0==(16384&i)?0:1,f=i<<1&32767,h=e|f,i=h^d;return 52811^i}function Ge(a,b,c,d){var e={key:dc(a),verificationBytes:dc(a)};return c.password&&(e.verifier=Fe(c.password)),d.valid=e.verificationBytes===e.verifier,d.valid&&(d.insitu=Io(c.password)),e}function He(a,b,c){var d=c||{};return d.Info=a.read_shift(2),a.l-=2,1===d.Info?d.Data=Ee(a,b):d.Data=De(a,b),d}function Ie(a,b,c){var d={Type:c.biff>=8?a.read_shift(2):0};return d.Type?He(a,b-2,d):Ge(a,c.biff>=8?b:b-2,c,d),d}function Je(a){var b=a.slice("#"===a[0]?1:0).slice(0,6);return[parseInt(b.slice(0,2),16),parseInt(b.slice(2,4),16),parseInt(b.slice(4,6),16)]}function Ke(a){for(var b=0,c=1;3!=b;++b)c=256*c+(a[b]>255?255:a[b]<0?0:a[b]);return c.toString(16).toUpperCase().slice(1)}function Le(a){var b=a[0]/255,c=a[1]/255,d=a[2]/255,e=Math.max(b,c,d),f=Math.min(b,c,d),g=e-f;if(0===g)return[0,0,b];var h=0,i=0,j=e+f;switch(i=g/(j>1?2-j:j),e){case b:h=((c-d)/g+6)%6;break;case c:h=(d-b)/g+2;break;case d:h=(b-c)/g+4}return[h/6,i,j/2]}function Me(a){var b,c=a[0],d=a[1],e=a[2],f=2*d*(e<.5?e:1-e),g=e-f/2,h=[g,g,g],i=6*c;if(0!==d)switch(0|i){case 0:case 6:b=f*i,h[0]+=f,h[1]+=b;break;case 1:b=f*(2-i),h[0]+=b,h[1]+=f;break;case 2:b=f*(i-2),h[1]+=f,h[2]+=b;break;case 3:b=f*(4-i),h[1]+=b,h[2]+=f;break;case 4:b=f*(i-4),h[2]+=f,h[0]+=b;break;case 5:b=f*(6-i),h[2]+=b,h[0]+=f}for(var j=0;3!=j;++j)h[j]=Math.round(255*h[j]);return h}function Ne(a,b){if(0===b)return a;var c=Le(Je(a));return c[2]=b<0?c[2]*(1+b):1-(1-c[2])*(1-b),Ke(Me(c))}function Oe(a){return Math.floor((a+Math.round(128/No)/256)*No)}function Pe(a){return Math.floor((a-5)/No*100+.5)/100}function Qe(a){return Math.round((a*No+5)/No*256)/256}function Re(a){return Qe(Pe(Oe(a)))}function Se(a){var b=Math.abs(a-Re(a)),c=No;if(b>.005)for(No=Mo;No":case"":break;case"":case"":e={},c.diagonalUp&&(e.diagonalUp=c.diagonalUp),c.diagonalDown&&(e.diagonalDown=c.diagonalDown),b.Borders.push(e);break;case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":break;case"":case"":break;case"":case"
          ":break;case"":f=!1;break;default:if(d&&d.WTF&&!f)throw new Error("unrecognized "+c[0]+" in borders")}})}function Xe(a,b,c,d){b.Fills=[];var e={},f=!1;a[0].match(im).forEach(function(a){var c=P(a);switch(Q(c[0])){case"":case"":break;case"":case"":e={},b.Fills.push(e);break;case"":case"":break;case"":b.Fills.push(e),e={};break;case"":c.patternType&&(e.patternType=c.patternType);break;case"":case"":break;case"":case"":break;case"":case"":break;case"":case"":break;case"":case"":break;case"":case"":break;case"":f=!1;break;default:if(d&&d.WTF&&!f)throw new Error("unrecognized "+c[0]+" in fills")}})}function Ye(a,b,c,d){b.Fonts=[];var e={},f=!1;a[0].match(im).forEach(function(a){var g=P(a);switch(Q(g[0])){case"":case"":break;case"":break;case"":case"":b.Fonts.push(e),e={};break;case"":case"":break;case"":e.bold=1;break;case"":e.italic=1;break;case"":e.underline=1;break;case"":e.strike=1;break;case"":e.outline=1;break;case"":e.shadow=1;break;case"":e.condense=1;break;case"":e.extend=1;break;case"":case"":break;case"":case"":break;case"":case"":break;case"":case"":break;case"":case"":break;case"":case"":break;case"":f=!1;break;default:if(d&&d.WTF&&!f)throw new Error("unrecognized "+g[0]+" in fonts")}})}function Ze(a,b,c){b.NumberFmt=[];for(var d=r(Tl._table),e=0;e":case"":case"":break;case"0){if(i>392){for(i=392;i>60&&null!=b.NumberFmt[i];--i);b.NumberFmt[i]=h}Tl.load(h,i)}break;case"":break;default:if(c.WTF)throw new Error("unrecognized "+g[0]+" in numFmts")}}}function $e(a){var b=[""];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(c){for(var d=c[0];d<=c[1];++d)null!=a[d]&&(b[b.length]=Z("numFmt",null,{numFmtId:d,formatCode:R(a[d])}))}),1===b.length?"":(b[b.length]="",b[0]=Z("numFmts",null,{count:b.length-2}).replace("/>",">"),b.join(""))}function _e(a,b,c){b.CellXf=[];var d,e=!1;a[0].match(im).forEach(function(a){var f=P(a),g=0;switch(Q(f[0])){case"":case"":case"":break;case"":for(d=f,delete d[0],g=0;g392)for(g=392;g>60;--g)if(b.NumberFmt[d.numFmtId]==b.NumberFmt[g]){d.numFmtId=g;break}b.CellXf.push(d);break;case"":break;case"":var h={};f.vertical&&(h.vertical=f.vertical),f.horizontal&&(h.horizontal=f.horizontal),null!=f.textRotation&&(h.textRotation=f.textRotation),f.indent&&(h.indent=f.indent),f.wrapText&&(h.wrapText=f.wrapText),d.alignment=h;break;case"":break;case"":case"":break;case"":case"":break;case"":e=!1;break;default:if(c&&c.WTF&&!e)throw new Error("unrecognized "+f[0]+" in cellXfs")}})}function af(a){var b=[];return b[b.length]=Z("cellXfs",null),a.forEach(function(a){b[b.length]=Z("xf",null,a)}),b[b.length]="",2===b.length?"":(b[0]=Z("cellXfs",null,{count:b.length-2}).replace("/>",">"),b.join(""))}function bf(a,b){if("undefined"!=typeof style_builder)return style_builder.toXml();var c,d=[gm,Uo];return a.SSF&&null!=(c=$e(a.SSF))&&(d[d.length]=c),d[d.length]='',d[d.length]='',d[d.length]='',d[d.length]='',(c=af(b.cellXfs))&&(d[d.length]=c),d[d.length]='',d[d.length]='',d[d.length]='',d.length>2&&(d[d.length]="",d[1]=d[1].replace("/>",">")),d.join("")}function cf(a,b){return[a.read_shift(2),Ka(a,b-2)]}function df(a,b,c){c||(c=ia(6+4*b.length)),c.write_shift(2,a),La(b,c);var d=c.length>c.l?c.slice(0,c.l):c;return null==c.l&&(c.l=c.length),d}function ef(a,b,c){var d={};d.sz=a.read_shift(2)/20;var e=bb(a,2,c);switch(e.fCondense&&(d.condense=1),e.fExtend&&(d.extend=1),e.fShadow&&(d.shadow=1),e.fOutline&&(d.outline=1),e.fStrikeout&&(d.strike=1),e.fItalic&&(d.italic=1),700===a.read_shift(2)&&(d.bold=1),a.read_shift(2)){case 1:d.vertAlign="superscript";break;case 2:d.vertAlign="subscript"}var f=a.read_shift(1);0!=f&&(d.underline=f);var g=a.read_shift(1);g>0&&(d.family=g);var h=a.read_shift(1);switch(h>0&&(d.charset=h),a.l++,d.color=_a(a,8),a.read_shift(1)){case 1:d.scheme="major";break;case 2:d.scheme="minor"}return d.name=Ka(a,b-21),d}function ff(a,b){b||(b=ia(153)),b.write_shift(2,20*a.sz),cb(a,b),b.write_shift(2,a.bold?700:400);var c=0;"superscript"==a.vertAlign?c=1:"subscript"==a.vertAlign&&(c=2),b.write_shift(2,c),b.write_shift(1,a.underline||0),b.write_shift(1,a.family||0),b.write_shift(1,a.charset||0),b.write_shift(1,0),ab(a.color,b);var d=0;return"major"==a.scheme&&(d=1),"minor"==a.scheme&&(d=2),b.write_shift(1,d),La(a.name,b),b.length>b.l?b.slice(0,b.l):b}function gf(a,b){b||(b=ia(84));var c=Wo[a.patternType];null==c&&(c=40),b.write_shift(4,c);var d=0;if(40!=c)for(ab({auto:1},b),ab({auto:1},b);d<12;++d)b.write_shift(4,0);else{for(;d<4;++d)b.write_shift(4,0);for(;d<12;++d)b.write_shift(4,0)}return b.length>b.l?b.slice(0,b.l):b}function hf(a,b){var c=a.l+b,d=a.read_shift(2),e=a.read_shift(2);return a.l=c,{ixfe:d,numFmtId:e}}function jf(a,b,c){return c||(c=ia(16)),c.write_shift(2,b||0),c.write_shift(2,a.numFmtId||0),c.write_shift(2,0),c.write_shift(2,0),c.write_shift(2,0),c.write_shift(1,0),c.write_shift(1,0),c.write_shift(1,0),c.write_shift(1,0),c.write_shift(1,0),c.write_shift(1,0),c}function kf(a,b){return b||(b=ia(10)),b.write_shift(1,0),b.write_shift(1,0),b.write_shift(4,0),b.write_shift(4,0),b}function lf(a,b){return b||(b=ia(51)),b.write_shift(1,0),kf(null,b),kf(null,b),kf(null,b),kf(null,b),kf(null,b),b.length>b.l?b.slice(0,b.l):b}function mf(a,b){return b||(b=ia(52)),b.write_shift(4,a.xfId),b.write_shift(2,1),b.write_shift(1,+a.builtinId),b.write_shift(1,0),Ua(a.name||"",b),b.length>b.l?b.slice(0,b.l):b}function nf(a,b,c){var d=ia(2052);return d.write_shift(4,a),Ua(b,d),Ua(c,d),d.length>d.l?d.slice(0,d.l):d}function of(a,b,c){var d={};d.NumberFmt=[];for(var e in Tl._table)d.NumberFmt[e]=Tl._table[e];d.CellXf=[],d.Fonts=[];var f=[],g=!1;return ja(a,function(a,e,h){switch(h){case 44:d.NumberFmt[a[0]]=a[1],Tl.load(a[1],a[0]);break;case 43:d.Fonts.push(a),null!=a.color.theme&&b&&b.themeElements&&b.themeElements.clrScheme&&(a.color.rgb=Ne(b.themeElements.clrScheme[a.color.theme].rgb,a.color.tint||0));break;case 1025:case 45:case 46:break;case 47:"BrtBeginCellXFs"==f[f.length-1]&&d.CellXf.push(a);break;case 48:case 507:case 572:case 475:break;case 1171:case 2102:case 1130:case 512:case 2095:case 3072:break;case 35:g=!0;break;case 36:g=!1;break;case 37:f.push(e);break;case 38:f.pop();break;default:if((e||"").indexOf("Begin")>0)f.push(e);else if((e||"").indexOf("End")>0)f.pop();else if(!g||c.WTF)throw new Error("Unexpected record "+h+" "+e)}}),d}function pf(a,b){if(b){var c=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(a){for(var d=a[0];d<=a[1];++d)null!=b[d]&&++c}),0!=c&&(la(a,"BrtBeginFmts",Ja(c)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(c){for(var d=c[0];d<=c[1];++d)null!=b[d]&&la(a,"BrtFmt",df(d,b[d]))}),la(a,"BrtEndFmts"))}}function qf(a){var b=1;0!=b&&(la(a,"BrtBeginFonts",Ja(b)),la(a,"BrtFont",ff({sz:12,color:{theme:1},name:"Calibri",family:2,scheme:"minor"})),la(a,"BrtEndFonts"))}function rf(a){var b=2;0!=b&&(la(a,"BrtBeginFills",Ja(b)),la(a,"BrtFill",gf({patternType:"none"})),la(a,"BrtFill",gf({patternType:"gray125"})),la(a,"BrtEndFills"))}function sf(a){var b=1;0!=b&&(la(a,"BrtBeginBorders",Ja(b)),la(a,"BrtBorder",lf({})),la(a,"BrtEndBorders"))}function tf(a){la(a,"BrtBeginCellStyleXFs",Ja(1)),la(a,"BrtXF",jf({numFmtId:0,fontId:0,fillId:0,borderId:0},65535)),la(a,"BrtEndCellStyleXFs")}function uf(a,b){la(a,"BrtBeginCellXFs",Ja(b.length)),b.forEach(function(b){la(a,"BrtXF",jf(b,0))}),la(a,"BrtEndCellXFs")}function vf(a){la(a,"BrtBeginStyles",Ja(1)),la(a,"BrtStyle",mf({xfId:0,builtinId:0,name:"Normal"})),la(a,"BrtEndStyles")}function wf(a){la(a,"BrtBeginDXFs",Ja(0)),la(a,"BrtEndDXFs")}function xf(a){la(a,"BrtBeginTableStyles",nf(0,"TableStyleMedium9","PivotStyleMedium4")),la(a,"BrtEndTableStyles")}function yf(){}function zf(a,b){var c=ka();return la(c,"BrtBeginStyleSheet"),pf(c,a.SSF),qf(c,a),rf(c,a),sf(c,a),tf(c,a),uf(c,b.cellXfs),vf(c,a),wf(c,a),xf(c,a),yf(c,a),la(c,"BrtEndStyleSheet"),c.end()}function Af(a,b,c){b.themeElements.clrScheme=[];var d={};(a[0].match(im)||[]).forEach(function(a){var e=P(a);switch(e[0]){case"":break;case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":case"":"/"===e[0].charAt(1)?(b.themeElements.clrScheme.push(d),d={}):d.name=e[0].slice(3,e[0].length-1);break;default:if(c&&c.WTF)throw new Error("Unrecognized "+e[0]+" in clrScheme")}})}function Bf(){}function Cf(){}function Df(a,b,c){b.themeElements={};var d;[["clrScheme",Zo,Af],["fontScheme",$o,Bf],["fmtScheme",_o,Cf]].forEach(function(e){if(!(d=a.match(e[1])))throw new Error(e[0]+" not found in themeElements");e[2](d,b,c)})}function Ef(a,b){if(!a||0===a.length)return Ef(Ff());var c,d={};if(!(c=a.match(ap)))throw new Error("themeElements not found in theme");return Df(c[0],d,b),d}function Ff(a,b){if(b&&b.themeXLSX)return b.themeXLSX;var c=[gm];return c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]='',c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]='',c[c.length]="",c[c.length]="",c[c.length]="",c[c.length]="",c.join("")}function Gf(a,b,c){var d=a.l+b;if(124226!==a.read_shift(4)){if(!c.cellStyles||!dm)return void(a.l=d);var e=a.slice(a.l);a.l=d;var f;try{f=new dm(e)}catch(a){return}var g=M(f,"theme/theme/theme1.xml",!0);if(g)return Ef(g,c)}}function Hf(a){return a.read_shift(4)}function If(a){var b={};switch(b.xclrType=a.read_shift(2),b.nTintShade=a.read_shift(2),b.xclrType){case 0:a.l+=4;break;case 1:b.xclrValue=Jf(a,4);break;case 2:b.xclrValue=vc(a,4);break;case 3:b.xclrValue=Hf(a,4);break;case 4:a.l+=4}return a.l+=8,b}function Jf(a,b){return ha(a,b)}function Kf(a,b){return ha(a,b)}function Lf(a){var b=a.read_shift(2),c=a.read_shift(2)-4,d=[b];switch(b){case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 13:d[1]=If(a,c);break;case 6:d[1]=Kf(a,c);break;case 14:case 15:d[1]=a.read_shift(1===c?1:2);break;default:throw new Error("Unrecognized ExtProp type: "+b+" "+c)}return d}function Mf(a,b){var c=a.l+b;a.l+=2;var d=a.read_shift(2);a.l+=2;for(var e=a.read_shift(2),f=[];e-- >0;)f.push(Lf(a,c-a.l));return{ixfe:d,ext:f}}function Nf(a,b){b.forEach(function(a){a[0]})}function Of(a){var b=[];if(!a)return b;var c=1;return(a.match(im)||[]).forEach(function(a){var d=P(a);switch(d[0]){case"":case"":break;case"0);else if(!((b||"").indexOf("End")>0))throw new Error("Unexpected record "+c+" "+b)}}),d}function Rf(){}function Sf(a,b,c){if(!a)return a;var d=c||{},e=!1;ja(a,function(a,b,c){switch(c){case 359:case 363:case 364:case 366:case 367:case 368:case 369:case 370:case 371:case 472:case 577:case 578:case 579:case 580:case 581:case 582:case 583:case 584:case 585:case 586:case 587:break;case 35:e=!0;break;case 36:e=!1;break;default:if((b||"").indexOf("Begin")>0);else if((b||"").indexOf("End")>0);else if(!e||d.WTF)throw new Error("Unexpected record "+c.toString(16)+" "+b)}},d)}function Tf(a,b){if(!a)return"??";var c=(a.match(/]*r:id="([^"]*)"/)||["",""])[1];return b["!id"][c].Target}function Uf(a,b){for(var c=[21600,21600],d=["m0,0l0",c[1],c[0],c[1],c[0],"0xe"].join(","),e=[Z("xml",null,{"xmlns:v":Hm.v,"xmlns:o":Hm.o,"xmlns:x":Hm.x,"xmlns:mv":Hm.mv}).replace(/\/>/,">"),Z("o:shapelayout",Z("o:idmap",null,{"v:ext":"edit",data:a}),{"v:ext":"edit"}),Z("v:shapetype",[Z("v:stroke",null,{joinstyle:"miter"}),Z("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:c.join(","),path:d})];bp<1e3*a;)bp+=1e3;return b.forEach(function(a){var b=za(a[0]);e=e.concat(["",Z("v:fill",Z("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}),{color2:"#BEFF82",angle:"-180",type:"gradient"}),Z("v:shadow",null,{on:"t",obscured:"t"}),Z("v:path",null,{"o:connecttype":"none"}),'
          ','',"","",X("x:Anchor",[b.c,0,b.r,0,b.c+3,100,b.r+5,100].join(",")),X("x:AutoFill","False"),X("x:Row",String(b.r)),X("x:Column",String(b.c)),a[1].hidden?"":"","",""])}),e.push(""),e.join("")}function Vf(a,b,c,d,e){for(var f=0;f!=b.length;++f){var g=b[f],h=Fj(L(a,g.replace(/^\//,""),!0),g,e);if(h&&h.length)for(var i=r(c),j=0;j!=i.length;++j){var k=i[j],l=d[k];if(l){var m=l[g];m&&Wf(k,c[k],h)}}}}function Wf(a,b,c){var d,e=Array.isArray(b);c.forEach(function(a){var c=za(a.ref);if(e?(b[c.r]||(b[c.r]=[]),d=b[c.r][c.c]):d=b[a.ref],!d){d={},e?b[c.r][c.c]=d:b[a.ref]=d;var f=Da(b["!ref"]||"BDWGO1000001:A1");f.s.r>c.r&&(f.s.r=c.r),f.e.rc.c&&(f.s.c=c.c),f.e.c/))return[];var c=[],d=[],e=a.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/);e&&e[1]&&e[1].split(/<\/\w*:?author>/).forEach(function(a){if(""!==a&&""!==a.trim()){var b=a.match(/<(?:\w+:)?author[^>]*>(.*)/);b&&c.push(b[1])}});var f=a.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/);return f&&f[1]&&f[1].split(/<\/\w*:?comment>/).forEach(function(a){if(""!==a&&""!==a.trim()){var e=a.match(/<(?:\w+:)?comment[^>]*>/);if(e){var f=P(e[0]),g={author:f.authorId&&c[f.authorId]||"sheetjsghost",ref:f.ref,guid:f.guid},h=za(f.ref);if(!(b.sheetRows&&b.sheetRows<=h.r)){var i=a.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/),j=!!i&&!!i[1]&&ie(i[1])||{r:"",t:"",h:""};g.r=j.r,""==j.r&&(j.t=j.h=""),g.t=j.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),b.cellHTML&&(g.h=j.h),d.push(g)}}}}),d}function Yf(a){var b=[gm,cp],c=[];return b.push(""),a.forEach(function(a){a[1].forEach(function(a){var d=R(a.a);c.indexOf(d)>-1||(c.push(d),b.push(""+d+""))})}),b.push(""),b.push(""),a.forEach(function(a){a[1].forEach(function(d){b.push(''),b.push(X("t",null==d.t?"":R(d.t))),b.push("")})}),b.push(""),b.length>2&&(b[b.length]="",b[1]=b[1].replace("/>",">")),b.join("")}function Zf(a){var b={};b.iauthor=a.read_shift(4);var c=qn(a,16);return b.rfx=c.s,b.ref=Aa(c.s),a.l+=16,b}function $f(a,b){return null==b&&(b=ia(36)),b.write_shift(4,a[1].iauthor),rn(a[0],b),b.write_shift(4,0),b.write_shift(4,0),b.write_shift(4,0),b.write_shift(4,0),b}function _f(a){return La(a.slice(0,54))}function ag(a,b){var c=[],d=[],e={},f=!1;return ja(a,function(a,g,h){switch(h){case 632:d.push(a);break;case 635:e=a;break;case 637:e.t=a.t,e.h=a.h,e.r=a.r;break;case 636:if(e.author=d[e.iauthor],delete e.iauthor,b.sheetRows&&b.sheetRows<=e.rfx.r)break;e.t||(e.t=""),delete e.rfx,c.push(e);break;case 3072:break;case 35:f=!0;break;case 36:f=!1;break;case 37:case 38:break;default:if((g||"").indexOf("Begin")>0);else if((g||"").indexOf("End")>0);else if(!f||b.WTF)throw new Error("Unexpected record "+h+" "+g)}}),c}function bg(a){var b=ka(),c=[];return la(b,"BrtBeginComments"),la(b,"BrtBeginCommentAuthors"),a.forEach(function(a){a[1].forEach(function(a){c.indexOf(a.a)>-1||(c.push(a.a.slice(0,54)),la(b,"BrtCommentAuthor",_f(a.a)))})}),la(b,"BrtEndCommentAuthors"),la(b,"BrtBeginCommentList"),a.forEach(function(a){a[1].forEach(function(d){d.iauthor=c.indexOf(d.a);var e={s:za(a[0]),e:za(a[0])};la(b,"BrtBeginComment",$f([e,d])),d.t&&d.t.length>0&&la(b,"BrtCommentText",Qa(d)),la(b,"BrtEndComment"),delete d.iauthor})}),la(b,"BrtEndCommentList"),la(b,"BrtEndComments"),b.end()}function cg(a){var b=$l.utils.cfb_new({root:"R"});return a.FullPaths.forEach(function(c,d){if("/"!==c.slice(-1)&&c.match(/_VBA_PROJECT_CUR/)){var e=c.replace(/^[^\/]*/,"R").replace(/\/_VBA_PROJECT_CUR\u0000*/,"");$l.utils.cfb_add(b,e,a.FileIndex[d].content)}}),$l.write(b)}function dg(a,b){b.FullPaths.forEach(function(c,d){if(0!=d){var e=c.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");"/"!==e.slice(-1)&&$l.utils.cfb_add(a,e,b.FileIndex[d].content)}})}function eg(){return{"!type":"dialog"}}function fg(){return{"!type":"dialog"}}function gg(){return{"!type":"macro"}}function hg(){return{"!type":"macro"}}function ig(a,b){return a.replace(hp,function(a,c,d,e,f,g){return c+("$"==d?d+e:va(ua(e)+b.c))+("$"==f?f+g:ra(qa(g)+b.r))})}function jg(a,b,c){var d=Ba(b),e=d.s,f=za(c);return ig(a,{r:f.r-e.r,c:f.c-e.c})}function kg(a){return 1!=a.length}function lg(a){return a.replace(/_xlfn\./g,"")}function mg(a){a.l+=1}function ng(a,b){var c=a.read_shift(1==b?1:2);return[16383&c,c>>14&1,c>>15&1]}function og(a,b,c){var d=2;if(c){if(c.biff>=2&&c.biff<=5)return pg(a,b,c);12==c.biff&&(d=4)}var e=a.read_shift(d),f=a.read_shift(d),g=ng(a,2),h=ng(a,2);return{s:{r:e,c:g[0],cRel:g[1],rRel:g[2]},e:{r:f,c:h[0],cRel:h[1],rRel:h[2]}}}function pg(a){var b=ng(a,2),c=ng(a,2),d=a.read_shift(1),e=a.read_shift(1);return{s:{r:b[0],c:d,cRel:b[1],rRel:b[2]},e:{r:c[0],c:e,cRel:c[1],rRel:c[2]}}}function qg(a,b,c){if(c.biff<8)return pg(a,b,c);var d=a.read_shift(12==c.biff?4:2),e=a.read_shift(12==c.biff?4:2),f=ng(a,2),g=ng(a,2);return{s:{r:d,c:f[0],cRel:f[1],rRel:f[2]},e:{r:e,c:g[0],cRel:g[1],rRel:g[2]}}}function rg(a,b,c){if(c&&c.biff>=2&&c.biff<=5)return sg(a,b,c);var d=a.read_shift(c&&12==c.biff?4:2),e=ng(a,2);return{r:d,c:e[0],cRel:e[1],rRel:e[2]}}function sg(a){var b=ng(a,2),c=a.read_shift(1);return{r:b[0],c:c,cRel:b[1],rRel:b[2]}}function tg(a){var b=a.read_shift(2),c=a.read_shift(2);return{r:b,c:255&c,fQuoted:!!(16384&c),cRel:c>>15,rRel:c>>15}}function ug(a,b,c){var d=c&&c.biff?c.biff:8;if(d>=2&&d<=5)return vg(a,b,c);var e=a.read_shift(d>=12?4:2),f=a.read_shift(2),g=(16384&f)>>14,h=(32768&f)>>15;if(f&=16383,1==h)for(;e>524287;)e-=1048576;if(1==g)for(;f>8191;)f-=16384;return{r:e,c:f,cRel:g,rRel:h}}function vg(a){var b=a.read_shift(2),c=a.read_shift(1),d=(32768&b)>>15,e=(16384&b)>>14;return b&=16383,1==d&&b>=8192&&(b-=16384),1==e&&c>=128&&(c-=256),{r:b,c:c,cRel:e,rRel:d}}function wg(a,b,c){return[(96&a[a.l++])>>5,og(a,c.biff>=2&&c.biff<=5?6:8,c)]}function xg(a,b,c){var d=(96&a[a.l++])>>5,e=a.read_shift(2,"i"),f=8;if(c)switch(c.biff){case 5:a.l+=12,f=6;break;case 12:f=12}return[d,e,og(a,f,c)]}function yg(a,b,c){var d=(96&a[a.l++])>>5;return a.l+=c&&c.biff>8?12:c.biff<8?6:8,[d]}function zg(a,b,c){var d=(96&a[a.l++])>>5,e=a.read_shift(2),f=8;if(c)switch(c.biff){case 5:a.l+=12,f=6;break;case 12:f=12}return a.l+=f,[d,e]}function Ag(a,b,c){return[(96&a[a.l++])>>5,qg(a,b-1,c)]}function Bg(a,b,c){var d=(96&a[a.l++])>>5;return a.l+=2==c.biff?6:12==c.biff?14:7,[d]}function Cg(a){var b=1&a[a.l+1];return a.l+=4,[b,1]}function Dg(a,b,c){a.l+=2;for(var d=a.read_shift(c&&2==c.biff?1:2),e=[],f=0;f<=d;++f)e.push(a.read_shift(c&&2==c.biff?1:2));return e}function Eg(a,b,c){var d=255&a[a.l+1]?1:0;return a.l+=2,[d,a.read_shift(c&&2==c.biff?1:2)]}function Fg(a,b,c){var d=255&a[a.l+1]?1:0;return a.l+=2,[d,a.read_shift(c&&2==c.biff?1:2)]}function Gg(a){var b=255&a[a.l+1]?1:0;return a.l+=2,[b,a.read_shift(2)]}function Hg(a,b,c){var d=255&a[a.l+1]?1:0;return a.l+=c&&2==c.biff?3:4,[d]}function Ig(a){return[a.read_shift(1),a.read_shift(1)]}function Jg(a){return a.read_shift(2),Ig(a,2)}function Kg(a){return a.read_shift(2),Ig(a,2)}function Lg(a,b,c){var d=(96&a[a.l])>>5;return a.l+=1,[d,rg(a,0,c)]}function Mg(a,b,c){var d=(96&a[a.l])>>5;return a.l+=1,[d,ug(a,0,c)]}function Ng(a,b,c){var d=(96&a[a.l])>>5;a.l+=1;var e=a.read_shift(2);return c&&5==c.biff&&(a.l+=12),[d,e,rg(a,0,c)]}function Og(a,b,c){var d=(96&a[a.l])>>5;a.l+=1;var e=a.read_shift(c&&c.biff<=3?1:2);return[Hp[e],Gp[e],d]}function Pg(a,b,c){var d=a[a.l++],e=a.read_shift(1),f=c&&c.biff<=3?[88==d?-1:0,a.read_shift(1)]:Qg(a);return[e,(0===f[0]?Gp:Fp)[f[1]]]}function Qg(a){return[a[a.l+1]>>7,32767&a.read_shift(2)]}function Rg(a,b,c){a.l+=c&&2==c.biff?3:4}function Sg(a,b,c){return a.l++,c&&12==c.biff?[a.read_shift(4,"i"),0]:[a.read_shift(2),a.read_shift(c&&2==c.biff?1:2)]}function Tg(a){return a.l++,sn[a.read_shift(1)]}function Ug(a){return a.l++,a.read_shift(2)}function Vg(a){return a.l++,0!==a.read_shift(1)}function Wg(a){return a.l++,Za(a,8)}function Xg(a,b,c){return a.l++,ic(a,b-1,c)}function Yg(a,b){var c=[a.read_shift(1)];if(12==b)switch(c[0]){case 2:c[0]=4;break;case 4:c[0]=16;break;case 0:c[0]=1;break;case 1:c[0]=2}switch(c[0]){case 4:c[1]=bc(a,1)?"TRUE":"FALSE",12!=b&&(a.l+=7);break;case 37:case 16:c[1]=sn[a[a.l]],a.l+=12==b?4:8;break;case 0:a.l+=8;break;case 1:c[1]=Za(a,8);break;case 2:c[1]=mc(a,0,{biff:b>0&&b<8?2:b});break;default:throw new Error("Bad SerAr: "+c[0])}return c}function Zg(a,b,c){for(var d=a.read_shift(12==c.biff?4:2),e=[],f=0;f!=d;++f)e.push((12==c.biff?qn:Ec)(a,8));return e}function $g(a,b,c){var d=0,e=0;12==c.biff?(d=a.read_shift(4),e=a.read_shift(4)):(e=1+a.read_shift(1),d=1+a.read_shift(2)),c.biff>=2&&c.biff<8&&(--d,0==--e&&(e=256));for(var f=0,g=[];f!=d&&(g[f]=[]);++f)for(var h=0;h!=e;++h)g[f][h]=Yg(a,c.biff);return g}function _g(a,b,c){var d=a.read_shift(1)>>>5&3,e=!c||c.biff>=8?4:2,f=a.read_shift(e);switch(c.biff){case 2:a.l+=5;break;case 3:case 4:a.l+=8;break;case 5:a.l+=12}return[d,0,f]}function ah(a,b,c){return 5==c.biff?bh(a,b,c):[a.read_shift(1)>>>5&3,a.read_shift(2),a.read_shift(4)]}function bh(a){var b=a.read_shift(1)>>>5&3,c=a.read_shift(2,"i");a.l+=8;var d=a.read_shift(2);return a.l+=12,[b,c,d]}function ch(a,b,c){var d=a.read_shift(1)>>>5&3;return a.l+=c&&2==c.biff?3:4,[d,a.read_shift(c&&2==c.biff?1:2)]}function dh(a,b,c){return[a.read_shift(1)>>>5&3,a.read_shift(c&&2==c.biff?1:2)]}function eh(a,b,c){var d=a.read_shift(1)>>>5&3;return a.l+=4,c.biff<8&&a.l--,12==c.biff&&(a.l+=2),[d]}function fh(a,b,c){var d=(96&a[a.l++])>>5,e=a.read_shift(2),f=4;if(c)switch(c.biff){case 5:f=15;break;case 12:f=6}return a.l+=f,[d,e]}function gh(a,b,c){return a.l+=2,[tg(a,4,c)]}function hh(a){return a.l+=6,[]}function ih(a){return a.l+=2,[dc(a),1&a.read_shift(2)]}function jh(a){a.l+=2;var b=a.read_shift(2),c=a.read_shift(2),d=a.read_shift(4),e=a.read_shift(2),f=a.read_shift(2);return{ixti:b,coltype:3&c,rt:vp[c>>2&31],idx:d,c:e,C:f}}function kh(a){return a.l+=2,[a.read_shift(4)]}function lh(a,b,c){return a.l+=5,a.l+=2,a.l+=2==c.biff?1:4,["PTGSHEET"]}function mh(a,b,c){return a.l+=2==c.biff?4:5,["PTGENDSHEET"]}function nh(a){return[a.read_shift(1)>>>5&3,a.read_shift(2)]}function oh(a){return[a.read_shift(1)>>>5&3,a.read_shift(2)]}function ph(a){return a.l+=4,[0,0]}function qh(a,b,c,d){if(d.biff<8)return ha(a,b);for(var e=a.l+b,f=[],g=0;g!==c.length;++g)switch(c[g][0]){case"PtgArray":c[g][1]=$g(a,0,d),f.push(c[g][1]);break;case"PtgMemArea":c[g][2]=Zg(a,c[g][1],d),f.push(c[g][2]);break;case"PtgExp":d&&12==d.biff&&(c[g][1][1]=a.read_shift(4),f.push(c[g][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+c[g][0]}return b=e-a.l,0!==b&&f.push(ha(a,b)),f}function rh(a,b,c){for(var d,e,f=a.l+b,g=[];f!=a.l;)b=f-a.l,e=a[a.l],d=wp[e],24!==e&&25!==e||(d=(24===e?yp:zp)[a[a.l+1]]),d&&d.f?g.push([d.n,d.f(a,b,c)]):ha(a,b);return g}function sh(a){for(var b=[],c=0;c=2))throw new Error("empty sheet name");return a.indexOf(" ")>-1?"'"+a+"'":a}function uh(a,b,c){if(!a)return"SH33TJSERR0";if(c.biff>8&&(!a.XTI||!a.XTI[b]))return a.SheetNames[b];if(!a.XTI)return"SH33TJSERR6";var d=a.XTI[b];if(c.biff<8)return b>1e4&&(b-=65536),b<0&&(b=-b),0==b?"":a.XTI[b-1];if(!d)return"SH33TJSERR1";var e="";if(c.biff>8)switch(a[d[0]][0]){case 357:return e=-1==d[1]?"#REF":a.SheetNames[d[1]],d[1]==d[2]?e:e+":"+a.SheetNames[d[2]];case 358:return null!=c.SID?a.SheetNames[c.SID]:"SH33TJSSAME"+a[d[0]][0];case 355:default:return"SH33TJSSRC"+a[d[0]][0]}switch(a[d[0]][0][0]){case 1025:return e=-1==d[1]?"#REF":a.SheetNames[d[1]]||"SH33TJSERR3",d[1]==d[2]?e:e+":"+a.SheetNames[d[2]];case 14849:return"SH33TJSERR8";default:return a[d[0]][0][3]?(e=-1==d[1]?"#REF":a[d[0]][0][3][d[1]]||"SH33TJSERR4",d[1]==d[2]?e:e+":"+a[d[0]][0][3][d[2]]):"SH33TJSERR2"}}function vh(a,b,c){return th(uh(a,b,c),c)}function wh(a,b,c,d,e){var f,g,h,i,j=e&&e.biff||8,k={s:{c:0,r:0},e:{c:0,r:0}},l=[],m=0,n=0,o="";if(!a[0]||!a[0][0])return"";for(var p=-1,q="",r=0,s=a[0].length;r=0){switch(a[0][p][1][0]){case 0:q=C(" ",a[0][p][1][1]);break;case 1:q=C("\r",a[0][p][1][1]);break;default:if(q="",e.WTF)throw new Error("Unexpected PtgAttrSpaceType "+a[0][p][1][0])}g+=q,p=-1}l.push(g+Ap[t[0]]+f);break;case"PtgIsect":f=l.pop(),g=l.pop(),l.push(g+" "+f);break;case"PtgUnion":f=l.pop(),g=l.pop(),l.push(g+","+f);break;case"PtgRange":f=l.pop(),g=l.pop(),l.push(g+":"+f);break;case"PtgAttrChoose":case"PtgAttrGoto":case"PtgAttrIf":case"PtgAttrIfError":break;case"PtgRef":h=ma(t[1][1],k,e),l.push(oa(h,j));break;case"PtgRefN":h=c?ma(t[1][1],c,e):t[1][1],l.push(oa(h,j));break;case"PtgRef3d":m=t[1][1],h=ma(t[1][2],k,e),o=vh(d,m,e);l.push(o+"!"+oa(h,j));break;case"PtgFunc":case"PtgFuncVar":var u=t[1][0],v=t[1][1];u||(u=0),u&=127;var w=0==u?[]:l.slice(-u);l.length-=u,"User"===v&&(v=w.shift()),l.push(v+"("+w.join(",")+")");break;case"PtgBool":l.push(t[1]?"TRUE":"FALSE");break;case"PtgInt":l.push(t[1]);break;case"PtgNum":l.push(String(t[1]));break;case"PtgStr":l.push('"'+t[1]+'"');break;case"PtgErr":l.push(t[1]);break;case"PtgAreaN":i=na(t[1][1],c?{s:c}:k,e),l.push(pa(i,e));break;case"PtgArea":i=na(t[1][1],k,e),l.push(pa(i,e));break;case"PtgArea3d":m=t[1][1],i=t[1][2],o=vh(d,m,e),l.push(o+"!"+pa(i,e));break;case"PtgAttrSum":l.push("SUM("+l.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":n=t[1][2];var x=(d.names||[])[n-1]||(d[0]||[])[n],y=x?x.Name:"SH33TJSNAME"+String(n);y in Ip&&(y=Ip[y]),l.push(y);break;case"PtgNameX":var z=t[1][1];n=t[1][2];var A;if(!(e.biff<=5)){var B="";14849==((d[z]||[])[0]||[])[0]||(1025==((d[z]||[])[0]||[])[0]?d[z][n]&&d[z][n].itab>0&&(B=d.SheetNames[d[z][n].itab-1]+"!"):B=d.SheetNames[n-1]+"!"),d[z]&&d[z][n]?B+=d[z][n].Name:d[0]&&d[0][n]?B+=d[0][n].Name:B+="SH33TJSERRX",l.push(B);break}z<0&&(z=-z),d[z]&&(A=d[z][n]),A||(A={Name:"SH33TJSERRY"}),l.push(A.Name);break;case"PtgParen":var D="(",E=")";if(p>=0){switch(q="",a[0][p][1][0]){case 2:D=C(" ",a[0][p][1][1])+D;break;case 3:D=C("\r",a[0][p][1][1])+D;break;case 4:E=C(" ",a[0][p][1][1])+E;break;case 5:E=C("\r",a[0][p][1][1])+E;break;default:if(e.WTF)throw new Error("Unexpected PtgAttrSpaceType "+a[0][p][1][0])}p=-1}l.push(D+l.pop()+E);break;case"PtgRefErr":case"PtgRefErr3d":l.push("#REF!");break;case"PtgExp":h={c:t[1][1],r:t[1][0]};var F={c:c.c,r:c.r};if(d.sharedf[Aa(h)]){var G=d.sharedf[Aa(h)];l.push(wh(G,k,F,d,e))}else{var H=!1;for(f=0;f!=d.arrayf.length;++f)if(g=d.arrayf[f],!(h.cg[0].e.c||h.rg[0].e.r)){l.push(wh(g[1],k,F,d,e)),H=!0;break}H||l.push(t[1])}break;case"PtgArray":l.push("{"+sh(t[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":p=r;break;case"PtgTbl":case"PtgMemErr":break;case"PtgMissArg":l.push("");break;case"PtgAreaErr":case"PtgAreaErr3d":l.push("#REF!");break;case"PtgList":l.push("Table"+t[1].idx+"[#"+t[1].rt+"]");break;case"PtgMemAreaN":case"PtgMemNoMemN":case"PtgAttrNoop":case"PtgSheet":case"PtgEndSheet":case"PtgMemFunc":case"PtgMemNoMem":break;case"PtgElfCol":case"PtgElfColS":case"PtgElfColSV":case"PtgElfColV":case"PtgElfLel":case"PtgElfRadical":case"PtgElfRadicalLel":case"PtgElfRadicalS":case"PtgElfRw":case"PtgElfRwV":throw new Error("Unsupported ELFs");case"PtgSxName":default:throw new Error("Unrecognized Formula Token: "+String(t))}var I=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(3!=e.biff&&p>=0&&-1==I.indexOf(a[0][r][0])){t=a[0][p];var J=!0;switch(t[1][0]){case 4:J=!1;case 0:q=C(" ",t[1][1]);break;case 5:J=!1;case 1:q=C("\r",t[1][1]);break;default:if(q="",e.WTF)throw new Error("Unexpected PtgAttrSpaceType "+t[1][0])}l.push((J?q:"")+l.pop()+(J?"":q)),p=-1}}if(l.length>1&&e.WTF)throw new Error("bad formula stack");return l[0]}function xh(a,b,c){var d,e=a.l+b,f=2==c.biff?1:2,g=a.read_shift(f);if(65535==g)return[[],ha(a,b-2)];var h=rh(a,g,c);return b!==g+f&&(d=qh(a,b-g-f,h,c)),a.l=e,[h,d]}function yh(a,b,c){var d,e=a.l+b,f=2==c.biff?1:2,g=a.read_shift(f);if(65535==g)return[[],ha(a,b-2)];var h=rh(a,g,c);return b!==g+f&&(d=qh(a,b-g-f,h,c)),a.l=e,[h,d]}function zh(a,b,c,d){var e,f=a.l+b,g=rh(a,d,c);return f!==a.l&&(e=qh(a,f-a.l,g,c)),[g,e]}function Ah(a,b,c){var d,e=a.l+b,f=a.read_shift(2),g=rh(a,f,c);return 65535==f?[[],ha(a,b-2)]:(b!==f+2&&(d=qh(a,e-f-2,g,c)),[g,d])}function Bh(a){var b;if(65535!==an(a,a.l+6))return[Za(a),"n"];switch(a[a.l]){case 0:return a.l+=8,["String","s"];case 1:return b=1===a[a.l+2],a.l+=8,[b,"b"];case 2:return b=a[a.l+2],a.l+=8,[b,"e"];case 3:return a.l+=8,["","s"]}return[]}function Ch(a,b,c){var d=a.l+b,e=xc(a,6);2==c.biff&&++a.l;var f=Bh(a,8),g=a.read_shift(1);2!=c.biff&&(a.read_shift(1),c.biff>=5&&a.read_shift(4));var h=yh(a,d-a.l,c);return{cell:e,val:f[0],formula:h,shared:g>>3&1,tt:f[1]}}function Dh(a,b,c){var d=a.read_shift(4),e=rh(a,d,c),f=a.read_shift(4);return[e,f>0?qh(a,f,e,c):null]}function Eh(a){return"of:"==a.slice(0,3)&&(a=a.slice(3)),61==a.charCodeAt(0)&&(a=a.slice(1),61==a.charCodeAt(0)&&(a=a.slice(1))),a=a.replace(/COM\.MICROSOFT\./g,""),a=a.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g,function(a,b){return b.replace(/\./g,"")}),a=a.replace(/\[.(#[A-Z]*[?!])\]/g,"$1"),a.replace(/[;~]/g,",").replace(/\|/g,";")}function Fh(a){return("of:="+a.replace(hp,"$1[.$2$3$4$5]").replace(/\]:\[/g,":")).replace(/;/g,"|").replace(/,/g,";")}function Gh(a){var b=a.split(":");return[b[0].split(".")[0],b[0].split(".")[1]+(b.length>1?":"+(b[1].split(".")[1]||b[1].split(".")[0]):"")]}function Hh(a){return a.replace(/\./,"!")}function Ih(a,b,c){var d=0,e=a.length;if(c){if(Lp?c.has(b):c.hasOwnProperty(b))for(var f=Lp?c.get(b):c[b];d-1?(c.width=Qe(d),c.customWidth=1):null!=b.width&&(c.width=b.width),b.hidden&&(c.hidden=!0),c}function Kh(a,b){if(a){var c=[.7,.7,.75,.75,.3,.3];"xlml"==b&&(c=[1,1,1,1,.5,.5]),null==a.left&&(a.left=c[0]),null==a.right&&(a.right=c[1]),null==a.top&&(a.top=c[2]),null==a.bottom&&(a.bottom=c[3]),null==a.header&&(a.header=c[4]),null==a.footer&&(a.footer=c[5])}}function Lh(a,b,c){if("undefined"!=typeof style_builder){if(/^\d+$/.exec(b.s))return b.s;if(b.s&&b.s==+b.s)return b.s;var d=b.s||{};return b.z&&(d.numFmt=b.z),style_builder.addStyle(d)}var e=c.revssf[null!=b.z?b.z:"General"],f=60,g=a.length;if(null==e&&c.ssf)for(;f<392;++f)if(null==c.ssf[f]){Tl.load(b.z,f),c.ssf[f]=b.z,c.revssf[b.z]=e=f;break}for(f=0;f!=g;++f)if(a[f].numFmtId===e)return f;return a[g]={numFmtId:e,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},g}function Mh(a,b,c,d,e,f){if("z"!==a.t){"d"===a.t&&"string"==typeof a.v&&(a.v=z(a.v));try{d.cellNF&&(a.z=Tl._table[b])}catch(a){if(d.WTF)throw a}if(!d||!1!==d.cellText)try{if(null==Tl._table[b]&&Tl.load(Xl[b]||"General",b),"e"===a.t)a.w=a.w||sn[a.v];else if(0===b)if("n"===a.t)(0|a.v)===a.v?a.w=Tl._general_int(a.v):a.w=Tl._general_num(a.v);else if("d"===a.t){var g=w(a.v);a.w=(0|g)===g?Tl._general_int(g):Tl._general_num(g)}else{if(void 0===a.v)return"";a.w=Tl._general(a.v,Kp)}else"d"===a.t?a.w=Tl.format(b,w(a.v),Kp):a.w=Tl.format(b,a.v,Kp)}catch(a){if(d.WTF)throw a}if(d.cellStyles&&null!=c)try{a.s=f.Fills[c],a.s.fgColor&&a.s.fgColor.theme&&!a.s.fgColor.rgb&&(a.s.fgColor.rgb=Ne(e.themeElements.clrScheme[a.s.fgColor.theme].rgb,a.s.fgColor.tint||0),d.WTF&&(a.s.fgColor.raw_rgb=e.themeElements.clrScheme[a.s.fgColor.theme].rgb)),a.s.bgColor&&a.s.bgColor.theme&&(a.s.bgColor.rgb=Ne(e.themeElements.clrScheme[a.s.bgColor.theme].rgb,a.s.bgColor.tint||0),d.WTF&&(a.s.bgColor.raw_rgb=e.themeElements.clrScheme[a.s.bgColor.theme].rgb))}catch(a){if(d.WTF&&f.Fills)throw a}}}function Nh(a,b,c){if(a&&a["!ref"]){var d=Da(a["!ref"]);if(d.e.c=0&&c.s.c>=0&&(a["!ref"]=Ca(c))}function Ph(a,b,c,d,e,f,g){if(!a)return a;null!=Jl&&null==b.dense&&(b.dense=Jl);var h=b.dense?[]:{},i={s:{r:2e6,c:2e6},e:{r:0,c:0}},j="",k="",l=a.match(Np);l?(j=a.slice(0,l.index),k=a.slice(l.index+l[0].length)):j=k=a;var m=j.match(Tp);m&&Rh(m[0],h,e,c);var n=(j.match(/<(?:\w*:)?dimension/)||{index:-1}).index;if(n>0){var o=j.slice(n,n+50).match(Pp);o&&Oh(h,o[1])}var p=j.match(Up);p&&p[1]&&$h(p[1],e);var q=[];if(b.cellStyles){var r=j.match(Qp);r&&Wh(q,r)}l&&Wp(l[1],h,b,i,f,g);var s=k.match(Rp);s&&(h["!autofilter"]=Yh(s[0]));var t=[],u=k.match(Mp);if(u)for(n=0;n!=u.length;++n)t[n]=Da(u[n].slice(u[n].indexOf('"')+1));var v=k.match(Op);v&&Th(h,v,d);var w=k.match(Sp);if(w&&(h["!margins"]=Uh(P(w[0]))),!h["!ref"]&&i.e.c>=i.s.c&&i.e.r>=i.s.r&&(h["!ref"]=Ca(i)),b.sheetRows>0&&h["!ref"]){var x=Da(h["!ref"]);b.sheetRows<=+x.e.r&&(x.e.r=b.sheetRows-1,x.e.r>i.e.r&&(x.e.r=i.e.r),x.e.ri.e.c&&(x.e.c=i.e.c),x.e.c0&&(h["!cols"]=q),t.length>0&&(h["!merges"]=t),h}function Qh(a){if(0===a.length)return"";for(var b='',c=0;c!=a.length;++c)b+='';return b+""}function Rh(a,b,c,d){var e=P(a);c.Sheets[d]||(c.Sheets[d]={}),e.codeName&&(c.Sheets[d].CodeName=e.codeName)}function Sh(a){var b={sheet:1},c=["objects","scenarios","selectLockedCells","selectUnlockedCells"],d=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];return c.forEach(function(c){null!=a[c]&&a[c]&&(b[c]="1")}),d.forEach(function(c){null==a[c]||a[c]||(b[c]="0")}),a.password&&(b.password=Fe(a.password).toString(16).toUpperCase()),Z("sheetProtection",null,b)}function Th(a,b,c){for(var d=Array.isArray(a),e=0;e!=b.length;++e){var f=P(tm(b[e]),!0);if(!f.ref)return;var g=((c||{})["!id"]||[])[f.id];g?(f.Target=g.Target,f.location&&(f.Target+="#"+f.location)):(f.Target="#"+f.location,g={Target:f.Target,TargetMode:"Internal"}),f.Rel=g,f.tooltip&&(f.Tooltip=f.tooltip,delete f.tooltip);for(var h=Da(f.ref),i=h.s.r;i<=h.e.r;++i)for(var j=h.s.c;j<=h.e.c;++j){var k=Aa({c:j,r:i});d?(a[i]||(a[i]=[]),a[i][j]||(a[i][j]={t:"z",v:void 0}),a[i][j].l=f):(a[k]||(a[k]={t:"z",v:void 0}),a[k].l=f)}}}function Uh(a){var b={};return["left","right","top","bottom","header","footer"].forEach(function(c){a[c]&&(b[c]=parseFloat(a[c]))}),b}function Vh(a){return Kh(a),Z("pageMargins",null,a)}function Wh(a,b){for(var c=!1,d=0;d!=b.length;++d){var e=P(b[d],!0);e.hidden&&(e.hidden=V(e.hidden));var f=parseInt(e.min,10)-1,g=parseInt(e.max,10)-1;for(delete e.min,delete e.max,e.width=+e.width,!c&&e.width&&(c=!0,Se(e.width)),Te(e);f<=g;)a[f++]=B(e)}}function Xh(a,b){for(var c,d=[""],e=0;e!=b.length;++e)(c=b[e])&&(d[d.length]=Z("col",null,Jh(e,c)));return d[d.length]="",d.join("")}function Yh(a){return{ref:(a.match(/ref="([^"]*)"/)||[])[1]}}function Zh(a,b,c,d){var e="string"==typeof a.ref?a.ref:Ca(a.ref);c.Workbook||(c.Workbook={}),c.Workbook.Names||(c.Workbook.Names=[]);var f=c.Workbook.Names,g=Ba(e);g.s.r==g.e.r&&(g.e.r=Ba(b["!ref"]).e.r,e=Ca(g));for(var h=0;h0||o&&o[m])&&(q={r:k},o&&o[m]&&(f=o[m],f.hidden&&(q.hidden=1),r=-1,f.hpx?r=Ue(f.hpx):f.hpt&&(r=f.hpt),r>-1&&(q.ht=r,q.customHeight=1),f.level&&(q.outlineLevel=f.level)),g[g.length]=Z("row",h.join(""),q))}if(o)for(;m-1&&(q.ht=r,q.customHeight=1),f.level&&(q.outlineLevel=f.level),g[g.length]=Z("row","",q));return g.join("")}function ci(a,b,c,d){var e=[gm,Xp],f=c.SheetNames[a],g=0,h="",i=c.Sheets[f];null==i&&(i={});var j=i["!ref"]||"A1",k=Da(j);if(k.e.c>16383||k.e.r>1048575){if(b.WTF)throw new Error("Range "+j+" exceeds format limit A1:XFD1048576");k.e.c=Math.min(k.e.c,16383),k.e.r=Math.min(k.e.c,1048575),j=Ca(k)}if(d||(d={}),i["!comments"]=[],i["!drawing"]=[],"xlsx"!==b.bookType&&c.vbaraw){var l=c.SheetNames[a];try{c.Workbook&&(l=c.Workbook.Sheets[a].CodeName||l)}catch(a){}e[e.length]=Z("sheetPr",null,{codeName:R(l)})}e[e.length]=Z("dimension",null,{ref:j}),e[e.length]=_h(i,b,a,c),b.sheetFormat&&(e[e.length]=Z("sheetFormatPr",null,{defaultRowHeight:b.sheetFormat.defaultRowHeight||"16",baseColWidth:b.sheetFormat.baseColWidth||"10",outlineLevelRow:b.sheetFormat.outlineLevelRow||"7"})),null!=i["!cols"]&&i["!cols"].length>0&&(e[e.length]=Xh(i,i["!cols"])),e[g=e.length]="",i["!links"]=[],null!=i["!ref"]&&(h=bi(i,b,a,c,d),h.length>0&&(e[e.length]=h)),e.length>g+1&&(e[e.length]="",e[g]=e[g].replace("/>",">")),null!=i["!protect"]&&(e[e.length]=Sh(i["!protect"])),null!=i["!autofilter"]&&(e[e.length]=Zh(i["!autofilter"],i,c,a)),null!=i["!merges"]&&i["!merges"].length>0&&(e[e.length]=Qh(i["!merges"]));var m,n=-1,o=-1;return i["!links"].length>0&&(e[e.length]="",i["!links"].forEach(function(a){a[1].Target&&(m={ref:a[0]},"#"!=a[1].Target.charAt(0)&&(o=nb(d,-1,R(a[1].Target).replace(/#.*$/,""),Un.HLINK),m["r:id"]="rId"+o),(n=a[1].Target.indexOf("#"))>-1&&(m.location=R(a[1].Target.slice(n+1))),a[1].Tooltip&&(m.tooltip=R(a[1].Tooltip)),e[e.length]=Z("hyperlink",null,m))}),e[e.length]=""),delete i["!links"],null!=i["!margins"]&&(e[e.length]=Vh(i["!margins"])),e[e.length]="",b&&!b.ignoreEC&&void 0!=b.ignoreEC||(e[e.length]=X("ignoredErrors",Z("ignoredError",null,{numberStoredAsText:1,sqref:j}))),i["!drawing"].length>0?(o=nb(d,-1,"../drawings/drawing"+(a+1)+".xml",Un.DRAW),e[e.length]=Z("drawing",null,{"r:id":"rId"+o})):delete i["!drawing"],i["!comments"].length>0&&(o=nb(d,-1,"../drawings/vmlDrawing"+(a+1)+".vml",Un.VML),e[e.length]=Z("legacyDrawing",null,{"r:id":"rId"+o}),i["!legacy"]=o),e.length>2&&(e[e.length]="",e[1]=e[1].replace("/>",">")),e.join("")}function di(a,b){var c={},d=a.l+b;c.r=a.read_shift(4),a.l+=4;var e=a.read_shift(2);a.l+=1;var f=a.read_shift(1);return a.l=d,7&f&&(c.level=7&f),16&f&&(c.hidden=!0),32&f&&(c.hpt=e/20),c}function ei(a,b,c){var d=ia(145),e=(c["!rows"]||[])[a]||{};d.write_shift(4,a),d.write_shift(4,0);var f=320;e.hpx?f=20*Ue(e.hpx):e.hpt&&(f=20*e.hpt),d.write_shift(2,f),d.write_shift(1,0);var g=0;e.level&&(g|=e.level),e.hidden&&(g|=16),(e.hpx||e.hpt)&&(g|=32),d.write_shift(1,g),d.write_shift(1,0);var h=0,i=d.l;d.l+=4;for(var j={r:a,c:0},k=0;k<16;++k)if(!(b.s.c>k+1<<10||b.e.cd.l?d.slice(0,d.l):d}function fi(a,b,c,d){var e=ei(d,c,b);(e.length>17||(b["!rows"]||[])[d])&&la(a,"BrtRowHdr",e)}function gi(){}function hi(a,b){var c={};return a.l+=19,c.name=ln(a,b-19),c}function ii(a,b){null==b&&(b=ia(84+4*a.length));for(var c=0;c<3;++c)b.write_shift(1,0);return ab({auto:1},b),b.write_shift(-4,-1),b.write_shift(-4,-1),mn(a,b),b.slice(0,b.l)}function ji(a){return[Ra(a)]}function ki(a,b,c){return null==c&&(c=ia(8)),Sa(b,c)}function li(a){return[Ra(a),a.read_shift(1),"b"]}function mi(a,b,c){return null==c&&(c=ia(9)),Sa(b,c),c.write_shift(1,a.v?1:0),c}function ni(a){return[Ra(a),a.read_shift(1),"e"]}function oi(a){return[Ra(a),a.read_shift(4),"s"]}function pi(a,b,c){return null==c&&(c=ia(12)),Sa(b,c),c.write_shift(4,b.v),c}function qi(a){return[Ra(a),Za(a),"n"]}function ri(a,b,c){return null==c&&(c=ia(16)),Sa(b,c),$a(a.v,c),c}function si(a){return[Ra(a),Va(a),"n"]}function ti(a,b,c){return null==c&&(c=ia(12)),Sa(b,c),Wa(a.v,c),c}function ui(a){return[Ra(a),Ka(a),"str"]}function vi(a,b,c){return null==c&&(c=ia(12+4*a.v.length)),Sa(b,c),La(a.v,c),c.length>c.l?c.slice(0,c.l):c}function wi(a,b,c){var d=a.l+b,e=Ra(a);e.r=c["!row"];var f=a.read_shift(1),g=[e,f,"b"];if(c.cellFormula){a.l+=2;var h=Cp(a,d-a.l,c);g[3]=wh(h,null,e,c.supbooks,c)}else a.l=d;return g}function xi(a,b,c){var d=a.l+b,e=Ra(a);e.r=c["!row"];var f=a.read_shift(1),g=[e,f,"e"];if(c.cellFormula){a.l+=2;var h=Cp(a,d-a.l,c);g[3]=wh(h,null,e,c.supbooks,c)}else a.l=d;return g}function yi(a,b,c){var d=a.l+b,e=Ra(a);e.r=c["!row"];var f=Za(a),g=[e,f,"n"];if(c.cellFormula){a.l+=2;var h=Cp(a,d-a.l,c);g[3]=wh(h,null,e,c.supbooks,c)}else a.l=d;return g}function zi(a,b,c){var d=a.l+b,e=Ra(a);e.r=c["!row"];var f=Ka(a),g=[e,f,"str"];if(c.cellFormula){a.l+=2;var h=Cp(a,d-a.l,c);g[3]=wh(h,null,e,c.supbooks,c)}else a.l=d;return g}function Ai(a,b){return null==b&&(b=ia(4)),b.write_shift(4,a),b}function Bi(a,b){var c=a.l+b,d=qn(a,16),e=Ta(a),f=Ka(a),g=Ka(a),h=Ka(a);a.l=c;var i={rfx:d,relId:e,loc:f,display:h};return g&&(i.Tooltip=g),i}function Ci(a,b){var c=ia(50+4*(a[1].Target.length+(a[1].Tooltip||"").length));rn({s:za(a[0]),e:za(a[0])},c),pn("rId"+b,c);var d=a[1].Target.indexOf("#");return La((-1==d?"":a[1].Target.slice(d+1))||"",c),La(a[1].Tooltip||"",c),La("",c),c.slice(0,c.l)}function Di(a,b,c){var d=a.l+b,e=Xa(a,16),f=a.read_shift(1),g=[e];if(g[2]=f,c.cellFormula){var h=Bp(a,d-a.l,c);g[1]=h}else a.l=d;return g}function Ei(a,b,c){var d=a.l+b,e=qn(a,16),f=[e];if(c.cellFormula){var g=Ep(a,d-a.l,c);f[1]=g,a.l=d}else a.l=d;return f}function Fi(a,b,c){null==c&&(c=ia(18));var d=Jh(a,b);c.write_shift(-4,a),c.write_shift(-4,a),c.write_shift(4,256*(d.width||10)),c.write_shift(4,0);var e=0;return b.hidden&&(e|=1),"number"==typeof d.width&&(e|=2),c.write_shift(1,e),c.write_shift(1,0),c}function Gi(a){var b={};return aq.forEach(function(c){b[c]=Za(a,8)}),b}function Hi(a,b){return null==b&&(b=ia(48)),Kh(a),aq.forEach(function(c){$a(a[c],b)}),b}function Ii(a){var b=a.read_shift(2);return a.l+=28,{RTL:32&b}}function Ji(a,b,c){null==c&&(c=ia(30));var d=924;return(((b||{}).Views||[])[0]||{}).RTL&&(d|=32),c.write_shift(2,d),c.write_shift(4,0),c.write_shift(4,0),c.write_shift(4,0),c.write_shift(1,0),c.write_shift(1,0),c.write_shift(2,0),c.write_shift(2,100),c.write_shift(2,0),c.write_shift(2,0),c.write_shift(2,0),c.write_shift(4,0),c}function Ki(a){var b=ia(24);return b.write_shift(4,4),b.write_shift(4,1),rn(a,b),b}function Li(a,b){return null==b&&(b=ia(66)),b.write_shift(2,a.password?Fe(a.password):0),b.write_shift(4,1),[["objects",!1],["scenarios",!1],["formatCells",!0],["formatColumns",!0],["formatRows",!0],["insertColumns",!0],["insertRows",!0],["insertHyperlinks",!0],["deleteColumns",!0],["deleteRows",!0],["selectLockedCells",!1],["sort",!0],["autoFilter",!0],["pivotTables",!0],["selectUnlockedCells",!1]].forEach(function(c){c[1]?b.write_shift(4,null==a[c[0]]||a[c[0]]?0:1):b.write_shift(4,null!=a[c[0]]&&a[c[0]]?0:1)}),b}function Mi(a,b,c,d,e,f,g){if(!a)return a;var h=b||{};d||(d={"!id":{}}),null!=Jl&&null==h.dense&&(h.dense=Jl);var i,j,k,l,m,n,o,p,q,r,s=h.dense?[]:{},t={s:{r:2e6,c:2e6},e:{r:0,c:0}},u=!1,v=!1,w=[];h.biff=12,h["!row"]=0;var x=0,y=!1,z=[],A={},B=h.supbooks||e.supbooks||[[]];if(B.sharedf=A,B.arrayf=z,B.SheetNames=e.SheetNames||e.Sheets.map(function(a){return a.name}),!h.supbooks&&(h.supbooks=B,e.Names))for(var C=0;C=G[0].s.r&&j.r<=G[0].e.r&&n>=G[0].s.c&&n<=G[0].e.c&&(k.F=Ca(G[0]),y=!0)}!y&&a.length>3&&(k.f=a[3])}if(t.s.r>j.r&&(t.s.r=j.r),t.s.c>n&&(t.s.c=n),t.e.rj.r&&(t.s.r=j.r),t.s.c>n&&(t.s.c=n),t.e.r=a.s;)D[a.e--]={width:a.w/256,hidden:!!(1&a.flags)},F||(F=!0,Se(a.w/256)),Te(D[a.e+1]);break;case 161:s["!autofilter"]={ref:Ca(a)};break;case 476:s["!margins"]=a;break;case 147:e.Sheets[c]||(e.Sheets[c]={}),a.name&&(e.Sheets[c].CodeName=a.name);break;case 137:e.Views||(e.Views=[{}]),e.Views[0]||(e.Views[0]={}),a.RTL&&(e.Views[0].RTL=!0);break;case 485:break;case 175:case 644:case 625:case 562:case 396:case 1112:case 1146:case 471:case 1050:case 649:case 1105:case 49:case 589:case 607:case 564:case 1055:case 168:case 174:case 1180:case 499:case 64:case 1053:case 550:case 171:case 167:case 1177:case 169:case 1181:case 551:case 552:case 661:case 639:case 478:case 151:case 537:case 477:case 536:case 1103:case 680:case 1104:case 1024:case 152:case 663:case 535:case 678:case 504:case 1043:case 428:case 170:case 3072:case 50:case 2070:case 1045:break;case 35:u=!0;break;case 36:u=!1;break;case 37:case 38:break;default:if((b||"").indexOf("Begin")>0);else if((b||"").indexOf("End")>0);else if(!u||h.WTF)throw new Error("Unexpected record "+C+" "+b)}},h),delete h.supbooks,delete h["!row"],!s["!ref"]&&(t.s.r<2e6||i&&(i.e.r>0||i.e.c>0||i.s.r>0||i.s.c>0))&&(s["!ref"]=Ca(i||t)),h.sheetRows&&s["!ref"]){var G=Da(s["!ref"]);h.sheetRows<=+G.e.r&&(G.e.r=h.sheetRows-1,G.e.r>t.e.r&&(G.e.r=t.e.r),G.e.rt.e.c&&(G.e.c=t.e.c),G.e.c0&&(s["!merges"]=w),D.length>0&&(s["!cols"]=D),E.length>0&&(s["!rows"]=E),s}function Ni(a,b,c,d,e,f){if(void 0===b.v)return"";var g="";switch(b.t){case"b":g=b.v?"1":"0";break;case"d":b=B(b),b.z=b.z||Tl._table[14],b.v=w(z(b.v)),b.t="n";break;case"n":case"e":g=""+b.v;break;default:g=b.v}var h={r:c,c:d};switch(h.s=Lh(e.cellXfs,b,e),b.l&&f["!links"].push([Aa(h),b.l]),b.c&&f["!comments"].push([Aa(h),b.c]),b.t){case"s":case"str":return void(e.bookSST?(g=Ih(e.Strings,b.v,e.revStrings),h.t="s",h.v=g,la(a,"BrtCellIsst",pi(b,h))):(h.t="str",la(a,"BrtCellSt",vi(b,h))));case"n":return void(b.v==(0|b.v)&&b.v>-1e3&&b.v<1e3?la(a,"BrtCellRk",ti(b,h)):la(a,"BrtCellReal",ri(b,h)));case"b":return h.t="b",void la(a,"BrtCellBool",mi(b,h));case"e":h.t="e"}la(a,"BrtCellBlank",ki(b,h))}function Oi(a,b,c,d){var e,f=Da(b["!ref"]||"A1"),g="",h=[];la(a,"BrtBeginSheetData");var i=Array.isArray(b),j=f.e.r;b["!rows"]&&(j=Math.max(f.e.r,b["!rows"].length-1));for(var k=f.s.r;k<=j;++k)if(g=ra(k),fi(a,b,f,k),k<=f.e.r)for(var l=f.s.c;l<=f.e.c;++l){k===f.s.r&&(h[l]=va(l)),e=h[l]+g;var m=i?(b[k]||[])[l]:b[e];m&&Ni(a,m,k,l,d,b)}la(a,"BrtEndSheetData")}function Pi(a,b){b&&b["!merges"]&&(la(a,"BrtBeginMergeCells",Ai(b["!merges"].length)),b["!merges"].forEach(function(b){la(a,"BrtMergeCell",_p(b))}),la(a,"BrtEndMergeCells"))}function Qi(a,b){b&&b["!cols"]&&(la(a,"BrtBeginColInfos"),b["!cols"].forEach(function(b,c){b&&la(a,"BrtColInfo",Fi(c,b))}),la(a,"BrtEndColInfos"))}function Ri(a,b){b&&b["!ref"]&&(la(a,"BrtBeginCellIgnoreECs"),la(a,"BrtCellIgnoreEC",Ki(Da(b["!ref"]))),la(a,"BrtEndCellIgnoreECs"))}function Si(a,b,c){b["!links"].forEach(function(b){if(b[1].Target){var d=nb(c,-1,b[1].Target.replace(/#.*$/,""),Un.HLINK);la(a,"BrtHLink",Ci(b,d))}}),delete b["!links"]}function Ti(a,b,c,d){if(b["!comments"].length>0){var e=nb(d,-1,"../drawings/vmlDrawing"+(c+1)+".vml",Un.VML);la(a,"BrtLegacyDrawing",pn("rId"+e)),b["!legacy"]=e}}function Ui(a,b){b["!autofilter"]&&(la(a,"BrtBeginAFilter",rn(Da(b["!autofilter"].ref))),la(a,"BrtEndAFilter"))}function Vi(a,b,c){la(a,"BrtBeginWsViews"),la(a,"BrtBeginWsView",Ji(b,c)),la(a,"BrtEndWsView"),la(a,"BrtEndWsViews")}function Wi(){}function Xi(a,b){b["!protect"]&&la(a,"BrtSheetProtection",Li(b["!protect"]))}function Yi(a,b,c,d){var e=ka(),f=c.SheetNames[a],g=c.Sheets[f]||{},h=f;try{c&&c.Workbook&&(h=c.Workbook.Sheets[a].CodeName||h)}catch(a){}var i=Da(g["!ref"]||"A1");if(i.e.c>16383||i.e.r>1048575){if(b.WTF)throw new Error("Range "+(g["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");i.e.c=Math.min(i.e.c,16383),i.e.r=Math.min(i.e.c,1048575)}return g["!links"]=[],g["!comments"]=[],la(e,"BrtBeginSheet"),c.vbaraw&&la(e,"BrtWsProp",ii(h)),la(e,"BrtWsDim",Zp(i)),Vi(e,g,c.Workbook),Wi(e,g),Qi(e,g,a,b,c),Oi(e,g,a,b,c),Xi(e,g),Ui(e,g),Pi(e,g),Si(e,g,d),g["!margins"]&&la(e,"BrtMargins",Hi(g["!margins"])),b&&!b.ignoreEC&&void 0!=b.ignoreEC||Ri(e,g),Ti(e,g,a,d),la(e,"BrtEndSheet"),e.end()}function Zi(a){var b=[];(a.match(/(.*?)<\/c:pt>/gm)||[]).forEach(function(a){var c=a.match(/(.*)<\/c:v><\/c:pt>/);c&&(b[+c[1]]=+c[2])});var c=nm((a.match(/([\s\S]*?)<\/c:formatCode>/)||["","General"])[1]);return[b,c]}function $i(a,b,c,d,e,f){var g=f||{"!type":"chart"};if(!a)return f;var h=0,i=0,j="A",k={s:{r:2e6,c:2e6},e:{r:0,c:0}};return(a.match(/[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(a){var b=Zi(a);k.s.r=k.s.c=0,k.e.c=h,j=va(h),b[0].forEach(function(a,c){g[j+ra(c)]={t:"n",v:a,z:b[1]},i=c}),k.e.r0&&(g["!ref"]=Ca(k)),g}function _i(a,b,c,d,e){if(!a)return a;d||(d={"!id":{}});var f,g={"!type":"chart","!chart":null,"!rel":""},h=a.match(Tp);return h&&Rh(h[0],g,e,c),(f=a.match(/drawing r:id="(.*?)"/))&&(g["!rel"]=f[1]),d["!id"][g["!rel"]]&&(g["!chart"]=d["!id"][g["!rel"]]),g}function aj(a,b){return a.l+=10,{name:Ka(a,b-10)}}function bj(a,b,c,d,e){if(!a)return a;d||(d={"!id":{}});var f={"!type":"chart","!chart":null,"!rel":""},g=[],h=!1;return ja(a,function(a,d,i){switch(i){case 550:f["!rel"]=a;break;case 651:e.Sheets[c]||(e.Sheets[c]={}),a.name&&(e.Sheets[c].CodeName=a.name);break;case 562:case 652:case 669:case 679:case 551:case 552:case 476:case 3072:break;case 35:h=!0;break;case 36:h=!1;break;case 37:g.push(d);break;case 38:g.pop();break;default:if((d||"").indexOf("Begin")>0)g.push(d);else if((d||"").indexOf("End")>0)g.pop();else if(!h||b.WTF)throw new Error("Unexpected record "+i+" "+d)}},b),d["!id"][f["!rel"]]&&(f["!chart"]=d["!id"][f["!rel"]]),f}function cj(a,b){for(var c=0;c!=a.length;++c)for(var d=a[c],e=0;e!=b.length;++e){var f=b[e];if(null==d[f[0]])d[f[0]]=f[1];else switch(f[2]){case"bool":"string"==typeof d[f[0]]&&(d[f[0]]=V(d[f[0]]));break;case"int":"string"==typeof d[f[0]]&&(d[f[0]]=parseInt(d[f[0]],10))}}}function dj(a,b){for(var c=0;c!=b.length;++c){var d=b[c];if(null==a[d[0]])a[d[0]]=d[1];else switch(d[2]){case"bool":"string"==typeof a[d[0]]&&(a[d[0]]=V(a[d[0]]));break;case"int":"string"==typeof a[d[0]]&&(a[d[0]]=parseInt(a[d[0]],10))}}}function ej(a){dj(a.WBProps,bq),dj(a.CalcPr,eq),cj(a.WBView,cq),cj(a.Sheets,dq),Kp.date1904=V(a.WBProps.date1904)}function fj(a){return a.Workbook&&a.Workbook.WBProps&&V(a.Workbook.WBProps.date1904)?"true":"false"}function gj(a,b){if(a.length>31){if(b)return!1;throw new Error("Sheet names cannot exceed 31 chars")}var c=!0;return fq.forEach(function(d){if(-1!=a.indexOf(d)){if(!b)throw new Error("Sheet name cannot contain : \\ / ? * [ ]");c=!1}}),c}function hj(a,b,c){a.forEach(function(d,e){gj(d);for(var f=0;f22)throw new Error("Bad Code Name: Worksheet"+g)}})}function ij(a){if(!a||!a.SheetNames||!a.Sheets)throw new Error("Invalid Workbook");if(!a.SheetNames.length)throw new Error("Workbook is empty");var b=a.Workbook&&a.Workbook.Sheets||[];hj(a.SheetNames,b,!!a.vbaraw);for(var c=0;c":break;case"":case"":break;case"":break;case"":bq.forEach(function(a){if(null!=j[a[0]])switch(a[2]){case"bool":c.WBProps[a[0]]=V(j[a[0]]);break;case"int":c.WBProps[a[0]]=parseInt(j[a[0]],10);break;default:c.WBProps[a[0]]=j[a[0]]}}),j.codeName&&(c.WBProps.CodeName=j.codeName);break;case"":case"":break;case"":case"":break;case"":delete j[0],c.WBView.push(j);break;case"":break;case"":case"":break;case"":break;case"":case"":case"":case"":break;case"":case"":d=!1;break;case"":f.Ref=nm(tm(a.slice(g,i))),c.Names.push(f);break;case"":break;case"":delete j[0],c.CalcPr=j;break;case"":case"":case"":case"":break;case"":case"":case"":break;case"":case"":case"":break;case"":break;case"":case"":case"":case"":case"":break;case"":d=!1;break;case"":d=!0;break;case"":d=!1;break;case"0,d={codeName:"ThisWorkbook"};a.Workbook&&a.Workbook.WBProps&&(bq.forEach(function(b){null!=a.Workbook.WBProps[b[0]]&&a.Workbook.WBProps[b[0]]!=b[1]&&(d[b[0]]=a.Workbook.WBProps[b[0]])}),a.Workbook.WBProps.CodeName&&(d.codeName=a.Workbook.WBProps.CodeName,delete d.CodeName)),b[b.length]=Z("workbookPr",null,d);var e=a.Workbook&&a.Workbook.Sheets||[],f=0;for(b[b.length]="",f=0;f!=a.SheetNames.length;++f){var g={name:R(a.SheetNames[f].slice(0,31))};if(g.sheetId=""+(f+1),g["r:id"]="rId"+(f+1),e[f])switch(e[f].Hidden){case 1:g.state="hidden";break;case 2:g.state="veryHidden"}b[b.length]=Z("sheet",null,g)}return b[b.length]="",c&&(b[b.length]="",a.Workbook&&a.Workbook.Names&&a.Workbook.Names.forEach(function(a){var c={name:a.Name};a.Comment&&(c.comment=a.Comment),null!=a.Sheet&&(c.localSheetId=""+a.Sheet),a.Hidden&&(c.hidden="1"),a.Ref&&(b[b.length]=Z("definedName",String(a.Ref).replace(//g,">"),c))}),b[b.length]=""),b.length>2&&(b[b.length]="",b[1]=b[1].replace("/>",">")),b.join("")}function lj(a,b){var c={};return c.Hidden=a.read_shift(4),c.iTabID=a.read_shift(4),c.strRelID=on(a,b-8),c.name=Ka(a),c}function mj(a,b){return b||(b=ia(127)),b.write_shift(4,a.Hidden),b.write_shift(4,a.iTabID),pn(a.strRelID,b),La(a.name.slice(0,31),b),b.length>b.l?b.slice(0,b.l):b}function nj(a,b){var c={},d=a.read_shift(4);c.defaultThemeVersion=a.read_shift(4);var e=b>8?Ka(a):"";return e.length>0&&(c.CodeName=e),c.autoCompressPictures=!!(65536&d),c.backupFile=!!(64&d),c.checkCompatibility=!!(4096&d),c.date1904=!!(1&d),c.filterPrivacy=!!(8&d),c.hidePivotFieldList=!!(1024&d),c.promptedSolutions=!!(16&d),c.publishItems=!!(2048&d),c.refreshAllConnections=!!(262144&d),c.saveExternalLinkValues=!!(128&d),c.showBorderUnselectedTables=!!(4&d),c.showInkAnnotation=!!(32&d),c.showObjects=["all","placeholders","none"][d>>13&3],c.showPivotChartFilter=!!(32768&d),c.updateLinks=["userSet","never","always"][d>>8&3],c}function oj(a,b){b||(b=ia(72));var c=0;return a&&a.filterPrivacy&&(c|=8),b.write_shift(4,c),b.write_shift(4,0),mn(a&&a.CodeName||"ThisWorkbook",b),b.slice(0,b.l)}function pj(a,b){var c={};return a.read_shift(4),c.ArchID=a.read_shift(4),a.l+=b-8,c}function qj(a,b,c){var d=a.l+b;a.l+=4,a.l+=1;var e=a.read_shift(4),f=nn(a),g=Dp(a,0,c),h=Ta(a);a.l=d;var i={Name:f,Ptg:g};return e<268435455&&(i.Sheet=e),h&&(i.Comment=h),i}function rj(a,b){var c={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""},d=[],e=!1;b||(b={}),b.biff=12;var f=[],g=[[]];return g.SheetNames=[],g.XTI=[],ja(a,function(a,h,i){switch(i){case 156:g.SheetNames.push(a.name),c.Sheets.push(a);break;case 153:c.WBProps=a;break;case 39:null!=a.Sheet&&(b.SID=a.Sheet),a.Ref=wh(a.Ptg,null,null,g,b),delete b.SID,delete a.Ptg,f.push(a);break;case 1036:break;case 357:case 358:case 355:case 667:g[0].length?g.push([i,a]):g[0]=[i,a],g[g.length-1].XTI=[];break;case 362:0===g.length&&(g[0]=[],g[0].XTI=[]),g[g.length-1].XTI=g[g.length-1].XTI.concat(a),g.XTI=g.XTI.concat(a);break;case 361:break;case 3072:case 3073:case 2071:case 534:case 677:case 158:case 157:case 610:case 2050:case 155:case 548:case 676:case 128:case 665:case 2128:case 2125:case 549:case 2053:case 596:case 2076:case 2075:case 2082:case 397:case 154:case 1117:case 553:case 2091:break;case 35:d.push(h),e=!0;break;case 36:d.pop(),e=!1;break;case 37:d.push(h),e=!0;break;case 38:d.pop(),e=!1;break;case 16:break;default:if((h||"").indexOf("Begin")>0);else if((h||"").indexOf("End")>0);else if(!e||b.WTF&&"BrtACBegin"!=d[d.length-1]&&"BrtFRTBegin"!=d[d.length-1])throw new Error("Unexpected record "+i+" "+h)}},b),ej(c),c.Names=f,c.supbooks=g,c}function sj(a,b){la(a,"BrtBeginBundleShs");for(var c=0;c!=b.SheetNames.length;++c){la(a,"BrtBundleSh",mj({Hidden:b.Workbook&&b.Workbook.Sheets&&b.Workbook.Sheets[c]&&b.Workbook.Sheets[c].Hidden||0,iTabID:c+1,strRelID:"rId"+(c+1),name:b.SheetNames[c]}))}la(a,"BrtEndBundleShs")}function tj(b,c){c||(c=ia(127));for(var d=0;4!=d;++d)c.write_shift(4,0);return La("SheetJS",c),La(a.version,c),La(a.version,c),La("7262",c),c.length=c.l,c.length>c.l?c.slice(0,c.l):c}function uj(a,b){return b||(b=ia(29)),b.write_shift(-4,0),b.write_shift(-4,460),b.write_shift(4,28800),b.write_shift(4,17600),b.write_shift(4,500),b.write_shift(4,a),b.write_shift(4,a),b.write_shift(1,120),b.length>b.l?b.slice(0,b.l):b}function vj(a,b){if(b.Workbook&&b.Workbook.Sheets){for(var c=b.Workbook.Sheets,d=0,e=-1,f=-1;de||(la(a,"BrtBeginBookViews"),la(a,"BrtBookView",uj(e)),la(a,"BrtEndBookViews"))}}function wj(a,b){var c=ka();return la(c,"BrtBeginBook"),la(c,"BrtFileVersion",tj()),la(c,"BrtWbProp",oj(a.Workbook&&a.Workbook.WBProps||null)),vj(c,a,b),sj(c,a,b),la(c,"BrtEndBook"),c.end()}function xj(a,b,c){return".bin"===b.slice(-4)?rj(a,c):jj(a,c)}function yj(a,b,c,d,e,f,g,h){return".bin"===b.slice(-4)?Mi(a,d,c,e,f,g,h):Ph(a,d,c,e,f,g,h)}function zj(a,b,c,d,e,f,g,h){return".bin"===b.slice(-4)?bj(a,d,c,e,f,g,h):_i(a,d,c,e,f,g,h)}function Aj(a,b,c,d,e,f,g,h){return".bin"===b.slice(-4)?gg(a,d,c,e,f,g,h):hg(a,d,c,e,f,g,h)}function Bj(a,b,c,d,e,f,g,h){return".bin"===b.slice(-4)?eg(a,d,c,e,f,g,h):fg(a,d,c,e,f,g,h)}function Cj(a,b,c,d){return".bin"===b.slice(-4)?of(a,c,d):To(a,c,d)}function Dj(a,b,c){return Ef(a,c)}function Ej(a,b,c){return".bin"===b.slice(-4)?me(a,c):je(a,c)}function Fj(a,b,c){return".bin"===b.slice(-4)?ag(a,c):Xf(a,c)}function Gj(a,b,c){return".bin"===b.slice(-4)?Qf(a,b,c):Of(a,b,c)}function Hj(a,b,c){return".bin"===b.slice(-4)?Sf(a,b,c):Rf(a,b,c)}function Ij(a,b,c){return(".bin"===b.slice(-4)?wj:kj)(a,c)}function Jj(a,b,c,d,e){return(".bin"===b.slice(-4)?Yi:ci)(a,c,d,e)}function Kj(a,b,c){return(".bin"===b.slice(-4)?zf:bf)(a,c)}function Lj(a,b,c){return(".bin"===b.slice(-4)?oe:ke)(a,c)}function Mj(a,b,c){return(".bin"===b.slice(-4)?bg:Yf)(a,c)}function Nj(a,b){var c=a.split(/\s+/),d=[];if(b||(d[0]=c[0]),1===c.length)return d;var e,f,g,h,i=a.match(iq);if(i)for(h=0;h!=i.length;++h)e=i[h].match(jq),-1===(f=e[1].indexOf(":"))?d[e[1]]=e[2].slice(1,e[2].length-1):(g="xmlns:"===e[1].slice(0,6)?"xmlns"+e[1].slice(6):e[1].slice(f+1),d[g]=e[2].slice(1,e[2].length-1));return d}function Oj(a){var b=a.split(/\s+/),c={};if(1===b.length)return c;var d,e,f,g,h=a.match(iq);if(h)for(g=0;g!=h.length;++g)d=h[g].match(jq),-1===(e=d[1].indexOf(":"))?c[d[1]]=d[2].slice(1,d[2].length-1):(f="xmlns:"===d[1].slice(0,6)?"xmlns"+d[1].slice(6):d[1].slice(e+1),c[f]=d[2].slice(1,d[2].length-1));return c}function Pj(a,b){var c=Wl[a]||nm(a);return"General"===c?Tl._general(b):Tl.format(c,b)}function Qj(a,b,c,d){var e=d;switch((c[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]){case"boolean":e=V(d);break;case"i2":case"int":e=parseInt(d,10);break;case"r4":case"float":e=parseFloat(d);break;case"date":case"dateTime.tz":e=z(d);break;case"i8":case"string":case"fixed":case"uuid":case"bin.base64":break;default:throw new Error("bad custprop:"+c[0])}a[nm(b)]=e}function Rj(a,b,c){if("z"!==a.t){if(!c||!1!==c.cellText)try{"e"===a.t?a.w=a.w||sn[a.v]:"General"===b?"n"===a.t?(0|a.v)===a.v?a.w=Tl._general_int(a.v):a.w=Tl._general_num(a.v):a.w=Tl._general(a.v):a.w=Pj(b||"General",a.v)}catch(a){if(c.WTF)throw a}try{var d=Wl[b]||b||"General";if(c.cellNF&&(a.z=d),c.cellDates&&"n"==a.t&&Tl.is_date(d)){var e=Tl.parse_date_code(a.v);e&&(a.t="d",a.v=new Date(e.y,e.m-1,e.d,e.H,e.M,e.S,e.u))}}catch(a){if(c.WTF)throw a}}}function Sj(a,b,c){if(c.cellStyles&&b.Interior){var d=b.Interior;d.Pattern&&(d.patternType=Qo[d.Pattern]||d.Pattern)}a[b.ID]=b}function Tj(a,b,c,d,e,f,g,h,i,j){var k="General",l=d.StyleID,m={};j=j||{};var n=[],o=0;for(void 0===l&&h&&(l=h.StyleID),void 0===l&&g&&(l=g.StyleID);void 0!==f[l]&&(f[l].nf&&(k=f[l].nf),f[l].Interior&&n.push(f[l].Interior),f[l].Parent);)l=f[l].Parent;switch(c.Type){case"Boolean":d.t="b",d.v=V(a);break;case"String":d.t="s",d.r=rm(nm(a)),d.v=a.indexOf("<")>-1?nm(b):d.r;break;case"DateTime":"Z"!=a.slice(-1)&&(a+="Z"),d.v=(z(a)-new Date(Date.UTC(1899,11,30)))/864e5,d.v!==d.v?d.v=nm(a):d.v<60&&(d.v=d.v-1),k&&"General"!=k||(k="yyyy-mm-dd");case"Number":void 0===d.v&&(d.v=+a),d.t||(d.t="n");break;case"Error":d.t="e",d.v=tn[a],!1!==j.cellText&&(d.w=a);break;default:d.t="s",d.v=rm(b||a)}if(Rj(d,k,j),!1!==j.cellFormula)if(d.Formula){var p=nm(d.Formula);61==p.charCodeAt(0)&&(p=p.slice(1)),d.f=gp(p,e),delete d.Formula,"RC"==d.ArrayRange?d.F=gp("RC:RC",e):d.ArrayRange&&(d.F=gp(d.ArrayRange,e),i.push([Da(d.F),d.F]))}else for(o=0;o=i[o][0].s.r&&e.r<=i[o][0].e.r&&e.c>=i[o][0].s.c&&e.c<=i[o][0].e.c&&(d.F=i[o][1]);j.cellStyles&&(n.forEach(function(a){!m.patternType&&a.patternType&&(m.patternType=a.patternType)}),d.s=m),void 0!==d.StyleID&&(d.ixfe=d.StyleID)}function Uj(a){a.t=a.v||"",a.t=a.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a.v=a.w=a.ixfe=void 0}function Vj(a){if(Ml&&Buffer.isBuffer(a))return a.toString("utf8");if("string"==typeof a)return a;if("undefined"!=typeof Uint8Array&&a instanceof Uint8Array)return tm(j(l(a)));throw new Error("Bad input format: expected Buffer or string")}function Wj(a,b){var c=b||{};Ul(Tl);var e=Hl(Vj(a));"binary"!=c.type&&"array"!=c.type&&"base64"!=c.type||(e="undefined"!=typeof cptable?cptable.utils.decode(65001,d(e)):tm(e));var f=e.slice(0,1024).toLowerCase(),g=!1;if(-1==f.indexOf("=0&&(g=!0)}),g)return rq.to_workbook(e,c);var h,i,j=[];null!=Jl&&null==c.dense&&(c.dense=Jl);var k,l={},m=[],n=c.dense?[]:{},o="",p={},q={},r=Nj(''),s=0,t=0,u=0,v={s:{r:2e6,c:2e6},e:{r:0,c:0}},w={},x={},y="",z=0,A=[],C={},D={},E=0,F=[],G=[],H={},I=[],J=!1,K=[],L=[],M={},N=0,O=0,Q={Sheets:[],WBProps:{date1904:!1}},R={};for(lq.lastIndex=0,e=e.replace(//gm,"");h=lq.exec(e);)switch(h[3]){case"Data":if(j[j.length-1][1])break;"/"===h[1]?Tj(e.slice(s,h.index),y,r,"Comment"==j[j.length-1][0]?H:p,{c:t,r:u},w,I[t],q,K,c):(y="",r=Nj(h[0]),s=h.index+h[0].length);break;case"Cell":if("/"===h[1])if(G.length>0&&(p.c=G),(!c.sheetRows||c.sheetRows>u)&&void 0!==p.v&&(c.dense?(n[u]||(n[u]=[]),n[u][t]=p):n[va(t)+ra(u)]=p),p.HRef&&(p.l={Target:p.HRef},p.HRefScreenTip&&(p.l.Tooltip=p.HRefScreenTip),delete p.HRef,delete p.HRefScreenTip),(p.MergeAcross||p.MergeDown)&&(N=t+(0|parseInt(p.MergeAcross,10)),O=u+(0|parseInt(p.MergeDown,10)),A.push({s:{c:t,r:u},e:{c:N,r:O}})),c.sheetStubs)if(p.MergeAcross||p.MergeDown){for(var S=t;S<=N;++S)for(var T=u;T<=O;++T)(S>t||T>u)&&(c.dense?(n[T]||(n[T]=[]),n[T][S]={t:"z"}):n[va(S)+ra(T)]={t:"z"});t=N+1}else++t;else p.MergeAcross?t=N+1:++t;else p=Oj(h[0]),p.Index&&(t=+p.Index-1),tv.e.c&&(v.e.c=t),"/>"===h[0].slice(-2)&&++t,G=[];break;case"Row":"/"===h[1]||"/>"===h[0].slice(-2)?(uv.e.r&&(v.e.r=u),"/>"===h[0].slice(-2)&&(q=Nj(h[0]),q.Index&&(u=+q.Index-1)),t=0,++u):(q=Nj(h[0]),q.Index&&(u=+q.Index-1),M={},("0"==q.AutoFitHeight||q.Height)&&(M.hpx=parseInt(q.Height,10),M.hpt=Ue(M.hpx),L[u]=M),"1"==q.Hidden&&(M.hidden=!0,L[u]=M));break;case"Worksheet":if("/"===h[1]){if((i=j.pop())[0]!==h[3])throw new Error("Bad state: "+i.join("|"));m.push(o),v.s.r<=v.e.r&&v.s.c<=v.e.c&&(n["!ref"]=Ca(v),c.sheetRows&&c.sheetRows<=v.e.r&&(n["!fullref"]=n["!ref"],v.e.r=c.sheetRows-1,n["!ref"]=Ca(v))),A.length&&(n["!merges"]=A),I.length>0&&(n["!cols"]=I),L.length>0&&(n["!rows"]=L),l[o]=n}else v={s:{r:2e6,c:2e6},e:{r:0,c:0}},u=t=0,j.push([h[3],!1]),i=Nj(h[0]),o=nm(i.Name),n=c.dense?[]:{},A=[],K=[],L=[],R={name:o,Hidden:0},Q.Sheets.push(R);break;case"Table":if("/"===h[1]){if((i=j.pop())[0]!==h[3])throw new Error("Bad state: "+i.join("|"))}else{if("/>"==h[0].slice(-2))break;Nj(h[0]),j.push([h[3],!1]),I=[],J=!1}break;case"Style":"/"===h[1]?Sj(w,x,c):x=Nj(h[0]);break;case"NumberFormat":x.nf=nm(Nj(h[0]).Format||"General"),Wl[x.nf]&&(x.nf=Wl[x.nf]);for(var U=0;392!=U&&Tl._table[U]!=x.nf;++U);if(392==U)for(U=57;392!=U;++U)if(null==Tl._table[U]){Tl.load(x.nf,U);break}break;case"Column":if("Table"!==j[j.length-1][0])break;if(k=Nj(h[0]),k.Hidden&&(k.hidden=!0,delete k.Hidden),k.Width&&(k.wpx=parseInt(k.Width,10)),!J&&k.wpx>10){J=!0,No=Ko;for(var V=0;V0&&(Y.Sheet=Q.Sheets.length-1),Q.Names.push(Y);break;case"NamedCell":case"B":case"I":case"U":case"S":case"Sub":case"Sup":case"Span":case"Border":case"Alignment":case"Borders":break;case"Font":if("/>"===h[0].slice(-2))break;"/"===h[1]?y+=e.slice(z,h.index):z=h.index+h[0].length;break;case"Interior":if(!c.cellStyles)break;x.Interior=Nj(h[0]);break;case"Protection":break;case"Author":case"Title":case"Description":case"Created":case"Keywords":case"Subject":case"Category":case"Company":case"LastAuthor":case"LastSaved":case"LastPrinted":case"Version":case"Revision":case"TotalTime":case"HyperlinkBase":case"Manager":case"ContentStatus":case"Identifier":case"Language":case"AppName":if("/>"===h[0].slice(-2))break;"/"===h[1]?Bb(C,h[3],e.slice(E,h.index)):E=h.index+h[0].length;break;case"Paragraphs":break;case"Styles":case"Workbook":if("/"===h[1]){if((i=j.pop())[0]!==h[3])throw new Error("Bad state: "+i.join("|"))}else j.push([h[3],!1]);break;case"Comment":if("/"===h[1]){if((i=j.pop())[0]!==h[3])throw new Error("Bad state: "+i.join("|"));Uj(H),G.push(H)}else j.push([h[3],!1]),i=Nj(h[0]),H={a:i.Author};break;case"AutoFilter":if("/"===h[1]){if((i=j.pop())[0]!==h[3])throw new Error("Bad state: "+i.join("|"))}else if("/"!==h[0].charAt(h[0].length-2)){var Z=Nj(h[0]);n["!autofilter"]={ref:gp(Z.Range).replace(/\$/g,"")},j.push([h[3],!0])}break;case"Name":break;case"ComponentOptions":case"DocumentProperties":case"CustomDocumentProperties":case"OfficeDocumentSettings":case"PivotTable":case"PivotCache":case"Names":case"MapInfo":case"PageBreaks":case"QueryTable":case"DataValidation":case"Sorting":case"Schema":case"data":case"ConditionalFormatting":case"SmartTagType":case"SmartTags":case"ExcelWorkbook":case"WorkbookOptions":case"WorksheetOptions":if("/"===h[1]){if((i=j.pop())[0]!==h[3])throw new Error("Bad state: "+i.join("|"))}else"/"!==h[0].charAt(h[0].length-2)&&j.push([h[3],!0]);break;default:if(0==j.length&&"document"==h[3])return Ok(e,c);if(0==j.length&&"UOF"==h[3])return Ok(e,c);var $=!0;switch(j[j.length-1][0]){case"OfficeDocumentSettings":switch(h[3]){case"AllowPNG":case"RemovePersonalInformation":case"DownloadComponents":case"LocationOfComponents":case"Colors":case"Color":case"Index":case"RGB":case"PixelsPerInch":case"TargetScreenSize":case"ReadOnlyRecommended":break;default:$=!1}break;case"ComponentOptions":switch(h[3]){case"Toolbar":case"HideOfficeLogo":case"SpreadsheetAutoFit":case"Label":case"Caption":case"MaxHeight":case"MaxWidth":case"NextSheetNumber":break;default:$=!1}break;case"ExcelWorkbook":switch(h[3]){case"Date1904":Q.WBProps.date1904=!0;break;case"WindowHeight":case"WindowWidth":case"WindowTopX":case"WindowTopY":case"TabRatio":case"ProtectStructure":case"ProtectWindows":case"ActiveSheet":case"DisplayInkNotes":case"FirstVisibleSheet":case"SupBook":case"SheetName":case"SheetIndex":case"SheetIndexFirst":case"SheetIndexLast":case"Dll":case"AcceptLabelsInFormulas":case"DoNotSaveLinkValues":case"Iteration":case"MaxIterations":case"MaxChange":case"Path":case"Xct":case"Count":case"SelectedSheets":case"Calculation":case"Uncalced":case"StartupPrompt":case"Crn":case"ExternName":case"Formula":case"ColFirst":case"ColLast":case"WantAdvise":case"Boolean":case"Error":case"Text":case"OLE":case"NoAutoRecover":case"PublishObjects":case"DoNotCalculateBeforeSave":case"Number":case"RefModeR1C1":case"EmbedSaveSmartTags":break;default:$=!1}break;case"WorkbookOptions":switch(h[3]){case"OWCVersion":case"Height":case"Width":break;default:$=!1}break;case"WorksheetOptions":switch(h[3]){case"Visible":if("/>"===h[0].slice(-2));else if("/"===h[1])switch(e.slice(E,h.index)){case"SheetHidden":R.Hidden=1;break;case"SheetVeryHidden":R.Hidden=2}else E=h.index+h[0].length;break;case"Header":n["!margins"]||Kh(n["!margins"]={},"xlml"),n["!margins"].header=P(h[0]).Margin;break;case"Footer":n["!margins"]||Kh(n["!margins"]={},"xlml"),n["!margins"].footer=P(h[0]).Margin;break;case"PageMargins":var _=P(h[0]);n["!margins"]||Kh(n["!margins"]={},"xlml"),_.Top&&(n["!margins"].top=_.Top),_.Left&&(n["!margins"].left=_.Left),_.Right&&(n["!margins"].right=_.Right),_.Bottom&&(n["!margins"].bottom=_.Bottom);break;case"DisplayRightToLeft":Q.Views||(Q.Views=[]),Q.Views[0]||(Q.Views[0]={}),Q.Views[0].RTL=!0;break;case"Unsynced":case"Print":case"Panes":case"Scale":case"Pane":case"Number":case"Layout":case"PageSetup":case"Selected":case"ProtectObjects":case"EnableSelection":case"ProtectScenarios":case"ValidPrinterInfo":case"HorizontalResolution":case"VerticalResolution":case"NumberofCopies":case"ActiveRow":case"ActiveCol":case"ActivePane":case"TopRowVisible":case"TopRowBottomPane":case"LeftColumnVisible":case"LeftColumnRightPane":case"FitToPage":case"RangeSelection":case"PaperSizeIndex":case"PageLayoutZoom":case"PageBreakZoom":case"FilterOn":case"DoNotDisplayGridlines":case"SplitHorizontal":case"SplitVertical":case"FreezePanes":case"FrozenNoSplit":case"FitWidth":case"FitHeight":case"CommentsLayout":case"Zoom":case"LeftToRight":case"Gridlines":case"AllowSort":case"AllowFilter":case"AllowInsertRows":case"AllowDeleteRows":case"AllowInsertCols":case"AllowDeleteCols":case"AllowInsertHyperlinks":case"AllowFormatCells":case"AllowSizeCols":case"AllowSizeRows":case"NoSummaryRowsBelowDetail":case"TabColorIndex":case"DoNotDisplayHeadings":case"ShowPageLayoutZoom":case"NoSummaryColumnsRightDetail":case"BlackAndWhite":case"DoNotDisplayZeros":case"DisplayPageBreak":case"RowColHeadings":case"DoNotDisplayOutline":case"NoOrientation":case"AllowUsePivotTables":case"ZeroHeight":case"ViewableRange":case"Selection":case"ProtectContents":break;default:$=!1}break;case"PivotTable":case"PivotCache":switch(h[3]){case"ImmediateItemsOnDrop":case"ShowPageMultipleItemLabel":case"CompactRowIndent":case"Location":case"PivotField":case"Orientation":case"LayoutForm":case"LayoutSubtotalLocation":case"LayoutCompactRow":case"Position":case"PivotItem":case"DataType":case"DataField":case"SourceName":case"ParentField":case"PTLineItems":case"PTLineItem":case"CountOfSameItems":case"Item":case"ItemType":case"PTSource":case"CacheIndex":case"ConsolidationReference":case"FileName":case"Reference":case"NoColumnGrand":case"NoRowGrand":case"BlankLineAfterItems":case"Hidden":case"Subtotal":case"BaseField":case"MapChildItems":case"Function":case"RefreshOnFileOpen":case"PrintSetTitles":case"MergeLabels":case"DefaultVersion":case"RefreshName":case"RefreshDate":case"RefreshDateCopy":case"VersionLastRefresh":case"VersionLastUpdate":case"VersionUpdateableMin":case"VersionRefreshableMin":case"Calculation":break;default:$=!1}break;case"PageBreaks":switch(h[3]){case"ColBreaks":case"ColBreak":case"RowBreaks":case"RowBreak":case"ColStart":case"ColEnd":case"RowEnd":break;default:$=!1}break;case"AutoFilter":switch(h[3]){case"AutoFilterColumn":case"AutoFilterCondition":case"AutoFilterAnd":case"AutoFilterOr":break;default:$=!1}break;case"QueryTable":switch(h[3]){case"Id":case"AutoFormatFont":case"AutoFormatPattern":case"QuerySource":case"QueryType":case"EnableRedirections":case"RefreshedInXl9":case"URLString":case"HTMLTables":case"Connection":case"CommandText":case"RefreshInfo":case"NoTitles":case"NextId":case"ColumnInfo":case"OverwriteCells":case"DoNotPromptForFile":case"TextWizardSettings":case"Source":case"Number":case"Decimal":case"ThousandSeparator":case"TrailingMinusNumbers":case"FormatSettings":case"FieldType":case"Delimiters":case"Tab":case"Comma":case"AutoFormatName":case"VersionLastEdit":case"VersionLastRefresh":break;default:$=!1}break;case"Sorting":case"ConditionalFormatting":case"DataValidation":switch(h[3]){case"Range":case"Type":case"Min":case"Max":case"Sort":case"Descending":case"Order":case"CaseSensitive":case"Value":case"ErrorStyle":case"ErrorMessage":case"ErrorTitle":case"CellRangeList":case"InputMessage":case"InputTitle":case"ComboHide":case"InputHide":case"Condition":case"Qualifier":case"UseBlank":case"Value1":case"Value2":case"Format":break;default:$=!1}break;case"MapInfo":case"Schema":case"data":switch(h[3]){case"Map":case"Entry":case"Range":case"XPath":case"Field":case"XSDType":case"FilterOn":case"Aggregate":case"ElementType":case"AttributeType":break;case"schema":case"element":case"complexType":case"datatype":case"all":case"attribute":case"extends":case"row":break;default:$=!1}break;case"SmartTags":break;default:$=!1}if($)break;if(!j[j.length-1][1])throw"Unrecognized tag: "+h[3]+"|"+j.join("|");if("CustomDocumentProperties"===j[j.length-1][0]){if("/>"===h[0].slice(-2))break;"/"===h[1]?Qj(D,h[3],F,e.slice(E,h.index)):(F=h,E=h.index+h[0].length);break}if(c.WTF)throw"Unrecognized tag: "+h[3]+"|"+j.join("|")}var aa={};return c.bookSheets||c.bookProps||(aa.Sheets=l),aa.SheetNames=m,aa.Workbook=Q,aa.SSF=Tl.get_table(),aa.Props=C,aa.Custprops=D,aa}function Xj(a,b){switch(Eq(b=b||{}),b.type||"base64"){case"base64":return Wj(Ll.decode(a),b);case"binary":case"buffer":case"file":return Wj(a,b);case"array":return Wj(j(a),b)}}function Yj(a,b){var c=[];return a.Props&&c.push(Cb(a.Props,b)),a.Custprops&&c.push(Db(a.Props,a.Custprops,b)),c.join("")}function Zj(){return""}function $j(a,b){var c=[''];return b.cellXfs.forEach(function(a,b){var d=[];d.push(Z("NumberFormat",null,{"ss:Format":R(Tl._table[a.numFmtId])})),c.push(Z("Style",d.join(""),{"ss:ID":"s"+(21+b)}))}),Z("Styles",c.join(""))}function _j(a){return Z("NamedRange",null,{"ss:Name":a.Name,"ss:RefersTo":"="+ip(a.Ref,{r:0,c:0})})}function ak(a){if(!((a||{}).Workbook||{}).Names)return"";for(var b=a.Workbook.Names,c=[],d=0;d"),a["!margins"].header&&e.push(Z("Header",null,{"x:Margin":a["!margins"].header})),a["!margins"].footer&&e.push(Z("Footer",null,{"x:Margin":a["!margins"].footer})),e.push(Z("PageMargins",null,{"x:Bottom":a["!margins"].bottom||"0.75","x:Left":a["!margins"].left||"0.7","x:Right":a["!margins"].right||"0.7","x:Top":a["!margins"].top||"0.75"})),e.push("")),d&&d.Workbook&&d.Workbook.Sheets&&d.Workbook.Sheets[c])if(d.Workbook.Sheets[c].Hidden)e.push(Z("Visible",1==d.Workbook.Sheets[c].Hidden?"SheetHidden":"SheetVeryHidden",{}));else{for(var f=0;f")}return((((d||{}).Workbook||{}).Views||[])[0]||{}).RTL&&e.push(""),a["!protect"]&&(e.push(X("ProtectContents","True")),a["!protect"].objects&&e.push(X("ProtectObjects","True")),a["!protect"].scenarios&&e.push(X("ProtectScenarios","True")),null==a["!protect"].selectLockedCells||a["!protect"].selectLockedCells?null==a["!protect"].selectUnlockedCells||a["!protect"].selectUnlockedCells||e.push(X("EnableSelection","UnlockedCells")):e.push(X("EnableSelection","NoSelection")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(b){a["!protect"][b[0]]&&e.push("<"+b[1]+"/>")})),0==e.length?"":Z("WorksheetOptions",e.join(""),{xmlns:Hm.x})}function dk(a){return a.map(function(a){return Z("Comment",Z("ss:Data",sm(a.t||""),{xmlns:"http://www.w3.org/TR/REC-html40"}),{"ss:Author":a.a})}).join("")}function ek(a,b,c,d,e,f,g){if(!a||void 0==a.v&&void 0==a.f)return"";var h={};if(a.f&&(h["ss:Formula"]="="+R(ip(a.f,g))),a.F&&a.F.slice(0,b.length)==b){var i=za(a.F.slice(b.length+1));h["ss:ArrayRange"]="RC:R"+(i.r==g.r?"":"["+(i.r-g.r)+"]")+"C"+(i.c==g.c?"":"["+(i.c-g.c)+"]")}if(a.l&&a.l.Target&&(h["ss:HRef"]=R(a.l.Target),a.l.Tooltip&&(h["x:HRefScreenTip"]=R(a.l.Tooltip))),c["!merges"])for(var j=c["!merges"],k=0;k!=j.length;++k)j[k].s.c==g.c&&j[k].s.r==g.r&&(j[k].e.c>j[k].s.c&&(h["ss:MergeAcross"]=j[k].e.c-j[k].s.c),j[k].e.r>j[k].s.r&&(h["ss:MergeDown"]=j[k].e.r-j[k].s.r));var l="",m="";switch(a.t){case"z":return"";case"n":l="Number",m=String(a.v);break;case"b":l="Boolean",m=a.v?"1":"0";break;case"e":l="Error",m=sn[a.v];break;case"d":l="DateTime",m=new Date(a.v).toISOString(),null==a.z&&(a.z=a.z||Tl._table[14]);break;case"s":l="String",m=U(a.v||"")}var n=Lh(d.cellXfs,a,d);h["ss:StyleID"]="s"+(21+n),h["ss:Index"]=g.c+1;var o=null!=a.v?m:"",p=''+o+"";return(a.c||[]).length>0&&(p+=dk(a.c)),Z("Cell",p,h)}function fk(a,b){var c='"}function gk(a,b,c,d){if(!a["!ref"])return"";var e=Da(a["!ref"]),f=a["!merges"]||[],g=0,h=[];a["!cols"]&&a["!cols"].forEach(function(a,b){Te(a);var c=!!a.width,d=Jh(b,a),e={"ss:Index":b+1};c&&(e["ss:Width"]=Oe(d.width)),a.hidden&&(e["ss:Hidden"]="1"),h.push(Z("Column",null,e))});for(var i=Array.isArray(a),j=e.s.r;j<=e.e.r;++j){for(var k=[fk(j,(a["!rows"]||[])[j])],l=e.s.c;l<=e.e.c;++l){var m=!1;for(g=0;g!=f.length;++g)if(!(f[g].s.c>l||f[g].s.r>j||f[g].e.c"),k.length>2&&h.push(k.join(""))}return h.join("")}function hk(a,b,c){var d=[],e=c.SheetNames[a],f=c.Sheets[e],g=f?bk(f,b,a,c):"";return g.length>0&&d.push(""+g+""),g=f?gk(f,b,a,c):"",g.length>0&&d.push(""+g+"
          "),d.push(ck(f,b,a,c)),d.join("")}function ik(a,b){b||(b={}),a.SSF||(a.SSF=Tl.get_table()),a.SSF&&(Ul(Tl),Tl.load_table(a.SSF),b.revssf=u(a.SSF),b.revssf[a.SSF[65535]]=0,b.ssf=a.SSF,b.cellXfs=[],Lh(b.cellXfs,{},{revssf:{General:0}}));var c=[];c.push(Yj(a,b)),c.push(Zj(a,b)),c.push(""),c.push("");for(var d=0;d40?b:(c.l-=4,b.Reserved1=c.read_shift(0,"lpstr-ansi"),c.length-c.l<=4?b:1907505652!==(d=c.read_shift(4))?b:(b.UnicodeClipboardFormat=fb(c),0==(d=c.read_shift(4))||d>40?b:(c.l-=4,void(b.Reserved2=c.read_shift(0,"lpwstr")))))}function kk(a,b,c,d){var e=c,f=[],g=b.slice(b.l,b.l+e);if(d&&d.enc&&d.enc.insitu)switch(a.n){case"BOF":case"FilePass":case"FileLock":case"InterfaceHdr":case"RRDInfo":case"RRDHead":case"UsrExcl":break;default:if(0===g.length)break;d.enc.insitu(g)}f.push(g),b.l+=e;for(var h=pq[an(b,b.l)],i=0;null!=h&&"Continue"===h.n.slice(0,8);)e=an(b,b.l+2),i=b.l+4,"ContinueFrt"==h.n?i+=4:"ContinueFrt"==h.n.slice(0,11)&&(i+=12),f.push(b.slice(i,b.l+4+e)),b.l+=4+e,h=pq[an(b,b.l)];var j=Ql(f);ga(j,0);var k=0;j.lens=[];for(var l=0;l1)&&(c.sheetRows&&a.r>=c.sheetRows&&(w=!1),w)){if(c.cellStyles&&b.XF&&b.XF.data&&C(a,b,c),delete b.ixfe,delete b.XF,e=a,t=Aa(a),n&&n.s&&n.e||(n={s:{r:0,c:0},e:{r:0,c:0}}),a.rn.e.r&&(n.e.r=a.r+1),a.c+1>n.e.c&&(n.e.c=a.c+1),c.cellFormula&&b.f)for(var d=0;da.c||v[d][0].s.r>a.r||v[d][0].e.c>8)!==U)throw new Error("rt mismatch: "+X+"!="+U);12==W.r&&(a.l+=10,V-=10)}var Y;Y="EOF"===W.n?W.f(a,V,E):kk(W,a,V,E);var Z=W.n;if(0==O&&"BOF"!=Z)continue;switch(Z){case"Date1904":c.opts.Date1904=z.WBProps.date1904=Y;break;case"WriteProtect":c.opts.WriteProtect=!0;break;case"FilePass":if(E.enc||(a.l=0),E.enc=Y,!b.password)throw new Error("File is password-protected");if(null==Y.valid)throw new Error("Encryption scheme unsupported");if(!Y.valid)throw new Error("Password is incorrect");break;case"WriteAccess":E.lastuser=Y;break;case"FileSharing":break;case"CodePage":switch(Y){case 21010:Y=1200;break;case 32768:Y=1e4;break;case 32769:Y=1252}Gl(E.codepage=Y),S=!0;break;case"RRTabId":E.rrtabid=Y;break;case"WinProtect":E.winlocked=Y;break;case"Template":case"BookBool":case"UsesELFs":case"MTRSettings":break;case"RefreshAll":case"CalcCount":case"CalcDelta":case"CalcIter":case"CalcMode":case"CalcPrecision":case"CalcSaveRecalc":c.opts[Z]=Y;break;case"CalcRefMode":E.CalcRefMode=Y;break;case"Uncalced":break;case"ForceFullCalculation":c.opts.FullCalc=Y;break;case"WsBool":Y.fDialog&&(l["!type"]="dialog");break;case"XF":x.push(Y);break;case"ExtSST":case"BookExt":case"RichTextStream":case"BkHim":break;case"SupBook":L.push([Y]),L[L.length-1].XTI=[];break;case"ExternName":L[L.length-1].push(Y);break;case"Index":break;case"Lbl":M={Name:Y.Name,Ref:wh(Y.rgce,n,null,L,E)},Y.itab>0&&(M.Sheet=Y.itab-1),L.names.push(M),L[0]||(L[0]=[],L[0].XTI=[]),L[L.length-1].push(Y),"_xlnm._FilterDatabase"==Y.Name&&Y.itab>0&&Y.rgce&&Y.rgce[0]&&Y.rgce[0][0]&&"PtgArea3d"==Y.rgce[0][0][0]&&(R[Y.itab-1]={ref:Ca(Y.rgce[0][0][1][2])});break;case"ExternCount":E.ExternCount=Y;break;case"ExternSheet":0==L.length&&(L[0]=[],L[0].XTI=[]),L[L.length-1].XTI=L[L.length-1].XTI.concat(Y),L.XTI=L.XTI.concat(Y);break;case"NameCmt":if(E.biff<8)break;null!=M&&(M.Comment=Y[1]);break;case"Protect":l["!protect"]=Y;break;case"Password":0!==Y&&E.WTF&&console.error("Password verifier: "+Y);break;case"Prot4Rev":case"Prot4RevPass":break;case"BoundSheet8":m[Y.pos]=Y,E.snames.push(Y.name);break;case"EOF":if(--O)break;if(n.e){if(n.e.r>0&&n.e.c>0){if(n.e.r--,n.e.c--,l["!ref"]=Ca(n),b.sheetRows&&b.sheetRows<=n.e.r){var $=n.e.r;n.e.r=b.sheetRows-1,l["!fullref"]=l["!ref"],l["!ref"]=Ca(n),n.e.r=$}n.e.r++,n.e.c++}G.length>0&&(l["!merges"]=G),H.length>0&&(l["!objects"]=H),I.length>0&&(l["!cols"]=I),J.length>0&&(l["!rows"]=J),z.Sheets.push(A)}""===q?s=l:d[q]=l,l=b.dense?[]:{};break;case"BOF":if(8===E.biff&&(E.biff={9:2,521:3,1033:4}[U]||{512:2,768:3,1024:4,1280:5,1536:8,2:2,7:2}[Y.BIFFVer]||8),8==E.biff&&0==Y.BIFFVer&&16==Y.dt&&(E.biff=2),O++)break;if(w=!0,l=b.dense?[]:{},E.biff<8&&!S&&(S=!0,Gl(E.codepage=b.codepage||1252)),E.biff<5){""===q&&(q="Sheet1"),n={s:{r:0,c:0},e:{r:0,c:0}};var _={pos:a.l-V,name:q};m[_.pos]=_,E.snames.push(q)}else q=(m[T]||{name:""}).name;32==Y.dt&&(l["!type"]="chart"),64==Y.dt&&(l["!type"]="macro"),G=[],H=[],E.arrayf=v=[],I=[],J=[],0,K=!1,A={Hidden:(m[T]||{hs:0}).hs,name:q};break;case"Number":case"BIFF2NUM":case"BIFF2INT":"chart"==l["!type"]&&(b.dense?(l[Y.r]||[])[Y.c]:l[Aa({c:Y.c,r:Y.r})])&&++Y.c,j={ixfe:Y.ixfe,XF:x[Y.ixfe]||{},v:Y.val,t:"n"},P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:Y.c,r:Y.r},j,b);break;case"BoolErr":j={ixfe:Y.ixfe,XF:x[Y.ixfe],v:Y.val,t:Y.t},P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:Y.c,r:Y.r},j,b);break;case"RK":j={ixfe:Y.ixfe,XF:x[Y.ixfe],v:Y.rknum,t:"n"},P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:Y.c,r:Y.r},j,b);break;case"MulRk":for(var aa=Y.c;aa<=Y.C;++aa){var ba=Y.rkrec[aa-Y.c][0];j={ixfe:ba,XF:x[ba],v:Y.rkrec[aa-Y.c][1],t:"n"},P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:aa,r:Y.r},j,b)}break;case"Formula":if("String"==Y.val){o=Y;break}if(j=mk(Y.val,Y.cell.ixfe,Y.tt),j.XF=x[j.ixfe],b.cellFormula){var ca=Y.formula;if(ca&&ca[0]&&ca[0][0]&&"PtgExp"==ca[0][0][0]){var da=ca[0][0][1][0],ea=ca[0][0][1][1],fa=Aa({r:da,c:ea});u[fa]?j.f=""+wh(Y.formula,n,Y.cell,L,E):j.F=((b.dense?(l[da]||[])[ea]:l[fa])||{}).F}else j.f=""+wh(Y.formula,n,Y.cell,L,E)}P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D(Y.cell,j,b),o=Y;break;case"String":if(!o)throw new Error("String record expects Formula");o.val=Y,j=mk(Y,o.cell.ixfe,"s"),j.XF=x[j.ixfe],b.cellFormula&&(j.f=""+wh(o.formula,n,o.cell,L,E)),P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D(o.cell,j,b),o=null;break;case"Array":v.push(Y);var ga=Aa(Y[0].s);if(f=b.dense?(l[Y[0].s.r]||[])[Y[0].s.c]:l[ga],b.cellFormula&&f){if(!o)break;if(!ga||!f)break;f.f=""+wh(Y[1],n,Y[0],L,E),f.F=Ca(Y[0])}break;case"ShrFmla":if(!w)break;if(!b.cellFormula)break;if(t){if(!o)break;u[Aa(o.cell)]=Y[0],f=b.dense?(l[o.cell.r]||[])[o.cell.c]:l[Aa(o.cell)],(f||{}).f=""+wh(Y[0],n,e,L,E)}break;case"LabelSst":j=mk(p[Y.isst].t,Y.ixfe,"s"),j.XF=x[j.ixfe],P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:Y.c,r:Y.r},j,b);break;case"Blank":b.sheetStubs&&(j={ixfe:Y.ixfe,XF:x[Y.ixfe],t:"z"},P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:Y.c,r:Y.r},j,b));break;case"MulBlank":if(b.sheetStubs)for(var ha=Y.c;ha<=Y.C;++ha){var ia=Y.ixfe[ha-Y.c];j={ixfe:ia,XF:x[ia],t:"z"},P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:ha,r:Y.r},j,b)}break;case"RString":case"Label":case"BIFF2STR":j=mk(Y.val,Y.ixfe,"s"),j.XF=x[j.ixfe],P>0&&(j.z=Q[j.ixfe>>8&31]),lk(j,b,c.opts.Date1904),D({c:Y.c,r:Y.r},j,b);break;case"Dimensions":1===O&&(n=Y);break;case"SST":p=Y;break;case"Format":if(4==E.biff){Q[P++]=Y[1];for(var ja=0;ja=163&&Tl.load(Y[1],P+163)}else Tl.load(Y[1],Y[0]);break;case"BIFF2FORMAT":Q[P++]=Y;for(var ka=0;ka=163&&Tl.load(Y,P+163);break;case"MergeCells":G=G.concat(Y);break;case"Obj":H[Y.cmo[0]]=E.lastobj=Y;break;case"TxO":E.lastobj.TxO=Y;break;case"ImData":E.lastobj.ImData=Y;break;case"HLink":for(i=Y[0].s.r;i<=Y[0].e.r;++i)for(h=Y[0].s.c;h<=Y[0].e.c;++h)(f=b.dense?(l[i]||[])[h]:l[Aa({c:h,r:i})])&&(f.l=Y[1]);break;case"HLinkTooltip":for(i=Y[0].s.r;i<=Y[0].e.r;++i)for(h=Y[0].s.c;h<=Y[0].e.c;++h)(f=b.dense?(l[i]||[])[h]:l[Aa({c:h,r:i})])&&f.l&&(f.l.Tooltip=Y[1]);break;case"Note":if(E.biff<=5&&E.biff>=2)break;f=b.dense?(l[Y[0].r]||[])[Y[0].c]:l[Aa(Y[0])];var la=H[Y[2]];if(!f)break;f.c||(f.c=[]),g={a:Y[1],t:la.TxO.t},f.c.push(g);break;default:switch(W.n){case"ClrtClient":break;case"XFExt":Nf(x[Y.ixfe],Y.ext);break;case"DefColWidth":Y;break;case"DefaultRowHeight":Y[1];break;case"ColInfo":if(!E.cellStyles)break;for(;Y.e>=Y.s;)I[Y.e--]={width:Y.w/256},K||(K=!0,Se(Y.w/256)),Te(I[Y.e+1]);break;case"Row":var ma={};null!=Y.level&&(J[Y.r]=ma,ma.level=Y.level),Y.hidden&&(J[Y.r]=ma,ma.hidden=!0),Y.hpt&&(J[Y.r]=ma,ma.hpt=Y.hpt,ma.hpx=Ve(Y.hpt));break;case"LeftMargin":case"RightMargin":case"TopMargin":case"BottomMargin":l["!margins"]||Kh(l["!margins"]={}),l["!margins"][Z.slice(0,-6).toLowerCase()]=Y;break;case"Setup":l["!margins"]||Kh(l["!margins"]={}),l["!margins"].header=Y.header,l["!margins"].footer=Y.footer;break;case"Window2":Y.RTL&&(z.Views[0].RTL=!0);break;case"Header":case"Footer":case"HCenter":case"VCenter":case"Pls":case"GCW":case"LHRecord":case"DBCell":case"EntExU2":case"SxView":case"Sxvd":case"SXVI":case"SXVDEx":case"SxIvd":case"SXString":case"Sync":case"Addin":case"SXDI":case"SXLI":case"SXEx":case"QsiSXTag":case"Selection":case"Feat":break;case"FeatHdr":case"FeatHdr11":break;case"Feature11":case"Feature12":case"List12":break;case"Country":k=Y;break;case"RecalcId":case"DxGCol":break;case"Fbi":case"Fbi2":case"GelFrame":case"Font":case"XFCRC":case"Style":case"StyleExt":break;case"Palette":y=Y;break;case"Theme":F=Y;break;case"ScenarioProtect":case"ObjProtect":case"CondFmt12":case"Table":case"TableStyles":case"TableStyle":case"TableStyleElement":case"SXStreamID":case"SXVS":case"DConRef":case"SXAddl":case"DConBin":case"DConName":case"SXPI":case"SxFormat":case"SxSelect":case"SxRule":case"SxFilt":case"SxItm":case"SxDXF":case"ScenMan":case"DCon":case"CellWatch":case"PrintRowCol":case"PrintGrid":case"PrintSize":case"XCT":case"CRN":case"Scl":case"SheetExt":case"SheetExtOptional":case"ObNoMacros":case"ObProj":break;case"CodeName":q?A.CodeName=Y||A.name:z.WBProps.CodeName=Y||"ThisWorkbook";break;case"GUIDTypeLib":case"WOpt":case"PhoneticInfo":case"OleObjectSize":break;case"DXF":case"DXFN":case"DXFN12":case"DXFN12List":case"DXFN12NoCB":break;case"Dv":case"DVal":break;case"BRAI":case"Series":case"SeriesText":case"DConn":case"DbOrParamQry":case"DBQueryExt":case"OleDbConn":case"ExtString":case"IFmtRecord":break;case"CondFmt":case"CF":case"CF12":case"CFEx":case"Excel9File":case"Units":break;case"InterfaceHdr":case"Mms":case"InterfaceEnd":case"DSF":case"BuiltInFnGroupCount":break;case"Window1":case"HideObj":case"GridSet":case"Guts":case"UserBView":case"UserSViewBegin":case"UserSViewEnd":case"Pane":break;default:switch(W.n){case"Dat":case"Begin":case"End":case"StartBlock":case"EndBlock":case"Frame":case"Area":case"Axis":case"AxisLine":case"Tick":break;case"AxesUsed":case"CrtLayout12":case"CrtLayout12A":case"CrtLink":case"CrtLine":case"CrtMlFrt":case"CrtMlFrtContinue":break;case"LineFormat":case"AreaFormat":case"Chart":case"Chart3d":case"Chart3DBarShape":case"ChartFormat":case"ChartFrtInfo":break;case"PlotArea":case"PlotGrowth":break;case"SeriesList":case"SerParent":case"SerAuxTrend":break;case"DataFormat":case"SerToCrt":case"FontX":break;case"CatSerRange":case"AxcExt":case"SerFmt":case"ShtProps":break;case"DefaultText":case"Text":case"CatLab":case"DataLabExtContents":break;case"Legend":case"LegendException":break;case"Pie":case"Scatter":break;case"PieFormat":case"MarkerFormat":break;case"StartObject":case"EndObject":break;case"AlRuns":case"ObjectLink":case"SIIndex":break;case"AttachedLabel":case"YMult":break;case"Line":case"Bar":case"Surf":case"AxisParent":case"Pos":case"ValueRange":case"SXViewEx9":case"SXViewLink":case"PivotChartBits":case"SBaseRef":case"TextPropsStream":case"LnExt":case"MkrExt":case"CrtCoopt":break;case"Qsi":case"Qsif":case"Qsir":case"QsiSXTag":case"TxtQry":case"FilterMode":break;case"AutoFilter":case"AutoFilterInfo":case"AutoFilter12":case"DropDownObjIds":case"Sort":case"SortData":case"ShapePropsStream":break;case"MsoDrawing":case"MsoDrawingGroup":case"MsoDrawingSelection":break;case"WebPub":case"AutoWebPub":break;case"HeaderFooter":case"HFPicture":case"PLV":case"HorizontalPageBreaks":case"VerticalPageBreaks":break;case"Backup":case"CompressPictures":case"Compat12":break;case"Continue":case"ContinueFrt12":break;case"FrtFontList":case"FrtWrapper":break;default:switch(W.n){case"TabIdConf":case"Radar":case"RadarArea":case"DropBar":case"Intl":case"CoordList":case"SerAuxErrBar":break;case"BIFF2FONTCLR":case"BIFF2FMTCNT":case"BIFF2FONTXTRA":break;case"BIFF2XF":case"BIFF3XF":case"BIFF4XF":break;case"BIFF4FMTCNT":case"BIFF2ROW":case"BIFF2WINDOW2":break;case"SCENARIO":case"DConBin":case"PicF":case"DataLabExt":case"Lel":case"BopPop":case"BopPopCustom":case"RealTimeData":case"Name":break;case"LHNGraph":case"FnGroupName":case"AddMenu":case"LPr":break;case"ListObj":case"ListField":case"RRSort":case"BigName":break;case"ToolbarHdr":case"ToolbarEnd":case"DDEObjName":case"FRTArchId$":break;default:if(b.WTF)throw"Unrecognized Record "+W.n}}}}}else a.l+=V}return c.SheetNames=r(m).sort(function(a,b){return Number(a)-Number(b)}).map(function(a){return m[a].name}),b.bookSheets||(c.Sheets=d),c.Sheets&&R.forEach(function(a,b){c.Sheets[c.SheetNames[b]]["!autofilter"]=a}),c.Preamble=s,c.Strings=p,c.SSF=Tl.get_table(),E.enc&&(c.Encryption=E.enc),F&&(c.Themes=F),c.Metadata={},void 0!==k&&(c.Metadata.Country=k),L.names.length>0&&(z.Names=L.names),c.Workbook=z,c}function ok(a,b,c){var d=$l.find(a,"!DocumentSummaryInformation");if(d&&d.size>0)try{var e=Yb(d,Hn,mq.DSI);for(var f in e)b[f]=e[f]}catch(a){if(c.WTF)throw a}var g=$l.find(a,"!SummaryInformation");if(g&&g.size>0)try{var h=Yb(g,In,mq.SI);for(var i in h)null==b[i]&&(b[i]=h[i])}catch(a){if(c.WTF)throw a}b.HeadingPairs&&b.TitlesOfParts&&(wb(b.HeadingPairs,b.TitlesOfParts,b,c),delete b.HeadingPairs,delete b.TitlesOfParts)}function pk(a,b){var c,d=[],e=[],f=[],g=0;if(a.Props)for(c=r(a.Props),g=0;g-1||null!=f[g][1]&&h.push(f[g]);e.length&&$l.utils.cfb_add(b,"/SummaryInformation",Zb(e,mq.SI,Ln,In)),(d.length||h.length)&&$l.utils.cfb_add(b,"/DocumentSummaryInformation",Zb(d,mq.DSI,Kn,Hn,h.length?h:null,mq.UDI))}function qk(a,b){b||(b={}),Eq(b),c(),b.codepage&&Fl(b.codepage);var d,e;if(a.FullPaths){if($l.find(a,"/encryption"))throw new Error("File is password-protected");d=$l.find(a,"!CompObj"),e=$l.find(a,"/Workbook")||$l.find(a,"/Book")}else{switch(b.type){case"base64":a=Pl(Ll.decode(a));break;case"binary":a=Pl(a);break;case"buffer":break;case"array":Array.isArray(a)||(a=Array.prototype.slice.call(a))}ga(a,0),e={content:a}}var f,g;if(d&&jk(d),b.bookProps&&!b.bookSheets)f={};else{var h=Ml?"buffer":"array";if(e&&e.content)f=nk(e.content,b);else if((g=$l.find(a,"PerfectOffice_MAIN"))&&g.content)f=wo.to_workbook(g.content,(b.type=h,b));else{if(!(g=$l.find(a,"NativeContent_MAIN"))||!g.content)throw new Error("Cannot find Workbook stream");f=wo.to_workbook(g.content,(b.type=h,b))}b.bookVBA&&a.FullPaths&&$l.find(a,"/_VBA_PROJECT_CUR/VBA/dir")&&(f.vbaraw=cg(a))}var i={};return a.FullPaths&&ok(a,i,b),f.Props=f.Custprops=i,b.bookFiles&&(f.cfb=a),f}function rk(a,b){var c=b||{},d=$l.utils.cfb_new({root:"R"}),e="/Workbook";switch(c.bookType||"xls"){case"xls":c.bookType="biff8";case"xla":c.bookType||(c.bookType="xla");case"biff8":e="/Workbook",c.biff=8;break;case"biff5":e="/Book",c.biff=5;break;default:throw new Error("invalid type "+c.bookType+" for XLS CFB")}return $l.utils.cfb_add(d,e,Ik(a,c)),8==c.biff&&(a.Props||a.Custprops)&&pk(a,d),8==c.biff&&a.vbaraw&&dg(d,$l.read(a.vbaraw,{type:"string"==typeof a.vbaraw?"binary":"buffer"})),d}function sk(a,b,c,d){var e=+b||+qq[b];if(!isNaN(e)){var f=d||(c||[]).length||0,g=a.next(4);g.write_shift(2,e),g.write_shift(2,f),f>0&&$m(c)&&a.push(c)}}function tk(a,b,c){return a||(a=ia(7)),a.write_shift(2,b),a.write_shift(2,c),a.write_shift(2,0),a.write_shift(1,0),a}function uk(a,b,c,d){var e=ia(9);return tk(e,a,b),"e"==d?(e.write_shift(1,c),e.write_shift(1,1)):(e.write_shift(1,c?1:0),e.write_shift(1,0)),e}function vk(a,b,c){var d=ia(8+2*c.length);return tk(d,a,b),d.write_shift(1,c.length),d.write_shift(c.length,c,"sbcs"),d.l=0&&e<65536?sk(a,2,de(c,d,e)):sk(a,3,be(c,d,e)));case"b":case"e":return void sk(a,5,uk(c,d,b.v,b.t));case"s":case"str":return void sk(a,4,vk(c,d,b.v))}sk(a,1,tk(null,c,d))}function xk(a,b,c,d){var e,f=Array.isArray(b),g=Da(b["!ref"]||"A1"),h="",i=[];if(g.e.c>255||g.e.r>16383){if(d.WTF)throw new Error("Range "+(b["!ref"]||"A1")+" exceeds format limit A1:IV16384");g.e.c=Math.min(g.e.c,255),g.e.r=Math.min(g.e.c,16383),e=Ca(g)}for(var j=g.s.r;j<=g.e.r;++j){h=ra(j);for(var k=g.s.c;k<=g.e.c;++k){j===g.s.r&&(i[k]=va(k)),e=i[k]+h;var l=f?(b[j]||[])[k]:b[e];l&&wk(a,l,j,k,d)}}}function yk(a,b){var c=b||{};null!=Jl&&null==c.dense&&(c.dense=Jl);for(var d=ka(),e=0,f=0;f255||n.e.r>=o){if(b.WTF)throw new Error("Range "+(g["!ref"]||"A1")+" exceeds format limit A1:IV16384");n.e.c=Math.min(n.e.c,255),n.e.r=Math.min(n.e.c,o-1)}sk(e,2057,Nc(c,16,b)),sk(e,"CalcMode",ec(1)),sk(e,"CalcCount",ec(100)),sk(e,"CalcRefMode",cc(!0)),sk(e,"CalcIter",cc(!1)),sk(e,"CalcDelta",$a(.001)),sk(e,"CalcSaveRecalc",cc(!0)),sk(e,"PrintRowCol",cc(!1)),sk(e,"PrintGrid",cc(!1)),sk(e,"GridSet",ec(1)),sk(e,"Guts",sd([0,0])),sk(e,"HCenter",cc(!1)),sk(e,"VCenter",cc(!1)),sk(e,512,kd(n,b)),k&&(g["!links"]=[]);for(var p=n.s.r;p<=n.e.r;++p){l=ra(p);for(var q=n.s.c;q<=n.e.c;++q){p===n.s.r&&(m[q]=va(q)),d=m[q]+l;var r=j?(g[p]||[])[q]:g[d];r&&(Ek(e,r,p,q,b),k&&r.l&&g["!links"].push([d,r.l]))}}var s=i.CodeName||i.name||f;return k&&h.Views&&sk(e,"Window2",bd(h.Views[0])),k&&(g["!merges"]||[]).length&&sk(e,"MergeCells",Jd(g["!merges"])),k&&Dk(e,g),sk(e,"CodeName",nc(s,b)),k&&Bk(e,g),sk(e,"EOF"),e.end()}function Gk(a,b,c){var d=ka(),e=(a||{}).Workbook||{},f=e.Sheets||[],g=e.WBProps||{},h=8==c.biff,i=5==c.biff;if(sk(d,2057,Nc(a,5,c)),"xla"==c.bookType&&sk(d,"Addin"),sk(d,"InterfaceHdr",h?ec(1200):null),sk(d,"Mms",_b(2)),i&&sk(d,"ToolbarHdr"),i&&sk(d,"ToolbarEnd"),sk(d,"InterfaceEnd"),sk(d,"WriteAccess",Qc("SheetJS",c)),sk(d,"CodePage",ec(h?1200:1252)),h&&sk(d,"DSF",ec(0)),h&&sk(d,"Excel9File"),sk(d,"RRTabId",Zd(a.SheetNames.length)),h&&a.vbaraw){sk(d,"ObProj");sk(d,"CodeName",nc(g.CodeName||"ThisWorkbook",c))}sk(d,"BuiltInFnGroupCount",ec(17)),sk(d,"WinProtect",cc(!1)),sk(d,"Protect",cc(!1)),sk(d,"Password",ec(0)),h&&sk(d,"Prot4Rev",cc(!1)),h&&sk(d,"Prot4RevPass",ec(0)),sk(d,"Window1",_c(c)),sk(d,"Backup",cc(!1)),sk(d,"HideObj",ec(0)),sk(d,"Date1904",cc("true"==fj(a))),sk(d,"CalcPrecision",cc(!0)),h&&sk(d,"RefreshAll",cc(!1)),sk(d,"BookBool",ec(0)),zk(d,a,c),Ak(d,a.SSF,c),Ck(d,c),h&&sk(d,"UsesELFs",cc(!1));var j=d.end(),k=ka();h&&sk(k,"Country",Sd()),sk(k,"EOF");var l=k.end(),m=ka(),n=0,o=0;for(o=0;o0||g>1)&&l.push({s:{r:p,c:e},e:{r:p+(f||1)-1,c:e+g-1}});var v={t:"s",v:t},x=s.getAttribute("t")||"";null!=t&&(0==t.length?v.t=x||"z":c.raw||0==t.trim().length||"s"==x||("TRUE"===t?v={t:"b",v:!0}:"FALSE"===t?v={t:"b",v:!1}:isNaN(D(t))?isNaN(E(t).getDate())||(v={t:"d",v:z(t)},c.cellDates||(v={t:"n",v:w(v.v)}),v.z=c.dateNF||Tl._table[14]):v={t:"n",v:D(t)})),c.dense?(h[p]||(h[p]=[]),h[p][e]=v):h[Aa({c:e,r:p})]=v,k.e.c=j&&(h["!fullref"]=Ca((k.e.r=i.length-o+p-1,k))),h}function Kk(a,b){return Ga(Jk(a,b),b)}function Lk(a){var b="",c=Mk(a);return c&&(b=c(a).getPropertyValue("display")),b||(b=a.style.display),"none"===b}function Mk(a){return a.ownerDocument.defaultView&&"function"==typeof a.ownerDocument.defaultView.getComputedStyle?a.ownerDocument.defaultView.getComputedStyle:"function"==typeof getComputedStyle?getComputedStyle:null}function Nk(a,b){b=b||{};var c=!!J(a,"objectdata");c&&ob(L(a,"META-INF/manifest.xml"),b);var d=M(a,"content.xml");if(!d)throw new Error("Missing content.xml in "+(c?"ODS":"UOF")+" file");var e=sq(c?d:tm(d),b);return J(a,"meta.xml")&&(e.Props=tb(L(a,"meta.xml"))),e}function Ok(a,b){return sq(a,b)}function Pk(a,b){if("fods"==b.bookType)return uq(a,b);var c=new dm,d="",e=[],f=[];return d="mimetype",c.file(d,"application/vnd.oasis.opendocument.spreadsheet"),d="content.xml",c.file(d,uq(a,b)),e.push([d,"text/xml"]),f.push([d,"ContentFile"]),d="styles.xml",c.file(d,tq(a,b)),e.push([d,"text/xml"]),f.push([d,"StylesFile"]),d="meta.xml",c.file(d,Xn()),e.push([d,"text/xml"]),f.push([d,"MetadataFile"]),d="manifest.rdf",c.file(d,sb(f)),e.push([d,"application/rdf+xml"]),d="META-INF/manifest.xml",c.file(d,pb(e)),c}function Qk(a,b){if(!b)return 0;var c=a.SheetNames.indexOf(b);if(-1==c)throw new Error("Sheet not found: "+b);return c}function Rk(a){return function(b,c){var d=Qk(b,c.sheet);return a.from_sheet(b.Sheets[b.SheetNames[d]],c,b)}}function Sk(a){return function(b){for(var c=0;c!=a.length;++c){var d=a[c];void 0===b[d[0]]&&(b[d[0]]=d[1]),"n"===d[2]&&(b[d[0]]=Number(b[d[0]]))}}}function Tk(a){return Un.WS.indexOf(a)>-1?"sheet":Un.CS&&a==Un.CS?"chart":Un.DS&&a==Un.DS?"dialog":Un.MS&&a==Un.MS?"macro":a&&a.length?a:"sheet"}function Uk(a,b){if(!a)return 0;try{a=b.map(function(b){return b.id||(b.id=b.strRelID),[b.name,a["!id"][b.id].Target,Tk(a["!id"][b.id].Type)]})}catch(a){return null}return a&&0!==a.length?a:null}function Vk(a,b,c,d,e,f,g,h,i,j,k,l){try{f[d]=lb(M(a,c,!0),b);var m,n=L(a,b);switch(h){case"sheet":m=yj(n,b,e,i,f[d],j,k,l);break;case"chart":if(!(m=zj(n,b,e,i,f[d],j,k,l))||!m["!chart"])break;var o=O(m["!chart"].Target,b),p=kb(o),q=Tf(M(a,o,!0),lb(M(a,p,!0),o)),r=O(q,o),s=kb(r);m=$i(M(a,r,!0),r,i,lb(M(a,s,!0),r),j,m);break;case"macro":m=Aj(n,b,e,i,f[d],j,k,l);break;case"dialog":m=Bj(n,b,e,i,f[d],j,k,l)}g[d]=m}catch(a){if(i.WTF)throw a}}function Wk(a){return"/"==a.charAt(0)?a.slice(1):a}function Xk(a,b){if(Ul(Tl),b=b||{},Eq(b),J(a,"META-INF/manifest.xml"))return Nk(a,b);if(J(a,"objectdata.xml"))return Nk(a,b);if(J(a,"Index/Document.iwa"))throw new Error("Unsupported NUMBERS file");var c,d,e=N(a),f=ib(M(a,"[Content_Types].xml")),g=!1;if(0===f.workbooks.length&&(d="xl/workbook.xml",L(a,d,!0)&&f.workbooks.push(d)),0===f.workbooks.length){if(d="xl/workbook.bin",!L(a,d,!0))throw new Error("Could not find workbook");f.workbooks.push(d),g=!0}"bin"==f.workbooks[0].slice(-3)&&(g=!0);var h={},i={};if(!b.bookSheets&&!b.bookProps){if(Jp=[],f.sst)try{Jp=Ej(L(a,Wk(f.sst)),f.sst,b)}catch(a){if(b.WTF)throw a}b.cellStyles&&f.themes.length&&(h=Dj(M(a,f.themes[0].replace(/^\//,""),!0)||"",f.themes[0],b)),f.style&&(i=Cj(L(a,Wk(f.style)),f.style,h,b))}f.links.map(function(c){return Hj(L(a,Wk(c)),c,b)});var j=xj(L(a,Wk(f.workbooks[0])),f.workbooks[0],b),k={},l="";f.coreprops.length&&(l=L(a,Wk(f.coreprops[0]),!0),l&&(k=tb(l)),0!==f.extprops.length&&(l=L(a,Wk(f.extprops[0]),!0))&&xb(l,k,b));var m={};b.bookSheets&&!b.bookProps||0!==f.custprops.length&&(l=M(a,Wk(f.custprops[0]),!0))&&(m=zb(l,b));var n={};if((b.bookSheets||b.bookProps)&&(j.Sheets?c=j.Sheets.map(function(a){return a.name}):k.Worksheets&&k.SheetNames.length>0&&(c=k.SheetNames),b.bookProps&&(n.Props=k,n.Custprops=m),b.bookSheets&&void 0!==c&&(n.SheetNames=c),b.bookSheets?n.SheetNames:b.bookProps))return n;c={};var o={};b.bookDeps&&f.calcchain&&(o=Gj(L(a,Wk(f.calcchain)),f.calcchain,b));var p,q,r=0,s={},t=j.Sheets;k.Worksheets=t.length,k.SheetNames=[];for(var u=0;u!=t.length;++u)k.SheetNames[u]=t[u].name;var v=g?"bin":"xml",w=f.workbooks[0].lastIndexOf("/"),x=(f.workbooks[0].slice(0,w+1)+"_rels/"+f.workbooks[0].slice(w+1)+".rels").replace(/^\//,"");J(a,x)||(x="xl/_rels/workbook."+v+".rels");var y=lb(M(a,x,!0),x);y&&(y=Uk(y,j.Sheets));var z=L(a,"xl/worksheets/sheet.xml",!0)?1:0;for(r=0;r!=k.Worksheets;++r){var A="sheet";y&&y[r]?(p="xl/"+y[r][1].replace(/[\/]?xl\//,""),J(a,p)||(p=y[r][1]),J(a,p)||(p=x.replace(/_rels\/.*$/,"")+y[r][1]),A=y[r][2]):(p="xl/worksheets/sheet"+(r+1-z)+"."+v,p=p.replace(/sheet0\./,"sheet.")),q=p.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),Vk(a,p,q,k.SheetNames[r],r,s,c,A,b,j,h,i)}return f.comments&&Vf(a,f.comments,c,s,b),n={Directory:f,Workbook:j,Props:k,Custprops:m,Deps:o,Sheets:c,SheetNames:k.SheetNames,Strings:Jp,Styles:i,Themes:h,SSF:Tl.get_table()},b.bookFiles&&(n.keys=e,n.files=a.files),b.bookVBA&&(f.vba.length>0?n.vbaraw=L(a,Wk(f.vba[0]),!0):f.defaults&&f.defaults.bin===ep&&(n.vbaraw=L(a,"xl/vbaProject.bin",!0))),n}function Yk(a,b){var c=b||{},d="Workbook",e=$l.find(a,d);try{if(d="/!DataSpaces/Version",!(e=$l.find(a,d))||!e.content)throw new Error("ECMA-376 Encrypted file missing "+d);if(re(e.content),d="/!DataSpaces/DataSpaceMap",!(e=$l.find(a,d))||!e.content)throw new Error("ECMA-376 Encrypted file missing "+d);var f=te(e.content);if(1!==f.length||1!==f[0].comps.length||0!==f[0].comps[0].t||"StrongEncryptionDataSpace"!==f[0].name||"EncryptedPackage"!==f[0].comps[0].v)throw new Error("ECMA-376 Encrypted file bad "+d);if(d="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",!(e=$l.find(a,d))||!e.content)throw new Error("ECMA-376 Encrypted file missing "+d);var g=ue(e.content);if(1!=g.length||"StrongEncryptionTransform"!=g[0])throw new Error("ECMA-376 Encrypted file bad "+d);if(d="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",!(e=$l.find(a,d))||!e.content)throw new Error("ECMA-376 Encrypted file missing "+d);we(e.content)}catch(a){}if(d="/EncryptionInfo",!(e=$l.find(a,d))||!e.content)throw new Error("ECMA-376 Encrypted file missing "+d);var h=ze(e.content);if(d="/EncryptedPackage",!(e=$l.find(a,d))||!e.content)throw new Error("ECMA-376 Encrypted file missing "+d);if(4==h[0]&&"undefined"!=typeof decrypt_agile)return decrypt_agile(h[1],e.content,c.password||"",c);if(2==h[0]&&"undefined"!=typeof decrypt_std76)return decrypt_std76(h[1],e.content,c.password||"",c);throw new Error("File is password-protected")}function Zk(a,b){if(bp=1024,"ods"==b.bookType)return Pk(a,b);a&&!a.SSF&&(a.SSF=Tl.get_table()),a&&a.SSF&&(Ul(Tl),Tl.load_table(a.SSF),b.revssf=u(a.SSF),b.revssf[a.SSF[65535]]=0,b.ssf=a.SSF),b.rels={},b.wbrels={},b.Strings=[],b.Strings.Count=0,b.Strings.Unique=0,Lp?b.revStrings=new Map:(b.revStrings={},b.revStrings.foo=[],delete b.revStrings.foo);var c="xlsb"==b.bookType?"bin":"xml",d=fp.indexOf(b.bookType)>-1,e=hb();Fq(b=b||{});var f=new dm,g="",h=0;if(b.cellXfs=[],Lh(b.cellXfs,{},{revssf:{General:0}}),a.Props||(a.Props={}),g="docProps/core.xml",f.file(g,vb(a.Props,b)),e.coreprops.push(g),nb(b.rels,2,g,Un.CORE_PROPS),g="docProps/app.xml",a.Props&&a.Props.SheetNames);else if(a.Workbook&&a.Workbook.Sheets){for(var i=[],j=0;j0&&(g="docProps/custom.xml",f.file(g,Ab(a.Custprops,b)),e.custprops.push(g),nb(b.rels,4,g,Un.CUST_PROPS)),h=1;h<=a.SheetNames.length;++h){var k={"!id":{}},l=a.Sheets[a.SheetNames[h-1]];switch((l||{})["!type"]||"sheet"){case"chart":default:g="xl/worksheets/sheet"+h+"."+c,f.file(g,Jj(h-1,g,b,a,k)),e.sheets.push(g),nb(b.wbrels,-1,"worksheets/sheet"+h+"."+c,Un.WS[0])}if(l){var m=l["!comments"],n=!1;if(m&&m.length>0){var o="xl/comments"+h+"."+c;f.file(o,Mj(m,o,b)),e.comments.push(o),nb(k,-1,"../comments"+h+"."+c,Un.CMNT),n=!0}l["!legacy"]&&n&&f.file("xl/drawings/vmlDrawing"+h+".vml",Uf(h,l["!comments"])),delete l["!comments"],delete l["!legacy"]}k["!id"].rId1&&f.file(kb(g),mb(k))}return null!=b.Strings&&b.Strings.length>0&&(g="xl/sharedStrings."+c,f.file(g,Lj(b.Strings,g,b)),e.strs.push(g),nb(b.wbrels,-1,"sharedStrings."+c,Un.SST)),g="xl/workbook."+c,f.file(g,Ij(a,g,b)),e.workbooks.push(g),nb(b.rels,1,g,Un.WB),g="xl/theme/theme1.xml",f.file(g,Ff(a.Themes,b)),e.themes.push(g),nb(b.wbrels,-1,"theme/theme1.xml",Un.THEME),g="xl/styles."+c,f.file(g,Kj(a,g,b)),e.styles.push(g),nb(b.wbrels,-1,"styles."+c,Un.STY),a.vbaraw&&d&&(g="xl/vbaProject.bin",f.file(g,a.vbaraw),e.vba.push(g),nb(b.wbrels,-1,"vbaProject.bin",Un.VBA)),f.file("[Content_Types].xml",jb(e,b)),f.file("_rels/.rels",mb(b.rels)),f.file("xl/_rels/workbook."+c+".rels",mb(b.wbrels)),delete b.revssf,delete b.ssf,f}function $k(a,b){var c="";switch((b||{}).type||"base64"){case"buffer":return[a[0],a[1],a[2],a[3]];case"base64":c=Ll.decode(a.slice(0,24));break;case"binary":c=a;break;case"array":return[a[0],a[1],a[2],a[3]];default:throw new Error("Unrecognized type "+(b&&b.type||"undefined"))}return[c.charCodeAt(0),c.charCodeAt(1),c.charCodeAt(2),c.charCodeAt(3)]}function _k(a,b){return $l.find(a,"EncryptedPackage")?Yk(a,b):qk(a,b)}function al(a,b){var c,d=a,e=b||{};switch(e.type||(e.type=Ml&&Buffer.isBuffer(a)?"buffer":"base64"),e.type){case"base64":c=new dm(d,{base64:!0});break;case"binary":case"array":c=new dm(d,{base64:!1});break;case"buffer":c=new dm(d);break;default:throw new Error("Unrecognized type "+e.type)}return Xk(c,e)}function bl(a,b){var c=0;a:for(;c=2&&0===e[3])return wo.to_workbook(d,g);break;case 3:case 131:case 139:case 140:return ro.to_workbook(d,g);case 123:if(92===e[1]&&114===e[2]&&116===e[3])return Jo.to_workbook(d,g);break;case 10:case 13:case 32:return cl(d,g)}return e[2]<=12&&e[3]<=31?ro.to_workbook(d,g):fl(a,d,g,f)}function hl(a,b){var c=b||{};return c.type="file",gl(a,c)}function il(a,b){switch(b.type){case"base64":case"binary":break;case"buffer":case"array":b.type="";break;case"file":return p(b.file,$l.write(a,{type:Ml?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+b.bookType+"' files");default:throw new Error("Unrecognized type "+b.type)}return $l.write(a,b)}function jl(a,b){var c=b||{};style_builder=new Jq(b);var d=Zk(a,c),e={};if(c.compression&&(e.compression="DEFLATE"),c.password)e.type=Ml?"nodebuffer":"string";else switch(c.type){case"base64":e.type="base64";break;case"binary":e.type="string";break;case"string":throw new Error("'string' output type invalid for '"+c.bookType+"' files");case"buffer":case"file":e.type=Ml?"nodebuffer":"string";break;default:throw new Error("Unrecognized type "+c.type)}var f=d.generate(e);return c.password&&"undefined"!=typeof encrypt_agile?il(encrypt_agile(f,c.password),c):"file"===c.type?p(c.file,f):"string"==c.type?tm(f):f}function kl(a,b){var c=b||{};return il(rk(a,c),c)}function ll(a,b,c){c||(c="");var d=c+a;switch(b.type){case"base64":return Ll.encode(um(d));case"binary":return um(d);case"string":return a;case"file":return p(b.file,d,"utf8");case"buffer":return Ml?Nl(d,"utf8"):ll(d,{type:"binary"}).split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+b.type)}function ml(a,b){switch(b.type){case"base64":return Ll.encode(a);case"binary":case"string":return a;case"file":return p(b.file,a,"binary");case"buffer":return Ml?Nl(a,"binary"):a.split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+b.type)}function nl(a,b){switch(b.type){case"string":case"base64":case"binary":for(var c="",d=0;d0&&(e=0);var l=ra(i.s.r),m=[],n=[],o=0,p=0,q=Array.isArray(a),r=i.s.r,s=0,t=0;for(q&&!a[r]&&(a[r]=[]),s=i.s.c;s<=i.e.c;++s)switch(m[s]=va(s),c=q?a[r][s]:a[m[s]+l],d){case 1:f[s]=s-i.s.c;break;case 2:f[s]=m[s];break;case 3:f[s]=j.header[s-i.s.c];break;default:for(null==c&&(c={w:"__EMPTY",t:"s"}),h=g=Fa(c,null,j),p=0,t=0;t=0&&(k='"'+k.replace(Gq,'""')+'"'));j.push(k)}return!1===h.blankrows&&i?null:j.join(g)}function vl(a,b){var c=[],d=null==b?{}:b;if(null==a||null==a["!ref"])return"";var e=Da(a["!ref"]),f=void 0!==d.FS?d.FS:",",g=f.charCodeAt(0),h=void 0!==d.RS?d.RS:"\n",i=h.charCodeAt(0),j=new RegExp(("|"==f?"\\|":f)+"+$"),k="",l=[];d.dense=Array.isArray(a);for(var m=d.skipHidden&&a["!cols"]||[],n=d.skipHidden&&a["!rows"]||[],o=e.s.c;o<=e.e.c;++o)(m[o]||{}).hidden||(l[o]=va(o));for(var p=e.s.r;p<=e.e.r;++p)(n[p]||{}).hidden||null!=(k=ul(a,e,p,l,g,i,f,d))&&(d.strip&&(k=k.replace(j,"")),c.push(k+h));return delete d.dense,c.join("")}function wl(a,b){b||(b={}),b.FS="\t",b.RS="\n";var c=vl(a,b);if("undefined"==typeof cptable||"string"==b.type)return c;var d=cptable.utils.encode(1200,c,"str");return String.fromCharCode(255)+String.fromCharCode(254)+d}function xl(a){var b,c="",d="";if(null==a||null==a["!ref"])return[];var e,f=Da(a["!ref"]),g="",h=[],i=[],j=Array.isArray(a);for(e=f.s.c;e<=f.e.c;++e)h[e]=va(e);for(var k=f.s.r;k<=f.e.r;++k)for(g=ra(k),e=f.s.c;e<=f.e.c;++e)if(c=h[e]+g,b=j?(a[k]||[])[e]:a[c],d="",void 0!==b){if(null!=b.F){if(c=b.F,!b.f)continue;d=b.f,-1==c.indexOf(":")&&(c=c+":"+c)}if(null!=b.f)d=b.f;else{if("z"==b.t)continue;if("n"==b.t&&null!=b.v)d=""+b.v;else if("b"==b.t)d=b.v?"TRUE":"FALSE";else if(void 0!==b.w)d="'"+b.w;else{if(void 0===b.v)continue;d="s"==b.t?"'"+b.v:""+b.v}}i[i.length]=c+"="+d}return i}function yl(a,b,c){var d=c||{},e=+!d.skipHeader,f=a||{},g=0,h=0;if(f&&null!=d.origin)if("number"==typeof d.origin)g=d.origin;else{var i="string"==typeof d.origin?za(d.origin):d.origin;g=i.r,h=i.c}var j,k={s:{c:0,r:0},e:{c:h,r:g+b.length-1+e}};if(f["!ref"]){var l=Da(f["!ref"]);k.e.c=Math.max(k.e.c,l.e.c),k.e.r=Math.max(k.e.r,l.e.r),-1==g&&(g=k.e.r+1,k.e.r=g+b.length-1+e)}var m=d.header||[],n=0;b.forEach(function(a,b){r(a).forEach(function(c){-1==(n=m.indexOf(c))&&(m[n=m.length]=c);var i=a[c],k="z",l="";!i||"object"!=typeof i||i instanceof Date?("number"==typeof i?k="n":"boolean"==typeof i?k="b":"string"==typeof i?k="s":i instanceof Date&&(k="d",d.cellDates||(k="n",i=w(i)),l=d.dateNF||Tl._table[14]),f[Aa({c:h+n,r:g+b+e})]=j={t:k,v:i},l&&(j.z=l)):f[Aa({c:h+n,r:g+b+e})]=i})}),k.e.c=Math.max(k.e.c,h+m.length-1);var o=ra(g);if(e)for(n=0;n>8])[0]});var Jl=null,Kl=!0,Ll=function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return{encode:function(b){for(var c="",d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;k>2,e=b.charCodeAt(k++),h=(3&d)<<4|e>>4,f=b.charCodeAt(k++),i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),c+=a.charAt(g)+a.charAt(h)+a.charAt(i)+a.charAt(j);return c},decode:function(b){var c="",d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=b.replace(/[^\w\+\/\=]/g,"");for(var k=0;k>4,c+=String.fromCharCode(d),i=a.indexOf(b.charAt(k++)),e=(15&h)<<4|i>>2,64!==i&&(c+=String.fromCharCode(e)),j=a.indexOf(b.charAt(k++)),f=(3&i)<<6|j,64!==j&&(c+=String.fromCharCode(f));return c}}}(),Ml="undefined"!=typeof Buffer&&"undefined"!=typeof process&&void 0!==process.versions&&!!process.versions.node,Nl=function(){};if("undefined"!=typeof Buffer){var Ol=!Buffer.from;if(!Ol)try{Buffer.from("foo","utf8")}catch(a){Ol=!0}Nl=Ol?function(a,b){return b?new Buffer(a,b):new Buffer(a)}:Buffer.from.bind(Buffer),Buffer.alloc||(Buffer.alloc=function(a){return new Buffer(a)}),Buffer.allocUnsafe||(Buffer.allocUnsafe=function(a){return new Buffer(a)})}var Pl=function(a){return Ml?Nl(a,"binary"):a.split("").map(function(a){return 255&a.charCodeAt(0)})},Ql=function(a){return[].concat.apply([],a)},Rl=/\u0000/g,Sl=/[\u0001-\u0006]/g,Tl={},Ul=function(a){function b(a){for(var b="",c=a.length-1;c>=0;)b+=a.charAt(c--);return b}function c(a,b){for(var c="";c.length=b?d:c("0",b-d.length)+d}function e(a,b){var d=""+a;return d.length>=b?d:c(" ",b-d.length)+d}function f(a,b){var d=""+a;return d.length>=b?d:d+c(" ",b-d.length)}function g(a,b){var d=""+Math.round(a);return d.length>=b?d:c("0",b-d.length)+d}function h(a,b){var d=""+a;return d.length>=b?d:c("0",b-d.length)+d}function i(a,b){return a>A||a<-A?g(a,b):h(Math.round(a),b)}function j(a,b){return b=b||0,a.length>=7+b&&103==(32|a.charCodeAt(b))&&101==(32|a.charCodeAt(b+1))&&110==(32|a.charCodeAt(b+2))&&101==(32|a.charCodeAt(b+3))&&114==(32|a.charCodeAt(b+4))&&97==(32|a.charCodeAt(b+5))&&108==(32|a.charCodeAt(b+6))}function k(a){a[0]="General",a[1]="0",a[2]="0.00",a[3]="#,##0",a[4]="#,##0.00",a[9]="0%",a[10]="0.00%",a[11]="0.00E+00",a[12]="# ?/?",a[13]="# ??/??",a[14]="m/d/yy",a[15]="d-mmm-yy",a[16]="d-mmm",a[17]="mmm-yy",a[18]="h:mm AM/PM",a[19]="h:mm:ss AM/PM",a[20]="h:mm",a[21]="h:mm:ss",a[22]="m/d/yy h:mm",a[37]="#,##0 ;(#,##0)",a[38]="#,##0 ;[Red](#,##0)",a[39]="#,##0.00;(#,##0.00)",a[40]="#,##0.00;[Red](#,##0.00)",a[45]="mm:ss",a[46]="[h]:mm:ss",a[47]="mmss.0",a[48]="##0.0E+0",a[49]="@",a[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',a[65535]="General"}function l(a,b,c){for(var d=a<0?-1:1,e=a*d,f=0,g=1,h=0,i=1,j=0,k=0,l=Math.floor(e);jb&&(j>b?(k=i,h=f):(k=j,h=g)),!c)return[0,d*h,k];var m=Math.floor(d*h/k);return[m,d*h-m*k,k]}function m(a,b,c){if(a>2958465||a<0)return null;var d=0|a,e=Math.floor(86400*(a-d)),f=0,g=[],h={D:d,T:e,u:86400*(a-d)-e,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(h.u)<1e-6&&(h.u=0),b&&b.date1904&&(d+=1462),h.u>.9999&&(h.u=0,86400==++e&&(h.T=e=0,++d,++h.D)),60===d)g=c?[1317,10,29]:[1900,2,29],f=3;else if(0===d)g=c?[1317,8,29]:[1900,1,0],f=6;else{d>60&&--d;var i=new Date(1900,0,1);i.setDate(i.getDate()+d-1),g=[i.getFullYear(),i.getMonth()+1,i.getDate()],f=i.getDay(),d<60&&(f=(f+6)%7),c&&(f=q(i,g))}return h.y=g[0],h.m=g[1],h.d=g[2],h.S=e%60,e=Math.floor(e/60),h.M=e%60,e=Math.floor(e/60),h.H=e,h.q=f,h}function n(a,b){var c=a.getTime();return b?c-=1262304e5:a>=G&&(c+=864e5),(c-(F+6e4*(a.getTimezoneOffset()-E.getTimezoneOffset())))/864e5}function o(a){return a.toString(10)}function p(a,b){switch(typeof a){case"string":return a;case"boolean":return a?"TRUE":"FALSE";case"number":return(0|a)===a?o(a):H(a);case"undefined":return"";case"object":if(null==a)return"";if(a instanceof Date)return y(14,n(a,b&&b.date1904),b)}throw new Error("unsupported value in General format: "+a)}function q(){return 0}function r(a,b,c,e){var f,g="",h=0,i=0,j=c.y,k=0;switch(a){case 98:j=c.y+543;case 121:switch(b.length){case 1:case 2:f=j%100,k=2;break;default:f=j%1e4,k=4}break;case 109:switch(b.length){case 1:case 2:f=c.m,k=b.length;break;case 3:return C[c.m-1][1];case 5:return C[c.m-1][0];default:return C[c.m-1][2]}break;case 100:switch(b.length){case 1:case 2:f=c.d,k=b.length;break;case 3:return B[c.q][0];default:return B[c.q][1]}break;case 104:switch(b.length){case 1:case 2:f=1+(c.H+11)%12,k=b.length;break;default:throw"bad hour format: "+b}break;case 72:switch(b.length){case 1:case 2:f=c.H,k=b.length;break;default:throw"bad hour format: "+b}break;case 77:switch(b.length){case 1:case 2:f=c.M,k=b.length;break;default:throw"bad minute format: "+b}break;case 115:if("s"!=b&&"ss"!=b&&".0"!=b&&".00"!=b&&".000"!=b)throw"bad second format: "+b;return 0!==c.u||"s"!=b&&"ss"!=b?(i=e>=2?3===e?1e3:100:1===e?10:1,h=Math.round(i*(c.S+c.u)),h>=60*i&&(h=0),"s"===b?0===h?"0":""+h/i:(g=d(h,2+e),"ss"===b?g.substr(0,2):"."+g.substr(2,b.length-1))):d(c.S,b.length);case 90:switch(b){case"[h]":case"[hh]":f=24*c.D+c.H;break;case"[m]":case"[mm]":f=60*(24*c.D+c.H)+c.M;break;case"[s]":case"[ss]":f=60*(60*(24*c.D+c.H)+c.M)+Math.round(c.S+c.u);break;default:throw"bad abstime format: "+b}k=3===b.length?1:2;break;case 101:f=j,k=1}return k>0?d(f,k):""}function s(a){var b=3;if(a.length<=b)return a;for(var c=a.length%b,d=a.substr(0,c);c!=a.length;c+=b)d+=(d.length>0?",":"")+a.substr(c,b);return d}function t(a){for(var b=[],c=!1,d=0,e=0;d-1||"\\"==c&&"-"==a.charAt(b+1)&&"0#".indexOf(a.charAt(b+2))>-1););break;case"?":for(;a.charAt(++b)===c;);break;case"*":++b," "!=a.charAt(b)&&"*"!=a.charAt(b)||++b;break;case"(":case")":++b;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;b-1;);break;case" ":default:++b}return!1}function v(a,b,c,d){for(var e,f,g,h=[],i="",k=0,l="",n="t",o="H";k=12?"P":"A"),t.t="T",o="h",k+=3):"AM/PM"===a.substr(k,5).toUpperCase()?(null!=e&&(t.v=e.H>=12?"PM":"AM"),t.t="T",k+=5,o="h"):(t.t="t",++k),null==e&&"T"===t.t)return"";h[h.length]=t,n=l;break;case"[":for(i=l;"]"!==a.charAt(k++)&&k-1&&(i=(i.match(/\$([^-\[\]]*)/)||[])[1]||"$",u(a)||(h[h.length]={t:"t",v:i}));break;case".":if(null!=e){for(i=l;++k-1||"\\"==l&&"-"==a.charAt(k+1)&&k-1;)i+=l;h[h.length]={t:"n",v:i};break;case"?":for(i=l;a.charAt(++k)===l;)i+=l;h[h.length]={t:l,v:i},n=l;break;case"*":++k," "!=a.charAt(k)&&"*"!=a.charAt(k)||++k;break;case"(":case")":h[h.length]={t:1===d?"t":l,v:l},++k;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(i=l;k-1;)i+=a.charAt(k);h[h.length]={t:"D",v:i};break;case" ":h[h.length]={t:l,v:l},++k;break;default:if(-1===",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(l))throw new Error("unrecognized character "+l+" in "+a);h[h.length]={t:"t",v:l},++k}var v,w=0,x=0;for(k=h.length-1,n="t";k>=0;--k)switch(h[k].t){case"h":case"H":h[k].t=o,n="h",w<1&&(w=1);break;case"s":(v=h[k].v.match(/\.0+$/))&&(x=Math.max(x,v[0].length-1)),w<3&&(w=3);case"d":case"y":case"M":case"e":n=h[k].t;break;case"m":"s"===n&&(h[k].t="M",w<2&&(w=2));break;case"X":break;case"Z":w<1&&h[k].v.match(/[Hh]/)&&(w=1),w<2&&h[k].v.match(/[Mm]/)&&(w=2),w<3&&h[k].v.match(/[Ss]/)&&(w=3)}switch(w){case 0:break;case 1:e.u>=.5&&(e.u=0,++e.S),e.S>=60&&(e.S=0,++e.M),e.M>=60&&(e.M=0,++e.H);break;case 2:e.u>=.5&&(e.u=0,++e.S),e.S>=60&&(e.S=0,++e.M)}var y,z="";for(k=0;k0){40==z.charCodeAt(0)?(A=b<0&&45===z.charCodeAt(0)?-b:b,B=I("(",z,A)):(A=b<0&&d>1?-b:b,B=I("n",z,A),A<0&&h[0]&&"t"==h[0].t&&(B=B.substr(1),h[0].v="-"+h[0].v)),y=B.length-1;var D=h.length;for(k=0;k-1){D=k;break}var E=h.length;if(D===h.length&&-1===B.indexOf("E")){for(k=h.length-1;k>=0;--k)null!=h[k]&&-1!=="n?(".indexOf(h[k].t)&&(y>=h[k].v.length-1?(y-=h[k].v.length,h[k].v=B.substr(y+1,h[k].v.length)):y<0?h[k].v="":(h[k].v=B.substr(0,y+1),y=-1),h[k].t="t",E=k);y>=0&&E=0;--k)if(null!=h[k]&&-1!=="n?(".indexOf(h[k].t)){for(f=h[k].v.indexOf(".")>-1&&k===D?h[k].v.indexOf(".")-1:h[k].v.length-1,C=h[k].v.substr(f+1);f>=0;--f)y>=0&&("0"===h[k].v.charAt(f)||"#"===h[k].v.charAt(f))&&(C=B.charAt(y--)+C);h[k].v=C,h[k].t="t",E=k}for(y>=0&&E-1&&k===D?h[k].v.indexOf(".")+1:0,C=h[k].v.substr(0,f);f-1&&(A=d>1&&b<0&&k>0&&"-"===h[k-1].v?-b:b,h[k].v=I(h[k].t,h[k].v,A),h[k].t="t");var F="";for(k=0;k!==h.length;++k)null!=h[k]&&(F+=h[k].v);return F}function w(a,b){if(null==b)return!1;var c=parseFloat(b[2]);switch(b[1]){case"=":if(a==c)return!0;break;case">":if(a>c)return!0;break;case"<":if(a":if(a!=c)return!0;break;case">=":if(a>=c)return!0;break;case"<=":if(a<=c)return!0}return!1}function x(a,b){var c=t(a),d=c.length,e=c[d-1].indexOf("@");if(d<4&&e>-1&&--d,c.length>4)throw new Error("cannot find right format for |"+c.join("|")+"|");if("number"!=typeof b)return[4,4===c.length||e>-1?c[c.length-1]:"@"];switch(c.length){case 1:c=e>-1?["General","General","General",c[0]]:[c[0],c[0],c[0],"@"];break;case 2:c=e>-1?[c[0],c[0],c[0],c[1]]:[c[0],c[1],c[0],"@"];break;case 3:c=e>-1?[c[0],c[1],c[0],c[2]]:[c[0],c[1],c[2],"@"]}var f=b>0?c[0]:b<0?c[1]:c[2];if(-1===c[0].indexOf("[")&&-1===c[1].indexOf("["))return[d,f];if(null!=c[0].match(K)||null!=c[1].match(K)){var g=c[0].match(L),h=c[1].match(L);return w(b,g)?[d,c[0]]:w(b,h)?[d,c[1]]:[d,c[null!=g&&null!=h?2:1]]}return[d,f]}function y(a,b,c){null==c&&(c={});var d="";switch(typeof a){case"string":d="m/d/yy"==a&&c.dateNF?c.dateNF:a;break;case"number":d=14==a&&c.dateNF?c.dateNF:(null!=c.table?c.table:D)[a]}if(j(d,0))return p(b,c);b instanceof Date&&(b=n(b,c.date1904));var e=x(d,b);if(j(e[1]))return p(b,c);if(!0===b)b="TRUE";else if(!1===b)b="FALSE";else if(""===b||null==b)return"";return v(e[1],b,c,e[0])}function z(a,b){if("number"!=typeof b){b=+b||-1;for(var c=0;c<392;++c)if(void 0!=D[c]){if(D[c]==a){b=c;break}}else b<0&&(b=c);b<0&&(b=391)}return D[b]=a,b}a.version="0.10.2";var A=Math.pow(2,32),B=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],C=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]],D={};k(D),a.parse_date_code=m;var E=new Date(1899,11,31,0,0,0),F=E.getTime(),G=new Date(1900,2,1,0,0,0);a._general_int=o;var H=function(){function a(a){var b=a<0?12:11,c=d(a.toFixed(12));return c.length<=b?c:(c=a.toPrecision(10),c.length<=b?c:a.toExponential(5))}function b(a){var b=a.toFixed(11).replace(e,".$1");return b.length>(a<0?12:11)&&(b=a.toPrecision(6)),b}function c(a){for(var b=0;b!=a.length;++b)if(101==(32|a.charCodeAt(b)))return a.replace(g,".$1").replace(h,"E").replace("e","E").replace(i,"$10$2");return a}function d(a){return a.indexOf(".")>-1?a.replace(f,"").replace(e,".$1"):a}var e=/\.(\d*[1-9])0+$/,f=/\.0*$/,g=/\.(\d*[1-9])0+/,h=/\.0*[Ee]/,i=/(E[+-])(\d)$/;return function(e){var f,g=Math.floor(Math.log(Math.abs(e))*Math.LOG10E);return f=g>=-4&&g<=-1?e.toPrecision(10+g):Math.abs(g)<=9?a(e):10===g?e.toFixed(10).substr(0,12):b(e),d(c(f))}}();a._general_num=H,a._general=p;var I=function(){function a(a,b,d){var e=b.replace(x,""),f=b.length-e.length;return I(a,e,d*Math.pow(10,2*f))+c("%",f)}function g(a,b,c){for(var d=b.length-1;44===b.charCodeAt(d-1);)--d;return I(a,b.substr(0,d),c/Math.pow(10,3*(b.length-d)))}function h(a,b){var c,d=a.indexOf("E")-a.indexOf(".")-1;if(a.match(/^#+0.0E\+0$/)){if(0==b)return"0.0E+0";if(b<0)return"-"+h(a,-b);var e=a.indexOf(".");-1===e&&(e=a.indexOf("E"));var f=Math.floor(Math.log(b)*Math.LOG10E)%e;if(f<0&&(f+=e),c=(b/Math.pow(10,f)).toPrecision(d+1+(e+f)%e),-1===c.indexOf("e")){var g=Math.floor(Math.log(b)*Math.LOG10E);for(-1===c.indexOf(".")?c=c.charAt(0)+"."+c.substr(1)+"E+"+(g-c.length+f):c+="E+"+(g-f);"0."===c.substr(0,2);)c=c.charAt(0)+c.substr(2,e)+"."+c.substr(2+e),c=c.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");c=c.replace(/\+-/,"-")}c=c.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(a,b,c,d){return b+c+d.substr(0,(e+f)%e)+"."+d.substr(f)+"E"})}else c=b.toExponential(d);return a.match(/E\+00$/)&&c.match(/e[+-]\d$/)&&(c=c.substr(0,c.length-1)+"0"+c.charAt(c.length-1)),a.match(/E\-/)&&c.match(/e\+/)&&(c=c.replace(/e\+/,"e")),c.replace("e","E")}function j(a,b,f){var g=parseInt(a[4],10),h=Math.round(b*g),i=Math.floor(h/g),j=h-i*g,k=g;return f+(0===i?"":""+i)+" "+(0===j?c(" ",a[1].length+1+a[4].length):e(j,a[1].length)+a[2]+"/"+a[3]+d(k,a[4].length))}function k(a,b,d){return d+(0===b?"":""+b)+c(" ",a[1].length+2+a[4].length)}function m(a){for(var b,c="",d=0;d!=a.length;++d)switch(b=a.charCodeAt(d)){case 35:break;case 63:c+=" ";break;case 48:c+="0";break;default:c+=String.fromCharCode(b)}return c}function n(a,b){var c=Math.pow(10,b);return""+Math.round(a*c)/c}function o(a,b){return b<(""+Math.round((a-Math.floor(a))*Math.pow(10,b))).length?0:Math.round((a-Math.floor(a))*Math.pow(10,b))}function p(a,b){return b<(""+Math.round((a-Math.floor(a))*Math.pow(10,b))).length?1:0}function q(a){return a<2147483647&&a>-2147483648?""+(a>=0?0|a:a-1|0):""+Math.floor(a)}function r(k,t,u){if(40===k.charCodeAt(0)&&!t.match(A)){var v=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return u>=0?r("n",v,u):"("+r("n",v,-u)+")"}if(44===t.charCodeAt(t.length-1))return g(k,t,u);if(-1!==t.indexOf("%"))return a(k,t,u);if(-1!==t.indexOf("E"))return h(t,u);if(36===t.charCodeAt(0))return"$"+r(k,t.substr(" "==t.charAt(1)?2:1),u);var w,x,C,D,E=Math.abs(u),F=u<0?"-":"";if(t.match(/^00+$/))return F+i(E,t.length);if(t.match(/^[#?]+$/))return w=i(u,0),"0"===w&&(w=""),w.length>t.length?w:m(t.substr(0,t.length-w.length))+w;if(x=t.match(y))return j(x,E,F);if(t.match(/^#+0+$/))return F+i(E,t.length-t.indexOf("0"));if(x=t.match(z))return w=n(u,x[1].length).replace(/^([^\.]+)$/,"$1."+m(x[1])).replace(/\.$/,"."+m(x[1])).replace(/\.(\d*)$/,function(a,b){return"."+b+c("0",m(x[1]).length-b.length)}),-1!==t.indexOf("0.")?w:w.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),x=t.match(/^(0*)\.(#*)$/))return F+n(E,x[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,x[1].length?"0.":".");if(x=t.match(/^#{1,3},##0(\.?)$/))return F+s(i(E,0));if(x=t.match(/^#,##0\.([#0]*0)$/))return u<0?"-"+r(k,t,-u):s(""+(Math.floor(u)+p(u,x[1].length)))+"."+d(o(u,x[1].length),x[1].length);if(x=t.match(/^#,#*,#0/))return r(k,t.replace(/^#,#*,/,""),u);if(x=t.match(/^([0#]+)(\\?-([0#]+))+$/))return w=b(r(k,t.replace(/[\\-]/g,""),u)),C=0,b(b(t.replace(/\\/g,"")).replace(/[0#]/g,function(a){return C=0?w("n",i,h):"("+w("n",i,-h)+")"}if(44===g.charCodeAt(g.length-1))return t(a,g,h);if(-1!==g.indexOf("%"))return u(a,g,h);if(-1!==g.indexOf("E"))return v(g,h);if(36===g.charCodeAt(0))return"$"+w(a,g.substr(" "==g.charAt(1)?2:1),h);var j,n,o,p,q=Math.abs(h),r=h<0?"-":"";if(g.match(/^00+$/))return r+d(q,g.length);if(g.match(/^[#?]+$/))return j=""+h,0===h&&(j=""),j.length>g.length?j:m(g.substr(0,g.length-j.length))+j;if(n=g.match(y))return k(n,q,r);if(g.match(/^#+0+$/))return r+d(q,g.length-g.indexOf("0"));if(n=g.match(z))return j=(""+h).replace(/^([^\.]+)$/,"$1."+m(n[1])).replace(/\.$/,"."+m(n[1])),j=j.replace(/\.(\d*)$/,function(a,b){return"."+b+c("0",m(n[1]).length-b.length)}),-1!==g.indexOf("0.")?j:j.replace(/^0\./,".");if(g=g.replace(/^#+([0.])/,"$1"),n=g.match(/^(0*)\.(#*)$/))return r+(""+q).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,n[1].length?"0.":".");if(n=g.match(/^#{1,3},##0(\.?)$/))return r+s(""+q);if(n=g.match(/^#,##0\.([#0]*0)$/))return h<0?"-"+w(a,g,-h):s(""+h)+"."+c("0",n[1].length);if(n=g.match(/^#,#*,#0/))return w(a,g.replace(/^#,#*,/,""),h);if(n=g.match(/^([0#]+)(\\?-([0#]+))+$/))return j=b(w(a,g.replace(/[\\-]/g,""),h)),o=0,b(b(g.replace(/\\/g,"")).replace(/[0#]/g,function(a){return o]/,L=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;a.load=z,a._table=D,a.get_table=function(){return D},a.load_table=function(a){for(var b=0;392!=b;++b)void 0!==a[b]&&z(a[b],b)},a.init_table=k,a.format=y};Ul(Tl);var Vl,Wl={"General Number":"General","General Date":Tl._table[22],"Long Date":"dddd, mmmm dd, yyyy","Medium Date":Tl._table[15],"Short Date":Tl._table[14],"Long Time":Tl._table[19],"Medium Time":Tl._table[18],"Short Time":Tl._table[20],Currency:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',Fixed:Tl._table[2],Standard:Tl._table[4],Percent:Tl._table[10],Scientific:Tl._table[11],"Yes/No":'"Yes";"Yes";"No";@',"True/False":'"True";"True";"False";@',"On/Off":'"Yes";"Yes";"No";@'},Xl={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},Yl=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g,Zl=!0;!function(a){a(Vl={})}(function(a){function b(){for(var a=0,b=new Array(256),c=0;256!=c;++c)a=c,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,a=1&a?-306674912^a>>>1:a>>>1,b[c]=a;return"undefined"!=typeof Int32Array?new Int32Array(b):b}function c(a,b){for(var c=-1^b,d=a.length-1,e=0;e>>8^g[255&(c^a.charCodeAt(e++))],c=c>>>8^g[255&(c^a.charCodeAt(e++))];return e===d&&(c=c>>>8^g[255&(c^a.charCodeAt(e))]),-1^c}function d(a,b){if(a.length>1e4)return e(a,b);for(var c=-1^b,d=a.length-3,f=0;f>>8^g[255&(c^a[f++])],c=c>>>8^g[255&(c^a[f++])],c=c>>>8^g[255&(c^a[f++])],c=c>>>8^g[255&(c^a[f++])];for(;f>>8^g[255&(c^a[f++])];return-1^c}function e(a,b){for(var c=-1^b,d=a.length-7,e=0;e>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])],c=c>>>8^g[255&(c^a[e++])];for(;e>>8^g[255&(c^a[e++])];return-1^c}function f(a,b){for(var c,d,e=-1^b,f=0,h=a.length;f>>8^g[255&(e^c)]:c<2048?(e=e>>>8^g[255&(e^(192|c>>6&31))],e=e>>>8^g[255&(e^(128|63&c))]):c>=55296&&c<57344?(c=64+(1023&c),d=1023&a.charCodeAt(f++),e=e>>>8^g[255&(e^(240|c>>8&7))],e=e>>>8^g[255&(e^(128|c>>2&63))],e=e>>>8^g[255&(e^(128|d>>6&15|(3&c)<<4))],e=e>>>8^g[255&(e^(128|63&d))]):(e=e>>>8^g[255&(e^(224|c>>12&15))],e=e>>>8^g[255&(e^(128|c>>6&63))],e=e>>>8^g[255&(e^(128|63&c))]);return-1^e}a.version="1.2.0";var g=b();a.table=g,a.bstr=c,a.buf=d,a.str=f});var $l=function(){function a(a,b){for(var c=a.split("/"),d=b.split("/"),e=0,f=0,g=Math.min(c.length,d.length);e>>1,a.write_shift(2,c);var d=b.getFullYear()-1980;d=d<<4|b.getMonth()+1,d=d<<5|b.getDate(),a.write_shift(2,d)}function e(a){var b=65535&a.read_shift(2),c=65535&a.read_shift(2),d=new Date,e=31&c;c>>>=5;var f=15&c;c>>>=4,d.setMilliseconds(0),d.setFullYear(c+1980),d.setMonth(f-1),d.setDate(e);var g=31&b;b>>>=5;var h=63&b;return b>>>=6,d.setHours(b),d.setMinutes(h),d.setSeconds(g<<1),d}function f(a){ga(a,0);for(var b={},c=0;a.l<=a.length-4;){var d=a.read_shift(2),e=a.read_shift(2),f=a.l+e,g={};switch(d){case 21589:c=a.read_shift(1),1&c&&(g.mtime=a.read_shift(4)),e>5&&(2&c&&(g.atime=a.read_shift(4)),4&c&&(g.ctime=a.read_shift(4))),g.mtime&&(g.mt=new Date(1e3*g.mtime))}a.l=f,b[d]=g}return b}function i(){return ea||(ea=require("fs"))}function j(a,b){if(80==a[0]&&75==a[1])return W(a,b);if(a.length<512)throw new Error("CFB file size "+a.length+" < 512");var c=3,d=512,e=0,f=0,g=0,h=0,i=0,j=[],o=a.slice(0,512);ga(o,0);var q=k(o);switch(c=q[0]){case 3:d=512;break;case 4:d=4096;break;case 0:if(0==q[1])return W(a,b);default:throw new Error("Major Version: Expected 3 or 4 saw "+c)}512!==d&&(o=a.slice(0,d),ga(o,28));var t=a.slice(0,d);l(o,c);var u=o.read_shift(4,"i");if(3===c&&0!==u)throw new Error("# Directory Sectors: Expected 0 saw "+u);o.l+=4,g=o.read_shift(4,"i"),o.l+=4,o.chk("00100000","Mini Stream Cutoff Size: "),h=o.read_shift(4,"i"),e=o.read_shift(4,"i"),i=o.read_shift(4,"i"),f=o.read_shift(4,"i");for(var v=-1,w=0;w<109&&!((v=o.read_shift(4,"i"))<0);++w)j[w]=v;var x=m(a,d);p(i,f,x,d,j);var y=r(x,g,j,d);y[g].name="!Directory",e>0&&h!==ka&&(y[h].name="!MiniFAT"),y[j[0]].name="!FAT",y.fat_addrs=j,y.ssz=d;var z={},A=[],B=[],C=[];s(g,y,x,A,e,z,B,h),n(B,C,A),A.shift();var D={FileIndex:B,FullPaths:C};return b&&b.raw&&(D.raw={header:t,sectors:x}),D}function k(a){if(80==a[a.l]&&75==a[a.l+1])return[0,0];a.chk(la,"Header Signature: "),a.chk(na,"CLSID: ");var b=a.read_shift(2,"u");return[a.read_shift(2,"u"),b]}function l(a,b){var c=9;switch(a.l+=2,c=a.read_shift(2)){case 9:if(3!=b)throw new Error("Sector Shift: Expected 9 saw "+c);break;case 12:if(4!=b)throw new Error("Sector Shift: Expected 12 saw "+c);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+c)}a.chk("0600","Mini Sector Shift: "),a.chk("000000000000","Reserved: ")}function m(a,b){for(var c=Math.ceil(a.length/b)-1,d=[],e=1;e0&&g>=0;)f.push(b.slice(g*ja,g*ja+ja)),e-=ja,g=dn(c,4*g);return 0===f.length?ia(0):Ql(f).slice(0,a.size)}function p(a,b,c,d,e){var f=ka;if(a===ka){if(0!==b)throw new Error("DIFAT chain shorter than expected")}else if(-1!==a){var g=c[a],h=(d>>>2)-1;if(!g)return;for(var i=0;i=0;){e[i]=!0,f[f.length]=i,g.push(a[i]);var k=c[Math.floor(4*i/d)];if(j=4*i&h,d<4+j)throw new Error("FAT boundary crossed: "+i+" 4 "+d);if(!a[k])break;i=dn(a[k],j)}return{nodes:f,data:Im([g])}}function r(a,b,c,d){var e=a.length,f=[],g=[],h=[],i=[],j=d-1,k=0,l=0,m=0,n=0;for(k=0;k=e&&(m-=e),!g[m]){for(i=[],l=m;l>=0;){g[l]=!0,h[h.length]=l,i.push(a[l]);var o=c[Math.floor(4*l/d)];if(n=4*l&j,d<4+n)throw new Error("FAT boundary crossed: "+l+" 4 "+d);if(!a[o])break;l=dn(a[o],n)}f[m]={nodes:h,data:Im([i])}}return f}function s(a,b,c,d,e,f,g,h){for(var i,j=0,k=d.length?2:0,l=b[a].data,m=0,n=0;m0&&j!==ka&&(b[j].name="!StreamData")):r.size>=4096?(r.storage="fat",void 0===b[r.start]&&(b[r.start]=q(c,r.start,b.fat_addrs,b.ssz)),b[r.start].name=r.name,r.content=b[r.start].data.slice(0,r.size)):(r.storage="minifat",r.size<0?r.size=0:j!==ka&&r.start!==ka&&b[j]&&(r.content=o(r,b[j].data,(b[h]||{}).data))),r.content&&ga(r.content,0),f[i]=r,g.push(r)}}function t(a,b){return new Date(1e3*(cn(a,b+4)/1e7*Math.pow(2,32)+cn(a,b)/1e7-11644473600))}function u(a,b){return i(),j(ea.readFileSync(a),b)}function v(a,b){switch(b&&b.type||"base64"){case"file":return u(a,b);case"base64":return j(Pl(Ll.decode(a)),b);case"binary":return j(Pl(a),b)}return j(a,b)}function w(a,b){var c=b||{},d=c.root||"Root Entry";if(a.FullPaths||(a.FullPaths=[]),a.FileIndex||(a.FileIndex=[]),a.FullPaths.length!==a.FileIndex.length)throw new Error("inconsistent CFB structure");0===a.FullPaths.length&&(a.FullPaths[0]=d+"/",a.FileIndex[0]={name:d,type:5}),c.CLSID&&(a.FileIndex[0].clsid=c.CLSID),x(a)}function x(a){var b="Sh33tJ5";if(!$l.find(a,"/"+b)){var c=ia(4);c[0]=55,c[1]=c[3]=50,c[2]=54,a.FileIndex.push({name:b,type:2,content:c,size:4,L:69,R:69,C:69}),a.FullPaths.push(a.FullPaths[0]+b),y(a)}}function y(d,e){w(d);for(var f=!1,g=!1,h=d.FullPaths.length-1;h>=0;--h){var i=d.FileIndex[h];switch(i.type){case 0:g?f=!0:(d.FileIndex.pop(),d.FullPaths.pop());break;case 1:case 2:case 5:g=!0,isNaN(i.R*i.L*i.C)&&(f=!0),i.R>-1&&i.L>-1&&i.R==i.L&&(f=!0);break;default:f=!0}}if(f||e){var j=new Date(1987,1,19),k=0,l=[];for(h=0;h1?1:-1,n.size=0,n.type=5;else if("/"==o.slice(-1)){for(k=h+1;k=l.length?-1:k,k=h+1;k=l.length?-1:k,n.type=1}else b(d.FullPaths[h+1]||"")==b(o)&&(n.R=h+1),n.type=2}}}function z(a,b){var c=b||{};if(y(a),"zip"==c.fileType)return Y(a,c);var d=function(a){for(var b=0,c=0,d=0;d0&&(f<4096?b+=f+63>>6:c+=f+511>>9)}}for(var g=a.FullPaths.length+3>>2,h=b+7>>3,i=b+127>>7,j=h+c+g+i,k=j+127>>7,l=k<=109?0:Math.ceil((k-109)/127);j+k+l+127>>7>k;)l=++k<=109?0:Math.ceil((k-109)/127);var m=[1,l,k,i,g,c,b,0];return a.FileIndex[0].size=b<<6,m[7]=(a.FileIndex[0].start=m[0]+m[1]+m[2]+m[3]+m[4]+m[5])+(m[6]+7>>3),m}(a),e=ia(d[7]<<9),f=0,g=0;for(f=0;f<8;++f)e.write_shift(1,ma[f]);for(f=0;f<8;++f)e.write_shift(2,0);for(e.write_shift(2,62),e.write_shift(2,3),e.write_shift(2,65534),e.write_shift(2,9),e.write_shift(2,6),f=0;f<3;++f)e.write_shift(2,0);for(e.write_shift(4,0),e.write_shift(4,d[2]),e.write_shift(4,d[0]+d[1]+d[2]+d[3]-1),e.write_shift(4,0),e.write_shift(4,4096),e.write_shift(4,d[3]?d[0]+d[1]+d[2]-1:ka),e.write_shift(4,d[3]),e.write_shift(-4,d[1]?d[0]-1:ka),e.write_shift(4,d[1]),f=0;f<109;++f)e.write_shift(-4,f>9)));for(h(d[6]+7>>3);511&e.l;)e.write_shift(-4,oa.ENDOFCHAIN);for(g=f=0,i=0;i=4096||(k.start=g,h(j+63>>6)));for(;511&e.l;)e.write_shift(-4,oa.ENDOFCHAIN);for(f=0;f=4096){for(e.l=k.start+1<<9,i=0;i0&&k.size<4096){for(i=0;i>16|b>>8|b)}function I(a,b){var c=ta[255&a];return b<=8?c>>>8-b:(c=c<<8|ta[a>>8&255],b<=16?c>>>16-b:(c=c<<8|ta[a>>16&255])>>>24-b)}function J(a,b){var c=7&b,d=b>>>3;return(a[d]|(c<=6?0:a[d+1]<<8))>>>c&3}function K(a,b){var c=7&b,d=b>>>3;return(a[d]|(c<=5?0:a[d+1]<<8))>>>c&7}function L(a,b){var c=7&b,d=b>>>3;return(a[d]|(c<=4?0:a[d+1]<<8))>>>c&15}function M(a,b){var c=7&b,d=b>>>3;return(a[d]|(c<=3?0:a[d+1]<<8))>>>c&31}function N(a,b){var c=7&b,d=b>>>3;return(a[d]|(c<=1?0:a[d+1]<<8))>>>c&127}function O(a,b,c){var d=7&b,e=b>>>3,f=(1<>>d;return c<8-d?g&f:(g|=a[e+1]<<8-d,c<16-d?g&f:(g|=a[e+2]<<16-d,c<24-d?g&f:(g|=a[e+3]<<24-d)&f))}function P(a,b){var c=a.length,d=2*c>b?2*c:b+5,e=0;if(c>=b)return a;if(Ml){var f=h(d);if(a.copy)a.copy(f);else for(;e>d-l,g=(1<=0;--g)b[h|g<>8-o;for(var p=(1<<7-o)-1;p>=0;--p)Ba[n|p<>>=3){case 16:for(f=3+J(a,b),b+=2,n=q[q.length-1];f-- >0;)q.push(n);break;case 17:for(f=3+K(a,b),b+=3;f-- >0;)q.push(0);break;case 18:for(f=11+N(a,b),b+=7;f-- >0;)q.push(0);break;default:q.push(n),i>>0,j=0,k=0;0==(1&d);)if(d=K(a,c),c+=3,d>>>1!=0)for(d>>>1==1?(j=9,k=5):(c=S(a,c),j=Ca,k=Da),!b&&i>>1==1?wa[l]:za[l];if(c+=15&m,0==((m>>>=4)>>>8&255))e[f++]=m;else{if(256==m)break;m-=257;var n=m<8?0:m-4>>2;n>5&&(n=0);var o=f+qa[m];n>0&&(o+=O(a,c,n),c+=n),l=O(a,c,k),m=d>>>1==1?xa[l]:Aa[l],c+=15&m,m>>>=4;var p=m<4?0:m-2>>1,q=ra[m];for(p>0&&(q+=O(a,c,p),c+=p),!b&&i>>3]|a[1+(c>>>3)]<<8;if(c+=32,!b&&i>>3,(c>>>3)+r),f+=r,c+=8*r;else for(;r-- >0;)e[f++]=a[c>>>3],c+=8}return[b?e:e.slice(0,f),c+7>>>3]}function U(a,b){var c=a.slice(a.l||0),d=T(c,b);return a.l+=d[1],d[0]}function V(a,b){if(!a)throw new Error(b);"undefined"!=typeof console&&console.error(b)}function W(a,b){var c=a;ga(c,0);var d=[],e=[],g={FileIndex:d,FullPaths:e};w(g,{root:b.root});for(var h=c.length-4;(80!=c[h]||75!=c[h+1]||5!=c[h+2]||6!=c[h+3])&&h>=0;)--h;c.l=h+4,c.l+=4;var i=c.read_shift(2);c.l+=6;var j=c.read_shift(4);for(c.l=j,h=0;h0;)b[b.l++]=a[c++]}return b.l}}();return function(b){var c=ia(50+Math.floor(1.1*b.length)),d=a(b,c);return c.slice(0,d)}}(),wa=sa?new Uint16Array(512):Q(512),xa=sa?new Uint16Array(32):Q(32);if(!sa){for(var ya=0;ya<512;++ya)wa[ya]=0;for(ya=0;ya<32;++ya)xa[ya]=0}!function(){for(var a=[],b=0;b<32;b++)a.push(5);R(a,xa,32);var c=[];for(b=0;b<=143;b++)c.push(8);for(;b<=255;b++)c.push(9);for(;b<=279;b++)c.push(7);for(;b<=287;b++)c.push(8);R(c,wa,288)}();var za=sa?new Uint16Array(32768):Q(32768),Aa=sa?new Uint16Array(32768):Q(32768),Ba=sa?new Uint16Array(128):Q(128),Ca=1,Da=1;return ca.find=A,ca.read=v,ca.parse=j,ca.write=D,ca.writeFile=B,ca.utils={cfb_new:Z,cfb_add:$,cfb_del:_,cfb_mov:aa,cfb_gc:ba,ReadShift:da,CheckField:fa,prep_blob:ga,bconcat:Ql,use_zlib:E,_deflateRaw:va,_inflateRaw:U,consts:oa},ca}();"undefined"!=typeof require&&"undefined"!=typeof module&&void 0===Zl&&(module.exports=$l);var _l;if("undefined"!=typeof require)try{_l=require("fs")}catch(a){}var am=new Date(1899,11,30,0,0,0),bm=am.getTime()+6e4*((new Date).getTimezoneOffset()-am.getTimezoneOffset()),cm=new Date("2017-02-19T19:06:09.000Z");isNaN(cm.getFullYear())&&(cm=new Date("2/19/17"));var dm,em=2017==cm.getFullYear(),fm=5=="abacaba".split(/(:?b)/i).length;"undefined"!=typeof JSZipSync&&(dm=JSZipSync),"undefined"!=typeof exports&&"undefined"!=typeof module&&module.exports&&void 0===dm&&(dm=void 0);var gm='\r\n',hm=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g,im=/<[\/\?]?[a-zA-Z0-9:]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s?[\/\?]?>/g;gm.match(im)||(im=/<[^>]*>/g);var jm=/<\w*:/,km=/<(\/?)\w+:/,lm={""":'"',"'":"'",">":">","<":"<","&":"&"},mm=t(lm),nm=function(){var a=/&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g,b=/_x([\da-fA-F]{4})_/g;return function c(d){var e=d+"",f=e.indexOf("-1?16:10))||a}).replace(b,function(a,b){return String.fromCharCode(parseInt(b,16))});var g=e.indexOf("]]>");return c(e.slice(0,f))+e.slice(f+9,g)+c(e.slice(g+3))}}(),om=/[&<>'"]/g,pm=/[\u0000-\u0008\u000b-\u001f]/g,qm=/[\u0000-\u001f]/g,rm=function(){function a(a,b){return String.fromCharCode(parseInt(b,10))}var b=/&#(\d+);/g;return function(c){return c.replace(b,a)}}(),sm=function(){return function(a){return a.replace(/(\r\n|[\r\n])/g," ")}}(),tm=function(a){for(var b="",c=0,d=0,e=0,f=0,g=0,h=0;c191&&d<224?(g=(31&d)<<6,g|=63&e,b+=String.fromCharCode(g)):(f=a.charCodeAt(c++),d<240?b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f):(g=a.charCodeAt(c++),h=((7&d)<<18|(63&e)<<12|(63&f)<<6|63&g)-65536,b+=String.fromCharCode(55296+(h>>>10&1023)),b+=String.fromCharCode(56320+(1023&h)))));return b},um=function(a){for(var b=[],c=0,d=0,e=0;c>6))),b.push(String.fromCharCode(128+(63&d)));break;case d>=55296&&d<57344:d-=55296,e=a.charCodeAt(c++)-56320+(d<<10),b.push(String.fromCharCode(240+(e>>18&7))),b.push(String.fromCharCode(144+(e>>12&63))),b.push(String.fromCharCode(128+(e>>6&63))),b.push(String.fromCharCode(128+(63&e)));break;default:b.push(String.fromCharCode(224+(d>>12))),b.push(String.fromCharCode(128+(d>>6&63))),b.push(String.fromCharCode(128+(63&d)))}return b.join("")};if(Ml){var vm=function(a){var b,c,d,e=Buffer.alloc(2*a.length),f=1,g=0,h=0;for(c=0;c>>10&1023),b=56320+(1023&b)),0!==h&&(e[g++]=255&h,e[g++]=h>>>8,h=0),e[g++]=b%256,e[g++]=b>>>8;return e.slice(0,g).toString("ucs2")},wm="foo bar baz☃🍣";tm(wm)==vm(wm)&&(tm=vm);var xm=function(a){return Nl(a,"binary").toString("utf8")};tm(wm)==xm(wm)&&(tm=xm),um=function(a){return Nl(a,"utf8").toString("binary")}}var ym=function(){var a={};return function(b,c){var d=b+"|"+(c||"");return a[d]?a[d]:a[d]=new RegExp("<(?:\\w+:)?"+b+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)",c||"")}}(),zm=function(){var a=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(a){return[new RegExp("&"+a[0]+";","g"),a[1]]});return function(b){for(var c=b.replace(/^[\t\n\r ]+/,"").replace(/[\t\n\r ]+$/,"").replace(/[\t\n\r ]+/g," ").replace(/<\s*[bB][rR]\s*\/?>/g,"\n").replace(/<[^>]*>/g,""),d=0;d([\\s\\S]*?)","g")}}(),Bm=/<\/?(?:vt:)?variant>/g,Cm=/<(?:vt:)([^>]*)>([\s\S]*)0?Om(a,b+4,b+4+c-1):""},Rm=Qm,Sm=function(a,b){var c=cn(a,b);return c>0?Om(a,b+4,b+4+c-1):""},Tm=Sm,Um=function(a,b){var c=2*cn(a,b);return c>0?Om(a,b+4,b+4+c-1):""},Vm=Um;Fm=Gm=function(a,b){var c=cn(a,b);return c>0?Km(a,b+4,b+4+c):""};var Wm,Xm,Ym=function(a,b){var c=cn(a,b);return c>0?Om(a,b+4,b+4+c):""},Zm=Ym;Wm=Xm=function(a,b){return ba(a,b)};var $m=function(a){return Array.isArray(a)};Ml&&(Km=function(a,b,c){return Buffer.isBuffer(a)?a.toString("utf16le",b,c).replace(Rl,""):Lm(a,b,c)},Mm=function(a,b,c){return Buffer.isBuffer(a)?a.toString("hex",b,b+c):Nm(a,b,c)},Qm=function(a,b){if(!Buffer.isBuffer(a))return Rm(a,b);var c=a.readUInt32LE(b);return c>0?a.toString("utf8",b+4,b+4+c-1):""},Sm=function(a,b){if(!Buffer.isBuffer(a))return Tm(a,b);var c=a.readUInt32LE(b);return c>0?a.toString("utf8",b+4,b+4+c-1):""},Um=function(a,b){if(!Buffer.isBuffer(a))return Vm(a,b);var c=2*a.readUInt32LE(b);return a.toString("utf16le",b+4,b+4+c-1)},Fm=function(a,b){if(!Buffer.isBuffer(a))return Gm(a,b);var c=a.readUInt32LE(b);return a.toString("utf16le",b+4,b+4+c)},Ym=function(a,b){if(!Buffer.isBuffer(a))return Zm(a,b);var c=a.readUInt32LE(b);return a.toString("utf8",b+4,b+4+c)},Om=function(a,b,c){return Buffer.isBuffer(a)?a.toString("utf8",b,c):Pm(a,b,c)},Im=function(a){return a[0].length>0&&Buffer.isBuffer(a[0][0])?Buffer.concat(a[0]):Jm(a)},Ql=function(a){return Buffer.isBuffer(a[0])?Buffer.concat(a):[].concat.apply([],a)},Wm=function(a,b){return Buffer.isBuffer(a)?a.readDoubleLE(b):Xm(a,b)},$m=function(a){return Buffer.isBuffer(a)||Array.isArray(a)}),"undefined"!=typeof cptable&&(Km=function(a,b,c){return cptable.utils.decode(1200,a.slice(b,c)).replace(Rl,"")},Om=function(a,b,c){return cptable.utils.decode(65001,a.slice(b,c))},Qm=function(a,b){var c=cn(a,b);return c>0?cptable.utils.decode(Bl,a.slice(b+4,b+4+c-1)):""},Sm=function(a,b){var c=cn(a,b);return c>0?cptable.utils.decode(Al,a.slice(b+4,b+4+c-1)):""},Um=function(a,b){var c=2*cn(a,b);return c>0?cptable.utils.decode(1200,a.slice(b+4,b+4+c-1)):""},Fm=function(a,b){var c=cn(a,b);return c>0?cptable.utils.decode(1200,a.slice(b+4,b+4+c)):""},Ym=function(a,b){var c=cn(a,b);return c>0?cptable.utils.decode(65001,a.slice(b+4,b+4+c)):""});var _m=function(a,b){return a[b]},an=function(a,b){return 256*a[b+1]+a[b]},bn=function(a,b){var c=256*a[b+1]+a[b];return c<32768?c:-1*(65535-c+1)},cn=function(a,b){return a[b+3]*(1<<24)+(a[b+2]<<16)+(a[b+1]<<8)+a[b]},dn=function(a,b){return a[b+3]<<24|a[b+2]<<16|a[b+1]<<8|a[b]},en=function(a,b){return a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3]},fn=function(a,b,c){a[c]=255&b,a[c+1]=b>>>8&255,a[c+2]=b>>>16&255,a[c+3]=b>>>24&255},gn=function(a,b,c){a[c]=255&b,a[c+1]=b>>8&255,a[c+2]=b>>16&255,a[c+3]=b>>24&255},hn=function(a,b,c){a[c]=255&b,a[c+1]=b>>>8&255},jn={};!function(a,b){var c;if(void 0!==b)c=b;else if("undefined"!=typeof require)try{c=void 0}catch(a){c=null}a.rc4=function(a,b){var c=new Array(256),d=0,e=0,f=0,g=0;for(e=0;256!=e;++e)c[e]=e;for(e=0;256!=e;++e)f=f+c[e]+a[e%a.length].charCodeAt(0)&255,g=c[e],c[e]=c[f],c[f]=g;e=f=0;var h=Buffer(b.length);for(d=0;d!=b.length;++d)e=e+1&255,f=(f+c[e])%256,g=c[e],c[e]=c[f],c[f]=g,h[d]=b[d]^c[c[e]+c[f]&255];return h},a.md5=function(a){if(!c)throw new Error("Unsupported crypto");return c.createHash("md5").update(a).digest("hex")}}(jn,"undefined"!=typeof crypto?crypto:void 0);var kn=Oa,ln=Ka,mn=La,nn=Ka,on=Ta,pn=Ua,qn=Xa,rn=Ya,sn={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},tn=u(sn),un=2,vn=3,wn=11,xn=12,yn=19,zn=30,An=64,Bn=65,Cn=71,Dn=4096,En=80,Fn=81,Gn=[En,Fn],Hn={1:{n:"CodePage",t:un},2:{n:"Category",t:En},3:{n:"PresentationFormat",t:En},4:{n:"ByteCount",t:vn},5:{n:"LineCount",t:vn},6:{n:"ParagraphCount",t:vn},7:{n:"SlideCount",t:vn},8:{n:"NoteCount",t:vn},9:{n:"HiddenCount",t:vn},10:{n:"MultimediaClipCount",t:vn},11:{n:"ScaleCrop",t:wn},12:{n:"HeadingPairs",t:Dn|xn},13:{n:"TitlesOfParts",t:Dn|zn},14:{n:"Manager",t:En},15:{n:"Company",t:En},16:{n:"LinksUpToDate",t:wn},17:{n:"CharacterCount",t:vn},19:{n:"SharedDoc",t:wn},22:{n:"HyperlinksChanged",t:wn},23:{n:"AppVersion",t:vn,p:"version"},24:{n:"DigSig",t:Bn},26:{n:"ContentType",t:En},27:{n:"ContentStatus",t:En},28:{n:"Language",t:En},29:{n:"Version",t:En},255:{}},In={1:{n:"CodePage",t:un},2:{n:"Title",t:En},3:{n:"Subject",t:En},4:{n:"Author",t:En},5:{n:"Keywords",t:En},6:{n:"Comments",t:En},7:{n:"Template",t:En},8:{n:"LastAuthor",t:En},9:{n:"RevNumber",t:En},10:{n:"EditTime",t:An},11:{n:"LastPrinted",t:An},12:{n:"CreatedDate",t:An},13:{n:"ModifiedDate",t:An},14:{n:"PageCount",t:vn},15:{n:"WordCount",t:vn},16:{n:"CharCount",t:vn},17:{n:"Thumbnail",t:Cn},18:{n:"Application",t:En},19:{n:"DocSecurity",t:vn},255:{}},Jn={2147483648:{n:"Locale",t:yn},2147483651:{n:"Behavior",t:yn},1919054434:{}};!function(){for(var a in Jn)Jn.hasOwnProperty(a)&&(Hn[a]=In[a]=Jn[a])}();var Kn=s(Hn,"n"),Ln=s(In,"n"),Mn={1:"US",2:"CA",3:"",7:"RU",20:"EG",30:"GR",31:"NL",32:"BE",33:"FR",34:"ES",36:"HU",39:"IT",41:"CH",43:"AT",44:"GB",45:"DK",46:"SE",47:"NO",48:"PL",49:"DE",52:"MX",55:"BR",61:"AU",64:"NZ",66:"TH",81:"JP",82:"KR",84:"VN",86:"CN",90:"TR",105:"JS",213:"DZ",216:"MA",218:"LY",351:"PT",354:"IS",358:"FI",420:"CZ",886:"TW",961:"LB",962:"JO",963:"SY",964:"IQ",965:"KW",966:"SA",971:"AE",972:"IL",974:"QA",981:"IR",65535:"US"},Nn=[null,"solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],On=gb([0,16777215,16711680,65280,255,16776960,16711935,65535,0,16777215,16711680,65280,255,16776960,16711935,65535,8388608,32768,128,8421376,8388736,32896,12632256,8421504,10066431,10040166,16777164,13434879,6684774,16744576,26316,13421823,128,16711935,16776960,65535,8388736,8388608,32896,255,52479,13434879,13434828,16777113,10079487,16751052,13408767,16764057,3368703,3394764,10079232,16763904,16750848,16737792,6710937,9868950,13158,3381606,13056,3355392,10040064,10040166,3355545,3355443,16777215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Pn={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":"workbooks","application/vnd.ms-excel.binIndexWs":"TODO","application/vnd.ms-excel.intlmacrosheet":"TODO","application/vnd.ms-excel.binIndexMs":"TODO","application/vnd.openxmlformats-package.core-properties+xml":"coreprops","application/vnd.openxmlformats-officedocument.custom-properties+xml":"custprops","application/vnd.openxmlformats-officedocument.extended-properties+xml":"extprops","application/vnd.openxmlformats-officedocument.customXmlProperties+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty":"TODO","application/vnd.ms-excel.pivotTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml":"TODO","application/vnd.ms-office.chartcolorstyle+xml":"TODO","application/vnd.ms-office.chartstyle+xml":"TODO","application/vnd.ms-excel.calcChain":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings":"TODO","application/vnd.ms-office.activeX":"TODO","application/vnd.ms-office.activeX+xml":"TODO","application/vnd.ms-excel.attachedToolbars":"TODO","application/vnd.ms-excel.connections":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":"TODO","application/vnd.ms-excel.externalLink":"links","application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":"links","application/vnd.ms-excel.sheetMetadata":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":"TODO","application/vnd.ms-excel.pivotCacheDefinition":"TODO","application/vnd.ms-excel.pivotCacheRecords":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml":"TODO","application/vnd.ms-excel.queryTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml":"TODO","application/vnd.ms-excel.userNames":"TODO","application/vnd.ms-excel.revisionHeaders":"TODO","application/vnd.ms-excel.revisionLog":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml":"TODO","application/vnd.ms-excel.tableSingleCells":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml":"TODO","application/vnd.ms-excel.slicer":"TODO","application/vnd.ms-excel.slicerCache":"TODO","application/vnd.ms-excel.slicer+xml":"TODO","application/vnd.ms-excel.slicerCache+xml":"TODO","application/vnd.ms-excel.wsSortMap":"TODO","application/vnd.ms-excel.table":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":"TODO","application/vnd.openxmlformats-officedocument.theme+xml":"themes","application/vnd.openxmlformats-officedocument.themeOverride+xml":"TODO","application/vnd.ms-excel.Timeline+xml":"TODO","application/vnd.ms-excel.TimelineCache+xml":"TODO","application/vnd.ms-office.vbaProject":"vba","application/vnd.ms-office.vbaProjectSignature":"vba","application/vnd.ms-office.volatileDependencies":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml":"TODO","application/vnd.ms-excel.controlproperties+xml":"TODO","application/vnd.openxmlformats-officedocument.model+data":"TODO","application/vnd.ms-excel.Survey+xml":"TODO","application/vnd.openxmlformats-officedocument.drawing+xml":"drawings","application/vnd.openxmlformats-officedocument.drawingml.chart+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml":"TODO","application/vnd.openxmlformats-officedocument.vmlDrawing":"TODO","application/vnd.openxmlformats-package.relationships+xml":"rels","application/vnd.openxmlformats-officedocument.oleObject":"TODO","image/png":"TODO",sheet:"js"},Qn=function(){var a={workbooks:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",xlam:"application/vnd.ms-excel.addin.macroEnabled.main+xml",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},comments:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",xlsb:"application/vnd.ms-excel.comments"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},charts:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",xlsb:"application/vnd.ms-excel.chartsheet"},dialogs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",xlsb:"application/vnd.ms-excel.dialogsheet"},macros:{xlsx:"application/vnd.ms-excel.macrosheet+xml",xlsb:"application/vnd.ms-excel.macrosheet"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};return r(a).forEach(function(b){["xlsm","xlam"].forEach(function(c){a[b][c]||(a[b][c]=a[b].xlsx)})}),r(a).forEach(function(b){r(a[b]).forEach(function(c){Pn[a[b][c]]=b})}),a}(),Rn=v(Pn);Em.CT="http://schemas.openxmlformats.org/package/2006/content-types";var Sn=Z("Types",null,{xmlns:Em.CT,"xmlns:xsd":Em.xsd,"xmlns:xsi":Em.xsi}),Tn=[["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels",Rn.rels[0]]].map(function(a){return Z("Default",null,{Extension:a[0],ContentType:a[1]})}),Un={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};Em.RELS="http://schemas.openxmlformats.org/package/2006/relationships";var Vn=Z("Relationships",null,{xmlns:Em.RELS}),Wn="application/vnd.oasis.opendocument.spreadsheet",Xn=function(){var b='SheetJS '+a.version+"";return function(){return b}}(),Yn=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]];Em.CORE_PROPS="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",Un.CORE_PROPS="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";var Zn=function(){for(var a=new Array(Yn.length),b=0;b]*>([\\s\\S]*?)")}return a}(),$n=Z("cp:coreProperties",null,{"xmlns:cp":Em.CORE_PROPS,"xmlns:dc":Em.dc,"xmlns:dcterms":Em.dcterms,"xmlns:dcmitype":Em.dcmitype,"xmlns:xsi":Em.xsi}),_n=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]];Em.EXT_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",Un.EXT_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";var ao=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"],bo=Z("Properties",null,{xmlns:Em.EXT_PROPS,"xmlns:vt":Em.vt});Em.CUST_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",Un.CUST_PROPS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties";var co=/<[^>]+>[^<]*/g,eo=Z("Properties",null,{xmlns:Em.CUST_PROPS,"xmlns:vt":Em.vt}),fo={Title:"Title",Subject:"Subject",Author:"Author",Keywords:"Keywords",Comments:"Description",LastAuthor:"LastAuthor",RevNumber:"Revision",Application:"AppName",LastPrinted:"LastPrinted",CreatedDate:"Created",ModifiedDate:"LastSaved",Category:"Category",Manager:"Manager",Company:"Company",AppVersion:"Version",ContentStatus:"ContentStatus",Identifier:"Identifier",Language:"Language"},go=t(fo),ho=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"].concat(ao),io=Gc,jo={0:Kc,4:Kc,5:Kc,6:Kc,7:Jc,8:Kc,9:Kc,10:Kc,11:Kc,12:Kc,13:Ic,14:Kc,15:Kc,16:Kc,17:Kc,18:Kc,19:Kc,20:Kc,21:Hc},ko=mc,lo=Ac,mo=["_xlnm.Consolidate_Area","_xlnm.Auto_Open","_xlnm.Auto_Close","_xlnm.Extract","_xlnm.Database","_xlnm.Criteria","_xlnm.Print_Area","_xlnm.Print_Titles","_xlnm.Recorder","_xlnm.Data_Form","_xlnm.Auto_Activate","_xlnm.Auto_Deactivate","_xlnm.Sheet_Title","_xlnm._FilterDatabase"],no=[];no[8]=function(a,b){var c=a.l+b;a.l+=10;var d=a.read_shift(2);a.l+=4,a.l+=2,a.l+=2,a.l+=2,a.l+=4;var e=a.read_shift(1);return a.l+=e,a.l=c,{fmt:d}};var oo=xc,po=fc,qo=lc,ro=function(){function a(a,b){var c=[],d=g(1);switch(b.type){case"base64":d=Pl(Ll.decode(a));break;case"binary":d=Pl(a);break;case"buffer":case"array":d=a}ga(d,0);var f=d.read_shift(1),h=!1,i=!1,j=!1;switch(f){case 2:case 3:break;case 48:i=!0,h=!0;break;case 49:i=!0;break;case 131:case 139:h=!0;break;case 140:h=!0,j=!0;break;case 245:h=!0;break;default:throw new Error("DBF Unsupported Version: "+f.toString(16))}var k=0,l=0;2==f&&(k=d.read_shift(2)),d.l+=3,2!=f&&(k=d.read_shift(4)),2!=f&&(l=d.read_shift(2));var m=d.read_shift(2),n=1252;2!=f&&(d.l+=16,d.read_shift(1),0!==d[d.l]&&(n=e[d[d.l]]),d.l+=1,d.l+=2),j&&(d.l+=36);for(var o=[],p={},q=l-10-(i?264:0),r=j?32:11;2==f?d.l0;)if(42!==d[d.l])for(++d.l,c[++s]=[],t=0,t=0;t!=o.length;++t){var u=d.slice(d.l,d.l+o[t].len);d.l+=o[t].len,ga(u,0);var v=cptable.utils.decode(n,u);switch(o[t].type){case"C":c[s][t]=cptable.utils.decode(n,u),c[s][t]=c[s][t].trim();break;case"D":8===v.length?c[s][t]=new Date(+v.slice(0,4),+v.slice(4,6)-1,+v.slice(6,8)):c[s][t]=v;break;case"F":c[s][t]=parseFloat(v.trim());break;case"+":case"I":c[s][t]=j?2147483648^u.read_shift(-4,"i"):u.read_shift(4,"i");break;case"L":switch(v.toUpperCase()){case"Y":case"T":c[s][t]=!0;break;case"N":case"F":c[s][t]=!1;break;case" ":case"?":c[s][t]=!1;break;default:throw new Error("DBF Unrecognized L:|"+v+"|")}break;case"M":if(!h)throw new Error("DBF Unexpected MEMO for type "+f.toString(16));c[s][t]="##MEMO##"+(j?parseInt(v.trim(),10):u.read_shift(4));break;case"N":c[s][t]=+v.replace(/\u0000/g,"").trim();break;case"@":c[s][t]=new Date(u.read_shift(-8,"f")-621356832e5);break;case"T":c[s][t]=new Date(864e5*(u.read_shift(4)-2440588)+u.read_shift(4));break;case"Y":c[s][t]=u.read_shift(4,"i")/1e4;break;case"O":c[s][t]=-u.read_shift(-8,"f");break;case"B":if(i&&8==o[t].len){c[s][t]=u.read_shift(8,"f");break}case"G":case"P":u.l+=o[t].len;break;case"0":if("_NullFlags"===o[t].name)break;default:throw new Error("DBF Unsupported data type "+o[t].type)}}else d.l+=m;if(2!=f&&d.l0)switch(t){case"ID":case"E":case"B":case"O":break;case"P":"P"==s[1].charAt(0)&&j.push(r.slice(3).replace(/;;/g,";"));break;case"C":var u=!1,v=!1;for(h=1;h0?(m[e].hpt=p,m[e].hpx=Ve(p)):0===p&&(m[e].hidden=!0);break;default:if(b&&b.WTF)throw new Error("SYLK bad record "+r)}y<1&&(k=null);break;default:if(b&&b.WTF)throw new Error("SYLK bad record "+r)}}return m.length>0&&(l["!rows"]=m),n.length>0&&(l["!cols"]=n),b&&b.sheetRows&&(i=i.slice(0,b.sheetRows)),[i,l]}function c(b,c){var d=a(b,c),e=d[0],f=d[1],g=Ia(e,c);return r(f).forEach(function(a){g[a]=f[a]}),g}function d(a,b){return Ga(c(a,b),b)}function e(a,b,c,d){var e="C;Y"+(c+1)+";X"+(d+1)+";K";switch(a.t){case"n":e+=a.v||0,a.f&&!a.F&&(e+=";E"+ip(a.f,{r:c,c:d}));break;case"b":e+=a.v?"TRUE":"FALSE";break;case"e":e+=a.w||a.v;break;case"d":e+='"'+(a.w||a.v)+'"';break;case"s":e+='"'+a.v.replace(/"/g,"")+'"'}return e}function f(a,b){b.forEach(function(b,c){var d="F;W"+(c+1)+" "+(c+1)+" ";b.hidden?d+="0":("number"==typeof b.width&&(b.wpx=Oe(b.width)),"number"==typeof b.wpx&&(b.wch=Pe(b.wpx)),"number"==typeof b.wch&&(d+=Math.round(b.wch)))," "!=d.charAt(d.length-1)&&a.push(d)})}function g(a,b){b.forEach(function(b,c){var d="F;";b.hidden?d+="M0;":b.hpt?d+="M"+20*b.hpt+";":b.hpx&&(d+="M"+20*Ue(b.hpx)+";"),d.length>2&&a.push(d+"R"+(c+1))})}function h(a,b){var c,d=["ID;PWXL;N;E"],h=[],i=Da(a["!ref"]),j=Array.isArray(a),k="\r\n";d.push("P;PGeneral"),d.push("F;P0;DG0G8;M255"),a["!cols"]&&f(d,a["!cols"]),a["!rows"]&&g(d,a["!rows"]),d.push("B;Y"+(i.e.r-i.s.r+1)+";X"+(i.e.c-i.s.c+1)+";D"+[i.s.c,i.s.r,i.e.c,i.e.r].join(" "));for(var l=i.s.r;l<=i.e.r;++l)for(var m=i.s.c;m<=i.e.c;++m){var n=Aa({r:l,c:m});c=j?(a[l]||[])[m]:a[n],c&&(null!=c.v||c.f&&!c.F)&&h.push(e(c,a,l,m,b))}return d.join(k)+k+h.join(k)+k+"E"+k}return{to_workbook:d,to_sheet:c,from_sheet:h}}(),to=function(){function a(a,c){switch(c.type){case"base64":return b(Ll.decode(a),c);case"binary":return b(a,c);case"buffer":return b(a.toString("binary"),c);case"array":return b(A(a),c)}throw new Error("Unrecognized type "+c.type)}function b(a,b){for(var c=a.split("\n"),d=-1,e=-1,f=0,g=[];f!==c.length;++f)if("BOT"!==c[f].trim()){if(!(d<0)){var h=c[f].trim().split(","),i=h[0],j=h[1];++f;var k=c[f].trim();switch(+i){case-1:if("BOT"===k){g[++d]=[],e=0;continue}if("EOD"!==k)throw new Error("Unrecognized DIF special command "+k);break;case 0:"TRUE"===k?g[d][e]=!0:"FALSE"===k?g[d][e]=!1:isNaN(D(j))?isNaN(E(j).getDate())?g[d][e]=j:g[d][e]=z(j):g[d][e]=D(j),++e;break;case 1:k=k.slice(1,k.length-1),g[d][e++]=""!==k?k:null}if("EOD"===k)break}}else g[++d]=[],e=0;return b&&b.sheetRows&&(g=g.slice(0,b.sheetRows)),g}function c(b,c){return Ia(a(b,c),c)}function d(a,b){return Ga(c(a,b),b)}return{to_workbook:d,to_sheet:c,from_sheet:function(){var a=function(a,b,c,d,e){a.push(b),a.push(c+","+d),a.push('"'+e.replace(/"/g,'""')+'"')},b=function(a,b,c,d){a.push(b+","+c),a.push(1==b?'"'+d.replace(/"/g,'""')+'"':d)};return function(c){var d,e=[],f=Da(c["!ref"]),g=Array.isArray(c);a(e,"TABLE",0,1,"sheetjs"),a(e,"VECTORS",0,f.e.r-f.s.r+1,""),a(e,"TUPLES",0,f.e.c-f.s.c+1,""),a(e,"DATA",0,0,"");for(var h=f.s.r;h<=f.e.r;++h){b(e,-1,0,"BOT");for(var i=f.s.c;i<=f.e.c;++i){var j=Aa({r:h,c:i});if(d=g?(c[h]||[])[i]:c[j])switch(d.t){case"n":var k=Kl?d.w:d.v;k||null==d.v||(k=d.v),null==k?Kl&&d.f&&!d.F?b(e,1,0,"="+d.f):b(e,1,0,""):b(e,0,k,"V");break;case"b":b(e,0,d.v?1:0,d.v?"TRUE":"FALSE");break;case"s":b(e,1,0,!Kl||isNaN(d.v)?d.v:'="'+d.v+'"');break;case"d":d.w||(d.w=Tl.format(d.z||Tl._table[14],w(z(d.v)))),Kl?b(e,0,d.w,"V"):b(e,1,0,d.w);break;default:b(e,1,0,"")}else b(e,1,0,"")}}return b(e,-1,0,"EOD"),e.join("\r\n")}}()}}(),uo=function(){function a(a){return a.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,"\n")}function b(a){return a.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function c(b,c){for(var d=b.split("\n"),e=-1,f=-1,g=0,h=[];g!==d.length;++g){var i=d[g].trim().split(":");if("cell"===i[0]){var j=za(i[1]);if(h.length<=j.r)for(e=h.length;e<=j.r;++e)h[e]||(h[e]=[]);switch(e=j.r,f=j.c,i[2]){case"t":h[e][f]=a(i[3]);break;case"v":h[e][f]=+i[3];break;case"vtf":var k=i[i.length-1];case"vtc":switch(i[3]){case"nl":h[e][f]=!!+i[4];break;default:h[e][f]=+i[4]}"vtf"==i[2]&&(h[e][f]=[h[e][f],k])}}}return c&&c.sheetRows&&(h=h.slice(0,c.sheetRows)),h}function d(a,b){return Ia(c(a,b),b)}function e(a,b){return Ga(d(a,b),b)}function f(a){if(!a||!a["!ref"])return"";for(var c,d=[],e=[],f="",g=Ba(a["!ref"]),h=Array.isArray(a),i=g.s.r;i<=g.e.r;++i)for(var j=g.s.c;j<=g.e.c;++j)if(f=Aa({r:i,c:j}),(c=h?(a[i]||[])[j]:a[f])&&null!=c.v&&"z"!==c.t){switch(e=["cell",f,"t"],c.t){case"s":case"str":e.push(b(c.v));break;case"n":c.f?(e[2]="vtf",e[3]="n",e[4]=c.v,e[5]=b(c.f)):(e[2]="v",e[3]=c.v);break;case"b":e[2]="vt"+(c.f?"f":"c"),e[3]="nl",e[4]=c.v?"1":"0",e[5]=b(c.f||(c.v?"TRUE":"FALSE"));break;case"d":var k=w(z(c.v));e[2]="vtc",e[3]="nd",e[4]=""+k,e[5]=c.w||Tl.format(c.z||Tl._table[14],k);break;case"e":continue}d.push(e.join(":"))}return d.push("sheet:c:"+(g.e.c-g.s.c+1)+":r:"+(g.e.r-g.s.r+1)+":tvf:1"),d.push("valueformat:1:text-wiki"),d.join("\n")}function g(a){return[h,i,j,i,f(a),k].join("\n")}var h=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join("\n"),i=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join("\n")+"\n",j=["# SocialCalc Spreadsheet Control Save","part:sheet"].join("\n"),k="--SocialCalcSpreadsheetControlSave--";return{to_workbook:e,to_sheet:d,from_sheet:g}}(),vo=function(){function a(a,b,c,d,e){e.raw?b[c][d]=a:"TRUE"===a?b[c][d]=!0:"FALSE"===a?b[c][d]=!1:""===a||(isNaN(D(a))?isNaN(E(a).getDate())?b[c][d]=a:b[c][d]=z(a):b[c][d]=D(a))}function b(b,c){var d=c||{},e=[];if(!b||0===b.length)return e;for(var f=b.split(/[\r\n]/),g=f.length-1;g>=0&&0===f[g].length;)--g;for(var h=10,i=0,j=0;j<=g;++j)i=f[j].indexOf(" "),-1==i?i=f[j].length:i++,h=Math.max(h,i);for(j=0;j<=g;++j){e[j]=[];var k=0;for(a(f[j].slice(0,h).trim(),e,j,k,d),k=1;k<=(f[j].length-h)/10+1;++k)a(f[j].slice(h+10*(k-1),h+10*k).trim(),e,j,k,d)}return d.sheetRows&&(e=e.slice(0,d.sheetRows)),e}function c(a){for(var b={},c=!1,d=0,e=0;d0&&d(),g["!ref"]=Ca(h),g}function e(a,c){return"sep="==a.slice(0,4)?d(a,c):a.indexOf("\t")>=0||a.indexOf(",")>=0||a.indexOf(";")>=0?d(a,c):Ia(b(a,c),c)}function f(a,b){var c="",d="string"==b.type?[0,0,0,0]:$k(a,b);switch(b.type){case"base64":c=Ll.decode(a);break;case"binary":c=a;break;case"buffer":c=65001==b.codepage?a.toString("utf8"):b.codepage&&"undefined"!=typeof cptable?cptable.utils.decode(b.codepage,a):a.toString("binary");break;case"array":c=A(a);break;case"string":c=a;break;default:throw new Error("Unrecognized type "+b.type)}return 239==d[0]&&187==d[1]&&191==d[2]?c=tm(c.slice(3)):"binary"==b.type&&"undefined"!=typeof cptable&&b.codepage&&(c=cptable.utils.decode(b.codepage,cptable.utils.encode(1252,c))),"socialcalc:version:"==c.slice(0,19)?uo.to_sheet("string"==b.type?c:tm(c),b):e(c,b)}function g(a,b){return Ga(f(a,b),b)}function h(a){for(var b,c=[],d=Da(a["!ref"]),e=Array.isArray(a),f=d.s.r;f<=d.e.r;++f){for(var g=[],h=d.s.c;h<=d.e.c;++h){var i=Aa({r:f,c:h});if((b=e?(a[f]||[])[h]:a[i])&&null!=b.v){for(var j=(b.w||(Fa(b),b.w)||"").slice(0,10);j.length<10;)j+=" ";g.push(j+(0===h?" ":""))}else g.push(" ")}c.push(g.join(""))}return c.join("\n")}var i={44:",",9:"\t",59:";"},j={44:3,9:2,59:1};return{to_workbook:g,to_sheet:f,from_sheet:h}}(),wo=function(){function a(a,b,c){if(a){ga(a,a.l||0);for(var d=c.Enum||r;a.l=4096&&(d.qpro=!0);break;case 6:j=a;break;case 15:d.qpro||(a[1].v=a[1].v.slice(1));case 13:case 14:case 16:case 51:14==l&&112==(112&a[2])&&(15&a[2])>1&&(15&a[2])<15&&(a[1].z=d.dateNF||Tl._table[14],d.cellDates&&(a[1].t="d",a[1].v=x(a[1].v))),d.dense?(e[a[0].r]||(e[a[0].r]=[]),e[a[0].r][a[0].c]=a[1]):e[Aa(a[0])]=a[1]}else switch(l){case 22:a[1].v=a[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(a[3]>g&&(e["!ref"]=Ca(j),h[f]=e,e=d.dense?[]:{},j={s:{r:0,c:0},e:{r:0,c:0}},g=a[3],f="Sheet"+(g+1),i.push(f)),k>0&&a[0].r>=k)break;d.dense?(e[a[0].r]||(e[a[0].r]=[]),e[a[0].r][a[0].c]=a[1]):e[Aa(a[0])]=a[1],j.e.c>1;if(1&c[1].v)switch(7&d){case 1:d=500*(d>>3);break;case 2:d=(d>>3)/20;break;case 4:d=(d>>3)/2e3;break;case 6:d=(d>>3)/16;break;case 7:d=(d>>3)/64;break;default:throw"unknown NUMBER_18 encoding "+(7&d)}return c[1].v=d,c}function m(a,b){var c=j(a,b),d=a.read_shift(4),e=a.read_shift(4),f=a.read_shift(2);if(65535==f)return c[1].v=0,c;var g=32768&f;return f=(32767&f)-16446,c[1].v=(2*g-1)*((f>0?e<>>-f)+(f>-32?d<>>-(f+32))),c}function n(a,b){var c=m(a,14);return a.l+=b-14,c}function o(a,b){var c=j(a,b),d=a.read_shift(4);return c[1].v=d>>6,c}function p(a,b){var c=j(a,b),d=a.read_shift(8,"f");return c[1].v=d,c}function q(a,b){var c=p(a,14);return a.l+=b-10,c}var r={0:{n:"BOF",f:dc},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f:d},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f:g},14:{n:"NUMBER",f:h},15:{n:"LABEL",f:f},16:{n:"FORMULA",f:i},24:{n:"TABLE"},25:{n:"ORANGE"},26:{n:"PRANGE"},27:{n:"SRANGE"},28:{n:"FRANGE"},29:{n:"KRANGE1"},32:{n:"HRANGE"},35:{n:"KRANGE2"},36:{n:"PROTEC"},37:{n:"FOOTER"},38:{n:"HEADER"},39:{n:"SETUP"},40:{n:"MARGINS"},41:{n:"LABELFMT"},42:{n:"TITLES"},43:{n:"SHEETJS"},45:{n:"GRAPH"},46:{n:"NGRAPH"},47:{n:"CALCCOUNT"},48:{n:"UNFORMATTED"},49:{n:"CURSORW12"},50:{n:"WINDOW"},51:{n:"STRING",f:f},55:{n:"PASSWORD"},56:{n:"LOCKED"},60:{n:"QUERY"},61:{n:"QUERYNAME"},62:{n:"PRINT"},63:{n:"PRINTNAME"},64:{n:"GRAPH2"},65:{n:"GRAPHNAME"},66:{n:"ZOOM"},67:{n:"SYMSPLIT"},68:{n:"NSROWS"},69:{n:"NSCOLS"},70:{n:"RULER"},71:{n:"NNAME"},72:{n:"ACOMM"},73:{n:"AMACRO"},74:{n:"PARSE"},255:{n:"",f:ha}},s={0:{n:"BOF"},1:{n:"EOF"},3:{n:"??"},4:{n:"??"},5:{n:"??"},6:{n:"??"},7:{n:"??"},9:{n:"??"},10:{n:"??"},11:{n:"??"},12:{n:"??"},14:{n:"??"},15:{n:"??"},16:{n:"??"},17:{n:"??"},18:{n:"??"},19:{n:"??"},21:{n:"??"},22:{n:"LABEL16",f:k},23:{n:"NUMBER17",f:m},24:{n:"NUMBER18",f:l},25:{n:"FORMULA19",f:n},26:{n:"??"},27:{n:"??"},28:{n:"??"},29:{n:"??"},30:{n:"??"},31:{n:"??"},33:{n:"??"},37:{n:"NUMBER25",f:o},39:{n:"NUMBER27",f:p},40:{n:"FORMULA28",f:q},255:{n:"",f:ha}};return{to_workbook:b}}(),xo=function(){function a(a){var d=[[],"",[]],e=a.match(b);if(!e)return"";d[1]=e[1];var h=a.match(c);return h&&g(h[1],d[0],d[2]),d[0].join("")+d[1].replace(f,"
          ")+d[2].join("")}var b=ym("t"),c=ym("rPr"),d=/<(?:\w+:)?r>/g,e=/<\/(?:\w+:)?r>/,f=/\r\n/g,g=function(a,b,c){var d={},e=65001,f="",g=!1,h=a.match(im),i=0;if(h)for(;i!=h.length;++i){var j=P(h[i]);switch(j[0].replace(/\w*:/g,"")){case"":case"":d.shadow=1;break;case"":break;case"":case"":d.outline=1;break;case"":break;case"":case"":d.strike=1;break;case"":break;case"":case"":d.u=1;break;case"":break;case"":case"":d.b=1;break;case"":break;case"":case"":d.i=1;break;case"":break;case"":case"
          ":break;case"":g=!1;break;default:if(47!==j[0].charCodeAt(1)&&!g)throw new Error("Unrecognized rich format "+j[0])}}var k=[];return d.u&&k.push("text-decoration: underline;"),d.uval&&k.push("text-underline-style:"+d.uval+";"),d.sz&&k.push("font-size:"+d.sz+"pt;"),d.outline&&k.push("text-effect: outline;"),d.shadow&&k.push("text-shadow: auto;"),b.push(''),d.b&&(b.push(""),c.push("")),d.i&&(b.push(""),c.push("")),d.strike&&(b.push(""),c.push("")),"superscript"==f?f="sup":"subscript"==f&&(f="sub"),""!=f&&(b.push("<"+f+">"),c.push("")),c.push(""),e};return function(b){return b.replace(d,"").split(e).map(a).join("")}}(),yo=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,zo=/<(?:\w+:)?r>/,Ao=/<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g,Bo=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/,Co=/<(?:\w+:)?(?:si|sstItem)>/g,Do=/<\/(?:\w+:)?(?:si|sstItem)>/;Un.SST="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings";var Eo=/^\s|\s$|[\t\n\r]/,Fo=Pa,Go=function(){var a=[187,255,255,186,255,255,185,128,0,190,15,0,191,15,0],b=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],c=[44796,19929,39858,10053,20106,40212,10761,31585,63170,64933,60267,50935,40399,11199,17763,35526,1453,2906,5812,11624,23248,885,1770,3540,7080,14160,28320,56640,55369,41139,20807,41614,21821,43642,17621,28485,56970,44341,19019,38038,14605,29210,60195,50791,40175,10751,21502,43004,24537,18387,36774,3949,7898,15796,31592,63184,47201,24803,49606,37805,14203,28406,56812,17824,35648,1697,3394,6788,13576,27152,43601,17539,35078,557,1114,2228,4456,30388,60776,51953,34243,7079,14158,28316,14128,28256,56512,43425,17251,34502,7597,13105,26210,52420,35241,883,1766,3532,4129,8258,16516,33032,4657,9314,18628],d=function(a){return 255&(a/2|128*a)},e=function(a,b){return d(a^b)},f=function(a){for(var d=b[a.length-1],e=104,f=a.length-1;f>=0;--f)for(var g=a[f],h=0;7!=h;++h)64&g&&(d^=c[e]),g*=2,--e;return d};return function(b){for(var c=pe(b),d=f(c),h=c.length,i=g(16),j=0;16!=j;++j)i[j]=0;var k,l,m;for(1==(1&h)&&(k=d>>8,i[h]=e(a[0],k),--h,k=255&d,l=c[c.length-1],i[h]=e(l,k));h>0;)--h,k=d>>8,i[h]=e(c[h],k),--h,k=255&d,i[h]=e(c[h],k);for(h=15,m=15-c.length;m>0;)k=d>>8,i[h]=e(a[m],k),--h,--m,k=255&d,i[h]=e(c[h],k),--h,--m;return i}}(),Ho=function(a,b,c,d,e){e||(e=b),d||(d=Go(a));var f,g;for(f=0;f!=b.length;++f)g=b[f],g^=d[c],g=255&(g>>5|g<<3),e[f]=g,++c;return[e,c,d]},Io=function(a){var b=0,c=Go(a);return function(a){var d=Ho("",a,b,c);return b=d[1],d[0]}},Jo=function(){function a(a,c){switch(c.type){case"base64":return b(Ll.decode(a),c);case"binary":return b(a,c);case"buffer":return b(a.toString("binary"),c);case"array":return b(A(a),c)}throw new Error("Unrecognized type "+c.type)}function b(a,b){var c=b||{},d=c.dense?[]:{},e={s:{c:0,r:0},e:{c:0,r:0}};if(!a.match(/\\trowd/))throw new Error("RTF missing table");return d["!ref"]=Ca(e),d}function c(b,c){return Ga(a(b,c),c)}function d(a){for(var b,c=["{\\rtf1\\ansi"],d=Da(a["!ref"]),e=Array.isArray(a),f=d.s.r;f<=d.e.r;++f){c.push("\\trowd\\trautofit1");for(var g=d.s.c;g<=d.e.c;++g)c.push("\\cellx"+(g+1));for(c.push("\\pard\\intbl"),g=d.s.c;g<=d.e.c;++g){var h=Aa({r:f,c:g});b=e?(a[f]||[])[g]:a[h],b&&(null!=b.v||b.f&&!b.F)&&(c.push(" "+(b.w||(Fa(b),b.w))),c.push("\\cell"))}c.push("\\pard\\intbl\\row")}return c.join("")+"}"}return{to_workbook:c,to_sheet:a,from_sheet:d}}(),Ko=6,Lo=15,Mo=1,No=Ko,Oo=96,Po=Oo,Qo={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"},Ro=["numFmtId","fillId","fontId","borderId","xfId"],So=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","pivotButton","quotePrefix"],To=function(){var a=/<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/,b=/<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/,c=/<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/,d=/<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/,e=/<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;return function(f,g,h){var i={};if(!f)return i;f=f.replace(//gm,"").replace(//gm,"");var j;return(j=f.match(a))&&Ze(j,i,h),(j=f.match(d))&&Ye(j,i,g,h),(j=f.match(c))&&Xe(j,i,g,h),(j=f.match(e))&&We(j,i,g,h),(j=f.match(b))&&_e(j,i,h),i}}(),Uo=Z("styleSheet",null,{xmlns:Em.main[0],"xmlns:vt":Em.vt});Un.STY="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";var Vo=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],Wo=t(Vo),Xo=ha,Yo=ha;Un.THEME="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";var Zo=/]*)>[\s\S]*<\/a:clrScheme>/,$o=/]*)>[\s\S]*<\/a:fontScheme>/,_o=/]*)>[\s\S]*<\/a:fmtScheme>/,ap=/]*)>[\s\S]*<\/a:themeElements>/;Un.IMG="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Un.DRAW="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";var bp=1024;Un.CMNT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";var cp=Z("comments",null,{xmlns:Em.main[0]}),dp=Ka,ep="application/vnd.ms-office.vbaProject",fp=["xlsb","xlsm","xlam","biff8","xla"];Un.DS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",Un.MS="http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";var gp=function(){function a(a,b,d,e,f,g){var h=e.length>0?0|parseInt(e,10):0,i=g.length>0?0|parseInt(g,10):0;i<0&&0===f.length&&(i=0);var j=!1,k=!1;return(f.length>0||0==g.length)&&(j=!0),j?i+=c.c:--i,(d.length>0||0==e.length)&&(k=!0),k?h+=c.r:--h,b+(j?"":"$")+va(i)+(k?"":"$")+ra(h)}var b=/(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g,c={r:0,c:0};return function(d,e){return c=e,d.replace(b,a)}}(),hp=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g,ip=function(){return function(a,b){return a.replace(hp,function(a,c,d,e,f,g){var h=ua(e)-(d?0:b.c),i=qa(g)-(f?0:b.r);return c+"R"+(0==i?"":f?i+1:"["+i+"]")+"C"+(0==h?"":d?h+1:"["+h+"]")})}}(),jp=ha,kp=ha,lp=ha,mp=gh,np=hh,op=hh,pp=gh,qp=gh,rp=ih,sp=hh,tp=gh,up=gh,vp=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"],wp={1:{n:"PtgExp",f:Sg},2:{n:"PtgTbl",f:lp},3:{n:"PtgAdd",f:mg},4:{n:"PtgSub",f:mg},5:{n:"PtgMul",f:mg},6:{n:"PtgDiv",f:mg},7:{n:"PtgPower",f:mg},8:{n:"PtgConcat",f:mg},9:{n:"PtgLt",f:mg},10:{n:"PtgLe",f:mg},11:{n:"PtgEq",f:mg},12:{n:"PtgGe",f:mg},13:{n:"PtgGt",f:mg},14:{n:"PtgNe",f:mg},15:{n:"PtgIsect",f:mg},16:{n:"PtgUnion",f:mg},17:{n:"PtgRange",f:mg},18:{n:"PtgUplus",f:mg},19:{n:"PtgUminus",f:mg},20:{n:"PtgPercent",f:mg},21:{n:"PtgParen",f:mg},22:{n:"PtgMissArg",f:mg},23:{n:"PtgStr",f:Xg},26:{n:"PtgSheet",f:lh},27:{n:"PtgEndSheet",f:mh},28:{n:"PtgErr",f:Tg},29:{n:"PtgBool",f:Vg},30:{n:"PtgInt",f:Ug},31:{n:"PtgNum",f:Wg},32:{n:"PtgArray",f:Bg},33:{n:"PtgFunc",f:Og},34:{n:"PtgFuncVar",f:Pg},35:{n:"PtgName",f:_g},36:{n:"PtgRef",f:Lg},37:{n:"PtgArea",f:wg},38:{n:"PtgMemArea",f:ch},39:{n:"PtgMemErr",f:jp},40:{n:"PtgMemNoMem",f:kp},41:{n:"PtgMemFunc",f:dh},42:{n:"PtgRefErr",f:eh},43:{n:"PtgAreaErr",f:yg},44:{n:"PtgRefN",f:Mg},45:{n:"PtgAreaN",f:Ag},46:{n:"PtgMemAreaN",f:nh},47:{n:"PtgMemNoMemN",f:oh},57:{n:"PtgNameX",f:ah},58:{n:"PtgRef3d",f:Ng},59:{n:"PtgArea3d",f:xg},60:{n:"PtgRefErr3d",f:fh},61:{n:"PtgAreaErr3d",f:zg},255:{}},xp={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,78:46,110:46,79:47,111:47,88:34,120:34,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61};!function(){for(var a in xp)wp[a]=wp[xp[a]]}();var yp={1:{n:"PtgElfLel",f:ih},2:{n:"PtgElfRw",f:tp},3:{n:"PtgElfCol",f:mp},6:{n:"PtgElfRwV",f:up},7:{n:"PtgElfColV",f:pp},10:{n:"PtgElfRadical",f:qp},11:{n:"PtgElfRadicalS",f:sp},13:{n:"PtgElfColS",f:np},15:{n:"PtgElfColSV",f:op},16:{n:"PtgElfRadicalLel",f:rp},25:{n:"PtgList",f:jh},29:{n:"PtgSxName",f:kh},255:{}},zp={0:{n:"PtgAttrNoop",f:ph},1:{n:"PtgAttrSemi",f:Hg},2:{n:"PtgAttrIf",f:Fg},4:{n:"PtgAttrChoose",f:Dg},8:{n:"PtgAttrGoto",f:Eg},16:{n:"PtgAttrSum",f:Rg},32:{n:"PtgAttrBaxcel",f:Cg},64:{n:"PtgAttrSpace",f:Jg},65:{n:"PtgAttrSpaceSemi",f:Kg},128:{n:"PtgAttrIfError",f:Gg},255:{}};zp[33]=zp[32];var Ap={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"},Bp=Dh,Cp=Dh,Dp=Dh,Ep=Dh,Fp={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"},Gp={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"IMAGINARY",410:"IMREAL",411:"COMPLEX",412:"IMSUM",413:"IMPRODUCT",414:"SERIESSUM",415:"FACTDOUBLE",416:"SQRTPI",417:"QUOTIENT",418:"DELTA",419:"GESTEP",420:"ISEVEN",421:"ISODD",422:"MROUND",423:"ERF",424:"ERFC",425:"BESSELJ",426:"BESSELK",427:"BESSELY",428:"BESSELI",429:"XIRR",430:"XNPV",431:"PRICEMAT",432:"YIELDMAT",433:"INTRATE",434:"RECEIVED",435:"DISC",436:"PRICEDISC",437:"YIELDDISC",438:"TBILLEQ",439:"TBILLPRICE",440:"TBILLYIELD",441:"PRICE",442:"YIELD",443:"DOLLARDE",444:"DOLLARFR",445:"NOMINAL",446:"EFFECT",447:"CUMPRINC",448:"CUMIPMT",449:"EDATE",450:"EOMONTH",451:"YEARFRAC",452:"COUPDAYBS",453:"COUPDAYS",454:"COUPDAYSNC",455:"COUPNCD",456:"COUPNUM",457:"COUPPCD",458:"DURATION",459:"MDURATION",460:"ODDLPRICE",461:"ODDLYIELD",462:"ODDFPRICE",463:"ODDFYIELD",464:"RANDBETWEEN",465:"WEEKNUM",466:"AMORDEGRC",467:"AMORLINC",468:"CONVERT",724:"SHEETJS",469:"ACCRINT",470:"ACCRINTM",471:"WORKDAY",472:"NETWORKDAYS",473:"GCD",474:"MULTINOMIAL",475:"LCM",476:"FVSCHEDULE",477:"CUBEKPIMEMBER",478:"CUBESET",479:"CUBESETCOUNT",480:"IFERROR",481:"COUNTIFS",482:"SUMIFS",483:"AVERAGEIF",484:"AVERAGEIFS"},Hp={2:1,3:1,10:0,15:1,16:1,17:1,18:1,19:0,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,34:0,35:0,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,63:0,65:3,66:3,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:0,75:1,76:1,77:1,79:2,80:2,83:1,85:0,86:1,89:0,90:1,94:0,95:0,97:2,98:1,99:1,101:3,102:3,105:1,106:1,108:2,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,144:4,161:1,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,186:1,189:3,190:1,195:3,196:3,197:1,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,225:0,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,247:4,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,382:3,385:1,392:1,393:1,396:2,397:2,398:2,399:1,400:1,401:1,402:1,403:1,404:1,405:1,406:1,407:1,408:1,409:1,410:1,414:4,415:1,416:1,417:2,420:1,421:1,422:2,424:1,425:2,426:2,427:2,428:2,430:3,438:3,439:3,440:3,443:2,444:2,445:2,446:2,447:6,448:6,449:2,450:2,464:2,468:3,476:2,479:1,480:2,65535:0},Ip={"_xlfn.ACOT":"ACOT","_xlfn.ACOTH":"ACOTH","_xlfn.AGGREGATE":"AGGREGATE","_xlfn.ARABIC":"ARABIC","_xlfn.AVERAGEIF":"AVERAGEIF","_xlfn.AVERAGEIFS":"AVERAGEIFS","_xlfn.BASE":"BASE","_xlfn.BETA.DIST":"BETA.DIST","_xlfn.BETA.INV":"BETA.INV","_xlfn.BINOM.DIST":"BINOM.DIST","_xlfn.BINOM.DIST.RANGE":"BINOM.DIST.RANGE","_xlfn.BINOM.INV":"BINOM.INV","_xlfn.BITAND":"BITAND","_xlfn.BITLSHIFT":"BITLSHIFT","_xlfn.BITOR":"BITOR","_xlfn.BITRSHIFT":"BITRSHIFT","_xlfn.BITXOR":"BITXOR","_xlfn.CEILING.MATH":"CEILING.MATH","_xlfn.CEILING.PRECISE":"CEILING.PRECISE","_xlfn.CHISQ.DIST":"CHISQ.DIST","_xlfn.CHISQ.DIST.RT":"CHISQ.DIST.RT","_xlfn.CHISQ.INV":"CHISQ.INV","_xlfn.CHISQ.INV.RT":"CHISQ.INV.RT","_xlfn.CHISQ.TEST":"CHISQ.TEST","_xlfn.COMBINA":"COMBINA","_xlfn.CONCAT":"CONCAT","_xlfn.CONFIDENCE.NORM":"CONFIDENCE.NORM","_xlfn.CONFIDENCE.T":"CONFIDENCE.T","_xlfn.COT":"COT","_xlfn.COTH":"COTH","_xlfn.COUNTIFS":"COUNTIFS","_xlfn.COVARIANCE.P":"COVARIANCE.P","_xlfn.COVARIANCE.S":"COVARIANCE.S","_xlfn.CSC":"CSC","_xlfn.CSCH":"CSCH","_xlfn.DAYS":"DAYS","_xlfn.DECIMAL":"DECIMAL","_xlfn.ECMA.CEILING":"ECMA.CEILING","_xlfn.ERF.PRECISE":"ERF.PRECISE","_xlfn.ERFC.PRECISE":"ERFC.PRECISE","_xlfn.EXPON.DIST":"EXPON.DIST","_xlfn.F.DIST":"F.DIST","_xlfn.F.DIST.RT":"F.DIST.RT","_xlfn.F.INV":"F.INV","_xlfn.F.INV.RT":"F.INV.RT","_xlfn.F.TEST":"F.TEST","_xlfn.FILTERXML":"FILTERXML","_xlfn.FLOOR.MATH":"FLOOR.MATH","_xlfn.FLOOR.PRECISE":"FLOOR.PRECISE","_xlfn.FORECAST.ETS":"FORECAST.ETS","_xlfn.FORECAST.ETS.CONFINT":"FORECAST.ETS.CONFINT","_xlfn.FORECAST.ETS.SEASONALITY":"FORECAST.ETS.SEASONALITY","_xlfn.FORECAST.ETS.STAT":"FORECAST.ETS.STAT","_xlfn.FORECAST.LINEAR":"FORECAST.LINEAR","_xlfn.FORMULATEXT":"FORMULATEXT","_xlfn.GAMMA":"GAMMA","_xlfn.GAMMA.DIST":"GAMMA.DIST","_xlfn.GAMMA.INV":"GAMMA.INV","_xlfn.GAMMALN.PRECISE":"GAMMALN.PRECISE","_xlfn.GAUSS":"GAUSS","_xlfn.HYPGEOM.DIST":"HYPGEOM.DIST","_xlfn.IFERROR":"IFERROR","_xlfn.IFNA":"IFNA","_xlfn.IFS":"IFS","_xlfn.IMCOSH":"IMCOSH","_xlfn.IMCOT":"IMCOT","_xlfn.IMCSC":"IMCSC","_xlfn.IMCSCH":"IMCSCH","_xlfn.IMSEC":"IMSEC","_xlfn.IMSECH":"IMSECH","_xlfn.IMSINH":"IMSINH","_xlfn.IMTAN":"IMTAN","_xlfn.ISFORMULA":"ISFORMULA","_xlfn.ISO.CEILING":"ISO.CEILING","_xlfn.ISOWEEKNUM":"ISOWEEKNUM","_xlfn.LOGNORM.DIST":"LOGNORM.DIST","_xlfn.LOGNORM.INV":"LOGNORM.INV","_xlfn.MAXIFS":"MAXIFS","_xlfn.MINIFS":"MINIFS","_xlfn.MODE.MULT":"MODE.MULT","_xlfn.MODE.SNGL":"MODE.SNGL","_xlfn.MUNIT":"MUNIT","_xlfn.NEGBINOM.DIST":"NEGBINOM.DIST","_xlfn.NETWORKDAYS.INTL":"NETWORKDAYS.INTL","_xlfn.NIGBINOM":"NIGBINOM","_xlfn.NORM.DIST":"NORM.DIST","_xlfn.NORM.INV":"NORM.INV","_xlfn.NORM.S.DIST":"NORM.S.DIST","_xlfn.NORM.S.INV":"NORM.S.INV","_xlfn.NUMBERVALUE":"NUMBERVALUE","_xlfn.PDURATION":"PDURATION","_xlfn.PERCENTILE.EXC":"PERCENTILE.EXC","_xlfn.PERCENTILE.INC":"PERCENTILE.INC","_xlfn.PERCENTRANK.EXC":"PERCENTRANK.EXC","_xlfn.PERCENTRANK.INC":"PERCENTRANK.INC","_xlfn.PERMUTATIONA":"PERMUTATIONA","_xlfn.PHI":"PHI","_xlfn.POISSON.DIST":"POISSON.DIST","_xlfn.QUARTILE.EXC":"QUARTILE.EXC","_xlfn.QUARTILE.INC":"QUARTILE.INC","_xlfn.QUERYSTRING":"QUERYSTRING","_xlfn.RANK.AVG":"RANK.AVG","_xlfn.RANK.EQ":"RANK.EQ","_xlfn.RRI":"RRI","_xlfn.SEC":"SEC","_xlfn.SECH":"SECH","_xlfn.SHEET":"SHEET","_xlfn.SHEETS":"SHEETS","_xlfn.SKEW.P":"SKEW.P","_xlfn.STDEV.P":"STDEV.P","_xlfn.STDEV.S":"STDEV.S","_xlfn.SUMIFS":"SUMIFS","_xlfn.SWITCH":"SWITCH","_xlfn.T.DIST":"T.DIST","_xlfn.T.DIST.2T":"T.DIST.2T","_xlfn.T.DIST.RT":"T.DIST.RT","_xlfn.T.INV":"T.INV","_xlfn.T.INV.2T":"T.INV.2T","_xlfn.T.TEST":"T.TEST","_xlfn.TEXTJOIN":"TEXTJOIN","_xlfn.UNICHAR":"UNICHAR","_xlfn.UNICODE":"UNICODE","_xlfn.VAR.P":"VAR.P","_xlfn.VAR.S":"VAR.S","_xlfn.WEBSERVICE":"WEBSERVICE","_xlfn.WEIBULL.DIST":"WEIBULL.DIST","_xlfn.WORKDAY.INTL":"WORKDAY.INTL","_xlfn.XOR":"XOR","_xlfn.Z.TEST":"Z.TEST"},Jp={},Kp={};Un.WS=["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"];var Lp="undefined"!=typeof Map,Mp=/<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g,Np=/<(?:\w+:)?sheetData>([\s\S]*)<\/(?:\w+:)?sheetData>/,Op=/<(?:\w:)?hyperlink [^>]*>/gm,Pp=/"(\w*:\w*)"/,Qp=/<(?:\w:)?col\b[^>]*[\/]?>/g,Rp=/<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g,Sp=/<(?:\w:)?pageMargins[^>]*\/>/g,Tp=/<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/,Up=/<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/,Vp=/<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/>/,Wp=function(){var a=/<(?:\w+:)?c[ >]/,b=/<\/(?:\w+:)?row>/,c=/r=["']([^"']*)["']/,d=/<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/,e=/ref=["']([^"']*)["']/,f=ym("v"),g=ym("f");return function(h,i,j,k,l,m){for(var n,o,p,q,r,s=0,t="",u=[],v=[],y=0,A=0,B=0,C="",D=0,E=0,F=0,G=0,H=Array.isArray(m.CellXf),I=[],J=[],K=Array.isArray(i),L=[],M={},N=!1,O=h.split(b),Q=0,R=O.length;Q!=R;++Q){t=O[Q].trim();var S=t.length;if(0!==S){for(s=0;sD-1&&(k.s.r=D-1),k.e.r":"")+t,null!=v&&2===v.length){for(y=0,C=v[1],A=0;A!=C.length&&!((B=C.charCodeAt(A)-64)<1||B>26);++A)y=26*y+B;--y,E=y}else++E;for(A=0;A!=t.length&&62!==t.charCodeAt(A);++A);if(++A,o=P(t.slice(0,A),!0),o.r||(o.r=Aa({r:D-1,c:E})),C=t.slice(A),n={t:""},null!=(v=C.match(f))&&""!==v[1]&&(n.v=nm(v[1])),j.cellFormula){null!=(v=C.match(g))&&""!==v[1]?(n.f=lg(nm(tm(v[1]))),v[0].indexOf('t="array"')>-1?(n.F=(C.match(e)||[])[1],n.F.indexOf(":")>-1&&I.push([Da(n.F),n.F])):v[0].indexOf('t="shared"')>-1&&(q=P(v[0]),J[parseInt(q.si,10)]=[q,lg(nm(tm(v[1]))),o.r])):(v=C.match(/]*\/>/))&&(q=P(v[0]),J[q.si]&&(n.f=jg(J[q.si][1],J[q.si][2],o.r)));var U=za(o.r);for(A=0;A=I[A][0].s.r&&U.r<=I[A][0].e.r&&U.c>=I[A][0].s.c&&U.c<=I[A][0].e.c&&(n.F=I[A][1])}if(null==o.t&&void 0===n.v)if(n.f||n.F)n.v=0,n.t="n";else{if(!j.sheetStubs)continue;n.t="z"}else n.t=o.t||"n";switch(k.s.c>E&&(k.s.c=E),k.e.c0&&(i["!rows"]=L)}}(),Xp=Z("worksheet",null,{xmlns:Em.main[0],"xmlns:r":Em.r}),Yp=qn,Zp=rn,$p=qn,_p=rn,aq=["left","right","top","bottom","header","footer"];Un.CS="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet";var bq=(Z("chartsheet",null,{xmlns:Em.main[0],"xmlns:r":Em.r}),[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]]),cq=[["activeTab",0,"int"],["autoFilterDateGrouping",!0,"bool"],["firstSheet",0,"int"],["minimized",!1,"bool"],["showHorizontalScroll",!0,"bool"],["showSheetTabs",!0,"bool"],["showVerticalScroll",!0,"bool"],["tabRatio",600,"int"],["visibility","visible"]],dq=[],eq=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]],fq="][*?/\\".split(""),gq=/<\w+:workbook/,hq=Z("workbook",null,{xmlns:Em.main[0],"xmlns:r":Em.r}),iq=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g,jq=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/,kq=function(a){return String.fromCharCode(a)},lq=/<(\/?)([^\s?>!\/:]*:|)([^\s?>:\/]+)[^>]*>/gm,mq={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"},nq={0:{n:"BrtRowHdr",f:di},1:{n:"BrtCellBlank",f:ji},2:{n:"BrtCellRk",f:si},3:{n:"BrtCellError",f:ni},4:{n:"BrtCellBool",f:li},5:{n:"BrtCellReal",f:qi},6:{n:"BrtCellSt",f:ui},7:{n:"BrtCellIsst",f:oi},8:{n:"BrtFmlaString",f:zi},9:{n:"BrtFmlaNum",f:yi},10:{n:"BrtFmlaBool",f:wi},11:{n:"BrtFmlaError",f:xi},16:{n:"BrtFRTArchID$",f:pj},19:{n:"BrtSSTItem",f:Oa},20:{n:"BrtPCDIMissing"},21:{n:"BrtPCDINumber"},22:{n:"BrtPCDIBoolean"},23:{n:"BrtPCDIError"},24:{n:"BrtPCDIString"},25:{n:"BrtPCDIDatetime"},26:{n:"BrtPCDIIndex"},27:{n:"BrtPCDIAMissing"},28:{n:"BrtPCDIANumber"},29:{n:"BrtPCDIABoolean"},30:{n:"BrtPCDIAError"},31:{n:"BrtPCDIAString"},32:{n:"BrtPCDIADatetime"},33:{n:"BrtPCRRecord"},34:{n:"BrtPCRRecordDt"},35:{n:"BrtFRTBegin"},36:{n:"BrtFRTEnd"},37:{n:"BrtACBegin"},38:{n:"BrtACEnd"},39:{n:"BrtName",f:qj},40:{n:"BrtIndexRowBlock"},42:{n:"BrtIndexBlock"},43:{n:"BrtFont",f:ef},44:{n:"BrtFmt",f:cf},45:{n:"BrtFill",f:Xo},46:{n:"BrtBorder",f:Yo},47:{n:"BrtXF",f:hf},48:{n:"BrtStyle"},49:{n:"BrtCellMeta"},50:{n:"BrtValueMeta"},51:{n:"BrtMdb"},52:{n:"BrtBeginFmd"},53:{n:"BrtEndFmd"},54:{n:"BrtBeginMdx"},55:{n:"BrtEndMdx"},56:{n:"BrtBeginMdxTuple"},57:{n:"BrtEndMdxTuple"},58:{n:"BrtMdxMbrIstr"},59:{n:"BrtStr"},60:{n:"BrtColInfo",f:Wd},62:{n:"BrtCellRString"},63:{n:"BrtCalcChainItem$",f:Pf},64:{n:"BrtDVal"},65:{n:"BrtSxvcellNum"},66:{n:"BrtSxvcellStr"},67:{n:"BrtSxvcellBool"},68:{n:"BrtSxvcellErr"},69:{n:"BrtSxvcellDate"},70:{n:"BrtSxvcellNil"},128:{n:"BrtFileVersion"},129:{n:"BrtBeginSheet"},130:{n:"BrtEndSheet"},131:{n:"BrtBeginBook",f:ha,p:0},132:{n:"BrtEndBook"},133:{n:"BrtBeginWsViews"},134:{n:"BrtEndWsViews"},135:{n:"BrtBeginBookViews"},136:{n:"BrtEndBookViews"},137:{n:"BrtBeginWsView",f:Ii},138:{n:"BrtEndWsView"},139:{n:"BrtBeginCsViews"},140:{n:"BrtEndCsViews"},141:{n:"BrtBeginCsView"},142:{n:"BrtEndCsView"},143:{n:"BrtBeginBundleShs"},144:{n:"BrtEndBundleShs"},145:{n:"BrtBeginSheetData"},146:{n:"BrtEndSheetData"},147:{n:"BrtWsProp",f:hi},148:{n:"BrtWsDim",f:Yp,p:16},151:{n:"BrtPane"},152:{n:"BrtSel"},153:{n:"BrtWbProp",f:nj},154:{n:"BrtWbFactoid"},155:{n:"BrtFileRecover"},156:{n:"BrtBundleSh",f:lj},157:{n:"BrtCalcProp"},158:{n:"BrtBookView"},159:{n:"BrtBeginSst",f:le},160:{n:"BrtEndSst"},161:{n:"BrtBeginAFilter",f:qn},162:{n:"BrtEndAFilter"},163:{n:"BrtBeginFilterColumn"},164:{n:"BrtEndFilterColumn"},165:{n:"BrtBeginFilters"},166:{n:"BrtEndFilters"},167:{n:"BrtFilter"},168:{n:"BrtColorFilter"},169:{n:"BrtIconFilter"},170:{n:"BrtTop10Filter"},171:{n:"BrtDynamicFilter"},172:{n:"BrtBeginCustomFilters"},173:{n:"BrtEndCustomFilters"},174:{n:"BrtCustomFilter"},175:{n:"BrtAFilterDateGroupItem"},176:{n:"BrtMergeCell",f:$p},177:{n:"BrtBeginMergeCells"},178:{n:"BrtEndMergeCells"},179:{n:"BrtBeginPivotCacheDef"},180:{n:"BrtEndPivotCacheDef"},181:{n:"BrtBeginPCDFields"},182:{n:"BrtEndPCDFields"},183:{n:"BrtBeginPCDField"},184:{n:"BrtEndPCDField"},185:{n:"BrtBeginPCDSource"},186:{n:"BrtEndPCDSource"},187:{n:"BrtBeginPCDSRange"},188:{n:"BrtEndPCDSRange"},189:{n:"BrtBeginPCDFAtbl"},190:{n:"BrtEndPCDFAtbl"},191:{n:"BrtBeginPCDIRun"},192:{n:"BrtEndPCDIRun"},193:{n:"BrtBeginPivotCacheRecords"},194:{n:"BrtEndPivotCacheRecords"},195:{n:"BrtBeginPCDHierarchies"},196:{n:"BrtEndPCDHierarchies"},197:{n:"BrtBeginPCDHierarchy"},198:{n:"BrtEndPCDHierarchy"},199:{n:"BrtBeginPCDHFieldsUsage"},200:{n:"BrtEndPCDHFieldsUsage"},201:{n:"BrtBeginExtConnection"},202:{n:"BrtEndExtConnection"},203:{n:"BrtBeginECDbProps"},204:{n:"BrtEndECDbProps"},205:{n:"BrtBeginECOlapProps"},206:{n:"BrtEndECOlapProps"},207:{n:"BrtBeginPCDSConsol"},208:{n:"BrtEndPCDSConsol"},209:{n:"BrtBeginPCDSCPages"},210:{n:"BrtEndPCDSCPages"},211:{n:"BrtBeginPCDSCPage"},212:{n:"BrtEndPCDSCPage"},213:{n:"BrtBeginPCDSCPItem"},214:{n:"BrtEndPCDSCPItem"},215:{n:"BrtBeginPCDSCSets"},216:{n:"BrtEndPCDSCSets"},217:{n:"BrtBeginPCDSCSet"},218:{n:"BrtEndPCDSCSet"},219:{n:"BrtBeginPCDFGroup"},220:{n:"BrtEndPCDFGroup"},221:{n:"BrtBeginPCDFGItems"},222:{n:"BrtEndPCDFGItems"},223:{n:"BrtBeginPCDFGRange"},224:{n:"BrtEndPCDFGRange"},225:{n:"BrtBeginPCDFGDiscrete"},226:{n:"BrtEndPCDFGDiscrete"},227:{n:"BrtBeginPCDSDTupleCache"},228:{n:"BrtEndPCDSDTupleCache"},229:{n:"BrtBeginPCDSDTCEntries"},230:{n:"BrtEndPCDSDTCEntries"},231:{n:"BrtBeginPCDSDTCEMembers"},232:{n:"BrtEndPCDSDTCEMembers"},233:{n:"BrtBeginPCDSDTCEMember"},234:{n:"BrtEndPCDSDTCEMember"},235:{n:"BrtBeginPCDSDTCQueries"},236:{n:"BrtEndPCDSDTCQueries"},237:{n:"BrtBeginPCDSDTCQuery"},238:{n:"BrtEndPCDSDTCQuery"},239:{n:"BrtBeginPCDSDTCSets"},240:{n:"BrtEndPCDSDTCSets"},241:{n:"BrtBeginPCDSDTCSet"},242:{n:"BrtEndPCDSDTCSet"},243:{n:"BrtBeginPCDCalcItems"},244:{n:"BrtEndPCDCalcItems"},245:{n:"BrtBeginPCDCalcItem"},246:{n:"BrtEndPCDCalcItem"},247:{n:"BrtBeginPRule"},248:{n:"BrtEndPRule"},249:{n:"BrtBeginPRFilters"},250:{n:"BrtEndPRFilters"},251:{n:"BrtBeginPRFilter"},252:{n:"BrtEndPRFilter"},253:{n:"BrtBeginPNames"},254:{n:"BrtEndPNames"},255:{n:"BrtBeginPName"},256:{n:"BrtEndPName"},257:{n:"BrtBeginPNPairs"},258:{n:"BrtEndPNPairs"},259:{n:"BrtBeginPNPair"},260:{n:"BrtEndPNPair"},261:{n:"BrtBeginECWebProps"},262:{n:"BrtEndECWebProps"},263:{n:"BrtBeginEcWpTables"},264:{n:"BrtEndECWPTables"},265:{n:"BrtBeginECParams"},266:{n:"BrtEndECParams"},267:{n:"BrtBeginECParam"},268:{n:"BrtEndECParam"},269:{n:"BrtBeginPCDKPIs"},270:{n:"BrtEndPCDKPIs"},271:{n:"BrtBeginPCDKPI"},272:{n:"BrtEndPCDKPI"},273:{n:"BrtBeginDims"},274:{n:"BrtEndDims"},275:{n:"BrtBeginDim"},276:{n:"BrtEndDim"},277:{n:"BrtIndexPartEnd"},278:{n:"BrtBeginStyleSheet"},279:{n:"BrtEndStyleSheet"},280:{n:"BrtBeginSXView"},281:{n:"BrtEndSXVI"},282:{n:"BrtBeginSXVI"},283:{n:"BrtBeginSXVIs"},284:{n:"BrtEndSXVIs"},285:{n:"BrtBeginSXVD"},286:{n:"BrtEndSXVD"},287:{n:"BrtBeginSXVDs"},288:{n:"BrtEndSXVDs"},289:{n:"BrtBeginSXPI"},290:{n:"BrtEndSXPI"},291:{n:"BrtBeginSXPIs"},292:{n:"BrtEndSXPIs"},293:{n:"BrtBeginSXDI"},294:{n:"BrtEndSXDI"},295:{n:"BrtBeginSXDIs"},296:{n:"BrtEndSXDIs"},297:{n:"BrtBeginSXLI"},298:{n:"BrtEndSXLI"},299:{n:"BrtBeginSXLIRws"},300:{n:"BrtEndSXLIRws"},301:{n:"BrtBeginSXLICols"},302:{n:"BrtEndSXLICols"},303:{n:"BrtBeginSXFormat"},304:{n:"BrtEndSXFormat"},305:{n:"BrtBeginSXFormats"},306:{n:"BrtEndSxFormats"},307:{n:"BrtBeginSxSelect"},308:{n:"BrtEndSxSelect"},309:{n:"BrtBeginISXVDRws"},310:{n:"BrtEndISXVDRws"},311:{n:"BrtBeginISXVDCols"},312:{n:"BrtEndISXVDCols"},313:{n:"BrtEndSXLocation"},314:{n:"BrtBeginSXLocation"},315:{n:"BrtEndSXView"},316:{n:"BrtBeginSXTHs"},317:{n:"BrtEndSXTHs"},318:{n:"BrtBeginSXTH"},319:{n:"BrtEndSXTH"},320:{n:"BrtBeginISXTHRws"},321:{n:"BrtEndISXTHRws"},322:{n:"BrtBeginISXTHCols"},323:{n:"BrtEndISXTHCols"},324:{n:"BrtBeginSXTDMPS"},325:{n:"BrtEndSXTDMPs"},326:{n:"BrtBeginSXTDMP"},327:{n:"BrtEndSXTDMP"},328:{n:"BrtBeginSXTHItems"},329:{n:"BrtEndSXTHItems"},330:{n:"BrtBeginSXTHItem"},331:{n:"BrtEndSXTHItem"},332:{n:"BrtBeginMetadata"},333:{n:"BrtEndMetadata"},334:{n:"BrtBeginEsmdtinfo"},335:{n:"BrtMdtinfo"},336:{n:"BrtEndEsmdtinfo"},337:{n:"BrtBeginEsmdb"},338:{n:"BrtEndEsmdb"},339:{n:"BrtBeginEsfmd"},340:{n:"BrtEndEsfmd"},341:{n:"BrtBeginSingleCells"},342:{n:"BrtEndSingleCells"},343:{n:"BrtBeginList"},344:{n:"BrtEndList"},345:{n:"BrtBeginListCols"},346:{n:"BrtEndListCols"},347:{n:"BrtBeginListCol"},348:{n:"BrtEndListCol"},349:{n:"BrtBeginListXmlCPr"},350:{n:"BrtEndListXmlCPr"},351:{n:"BrtListCCFmla"},352:{n:"BrtListTrFmla"},353:{n:"BrtBeginExternals"},354:{n:"BrtEndExternals"},355:{n:"BrtSupBookSrc",f:on},357:{n:"BrtSupSelf"},358:{n:"BrtSupSame"},359:{n:"BrtSupTabs"},360:{n:"BrtBeginSupBook"},361:{n:"BrtPlaceholderName"},362:{n:"BrtExternSheet",f:Ad},363:{n:"BrtExternTableStart"},364:{n:"BrtExternTableEnd"},366:{n:"BrtExternRowHdr"},367:{n:"BrtExternCellBlank"},368:{n:"BrtExternCellReal"},369:{n:"BrtExternCellBool"},370:{n:"BrtExternCellError"},371:{n:"BrtExternCellString"},372:{n:"BrtBeginEsmdx"},373:{n:"BrtEndEsmdx"},374:{n:"BrtBeginMdxSet"},375:{n:"BrtEndMdxSet"},376:{n:"BrtBeginMdxMbrProp"},377:{n:"BrtEndMdxMbrProp"},378:{n:"BrtBeginMdxKPI"},379:{n:"BrtEndMdxKPI"},380:{n:"BrtBeginEsstr"},381:{n:"BrtEndEsstr"},382:{n:"BrtBeginPRFItem"},383:{n:"BrtEndPRFItem"},384:{n:"BrtBeginPivotCacheIDs"},385:{n:"BrtEndPivotCacheIDs"},386:{n:"BrtBeginPivotCacheID"},387:{n:"BrtEndPivotCacheID"},388:{n:"BrtBeginISXVIs"},389:{n:"BrtEndISXVIs"},390:{n:"BrtBeginColInfos"},391:{n:"BrtEndColInfos"},392:{n:"BrtBeginRwBrk"},393:{n:"BrtEndRwBrk"},394:{n:"BrtBeginColBrk"},395:{n:"BrtEndColBrk"},396:{n:"BrtBrk"},397:{n:"BrtUserBookView"},398:{n:"BrtInfo"},399:{n:"BrtCUsr"},400:{n:"BrtUsr"},401:{n:"BrtBeginUsers"},403:{n:"BrtEOF"},404:{n:"BrtUCR"},405:{n:"BrtRRInsDel"},406:{n:"BrtRREndInsDel"},407:{n:"BrtRRMove"},408:{n:"BrtRREndMove"},409:{n:"BrtRRChgCell"},410:{n:"BrtRREndChgCell"},411:{n:"BrtRRHeader"},412:{n:"BrtRRUserView"},413:{n:"BrtRRRenSheet"},414:{n:"BrtRRInsertSh"},415:{n:"BrtRRDefName"},416:{n:"BrtRRNote"},417:{n:"BrtRRConflict"},418:{n:"BrtRRTQSIF"},419:{n:"BrtRRFormat"},420:{n:"BrtRREndFormat"},421:{n:"BrtRRAutoFmt"},422:{n:"BrtBeginUserShViews"},423:{n:"BrtBeginUserShView"},424:{n:"BrtEndUserShView"},425:{n:"BrtEndUserShViews"},426:{n:"BrtArrFmla",f:Di},427:{n:"BrtShrFmla",f:Ei},428:{n:"BrtTable"},429:{n:"BrtBeginExtConnections"},430:{n:"BrtEndExtConnections"},431:{n:"BrtBeginPCDCalcMems"},432:{n:"BrtEndPCDCalcMems"},433:{n:"BrtBeginPCDCalcMem"},434:{n:"BrtEndPCDCalcMem"},435:{n:"BrtBeginPCDHGLevels"},436:{n:"BrtEndPCDHGLevels"},437:{n:"BrtBeginPCDHGLevel"},438:{n:"BrtEndPCDHGLevel"},439:{n:"BrtBeginPCDHGLGroups"},440:{n:"BrtEndPCDHGLGroups"},441:{n:"BrtBeginPCDHGLGroup"},442:{n:"BrtEndPCDHGLGroup"},443:{n:"BrtBeginPCDHGLGMembers"},444:{n:"BrtEndPCDHGLGMembers"},445:{n:"BrtBeginPCDHGLGMember"},446:{n:"BrtEndPCDHGLGMember"},447:{n:"BrtBeginQSI"},448:{n:"BrtEndQSI"},449:{n:"BrtBeginQSIR"},450:{n:"BrtEndQSIR"},451:{n:"BrtBeginDeletedNames"},452:{n:"BrtEndDeletedNames"},453:{n:"BrtBeginDeletedName"},454:{n:"BrtEndDeletedName"},455:{n:"BrtBeginQSIFs"},456:{n:"BrtEndQSIFs"},457:{n:"BrtBeginQSIF"},458:{n:"BrtEndQSIF"},459:{n:"BrtBeginAutoSortScope"},460:{n:"BrtEndAutoSortScope"},461:{n:"BrtBeginConditionalFormatting"},462:{n:"BrtEndConditionalFormatting"},463:{n:"BrtBeginCFRule"},464:{n:"BrtEndCFRule"},465:{n:"BrtBeginIconSet"},466:{n:"BrtEndIconSet"},467:{n:"BrtBeginDatabar"},468:{n:"BrtEndDatabar"},469:{n:"BrtBeginColorScale"},470:{n:"BrtEndColorScale"},471:{n:"BrtCFVO"},472:{n:"BrtExternValueMeta"},473:{n:"BrtBeginColorPalette"},474:{n:"BrtEndColorPalette"},475:{n:"BrtIndexedColor"},476:{n:"BrtMargins",f:Gi},477:{n:"BrtPrintOptions"},478:{n:"BrtPageSetup"},479:{n:"BrtBeginHeaderFooter"},480:{n:"BrtEndHeaderFooter"},481:{n:"BrtBeginSXCrtFormat"},482:{n:"BrtEndSXCrtFormat"},483:{n:"BrtBeginSXCrtFormats"},484:{n:"BrtEndSXCrtFormats"},485:{n:"BrtWsFmtInfo",f:gi},486:{n:"BrtBeginMgs"},487:{n:"BrtEndMGs"},488:{n:"BrtBeginMGMaps"},489:{n:"BrtEndMGMaps"},490:{n:"BrtBeginMG"},491:{n:"BrtEndMG"},492:{n:"BrtBeginMap"},493:{n:"BrtEndMap"},494:{n:"BrtHLink",f:Bi},495:{n:"BrtBeginDCon"},496:{n:"BrtEndDCon"},497:{n:"BrtBeginDRefs"},498:{n:"BrtEndDRefs"},499:{n:"BrtDRef"},500:{n:"BrtBeginScenMan"},501:{n:"BrtEndScenMan"},502:{n:"BrtBeginSct"},503:{n:"BrtEndSct"},504:{n:"BrtSlc"},505:{n:"BrtBeginDXFs"},506:{n:"BrtEndDXFs"},507:{n:"BrtDXF"},508:{n:"BrtBeginTableStyles"},509:{n:"BrtEndTableStyles"},510:{n:"BrtBeginTableStyle"},511:{n:"BrtEndTableStyle"},512:{n:"BrtTableStyleElement"},513:{n:"BrtTableStyleClient"},514:{n:"BrtBeginVolDeps"},515:{n:"BrtEndVolDeps"},516:{n:"BrtBeginVolType"},517:{n:"BrtEndVolType"},518:{n:"BrtBeginVolMain"},519:{n:"BrtEndVolMain"},520:{n:"BrtBeginVolTopic"},521:{n:"BrtEndVolTopic"},522:{n:"BrtVolSubtopic"},523:{n:"BrtVolRef"},524:{n:"BrtVolNum"},525:{n:"BrtVolErr"},526:{n:"BrtVolStr"},527:{n:"BrtVolBool"},528:{n:"BrtBeginCalcChain$"},529:{n:"BrtEndCalcChain$"},530:{n:"BrtBeginSortState"},531:{n:"BrtEndSortState"},532:{n:"BrtBeginSortCond"},533:{n:"BrtEndSortCond"},534:{n:"BrtBookProtection"},535:{n:"BrtSheetProtection"},536:{n:"BrtRangeProtection"},537:{n:"BrtPhoneticInfo"},538:{n:"BrtBeginECTxtWiz"},539:{n:"BrtEndECTxtWiz"},540:{n:"BrtBeginECTWFldInfoLst"},541:{n:"BrtEndECTWFldInfoLst"},542:{n:"BrtBeginECTwFldInfo"},548:{n:"BrtFileSharing"},549:{n:"BrtOleSize"},550:{n:"BrtDrawing",f:on},551:{n:"BrtLegacyDrawing"},552:{n:"BrtLegacyDrawingHF"},553:{n:"BrtWebOpt"},554:{n:"BrtBeginWebPubItems"},555:{n:"BrtEndWebPubItems"},556:{n:"BrtBeginWebPubItem"},557:{n:"BrtEndWebPubItem"},558:{n:"BrtBeginSXCondFmt"},559:{n:"BrtEndSXCondFmt"},560:{n:"BrtBeginSXCondFmts"},561:{n:"BrtEndSXCondFmts"},562:{n:"BrtBkHim"},564:{n:"BrtColor"},565:{n:"BrtBeginIndexedColors"},566:{n:"BrtEndIndexedColors"},569:{n:"BrtBeginMRUColors"},570:{n:"BrtEndMRUColors"},572:{n:"BrtMRUColor"},573:{n:"BrtBeginDVals"},574:{n:"BrtEndDVals"},577:{n:"BrtSupNameStart"},578:{n:"BrtSupNameValueStart"},579:{n:"BrtSupNameValueEnd"},580:{n:"BrtSupNameNum"},581:{n:"BrtSupNameErr"},582:{n:"BrtSupNameSt"},583:{n:"BrtSupNameNil"},584:{n:"BrtSupNameBool"},585:{n:"BrtSupNameFmla"},586:{n:"BrtSupNameBits"},587:{n:"BrtSupNameEnd"},588:{n:"BrtEndSupBook"},589:{n:"BrtCellSmartTagProperty"},590:{n:"BrtBeginCellSmartTag"},591:{n:"BrtEndCellSmartTag"},592:{n:"BrtBeginCellSmartTags"},593:{n:"BrtEndCellSmartTags"},594:{n:"BrtBeginSmartTags"},595:{n:"BrtEndSmartTags"},596:{n:"BrtSmartTagType"},597:{n:"BrtBeginSmartTagTypes"},598:{n:"BrtEndSmartTagTypes"},599:{n:"BrtBeginSXFilters"},600:{n:"BrtEndSXFilters"},601:{n:"BrtBeginSXFILTER"},602:{n:"BrtEndSXFilter"},603:{n:"BrtBeginFills"},604:{n:"BrtEndFills"},605:{n:"BrtBeginCellWatches"},606:{n:"BrtEndCellWatches"},607:{n:"BrtCellWatch"},608:{n:"BrtBeginCRErrs"},609:{n:"BrtEndCRErrs"},610:{n:"BrtCrashRecErr"},611:{n:"BrtBeginFonts"},612:{n:"BrtEndFonts"},613:{n:"BrtBeginBorders"},614:{n:"BrtEndBorders"},615:{n:"BrtBeginFmts"},616:{n:"BrtEndFmts"},617:{n:"BrtBeginCellXFs"},618:{n:"BrtEndCellXFs"},619:{n:"BrtBeginStyles"},620:{n:"BrtEndStyles"},625:{n:"BrtBigName"},626:{n:"BrtBeginCellStyleXFs"},627:{n:"BrtEndCellStyleXFs"},628:{n:"BrtBeginComments"},629:{n:"BrtEndComments"},630:{n:"BrtBeginCommentAuthors"},631:{n:"BrtEndCommentAuthors"},632:{n:"BrtCommentAuthor",f:dp},633:{n:"BrtBeginCommentList"},634:{n:"BrtEndCommentList"},635:{n:"BrtBeginComment",f:Zf},636:{n:"BrtEndComment"},637:{n:"BrtCommentText",f:kn},638:{n:"BrtBeginOleObjects"},639:{n:"BrtOleObject"},640:{n:"BrtEndOleObjects"},641:{n:"BrtBeginSxrules"},642:{n:"BrtEndSxRules"},643:{n:"BrtBeginActiveXControls"},644:{n:"BrtActiveX"},645:{n:"BrtEndActiveXControls"},646:{n:"BrtBeginPCDSDTCEMembersSortBy"},648:{n:"BrtBeginCellIgnoreECs"},649:{n:"BrtCellIgnoreEC"},650:{n:"BrtEndCellIgnoreECs"},651:{n:"BrtCsProp",f:aj},652:{n:"BrtCsPageSetup"},653:{n:"BrtBeginUserCsViews"},654:{n:"BrtEndUserCsViews"},655:{n:"BrtBeginUserCsView"},656:{n:"BrtEndUserCsView"},657:{n:"BrtBeginPcdSFCIEntries"},658:{n:"BrtEndPCDSFCIEntries"},659:{n:"BrtPCDSFCIEntry"},660:{n:"BrtBeginListParts"},661:{n:"BrtListPart"},662:{n:"BrtEndListParts"},663:{n:"BrtSheetCalcProp"},664:{n:"BrtBeginFnGroup"},665:{n:"BrtFnGroup"},666:{n:"BrtEndFnGroup"},667:{n:"BrtSupAddin"},668:{n:"BrtSXTDMPOrder"},669:{n:"BrtCsProtection"},671:{n:"BrtBeginWsSortMap"},672:{n:"BrtEndWsSortMap"},673:{n:"BrtBeginRRSort"},674:{n:"BrtEndRRSort"},675:{n:"BrtRRSortItem"},676:{n:"BrtFileSharingIso"},677:{n:"BrtBookProtectionIso"},678:{n:"BrtSheetProtectionIso"},679:{n:"BrtCsProtectionIso"},680:{n:"BrtRangeProtectionIso"},1024:{n:"BrtRwDescent"},1025:{n:"BrtKnownFonts"},1026:{n:"BrtBeginSXTupleSet"},1027:{n:"BrtEndSXTupleSet"},1028:{n:"BrtBeginSXTupleSetHeader"},1029:{n:"BrtEndSXTupleSetHeader"},1030:{n:"BrtSXTupleSetHeaderItem"},1031:{n:"BrtBeginSXTupleSetData"},1032:{n:"BrtEndSXTupleSetData"},1033:{n:"BrtBeginSXTupleSetRow"},1034:{n:"BrtEndSXTupleSetRow"},1035:{n:"BrtSXTupleSetRowItem"},1036:{n:"BrtNameExt"},1037:{n:"BrtPCDH14"},1038:{n:"BrtBeginPCDCalcMem14"},1039:{n:"BrtEndPCDCalcMem14"},1040:{n:"BrtSXTH14"},1041:{n:"BrtBeginSparklineGroup"},1042:{n:"BrtEndSparklineGroup"},1043:{n:"BrtSparkline"},1044:{n:"BrtSXDI14"},1045:{n:"BrtWsFmtInfoEx14"},1046:{n:"BrtBeginConditionalFormatting14"},1047:{n:"BrtEndConditionalFormatting14"},1048:{n:"BrtBeginCFRule14"},1049:{n:"BrtEndCFRule14"},1050:{n:"BrtCFVO14"},1051:{n:"BrtBeginDatabar14"},1052:{n:"BrtBeginIconSet14"},1053:{n:"BrtDVal14"},1054:{n:"BrtBeginDVals14"},1055:{n:"BrtColor14"},1056:{n:"BrtBeginSparklines"},1057:{n:"BrtEndSparklines"},1058:{n:"BrtBeginSparklineGroups"},1059:{n:"BrtEndSparklineGroups"},1061:{n:"BrtSXVD14"},1062:{n:"BrtBeginSXView14"},1063:{n:"BrtEndSXView14"},1064:{n:"BrtBeginSXView16"},1065:{n:"BrtEndSXView16"},1066:{n:"BrtBeginPCD14"},1067:{n:"BrtEndPCD14"},1068:{n:"BrtBeginExtConn14"},1069:{n:"BrtEndExtConn14"},1070:{n:"BrtBeginSlicerCacheIDs"},1071:{n:"BrtEndSlicerCacheIDs"},1072:{n:"BrtBeginSlicerCacheID"},1073:{n:"BrtEndSlicerCacheID"},1075:{n:"BrtBeginSlicerCache"},1076:{n:"BrtEndSlicerCache"},1077:{n:"BrtBeginSlicerCacheDef"},1078:{n:"BrtEndSlicerCacheDef"},1079:{n:"BrtBeginSlicersEx"},1080:{n:"BrtEndSlicersEx"},1081:{n:"BrtBeginSlicerEx"},1082:{n:"BrtEndSlicerEx"},1083:{n:"BrtBeginSlicer"},1084:{n:"BrtEndSlicer"},1085:{n:"BrtSlicerCachePivotTables"},1086:{n:"BrtBeginSlicerCacheOlapImpl"},1087:{n:"BrtEndSlicerCacheOlapImpl"},1088:{n:"BrtBeginSlicerCacheLevelsData"},1089:{n:"BrtEndSlicerCacheLevelsData"},1090:{n:"BrtBeginSlicerCacheLevelData"},1091:{n:"BrtEndSlicerCacheLevelData"},1092:{n:"BrtBeginSlicerCacheSiRanges"},1093:{n:"BrtEndSlicerCacheSiRanges"},1094:{n:"BrtBeginSlicerCacheSiRange"},1095:{n:"BrtEndSlicerCacheSiRange"},1096:{n:"BrtSlicerCacheOlapItem"},1097:{n:"BrtBeginSlicerCacheSelections"},1098:{n:"BrtSlicerCacheSelection"},1099:{n:"BrtEndSlicerCacheSelections"},1100:{n:"BrtBeginSlicerCacheNative"},1101:{n:"BrtEndSlicerCacheNative"},1102:{n:"BrtSlicerCacheNativeItem"},1103:{n:"BrtRangeProtection14"},1104:{n:"BrtRangeProtectionIso14"},1105:{n:"BrtCellIgnoreEC14"},1111:{n:"BrtList14"},1112:{n:"BrtCFIcon"},1113:{n:"BrtBeginSlicerCachesPivotCacheIDs"},1114:{n:"BrtEndSlicerCachesPivotCacheIDs"},1115:{n:"BrtBeginSlicers"},1116:{n:"BrtEndSlicers"},1117:{n:"BrtWbProp14"},1118:{n:"BrtBeginSXEdit"},1119:{n:"BrtEndSXEdit"},1120:{n:"BrtBeginSXEdits"},1121:{n:"BrtEndSXEdits"},1122:{n:"BrtBeginSXChange"},1123:{n:"BrtEndSXChange"},1124:{n:"BrtBeginSXChanges"},1125:{n:"BrtEndSXChanges"},1126:{n:"BrtSXTupleItems"},1128:{n:"BrtBeginSlicerStyle"},1129:{n:"BrtEndSlicerStyle"},1130:{n:"BrtSlicerStyleElement"},1131:{n:"BrtBeginStyleSheetExt14"},1132:{n:"BrtEndStyleSheetExt14"},1133:{n:"BrtBeginSlicerCachesPivotCacheID"},1134:{n:"BrtEndSlicerCachesPivotCacheID"},1135:{n:"BrtBeginConditionalFormattings"},1136:{n:"BrtEndConditionalFormattings"},1137:{n:"BrtBeginPCDCalcMemExt"},1138:{n:"BrtEndPCDCalcMemExt"},1139:{n:"BrtBeginPCDCalcMemsExt"},1140:{n:"BrtEndPCDCalcMemsExt"},1141:{n:"BrtPCDField14"},1142:{n:"BrtBeginSlicerStyles"},1143:{n:"BrtEndSlicerStyles"},1144:{n:"BrtBeginSlicerStyleElements"},1145:{n:"BrtEndSlicerStyleElements"},1146:{n:"BrtCFRuleExt"},1147:{n:"BrtBeginSXCondFmt14"},1148:{n:"BrtEndSXCondFmt14"},1149:{n:"BrtBeginSXCondFmts14"},1150:{n:"BrtEndSXCondFmts14"},1152:{n:"BrtBeginSortCond14"},1153:{n:"BrtEndSortCond14"},1154:{n:"BrtEndDVals14"},1155:{n:"BrtEndIconSet14"},1156:{n:"BrtEndDatabar14"},1157:{n:"BrtBeginColorScale14"},1158:{n:"BrtEndColorScale14"},1159:{n:"BrtBeginSxrules14"},1160:{n:"BrtEndSxrules14"},1161:{n:"BrtBeginPRule14"},1162:{n:"BrtEndPRule14"},1163:{n:"BrtBeginPRFilters14"},1164:{n:"BrtEndPRFilters14"},1165:{n:"BrtBeginPRFilter14"},1166:{n:"BrtEndPRFilter14"},1167:{n:"BrtBeginPRFItem14"},1168:{n:"BrtEndPRFItem14"},1169:{n:"BrtBeginCellIgnoreECs14"},1170:{n:"BrtEndCellIgnoreECs14"},1171:{n:"BrtDxf14"},1172:{n:"BrtBeginDxF14s"},1173:{n:"BrtEndDxf14s"},1177:{n:"BrtFilter14"},1178:{n:"BrtBeginCustomFilters14"},1180:{n:"BrtCustomFilter14"},1181:{n:"BrtIconFilter14"},1182:{n:"BrtPivotCacheConnectionName"},2048:{n:"BrtBeginDecoupledPivotCacheIDs"},2049:{n:"BrtEndDecoupledPivotCacheIDs"},2050:{n:"BrtDecoupledPivotCacheID"},2051:{n:"BrtBeginPivotTableRefs"},2052:{n:"BrtEndPivotTableRefs"},2053:{n:"BrtPivotTableRef"},2054:{n:"BrtSlicerCacheBookPivotTables"},2055:{n:"BrtBeginSxvcells"},2056:{n:"BrtEndSxvcells"},2057:{n:"BrtBeginSxRow"},2058:{n:"BrtEndSxRow"},2060:{n:"BrtPcdCalcMem15"},2067:{n:"BrtQsi15"},2068:{n:"BrtBeginWebExtensions"},2069:{n:"BrtEndWebExtensions"},2070:{n:"BrtWebExtension"},2071:{n:"BrtAbsPath15"},2072:{n:"BrtBeginPivotTableUISettings"},2073:{n:"BrtEndPivotTableUISettings"},2075:{n:"BrtTableSlicerCacheIDs"},2076:{n:"BrtTableSlicerCacheID"},2077:{n:"BrtBeginTableSlicerCache"},2078:{n:"BrtEndTableSlicerCache"},2079:{n:"BrtSxFilter15"},2080:{n:"BrtBeginTimelineCachePivotCacheIDs"},2081:{n:"BrtEndTimelineCachePivotCacheIDs"},2082:{n:"BrtTimelineCachePivotCacheID"},2083:{n:"BrtBeginTimelineCacheIDs"},2084:{n:"BrtEndTimelineCacheIDs"},2085:{n:"BrtBeginTimelineCacheID"},2086:{n:"BrtEndTimelineCacheID"},2087:{n:"BrtBeginTimelinesEx"},2088:{n:"BrtEndTimelinesEx"},2089:{n:"BrtBeginTimelineEx"},2090:{n:"BrtEndTimelineEx"},2091:{n:"BrtWorkBookPr15"},2092:{n:"BrtPCDH15"},2093:{n:"BrtBeginTimelineStyle"},2094:{n:"BrtEndTimelineStyle"},2095:{n:"BrtTimelineStyleElement"},2096:{n:"BrtBeginTimelineStylesheetExt15"},2097:{n:"BrtEndTimelineStylesheetExt15"},2098:{n:"BrtBeginTimelineStyles"},2099:{n:"BrtEndTimelineStyles"},2100:{n:"BrtBeginTimelineStyleElements"},2101:{n:"BrtEndTimelineStyleElements"},2102:{n:"BrtDxf15"},2103:{n:"BrtBeginDxfs15"},2104:{n:"brtEndDxfs15"},2105:{n:"BrtSlicerCacheHideItemsWithNoData"},2106:{n:"BrtBeginItemUniqueNames"},2107:{n:"BrtEndItemUniqueNames"},2108:{n:"BrtItemUniqueName"},2109:{n:"BrtBeginExtConn15"},2110:{n:"BrtEndExtConn15"},2111:{n:"BrtBeginOledbPr15"},2112:{n:"BrtEndOledbPr15"},2113:{n:"BrtBeginDataFeedPr15"},2114:{n:"BrtEndDataFeedPr15"},2115:{n:"BrtTextPr15"},2116:{n:"BrtRangePr15"},2117:{n:"BrtDbCommand15"},2118:{n:"BrtBeginDbTables15"},2119:{n:"BrtEndDbTables15"},2120:{n:"BrtDbTable15"},2121:{n:"BrtBeginDataModel"},2122:{n:"BrtEndDataModel"},2123:{n:"BrtBeginModelTables"},2124:{n:"BrtEndModelTables"},2125:{n:"BrtModelTable"},2126:{n:"BrtBeginModelRelationships"},2127:{n:"BrtEndModelRelationships"},2128:{n:"BrtModelRelationship"},2129:{n:"BrtBeginECTxtWiz15"},2130:{n:"BrtEndECTxtWiz15"},2131:{n:"BrtBeginECTWFldInfoLst15"},2132:{n:"BrtEndECTWFldInfoLst15"},2133:{n:"BrtBeginECTWFldInfo15"},2134:{n:"BrtFieldListActiveItem"},2135:{n:"BrtPivotCacheIdVersion"},2136:{n:"BrtSXDI15"},2137:{n:"BrtBeginModelTimeGroupings"},2138:{n:"BrtEndModelTimeGroupings"},2139:{n:"BrtBeginModelTimeGrouping"},2140:{n:"BrtEndModelTimeGrouping"},2141:{n:"BrtModelTimeGroupingCalcCol"},3072:{n:"BrtUid"},3073:{n:"BrtRevisionPtr"},5095:{n:"BrtBeginCalcFeatures"},5096:{n:"BrtEndCalcFeatures"},5097:{n:"BrtCalcFeature"},65535:{n:""}},oq=s(nq,"n"),pq={3:{n:"BIFF2NUM",f:ae},4:{n:"BIFF2STR",f:_d},6:{n:"Formula",f:Ch},9:{n:"BOF",f:Mc},10:{n:"EOF",f:$b},12:{n:"CalcCount",f:dc},13:{n:"CalcMode",f:dc},14:{n:"CalcPrecision",f:bc},15:{n:"CalcRefMode",f:bc},16:{n:"CalcDelta",f:Za},17:{n:"CalcIter",f:bc},18:{n:"Protect",f:bc},19:{n:"Password",f:dc},20:{n:"Header",f:lo},21:{n:"Footer",f:lo},23:{n:"ExternSheet",f:Ad},24:{n:"Lbl",f:zd},25:{n:"WinProtect",f:bc},26:{n:"VerticalPageBreaks"},27:{n:"HorizontalPageBreaks"},28:{n:"Note",f:Hd},29:{n:"Selection"},34:{n:"Date1904",f:bc},35:{n:"ExternName",f:yd},38:{n:"LeftMargin",f:Za},39:{n:"RightMargin",f:Za},40:{n:"TopMargin",f:Za},41:{n:"BottomMargin",f:Za},42:{n:"PrintRowCol",f:bc},43:{n:"PrintGrid",f:bc},47:{n:"FilePass",f:Ie},49:{n:"Font",f:cd},51:{n:"PrintSize",f:dc},60:{n:"Continue"},61:{n:"Window1",f:$c},64:{n:"Backup",f:bc},65:{n:"Pane"},66:{n:"CodePage",f:dc},77:{n:"Pls"},80:{n:"DCon"},81:{n:"DConRef"},82:{n:"DConName"},85:{n:"DefColWidth",f:dc},89:{n:"XCT"},90:{n:"CRN"},91:{n:"FileSharing"},92:{n:"WriteAccess",f:Pc},93:{n:"Obj",f:Kd},94:{n:"Uncalced"},95:{n:"CalcSaveRecalc",f:bc},96:{n:"Template"},97:{n:"Intl"},99:{n:"ObjProtect",f:bc},125:{n:"ColInfo",f:Wd},128:{n:"Guts",f:rd},129:{n:"WsBool",f:Rc},130:{n:"GridSet",f:dc},131:{n:"HCenter",f:bc},132:{n:"VCenter",f:bc},133:{n:"BoundSheet8",f:Sc},134:{n:"WriteProtect"},140:{n:"Country",f:Rd},141:{n:"HideObj",f:dc},144:{n:"Sort"},146:{n:"Palette",f:Ud},151:{n:"Sync"},152:{n:"LPr"},153:{n:"DxGCol"},154:{n:"FnGroupName"},155:{n:"FilterMode"},156:{n:"BuiltInFnGroupCount",f:dc},157:{n:"AutoFilterInfo"},158:{n:"AutoFilter"},160:{n:"Scl",f:po},161:{n:"Setup",f:Xd},174:{n:"ScenMan"},175:{n:"SCENARIO"},176:{n:"SxView"},177:{n:"Sxvd"},178:{n:"SXVI"},180:{n:"SxIvd"},181:{n:"SXLI"},182:{n:"SXPI"},184:{n:"DocRoute"},185:{n:"RecipName"},189:{n:"MulRk",f:md},190:{n:"MulBlank",f:nd},193:{n:"Mms",f:$b},197:{n:"SXDI"},198:{n:"SXDB"},199:{n:"SXFDB"},200:{n:"SXDBB"},201:{n:"SXNum"},202:{n:"SxBool",f:bc},203:{n:"SxErr"},204:{n:"SXInt"},205:{n:"SXString"},206:{n:"SXDtr"},207:{n:"SxNil"},208:{n:"SXTbl"},209:{n:"SXTBRGIITM"},210:{n:"SxTbpg"},211:{n:"ObProj"},213:{n:"SXStreamID"},215:{n:"DBCell"},216:{n:"SXRng"},217:{n:"SxIsxoper"},218:{n:"BookBool",f:dc},220:{n:"DbOrParamQry"},221:{n:"ScenarioProtect",f:bc},222:{n:"OleObjectSize"},224:{n:"XF",f:pd},225:{n:"InterfaceHdr",f:Oc},226:{n:"InterfaceEnd",f:$b},227:{n:"SXVS"},229:{n:"MergeCells",f:Id},233:{n:"BkHim"},235:{n:"MsoDrawingGroup"},236:{n:"MsoDrawing"},237:{n:"MsoDrawingSelection"},239:{n:"PhoneticInfo"},240:{n:"SxRule"},241:{n:"SXEx"},242:{n:"SxFilt"},244:{n:"SxDXF"},245:{n:"SxItm"},246:{n:"SxName"},247:{n:"SxSelect"},248:{n:"SXPair"},249:{n:"SxFmla"},251:{n:"SxFormat"},252:{n:"SST",f:Uc},253:{n:"LabelSst",f:ed},255:{n:"ExtSST",f:Vc},256:{n:"SXVDEx"},259:{n:"SXFormula"},290:{n:"SXDBEx"},311:{n:"RRDInsDel"},312:{n:"RRDHead"},315:{n:"RRDChgCell"},317:{n:"RRTabId",f:fc},318:{n:"RRDRenSheet"},319:{n:"RRSort"},320:{n:"RRDMove"},330:{n:"RRFormat"},331:{n:"RRAutoFmt"},333:{n:"RRInsertSh"},334:{n:"RRDMoveBegin"},335:{n:"RRDMoveEnd"},336:{n:"RRDInsDelBegin"},337:{n:"RRDInsDelEnd"},338:{n:"RRDConflict"},339:{n:"RRDDefName"},340:{n:"RRDRstEtxp"},351:{n:"LRng"},352:{n:"UsesELFs",f:bc},353:{n:"DSF",f:$b},401:{n:"CUsr"},402:{n:"CbUsr"},403:{n:"UsrInfo"},404:{n:"UsrExcl"},405:{n:"FileLock"},406:{n:"RRDInfo"},407:{n:"BCUsrs"},408:{n:"UsrChk"},425:{n:"UserBView"},426:{n:"UserSViewBegin"},427:{n:"UserSViewEnd"},428:{n:"RRDUserView"},429:{n:"Qsi"},430:{n:"SupBook",f:xd},431:{n:"Prot4Rev",f:bc},432:{n:"CondFmt"},433:{n:"CF"},434:{n:"DVal"},437:{n:"DConBin"},438:{n:"TxO",f:Md},439:{n:"RefreshAll",f:bc},440:{n:"HLink",f:Nd},441:{n:"Lel"},442:{n:"CodeName",f:lc},443:{n:"SXFDBType"},444:{n:"Prot4RevPass",f:dc},445:{n:"ObNoMacros"},446:{n:"Dv"},448:{n:"Excel9File",f:$b},449:{n:"RecalcId",f:Yc,r:2},450:{n:"EntExU2",f:$b},512:{n:"Dimensions",f:jd},513:{n:"Blank",f:oo},515:{n:"Number",f:vd},516:{n:"Label",f:fd},517:{n:"BoolErr",f:td},518:{n:"Formula",f:Ch},519:{n:"String",f:qo},520:{n:"Row",f:Wc},523:{n:"Index"},545:{n:"Array",f:Ed},549:{n:"DefaultRowHeight",f:Zc},566:{n:"Table"},574:{n:"Window2",f:ad},638:{n:"RK",f:ld},659:{n:"Style"},1030:{n:"Formula",f:Ch},1048:{n:"BigName"},1054:{n:"Format",f:hd},1084:{n:"ContinueBigName"},1212:{n:"ShrFmla",f:Dd},2048:{n:"HLinkTooltip",f:Pd},2049:{n:"WebPub"},2050:{n:"QsiSXTag"},2051:{n:"DBQueryExt"},2052:{n:"ExtString"},2053:{n:"TxtQry"},2054:{n:"Qsir"},2055:{n:"Qsif"},2056:{n:"RRDTQSIF"},2057:{n:"BOF",f:Mc},2058:{n:"OleDbConn"},2059:{n:"WOpt"},2060:{n:"SXViewEx"},2061:{n:"SXTH"},2062:{n:"SXPIEx"},2063:{n:"SXVDTEx"},2064:{n:"SXViewEx9"},2066:{n:"ContinueFrt"},2067:{n:"RealTimeData"},2128:{n:"ChartFrtInfo"},2129:{n:"FrtWrapper"},2130:{n:"StartBlock"},2131:{n:"EndBlock"},2132:{n:"StartObject"},2133:{n:"EndObject"},2134:{n:"CatLab"},2135:{n:"YMult"},2136:{n:"SXViewLink"},2137:{n:"PivotChartBits"},2138:{n:"FrtFontList"},2146:{n:"SheetExt"},2147:{n:"BookExt",r:12},2148:{n:"SXAddl"},2149:{n:"CrErr"},2150:{n:"HFPicture"},2151:{n:"FeatHdr",f:$b},2152:{n:"Feat"},2154:{n:"DataLabExt"},2155:{n:"DataLabExtContents"},2156:{n:"CellWatch"},2161:{n:"FeatHdr11"},2162:{n:"Feature11"},2164:{n:"DropDownObjIds"},2165:{n:"ContinueFrt11"},2166:{n:"DConn"},2167:{n:"List12"},2168:{n:"Feature12"},2169:{n:"CondFmt12"},2170:{n:"CF12"},2171:{n:"CFEx"},2172:{n:"XFCRC",f:Vd,r:12},2173:{n:"XFExt",f:Mf,r:12},2174:{n:"AutoFilter12"},2175:{n:"ContinueFrt12"},2180:{n:"MDTInfo"},2181:{n:"MDXStr"},2182:{n:"MDXTuple"},2183:{n:"MDXSet"},2184:{n:"MDXProp"},2185:{n:"MDXKPI"},2186:{n:"MDB"},2187:{n:"PLV"},2188:{n:"Compat12",f:bc,r:12},2189:{n:"DXF"},2190:{n:"TableStyles",r:12},2191:{n:"TableStyle"},2192:{n:"TableStyleElement"},2194:{n:"StyleExt"},2195:{n:"NamePublish"},2196:{n:"NameCmt",f:Cd,r:12},2197:{n:"SortData"},2198:{n:"Theme",f:Gf,r:12},2199:{n:"GUIDTypeLib"},2200:{n:"FnGrp12"},2201:{n:"NameFnGrp12"},2202:{n:"MTRSettings",f:Fd,r:12},2203:{n:"CompressPictures",f:$b},2204:{n:"HeaderFooter"},2205:{n:"CrtLayout12"},2206:{n:"CrtMlFrt"},2207:{n:"CrtMlFrtContinue"},2211:{n:"ForceFullCalculation",f:Xc},2212:{n:"ShapePropsStream"},2213:{n:"TextPropsStream"},2214:{n:"RichTextStream"},2215:{n:"CrtLayout12A"},4097:{n:"Units"},4098:{n:"Chart"},4099:{n:"Series"},4102:{n:"DataFormat"},4103:{n:"LineFormat"},4105:{n:"MarkerFormat"},4106:{n:"AreaFormat"},4107:{n:"PieFormat"},4108:{n:"AttachedLabel"},4109:{n:"SeriesText"},4116:{n:"ChartFormat"},4117:{n:"Legend"},4118:{n:"SeriesList"},4119:{n:"Bar"},4120:{n:"Line"},4121:{n:"Pie"},4122:{n:"Area"},4123:{n:"Scatter"},4124:{n:"CrtLine"},4125:{n:"Axis"},4126:{n:"Tick"},4127:{n:"ValueRange"},4128:{n:"CatSerRange"},4129:{n:"AxisLine"},4130:{n:"CrtLink"},4132:{n:"DefaultText"},4133:{n:"Text"},4134:{n:"FontX",f:dc},4135:{n:"ObjectLink"},4146:{n:"Frame"},4147:{n:"Begin"},4148:{n:"End"},4149:{n:"PlotArea"},4154:{n:"Chart3d"},4156:{n:"PicF"},4157:{n:"DropBar"},4158:{n:"Radar"},4159:{n:"Surf"},4160:{n:"RadarArea"},4161:{n:"AxisParent"},4163:{n:"LegendException"},4164:{n:"ShtProps",f:Yd},4165:{n:"SerToCrt"},4166:{n:"AxesUsed"},4168:{n:"SBaseRef"},4170:{n:"SerParent"},4171:{n:"SerAuxTrend"},4174:{n:"IFmtRecord"},4175:{n:"Pos"},4176:{n:"AlRuns"},4177:{n:"BRAI"},4187:{n:"SerAuxErrBar"},4188:{n:"ClrtClient",f:Td},4189:{n:"SerFmt"},4191:{n:"Chart3DBarShape"},4192:{n:"Fbi"},4193:{n:"BopPop"},4194:{n:"AxcExt"},4195:{n:"Dat"},4196:{n:"PlotGrowth"},4197:{n:"SIIndex"},4198:{n:"GelFrame"},4199:{n:"BopPopCustom"},4200:{n:"Fbi2"},0:{n:"Dimensions",f:jd},2:{n:"BIFF2INT",f:ce},5:{n:"BoolErr",f:td},7:{n:"String",f:ee},8:{n:"BIFF2ROW"},11:{n:"Index"},22:{n:"ExternCount",f:dc},30:{n:"BIFF2FORMAT",f:ko},31:{n:"BIFF2FMTCNT"},32:{n:"BIFF2COLINFO"},33:{n:"Array",f:Ed},37:{n:"DefaultRowHeight",f:Zc},50:{n:"BIFF2FONTXTRA",f:fe},52:{n:"DDEObjName"},62:{n:"BIFF2WINDOW2"},67:{n:"BIFF2XF"},69:{n:"BIFF2FONTCLR"},86:{n:"BIFF4FMTCNT"},126:{n:"RK"},127:{n:"ImData",f:$d},135:{n:"Addin"},136:{n:"Edg"},137:{n:"Pub"},145:{n:"Sub"},148:{n:"LHRecord"},149:{n:"LHNGraph"},150:{n:"Sound"},169:{n:"CoordList"},171:{n:"GCW"},188:{n:"ShrFmla"},191:{n:"ToolbarHdr"},192:{n:"ToolbarEnd"},194:{n:"AddMenu"},195:{n:"DelMenu"},214:{n:"RString",f:ge},223:{n:"UDDesc"},234:{n:"TabIdConf"},354:{n:"XL5Modify"},421:{n:"FileSharing2"},521:{n:"BOF",f:Mc},536:{n:"Lbl",f:zd},547:{n:"ExternName",f:yd},561:{n:"Font"},579:{n:"BIFF3XF"},1033:{n:"BOF",f:Mc},1091:{n:"BIFF4XF"},2157:{n:"FeatInfo"},2163:{n:"FeatInfo11"},2177:{n:"SXAddl12"},2240:{n:"AutoWebPub"},2241:{n:"ListObj"},2242:{n:"ListField"},2243:{n:"ListDV"},2244:{n:"ListCondFmt"},2245:{n:"ListCF"},2246:{n:"FMQry"},2247:{n:"FMSQry"},2248:{n:"PLV"},2249:{n:"LnExt"},2250:{n:"MkrExt"},2251:{n:"CrtCoopt"},2262:{n:"FRTArchId$",r:12},29282:{}},qq=s(pq,"n"),rq=function(){function a(a,b){var c=b||{};null!=Jl&&null==c.dense&&(c.dense=Jl);var d=c.dense?[]:{},e=a.match(/");var f=a.match(/<\/table/i),g=e.index,h=f&&f.index||a.length,i=F(a.slice(g,h),/(:?]*>)/i,""),j=-1,k=0,l=0,m=0,n={s:{r:1e7,c:1e7},e:{r:0,c:0}},o=[];for(g=0;g/i);for(h=0;h"))>-1;)t=t.slice(u+1);var v=P(s.slice(0,s.indexOf(">")));m=v.colspan?+v.colspan:1,((l=+v.rowspan)>1||m>1)&&o.push({s:{r:j,c:k},e:{r:j+(l||1)-1,c:k+m-1}});var x=v.t||"";if(t.length){if(t=zm(t),n.s.r>j&&(n.s.r=j),n.e.rk&&(n.s.c=k),n.e.cc||e[j].s.c>g||e[j].e.r1&&(m.rowspan=h),i>1&&(m.colspan=i);var n=l&&null!=l.v&&(l.h||T(l.w||(Fa(l),l.w)||""))||"";m.t=l&&l.t||"z",d.editable&&(n=''+n+""),m.id="sjs-"+k,f.push(Z("td",n,m))}}return""+f.join("")+""}function d(a,b,c){return[].join("")+""}function e(a,b){var e=b||{},h=null!=e.header?e.header:f,i=null!=e.footer?e.footer:g,j=[h],k=Ba(a["!ref"]);e.dense=Array.isArray(a),j.push(d(a,k,e));for(var l=k.s.r;l<=k.e.r;++l)j.push(c(a,k,l,e));return j.push("
          "+i),j.join("")}var f='SheetJS Table Export',g="";return{to_workbook:b,to_sheet:a,_row:c,BEGIN:f,END:g,_preamble:d,from_sheet:e}}(),sq=function(){var a=function(a){var b=a.replace(/[\t\r\n]/g," ").trim().replace(/ +/g," ").replace(//g," ").replace(//g,function(a,b){return Array(parseInt(b,10)+1).join(" ")}).replace(/]*\/>/g,"\t").replace(//g,"\n");return[nm(b.replace(/<[^>]*>/g,""))]},b={day:["d","dd"],month:["m","mm"],year:["y","yy"],hours:["h","hh"],minutes:["m","mm"],seconds:["s","ss"],"am-pm":["A/P","AM/PM"],"day-of-week":["ddd","dddd"],era:["e","ee"],quarter:["\\Qm",'m\\"th quarter"']};return function(c,d){var e=d||{};null!=Jl&&null==e.dense&&(e.dense=Jl);var f,g,h,i,j,k,l,m=Vj(c),n=[],o={name:""},p="",q=0,r={},s=[],t=e.dense?[]:{},u={value:""},v="",x=0,A=[],C=-1,D=-1,E={s:{r:1e6,c:1e7},e:{r:0,c:0}},F=0,G={},H=[],I={},J=0,K=0,L=[],M=1,N=1,O=[],Q={Names:[]},R={},S=["",""],T=[],U={},W="",X=0,Y=!1,Z=!1,$=0;for(lq.lastIndex=0,m=m.replace(//gm,"").replace(//gm,"");j=lq.exec(m);)switch(j[3]=j[3].replace(/_.*$/,"")){case"table":case"工作表":"/"===j[1]?(E.e.c>=E.s.c&&E.e.r>=E.s.r&&(t["!ref"]=Ca(E)),e.sheetRows>0&&e.sheetRows<=E.e.r&&(t["!fullref"]=t["!ref"],E.e.r=e.sheetRows-1,t["!ref"]=Ca(E)),H.length&&(t["!merges"]=H),L.length&&(t["!rows"]=L),h.name=h["名称"]||h.name,"undefined"!=typeof JSON&&JSON.stringify(h),s.push(h.name),r[h.name]=t,Z=!1):"/"!==j[0].charAt(j[0].length-2)&&(h=P(j[0],!1),C=D=-1,E.s.r=E.s.c=1e7,E.e.r=E.e.c=0,t=e.dense?[]:{},H=[],L=[],Z=!0);break;case"table-row-group":"/"===j[1]?--F:++F;break;case"table-row":case"行":if("/"===j[1]){C+=M,M=1;break}if(i=P(j[0],!1),i["行号"]?C=i["行号"]-1:-1==C&&(C=0),(M=+i["number-rows-repeated"]||1)<10)for($=0;$0&&(L[C+$]={level:F});D=-1;break;case"covered-table-cell":"/"!==j[1]&&++D,e.sheetStubs&&(e.dense?(t[C]||(t[C]=[]),t[C][D]={t:"z"}):t[Aa({r:C,c:D})]={t:"z"}),v="",A=[];break;case"table-cell":case"数据":if("/"===j[0].charAt(j[0].length-2))++D,u=P(j[0],!1),N=parseInt(u["number-columns-repeated"]||"1",10),k={t:"z",v:null},u.formula&&0!=e.cellFormula&&(k.f=Eh(nm(u.formula))),"string"==(u["数据类型"]||u["value-type"])&&(k.t="s",k.v=nm(u["string-value"]||""),e.dense?(t[C]||(t[C]=[]),t[C][D]=k):t[Aa({r:C,c:D})]=k),D+=N-1;else if("/"!==j[1]){++D,N=1;var _=M?C+M-1:C;if(D>E.e.c&&(E.e.c=D),DE.e.r&&(E.e.r=_),u=P(j[0],!1),T=[],U={},k={t:u["数据类型"]||u["value-type"],v:null},e.cellFormula)if(u.formula&&(u.formula=nm(u.formula)),u["number-matrix-columns-spanned"]&&u["number-matrix-rows-spanned"]&&(J=parseInt(u["number-matrix-rows-spanned"],10)||0,K=parseInt(u["number-matrix-columns-spanned"],10)||0,I={s:{r:C,c:D},e:{r:C+J-1,c:D+K-1}},k.F=Ca(I),O.push([I,k.F])),u.formula)k.f=Eh(u.formula);else for($=0;$=O[$][0].s.r&&C<=O[$][0].e.r&&D>=O[$][0].s.c&&D<=O[$][0].e.c&&(k.F=O[$][1]);switch((u["number-columns-spanned"]||u["number-rows-spanned"])&&(J=parseInt(u["number-rows-spanned"],10)||0,K=parseInt(u["number-columns-spanned"],10)||0,I={s:{r:C,c:D},e:{r:C+J-1,c:D+K-1}},H.push(I)),u["number-columns-repeated"]&&(N=parseInt(u["number-columns-repeated"],10)),k.t){case"boolean":k.t="b",k.v=V(u["boolean-value"]);break;case"float":case"percentage":case"currency":k.t="n",k.v=parseFloat(u.value);break;case"date":k.t="d",k.v=z(u["date-value"]),e.cellDates||(k.t="n",k.v=w(k.v)),k.z="m/d/yy";break;case"time":k.t="n",k.v=y(u["time-value"])/86400;break;case"number":k.t="n",k.v=parseFloat(u["数据数值"]);break;default:if("string"!==k.t&&"text"!==k.t&&k.t)throw new Error("Unsupported value type "+k.t);k.t="s",null!=u["string-value"]&&(v=nm(u["string-value"]),A=[])}}else{if(Y=!1,"s"===k.t&&(k.v=v||"",A.length&&(k.R=A),Y=0==x),R.Target&&(k.l=R),T.length>0&&(k.c=T,T=[]),v&&!1!==e.cellText&&(k.w=v),(!Y||e.sheetStubs)&&!(e.sheetRows&&e.sheetRows<=C))for(var aa=0;aa0;)t[C+aa][D+N]=B(k);else for(t[Aa({r:C+aa,c:D})]=k;--N>0;)t[Aa({r:C+aa,c:D+N})]=B(k);E.e.c<=D&&(E.e.c=D)}N=parseInt(u["number-columns-repeated"]||"1",10),D+=N-1,N=0,k={},v="",A=[]}R={};break;case"document":case"document-content":case"电子表格文档":case"spreadsheet":case"主体":case"scripts":case"styles":case"font-face-decls":if("/"===j[1]){if((f=n.pop())[0]!==j[3])throw"Bad state: "+f}else"/"!==j[0].charAt(j[0].length-2)&&n.push([j[3],!0]);break;case"annotation":if("/"===j[1]){if((f=n.pop())[0]!==j[3])throw"Bad state: "+f;U.t=v,A.length&&(U.R=A),U.a=W,T.push(U)}else"/"!==j[0].charAt(j[0].length-2)&&n.push([j[3],!1]);W="",X=0,v="",x=0,A=[];break;case"creator":"/"===j[1]?W=m.slice(X,j.index):X=j.index+j[0].length;break;case"meta":case"元数据":case"settings":case"config-item-set":case"config-item-map-indexed":case"config-item-map-entry":case"config-item-map-named":case"shapes":case"frame":case"text-box":case"image":case"data-pilot-tables":case"list-style":case"form":case"dde-links":case"event-listeners":case"chart":if("/"===j[1]){if((f=n.pop())[0]!==j[3])throw"Bad state: "+f}else"/"!==j[0].charAt(j[0].length-2)&&n.push([j[3],!1]);v="",x=0,A=[];break;case"scientific-number":case"currency-symbol":case"currency-style":break;case"number-style":case"percentage-style":case"date-style":case"time-style":if("/"===j[1]){if(G[o.name]=p,(f=n.pop())[0]!==j[3])throw"Bad state: "+f}else"/"!==j[0].charAt(j[0].length-2)&&(p="",o=P(j[0],!1),n.push([j[3],!0]));break;case"script":case"libraries":case"automatic-styles":case"master-styles":break;case"default-style":case"page-layout":case"style":case"map":case"font-face":case"paragraph-properties":case"table-properties":case"table-column-properties":case"table-row-properties":case"table-cell-properties":break;case"number":switch(n[n.length-1][0]){case"time-style":case"date-style":g=P(j[0],!1),p+=b[j[3]]["long"===g.style?1:0]}break;case"fraction":break;case"day":case"month":case"year":case"era":case"day-of-week":case"week-of-year":case"quarter":case"hours":case"minutes":case"seconds":case"am-pm":switch(n[n.length-1][0]){case"time-style":case"date-style":g=P(j[0],!1),p+=b[j[3]]["long"===g.style?1:0]}break;case"boolean-style":case"boolean":case"text-style":break;case"text":if("/>"===j[0].slice(-2))break;if("/"===j[1])switch(n[n.length-1][0]){case"number-style":case"date-style":case"time-style":p+=m.slice(q,j.index)}else q=j.index+j[0].length;break;case"named-range":g=P(j[0],!1),S=Gh(g["cell-range-address"]);var ba={Name:g.name,Ref:S[0]+"!"+S[1]};Z&&(ba.Sheet=s.length),Q.Names.push(ba);break;case"text-content":case"text-properties":case"embedded-text":break;case"body":case"电子表格":case"forms":case"table-column":case"table-header-rows":case"table-rows":case"table-column-group":case"table-header-columns":case"table-columns":case"null-date":case"graphic-properties":case"calculation-settings":case"named-expressions":case"label-range":case"label-ranges":case"named-expression":case"sort":case"sort-by":case"sort-groups":case"tab":case"line-break":case"span":break;case"p":case"文本串":if("/"!==j[1]||u&&u["string-value"])l=P(j[0],!1),x=j.index+j[0].length;else{var ca=a(m.slice(x,j.index),l);v=(v.length>0?v+"\n":"")+ca[0]}break;case"s":break;case"database-range":if("/"===j[1])break;try{S=Gh(P(j[0])["target-range-address"]),r[S[0]]["!autofilter"]={ref:S[1]}}catch(a){}break;case"date":case"object":break;case"title":case"标题":case"desc":case"binary-data":case"table-source":case"scenario":case"iteration":case"content-validations":case"content-validation":case"help-message":case"error-message":case"database-ranges":case"filter":case"filter-and":case"filter-or":case"filter-condition":case"list-level-style-bullet":case"list-level-style-number":case"list-level-properties":break;case"sender-firstname":case"sender-lastname":case"sender-initials":case"sender-title":case"sender-position":case"sender-email":case"sender-phone-private":case"sender-fax":case"sender-company":case"sender-phone-work":case"sender-street":case"sender-city":case"sender-postal-code":case"sender-country":case"sender-state-or-province":case"author-name":case"author-initials":case"chapter":case"file-name":case"template-name":case"sheet-name":case"event-listener":break;case"initial-creator":case"creation-date":case"print-date":case"generator":case"document-statistic":case"user-defined":case"editing-duration":case"editing-cycles":case"config-item":case"page-number":case"page-count":case"time":case"cell-range-source":case"detective":case"operation":case"highlighted-range":break;case"data-pilot-table":case"source-cell-range":case"source-service":case"data-pilot-field":case"data-pilot-level":case"data-pilot-subtotals":case"data-pilot-subtotal":case"data-pilot-members":case"data-pilot-member":case"data-pilot-display-info":case"data-pilot-sort-info":case"data-pilot-layout-info":case"data-pilot-field-reference":case"data-pilot-groups":case"data-pilot-group":case"data-pilot-group-member":case"rect":break;case"dde-connection-decls":case"dde-connection-decl":case"dde-link":case"dde-source":case"properties":case"property":break;case"a":if("/"!==j[1]){if(R=P(j[0],!1),!R.href)break;R.Target=R.href,delete R.href,"#"==R.Target.charAt(0)&&R.Target.indexOf(".")>-1&&(S=Gh(R.Target.slice(1)),R.Target="#"+S[0]+"!"+S[1])}break;case"table-protection":case"data-pilot-grand-total":case"office-document-common-attrs":break;default:switch(j[2]){case"dc:":case"calcext:":case"loext:":case"ooo:":case"chartooo:":case"draw:":case"style:":case"chart:":case"form:":case"uof:":case"表:":case"字:":break;default:if(e.WTF)throw new Error(j)}}var da={Sheets:r,SheetNames:s,Workbook:Q};return e.bookSheets&&delete da.Sheets,da}}(),tq=function(){var a="";return function(){return gm+a}}(),uq=function(){var a=function(a){return R(a).replace(/ +/g,function(a){return''}).replace(/\t/g,"").replace(/\n/g,"").replace(/^ /,"").replace(/ $/,"")},b=" \n",c=" \n",d=function(d,e,f){var g=[];g.push(' \n');var h=0,i=0,j=Ba(d["!ref"]),k=d["!merges"]||[],l=0,m=Array.isArray(d);for(h=0;h\n");for(;h<=j.e.r;++h){for(g.push(" \n"),i=0;ii||k[l].s.r>h||k[l].e.c\n")}return g.push(" \n"),g.join("")},e=function(a){a.push(" \n"),a.push(' \n'),a.push(' \n'),a.push(" /\n"),a.push(' \n'),a.push(" /\n"),a.push(" \n"),a.push(" \n"),a.push(' \n'),a.push(" \n")};return function(a,b){var c=[gm],f=Y({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),g=Y({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});"fods"==b.bookType?c.push("\n"):c.push("\n"),e(c),c.push(" \n"),c.push(" \n");for(var h=0;h!=a.SheetNames.length;++h)c.push(d(a.Sheets[a.SheetNames[h]],a,h,b));return c.push(" \n"),c.push(" \n"),"fods"==b.bookType?c.push(""):c.push(""),c.join("")}}(),vq=Rk(rq),wq=Rk({from_sheet:vl}),xq=Rk(so),yq=Rk(to),zq=Rk(vo),Aq=Rk(Jo),Bq=Rk({from_sheet:wl}),Cq=Rk(ro),Dq=Rk(uo),Eq=Sk([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]]),Fq=Sk([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]]),Gq=/"/g,Hq={encode_col:va,encode_row:ra,encode_cell:Aa,encode_range:Ca,decode_col:ua,decode_row:qa,split_cell:ya,decode_cell:za,decode_range:Ba,format_cell:Fa,get_formulae:xl,make_csv:vl,make_json:tl,make_formulae:xl,sheet_add_aoa:Ha,sheet_add_json:yl,aoa_to_sheet:Ia,json_to_sheet:zl,table_to_sheet:Jk,table_to_book:Kk,sheet_to_csv:vl,sheet_to_txt:wl,sheet_to_json:tl,sheet_to_html:rq.from_sheet,sheet_to_dif:to.from_sheet,sheet_to_slk:so.from_sheet,sheet_to_eth:uo.from_sheet,sheet_to_formulae:xl,sheet_to_row_object_array:tl};!function(a){function b(b){b.forEach(function(b){a.consts[b[0]]=b[1]})}function c(a,b,c){return null!=a[b]?a[b]:a[b]=c}function d(a,b,c){return"string"==typeof b?a[b]||(a[b]={t:"z"}):"number"!=typeof b?d(a,Aa(b)):d(a,Aa({r:b,c:c||0}))}function e(a,b){if("number"==typeof b){if(b>=0&&a.SheetNames.length>b)return b;throw new Error("Cannot find sheet # "+b)}if("string"==typeof b){var c=a.SheetNames.indexOf(b);if(c>-1)return c;throw new Error("Cannot find sheet name |"+b+"|")}throw new Error("Cannot find sheet |"+b+"|")}a.consts=a.consts||{},a.book_new=function(){return{SheetNames:[],Sheets:{}}},a.book_append_sheet=function(a,b,c){if(!c)for(var d=1;d<=65535&&-1!=a.SheetNames.indexOf(c="Sheet"+d);++d);if(!c)throw new Error("Too many worksheets");if(gj(c),a.SheetNames.indexOf(c)>=0)throw new Error("Worksheet with name |"+c+"| already exists!");a.SheetNames.push(c),a.Sheets[c]=b},a.book_set_sheet_visibility=function(a,b,d){c(a,"Workbook",{}),c(a.Workbook,"Sheets",[]);var f=e(a,b);switch(c(a.Workbook.Sheets,f,{}),d){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+d)}a.Workbook.Sheets[f].Hidden=d},b([["SHEET_VISIBLE",0],["SHEET_HIDDEN",1],["SHEET_VERY_HIDDEN",2]]),a.cell_set_number_format=function(a,b){return a.z=b,a},a.cell_set_hyperlink=function(a,b,c){return b?(a.l={Target:b},c&&(a.l.Tooltip=c)):delete a.l,a},a.cell_set_internal_link=function(b,c,d){return a.cell_set_hyperlink(b,"#"+c,d)},a.cell_add_comment=function(a,b,c){a.c||(a.c=[]),a.c.push({t:b,a:c||"SheetJS"})},a.sheet_set_array_formula=function(a,b,c){for(var e="string"!=typeof b?b:Da(b),f="string"==typeof b?b:Ca(b),g=e.s.r;g<=e.e.r;++g)for(var h=e.s.c;h<=e.e.c;++h){var i=d(a,g,h);i.t="n",i.F=f,delete i.v,g==e.s.r&&h==e.s.c&&(i.f=c)}return a}}(Hq),Ml&&"undefined"!=typeof require&&function(){var b={}.Readable,c=function(a,c){var d=b(),e=null==c?{}:c;if(null==a||null==a["!ref"])return d.push(null),d;var f=Da(a["!ref"]),g=void 0!==e.FS?e.FS:",",h=g.charCodeAt(0),i=void 0!==e.RS?e.RS:"\n",j=i.charCodeAt(0),k=new RegExp(("|"==g?"\\|":g)+"+$"),l="",m=[];e.dense=Array.isArray(a);for(var n=e.skipHidden&&a["!cols"]||[],o=e.skipHidden&&a["!rows"]||[],p=f.s.c;p<=f.e.c;++p)(n[p]||{}).hidden||(m[p]=va(p));var q=f.s.r,r=!1;return d._read=function(){if(!r)return r=!0,d.push("\ufeff");if(q>f.e.r)return d.push(null);for(;q<=f.e.r;)if(++q,!(o[q-1]||{}).hidden&&null!=(l=ul(a,f,q-1,m,h,j,g,e))){e.strip&&(l=l.replace(k,"")),d.push(l+i);break}},d},d=function(a,c){var d=b(),e=c||{},f=null!=e.header?e.header:rq.BEGIN,g=null!=e.footer?e.footer:rq.END;d.push(f);var h=Ba(a["!ref"]);e.dense=Array.isArray(a),d.push(rq._preamble(a,h,e));var i=h.s.r,j=!1;return d._read=function(){if(i>h.e.r)return j||(j=!0,d.push(""+g)),d.push(null);for(;i<=h.e.r;){d.push(rq._row(a,h,i,e)),++i;break}},d},e=function(a,c){var d=b({objectMode:!0});if(null==a||null==a["!ref"])return d.push(null),d;var e={t:"n",v:0},f=0,g=1,h=[],i=0,j="",k={s:{r:0,c:0},e:{r:0,c:0}},l=c||{},m=null!=l.range?l.range:a["!ref"];switch(1===l.header?f=1:"A"===l.header?f=2:Array.isArray(l.header)&&(f=3),typeof m){case"string":k=Da(m);break;case"number":k=Da(a["!ref"]),k.s.r=m;break;default:k=m}f>0&&(g=0);var n=ra(k.s.r),o=[],p=0,q=Array.isArray(a),r=k.s.r,s=0,t=0;for(q&&!a[r]&&(a[r]=[]),s=k.s.c;s<=k.e.c;++s)switch(o[s]=va(s),e=q?a[r][s]:a[o[s]+n],f){case 1:h[s]=s-k.s.c;break;case 2:h[s]=o[s];break;case 3:h[s]=l.header[s-k.s.c];break;default:for(null==e&&(e={w:"__EMPTY",t:"s"}),j=i=Fa(e,null,l),p=0,t=0;tk.e.r)return d.push(null);for(;r<=k.e.r;){var b=sl(a,k,r,o,f,h,q,l);if(++r,!1===b.isempty||(1===f?!1!==l.blankrows:!!l.blankrows)){d.push(b.row);break}}},d};a.stream={to_json:e,to_html:d,to_csv:c}}();var Iq=function(){function a(b,c,d){return this instanceof a?(this.tagName=b,this._attributes=c||{},this._children=d||[],this._prefix="",this):new a(b,c,d)}a.prototype.createElement=function(){return new a(arguments)},a.prototype.children=function(){return this._children},a.prototype.append=function(a){return this._children.push(a),this},a.prototype.prefix=function(a){return 0==arguments.length?this._prefix:(this._prefix=a,this)},a.prototype.attr=function(a,b){if(void 0==b)return delete this._attributes[a],this;if(0==arguments.length)return this._attributes;if("string"==typeof a&&1==arguments.length)return this._attributes.attr[a];if("object"==typeof a&&1==arguments.length)for(var c in a)this._attributes[c]=a[c];else 2==arguments.length&&"string"==typeof a&&(this._attributes[a]=b);return this};var b="'";QUOTE='"';var c={};return c[QUOTE]=""",c[b]="'",a.prototype.escapeAttributeValue=function(a){return'"'+a.replace(/\"/g,""")+'"'},a.prototype.toXml=function(a){a||(a=this);var b=a._prefix;if(b+="<"+a.tagName,a._attributes)for(var c in a._attributes)b+=" "+c+"="+this.escapeAttributeValue(""+a._attributes[c]);if(a._children&&a._children.length>0){b+=">";for(var d=0;d"}else b+="/>";return b},a}(),Jq=function(a){var b=164,c={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},d={};for(var e in c)d[c[e]]=e;return _hashIndex={},_listIndex=[],{initialize:function(a){this.$fonts=Iq("fonts").attr("count",0).attr("x14ac:knownFonts","1"),this.$fills=Iq("fills").attr("count",0),this.$borders=Iq("borders").attr("count",0),this.$numFmts=Iq("numFmts").attr("count",0),this.$cellStyleXfs=Iq("cellStyleXfs"),this.$xf=Iq("xf").attr("numFmtId",0).attr("fontId",0).attr("fillId",0).attr("borderId",0),this.$cellXfs=Iq("cellXfs").attr("count",0),this.$cellStyles=Iq("cellStyles").append(Iq("cellStyle").attr("name","Normal").attr("xfId",0).attr("builtinId",0)),this.$dxfs=Iq("dxfs").attr("count","0"),this.$tableStyles=Iq("tableStyles").attr("count","0").attr("defaultTableStyle","TableStyleMedium9").attr("defaultPivotStyle","PivotStyleMedium4"),this.$styles=Iq("styleSheet").attr("xmlns:mc","http://schemas.openxmlformats.org/markup-compatibility/2006").attr("xmlns:x14ac","http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac").attr("xmlns","http://schemas.openxmlformats.org/spreadsheetml/2006/main").attr("mc:Ignorable","x14ac").prefix('').append(this.$numFmts).append(this.$fonts).append(this.$fills).append(this.$borders).append(this.$cellStyleXfs.append(this.$xf)).append(this.$cellXfs).append(this.$cellStyles).append(this.$dxfs).append(this.$tableStyles);var b=a.defaultCellStyle||{};b.font||(b.font={name:"Calibri",sz:"12"}),b.font.name||(b.font.name="Calibri"),b.font.sz||(b.font.sz=11),b.fill||(b.fill={patternType:"none",fgColor:{}}),b.border||(b.border={}),b.numFmt||(b.numFmt=0),this.defaultStyle=b;var c=JSON.parse(JSON.stringify(b));return c.fill={patternType:"gray125",fgColor:{}},this.addStyles([b,c]),this},addStyle:function(a){var b=JSON.stringify(a),c=_hashIndex[b];return void 0==c?(c=this._addXf(a),_hashIndex[b]=c):c=_hashIndex[b],c},addStyles:function(a){var b=this;return a.map(function(a){return b.addStyle(a)})},_duckTypeStyle:function(a){return"object"==typeof a&&(a.patternFill||a.fgColor)?{fill:a}:a.font||a.numFmt||a.border||a.fill?a:this._getStyleCSS(a)},_getStyleCSS:function(a){return a},_addXf:function(a){var b=this._addFont(a.font),c=this._addFill(a.fill),d=this._addBorder(a.border),e=this._addNumFmt(a.numFmt),f=Iq("xf").attr("numFmtId",e).attr("fontId",b).attr("fillId",c).attr("borderId",d).attr("xfId","0");if(b>0&&f.attr("applyFont","1"),c>0&&f.attr("applyFill","1"),d>0&&f.attr("applyBorder","1"),e>0&&f.attr("applyNumberFormat","1"),a.alignment){var g=Iq("alignment");a.alignment.horizontal&&g.attr("horizontal",a.alignment.horizontal),a.alignment.vertical&&g.attr("vertical",a.alignment.vertical),a.alignment.indent&&g.attr("indent",a.alignment.indent),a.alignment.readingOrder&&g.attr("readingOrder",a.alignment.readingOrder),a.alignment.wrapText&&g.attr("wrapText",a.alignment.wrapText),void 0!=a.alignment.textRotation&&g.attr("textRotation",a.alignment.textRotation),f.append(g).attr("applyAlignment",1)}this.$cellXfs.append(f);var h=+this.$cellXfs.children().length;return this.$cellXfs.attr("count",h),h-1},_addFont:function(a){if(!a)return 0;var b=Iq("font").append(Iq("sz").attr("val",a.sz||this.defaultStyle.font.sz)).append(Iq("name").attr("val",a.name||this.defaultStyle.font.name));a.bold&&b.append(Iq("b")),a.underline&&b.append(Iq("u")),a.italic&&b.append(Iq("i")),a.strike&&b.append(Iq("strike")),a.outline&&b.append(Iq("outline")),a.shadow&&b.append(Iq("shadow")),a.vertAlign&&b.append(Iq("vertAlign").attr("val",a.vertAlign)),a.color&&(a.color.theme?(b.append(Iq("color").attr("theme",a.color.theme)),a.color.tint&&b.append(Iq("tint").attr("theme",a.color.tint))):a.color.rgb&&b.append(Iq("color").attr("rgb",a.color.rgb))),this.$fonts.append(b);var c=this.$fonts.children().length;return this.$fonts.attr("count",c),c-1},_addNumFmt:function(a){if(!a)return 0;if("string"==typeof a){var c=d[a];if(c>=0)return c}if(/^[0-9]+$/.exec(a))return a;a=a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");var e=Iq("numFmt").attr("numFmtId",++b).attr("formatCode",a);this.$numFmts.append(e);var f=this.$numFmts.children().length;return this.$numFmts.attr("count",f),b},_addFill:function(a){if(!a)return 0;var b=Iq("patternFill").attr("patternType",a.patternType||"solid");if(a.fgColor){var c=Iq("fgColor");a.fgColor.rgb?(6==a.fgColor.rgb.length&&(a.fgColor.rgb="FF"+a.fgColor.rgb),c.attr("rgb",a.fgColor.rgb),b.append(c)):a.fgColor.theme&&(c.attr("theme",a.fgColor.theme),a.fgColor.tint&&c.attr("tint",a.fgColor.tint),b.append(c)),a.bgColor||(a.bgColor={indexed:"64"})}if(a.bgColor){var d=Iq("bgColor").attr(a.bgColor);b.append(d)}var e=Iq("fill").append(b);this.$fills.append(e);var f=this.$fills.children().length;return this.$fills.attr("count",f),f-1},_getSubBorder:function(a,b){var c=Iq(a);if(b&&(b.style&&c.attr("style",b.style),b.color)){var d=Iq("color");b.color.auto?d.attr("auto",b.color.auto):b.color.rgb?d.attr("rgb",b.color.rgb):(b.color.theme||b.color.tint)&&(d.attr("theme",b.color.theme||"1"),d.attr("tint",b.color.tint||"0")),c.append(d)}return c},_addBorder:function(a){if(!a)return 0;var b=this,c=Iq("border").attr("diagonalUp",a.diagonalUp).attr("diagonalDown",a.diagonalDown);["left","right","top","bottom","diagonal"].forEach(function(d){c.append(b._getSubBorder(d,a[d]))}),this.$borders.append(c);var d=this.$borders.children().length;return this.$borders.attr("count",d),d-1},toXml:function(){return this.$styles.toXml()}}.initialize(a||{})};a.parse_xlscfb=qk,a.parse_ods=Nk,a.parse_fods=Ok,a.write_ods=Pk,a.parse_zip=Xk,a.read=gl,a.readFile=hl,a.readFileSync=hl,a.write=ol,a.writeFile=ql,a.writeFileSync=ql,a.writeFileAsync=rl,a.utils=Hq,a.SSF=Tl,a.CFB=$l}"undefined"==typeof layui&&"undefined"==typeof jQuery&&console.error("非layui调用请先加载jQuery"),"undefined"!=typeof jQuery&&($=jQuery),LAY_EXCEL={downloadExl:function(a,b,c){c=c||"xlsx",this.exportExcel({sheet1:a},b+"."+c,c,null)},exportExcel:function(a,b,c,d){c=c||"xlsx",b=b||"导出数据."+c;var e=XLSX.utils.book_new(),f={Title:b,Subject:"Export From web browser",Author:"excel.wj2015.com",Manager:"",Company:"",Category:"",Keywords:"",Comments:"",LastAuthor:"",CreatedData:new Date};d&&d.Props&&(f=$.extend(f,d.Props)),e.compression=!d||d.compression,!1!==e.compression&&(e.compression=!0),e.Props=f;var g={"!merges":null,"!margins":null,"!cols":null,"!rows":null,"!protect":null,"!autofilter":null};d&&d.extend&&(g=$.extend(g,d.extend));for(var h in g)g.hasOwnProperty(h)&&(g[h]||delete g[h]);$.isArray(a)&&(a={sheet1:a});for(var i in a)if(a.hasOwnProperty(i)){var j=a[i];e.SheetNames.push(i);var k=!1;if(j.length&&j[0]&&$.isArray(j[0])&&(k=!0),k)n=XLSX.utils.aoa_to_sheet(j);else{var l={};if(j.length){l.headers=j.unshift(),l.skipHeader=!0;var m=this.splitContent(j)}var n=XLSX.utils.json_to_sheet(j,l);g[i]?$.extend(n,g[i]):$.extend(n,g),void 0!==m&&this.mergeCellOpt(n,m.style)}e.Sheets[i]=n}var o=XLSX.write(e,{bookType:c,type:"binary",cellStyles:!0,compression:e.compression});saveAs(new Blob([this.s2ab(o)],{type:"application/octet-stream"}),b)},splitContent:function(a){for(var b={},c=0;c tr").each(function(){var a=[];$(this).find("td,th").each(function(){a.push($(this).text())}),b.push(a)});var c=[];return a.find("tbody > tr").each(function(){var a=[];$(this).find("td").each(function(){a.push($(this).text())}),c.push(a)}),{head:b,body:c}},numsTitleCache:{},titleNumsCache:{},numToTitle:function(a){if(this.numsTitleCache[a])return this.numsTitleCache[a];var b="";if(a>26){var c=a%26;return b=this.numToTitle((a-c)/26)+this.numToTitle(c||26),this.numsTitleCache[a]=b,this.titleNumsCache[b]=a,b}return b=String.fromCharCode(64+a),this.numsTitleCache[a]=b,this.titleNumsCache[b]=a,b},titleToNum:function(a){if(this.titleNumsCache[a])return this.titleNumsCache[a];var b=a.length,c=0;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d],f=e.charCodeAt()-64;c+=f*Math.pow(26,b-d-1)}return this.numsTitleCache[c]=a,this.titleNumsCache[a]=c,c},getDefaultRange:function(a,b){var c=Object.keys(a[0]),d=c.length-1,e=a.length-1,f={c:0,r:0},g={c:d,r:e};if(b&&"string"==typeof b){var h=b.split(":");h[0].length&&(f=this.splitPosition(h[0])),void 0!==h[1]&&""!==h[1]&&(g=this.splitPosition(h[1]))}return f.c>g.c&&console.error("开始列不得大于结束列"),f.r>g.r&&console.error("开始行不得大于结束行"),{startPos:f,endPos:g,fieldKeys:c}},setCellStyle:function(a,b,c,d,e,f){for(var g=b.r;g<=c.r;g++)for(var h=b.c;h<=c.c;h++){var i=a[g];if(!i){i={};for(var j=0;j0?b:50;var c=[],d=0;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e];if(e.match&&e.match(/[A-Z]*/)){for(var g=this.titleToNum(e)-1;d0?f:b})}}return c},makeRowConfig:function(a,b){b=b>0?b:10;var c=[],d=0;for(var e in a)if(a.hasOwnProperty(e)){var f=a[e];if(e.match&&e.match(/[0-9]*/)){for(var g=parseInt(e)-1;d0?f:b})}}return c},splitPosition:function(a){var b=a.match("^([A-Z]+)([0-9]+)$");return b?{c:this.titleToNum(b[1])-1,r:parseInt(b[2])-1}:{c:0,r:0}},s2ab:function(a){for(var b=new ArrayBuffer(a.length),c=new Uint8Array(b),d=0;d>6,128|63&d):d<55296||d>=57344?b.push(224|d>>12,128|d>>6&63,128|63&d):(c++,d=65536+((1023&d)<<10|1023&a.charCodeAt(c)),b.push(240|d>>18,128|d>>12&63,128|d>>6&63,128|63&d))}return b}function b(a){var b,c,d,e,f,g;for(b="",d=a.length,c=0;c>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(e);break;case 12:case 13:f=a[c++],b+=String.fromCharCode((31&e)<<6|63&f);break;case 14:f=a[c++],g=a[c++],b+=String.fromCharCode((15&e)<<12|(63&f)<<6|(63&g)<<0)}return b}function c(a){return a&&DataView.prototype.isPrototypeOf(a)}function d(a){for(var b=new Array(a.byteLength),c=new Uint8Array(a),d=b.length;d--;)b[d]=c[d];return b}function e(a){for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",c=[],d=0;d>2,k=(3&e)<<4|g>>4,l=(15&g)<<2|i>>6,m=63&i;h||(m=64,f||(l=64)),c.push(b[j],b[k],b[l],b[m])}return c.join("")}function g(b,e){b=b||[];for(var f=0,h=b.length;f-1};if(g.prototype.slice=function(a,b,c){return new g([this._buffer.slice(a||0,b||this._buffer.length)],{type:c})},g.prototype.toString=function(){return"[object Blob]"},h.prototype=m(g.prototype),h.prototype.constructor=h,Object.setPrototypeOf)Object.setPrototypeOf(h,g);else try{h.__proto__=g}catch(a){}h.prototype.toString=function(){return"[object File]"},k.EMPTY=0,k.LOADING=1,k.DONE=2,k.prototype.error=null,k.prototype.onabort=null,k.prototype.onerror=null,k.prototype.onload=null,k.prototype.onloadend=null,k.prototype.onloadstart=null,k.prototype.onprogress=null,k.prototype.readAsDataURL=function(a){l(this,a,"readAsDataURL"),this.result="data:"+a.type+";base64,"+e(a._buffer)},k.prototype.readAsText=function(a){l(this,a,"readAsText"),this.result=b(a._buffer)},k.prototype.readAsArrayBuffer=function(a){l(this,a,"readAsText"),this.result=a._buffer.slice()},k.prototype.abort=function(){},URL.createObjectURL=function(a){return a instanceof g?"data:"+a.type+";base64,"+e(a._buffer):i.call(URL,a)},URL.revokeObjectURL=function(a){j&&j.call(URL,a)};var q=f.XMLHttpRequest&&f.XMLHttpRequest.prototype.send;q&&(XMLHttpRequest.prototype.send=function(a){a instanceof g?(this.setRequestHeader("Content-Type",a.type),q.call(this,b(a._buffer))):q.call(this,a)}),f.FileReader=k,f.File=h,f.Blob=g}function e(){var a=!!f.ActiveXObject||"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,b=f.XMLHttpRequest&&f.XMLHttpRequest.prototype.send;a&&b&&(XMLHttpRequest.prototype.send=function(a){a instanceof Blob?(this.setRequestHeader("Content-Type",a.type),b.call(this,a)):b.call(this,a)});try{new File([],"")}catch(a){try{var c=new Function('class File extends Blob {constructor(chunks, name, opts) {opts = opts || {};super(chunks, opts || {});this.name = name;this.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date;this.lastModified = +this.lastModifiedDate;}};return new File([], ""), File')();f.File=c}catch(a){var c=function(a,b,c){var d=new Blob(a,c),e=c&&void 0!==c.lastModified?new Date(c.lastModified):new Date;return d.name=b,d.lastModifiedDate=e,d.lastModified=+e,d.toString=function(){return"[object File]"},k&&(d[k]="File"),d};f.File=c}}}var f="object"==typeof window?window:"object"==typeof self?self:this,g=f.BlobBuilder||f.WebKitBlobBuilder||f.MSBlobBuilder||f.MozBlobBuilder;f.URL=f.URL||f.webkitURL||function(a,b){return b=document.createElement("a"),b.href=a,b};var h=f.Blob,i=URL.createObjectURL,j=URL.revokeObjectURL,k=f.Symbol&&f.Symbol.toStringTag,l=!1,m=!1,n=!!f.ArrayBuffer,o=g&&g.prototype.append&&g.prototype.getBlob;try{l=2===new Blob(["ä"]).size,m=2===new Blob([new Uint8Array([1,2])]).size}catch(a){}f.Blob&&(b.prototype=Blob.prototype,c.prototype=Blob.prototype),k&&(File.prototype[k]="File",Blob.prototype[k]="Blob",FileReader.prototype[k]="FileReader"),l?(e(),f.Blob=m?f.Blob:c):o?(e(),f.Blob=b):d()}(),function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof exports?b():(b(),a.FileSaver={exports:{}}.exports)}(this,function(){"use strict";function a(a,b){return void 0===b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Depricated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a}function b(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){f(d.response,b,c)},d.onerror=function(){console.error("could not download file")},d.send()}function c(a){var b=new XMLHttpRequest;return b.open("HEAD",a,!1),b.send(),200<=b.status&&299>=b.status}function d(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var e="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,f=e.saveAs||"object"!=typeof window||window!==e?function(){}:"download"in HTMLAnchorElement.prototype?function(a,f,g){var h=e.URL||e.webkitURL,i=document.createElement("a");f=f||a.name||"download",i.download=f,i.rel="noopener","string"==typeof a?(i.href=a,i.origin===location.origin?d(i):c(i.href)?b(a,f,g):d(i,i.target="_blank")):(i.href=h.createObjectURL(a),setTimeout(function(){h.revokeObjectURL(i.href)},4e4),setTimeout(function(){d(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,f,g){if(f=f||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(a(e,g),f);else if(c(e))b(e,f,g);else{var h=document.createElement("a");h.href=e,h.target="_blank",setTimeout(function(){d(h)})}}:function(a,c,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),"string"==typeof a)return b(a,c,d);var g="application/octet-stream"===a.type,h=/constructor/i.test(e.HTMLElement)||e.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||g&&h)&&"object"==typeof FileReader){var j=new FileReader;j.onloadend=function(){var a=j.result;a=i?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=a:location=a,f=null},j.readAsDataURL(a)}else{var k=e.URL||e.webkitURL,l=k.createObjectURL(a);f?f.location=l:location.href=l,f=null,setTimeout(function(){k.revokeObjectURL(l)},4e4)}};e.saveAs=f.saveAs=f,"undefined"!=typeof module&&(module.exports=f)}),function(a){if("object"==typeof exports&&"undefined"!=typeof module&&"undefined"==typeof DO_NOT_EXPORT_JSZIP)module.exports=a();else if("function"==typeof define&&define.amd&&"undefined"==typeof DO_NOT_EXPORT_JSZIP)JSZipSync=a(),define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof $&&$.global?b=$.global:"undefined"!=typeof self&&(b=self),b.JSZipSync=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c||a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g>2,h=(3&c)<<4|e>>4,i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),k=k+d.charAt(g)+d.charAt(h)+d.charAt(i)+d.charAt(j);return k},c.decode=function(a,b){var c,e,f,g,h,i,j,k="",l=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");l>4,e=(15&h)<<4|i>>2,f=(3&i)<<6|j,k+=String.fromCharCode(c),64!=i&&(k+=String.fromCharCode(e)),64!=j&&(k+=String.fromCharCode(f));return k}},{}],2:[function(a,b,c){"use strict";function d(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}d.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},b.exports=d},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\0\0",compress:function(a){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":8}],4:[function(a,b,c){"use strict";var d=a("./utils"),e=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];b.exports=function(a,b){if(void 0===a||!a.length)return 0;var c="string"!==d.getTypeOf(a);void 0===b&&(b=0);var f=0,g=0,h=0;b^=-1;for(var i=0,j=a.length;i>>8^f;return-1^b}},{"./utils":21}],5:[function(a,b,c){"use strict";function d(a){this.data=null,this.length=0,this.index=0}var e=a("./utils");d.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return e.transformTo("string",this.readData(a))},readData:function(a){},lastIndexOfSignature:function(a){},readDate:function(){var a=this.readInt(4);return new Date(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=d},{"./utils":21}],6:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!1,c.date=null,c.compression=null,c.comment=null},{}],7:[function(a,b,c){"use strict";var d=a("./utils");c.string2binary=function(a){return d.string2binary(a)},c.string2Uint8Array=function(a){return d.transformTo("uint8array",a)},c.uint8Array2String=function(a){return d.transformTo("string",a)},c.string2Blob=function(a){var b=d.transformTo("arraybuffer",a);return d.arrayBuffer2Blob(b)},c.arrayBuffer2Blob=function(a){return d.arrayBuffer2Blob(a)},c.transformTo=function(a,b){return d.transformTo(a,b)},c.getTypeOf=function(a){return d.getTypeOf(a)},c.checkSupport=function(a){return d.checkSupport(a)},c.MAX_VALUE_16BITS=d.MAX_VALUE_16BITS,c.MAX_VALUE_32BITS=d.MAX_VALUE_32BITS,c.pretty=function(a){return d.pretty(a)},c.findCompression=function(a){return d.findCompression(a)},c.isRegExp=function(a){return d.isRegExp(a)}},{"./utils":21}],8:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("pako");c.uncompressInputType=d?"uint8array":"array",c.compressInputType=d?"uint8array":"array",c.magic="\b\0",c.compress=function(a){return e.deflateRaw(a)},c.uncompress=function(a){return e.inflateRaw(a)}},{pako:24}],9:[function(a,b,c){"use strict";function d(a,b){if(!(this instanceof d))return new d(a,b);this.files={},this.comment=null,this.root="",a&&this.load(a,b),this.clone=function(){var a=new d;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a}}var e=a("./base64");d.prototype=a("./object"),d.prototype.load=a("./load"),d.support=a("./support"),d.defaults=a("./defaults"),d.utils=a("./deprecatedPublicUtils"),d.base64={encode:function(a){return e.encode(a)},decode:function(a){return e.decode(a)}},d.compressions=a("./compressions"),b.exports=d},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(a,b,c){"use strict";var d=a("./base64"),e=a("./zipEntries");b.exports=function(a,b){var c,f,g,h;for(b=b||{},b.base64&&(a=d.decode(a)),f=new e(a,b),c=f.files,g=0;g>>=8;return d},u=function(){var a,b,c={};for(a=0;a0?a.substring(0,b):""},y=function(a,b){return"/"!=a.slice(-1)&&(a+="/"),b=void 0!==b&&b,this.files[a]||w.call(this,a,null,{dir:!0,createFolders:b}),this.files[a]},z=function(a,b){var c,d=new k;return a._data instanceof k?(d.uncompressedSize=a._data.uncompressedSize,d.crc32=a._data.crc32,0===d.uncompressedSize||a.dir?(b=j.STORE,d.compressedContent="",d.crc32=0):a._data.compressionMethod===b.magic?d.compressedContent=a._data.getCompressedContent():(c=a._data.getContent(),d.compressedContent=b.compress(e.transformTo(b.compressInputType,c)))):(c=q(a),c&&0!==c.length&&!a.dir||(b=j.STORE,c=""),d.uncompressedSize=c.length,d.crc32=f(c),d.compressedContent=b.compress(e.transformTo(b.compressInputType,c))),d.compressedSize=d.compressedContent.length,d.compressionMethod=b.magic,d},A=function(a,b,c,d){var h,i,j,k,l=(c.compressedContent,e.transformTo("string",m.utf8encode(b.name))),n=b.comment||"",o=e.transformTo("string",m.utf8encode(n)),p=l.length!==b.name.length,q=o.length!==n.length,r=b.options,s="",u="",v="";j=b._initialMetadata.dir!==b.dir?b.dir:r.dir,k=b._initialMetadata.date!==b.date?b.date:r.date,h=k.getHours(),h<<=6,h|=k.getMinutes(),h<<=5,h|=k.getSeconds()/2,i=k.getFullYear()-1980,i<<=4,i|=k.getMonth()+1,i<<=5,i|=k.getDate(),p&&(u=t(1,1)+t(f(l),4)+l,s+="up"+t(u.length,2)+u),q&&(v=t(1,1)+t(this.crc32(o),4)+o,s+="uc"+t(v.length,2)+v);var w="";return w+="\n\0",w+=p||q?"\0\b":"\0\0",w+=c.compressionMethod,w+=t(h,2),w+=t(i,2),w+=t(c.crc32,4),w+=t(c.compressedSize,4),w+=t(c.uncompressedSize,4),w+=t(l.length,2),w+=t(s.length,2),{fileRecord:g.LOCAL_FILE_HEADER+w+l+s,dirRecord:g.CENTRAL_FILE_HEADER+"\0"+w+t(o.length,2)+"\0\0\0\0"+(!0===j?"\0\0\0":"\0\0\0\0")+t(d,4)+l+s+o,compressedObject:c}},B={load:function(a,b){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(a){var b,c,d,e,f=[];for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],e=new s(d.name,d._data,u(d.options)),c=b.slice(this.root.length,b.length),b.slice(0,this.root.length)===this.root&&a(c,e)&&f.push(e));return f},file:function(a,b,c){if(1===arguments.length){if(e.isRegExp(a)){var d=a;return this.filter(function(a,b){return!b.dir&&d.test(a)})}return this.filter(function(b,c){return!c.dir&&b===a})[0]||null}return a=this.root+a,w.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(e.isRegExp(a))return this.filter(function(b,c){return c.dir&&a.test(b)});var b=this.root+a,c=y.call(this,b),d=this.clone();return d.root=c.name,d},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!=a.slice(-1)&&(a+="/"),b=this.files[a]),b&&!b.dir)delete this.files[a];else for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;d=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f;return-1},d.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.index,this.index+a);return this.index+=a,b},b.exports=d},{"./dataReader":5}],19:[function(a,b,c){"use strict";var d=a("./utils"),e=function(a){this.data=new Uint8Array(a),this.index=0};e.prototype={append:function(a){0!==a.length&&(a=d.transformTo("uint8array",a),this.data.set(a,this.index),this.index+=a.length)},finalize:function(){return this.data}},b.exports=e},{"./utils":21}],20:[function(a,b,c){"use strict";for(var d=a("./utils"),e=a("./support"),f=a("./nodeBuffer"),g=new Array(256),h=0;h<256;h++)g[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;g[254]=g[254]=1;var i=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},j=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128==(192&a[c]);)c--;return c<0?b:0===c?b:c+g[a[c]]>b?c:b},k=function(a){var b,c,e,f,h=a.length,i=new Array(2*h);for(c=0,b=0;b4)i[c++]=65533,b+=f-1;else{for(e&=2===f?31:3===f?15:7;f>1&&b1?i[c++]=65533:e<65536?i[c++]=e:(e-=65536,i[c++]=55296|e>>10&1023,i[c++]=56320|1023&e)}return i.length!==c&&(i.subarray?i=i.subarray(0,c):i.length=c),d.applyFromCharCode(i)};c.utf8encode=function(a){return e.nodebuffer?f(a,"utf-8"):i(a)},c.utf8decode=function(a){if(e.nodebuffer)return d.transformTo("nodebuffer",a).toString("utf-8");a=d.transformTo(e.uint8array?"uint8array":"array",a);for(var b=[],c=0,f=a.length,g=65536;c1;)try{"array"===f||"nodebuffer"===f?d.push(String.fromCharCode.apply(null,a.slice(g,Math.min(g+b,e)))):d.push(String.fromCharCode.apply(null,a.subarray(g,Math.min(g+b,e)))),g+=b}catch(a){b=Math.floor(b/2)}return d.join("")}function g(a,b){for(var c=0;c1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=g.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==m)throw new Error(j[c]);b.header&&g.deflateSetHeader(this.strm,b.header)};r.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:!0===b?l:0,e.input="string"==typeof a?i.string2buf(a):a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new h.Buf8(f),e.next_out=0,e.avail_out=f),(c=g.deflate(e,d))!==n&&c!==m)return this.onEnd(c),this.ended=!0,!1;(0===e.avail_out||0===e.avail_in&&d===l)&&("string"===this.options.to?this.onData(i.buf2binstring(h.shrinkBuf(e.output,e.next_out))):this.onData(h.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==n);return d!==l||(c=g.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===m)},r.prototype.onData=function(a){this.chunks.push(a)},r.prototype.onEnd=function(a){a===m&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=r,c.deflate=d,c.deflateRaw=e,c.gzip=f},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(a,b,c){"use strict";function d(a,b){var c=new m(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}var f=a("./zlib/inflate.js"),g=a("./utils/common"),h=a("./utils/strings"),i=a("./zlib/constants"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=a("./zlib/gzheader"),m=function(a){this.options=g.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0==(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=f.inflateInit2(this.strm,b.windowBits);if(c!==i.Z_OK)throw new Error(j[c]);this.header=new l,f.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,b){var c,d,e,j,k,l=this.strm,m=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:!0===b?i.Z_FINISH:i.Z_NO_FLUSH,l.input="string"==typeof a?h.binstring2buf(a):a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new g.Buf8(m),l.next_out=0,l.avail_out=m),(c=f.inflate(l,i.Z_NO_FLUSH))!==i.Z_STREAM_END&&c!==i.Z_OK)return this.onEnd(c),this.ended=!0,!1;l.next_out&&(0===l.avail_out||c===i.Z_STREAM_END||0===l.avail_in&&d===i.Z_FINISH)&&("string"===this.options.to?(e=h.utf8border(l.output,l.next_out),j=l.next_out-e,k=h.buf2string(l.output,e),l.next_out=j,l.avail_out=m-j,j&&g.arraySet(l.output,l.output,e,j,0),this.onData(k)):this.onData(g.shrinkBuf(l.output,l.next_out)))}while(l.avail_in>0&&c!==i.Z_STREAM_END);return c===i.Z_STREAM_END&&(d=i.Z_FINISH),d!==i.Z_FINISH||(c=f.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===i.Z_OK)},m.prototype.onData=function(a){this.chunks.push(a)},m.prototype.onEnd=function(a){a===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=g.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=m,c.inflate=d,c.inflateRaw=e,c.ungzip=d},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;f=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;h[254]=h[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128==(192&a[c]);)c--;return c<0?b:0===c?b:c+h[a[c]]>b?c:b}},{"./common":27}],29:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do{e=e+b[d++]|0,f=f+e|0}while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],30:[function(a,b,c){b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],31:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h>>8^e[255&(a^b[h])];return-1^a}var f=d();b.exports=e},{}],32:[function(a,b,c){"use strict";function d(a,b){return a.msg=G[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(C.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){D._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,C.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=E(a.adler,b,e,c):2===a.state.wrap&&(a.adler=F(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-ja?a.strstart-(a.w_size-ja):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ia,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do{if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do{}while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&fg){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}}while((b=l[b&k])>i&&0!=--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-ja)){C.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do{d=a.head[--b],a.head[b]=d>=g?d-g:0}while(--c);c=g,b=c;do{d=a.prev[--b],a.prev[b]=d>=g?d-g:0}while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ha)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===H)return sa;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return sa;if(a.strstart-a.block_start>=a.w_size-ja&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):(a.strstart>a.block_start&&(h(a,!1),a.strm.avail_out),sa)}function o(a,b){for(var c,d;;){if(a.lookahead=ha&&(a.ins_h=(a.ins_h<=ha)if(d=D._tr_tally(a,a.strstart-a.match_start,a.match_length-ha),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ha){a.match_length--;do{a.strstart++,a.ins_h=(a.ins_h<=ha&&(a.ins_h=(a.ins_h<4096)&&(a.match_length=ha-1)),a.prev_length>=ha&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ha,d=D._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ha),a.lookahead-=a.prev_length-1,a.prev_length-=2;do{++a.strstart<=e&&(a.ins_h=(a.ins_h<=ha&&a.strstart>0&&(e=a.strstart-1,(d=g[e])===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ia;do{}while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&ea.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ha?(c=D._tr_tally(a,1,a.match_length-ha),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===H)return sa;break}if(a.match_length=0,c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return sa}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ua:va):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sa:ta}function s(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=B[a.level].max_lazy,a.good_match=B[a.level].good_length,a.nice_match=B[a.level].nice_length,a.max_chain_length=B[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ha-1,a.match_available=0,a.ins_h=0}function t(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new C.Buf16(2*fa),this.dyn_dtree=new C.Buf16(2*(2*da+1)),this.bl_tree=new C.Buf16(2*(2*ea+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(ga+1),this.heap=new C.Buf16(2*ca+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*ca+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function u(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=X,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?la:qa,a.adler=2===b.wrap?0:1,b.last_flush=H,D._tr_init(b),M):d(a,O)}function v(a){var b=u(a);return b===M&&s(a.state),b}function w(a,b){return a&&a.state?2!==a.state.wrap?O:(a.state.gzhead=b,M):O}function x(a,b,c,e,f,g){if(!a)return O;var h=1;if(b===R&&(b=6),e<0?(h=0,e=-e):e>15&&(h=2,e-=16),f<1||f>Z||c!==Y||e<8||e>15||b<0||b>9||g<0||g>V)return d(a,O);8===e&&(e=9);var i=new t;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<>1,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,v(a)}function y(a,b){return x(a,b,Y,$,_,W)}function z(a,b){var c,h,k,l;if(!a||!a.state||b>L||b<0)return a?d(a,O):O;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===ra&&b!==K)return d(a,0===a.avail_out?Q:O);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===la)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=F(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=ma):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,wa),h.status=qa);else{var m=Y+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=T||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=ka),m+=31-m%31,h.status=qa,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===ma)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=na)}else h.status=na;if(h.status===na)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindexk&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=oa)}else h.status=oa;if(h.status===oa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindexk&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=pa)}else h.status=pa;if(h.status===pa&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=qa)):h.status=qa),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,M}else if(0===a.avail_in&&e(b)<=e(c)&&b!==K)return d(a,Q);if(h.status===ra&&0!==a.avail_in)return d(a,Q);if(0!==a.avail_in||0!==h.lookahead||b!==H&&h.status!==ra){var o=h.strategy===T?r(h,b):h.strategy===U?q(h,b):B[h.level].func(h,b);if(o!==ua&&o!==va||(h.status=ra),o===sa||o===ua)return 0===a.avail_out&&(h.last_flush=-1),M;if(o===ta&&(b===I?D._tr_align(h):b!==L&&(D._tr_stored_block(h,0,0,!1),b===J&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,M}return b!==K?M:h.wrap<=0?N:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?M:N)}function A(a){var b;return a&&a.state?(b=a.state.status)!==la&&b!==ma&&b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra?d(a,O):(a.state=null,b===qa?d(a,P):M):O}var B,C=a("../utils/common"),D=a("./trees"),E=a("./adler32"),F=a("./crc32"),G=a("./messages"),H=0,I=1,J=3,K=4,L=5,M=0,N=1,O=-2,P=-3,Q=-5,R=-1,S=1,T=2,U=3,V=4,W=0,X=2,Y=8,Z=9,$=15,_=8,aa=29,ba=256,ca=ba+1+aa,da=30,ea=19,fa=2*ca+1,ga=15,ha=3,ia=258,ja=ia+ha+1,ka=32,la=42,ma=69,na=73,oa=91,pa=103,qa=113,ra=666,sa=1,ta=2,ua=3,va=4,wa=3,xa=function(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e};B=[new xa(0,0,0,0,n),new xa(4,4,8,4,o),new xa(4,5,16,8,o),new xa(4,6,32,32,o),new xa(4,4,16,16,p),new xa(8,16,32,32,p),new xa(8,16,128,128,p),new xa(8,32,128,256,p),new xa(32,128,258,1024,p),new xa(32,258,258,4096,p)],c.deflateInit=y,c.deflateInit2=x,c.deflateReset=v,c.deflateResetKeep=u,c.deflateSetHeader=w,c.deflate=z,c.deflateEnd=A,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],34:[function(a,b,c){"use strict";var d=30;b.exports=function(a,b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;c=a.state,e=a.next_in,A=a.input,f=e+(a.avail_in-5),g=a.next_out,B=a.output,h=g-(b-a.avail_out),i=g+(a.avail_out-257),j=c.dmax,k=c.wsize,l=c.whave,m=c.wnext,n=c.window,o=c.hold,p=c.bits,q=c.lencode,r=c.distcode,s=(1<>>24,o>>>=v,p-=v,0==(v=u>>>16&255))B[g++]=65535&u;else{if(!(16&v)){if(0==(64&v)){u=q[(65535&u)+(o&(1<>>=v,p-=v),p<15&&(o+=A[e++]<>>24,o>>>=v,p-=v,!(16&(v=u>>>16&255))){if(0==(64&v)){u=r[(65535&u)+(o&(1<j){a.msg="invalid distance too far back",c.mode=d;break a}if(o>>>=v,p-=v,v=g-h,x>v){if((v=x-v)>l&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(y=0,z=n,0===m){if(y+=k-v,v2;)B[g++]=z[y++],B[g++]=z[y++],B[g++]=z[y++],w-=3;w&&(B[g++]=z[y++],w>1&&(B[g++]=z[y++]))}else{y=g-x;do{B[g++]=B[y++],B[g++]=B[y++],B[g++]=B[y++],w-=3}while(w>2);w&&(B[g++]=B[y++],w>1&&(B[g++]=B[y++]))}break}}break}}while(e>3,e-=w,p-=w<<3,o&=(1<>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(oa),b.distcode=b.distdyn=new r.Buf32(pa),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=1+(b>>4),b<48&&(b&=15)),b&&(b<8||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,ra)}function k(a){if(sa){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sa=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<=f.wsize?(r.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave>>8&255,c.check=t(c.check,Ba,2,0),m=0,n=0,c.mode=L;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=la;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=la;break}if(m>>>=4,n-=4,wa=8+(15&m),0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=la;break}c.dmax=1<>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=M;case M:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=t(c.check,Ba,4,0)),m=0,n=0,c.mode=N;case N:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do{wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa))}while(wa&&q>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<>>=7&n,n-=7&n,c.mode=ia;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=ba,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=la}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<>>16^65535)){a.msg="invalid stored block lengths",c.mode=la;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<>>=5,n-=5,c.ndist=1+(31&m),m>>>=5,n-=5,c.ncode=4+(15&m),m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=la;break}c.have=0,c.mode=_;case _:for(;c.have>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=v(w,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=la;break}c.have=0,c.mode=aa;case aa:for(;c.have>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=la;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=la;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===la)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=la;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=la;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=la;break}if(c.mode=ba,b===B)break a;case ba:c.mode=ca;case ca:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,u(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===V&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ha;break}if(32&ra){c.back=-1,c.mode=V;break}if(64&ra){a.msg="invalid literal/length code",c.mode=la;break}c.extra=15&ra,c.mode=da;case da:if(c.extra){for(za=c.extra;n>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=ea;case ea:for(;Aa=c.distcode[m&(1<>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=la;break}c.offset=sa,c.extra=15&ra,c.mode=fa;case fa:if(c.extra){for(za=c.extra;n>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=la;break}c.mode=ga;case ga:if(0===j)break a;if(q=p-j,c.offset>q){if((q=c.offset-q)>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=la;break}q>c.wnext?(q-=c.wnext,oa=c.wsize-q):oa=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,oa=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do{f[h++]=pa[oa++]}while(--q);0===c.length&&(c.mode=ca);break;case ha:if(0===j)break a;f[h++]=c.length,j--,c.mode=ca;break;case ia:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;Df||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<>J)+u]=z<<24|A<<16|B|0}while(0!==u);for(t=1<>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0==--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":27}],37:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],38:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a){return a<256?ga[a]:ga[256+(a>>>7)]}function f(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function g(a,b,c){a.bi_valid>V-c?(a.bi_buf|=b<>V-a.bi_valid,a.bi_valid+=c-V):(a.bi_buf|=b<>>=1,c<<=1}while(--b>0);return c>>>1}function j(a){16===a.bi_valid?(f(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function k(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;f<=U;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;co&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)(e=a.heap[--c])>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function l(a,b,c){var d,e,f=new Array(U+1),g=0;for(d=1;d<=U;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2*e]=i(f[h]++,h))}}function m(){var a,b,c,d,e,f=new Array(U+1);for(c=0,d=0;d>=7;d8?f(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function p(a,b,c,d){o(a),d&&(f(a,c),f(a,~c)),E.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function q(a,b,c,d){var e=2*b,f=2*c;return a[e]>1;c>=1;c--)r(a,f,c);e=i;do{c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],r(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,r(a,f,1)}while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],k(a,b),l(f,j,a.bl_count)}function u(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;d<=c;d++)e=g,g=b[2*(d+1)+1],++h=3&&0===a.bl_tree[2*ca[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function x(a,b,c,d){var e;for(g(a,b-257,5),g(a,c-1,5),g(a,d-4,4),e=0;e>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return G;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return H;for(b=32;b0?(a.strm.data_type===I&&(a.strm.data_type=y(a)),t(a,a.l_desc),t(a,a.d_desc),h=w(a),e=a.opt_len+3+7>>>3,(f=a.static_len+3+7>>>3)<=e&&(e=f)):e=f=c+5,c+4<=e&&-1!==b?A(a,b,c,d):a.strategy===F||f===e?(g(a,(K<<1)+(d?1:0),3),s(a,ea,fa)):(g(a,(L<<1)+(d?1:0),3),x(a,a.l_desc.max_code+1,a.d_desc.max_code+1,h+1),s(a,a.dyn_ltree,a.dyn_dtree)),n(a),d&&o(a)}function D(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ha[c]+P+1)]++,a.dyn_dtree[2*e(b)]++),a.last_lit===a.lit_bufsize-1}var E=a("../utils/common"),F=4,G=0,H=1,I=2,J=0,K=1,L=2,M=3,N=258,O=29,P=256,Q=P+1+O,R=30,S=19,T=2*Q+1,U=15,V=16,W=7,X=256,Y=16,Z=17,$=18,_=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],aa=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ba=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],da=512,ea=new Array(2*(Q+2));d(ea);var fa=new Array(2*R);d(fa);var ga=new Array(da);d(ga);var ha=new Array(N-M+1);d(ha);var ia=new Array(O);d(ia);var ja=new Array(R);d(ja);var ka,la,ma,na=function(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length},oa=function(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b},pa=!1;c._tr_init=z,c._tr_stored_block=A,c._tr_flush_block=C,c._tr_tally=D,c._tr_align=B},{"../utils/common":27}],39:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}]},{},[9])(9)});var XLSX={};"undefined"!=typeof exports?make_xlsx_lib(exports):"undefined"!=typeof module&&module.exports?make_xlsx_lib(module.exports):"function"==typeof define&&define.amd?define("xlsx",function(){return XLSX.version||make_xlsx_lib(XLSX),XLSX}):make_xlsx_lib(XLSX);var XLS=XLSX,ODS=XLSX;!function(a){"use strict";function b(a){switch(typeof a){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return null===a?"null":"object"}}function c(a){return Object.prototype.toString.call(a).replace(/^\[object *|\]$/g,"")}function d(a){return"function"==typeof a}function e(a){if(null===a||a===D)throw TypeError();return Object(a)}function f(a){return a>>0}function g(a){return a>>>0}function h(b){function c(a){Object.defineProperty(b,a,{get:function(){return b._getter(a)},set:function(c){b._setter(a,c)},enumerable:!0,configurable:!1})}if(!("TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS"in a)){if(b.length>E)throw RangeError("Array too large for polyfill");var d;for(d=0;d>c}function j(a,b){var c=32-b;return a<>>c}function k(a){return[255&a]}function l(a){return i(a[0],8)}function m(a){return[255&a]}function n(a){return j(a[0],8)}function o(a){return a=M(Number(a)),[a<0?0:a>255?255:255&a]}function p(a){return[255&a,a>>8&255]}function q(a){return i(a[1]<<8|a[0],16)}function r(a){return[255&a,a>>8&255]}function s(a){return j(a[1]<<8|a[0],16)}function t(a){return[255&a,a>>8&255,a>>16&255,a>>24&255]}function u(a){return i(a[3]<<24|a[2]<<16|a[1]<<8|a[0],32)}function v(a){return[255&a,a>>8&255,a>>16&255,a>>24&255]}function w(a){return j(a[3]<<24|a[2]<<16|a[1]<<8|a[0],32)}function x(a,b,c){function d(a){var b=H(a),c=a-b;return c<.5?b:c>.5?b+1:b%2?b+1:b}var e,f,g,h=(1<=L(2,1-h)){f=K(H(I(a)/F),1023);var i=a/L(2,f);i<1&&(f-=1,i*=2),i>=2&&(f+=1,i/=2);var j=L(2,c);g=d(i*j)-j,f+=h,g/j>=1&&(f+=1,g=0),f>2*h&&(f=(1<>=1;return l.reverse(),g=l.join(""),h=(1<0?i*L(2,j-h)*(1+k/L(2,c)):0!==k?i*L(2,-(h-1))*(k/L(2,c)):i<0?-0:0}function z(a){return y(a,11,52)}function A(a){return x(a,11,52)}function B(a){return y(a,8,23)}function C(a){return x(a,8,23)}var D=void 0,E=1e5,F=Math.LN2,G=Math.abs,H=Math.floor,I=Math.log,J=Math.max,K=Math.min,L=Math.pow,M=Math.round;!function(){var a=Object.defineProperty,b=!function(){try{return Object.defineProperty({},"x",{})}catch(a){return!1}}();a&&!b||(Object.defineProperty=function(b,c,d){if(a)try{return a(b,c,d)}catch(a){}if(b!==Object(b))throw TypeError("Object.defineProperty called on non-object");return Object.prototype.__defineGetter__&&"get"in d&&Object.prototype.__defineGetter__.call(b,c,d.get),Object.prototype.__defineSetter__&&"set"in d&&Object.prototype.__defineSetter__.call(b,c,d.set),"value"in d&&(b[c]=d.value),b})}(),function(){function i(a){if((a=f(a))<0)throw RangeError("ArrayBuffer size is not a small enough positive integer.");Object.defineProperty(this,"byteLength",{value:a}),Object.defineProperty(this,"_bytes",{value:Array(a)});for(var b=0;b=1&&"object"===b(arguments[0])&&arguments[0]instanceof j)return function(a){if(this.constructor!==a.constructor)throw TypeError();var b=a.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new i(b)}),Object.defineProperty(this,"byteLength",{value:b}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:a.length});for(var c=0;c=1&&"object"===b(arguments[0])&&!(arguments[0]instanceof j)&&!(arguments[0]instanceof i||"ArrayBuffer"===c(arguments[0])))return function(a){var b=a.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new i(b)}),Object.defineProperty(this,"byteLength",{value:b}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:a.length});for(var c=0;c=1&&"object"===b(arguments[0])&&(arguments[0]instanceof i||"ArrayBuffer"===c(arguments[0])))return function(a,b,c){if((b=g(b))>a.byteLength)throw RangeError("byteOffset out of range");if(b%this.BYTES_PER_ELEMENT)throw RangeError("buffer length minus the byteOffset is not a multiple of the element size.");if(c===D){var d=a.byteLength-b;if(d%this.BYTES_PER_ELEMENT)throw RangeError("length of buffer minus byteOffset not a multiple of the element size");c=d/this.BYTES_PER_ELEMENT}else c=g(c),d=c*this.BYTES_PER_ELEMENT;if(b+d>a.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:a}),Object.defineProperty(this,"byteLength",{value:d}),Object.defineProperty(this,"byteOffset",{value:b}),Object.defineProperty(this,"length",{value:c})}.apply(this,arguments);throw TypeError()}function x(a,b,c){var d=function(){Object.defineProperty(this,"constructor",{value:d}),j.apply(this,arguments),h(this)};"__proto__"in d?d.__proto__=j:(d.from=j.from,d.of=j.of),d.BYTES_PER_ELEMENT=a;var e=function(){};return e.prototype=y,d.prototype=new e,Object.defineProperty(d.prototype,"BYTES_PER_ELEMENT",{value:a}),Object.defineProperty(d.prototype,"_pack",{value:b}),Object.defineProperty(d.prototype,"_unpack",{value:c}),d}a.ArrayBuffer=a.ArrayBuffer||i,Object.defineProperty(j,"from",{value:function(a){return new this(a)}}),Object.defineProperty(j,"of",{value:function(){return new this(arguments)}});var y={};j.prototype=y,Object.defineProperty(j.prototype,"_getter",{value:function(a){if(arguments.length<1)throw SyntaxError("Not enough arguments");if((a=g(a))>=this.length)return D;var b,c,d=[];for(b=0,c=this.byteOffset+a*this.BYTES_PER_ELEMENT;b=this.length)){var c,d,e=this._pack(b);for(c=0,d=this.byteOffset+a*this.BYTES_PER_ELEMENT;c0;)d._setter(j,d._getter(l)),l+=p,j+=p,q-=1;return d}}),Object.defineProperty(j.prototype,"every",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();for(var e=arguments[1],f=0;f1?arguments[1]:D,i=0;i1?arguments[1]:D,i=0;i0&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-1/0&&(d=(d>0||-1)*H(G(d)))),d>=c)return-1;for(var e=d>=0?d:J(c-G(d),0);e1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-1/0&&(d=(d>0||-1)*H(G(d))));for(var e=d>=0?K(d,c-1):c-G(d);e>=0;e--)if(b._getter(e)===a)return e;return-1}}),Object.defineProperty(j.prototype,"map",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();var e=[];e.length=c;for(var f=arguments[1],h=0;h=2?arguments[1]:b._getter(f++);f=2?arguments[1]:b._getter(f--);f>=0;)e=a.call(D,e,b._getter(f),f,b),f--;return e}}),Object.defineProperty(j.prototype,"reverse",{value:function(){if(this===D||null===this)throw TypeError();for(var a=Object(this),b=g(a.length),c=H(b/2),d=0,e=b-1;dthis.length)throw RangeError("Offset plus length of array is out of range");if(k=this.byteOffset+e*this.BYTES_PER_ELEMENT,l=c.length*this.BYTES_PER_ELEMENT,c.buffer===this.buffer){for(m=[],h=0,i=c.byteOffset;hthis.length)throw RangeError("Offset plus length of array is out of range");for(h=0;hc?1:0}if(this===D||null===this)throw TypeError();for(var c=Object(this),d=g(c.length),e=Array(d),f=0;fc?c:a}a=f(a),b=f(b),arguments.length<1&&(a=0),arguments.length<2&&(b=this.length),a<0&&(a=this.length+a),b<0&&(b=this.length+b),a=c(a,0,this.length),b=c(b,0,this.length);var d=b-a;return d<0&&(d=0),new this.constructor(this.buffer,this.byteOffset+a*this.BYTES_PER_ELEMENT,d)}});var E=x(1,k,l),F=x(1,m,n),I=x(1,o,n),L=x(2,p,q),M=x(2,r,s),N=x(4,t,u),O=x(4,v,w),P=x(4,C,B),Q=x(8,A,z);a.Int8Array=a.Int8Array||E,a.Uint8Array=a.Uint8Array||F,a.Uint8ClampedArray=a.Uint8ClampedArray||I,a.Int16Array=a.Int16Array||L,a.Uint16Array=a.Uint16Array||M,a.Int32Array=a.Int32Array||N,a.Uint32Array=a.Uint32Array||O,a.Float32Array=a.Float32Array||P,a.Float64Array=a.Float64Array||Q}(),function(){function b(a,b){return d(a.get)?a.get(b):a[b]}function e(a,b,d){if(!(a instanceof ArrayBuffer||"ArrayBuffer"===c(a)))throw TypeError();if((b=g(b))>a.byteLength)throw RangeError("byteOffset out of range");if(d=d===D?a.byteLength-b:g(d),b+d>a.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:a}),Object.defineProperty(this,"byteLength",{value:d}),Object.defineProperty(this,"byteOffset",{value:b})}function f(a){return function(c,d){if((c=g(c))+a.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");c+=this.byteOffset;for(var e=new Uint8Array(this.buffer,c,a.BYTES_PER_ELEMENT),f=[],h=0;hthis.byteLength)throw RangeError("Array index out of range");var f,h,j=new a([d]),k=new Uint8Array(j.buffer),l=[];for(f=0;f a { + padding-top: 8px; + padding-bottom: 8px; +} + +.layui-side-menu .layui-nav .layui-nav-item a:hover { + background: none; +} + +.layui-side-menu .layui-nav .layui-nav-itemed > .layui-nav-child { + padding: 5px 0; +} + +.layui-side-menu .layui-nav .layui-nav-item .layui-icon { + position: absolute; + top: 50%; + left: 20px; + margin-top: -19px; +} + +.layui-side-menu .layui-nav .layui-nav-child .layui-nav-child { + background: none !important; +} + +.layui-side-menu .layui-nav .layui-nav-child .layui-nav-child a { + padding-left: 60px; +} + +.layui-side-menu .layui-nav .layui-nav-more { + right: 15px; +} + +/* 侧边菜单 - 平板移动设备 */ +@media screen and (max-width: 992px) { + .layui-layout-admin .layui-side { + transform: translate3d(-220px, 0, 0); + -webkit-transform: translate3d(-220px, 0, 0); + width: 220px; + } + + .layui-layout-admin .layui-layout-left, + .layadmin-pagetabs, + .layui-layout-admin .layui-body, + .layui-layout-admin .layui-footer { + left: 0; + } +} + +/* 侧边收缩模式 */ +.layadmin-side-shrink .layui-layout-admin .layui-logo { + width: 60px; + background-image: url(res/logo.png); + /*background-size: 20px;)*/ +} + +.layadmin-side-shrink .layui-layout-admin .layui-logo span { + display: none; +} + +.layadmin-side-shrink .layui-side { + left: 0; + width: 60px; +} + +.layadmin-side-shrink .layui-layout-admin .layui-layout-left, +.layadmin-side-shrink .layadmin-pagetabs, +.layadmin-side-shrink .layui-layout-admin .layui-body, +.layadmin-side-shrink .layui-layout-admin .layui-footer { + left: 60px; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav { + position: static; + width: 60px; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav-item { + position: static; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav-item > a { + padding-right: 0; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav-item cite, +.layadmin-side-shrink + .layui-side-menu + .layui-nav + > .layui-nav-item + > a + .layui-nav-more, +.layadmin-side-shrink + .layui-side-menu + .layui-nav + > .layui-nav-item + > .layui-nav-child { + display: none; + padding: 8px 0; + width: 200px; +} + +.layadmin-side-shrink .layui-side-menu .layui-nav > .layui-nav-itemed > a { + background: rgba(0, 0, 0, 0.3); +} + +/* 移动端展开模式 */ +.layadmin-side-spread-sm .layui-layout-admin .layui-layout-left, +.layadmin-side-spread-sm .layadmin-pagetabs, +.layadmin-side-spread-sm .layui-layout-admin .layui-body, +.layadmin-side-spread-sm .layui-layout-admin .layui-footer { + left: 0; + transform: translate3d(220px, 0, 0); + -webkit-transform: translate3d(220px, 0, 0); +} + +.layadmin-side-spread-sm .layui-layout-admin .layui-layout-right { + transform: translate3d(220px, 0, 0); + -webkit-transform: translate3d(220px, 0, 0); +} + +.layadmin-side-spread-sm .layui-side { + transform: translate3d(0, 0, 0); + -webkit-transform: translate3d(0, 0, 0); +} + +.layadsidmin-e-spread-sm .layadmin-body-shade { + display: block; +} + +/* 页面标签 */ +.layadmin-pagetabs { + height: 40px; + line-height: 40px; + padding: 0 80px 0 40px; + /*border-bottom: 2px solid #292B34;*/ + background-color: #fff; + box-sizing: border-box; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); +} + +.layadmin-pagetabs .layadmin-tabs-control { + position: absolute; + top: 0; + width: 40px; + height: 100%; + text-align: center; + cursor: pointer; + transition: all 0.3s; + -webkit-transition: all 0.3s; + box-sizing: border-box; + border-left: 1px solid #f6f6f6; +} + +.layadmin-pagetabs .layadmin-tabs-control:hover { + background-color: #f6f6f6; +} + +.layadmin-pagetabs .layui-icon-prev { + left: 0; + border-left: none; + border-right: 1px solid #f6f6f6; +} + +.layadmin-pagetabs .layui-icon-next { + right: 40px; + right: 40px; +} + +.layadmin-pagetabs .layui-icon-down { + right: 0; +} + +.layadmin-tabs-select.layui-nav { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + padding: 0; + background: none; +} + +.layadmin-tabs-select.layui-nav .layui-nav-item { + line-height: 40px; +} + +.layadmin-tabs-select.layui-nav .layui-nav-item > a { + height: 40px; +} + +.layadmin-tabs-select.layui-nav .layui-nav-item a { + color: #666; +} + +.layadmin-tabs-select.layui-nav .layui-nav-child { + top: 40px; + left: auto; + right: 0; +} + +.layadmin-tabs-select.layui-nav .layui-nav-child dd.layui-this, +.layadmin-tabs-select.layui-nav .layui-nav-child dd.layui-this a { + background-color: #f2f2f2 !important; + color: #333; +} + +.layadmin-tabs-select.layui-nav .layui-nav-more, +.layadmin-tabs-select.layui-nav .layui-nav-bar { + display: none; +} + +.layadmin-pagetabs .layui-tab { + margin: 0; + overflow: hidden; +} + +.layadmin-pagetabs .layui-tab-title { + height: 40px; + border: none; +} + +.layadmin-pagetabs .layui-tab-title li { + min-width: 0; + line-height: 40px; + max-width: 160px; + text-overflow: ellipsis; + padding-right: 40px; + overflow: hidden; + border-right: 1px solid #f6f6f6; + vertical-align: top; +} + +.layadmin-pagetabs .layui-tab-title li:first-child { + padding-right: 15px; +} + +.layadmin-pagetabs .layui-tab-title li:first-child .layui-tab-close { + display: none; +} + +.layadmin-pagetabs .layui-tab-title li .layui-tab-close { + position: absolute; + right: 8px; + top: 50%; + margin: -7px 0 0 0; + width: 16px; + height: 16px; + line-height: 16px; + border-radius: 50%; + font-size: 12px; +} + +.layadmin-pagetabs .layui-tab-title li:after { + content: ""; + position: absolute; + top: 0; + left: 0; + width: 0; + height: 2px; + border-radius: 0; + background-color: #292b34; + transition: all 0.3s; + -webkit-transition: all 0.3s; +} + +.layadmin-pagetabs .layui-tab-title li:hover:after { + width: 100%; +} + +.layadmin-pagetabs .layui-tab-title li:hover, +.layadmin-pagetabs .layui-tab-title li.layui-this { + background-color: #f6f6f6; +} + +.layadmin-pagetabs .layui-tab-title li.layui-this:after { + width: 100%; + border: none; + height: 2px; + background-color: #292b34; +} + +/* 不开启页面标签时 */ +.layadmin-tabspage-none .layui-layout-admin .layui-header { + border-bottom: none; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); +} + +.layadmin-tabspage-none .layui-layout-admin .layui-body { + top: 50px; +} + +.layadmin-tabspage-none .layadmin-header { + display: block; +} + +.layadmin-tabspage-none .layadmin-header .layui-breadcrumb { + border-top: 1px solid #f6f6f6; +} + +/* 底部固定区域 */ +.layui-layout-admin .layui-footer { + padding: 10px 0; + text-align: center; +} + +/* 默认主题修饰 */ +.layui-layout-admin .layui-header { + border-bottom: 1px solid #f6f6f6; + box-sizing: border-box; + background-color: #fff; +} + +.layui-layout-admin .layui-header a, +.layui-layout-admin .layui-header a cite { + color: #333; +} + +.layui-layout-admin .layui-header a:hover { + color: #000; +} + +.layui-layout-admin .layui-header .layui-nav .layui-nav-more { + border-top-color: #666; +} + +.layui-layout-admin .layui-header .layui-nav .layui-nav-mored { + border-color: transparent; + border-bottom-color: #666; +} + +.layui-layout-admin .layui-header .layui-nav .layui-this:after, +.layui-layout-admin .layui-header .layui-nav-bar { + height: 2px; + background-color: #20222a; +} + +.layui-layout-admin .layui-logo { + background-color: #20222a; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); +} + +.layui-layout-admin .layui-logo, +.layui-layout-admin .layui-logo a { + color: #fff; + color: rgba(255, 255, 255, 0.8); +} + +.layui-side-menu { + box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.05); +} + +.layui-layout-admin .layui-footer { + box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.05); +} + +.layui-side-menu, +.layadmin-setTheme-side { + background-color: #20222a; + color: #fff; +} + +.layadmin-setTheme-header { + background-color: #fff; +} + +.layui-layout-admin .layui-footer { + background-color: #fff; +} + +.layui-tab-admin .layui-tab-title { + background-color: #393d49; + color: #fff; +} + +/* + + 格局 + +*/ + +.layui-fluid { + padding: 15px; +} + +.layadmin-header { + display: none; + height: 50px; + line-height: 50px; + margin-bottom: 0; + border-radius: 0; +} + +.layadmin-header .layui-breadcrumb { + padding: 0 15px; +} + +.layui-card-header { + position: relative; +} + +.layui-card-header .layui-icon { + line-height: initial; + position: absolute; + right: 15px; + top: 50%; + margin-top: -7px; +} + +.layadmin-iframe { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + right: 0; + bottom: 0; +} + +/* + + 控制台 + +*/ + +/* 重置轮播样式 */ +.layadmin-carousel { + height: 185px !important; + background-color: #fff; +} + +.layadmin-carousel .layui-carousel-ind li { + background-color: #e2e2e2; +} + +.layadmin-carousel .layui-carousel-ind li:hover { + background-color: #c2c2c2; +} + +.layadmin-carousel .layui-carousel-ind li.layui-this { + background-color: #999; +} + +.layadmin-carousel .layui-carousel, +.layadmin-carousel > *[carousel-item] > * { + background-color: #fff; +} + +.layadmin-carousel .layui-col-space10 { + margin: 0; +} + +.layadmin-carousel .layui-carousel-ind { + position: absolute; + top: -41px; + text-align: right; +} + +.layadmin-carousel .layui-carousel-ind ul { + background: none; +} + +/* 重置tab样式 */ +.layui-card .layui-tab-brief .layui-tab-title { + height: 42px; + border-bottom-color: #f6f6f6; +} + +.layui-card .layui-tab-brief .layui-tab-title li { + margin: 0 15px; + padding: 0; + line-height: 42px; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this { + color: #333; +} + +.layui-card .layui-tab-brief .layui-tab-title .layui-this:after { + height: 43px; +} + +.layui-card .layui-tab-brief .layui-tab-content { + padding: 15px; +} + +.layui-card .layui-table-view { + margin: 0; +} + +/* 快捷方式 */ +.layadmin-shortcut li { + text-align: center; +} + +.layadmin-shortcut li .layui-icon { + display: inline-block; + width: 100%; + height: 60px; + line-height: 60px; + text-align: center; + border-radius: 2px; + font-size: 30px; + background-color: #f8f8f8; + color: #333; + transition: all 0.3s; + -webkit-transition: all 0.3s; +} + +.layadmin-shortcut li cite { + position: relative; + top: 2px; + display: block; + color: #666; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + font-size: 14px; +} + +.layadmin-shortcut li:hover .layui-icon { + background-color: #f2f2f2; +} + +/* 待办事项 */ +.layadmin-backlog .layadmin-backlog-body { + display: block; + padding: 10px 15px; + background-color: #f8f8f8; + color: #999; + border-radius: 2px; + transition: all 0.3s; + -webkit-transition: all 0.3s; +} + +.layadmin-backlog-body h3 { + padding-bottom: 10px; + font-size: 12px; +} + +.layadmin-backlog-body p cite { + font-style: normal; + font-size: 30px; + font-weight: 300; + color: #009688; +} + +.layadmin-backlog-body:hover { + background-color: #f2f2f2; + color: #888; +} + +/* 数据概览 */ +.layadmin-dataview { + height: 332px !important; +} + +.layadmin-dataview > *[carousel-item]:before { + display: none; +} + +.layadmin-dataview > *[carousel-item] > div { + height: 332px; +} + +/* 控制台效果报告 */ +.layadmin-takerates { + padding-top: 5px; +} + +.layadmin-takerates .layui-progress { + margin: 50px 0 60px; +} + +.layadmin-takerates .layui-progress:last-child { + margin-bottom: 10px; +} + +.layadmin-takerates .layui-progress h3 { + position: absolute; + right: 0; + top: -35px; + color: #999; + font-size: 14px; +} + +.layadmin-takerates .layui-progress-bar { + text-align: left; +} + +.layadmin-takerates .layui-progress-text { + top: -35px; + line-height: 26px; + font-size: 26px; +} + +/* 产品动态 */ +.layadmin-news { + height: 60px !important; + padding: 5px 0; +} + +.layadmin-news a { + display: block; + line-height: 60px; + text-align: center; +} + +.layadmin-news .layui-carousel-ind { + height: 45px; +} + +/* 文字列表 */ +.layadmin-list li { + margin-bottom: 6px; + padding-bottom: 6px; + border-bottom-color: #f6f6f6; + list-style-position: inside; + list-style-type: disc; +} + +.layadmin-list li { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.layadmin-list li a { + color: #666; +} + +.layadmin-list li a:hover { + color: #009688; +} + +.layadmin-list li:last-child { + border: none; + padding: 0; + margin: 0; +} + +/* 文本区域 */ +.layadmin-text p { + margin-bottom: 10px; + text-indent: 2em; +} + +.layadmin-text p:last-child { + margin: 0; +} + +.layadmin-font-em { + font-size: 13px; + color: #758697; +} + +/******************************** + + 其它主页开始 By star1029 + +*******************************/ + +/* 主页示例一 by star1029 */ +/* 进行中的项目 */ +.layui-card-header .layui-a-tips { + position: absolute; + right: 15px; + color: #01aaed; +} + +.layuiadmin-card-text { + background-color: #f8f8f8; + color: #777; + padding: 24px; +} + +.layuiadmin-card-text .layui-text-top { + padding-bottom: 10px; +} + +.layuiadmin-card-text .layui-text-top i { + margin-right: 10px; + font-size: 24px; + color: #009688; +} + +.layuiadmin-card-text .layui-text-top a { + line-height: 24px; + font-size: 16px; + vertical-align: top; +} + +.layuiadmin-card-text .layui-text-center { + height: 44px; + line-height: 22px; + margin-bottom: 10px; + overflow: hidden; +} + +.layuiadmin-card-text .layui-text-bottom { + position: relative; +} + +.layuiadmin-card-text .layui-text-bottom a { + color: #777; + font-size: 12px; + text-overflow: ellipsis; + word-break: break-all; +} + +.layuiadmin-card-text .layui-text-bottom span { + color: #ccc; + font-size: 12px; + position: absolute; + right: 0; +} + +.layuiadmin-card-text a:hover, +.layuiadmin-card-link a:hover, +.layuiadmin-card-team li a:hover { + color: #01aaed; + transition: all 300ms; +} + +/* 动态 */ +.layuiadmin-card-status { + padding: 0 10px 10px 10px; +} + +.layuiadmin-card-status dd { + padding: 15px 0; + border-bottom: 1px solid #eee; + display: -webkit-flex; + display: flex; +} + +.layuiadmin-card-status dd:last-child { + border: none; +} + +.layuiadmin-card-status dd div.layui-status-img, +.layuiadmin-card-team .layui-team-img { + width: 32px; + height: 32px; + border-radius: 50%; + background-color: #009688; + margin-right: 15px; +} + +.layuiadmin-card-status dd div.layui-status-img a { + width: 100%; + height: 100%; + display: inline-block; + text-align: center; + line-height: 32px; +} + +.layuiadmin-card-status dd div.layui-status-img img, +.layuiadmin-card-team .layui-team-img img { + width: 50%; + height: 50%; +} + +.layuiadmin-card-status dd div a { + color: #01aaed; +} + +.layuiadmin-card-status dd div span { + color: #bbb; +} + +/* 便捷导航 */ +.layuiadmin-card-link { + padding-left: 10px; + font-size: 0; +} + +.layuiadmin-card-link a { + display: inline-block; + width: 25%; + color: #666; + font-size: 14px; + margin-bottom: 12px; +} + +.layuiadmin-card-link button { + vertical-align: top; +} + +.layuiadmin-card-link button:hover { + color: #009688; +} + +/* 团队 */ +.layuiadmin-card-team li { + padding: 10px 0 10px 10px; +} + +.layuiadmin-card-team .layui-team-img { + display: inline-block; + margin-right: 8px; + width: 24px; + height: 24px; + text-align: center; + line-height: 24px; +} + +.layuiadmin-card-team span { + color: #777; +} + +/* 主页示例二 by star1029 */ +.layuiadmin-badge { + position: absolute; + top: 50%; + margin-top: -9px; + right: 15px; + color: #01aaed; +} + +.layuiadmin-card-list { + padding: 15px; +} + +.layuiadmin-card-list p.layuiadmin-big-font { + font-size: 36px; + color: #666; + line-height: 36px; + padding: 5px 0 10px; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-all; + white-space: nowrap; +} + +.layuiadmin-card-list p.layuiadmin-normal-font { + padding-bottom: 10px; + font-size: 20px; + color: #666; + line-height: 24px; +} + +.layuiadmin-span-color { + font-size: 14px; + position: absolute; + right: 15px; +} + +.layuiadmin-span-color i { + padding-left: 5px; +} + +.layuiadmin-btn-group { + position: absolute; + right: 15px; +} + +.layuiadmin-card-status li { + position: relative; + padding: 10px 0; + border-bottom: 1px solid #eee; +} + +.layuiadmin-card-status li h3 { + padding-bottom: 5px; + font-weight: 700; +} + +.layuiadmin-card-status li p { + padding-bottom: 10px; +} + +.layuiadmin-card-status li > span { + color: #999; +} + +.layuiadmin-home2-usernote .layuiadmin-reply { + display: none; + position: absolute; + right: 0; + bottom: 12px; +} + +.layuiadmin-home2-usernote li:hover .layuiadmin-reply { + display: block; +} + +.layuiadmin-page-table td span { + color: #2f4056; +} + +.layuiadmin-page-table td span.first { + color: #ff5722; +} + +.layuiadmin-page-table td span.second { + color: #ffb800; +} + +.layuiadmin-page-table td span.third { + color: #5fb878; +} + +/****** 其它主页结束 By star1029 ******/ + +/* + + 应用 + +*/ + +/* 消息中心 */ +.layuiAdmin-msg-detail h1 { + font-size: 16px; +} + +.layuiAdmin-msg-detail .layui-card-header { + height: auto; + line-height: 30px; + padding: 15px; +} + +.layuiAdmin-msg-detail .layui-card-header span { + padding: 0 5px; + color: #999; +} + +.layuiAdmin-msg-detail .layui-card-header span:first-child { + padding-left: 0; +} + +.layuiAdmin-msg-detail .layui-card-body { + padding: 15px; +} + +/* 文章列表 */ +.layuiadmin-content-bread { + padding-bottom: 20px; +} + +/* 进度条样式 */ +.layuiadmin-order-progress { + position: relative; + top: 12px; +} + +/* + + 系统 + +*/ + +/* 头部图标重置 */ +.layui-card-header.layuiadmin-card-header-auto { + padding-top: 15px; + padding-bottom: 15px; + height: auto; +} + +.layuiadmin-card-header-auto i.layuiadmin-button-btn { + position: relative; + right: 0; + top: 0; + vertical-align: middle; +} + +.layuiadmin-card-header-auto .layui-form-item:last-child { + margin-bottom: 0; +} + +/* 主题设置 */ +.layadmin-setTheme { + padding: 15px; + overflow-x: hidden; +} + +.layadmin-setTheme > h5 { + padding: 20px 0 10px; + color: #000; +} + +.layadmin-setTheme > h5:first-child { + padding-top: 0; +} + +.layadmin-setTheme-color { + width: 330px; + font-size: 0; +} + +.layadmin-setTheme-color li { + position: relative; + display: inline-block; + vertical-align: top; + width: 80px; + height: 50px; + margin: 0 15px 15px 0; + background-color: #f2f2f2; + cursor: pointer; + font-size: 12px; + color: #666; +} + +.layadmin-setTheme-color li:after { + content: ""; + position: absolute; + z-index: 20; + top: 50%; + left: 50%; + width: 1px; + height: 0; + border: 1px solid #f2f2f2; + transition: all 0.3s; + -webkit-transition: all 0.3s; + opacity: 0; +} + +.layadmin-setTheme-color li.layui-this:after, +.layadmin-setTheme-color li:hover:after { + width: 100%; + height: 100%; + padding: 4px; + top: -5px; + left: -5px; + border-color: #5fb878; + opacity: 1; +} + +.layadmin-setTheme-header { + position: relative; + z-index: 10; + height: 10px; + border-top: 1px solid #f2f2f2; + border-right: 1px solid #f2f2f2; +} + +.layadmin-setTheme-side { + position: absolute; + left: 0; + top: 0; + width: 20px; + height: 100%; + z-index: 11; + box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.05); +} + +.layadmin-setTheme-logo { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 10px; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); +} + +.layadmin-form-right { + text-align: right; +} + +/* 关于 */ +.layadmin-about p { + margin-bottom: 10px; +} + +/* 菜单列表 */ +.layadmin-menu-list .layui-card-header { + height: 50px; + line-height: 50px; + font-size: 16px; +} + +.layadmin-menu-list .layui-card-header:active { + background-color: #f2f2f2; +} + +.layadmin-menu-list .layui-card-header .layui-icon { + position: relative; + top: 1px; + left: 0; + display: inline-block; + margin: 0 10px 0; + font-size: 18px; +} + +/* 动画 */ +@-webkit-keyframes layui-rl { + /* 从右往左滑入 */ + from { + -webkit-transform: translate3d(100%, 0, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + } +} + +@keyframes layui-rl { + from { + transform: translate3d(100%, 0, 0); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.layui-anim-rl { + -webkit-animation-name: layui-rl; + animation-name: layui-rl; +} + +@-webkit-keyframes layui-lr { + /* 从右往左滑入 */ + from { + -webkit-transform: translate3d(0 0, 0); + opacity: 1; + } + + to { + -webkit-transform: translate3d(100%, 0, 0); + opacity: 1; + } +} + +@keyframes layui-lr { + from { + transform: translate3d(0, 0, 0); + } + + to { + transform: translate3d(100%, 0, 0); + } +} + +.layui-anim-lr { + -webkit-animation-name: layui-lr; + animation-name: layui-lr; +} + +.layui-anim-rl.layer-anim-close { + -webkit-animation-name: layui-lr; + animation-name: layui-lr; +} + +/* 提示页 */ +.layadmin-tips { + margin-top: 30px; + text-align: center; +} + +.layadmin-tips .layui-icon[face] { + display: inline-block; + font-size: 300px; + color: #393d49; +} + +.layadmin-tips .layui-text { + width: 500px; + margin: 30px auto; + padding-top: 20px; + border-top: 5px solid #009688; + font-size: 16px; +} + +.layadmin-tips h1 { + font-size: 100px; + line-height: 100px; + color: #009688; +} + +.layadmin-tips .layui-text .layui-anim { + display: inline-block; +} + +/* + + 响应式补充 + +*/ + +@media screen and (max-width: 768px) { + /* 产品清单模板 */ + .layadmin-panel-selection { + margin: 0; + width: auto; + } + + /* 导航 */ + .layui-body .layui-nav .layui-nav-item { + display: block; + } + + /* 主体容器 */ + .layui-layout-admin .layui-body .layadmin-tabsbody-item { + -webkit-overflow-scrolling: touch; + overflow: auto; + } +} + +.layui-card { + background: rgba(255, 255, 255, 1); + box-shadow: 0px 2px 20px rgba(228, 232, 233, 1); + opacity: 1; + border-radius: 0px 4px 4px 4px; +} + +.layui-card .layui-tab-brief { + box-shadow: 0px 2px 20px #e4e8e9; + opacity: 1; + border-radius: 0px 4px 4px 4px; + background-color: #fff; +} + +.layui-card .layui-tab-brief .layui-tab-title { + background-color: #fff; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this { + background-color: #fff; + color: #3d89ff; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-bottom: 2px solid #3d89ff; + border-top: none; +} + +.layui-card .layui-tab-card .layui-tab-title li.layui-this { + background-color: #f2f2f2; +} + +.layui-card .layui-tab-card .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-bottom: 2px solid #3d89ff; + border-top: none; +} + +.layui-card .layui-tab-title { + background-color: #f2f2f2; +} + +.layui-card .layui-tab-title li.layui-this { + background-color: #fff; +} + +.layui-card .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-top: 2px solid #3d89ff; + border-bottom: none; +} + +.layui-card .layui-tab-title li .layui-tab-close { + background-color: #f2f4f5; + border-radius: 50%; +} + +.layui-card .layui-tab-title li .layui-tab-close:hover { + background-color: #ff5722; +} + +/* .layui-btn { + background: #3D89FF; + border-radius: 4px; + margin-right: 8px; + margin-bottom: 8px; +} + +.layui-btn.layui-btn-primary { + background: #fff; + border: 1px solid #dedfe1; + border-radius: 4px; + color: #454b50; +} + +.layui-btn.layui-btn-normal { + color: #3D89FF; + border-color: #3D89FF; + border-style: solid; + border-width: 1px; + background: #fff; +} + +.layui-btn.layui-btn-disabled { + background-color: #9CC0F9; + color: #fff; +} + +.layui-btn.layui-btn-disabled-default { + border-width: 1px; + border-style: solid; + border-color: #dedfe1; + background-color: #dedfe1; + color: #b8b8b8; +} + +.layui-btn.layui-btn-danger { + background-color: #ff4d4f; +} */ + +.layui-table thead tr, +.layui-table-click, +.layui-table-header, +.layui-table-hover, +.layui-table-mend, +.layui-table-patch, +.layui-table-tool, +.layui-table-total, +.layui-table-total tr, +.layui-table[lay-even] tr:nth-child(even) { + background-color: #f6f8f9; +} + +.layui-table thead tr { + border-left: 4px; + border-left-style: solid; + border-color: #f6f8f9; +} + +.layui-table tbody tr { + border-left: 4px; + border-left-style: solid; + border-color: transparent; +} + +.layui-table tbody tr:hover { + background-color: #e8f2ff; + border-color: #3d89ff; +} + +.layui-table-view .layui-form-checkbox[lay-skin="primary"] i { + width: 14px; + height: 14px; + line-height: 14px; +} + +.layui-form-checkbox[lay-skin="primary"]:hover i { + border-color: #3d89ff; +} + +.layui-table .layui-a { + color: #3d89ff; + cursor: pointer; + display: inline-block; + padding: 0px 5px; +} + +.layui-table .layui-a.layui-a-primary { + color: #ff9800; +} + +.layui-table .layui-a.layui-a-danger { + color: #f63c49; +} + +.layui-laypage span, +.layui-laypage a { + margin-right: 8px; + border-radius: 4px; +} + +.layui-laypage span.layui-laypage-curr { + border-width: 1px; + border-style: solid; + border-color: #3d89ff; +} + +.layui-laypage span.layui-laypage-curr .layui-laypage-em { + background-color: unset; + color: #3d89ff; +} + +.layui-laypage span.layui-laypage-curr em { + color: #3d89ff; +} + +.layui-laypage a { + border-color: #dfe5e8; + border-style: solid; + border-width: 1px; +} + +.layui-layer.layui-layer-msg { + width: auto !important; +} + +.layui-layer.layui-layer-msg .layui-layer-content { + height: auto; +} + +.layui-layer .layui-layer-title { + color: #454b50; + height: 49px; + line-height: 49px; + padding: 0 80px 0 16px; +} + +.layui-layer.layui-layer-page .layui-layer-content { + padding: 30px 30px 20px 0px; + overflow-y: auto; +} + +.layui-layer.layui-layer-dialog .layui-layer-content { + text-align: center; +} + +.layui-layer.layui-layer-dialog .layui-layer-btn { + text-align: center; +} + +.layui-form-radio i { + font-size: 16px; + margin-right: 6px; +} + +.layui-form-radio i:hover { + color: #3d89ff; +} + +.layui-form-radio.layui-form-radioed i { + color: #3d89ff; +} + +.layui-form-radio.layui-form-radioed i:hover { + color: #3d89ff; +} + +.layui-form-checked { + border-color: #3d89ff; +} + +.layui-form-checked i { + color: #3d89ff; +} + +.layui-form-checked span { + background-color: #3d89ff; +} + +.layui-form-checked:hover { + border-color: #3d89ff; +} + +.layui-form-checked:hover i { + color: #3d89ff; +} + +.layui-form-checked:hover span { + background-color: #3d89ff; +} + +.layui-form-checkbox[lay-skin="primary"] { + padding-left: 20px; +} + +.layui-form-checkbox[lay-skin="primary"] i { + width: 14px; + height: 14px; + line-height: 14px; +} + +.layui-form-checkbox[lay-skin="primary"]:hover i { + border-color: #3d89ff; +} + +.layui-form-checked[lay-skin="primary"] i { + border-color: #3d89ff; + background-color: #3d89ff; +} + +.layui-form-checkbox[lay-skin="primary"] span { + background: 0 0; + color: #666; +} + +.layui-form-switch.layui-form-onswitch { + border-color: #3d89ff; + background-color: #3d89ff; +} + +.layui-input { + border-radius: 4px; +} + +.layui-input:focus, +.layui-input:hover { + border-color: #3d89ff !important; +} + +.layui-input-disable { + border-radius: 4px; + background-color: #f5f5f5; + border: 1px solid #e7e8eb; + color: #bdc2c5; +} + +.layui-input:focus, +.layui-input-disable:hover { + border-color: #e7e8eb !important; +} + +.layui-form-danger { + border-color: #ff4d4f; +} + +.layui-form-danger:focus { + border-color: #ff4d4f; +} + +.layui-unselect dl dd:hover { + background-color: #e8f2ff; +} + +.layui-unselect dl dd.layui-this { + background-color: #e8f2ff; + color: #454b50; +} + +.layui-nav { + background-color: #323e47; +} + +.layui-nav.layui-nav-tree .layui-nav-bar { + background-color: #3d89ff; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed { + margin-bottom: 3px; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed > .layui-nav-child { + background-color: unset !important; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed:before { + position: absolute; + content: ""; + top: 0; + right: 0; + bottom: 3px; + left: 5px; + width: calc(100% - 10px); + height: 100%; + background-color: rgba(81, 94, 104, 0.53); + border-radius: 4px; +} + +.layui-nav.layui-nav-tree .layui-nav-child dd { + width: calc(100% - 10px); + margin: 0 auto; +} + +.layui-nav.layui-nav-tree .layui-nav-child a { + width: calc(100% - 40px); + margin: 0 auto; +} + +.layui-nav.layui-nav-tree .layui-nav-child a:hover { + background: #515e68; + border-radius: 4px; + width: calc(100% - 40px); +} + +.layui-nav.layui-nav-tree .layui-nav-child a:hover:after { + position: absolute; + content: ""; + left: 0; + top: 0; + bottom: 0; + width: 3px; + background-color: #3d89ff; + z-index: 2; +} + +.layui-nav.layui-nav-tree .layui-nav-item a:hover { + background-color: unset; +} + +.layui-nav.layui-nav-tree .layui-this, +.layui-nav.layui-nav-tree .layui-this > a, +.layui-nav.layui-nav-tree .layui-nav-child dd.layui-this, +.layui-nav.layui-nav-tree .layui-nav-child dd.layui-this a { + background-color: #3d89ff !important; + border-radius: 4px; +} + +.layui-nav .layui-this:after, +.layui-nav-bar, +.layui-nav-tree .layui-nav-itemed:after { + background-color: #3d89ff; +} + +/* 颜色 */ +.layui-bg-gray-1 { + background-color: #f2f4f5 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-2 { + background-color: #f3f3f3 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-3 { + background-color: #dedfe1 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-4 { + background-color: #e3e3e3 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-5 { + background-color: #f6f8f9 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-6 { + background-color: #f8f8f8 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-blue-1 { + background-color: #3d89ff !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-1 { + background-color: #323e47 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-2 { + background-color: #424e58 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-3 { + background-color: #515e68 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-select-gray { + background-color: #ebebeb !important; + opacity: 1; + border-radius: 4px; +} + +.layui-text-blue-1 { + color: #3d89ff !important; +} + +.layui-text-black-1 { + color: #454b50 !important; +} + +.layui-text-black-2 { + color: #515151 !important; +} + +.layui-text-gray-1 { + color: #8e8e8e !important; +} + +.layui-text-gray-2 { + color: #c3c3c3 !important; +} + +.layui-text-red-1 { + color: #f63c49 !important; +} + +.layui-table td, +.layui-table th, +.layui-table-fixed-r, +.layui-table-header, +.layui-table-page, +.layui-table-tips-main, +.layui-table-tool, +.layui-table-view, +.layui-table[lay-skin="line"], +.layui-table[lay-skin="row"] { + border-width: 0px; + border-style: solid; + border-color: #e6e6e6; +} + +.layui-layer-btn-c { + text-align: right !important; +} + +.layui-laypage { + display: block; + margin: 0; + font-size: 0; + text-align: center; +} + +/* 按钮 */ +.layui-btn-default { + width: 80px; + height: 32px; + line-height: 32px; + padding: 0px; +} +.layui-btn-blue { + background-color: #3d89ff; + border-radius: 4px; + color: #ffffff; +} + +.layui-btn-primary-gray { + border: 1px solid #cfd0d4; + background-color: #fff; + border-radius: 4px; + color: #454b50; +} + +.layui-btn-primary-blue { + border: 1px solid #3d89ff; + background-color: #fff; + border-radius: 4px; + color: #3d89ff; +} + +.layui-btn-primary-gray:hover { + border-color: #3d89ff; + color: #333; +} + +.layui-btn-primary-blue:hover { + border-color: #3d89ff; + color: #333; +} + +.layui-btn-disabled-blue { + background-color: #9cc0f9; + border-width: 0px; + border-radius: 4px; + color: #ffffff; +} + +.layui-btn-disabled-gray { + background-color: #f5f5f5; + border-width: 1px; + border-color: #dedfe1; + border-radius: 4px; + color: #b8b8b8; +} + +.layui-btn-disabled-gray:hover { + opacity: 0.8; + color: #b8b8b8; +} + +.layui-btn-normal-blue { + background-color: #3d89ff; + border-radius: 4px; + color: #ffffff; +} + +.layui-btn-sm { + height: 38px !important; + line-height: 38px !important; + padding: 0 10px; + font-size: 12px; +} + +.layui-btn-lg-blue { + background-color: #3d89ff; + height: 44px; + line-height: 44px; + padding: 0 25px; + font-size: 16px; + border-radius: 4px; +} + +.layui-btn-sm-blue { + background-color: #3d89ff; + height: 30px; + line-height: 30px; + padding: 0 10px; + font-size: 12px; + border-radius: 4px; +} + +.layui-btn-xs-blue { + background-color: #3d89ff; + height: 22px; + line-height: 22px; + padding: 0 5px; + font-size: 12px; + border-radius: 4px; +} + +.layui-btn-danger-red { + background-color: #f63c49; + border-radius: 4px; +} + +/* 表单 */ +.layui-form-select dl dd.layui-this { + background-color: #3d89ff !important; + color: #fff !important; +} + +.layui-laydate .layui-this { + background-color: #3d89ff !important; + color: #fff !important; +} + +.layui-laydate-header i:hover, +.layui-laydate-header span:hover { + color: #3d89ff !important; +} + +.layui-laydate-footer span:hover { + color: #3d89ff !important; +} + +/* tab */ +.layui-nav .layui-this:after, +.layui-nav-bar, +.layui-nav-tree .layui-nav-itemed:after { + position: absolute; + left: 0; + top: 0; + width: 0; + height: 5px; + background-color: #3d89ff; + transition: all 0.2s; + -webkit-transition: all 0.2s; +} + +.layui-nav-pages { + font-size: 14px; + color: #454b50; + width: 100%; + height: 100%; +} + +.layui-nav-page-tabs { + width: 100%; + height: 100%; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; +} + +.layui-nav-page-menu { + color: #8e8e8e; + text-decoration: none; + line-height: 42px; + padding-left: 29px; + padding-right: 9px; + background-color: transparent; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.layui-nav-page-menu.active { + background-color: #ffffff; + border-radius: 6px 6px 0px 0px; + position: relative; + color: #454b50; +} + +.layui-pages { + flex: 1; + background-color: #ffffff; + margin-top: 10px; + box-shadow: 0px 2px 10px 0px rgba(228, 232, 233, 0.8); + border-radius: 0px 0px 4px 4px; +} + +.layui-tab-title-black { + color: #454b50; +} + +.layui-tab-brief > .layui-tab-title .layui-this { + color: #3d89ff; +} + +.layui-tab-brief > .layui-tab-more li.layui-this:after, +.layui-tab-brief > .layui-tab-title .layui-this:after { + border: none; + border-radius: 0; + border-bottom: 3px solid #3d89ff; +} + +/* 内容块 */ +.layui-form-gray { + background-color: #f8f8f8; + border-radius: 2px; + border: 1px solid #ececec; + padding: 22px 0px 0px 24px; + margin-bottom: 14px; +} + +.layui-input-inline-w218 { + width: 218px !important; +} + +.layui-input-inline-w303 { + width: 303px !important; +} + +.layui-input-inline-w650 { + width: 650px !important; +} + +.layui-icon-upload { + width: 55px; + height: 55px; + background-color: #ffffff; + border-radius: 4px; + border: 1px dashed #d2d3d8; +} + +.layui-input-inline-upload { + width: 55px !important; + margin-left: 14px; +} + +.layui-form-mid-hint { + margin-left: 55px; +} + +.layui-title1 { + display: flex; + margin-bottom: 24px; + align-items: center; +} + +.layui-title-line { + width: 3px; + height: 16px; + background-color: #3d89ff; + margin-right: 6px; + float: left; +} + +.layui-title-label1 { + font-size: 18px; + color: #333333; +} + +.layui-title2 { + display: flex; + margin: 22px 0px 14px 0px; + /* align-items: center; */ +} + +.layui-title-label2 { + font-size: 14px; + color: #454b50; +} + +/* 逐条添加 */ +.layui-form-item-gray { + background-color: #ffffff; + border-radius: 4px; + border: 1px solid #ececec; + margin-bottom: 20px; +} + +.layui-form-item-left1 { + padding: 20px 0px 0px 20px; + background: #f8f8f8; +} + +.layui-form-item-left2 { + float: left; + padding: 20px 0px 0px 20px; + width: 96%; + background: #f8f8f8; +} + +.layui-form-item-right { + float: left; + width: 30px; + height: 179px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + border-left: 1px solid #e9e9e9; + display: flex; + align-items: center; + justify-content: center; +} + +.layui-icon-close-gray { + color: #8e8e8e; + font-size: 10px; +} + +.layui-form-label-item { + padding: 9px 0px; +} + +.layui-input-block-item { + display: flex; + align-items: center; + margin-left: 90px; +} + +.layui-form-item-add { + height: 50px; + border-radius: 4px; + border: 1px dashed #d2d3d8; + margin-bottom: 20px; + display: flex; + align-items: center; + padding-left: 20px; + font-size: 14px; + color: #454b50; +} + +.layui-icon-add-circle-fine-blue { + float: left; + font-size: 20px; + color: #3d89ff; + margin-right: 8px; +} + +/* 数据表单 */ +.layui-custom-line { + border-top: 1px solid #e6e6e6; + border-bottom: 1px solid #e6e6e6; + border-left: 1px solid #e6e6e6; +} + +.lauyu-custom-item-line { + width: 100%; + height: 1px; + background-color: #e6e6e6; +} + +.layui-custom-key { + height: 50px; + background-color: #f6f7f9; + border-right: 1px solid #e6e6e6; + display: flex; + align-items: center; + justify-content: center; +} + +.layui-custom-value { + height: 50px; + border-right: 1px solid #e6e6e6; + display: flex; + align-items: center; + padding: 0px 40px; +} + +.layui-form-block { + background: rgba(248, 248, 248, 1); + border: 1px solid rgba(236, 236, 236, 1); + opacity: 1; + border-radius: 4px; + padding: 20px 20px 5px 0px; + margin-bottom: 10px; + position: relative; +} + +.layui-form-item-close { + position: absolute; + right: 0px; + top: 0px; + width: 30px; + height: 100%; + text-align: center; + border-left: 1px solid rgba(233, 233, 233, 1); + background: rgba(255, 255, 255, 1); + opacity: 1; + border-radius: 0px 4px 4px 0px; +} + +.layui-form-item-close-icon { + position: absolute; + top: 50%; + right: 50%; + text-align: center; + width: 10px; + height: 10px; + color: #f63c49; + cursor: pointer; + font-weight: bold; +} + +.layui-table-tool { + background-color: #ffffff; +} + +.layui-card-gray { + margin-bottom: 15px; + border-radius: 2px; + background-color: #fff; + box-shadow: 0 2px 10px 0 rgba(228, 232, 233, 0.8) !important; +} + +/* 弹窗 */ +.layui-layer { + box-shadow: 0px 2px 20px rgba(187, 187, 187, 0.53) !important; + border-radius: 4px !important; +} + +.layui-form-layer { + padding: 30px 30px 42px 30px; + border-bottom: 1px solid #efefef; +} + +.layui-input-noborder { + border: 0px; + /* width: 150px */ +} + +.layui-layer-row-checkbox { + padding: 22px 22px 0px 22px; +} + +.layui-layer-row-select { + min-height: 259px; + border: 1px solid #dedfe1; + border-radius: 4px; + margin-top: 10px; + padding: 16px; +} + +.layui-layer-select { + width: 66px !important; + height: 32px; + margin: 0px 8px 8px 0px; + border: 1px solid #3d89ff; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + font-size: 14px; + color: #454b50; + float: left; +} + +.layui-inline-layer-btn { + position: relative; + left: 348px; + padding: 10px 0px; +} + +.layui-btn-layer { + width: 80px; + height: 32px; + line-height: 32px; +} + +.layui-text-gray { + font-size: 14px; + color: #454b50; +} + +.layui-transfer-data li:hover { + background-color: #e2edff; + transition: 0.5s all; +} + +.layui-transfer-active .layui-btn { + display: block; + margin: 0; + padding: 0 15px; + background-color: #3d89ff !important; + border-color: #3d89ff !important; + color: #fff; +} + +.layui-transfer-active .layui-btn-disabled { + background-color: #fbfbfb; + border-color: #e6e6e6; + color: #c9c9c9; +} + +.layui-form-checked[lay-skin="primary"] i { + border-color: #3d89ff !important; + background-color: #3d89ff; + color: #fff; +} + +/* 控件 */ +.layui-laypage a:hover { + color: #3d89ff; +} + +.layui-laypage input:focus, +.layui-laypage select:focus { + border-color: #3d89ff !important; +} + +.layui-laypage select { + height: 28px; + padding: 3px; + border-radius: 4px; + cursor: pointer; + background-color: #fff; +} + +.layui-icon-picture-gray { + font-size: 23px !important; + color: #a8a8a8 !important; +} +.layui-icon-close-fill-black { + font-size: 16px; + color: #000000; + position: relative; + left: -8px; + top: -8px; +} +.layui-row-fl { + float: left; +} +.layui-upload-drag { + float: left; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 0px; + font-size: 12px; + color: #a8a8a8; + border-radius: 4px; +} +.layui-upload-drag-lg { + width: 198px; + height: 198px; + margin-bottom: 20px; +} +.layui-upload-img-lg { + float: left; + width: 200px; + height: 200px; + margin-bottom: 20px; + border-radius: 4px; +} +.layui-upload-drag-mid { + width: 98px; + height: 98px; + margin-bottom: 20px; +} +.layui-upload-img-mid { + float: left; + width: 100px; + height: 100px; + margin-bottom: 20px; + border-radius: 4px; +} +.layui-upload-drag-sm { + width: 54px; + height: 54px; + margin-bottom: 8px; +} +.layui-upload-img-sm { + float: left; + width: 56px; + height: 56px; + margin-bottom: 8px; + border-radius: 4px; +} +.layui-upload-drag-xs { + width: 44px; + height: 44px; + margin-bottom: 8px; +} +.layui-upload-img-xs { + float: left; + width: 46px; + height: 46px; + margin-bottom: 8px; + border-radius: 4px; +} +.layui-upload-input { + width: 377px; + height: 32px; + margin-right: 16px; +} + +.layui-label { + float: left; + height: 32px; + padding: 0px 14px; + margin: 0px 8px 8px 0px; + background-color: #efefef; + border-radius: 4px; + font-size: 14px; + color: #454b50; + display: flex; + align-items: center; + justify-content: space-between; +} +.layui-icon-close-fill-label { + font-size: 14px; + color: #aeaeae; + margin-left: 8px; +} +.layui-input-inline-content { + padding: 19px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + border: 1px solid #e7e8eb; + box-shadow: 0px 2px 6px rgba(68, 70, 74, 0.05); + background-color: #ffffff; + font-size: 14px; + color: #454b50; +} +.layui-input-inline-content:hover { + border: 1px solid #3d89ff; +} +.layui-laypage select { + padding: 0px; + height: 26px; +} diff --git a/admin/static/scss/detail.scss b/admin/static/scss/detail.scss new file mode 100644 index 0000000..062e526 --- /dev/null +++ b/admin/static/scss/detail.scss @@ -0,0 +1,49 @@ +@import "./common/variables.scss"; + +.detail-card { + padding: 20px; +} +.detail-card .header { + display: flex; + align-items: center; + margin-bottom: 20px; +} +.detail-card .header .icon { + width: 4px; + height: 16px; + margin-right: 8px; + background: $main-bg; +} +.detail-card .header .title { + font-size: 18px; + font-family: MicrosoftYaHei; + color: rgba(69, 75, 80, 1); +} +.detail-card .content { + display: flex; + flex-direction: column; +} +.detail-card .content li:nth-child(odd) { + background: rgba(246, 248, 249, 1); +} +.detail-card .content li { + display: flex; + justify-content: space-around; + align-items: center; + height: 54px; + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(69, 75, 80, 1); +} +.detail-card .content li span { + flex-basis: 550px; +} +.detail-card .desc { + margin: 24px; + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(69, 75, 80, 1); +} +.layui-border-box { + margin-top: 0; +} diff --git a/admin/static/scss/edittable.scss b/admin/static/scss/edittable.scss new file mode 100644 index 0000000..4a294c6 --- /dev/null +++ b/admin/static/scss/edittable.scss @@ -0,0 +1,20 @@ +.layui-table-cell { + display: flex; + align-items: center; + .save-cell { + margin-right: 8px; + } +} + +.layui-table-click, +.layui-table-click:hover { + background-color: transparent; +} + +.opr-box { + display: flex; +} + +.opr-box .save-cell { + margin-right: 5px; +} diff --git a/admin/static/scss/excel.scss b/admin/static/scss/excel.scss new file mode 100644 index 0000000..798a4a1 --- /dev/null +++ b/admin/static/scss/excel.scss @@ -0,0 +1,26 @@ +.file { + position: relative; + display: inline-block; + background: #1289ff; + border-color: #1289ff; + color: #ffffff; + border-radius: 4px; + padding: 4px 12px; + overflow: hidden; + text-decoration: none; + text-indent: 0; + line-height: 20px; +} +.file input { + position: absolute; + font-size: 100px; + right: 0; + top: 0; + opacity: 0; +} +.file:hover { + background: #1289ff; + border-color: #1289ff; + color: #ffffff; + text-decoration: none; +} diff --git a/admin/static/scss/step.scss b/admin/static/scss/step.scss new file mode 100644 index 0000000..c42ad57 --- /dev/null +++ b/admin/static/scss/step.scss @@ -0,0 +1,415 @@ +@import "./common/variables.scss"; +.table-box { + min-height: 640px; +} + +.dialog-form { + margin-top: 30px; +} + +.step-box { + margin-top: 20px; +} + +.step-box .step-ul { + display: flex; + justify-content: space-around; + align-items: center; + background-color: rgba(246, 248, 249, 1); + height: 48px; +} + +.step-box .step-ul li { + z-index: 100; +} + +.step-box .step-ul .active { + font-size: 16px; + font-family: MicrosoftYaHei; + color: rgba(255, 255, 255, 1); +} + +.active-after { + width: 0; + height: 0; + border-color: transparent transparent transparent $main-border-color; + border-width: 24px 0 24px 12px; + border-style: solid; + position: absolute; +} + +.layui-progress { + background-color: $progress-bg; + font-size: 16px; + font-family: MicrosoftYaHei; + color: $progress-text-color; +} + +.layui-progress-bar { + background-color: $progress-bar-bg; +} + +.layui-progress-big, +.layui-progress-big .layui-progress-bar { + height: 48px; + line-height: 48px; +} + +.layui-progress-bar { + border-radius: 0; +} + +.step-1, +.step-2, +.step-3, +.step-4 { + display: flex; + justify-content: center; + align-items: center; +} + +.step-btn { + height: 32px; + line-height: 32px; + padding: 0 26px; + background-color: $button-bg; + border: none; + border-radius: 4px; + color: white; + cursor: pointer; + text-align: center; + font-size: 14px; + white-space: nowrap; + text-align: center; + vertical-align: middle; +} + +.layui-form .submit-btn, +.layui-form .next-btn { + color: white; + background-color: $button-bg; +} + +.layui-form .pre-btn { + font-size: 14px; + font-family: MicrosoftYaHei; + color: $main-text-color; + background: $button-reset-bg; + border-radius: 4px; + border: 1px solid $main-border-color; +} + +.layui-form .reset-btn { + color: $button-reset-color; + background-color: $button-reset-bg; + border: 1px solid $button-reset-border-color; +} + +.layui-input-inline { + width: 444px; +} + +.layui-layer-btn { + margin-top: 164px; +} + +.source-test .layui-input-inline { + display: flex; + justify-content: flex-end; + align-items: center; +} + +.source-test .test-link-fail { + display: flex; + justify-content: center; + align-items: center; + padding: 4px 8px; + margin-right: 8px; + font-size: 14px; + font-family: MicrosoftYaHei; + color: $fail-text-color; + background: $fail-bg; + border: 1px solid $fail-text-color; +} + +.source-test .test-link-fail .icon { + width: 16px; + height: 16px; + background: url(../img/fail@2x.png) no-repeat center/cover; +} + +.source-test .test-link-success { + display: flex; + justify-content: center; + align-items: center; + padding: 4px 8px; + margin-right: 8px; + font-size: 14px; + font-family: MicrosoftYaHei; + color: $success-text-color; + background: $success-bg; + border: 1px solid $success-text-color; +} + +.source-test .test-link-success .icon { + width: 16px; + height: 16px; + background: url(../img/success@2x.png) no-repeat center/cover; +} + +.source-test .test-link { + height: 14px; + font-size: 14px; + color: #1289ff; + line-height: 14px; + cursor: pointer; +} + +/* step2 */ + +.layui-transfer-box { + width: 360px; + height: 360px; +} + +.layui-transfer-data { + height: 320px; +} + +.layui-form-checkbox[lay-skin="primary"] { + padding-left: 20px; + width: 0; +} + +/* tree */ + +.tree-node { + display: flex; + align-items: center; + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(69, 75, 80, 1); +} + +.tree-node2 { + margin-left: 25px; +} + +.tree-list { + display: flex; + flex-direction: column; + align-items: flex-start; + margin-left: 50px; +} + +.tree-list .active { + color: #1289ff; + width: 100%; +} + +.opr-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.total-nodes { + font-style: normal; +} + +.opr-box .icon-next { + width: 24px; + height: 24px; + background: url(../img/icon-next@2x.png) no-repeat center/cover; +} + +.opr-box .icon-pre { + width: 24px; + height: 24px; + margin-top: 4px; + background: url(../img/icon-pre@2x.png) no-repeat center/cover; +} + +.rw1 { + width: 14px; + height: 14px; + margin-right: 8px; + background: url(../img/rw-1@2x.png) no-repeat center/cover; +} + +.rw2 { + width: 16px; + height: 12px; + margin-right: 2px; + background: url(../img/rw-2@2x.png) no-repeat center/cover; +} + +.rw3 { + width: 14px; + height: 16px; + margin-right: 10px; + background: url(../img/rw-3@2x.png) no-repeat center/cover; +} + +.layui-transfer-data li:hover { + background-color: transparent; +} + +.layui-transfer-data dd { + cursor: pointer; +} + +.layui-transfer-data dd .edit { + position: absolute; + right: 20px; + font-size: 14px; + font-family: MicrosoftYaHei; + color: $main-text-color; +} + +/* 编辑 */ + +.msg-box { + display: flex; + justify-content: center; + align-items: center; + width: 560px; + height: 40px; + background: rgba(255, 250, 235, 1); + border: 1px solid rgba(255, 191, 0, 1); +} + +.msg-box .msg-icon { + width: 16px; + height: 16px; + background: rgba(255, 191, 0, 1); + margin-right: 10px; + text-align: center; + font-size: 12px; + border-radius: 50%; + color: rgba(255, 255, 255, 1); +} + +.mark-icon { + display: inline-block; + width: 14px; + height: 16px; + text-align: center; + font-size: 12px; + border-radius: 50%; + border: 1px solid; + color: rgba(179, 189, 196, 1); +} + +.layui-layer-content { + display: flex; + justify-content: center; +} + +.header-box .layui-form-label { + width: 92px; + padding: 0; + margin: 0; + margin-right: 10px; +} + +.header-box .layui-input-inline { + display: flex; + align-items: center; + width: 460px; +} + +.header-box .mark-icon { + position: absolute; + top: 10px; + right: 10px; +} + +.layui-layer-content .table-box .layui-input-inline { + display: flex; + align-items: center; +} + +.layui-table-tool { + height: 2px; + position: absolute; + top: 300px; + left: 0; +} + +/* step 3*/ + +.layui-checkbox-disbaled span { + color: rgba(179, 189, 196, 1) !important; + /*layui.css 写死了 所以需要强制设置 disabled的颜色*/ +} + +.step3-form-item { + display: flex; +} + +.step3-label { + margin-top: 10px; + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(69, 75, 80, 1); + line-height: 14px; +} + +.step3-chekbox-box { + display: flex; + flex-direction: column; +} + +/* step 4 */ + +.progress-box { + display: flex; + justify-content: center; + align-items: center; + font-size: 14px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: rgba(69, 75, 80, 1); +} + +.progress-box .layui-progress { + width: 860px; + margin-right: 20px; +} + +.progress-box .layui-progress-bar { + background-color: rgba(43, 204, 113, 1); +} + +.step4-layer-btn { + display: flex; + justify-content: center; + align-items: center; + margin-top: 20px; +} + +.status-success { + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(43, 204, 113, 1); +} + +.status-fail-box { + display: flex; + align-items: center; +} + +.status-fail-box .status-fail { + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(246, 60, 73, 1); +} + +.status-fail-box .fail-icon { + width: 16px; + height: 16px; + margin-right: 10px; + background: url(../img/fail-icon@2x.png) no-repeat center/cover; +} diff --git a/admin/static/scss/sub.scss b/admin/static/scss/sub.scss new file mode 100644 index 0000000..8dde902 --- /dev/null +++ b/admin/static/scss/sub.scss @@ -0,0 +1,51 @@ +@import "./common/variables.scss"; +.more-box { + display: flex; + justify-content: center; + align-items: center; + position: relative; + height: 100%; + .icon { + width: 24px; + height: 24px; + background: url(../img/more@2x.png) no-repeat center/cover; + } +} +.tips-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + position: absolute; + right: 100px; + width: 160px; + padding: 10px; + margin-top: 15px; + font-size: 14px; + color: rgba(69, 75, 80, 1); + background: rgba(255, 255, 255, 1); + box-shadow: 0px 4px 24px 0px rgba(69, 75, 80, 0.16); + border-radius: 4px; + z-index: 1000; + li { + width: 100%; + height: 40px; + line-height: 40px; + text-align: center; + } + li:hover { + background: rgba(246, 248, 249, 1); + } +} +.node-fz .layui-input-inline { + width: 300px; +} +.form-add-icon { + width: 32px; + height: 32px; + background: url(../img/plus@2x.png) no-repeat center/cover; +} +.tasks { + color: $main-text-color; + cursor: pointer; +} diff --git a/admin/static/scss/table.scss b/admin/static/scss/table.scss new file mode 100644 index 0000000..628dec7 --- /dev/null +++ b/admin/static/scss/table.scss @@ -0,0 +1,1286 @@ +@import "./common/variables.scss"; +.layui-card { + margin-bottom: 10px; + background: rgba(255, 255, 255, 1); + box-shadow: 0px 2px 20px rgba(228, 232, 233, 1); + opacity: 1; + border-radius: 0px 4px 4px 4px; +} + +.layui-card .layui-tab-brief { + padding: 40px; + box-shadow: 0px 2px 20px #e4e8e9; + opacity: 1; + border-radius: 0px 4px 4px 4px; + background-color: #fff; +} + +.layui-card .layui-tab-brief .layui-tab-title { + background-color: #fff; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this { + background-color: #fff; + color: $table-main-color; +} + +.layui-card .layui-tab-brief .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-bottom: 2px solid $table-main-color; + border-top: none; +} + +.layui-card .layui-tab-card .layui-tab-title li.layui-this { + background-color: #f2f2f2; +} + +.layui-card .layui-tab-card .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-bottom: 2px solid $table-main-color; + border-top: none; +} + +.layui-card .layui-tab-title { + background-color: #f2f2f2; +} + +.layui-card .layui-tab-title li.layui-this { + background-color: #fff; +} + +.layui-card .layui-tab-title li.layui-this:after { + border-radius: 2px; + border-top: 2px solid $table-main-color; + border-bottom: none; +} + +.layui-card .layui-tab-title li .layui-tab-close { + background-color: #f2f4f5; + border-radius: 50%; +} + +.layui-card .layui-tab-title li .layui-tab-close:hover { + background-color: #ff5722; +} + +.layui-table thead tr, +.layui-table-click, +.layui-table-header, +.layui-table-hover, +.layui-table-mend, +.layui-table-patch, +.layui-table-tool, +.layui-table-total, +.layui-table-total tr, +.layui-table[lay-even] tr:nth-child(even) { + background-color: #f6f8f9; +} + +.layui-table thead tr { + border-left: 4px; + border-left-style: solid; + border-color: #f6f8f9; +} + +.layui-table tbody tr { + border-left: 4px; + border-left-style: solid; + border-color: transparent; +} + +.layui-table tbody tr:hover { + background-color: #e8f2ff; + border-color: $table-main-color; +} + +.layui-table-view .layui-form-checkbox[lay-skin="primary"] i { + width: 14px; + height: 14px; + line-height: 14px; +} + +.layui-form-checkbox[lay-skin="primary"]:hover i { + border-color: $table-main-color; +} + +.layui-table .layui-a { + color: $table-main-color; + cursor: pointer; + display: inline-block; + padding: 0px 5px; +} + +.layui-table .layui-a.layui-a-primary { + color: #ff9800; +} + +.layui-table .layui-a.layui-a-danger { + color: #f63c49; +} + +.layui-laypage span, +.layui-laypage a { + margin-right: 8px; + border-radius: 4px; +} + +.layui-laypage span.layui-laypage-curr { + border-width: 1px; + border-style: solid; + border-color: $table-main-color; +} + +.layui-laypage span.layui-laypage-curr .layui-laypage-em { + background-color: unset; + color: $table-main-color; +} + +.layui-laypage span.layui-laypage-curr em { + color: $table-main-color; +} + +.layui-laypage a { + border-color: #dfe5e8; + border-style: solid; + border-width: 1px; +} + +.layui-layer.layui-layer-msg { + width: auto !important; +} + +.layui-layer.layui-layer-msg .layui-layer-content { + height: auto; +} + +.layui-layer .layui-layer-title { + color: #454b50; + height: 49px; + line-height: 49px; + padding: 0 80px 0 16px; +} + +.layui-layer.layui-layer-page .layui-layer-content { + padding: 30px 30px 20px 0px; + overflow-y: auto; +} + +.layui-layer.layui-layer-dialog .layui-layer-content { + text-align: center; +} + +.layui-layer.layui-layer-dialog .layui-layer-btn { + text-align: center; +} + +.layui-form-radio i { + font-size: 16px; + margin-right: 6px; +} + +.layui-form-radio i:hover { + color: $table-main-color; +} + +.layui-form-radio.layui-form-radioed i { + color: $table-main-color; +} + +.layui-form-radio.layui-form-radioed i:hover { + color: $table-main-color; +} + +.layui-form-checked { + border-color: $table-main-color; +} + +.layui-form-checked i { + color: $table-main-color; +} + +.layui-form-checked span { + background-color: $table-main-color; +} + +.layui-form-checked:hover { + border-color: $table-main-color; +} + +.layui-form-checked:hover i { + color: $table-main-color; +} + +.layui-form-checked:hover span { + background-color: $table-main-color; +} + +.layui-form-checkbox[lay-skin="primary"] { + padding-left: 20px; +} + +.layui-form-checkbox[lay-skin="primary"] i { + width: 14px; + height: 14px; + line-height: 14px; +} + +.layui-form-checkbox[lay-skin="primary"]:hover i { + border-color: $table-main-color; +} + +.layui-form-checked[lay-skin="primary"] i { + border-color: $table-main-color; + background-color: $table-main-color; +} + +.layui-form-checkbox[lay-skin="primary"] span { + background: 0 0; + color: #666; +} + +.layui-form-switch.layui-form-onswitch { + border-color: $table-main-color; + background-color: $table-main-color; +} + +.layui-input { + border-radius: 4px; +} + +.layui-input:focus, +.layui-input:hover { + border-color: $table-main-color !important; +} + +.layui-input-disable { + border-radius: 4px; + background-color: #f5f5f5; + border: 1px solid #e7e8eb; + color: #bdc2c5; +} + +.layui-input:focus, +.layui-input-disable:hover { + border-color: #e7e8eb !important; +} + +.layui-form-danger { + border-color: #ff4d4f; +} + +.layui-form-danger:focus { + border-color: #ff4d4f; +} + +.layui-unselect dl dd:hover { + color: rgba(69, 75, 80, 1); + background: rgba(246, 248, 249, 1); +} + +.layui-unselect dl dd.layui-this { + background-color: #e8f2ff; + color: #454b50; +} + +.layui-nav { + background-color: #323e47; +} + +.layui-nav.layui-nav-tree .layui-nav-bar { + background-color: $table-main-color; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed { + margin-bottom: 3px; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed > .layui-nav-child { + background-color: unset !important; +} + +.layui-nav.layui-nav-tree .layui-nav-itemed:before { + position: absolute; + content: ""; + top: 0; + right: 0; + bottom: 3px; + left: 5px; + width: calc(100% - 10px); + height: 100%; + background-color: rgba(81, 94, 104, 0.53); + border-radius: 4px; +} + +.layui-nav.layui-nav-tree .layui-nav-child dd { + width: calc(100% - 10px); + margin: 0 auto; +} + +.layui-nav.layui-nav-tree .layui-nav-child a { + width: calc(100% - 40px); + margin: 0 auto; +} + +.layui-nav.layui-nav-tree .layui-nav-child a:hover { + background: #515e68; + border-radius: 4px; + width: calc(100% - 40px); +} + +.layui-nav.layui-nav-tree .layui-nav-child a:hover:after { + position: absolute; + content: ""; + left: 0; + top: 0; + bottom: 0; + width: 3px; + background-color: $table-main-color; + z-index: 2; +} + +.layui-nav.layui-nav-tree .layui-nav-item a:hover { + background-color: unset; +} + +.layui-nav.layui-nav-tree .layui-this, +.layui-nav.layui-nav-tree .layui-this > a, +.layui-nav.layui-nav-tree .layui-nav-child dd.layui-this, +.layui-nav.layui-nav-tree .layui-nav-child dd.layui-this a { + background-color: $table-main-color !important; + border-radius: 4px; +} + +.layui-nav .layui-this:after, +.layui-nav-bar, +.layui-nav-tree .layui-nav-itemed:after { + background-color: $table-main-color; +} + +/* 颜色 */ + +.layui-bg-gray-1 { + background-color: #f2f4f5 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-2 { + background-color: #f3f3f3 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-3 { + background-color: #dedfe1 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-4 { + background-color: #e3e3e3 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-5 { + background-color: #f6f8f9 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-gray-6 { + background-color: #f8f8f8 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-blue-1 { + background-color: $table-main-color !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-1 { + background-color: #323e47 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-2 { + background-color: #424e58 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-black-3 { + background-color: #515e68 !important; + opacity: 1; + border-radius: 4px; +} + +.layui-bg-select-gray { + background-color: #ebebeb !important; + opacity: 1; + border-radius: 4px; +} + +.layui-text-blue-1 { + color: $table-main-color !important; +} + +.layui-text-black-1 { + color: #454b50 !important; +} + +.layui-text-black-2 { + color: #515151 !important; +} + +.layui-text-gray-1 { + color: #8e8e8e !important; +} + +.layui-text-gray-2 { + color: #c3c3c3 !important; +} + +.layui-text-red-1 { + color: #f63c49 !important; +} + +.layui-table td, +.layui-table th, +.layui-table-fixed-r, +.layui-table-header, +.layui-table-page, +.layui-table-tips-main, +.layui-table-tool, +.layui-table-view, +.layui-table[lay-skin="line"], +.layui-table[lay-skin="row"] { + border-width: 0px; + border-style: solid; + border-color: #e6e6e6; +} + +.layui-layer-btn-c { + text-align: right !important; +} + +.layui-laypage { + display: block; + margin: 0; + font-size: 0; + text-align: center; +} + +/* 按钮 */ + +.layui-btn-default { + width: 80px; + height: 32px; + line-height: 32px; + padding: 0px; +} + +.layui-btn-blue { + background-color: $table-main-color; + border-radius: 4px; + color: #ffffff; +} + +.layui-btn-primary-gray { + border: 1px solid #cfd0d4; + background-color: #fff; + border-radius: 4px; + color: #454b50; +} + +.layui-btn-primary-blue { + border: 1px solid $table-main-color; + background-color: #fff; + border-radius: 4px; + color: $table-main-color; +} + +.layui-btn-primary-gray:hover { + border-color: $table-main-color; + color: #333; +} + +.layui-btn-primary-blue:hover { + border-color: $table-main-color; + color: #333; +} + +.layui-btn-disabled-blue { + background-color: #9cc0f9; + border-width: 0px; + border-radius: 4px; + color: #ffffff; +} + +.layui-btn-disabled-gray { + background-color: #f5f5f5; + border-width: 1px; + border-color: #dedfe1; + border-radius: 4px; + color: #b8b8b8; +} + +.layui-btn-disabled-gray:hover { + opacity: 0.8; + color: #b8b8b8; +} + +.layui-btn-normal-blue { + background-color: $table-main-color; + border-radius: 4px; + color: #ffffff; +} + +.layui-btn-sm { + height: 38px !important; + line-height: 38px !important; + padding: 0 10px; + font-size: 12px; +} + +.layui-btn-lg-blue { + background-color: $table-main-color; + height: 44px; + line-height: 44px; + padding: 0 25px; + font-size: 16px; + border-radius: 4px; +} + +.layui-btn-sm-blue { + background-color: $table-main-color; + height: 30px; + line-height: 30px; + padding: 0 10px; + font-size: 12px; + border-radius: 4px; +} + +.layui-btn-xs-blue { + background-color: $table-main-color; + height: 22px; + line-height: 22px; + padding: 0 5px; + font-size: 12px; + border-radius: 4px; +} + +.layui-btn-danger-red { + background-color: #f63c49; + border-radius: 4px; +} + +/* 表单 */ + +.layui-form-select dl dd.layui-this { + background: rgba(18, 137, 255, 0.12); + font-size: 14px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: $main-text-color; + height: 40px; + line-height: 40px; +} + +.layui-laydate .layui-this { + background-color: $table-main-color !important; + color: #fff !important; +} + +.layui-laydate-header i:hover, +.layui-laydate-header span:hover { + color: $table-main-color !important; +} + +.layui-laydate-footer span:hover { + color: $table-main-color !important; +} + +/* tab */ + +.layui-nav .layui-this:after, +.layui-nav-bar, +.layui-nav-tree .layui-nav-itemed:after { + position: absolute; + left: 0; + top: 0; + width: 0; + height: 5px; + background-color: $table-main-color; + transition: all 0.2s; + -webkit-transition: all 0.2s; +} + +.layui-nav-pages { + font-size: 14px; + color: #454b50; + width: 100%; + height: 100%; +} + +.layui-nav-page-tabs { + width: 100%; + height: 100%; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; +} + +.layui-nav-page-menu { + color: #8e8e8e; + text-decoration: none; + line-height: 42px; + padding-left: 29px; + padding-right: 9px; + background-color: transparent; + display: inline-flex; + align-items: center; + justify-content: center; +} + +.layui-nav-page-menu.active { + background-color: #ffffff; + border-radius: 6px 6px 0px 0px; + position: relative; + color: #454b50; +} + +.layui-pages { + flex: 1; + background-color: #ffffff; + margin-top: 10px; + box-shadow: 0px 2px 10px 0px rgba(228, 232, 233, 0.8); + border-radius: 0px 0px 4px 4px; +} + +.layui-tab-title-black { + color: #454b50; +} + +.layui-tab-brief > .layui-tab-title .layui-this { + color: $table-main-color; +} + +.layui-tab-brief > .layui-tab-more li.layui-this:after, +.layui-tab-brief > .layui-tab-title .layui-this:after { + border: none; + border-radius: 0; + border-bottom: 3px solid $table-main-color; +} + +/* 内容块 */ + +.layui-form-gray { + background-color: #f8f8f8; + border-radius: 2px; + border: 1px solid #ececec; + padding: 22px 0px 0px 24px; + margin-bottom: 14px; +} + +.layui-input-inline-w218 { + width: 218px !important; +} + +.layui-input-inline-w303 { + width: 303px !important; +} + +.layui-input-inline-w650 { + width: 650px !important; +} + +.layui-icon-upload { + width: 55px; + height: 55px; + background-color: #ffffff; + border-radius: 4px; + border: 1px dashed #d2d3d8; +} + +.layui-input-inline-upload { + width: 55px !important; + margin-left: 14px; +} + +.layui-form-mid-hint { + margin-left: 55px; +} + +.layui-title1 { + display: flex; + margin-bottom: 24px; + align-items: center; +} + +.layui-title-line { + width: 3px; + height: 16px; + background-color: $table-main-color; + margin-right: 6px; + float: left; +} + +.layui-title-label1 { + font-size: 18px; + color: #333333; +} + +.layui-title2 { + display: flex; + margin: 22px 0px 14px 0px; + /* align-items: center; */ +} + +.layui-title-label2 { + font-size: 14px; + color: #454b50; +} + +/* 逐条添加 */ + +.layui-form-item-gray { + background-color: #ffffff; + border-radius: 4px; + border: 1px solid #ececec; + margin-bottom: 20px; +} + +.layui-form-item-left1 { + padding: 20px 0px 0px 20px; + background: #f8f8f8; +} + +.layui-form-item-left2 { + float: left; + padding: 20px 0px 0px 20px; + width: 96%; + background: #f8f8f8; +} + +.layui-form-item-right { + float: left; + width: 30px; + height: 179px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + border-left: 1px solid #e9e9e9; + display: flex; + align-items: center; + justify-content: center; +} + +.layui-icon-close-gray { + color: #8e8e8e; + font-size: 10px; +} + +.layui-form-label-item { + padding: 9px 0px; +} + +.layui-input-block-item { + display: flex; + align-items: center; + margin-left: 90px; +} + +.layui-form-item-add { + height: 50px; + border-radius: 4px; + border: 1px dashed #d2d3d8; + margin-bottom: 20px; + display: flex; + align-items: center; + padding-left: 20px; + font-size: 14px; + color: #454b50; +} + +.layui-icon-add-circle-fine-blue { + float: left; + font-size: 20px; + color: $table-main-color; + margin-right: 8px; +} + +/* 数据表单 */ + +.layui-custom-line { + border-top: 1px solid #e6e6e6; + border-bottom: 1px solid #e6e6e6; + border-left: 1px solid #e6e6e6; +} + +.lauyu-custom-item-line { + width: 100%; + height: 1px; + background-color: #e6e6e6; +} + +.layui-custom-key { + height: 50px; + background-color: #f6f7f9; + border-right: 1px solid #e6e6e6; + display: flex; + align-items: center; + justify-content: center; +} + +.layui-custom-value { + height: 50px; + border-right: 1px solid #e6e6e6; + display: flex; + align-items: center; + padding: 0px 40px; +} + +.layui-form-block { + background: rgba(248, 248, 248, 1); + border: 1px solid rgba(236, 236, 236, 1); + opacity: 1; + border-radius: 4px; + padding: 20px 20px 5px 0px; + margin-bottom: 10px; + position: relative; +} + +.layui-form-item-close { + position: absolute; + right: 0px; + top: 0px; + width: 30px; + height: 100%; + text-align: center; + border-left: 1px solid rgba(233, 233, 233, 1); + background: rgba(255, 255, 255, 1); + opacity: 1; + border-radius: 0px 4px 4px 0px; +} + +.layui-form-item-close-icon { + position: absolute; + top: 50%; + right: 50%; + text-align: center; + width: 10px; + height: 10px; + color: #f63c49; + cursor: pointer; + font-weight: bold; +} + +.layui-table-tool { + background-color: #ffffff; +} + +.layui-card-gray { + margin-bottom: 15px; + border-radius: 2px; + background-color: #fff; + box-shadow: 0 2px 10px 0 rgba(228, 232, 233, 0.8) !important; +} + +/* 弹窗 */ + +.layui-layer { + box-shadow: 0px 2px 20px rgba(187, 187, 187, 0.53) !important; + border-radius: 4px !important; +} + +.layui-form-layer { + padding: 30px 30px 42px 30px; + border-bottom: 1px solid #efefef; +} + +.layui-input-noborder { + border: 0px; + /* width: 150px */ +} + +.layui-layer-row-checkbox { + padding: 22px 22px 0px 22px; +} + +.layui-layer-row-select { + min-height: 259px; + border: 1px solid #dedfe1; + border-radius: 4px; + margin-top: 10px; + padding: 16px; +} + +.layui-layer-select { + width: 66px !important; + height: 32px; + margin: 0px 8px 8px 0px; + border: 1px solid $table-main-color; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; + font-size: 14px; + color: #454b50; + float: left; +} + +.layui-inline-layer-btn { + position: relative; + left: 348px; + padding: 10px 0px; +} + +.layui-btn-layer { + width: 80px; + height: 32px; + line-height: 32px; +} + +.layui-text-gray { + font-size: 14px; + color: #454b50; +} + +.layui-transfer-data li:hover { + background-color: #e2edff; + transition: 0.5s all; +} + +.layui-transfer-active .layui-btn { + display: block; + margin: 0; + padding: 0 15px; + background-color: $table-main-color !important; + border-color: $table-main-color !important; + color: #fff; +} + +.layui-transfer-active .layui-btn-disabled { + background-color: #fbfbfb; + border-color: #e6e6e6; + color: #c9c9c9; +} + +.layui-form-checked[lay-skin="primary"] i { + border-color: $table-main-color !important; + background-color: $table-main-color; + color: #fff; +} + +/* 控件 */ + +.layui-laypage a:hover { + color: $table-main-color; +} + +.layui-laypage input:focus, +.layui-laypage select:focus { + border-color: $table-main-color !important; +} + +.layui-laypage select { + height: 28px; + padding: 3px; + border-radius: 4px; + cursor: pointer; + background-color: #fff; +} + +.layui-icon-picture-gray { + font-size: 23px !important; + color: #a8a8a8 !important; +} + +.layui-icon-close-fill-black { + font-size: 16px; + color: #000000; + position: relative; + left: -8px; + top: -8px; +} + +.layui-row-fl { + float: left; +} + +.layui-upload-drag { + float: left; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 0px; + font-size: 12px; + color: #a8a8a8; + border-radius: 4px; +} + +.layui-upload-drag-lg { + width: 198px; + height: 198px; + margin-bottom: 20px; +} + +.layui-upload-img-lg { + float: left; + width: 200px; + height: 200px; + margin-bottom: 20px; + border-radius: 4px; +} + +.layui-upload-drag-mid { + width: 98px; + height: 98px; + margin-bottom: 20px; +} + +.layui-upload-img-mid { + float: left; + width: 100px; + height: 100px; + margin-bottom: 20px; + border-radius: 4px; +} + +.layui-upload-drag-sm { + width: 54px; + height: 54px; + margin-bottom: 8px; +} + +.layui-upload-img-sm { + float: left; + width: 56px; + height: 56px; + margin-bottom: 8px; + border-radius: 4px; +} + +.layui-upload-drag-xs { + width: 44px; + height: 44px; + margin-bottom: 8px; +} + +.layui-upload-img-xs { + float: left; + width: 46px; + height: 46px; + margin-bottom: 8px; + border-radius: 4px; +} + +.layui-upload-input { + width: 377px; + height: 32px; + margin-right: 16px; +} + +.layui-label { + float: left; + height: 32px; + padding: 0px 14px; + margin: 0px 8px 8px 0px; + background-color: #efefef; + border-radius: 4px; + font-size: 14px; + color: #454b50; + display: flex; + align-items: center; + justify-content: space-between; +} + +.layui-icon-close-fill-label { + font-size: 14px; + color: #aeaeae; + margin-left: 8px; +} + +.layui-input-inline-content { + padding: 19px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + border: 1px solid #e7e8eb; + box-shadow: 0px 2px 6px rgba(68, 70, 74, 0.05); + background-color: #ffffff; + font-size: 14px; + color: #454b50; +} + +.layui-input-inline-content:hover { + border: 1px solid $table-main-color; +} + +.layui-laypage select { + padding: 0px; + height: 26px; +} + +.layui-table-cell { + height: 50px; + line-height: 50px; + font-size: 14px; +} + +.layui-table-header { + .layui-table-cell { + font-weight: bold; + color: rgba(69, 75, 80, 1); + } +} + +.layui-card-body { + padding: 0; + color: rgba(69, 75, 80, 1); +} + +.layui-opr-block { + .normal-btn { + width: 90px; + height: 32px; + line-height: 32px; + border-radius: 4px; + font-size: 14px; + background-color: $form-input-bg; + color: $table-main-color; + border: 1px solid $table-main-color; + display: inline-block; + text-align: center; + } +} + +.cell-opr { + display: inline-block; + width: 24px; + height: 24px; + cursor: pointer; +} + +.save-cell { + background: url(../img/save-cell.png) no-repeat center/cover; +} + +.edit-cell { + margin-right: 8px; + background: url(../img/edit-cell.png) no-repeat center/cover; +} + +.delete-cell { + background: url(../img/delete-cell.png) no-repeat center/cover; +} + +.layui-layer-tips .layui-layer-content { + position: relative; + line-height: 22px; + min-width: 12px; + padding: 8px 15px; + font-size: 12px; + _float: left; + border-radius: 2px; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2); + background-color: #000; + color: #fff; + padding: 4px 8px !important; + /* left: 0; */ +} + +.layui-layer-tips i.layui-layer-TipsT { + bottom: -8px; + left: 0; +} + +.layui-layer-btn-r { + display: flex; + justify-content: flex-end; +} + +.layui-layer-btn .layui-layer-btn0 { + border-radius: 4px; + border: 1px solid rgba(220, 224, 228, 1) !important; + background-color: rgba(255, 255, 255, 1) !important; + color: rgba(69, 75, 80, 1) !important; +} + +.layui-layer-btn .layui-layer-btn1 { + color: rgba(255, 255, 255, 1) !important; + background: rgba(18, 137, 255, 1) !important; + border-radius: 4px; + border-color: $main-border-color; +} + +.msg-skin .layui-layer-btn a { + color: rgba(255, 255, 255, 1) !important; + background: rgba(18, 137, 255, 1) !important; + border-radius: 4px; + border-color: rgba(18, 137, 255, 1); +} + +.layui-table-grid-down { + display: none; +} + +.layui-table-grid-down:hover { + display: none; +} + +.layui-layer.layui-layer-page .layui-layer-content { + padding: 0; +} + +.layui-form { + .layui-form-item { + display: flex; + align-items: center; + font-size: 14px; + .layui-form-label { + font-size: 14px; + font-family: MicrosoftYaHei; + color: rgba(69, 75, 80, 1); + } + .layui-input, + .layui-select, + .layui-textarea { + height: 34px; + } + input::placeholder { + font-size: 14px; + } + } +} + +.form-box { + padding-left: 10px; + .layui-form-label, + .layui-form-mid, + .layui-form-select, + .layui-input-block, + .layui-input-inline, + .layui-textarea { + width: 180px; + } +} + +.import-title { + font-size: 18px; + font-family: MicrosoftYaHei; + color: rgba(18, 137, 255, 1); + margin-left: 10px; +} + +.cell-opr { + display: inline-block; + width: 24px; + height: 24px; + cursor: pointer; +} diff --git a/admin/template/common/breadcrumb.html b/admin/template/common/breadcrumb.html new file mode 100644 index 0000000..e4047d4 --- /dev/null +++ b/admin/template/common/breadcrumb.html @@ -0,0 +1,13 @@ +
          + + + + +
          \ No newline at end of file diff --git a/admin/template/common/celloperating.html b/admin/template/common/celloperating.html new file mode 100644 index 0000000..edcf9bd --- /dev/null +++ b/admin/template/common/celloperating.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/admin/template/common/footer.html b/admin/template/common/footer.html new file mode 100644 index 0000000..96c455c --- /dev/null +++ b/admin/template/common/footer.html @@ -0,0 +1,8 @@ +@@if (jslinks.length>0) { +@@for (var i = 0; i < jslinks.length; i++) { + } + } + + + \ No newline at end of file diff --git a/admin/template/common/header.html b/admin/template/common/header.html new file mode 100644 index 0000000..aebf1e3 --- /dev/null +++ b/admin/template/common/header.html @@ -0,0 +1,24 @@ + + + + + + @@title + + + + + + + @@if (csslinks.length>0) { + @@for (var i = 0; i < csslinks.length; i++) { + } + } + + + + + + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..e6f8613 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,197 @@ +var gulp = require("gulp"); +var gulpif = require("gulp-if"); +var fileinclude = require('gulp-file-include'); +var clean = require("gulp-clean"); + +var connect = require("gulp-connect"); //引入gulp-connect模块 +var webserver = require('gulp-webserver'); + +var sass = require("gulp-sass"); //编译scss +var rename = require("gulp-rename"); //重命名 +var minifyCss = require("gulp-minify-css"); //压缩CSS +var autoprefixer = require("gulp-autoprefixer"); +var px2rem = require('gulp-px2rem-plugin'); + +var imagemin = require("gulp-imagemin"); + +var minifyHtml = require("gulp-minify-html"); //压缩html +// var htmltpl = require("gulp-html-tpl"); // 引用html模板 +var artTemplate = require("art-template"); // 模板渲染 + +var uglify = require("gulp-uglify"); //js压缩 +var babel = require("gulp-babel"); + +var entrance = "admin"; +var out = "dist"; + +var outPath = out + "/"; +var entrancePath = entrance + "/"; +var commonHtmlPath = entrancePath + "template/common/"; +var localPort = 9909; +gulp.task("watchs", function () { + gulp.watch("gulpfile.js", gulp.series("default")); + gulp.watch(commonHtmlPath + "*.html", gulp.series("html")); + gulp.watch(entrancePath + "pages/*.html", gulp.series("html")); + gulp.watch(entrancePath + "pages/*/*.html", gulp.series("html")); + gulp.watch(entrancePath + "static/scss/*.scss", gulp.series("scss")); + gulp.watch(entrancePath + "static/js/*.js", gulp.series("js")); + gulp.watch(entrancePath + "static/js/*/*.js", gulp.series("js")); + gulp.watch(entrancePath + "static/img/*", gulp.series("img")); + gulp.watch(entrancePath + "res/js/*.js", gulp.series("libJs")); +}); + +gulp.task('webserver', function () { + gulp.src(out) + .pipe(webserver({ + host: 'localhost', + port: localPort, + livereload: true, + open: './pages/index.html', + directoryListing: { + enable: true, + path: out + }, + proxies: [{ + source: '/api', + target: 'http://localhost:8090' // 代理的域名 + }] + })) +}); +// 清空dist文件夹 +gulp.task("clean", function () { + return gulp.src([outPath + "*"]).pipe(clean()); +}); + +gulp.task("layui_exts", function () { + return gulp + .src([entrancePath + "static/layui/layui_exts/*"]) + .pipe(gulp.dest(outPath + "static/layui/layui_exts/")) + .pipe(connect.reload()); +}); + +gulp.task("layui", function () { + return gulp + .src([entrancePath + "static/layui/*", entrancePath + "static/layui/*/*", entrancePath + "static/layui/*/*/*", entrancePath + "static/layui/*/*/*/*", entrancePath + "static/layui/*/*/*/*/*", entrancePath + "static/layui/*/*/*/*/*/*"]) + .pipe(gulp.dest(outPath + "static/layui/")) + .pipe(connect.reload()); +}); +gulp.task("layuicss", function () { + return gulp + .src([ + entrancePath + "/static/layui/layui/css/*.css", + entrancePath + "/static/layui/layui/css/*/*.css", + entrancePath + "/static/layui/layui/css/*/*/*.css", + entrancePath + "/static/layui/layui/css/*/*/*/*.css", + entrancePath + "/static/layui/layui/css/*/*/*/*/*.css" + ]) + .pipe(px2rem({ 'width_design': 1600, 'valid_num': 6, 'pieces': 10, 'ignore_px': [1, 2], 'ignore_selector': ['.layui-layer-setwin .layui-layer-close1', '.layui-layer-setwin a'] })) + .pipe(gulp.dest(outPath + "/static/layui/layui/css")) + .pipe(connect.reload()); //更新; +}); +gulp.task("html", function () { + return gulp + .src([entrancePath + "pages/index.html", entrancePath + "pages/*/*.html"]) + .pipe(fileinclude({ + prefix: '@@', + basepath: '@file' + })) + // .pipe( + // htmltpl({ + // tag: "template", + // paths: [commonHtmlPath], + // engine: function (template, data) { + // return template && artTemplate.compile(template)(data); + // }, + // data: { + // //初始化数据 + // csslinks: false, + // jslinks: false, + // }, + // }) + // ) + .pipe( + rename(function (path) { + path.dirname += ""; + path.basename += ""; + path.extname = ".html"; + }) + ) + .pipe(gulp.dest(outPath + "pages/")) + .pipe(connect.reload()); +}); + +gulp.task("scss", function () { + return gulp + .src(entrancePath + "/static/scss/*.scss") + .pipe(sass()) //编译scss + .pipe(autoprefixer("last 15 version", "ie 8")) + .pipe(rename({ suffix: "" })) //rename压缩后的文件名 + .pipe(px2rem({ 'width_design': 1600, 'valid_num': 6, 'pieces': 10, 'ignore_px': [1, 2], 'ignore_selector': [] })) + // .pipe(minifyCss()) //执行压缩 + .pipe(gulp.dest(outPath + "/static/css")) + .pipe(connect.reload()); //更新; +}); +var libJsCondition = function (f) { + return !/qrcode.js$/.test(f.path); +}; +gulp.task("libJs", function () { + return ( + gulp + .src([entrancePath + "res/js/*.js", entrancePath + "res/js/*/*.js", entrancePath + "res/js/*/*/*.js"]) + .pipe(gulpif(libJsCondition, babel({ + presets: ["env"], + plugins: [], + }))) + // .pipe(uglify())//执行压缩 + .pipe(gulp.dest(outPath + "res/js")) + .pipe( + rename(function (path) { + path.dirname += ""; + path.basename += ""; + path.extname = ".js"; + }) + ) + .pipe(connect.reload()) + ); +}); +var jsCondition = function (f) { + return !/.min.js$/.test(f.path); +}; +gulp.task("js", function () { + return ( + gulp + .src([entrancePath + "static/js/*.js", entrancePath + "static/js/*/*.js"]) + .pipe(gulpif(jsCondition, babel({ + presets: ["env"], + plugins: [], + }))) + // .pipe(uglify())//执行压缩 + .pipe(gulp.dest(outPath + "static/js")) + .pipe( + rename(function (path) { + path.dirname += ""; + path.basename += ""; + path.extname = ".js"; + }) + ) + .pipe(connect.reload()) + ); +}); + +gulp.task('img', function () { + return gulp.src(entrancePath + 'static/img/*.{png,jpg,gif,ico}') + // .pipe(imagemin()) + .pipe(gulp.dest(outPath + 'static/img')); +}); +gulp.task( + "default", + gulp.series( + "clean", + "scss", + "layui", + "layuicss", + "layui_exts", + gulp.parallel("html", 'img', 'libJs', "js"), + gulp.parallel("webserver", 'watchs') + ) +); \ No newline at end of file diff --git a/mock/.gitignore b/mock/.gitignore new file mode 100644 index 0000000..7db017a --- /dev/null +++ b/mock/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +/node_modules +/dist diff --git a/mock/READEME.md b/mock/READEME.md new file mode 100644 index 0000000..083e9bb --- /dev/null +++ b/mock/READEME.md @@ -0,0 +1,6 @@ + +根据data 中的数据配置 自动生成路由,以及mock数据 + +自动生成的markdownApi文档 routerLog.md + +[模拟数据地址](http://localhost:8090/) \ No newline at end of file diff --git a/mock/data/detail.js b/mock/data/detail.js new file mode 100644 index 0000000..1ff8363 --- /dev/null +++ b/mock/data/detail.js @@ -0,0 +1,44 @@ +const basicRouteUrl = 'detail'; +module.exports = { + basicRouteUrl, + basicRouteName: "首页", + routerConfigs: [{ + url: '/detail', + type: "post", + name: "详情table", + desc: "详情tablelist", + accessUrl: basicRouteUrl + '/detail', + mockData: { + "data|1-9": [{ + id: 4, + name: "我的名字", + ip: "192", + port: "3306", + sid: "student" + }] + } + }, + { + url: '/list', + type: "post", + name: "table-list", + desc: "table-list api", + accessUrl: basicRouteUrl + '/list', + mockData: { + 'data|1-20': [{ + id: 1, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: "12345678", + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注", + }] + } + } + ] +}; \ No newline at end of file diff --git a/mock/data/edittable.js b/mock/data/edittable.js new file mode 100644 index 0000000..9a0281b --- /dev/null +++ b/mock/data/edittable.js @@ -0,0 +1,50 @@ +const basicRouteUrl = 'edittable'; +module.exports = { + basicRouteUrl, + basicRouteName: "首页", + routerConfigs: [{ + url: '/list', + type: "post", + name: "table-list", + desc: "table-list api", + accessUrl: basicRouteUrl + '/list', + mockData: { + 'data|1-20': [{ + id: 4, + groupName: "分组1", + remark: "分组1备注" + }] + } + }, + { + url: '/insert', + type: "post", + name: "table-insert", + desc: "table-insert api", + accessUrl: basicRouteUrl + '/insert', + mockData: { + 'data': [] + } + }, + { + url: '/update', + type: "post", + name: "table-update", + desc: "table-update api", + accessUrl: basicRouteUrl + '/update', + mockData: { + 'data': [] + } + }, + { + url: '/delete', + type: "post", + name: "table-delete", + desc: "table-delete api", + accessUrl: basicRouteUrl + '/delete', + mockData: { + 'data': [] + } + } + ] +}; \ No newline at end of file diff --git a/mock/data/index.js b/mock/data/index.js new file mode 100644 index 0000000..7356379 --- /dev/null +++ b/mock/data/index.js @@ -0,0 +1,44 @@ +const basicRouteUrl = 'index'; +module.exports = { + basicRouteUrl, + basicRouteName: "首页", + routerConfigs: [{ + url: '/detail', + type: "post", + name: "详情table", + desc: "详情tablelist", + accessUrl: basicRouteUrl + '/detail', + mockData: { + "data|1-9": [{ + id: 4, + name: "我的名字", + ip: "192", + port: "3306", + sid: "student" + }] + } + }, + { + url: '/list', + type: "post", + name: "table-list", + desc: "table-list api", + accessUrl: basicRouteUrl + '/list', + mockData: { + 'data|1-20': [{ + id: 4, + name: "我的名字", + ip: "192.168.10.123", + port: "3306", + sid: "student_info", + username: "student", + password: '12345678', + createTime: 1590560278000, + fz: 1, + type: 1, + remark: "我是一个备注" + }] + } + } + ] +}; \ No newline at end of file diff --git a/mock/mockServer.js b/mock/mockServer.js new file mode 100644 index 0000000..a95ad72 --- /dev/null +++ b/mock/mockServer.js @@ -0,0 +1,94 @@ +const express = require('express'); //引入express +const Mock = require('mockjs'); //引入mock +const fs = require('fs'); +const app = express(); //实例化express + + +const { + routerLog, + writeLog +} = require('./writeLog'); + + +app.use(function(req, res, next) { + res.header("Access-Control-Allow-Origin", "*"); + res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS'); + res.header("Access-Control-Allow-Headers", "X-Requested-With"); + res.header('Access-Control-Allow-Headers', 'Content-Type'); + next(); +}); + + + +fs.writeFile('./routerLog.md', ' \n # 路由 \n', function(error) { + if (error) { + console.log('写入失败') + } else { + console.log('markdown 写入路由记录') + } +}) + +const directory = './data/'; +loopPath(directory); +//循环目录 +function loopPath(directory) { + const paths = fs.readdirSync(directory); + let logs = ""; + for (let i = 0; i < paths.length; i++) { + const file = directory + paths[i]; + if (isDirectory(file)) { + const subDirectory = file + "/"; + loopPath(subDirectory); + } else { + if (fs.existsSync(`${file}`)) { + const dataConfigs = require(`${file}`); + // console.log('dataConfigs', dataConfigs); + + const configs = dataConfigs.routerConfigs; + const baseUrl = dataConfigs.basicRouteUrl; + logs += `\n ## 路由 --- ${dataConfigs.basicRouteName} \n\n`; + for (let i = 0; i < configs.length; i++) { + configs[i].responseExample = JSON.stringify( + FormatMockData({ + data: configs[i].mockData + }) + ); + logs += routerLog(configs[i]); + const { url, type } = configs[i]; + const mockUrl = "/" + baseUrl + url; + console.log("路由信息:", "url:", mockUrl, "type:", type); + loopRouteConfig(mockUrl, configs[i]); + } + } + } + } + writeLog(logs); +} +// 注册路由 +function loopRouteConfig(mockUrl, { type, mockData }) { + app[type](mockUrl, function(req, res) { + res.json( + FormatMockData({ + mockData + }) + ); + }); +} + +// 是否为目录 +function isDirectory(directory) { + return fs.lstatSync(directory).isDirectory() ? true : false; +} + +// mock 模拟数据 mock json +function FormatMockData({ mockData }) { + const status200 = { code: 0, message: "成功" }; + return { + ...status200, + ...Mock.mock(mockData) + }; +} + +app.listen('8090', () => { + console.log('mock 模拟地址 :http://localhost:8090/') +}) diff --git a/mock/package.json b/mock/package.json new file mode 100644 index 0000000..2f8ef4b --- /dev/null +++ b/mock/package.json @@ -0,0 +1,17 @@ +{ + "name": "express-to-mock", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "mock": "node mockServer.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "pp", + "license": "ISC", + "dependencies": { + "express": "^4.17.1", + "fs": "0.0.1-security", + "mockjs": "^1.1.0" + } +} diff --git a/mock/routerLog.md b/mock/routerLog.md new file mode 100644 index 0000000..fcab592 --- /dev/null +++ b/mock/routerLog.md @@ -0,0 +1,211 @@ + + # 路由 + + ## 路由 --- 首页 + +### 详情table + + #### 说明 + + 详情tablelist + + #### 请求方式 + + post + + #### 接口地址 + + /detail + + #### 预览接口 + + [预览接口详情table](http://localhost:8090/detail/detail) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + +### table-list + + #### 说明 + + table-list api + + #### 请求方式 + + post + + #### 接口地址 + + /list + + #### 预览接口 + + [预览接口table-list](http://localhost:8090/detail/list) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + + + ## 路由 --- 首页 + +### table-list + + #### 说明 + + table-list api + + #### 请求方式 + + post + + #### 接口地址 + + /list + + #### 预览接口 + + [预览接口table-list](http://localhost:8090/edittable/list) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + +### table-insert + + #### 说明 + + table-insert api + + #### 请求方式 + + post + + #### 接口地址 + + /insert + + #### 预览接口 + + [预览接口table-insert](http://localhost:8090/edittable/insert) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + +### table-update + + #### 说明 + + table-update api + + #### 请求方式 + + post + + #### 接口地址 + + /update + + #### 预览接口 + + [预览接口table-update](http://localhost:8090/edittable/update) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + +### table-delete + + #### 说明 + + table-delete api + + #### 请求方式 + + post + + #### 接口地址 + + /delete + + #### 预览接口 + + [预览接口table-delete](http://localhost:8090/edittable/delete) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + + + ## 路由 --- 首页 + +### 详情table + + #### 说明 + + 详情tablelist + + #### 请求方式 + + post + + #### 接口地址 + + /detail + + #### 预览接口 + + [预览接口详情table](http://localhost:8090/index/detail) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + +### table-list + + #### 说明 + + table-list api + + #### 请求方式 + + post + + #### 接口地址 + + /list + + #### 预览接口 + + [预览接口table-list](http://localhost:8090/index/list) + + + #### 相应示例 + + ``` + {"code":0,"message":"成功"} + ``` + diff --git a/mock/writeLog.js b/mock/writeLog.js new file mode 100644 index 0000000..6b1b141 --- /dev/null +++ b/mock/writeLog.js @@ -0,0 +1,50 @@ +const fs = require('fs'); +const baseUrl = 'http://localhost:8090/'; + +function routerLog({ + name, + url, + type, + desc, + accessUrl, + responseExample +}) { + let log = `### ${name} \n` + + ` \n #### 说明 \n` + + ` \n ${desc} \n` + + ` \n #### 请求方式 \n` + + ` \n ${type} \n` + + ` \n #### 接口地址 \n` + + ` \n ${url} \n` + + ` \n #### 预览接口 \n` + + ` \n [预览接口${name}](${baseUrl}${accessUrl}) \n\n`+ + ` \n #### 相应示例 \n` + + ` \n `+'```'+' \n '+` ${responseExample}`+' \n '+'```'+` \n\n` + return log; +} + +function markdownTitle({ + name +}) { + let data = `\n ## ${name} \n\n`; + writeLog(data); + +} + + +function writeLog(data) { + + fs.appendFile('./routerLog.md', data, 'utf8', function(err) { + if (err) { + console.log(err); + } else { + console.log('写入路由记录') + } + }); +} + +module.exports = { + markdownTitle, + routerLog, + writeLog +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..4ec0f92 --- /dev/null +++ b/package.json @@ -0,0 +1,43 @@ +{ + "name": "layui-admin", + "version": "1.0.0", + "description": "", + "main": "gulpfile.js", + "scripts": { + "init": "npm install && cd mock && npm install", + "mock": "cd mock && node mockServer.js", + "gulp": "gulp &", + "start": "concurrently \"npm run gulp\" \"npm run mock\"", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "http://git.ppst.top/pengpian/layui-admin.git" + }, + "dependencies": { + "art-template": "^4.13.2", + "concurrently": "^5.2.0", + "gulp": "^4.0.2", + "gulp-autoprefixer": "^7.0.1", + "gulp-clean": "^0.4.0", + "gulp-connect": "^5.7.0", + "gulp-file-include": "^2.2.2", + "gulp-html-tpl": "^0.5.2", + "gulp-if": "^3.0.0", + "gulp-imagemin": "^7.1.0", + "gulp-minify-css": "^1.2.4", + "gulp-minify-html": "^1.0.6", + "gulp-px2rem-plugin": "^0.4.0", + "gulp-rename": "^2.0.0", + "gulp-sass": "^4.1.0", + "gulp-uglify": "^3.0.2", + "gulp-webserver": "^0.9.1" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "babel-preset-env": "^1.7.0", + "gulp-babel": "^8.0.0" + }, + "author": "pp", + "license": "ISC" +}