├── .DS_Store ├── README.md ├── app.js ├── app.json ├── app.wxss ├── images ├── demo01.png ├── demo02.png ├── demo03.png ├── demo04.png ├── icon.png ├── icon_address.png ├── icon_discount.png ├── icon_order.png ├── icon_rightgo.png ├── icon_yuyue.png ├── index.png ├── index_selected.png ├── me.png ├── me_selected.png ├── meirongshi.png ├── meirongshi_selected.png ├── my_header_bg.jpg └── python.jpeg ├── node_modules ├── pako │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── pako.js │ │ ├── pako.min.js │ │ ├── pako_deflate.js │ │ ├── pako_deflate.min.js │ │ ├── pako_inflate.js │ │ └── pako_inflate.min.js │ ├── index.js │ ├── lib │ │ ├── deflate.js │ │ ├── inflate.js │ │ ├── utils │ │ │ ├── common.js │ │ │ └── strings.js │ │ └── zlib │ │ │ ├── README │ │ │ ├── adler32.js │ │ │ ├── constants.js │ │ │ ├── crc32.js │ │ │ ├── deflate.js │ │ │ ├── gzheader.js │ │ │ ├── inffast.js │ │ │ ├── inflate.js │ │ │ ├── inftrees.js │ │ │ ├── messages.js │ │ │ ├── trees.js │ │ │ └── zstream.js │ └── package.json └── upng-js │ ├── LICENSE │ ├── README.md │ ├── UPNG.js │ └── package.json ├── package-lock.json ├── pages ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── meirongshi │ ├── meirongshi.js │ ├── meirongshi.json │ ├── meirongshi.wxml │ └── meirongshi.wxss ├── my │ ├── my.js │ ├── my.json │ ├── my.wxml │ └── my.wxss ├── myAddress │ ├── myAddress.js │ ├── myAddress.json │ ├── myAddress.wxml │ └── myAddress.wxss ├── myYuyue │ ├── myYuyue.js │ ├── myYuyue.json │ ├── myYuyue.wxml │ └── myYuyue.wxss ├── order │ ├── orderAddress.js │ ├── orderAddress.json │ ├── orderAddress.wxml │ ├── orderAddress.wxss │ ├── orderProducts.js │ ├── orderProducts.json │ ├── orderProducts.wxml │ └── orderProducts.wxss └── product │ ├── product.js │ ├── product.json │ ├── product.wxml │ └── product.wxss ├── project.config.json ├── sitemap.json └── utils ├── UPNG.js ├── api.js ├── config.js ├── pako.min.js └── util.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Housekeeping 2 | 微信小程序-家政预约 3 | 4 | 5 | #### 源码地址 6 | 7 | https://github.com/geeeeeeeek/Housekeeping 8 | 9 | #### 界面预览 10 | 11 | **首页展示** 12 | 13 | ![](https://github.com/geeeeeeeek/Housekeeping/blob/master/images/demo03.png) 14 | 15 | 16 | **个人页** 17 | 18 | ![](https://github.com/geeeeeeeek/Housekeeping/blob/master/images/demo04.png) 19 | 20 | 21 | #### 问题咨询 22 | 23 | 微信: lengqin1024 24 | 25 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var api=require('utils/api.js') 2 | var config=require('utils/config.js') 3 | var util=require('utils/util.js') 4 | 5 | App({ 6 | onLaunch: function () { 7 | this.getUserInfo(); 8 | }, 9 | getUserInfo:function(){ 10 | var that = this 11 | //调用登录接口 12 | wx.login({ 13 | success: function () { 14 | wx.getUserInfo({ 15 | success: function (res) { 16 | that.globalData.userInfo = res.userInfo 17 | console.log("globalData===="+JSON.stringify(that.globalData)); 18 | 19 | //获取uuid 20 | var uuid=wx.getStorageSync('uuid'); 21 | if(!uuid){ 22 | uuid=util.uuid(13,10); 23 | } 24 | console.log("uuid===="+uuid); 25 | wx.setStorageSync('userInfo',that.globalData.userInfo); 26 | wx.setStorageSync('uuid', uuid); 27 | } 28 | }) 29 | } 30 | }) 31 | }, 32 | globalData:{ 33 | userInfo:null 34 | } 35 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages":[ 3 | "pages/index/index", 4 | "pages/meirongshi/meirongshi", 5 | "pages/order/orderAddress", 6 | "pages/order/orderProducts", 7 | "pages/product/product", 8 | "pages/my/my", 9 | "pages/myYuyue/myYuyue", 10 | "pages/myAddress/myAddress" 11 | ], 12 | "window":{ 13 | "backgroundTextStyle":"light", 14 | "navigationBarBackgroundColor": "#f63440", 15 | "navigationBarTitleText": "家政服务预约", 16 | "navigationBarTextStyle":"white" 17 | }, 18 | "tabBar": { 19 | "color": "#afaeae", 20 | "selectedColor": "#f00", 21 | "borderStyle": "black", 22 | "backgroundColor": "#f0f0f0", 23 | "list": [{ 24 | "pagePath": "pages/index/index", 25 | "iconPath": "images/index.png", 26 | "selectedIconPath": "images/index_selected.png", 27 | "text": "服务列表" 28 | }, 29 | { 30 | "pagePath": "pages/my/my", 31 | "iconPath": "images/me.png", 32 | "selectedIconPath": "images/me_selected.png", 33 | "text": "个人中心" 34 | }] 35 | }, 36 | "debug":false 37 | } 38 | -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: space-between; 8 | padding: 200rpx 0; 9 | box-sizing: border-box; 10 | } 11 | 12 | page{ 13 | height: 100%; 14 | background-color: #f4f4f4; 15 | } 16 | 17 | /**隐藏**/ 18 | .n{display: none;} 19 | 20 | /**居中**/ 21 | .cc{ display: flex;justify-content: center; align-items: center;} 22 | 23 | /**垂直居中**/ 24 | .vc{ display: flex; align-items: center;} 25 | 26 | /**加粗**/ 27 | .fw-600{font-weight: 600;} 28 | .fw-700{font-weight: 700;} 29 | .fw-900{font-weight: 900;} -------------------------------------------------------------------------------- /images/demo01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/demo01.png -------------------------------------------------------------------------------- /images/demo02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/demo02.png -------------------------------------------------------------------------------- /images/demo03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/demo03.png -------------------------------------------------------------------------------- /images/demo04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/demo04.png -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/icon.png -------------------------------------------------------------------------------- /images/icon_address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/icon_address.png -------------------------------------------------------------------------------- /images/icon_discount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/icon_discount.png -------------------------------------------------------------------------------- /images/icon_order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/icon_order.png -------------------------------------------------------------------------------- /images/icon_rightgo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/icon_rightgo.png -------------------------------------------------------------------------------- /images/icon_yuyue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/icon_yuyue.png -------------------------------------------------------------------------------- /images/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/index.png -------------------------------------------------------------------------------- /images/index_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/index_selected.png -------------------------------------------------------------------------------- /images/me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/me.png -------------------------------------------------------------------------------- /images/me_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/me_selected.png -------------------------------------------------------------------------------- /images/meirongshi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/meirongshi.png -------------------------------------------------------------------------------- /images/meirongshi_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/meirongshi_selected.png -------------------------------------------------------------------------------- /images/my_header_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/my_header_bg.jpg -------------------------------------------------------------------------------- /images/python.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geeeeeeeek/Housekeeping/ae692d99088d6f9f90241e24d79b24a2540bf857/images/python.jpeg -------------------------------------------------------------------------------- /node_modules/pako/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 1.0.10 / 2019-02-28 2 | ------------------ 3 | 4 | - Fix minified version, #161. 5 | 6 | 7 | 1.0.9 / 2019-02-28 8 | ------------------ 9 | 10 | - Fix `new Buffer()` warning, #154. 11 | 12 | 13 | 1.0.8 / 2019-01-14 14 | ------------------ 15 | 16 | - Fix raw inflate with dictionary, #155. 17 | 18 | 19 | 1.0.7 / 2018-11-29 20 | ------------------ 21 | 22 | - Fixed RangeError in Crome 72, #150. 23 | 24 | 25 | 1.0.6 / 2017-09-14 26 | ------------------ 27 | 28 | - Improve @std/esm compatibility. 29 | 30 | 31 | 1.0.5 / 2017-03-17 32 | ------------------ 33 | 34 | - Maintenance. More formal `zlib` attribution and related 35 | changes, #93. Thanks to @bastien-roucaries for the help. 36 | 37 | 38 | 1.0.4 / 2016-12-15 39 | ------------------ 40 | 41 | - Bump dev dependencies. 42 | - Make sure `err.message` is filled on throw. 43 | - Code examples for utf-16 string encoding & object compression. 44 | 45 | 46 | 1.0.3 / 2016-07-25 47 | ------------------ 48 | 49 | - Maintenance: re-release to properly display latest version in npm registry 50 | and badges. Because `npm publish` timestamp used instead of versions. 51 | 52 | 53 | 1.0.2 / 2016-07-21 54 | ------------------ 55 | 56 | - Fixed nasty bug in deflate (wrong `d_buf` offset), which could cause 57 | broken data in some rare cases. 58 | - Also released as 0.2.9 to give chance to old dependents, not updated to 1.x 59 | version. 60 | 61 | 62 | 1.0.1 / 2016-04-01 63 | ------------------ 64 | 65 | - Added dictionary support. Thanks to @dignifiedquire. 66 | 67 | 68 | 1.0.0 / 2016-02-17 69 | ------------------ 70 | 71 | - Maintenance release (semver, coding style). 72 | 73 | 74 | 0.2.8 / 2015-09-14 75 | ------------------ 76 | 77 | - Fixed regression after 0.2.4 for edge conditions in inflate wrapper (#65). 78 | Added more tests to cover possible cases. 79 | 80 | 81 | 0.2.7 / 2015-06-09 82 | ------------------ 83 | 84 | - Added Z_SYNC_FLUSH support. Thanks to @TinoLange. 85 | 86 | 87 | 0.2.6 / 2015-03-24 88 | ------------------ 89 | 90 | - Allow ArrayBuffer input. 91 | 92 | 93 | 0.2.5 / 2014-07-19 94 | ------------------ 95 | 96 | - Workaround for Chrome 38.0.2096.0 script parser bug, #30. 97 | 98 | 99 | 0.2.4 / 2014-07-07 100 | ------------------ 101 | 102 | - Fixed bug in inflate wrapper, #29 103 | 104 | 105 | 0.2.3 / 2014-06-09 106 | ------------------ 107 | 108 | - Maintenance release, dependencies update. 109 | 110 | 111 | 0.2.2 / 2014-06-04 112 | ------------------ 113 | 114 | - Fixed iOS 5.1 Safari issue with `apply(typed_array)`, #26. 115 | 116 | 117 | 0.2.1 / 2014-05-01 118 | ------------------ 119 | 120 | - Fixed collision on switch dynamic/fixed tables. 121 | 122 | 123 | 0.2.0 / 2014-04-18 124 | ------------------ 125 | 126 | - Added custom gzip headers support. 127 | - Added strings support. 128 | - Improved memory allocations for small chunks. 129 | - ZStream properties rename/cleanup. 130 | - More coverage tests. 131 | 132 | 133 | 0.1.1 / 2014-03-20 134 | ------------------ 135 | 136 | - Bugfixes for inflate/deflate. 137 | 138 | 139 | 0.1.0 / 2014-03-15 140 | ------------------ 141 | 142 | - First release. 143 | -------------------------------------------------------------------------------- /node_modules/pako/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/pako/README.md: -------------------------------------------------------------------------------- 1 | pako 2 | ========================================== 3 | 4 | [![Build Status](https://travis-ci.org/nodeca/pako.svg?branch=master)](https://travis-ci.org/nodeca/pako) 5 | [![NPM version](https://img.shields.io/npm/v/pako.svg)](https://www.npmjs.org/package/pako) 6 | 7 | > zlib port to javascript, very fast! 8 | 9 | __Why pako is cool:__ 10 | 11 | - Almost as fast in modern JS engines as C implementation (see benchmarks). 12 | - Works in browsers, you can browserify any separate component. 13 | - Chunking support for big blobs. 14 | - Results are binary equal to well known [zlib](http://www.zlib.net/) (now contains ported zlib v1.2.8). 15 | 16 | This project was done to understand how fast JS can be and is it necessary to 17 | develop native C modules for CPU-intensive tasks. Enjoy the result! 18 | 19 | 20 | __Famous projects, using pako:__ 21 | 22 | - [browserify](http://browserify.org/) (via [browserify-zlib](https://github.com/devongovett/browserify-zlib)) 23 | - [JSZip](http://stuk.github.io/jszip/) 24 | - [mincer](https://github.com/nodeca/mincer) 25 | - [JS-Git](https://github.com/creationix/js-git) and 26 | [Tedit](https://chrome.google.com/webstore/detail/tedit-development-environ/ooekdijbnbbjdfjocaiflnjgoohnblgf) 27 | by [@creationix](https://github.com/creationix) 28 | 29 | 30 | __Benchmarks:__ 31 | 32 | ``` 33 | node v0.10.26, 1mb sample: 34 | 35 | deflate-dankogai x 4.73 ops/sec ±0.82% (15 runs sampled) 36 | deflate-gildas x 4.58 ops/sec ±2.33% (15 runs sampled) 37 | deflate-imaya x 3.22 ops/sec ±3.95% (12 runs sampled) 38 | ! deflate-pako x 6.99 ops/sec ±0.51% (21 runs sampled) 39 | deflate-pako-string x 5.89 ops/sec ±0.77% (18 runs sampled) 40 | deflate-pako-untyped x 4.39 ops/sec ±1.58% (14 runs sampled) 41 | * deflate-zlib x 14.71 ops/sec ±4.23% (59 runs sampled) 42 | inflate-dankogai x 32.16 ops/sec ±0.13% (56 runs sampled) 43 | inflate-imaya x 30.35 ops/sec ±0.92% (53 runs sampled) 44 | ! inflate-pako x 69.89 ops/sec ±1.46% (71 runs sampled) 45 | inflate-pako-string x 19.22 ops/sec ±1.86% (49 runs sampled) 46 | inflate-pako-untyped x 17.19 ops/sec ±0.85% (32 runs sampled) 47 | * inflate-zlib x 70.03 ops/sec ±1.64% (81 runs sampled) 48 | 49 | node v0.11.12, 1mb sample: 50 | 51 | deflate-dankogai x 5.60 ops/sec ±0.49% (17 runs sampled) 52 | deflate-gildas x 5.06 ops/sec ±6.00% (16 runs sampled) 53 | deflate-imaya x 3.52 ops/sec ±3.71% (13 runs sampled) 54 | ! deflate-pako x 11.52 ops/sec ±0.22% (32 runs sampled) 55 | deflate-pako-string x 9.53 ops/sec ±1.12% (27 runs sampled) 56 | deflate-pako-untyped x 5.44 ops/sec ±0.72% (17 runs sampled) 57 | * deflate-zlib x 14.05 ops/sec ±3.34% (63 runs sampled) 58 | inflate-dankogai x 42.19 ops/sec ±0.09% (56 runs sampled) 59 | inflate-imaya x 79.68 ops/sec ±1.07% (68 runs sampled) 60 | ! inflate-pako x 97.52 ops/sec ±0.83% (80 runs sampled) 61 | inflate-pako-string x 45.19 ops/sec ±1.69% (57 runs sampled) 62 | inflate-pako-untyped x 24.35 ops/sec ±2.59% (40 runs sampled) 63 | * inflate-zlib x 60.32 ops/sec ±1.36% (69 runs sampled) 64 | ``` 65 | 66 | zlib's test is partially affected by marshalling (that make sense for inflate only). 67 | You can change deflate level to 0 in benchmark source, to investigate details. 68 | For deflate level 6 results can be considered as correct. 69 | 70 | __Install:__ 71 | 72 | node.js: 73 | 74 | ``` 75 | npm install pako 76 | ``` 77 | 78 | browser: 79 | 80 | ``` 81 | bower install pako 82 | ``` 83 | 84 | 85 | Example & API 86 | ------------- 87 | 88 | Full docs - http://nodeca.github.io/pako/ 89 | 90 | ```javascript 91 | var pako = require('pako'); 92 | 93 | // Deflate 94 | // 95 | var input = new Uint8Array(); 96 | //... fill input data here 97 | var output = pako.deflate(input); 98 | 99 | // Inflate (simple wrapper can throw exception on broken stream) 100 | // 101 | var compressed = new Uint8Array(); 102 | //... fill data to uncompress here 103 | try { 104 | var result = pako.inflate(compressed); 105 | } catch (err) { 106 | console.log(err); 107 | } 108 | 109 | // 110 | // Alternate interface for chunking & without exceptions 111 | // 112 | 113 | var inflator = new pako.Inflate(); 114 | 115 | inflator.push(chunk1, false); 116 | inflator.push(chunk2, false); 117 | ... 118 | inflator.push(chunkN, true); // true -> last chunk 119 | 120 | if (inflator.err) { 121 | console.log(inflator.msg); 122 | } 123 | 124 | var output = inflator.result; 125 | 126 | ``` 127 | 128 | Sometime you can wish to work with strings. For example, to send 129 | big objects as json to server. Pako detects input data type. You can 130 | force output to be string with option `{ to: 'string' }`. 131 | 132 | ```javascript 133 | var pako = require('pako'); 134 | 135 | var test = { my: 'super', puper: [456, 567], awesome: 'pako' }; 136 | 137 | var binaryString = pako.deflate(JSON.stringify(test), { to: 'string' }); 138 | 139 | // 140 | // Here you can do base64 encode, make xhr requests and so on. 141 | // 142 | 143 | var restored = JSON.parse(pako.inflate(binaryString, { to: 'string' })); 144 | ``` 145 | 146 | 147 | Notes 148 | ----- 149 | 150 | Pako does not contain some specific zlib functions: 151 | 152 | - __deflate__ - methods `deflateCopy`, `deflateBound`, `deflateParams`, 153 | `deflatePending`, `deflatePrime`, `deflateTune`. 154 | - __inflate__ - methods `inflateCopy`, `inflateMark`, 155 | `inflatePrime`, `inflateGetDictionary`, `inflateSync`, `inflateSyncPoint`, `inflateUndermine`. 156 | - High level inflate/deflate wrappers (classes) may not support some flush 157 | modes. Those should work: Z_NO_FLUSH, Z_FINISH, Z_SYNC_FLUSH. 158 | 159 | 160 | Authors 161 | ------- 162 | 163 | - Andrey Tupitsin [@anrd83](https://github.com/andr83) 164 | - Vitaly Puzrin [@puzrin](https://github.com/puzrin) 165 | 166 | Personal thanks to: 167 | 168 | - Vyacheslav Egorov ([@mraleph](https://github.com/mraleph)) for his awesome 169 | tutorials about optimising JS code for v8, [IRHydra](http://mrale.ph/irhydra/) 170 | tool and his advices. 171 | - David Duponchel ([@dduponchel](https://github.com/dduponchel)) for help with 172 | testing. 173 | 174 | Original implementation (in C): 175 | 176 | - [zlib](http://zlib.net/) by Jean-loup Gailly and Mark Adler. 177 | 178 | 179 | License 180 | ------- 181 | 182 | - MIT - all files, except `/lib/zlib` folder 183 | - ZLIB - `/lib/zlib` content 184 | -------------------------------------------------------------------------------- /node_modules/pako/dist/pako_deflate.min.js: -------------------------------------------------------------------------------- 1 | !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).pako=t()}}(function(){return function i(s,h,l){function o(e,t){if(!h[e]){if(!s[e]){var a="function"==typeof require&&require;if(!t&&a)return a(e,!0);if(_)return _(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var r=h[e]={exports:{}};s[e][0].call(r.exports,function(t){return o(s[e][1][t]||t)},r,r.exports,i,s,h,l)}return h[e].exports}for(var _="function"==typeof require&&require,t=0;t>>6:(a<65536?e[i++]=224|a>>>12:(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63),e[i++]=128|a>>>6&63),e[i++]=128|63&a);return e},a.buf2binstring=function(t){return _(t,t.length)},a.binstring2buf=function(t){for(var e=new l.Buf8(t.length),a=0,n=e.length;a>10&1023,h[n++]=56320|1023&r)}return _(h,n)},a.utf8border=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0?e:0===a?e:a+o[t[a]]>e?a:e}},{"./common":1}],3:[function(t,e,a){"use strict";e.exports=function(t,e,a,n){for(var r=65535&t|0,i=t>>>16&65535|0,s=0;0!==a;){for(a-=s=2e3>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e,a,n){var r=h,i=n+a;t^=-1;for(var s=n;s>>8^r[255&(t^e[s])];return-1^t}},{}],5:[function(t,e,a){"use strict";var l,u=t("../utils/common"),o=t("./trees"),f=t("./adler32"),c=t("./crc32"),n=t("./messages"),_=0,d=4,p=0,g=-2,m=-1,b=4,r=2,v=8,w=9,i=286,s=30,h=19,y=2*i+1,k=15,z=3,x=258,B=x+z+1,A=42,C=113,S=1,j=2,E=3,U=4;function D(t,e){return t.msg=n[e],e}function I(t){return(t<<1)-(4t.avail_out&&(a=t.avail_out),0!==a&&(u.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function T(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,q(t.strm)}function L(t,e){t.pending_buf[t.pending++]=e}function N(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function R(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-B?t.strstart-(t.w_size-B):0,o=t.window,_=t.w_mask,d=t.prev,u=t.strstart+x,f=o[i+s-1],c=o[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(o[(a=e)+s]===c&&o[a+s-1]===f&&o[a]===o[i]&&o[++a]===o[i+1]){i+=2,a++;do{}while(o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&il&&0!=--r);return s<=t.lookahead?s:t.lookahead}function H(t){var e,a,n,r,i,s,h,l,o,_,d=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-B)){for(u.arraySet(t.window,t.window,d,d,0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=a=t.hash_size;n=t.head[--e],t.head[e]=d<=n?n-d:0,--a;);for(e=a=d;n=t.prev[--e],t.prev[e]=d<=n?n-d:0,--a;);r+=d}if(0===t.strm.avail_in)break;if(s=t.strm,h=t.window,l=t.strstart+t.lookahead,o=r,_=void 0,_=s.avail_in,o<_&&(_=o),a=0===_?0:(s.avail_in-=_,u.arraySet(h,s.input,s.next_in,_,l),1===s.state.wrap?s.adler=f(s.adler,h,_,l):2===s.state.wrap&&(s.adler=c(s.adler,h,_,l)),s.next_in+=_,s.total_in+=_,_),t.lookahead+=a,t.lookahead+t.insert>=z)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=(t.ins_h<=z&&(t.ins_h=(t.ins_h<=z)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-z),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=z){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=z&&(t.ins_h=(t.ins_h<=z&&t.match_length<=t.prev_length){for(r=t.strstart+t.lookahead-z,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-z),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=r&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(H(t),0===t.lookahead&&e===_)return S;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,T(t,!1),0===t.strm.avail_out))return S;if(t.strstart-t.block_start>=t.w_size-B&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=0,e===d?(T(t,!0),0===t.strm.avail_out?E:U):(t.strstart>t.block_start&&(T(t,!1),t.strm.avail_out),S)}),new M(4,4,8,4,F),new M(4,5,16,8,F),new M(4,6,32,32,F),new M(4,4,16,16,K),new M(8,16,32,32,K),new M(8,16,128,128,K),new M(8,32,128,256,K),new M(32,128,258,1024,K),new M(32,258,258,4096,K)],a.deflateInit=function(t,e){return Q(t,e,v,15,8,0)},a.deflateInit2=Q,a.deflateReset=J,a.deflateResetKeep=G,a.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=e,p):g},a.deflate=function(t,e){var a,n,r,i;if(!t||!t.state||5>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=c(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=C);else{var s=v+(n.w_bits-8<<4)<<8;s|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(s|=32),s+=31-s%31,n.status=C,N(n,s),0!==n.strstart&&(N(n,t.adler>>>16),N(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(r=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),q(t),r=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),q(t),r=n.pending,n.pending===n.pending_buf_size)){i=1;break}L(n,i=n.gzindexr&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),0===i&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){r=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>r&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),q(t),r=n.pending,n.pending===n.pending_buf_size)){i=1;break}L(n,i=n.gzindexr&&(t.adler=c(t.adler,n.pending_buf,n.pending-r,r)),0===i&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&q(t),n.pending+2<=n.pending_buf_size&&(L(n,255&t.adler),L(n,t.adler>>8&255),t.adler=0,n.status=C)):n.status=C),0!==n.pending){if(q(t),0===t.avail_out)return n.last_flush=-1,p}else if(0===t.avail_in&&I(e)<=I(a)&&e!==d)return D(t,-5);if(666===n.status&&0!==t.avail_in)return D(t,-5);if(0!==t.avail_in||0!==n.lookahead||e!==_&&666!==n.status){var h=2===n.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(H(t),0===t.lookahead)){if(e===_)return S;break}if(t.match_length=0,a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=0,e===d?(T(t,!0),0===t.strm.avail_out?E:U):t.last_lit&&(T(t,!1),0===t.strm.avail_out)?S:j}(n,e):3===n.strategy?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=x){if(H(t),t.lookahead<=x&&e===_)return S;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=z&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=z?(a=o._tr_tally(t,1,t.match_length-z),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(T(t,!1),0===t.strm.avail_out))return S}return t.insert=0,e===d?(T(t,!0),0===t.strm.avail_out?E:U):t.last_lit&&(T(t,!1),0===t.strm.avail_out)?S:j}(n,e):l[n.level].func(n,e);if(h!==E&&h!==U||(n.status=666),h===S||h===E)return 0===t.avail_out&&(n.last_flush=-1),p;if(h===j&&(1===e?o._tr_align(n):5!==e&&(o._tr_stored_block(n,0,0,!1),3===e&&(O(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),q(t),0===t.avail_out))return n.last_flush=-1,p}return e!==d?p:n.wrap<=0?1:(2===n.wrap?(L(n,255&t.adler),L(n,t.adler>>8&255),L(n,t.adler>>16&255),L(n,t.adler>>24&255),L(n,255&t.total_in),L(n,t.total_in>>8&255),L(n,t.total_in>>16&255),L(n,t.total_in>>24&255)):(N(n,t.adler>>>16),N(n,65535&t.adler)),q(t),0=a.w_size&&(0===i&&(O(a.head),a.strstart=0,a.block_start=0,a.insert=0),o=new u.Buf8(a.w_size),u.arraySet(o,e,_-a.w_size,a.w_size,0),e=o,_=a.w_size),s=t.avail_in,h=t.next_in,l=t.input,t.avail_in=_,t.next_in=0,t.input=e,H(a);a.lookahead>=z;){for(n=a.strstart,r=a.lookahead-(z-1);a.ins_h=(a.ins_h<>>7)]}function L(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function N(t,e,a){t.bi_valid>r-a?(t.bi_buf|=e<>r-t.bi_valid,t.bi_valid+=a-r):(t.bi_buf|=e<>>=1,a<<=1,0<--e;);return a>>>1}function F(t,e,a){var n,r,i=new Array(m+1),s=0;for(n=1;n<=m;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){var h=t[2*r+1];0!==h&&(t[2*r]=H(i[h]++,h))}}function K(t){var e;for(e=0;e>1;1<=a;a--)G(t,i,a);for(r=l;a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],G(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,i[2*r]=i[2*a]+i[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,i[2*a+1]=i[2*n+1]=r,t.heap[1]=r++,G(t,i,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,i,s,h,l=e.dyn_tree,o=e.max_code,_=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,p=0;for(i=0;i<=m;i++)t.bl_count[i]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a>=7;n>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return h;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e>>3,(i=t.static_len+3+7>>>3)<=r&&(r=i)):r=i=a+5,a+4<=r&&-1!==e?Y(t,e,a,n):4===t.strategy||i===r?(N(t,2+(n?1:0),3),J(t,A,C)):(N(t,4+(n?1:0),3),function(t,e,a,n){var r;for(N(t,e-257,5),N(t,a-1,5),N(t,n-4,4),r=0;r>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(j[a]+d+1)]++,t.dyn_dtree[2*T(e)]++),t.last_lit===t.lit_bufsize-1},a._tr_align=function(t){var e;N(t,2,3),R(t,b,A),16===(e=t).bi_valid?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":1}],8:[function(t,e,a){"use strict";e.exports=function(){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}},{}],"/lib/deflate.js":[function(t,e,a){"use strict";var s=t("./zlib/deflate"),h=t("./utils/common"),l=t("./utils/strings"),r=t("./zlib/messages"),i=t("./zlib/zstream"),o=Object.prototype.toString,_=0,d=-1,u=0,f=8;function c(t){if(!(this instanceof c))return new c(t);this.options=h.assign({level:d,method:f,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},t||{});var e=this.options;e.raw&&0>>6:(i<65536?t[r++]=224|i>>>12:(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63),t[r++]=128|i>>>6&63),t[r++]=128|63&i);return t},i.buf2binstring=function(e){return d(e,e.length)},i.binstring2buf=function(e){for(var t=new f.Buf8(e.length),i=0,n=t.length;i>10&1023,s[n++]=56320|1023&a)}return d(s,n)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0?t:0===i?t:i+l[e[i]]>t?i:t}},{"./common":1}],3:[function(e,t,i){"use strict";t.exports=function(e,t,i,n){for(var a=65535&e|0,r=e>>>16&65535|0,o=0;0!==i;){for(i-=o=2e3>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var a=s,r=n+i;e^=-1;for(var o=n;o>>8^a[255&(e^t[o])];return-1^e}},{}],6:[function(e,t,i){"use strict";t.exports=function(){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}},{}],7:[function(e,t,i){"use strict";t.exports=function(e,t){var i,n,a,r,o,s,f,l,d,c,u,h,b,m,w,k,_,g,v,p,x,y,S,E,Z;i=e.state,n=e.next_in,E=e.input,a=n+(e.avail_in-5),r=e.next_out,Z=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),f=i.dmax,l=i.wsize,d=i.whave,c=i.wnext,u=i.window,h=i.hold,b=i.bits,m=i.lencode,w=i.distcode,k=(1<>>=v=g>>>24,b-=v,0===(v=g>>>16&255))Z[r++]=65535&g;else{if(!(16&v)){if(0==(64&v)){g=m[(65535&g)+(h&(1<>>=v,b-=v),b<15&&(h+=E[n++]<>>=v=g>>>24,b-=v,!(16&(v=g>>>16&255))){if(0==(64&v)){g=w[(65535&g)+(h&(1<>>=v,b-=v,(v=r-o)>3,h&=(1<<(b-=p<<3))-1,e.next_in=n,e.next_out=r,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function r(){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 z.Buf16(320),this.work=new z.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=F,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new z.Buf32(n),t.distcode=t.distdyn=new z.Buf32(a),t.sane=1,t.back=-1,T):U}function s(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,o(e)):U}function f(e,t){var i,n;return e&&e.state?(n=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=r.wsize?(z.arraySet(r.window,t,i-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(n<(a=r.wsize-r.wnext)&&(a=n),z.arraySet(r.window,t,i-n,a,r.wnext),(n-=a)?(z.arraySet(r.window,t,i-n,n,0),r.wnext=n,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,i.check=N(i.check,B,2,0),d=l=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&l)){e.msg="unknown compression method",i.mode=30;break}if(d-=4,x=8+(15&(l>>>=4)),0===i.wbits)i.wbits=x;else if(x>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(B[0]=255&l,B[1]=l>>>8&255,i.check=N(i.check,B,2,0)),d=l=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,l+=n[r++]<>>8&255,B[2]=l>>>16&255,B[3]=l>>>24&255,i.check=N(i.check,B,4,0)),d=l=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,l+=n[r++]<>8),512&i.flags&&(B[0]=255&l,B[1]=l>>>8&255,i.check=N(i.check,B,2,0)),d=l=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,l+=n[r++]<>>8&255,i.check=N(i.check,B,2,0)),d=l=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(s<(h=i.length)&&(h=s),h&&(i.head&&(x=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),z.arraySet(i.head.extra,n,r,h,x)),512&i.flags&&(i.check=N(i.check,n,h,r)),s-=h,r+=h,i.length-=h),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;for(h=0;x=n[r+h++],i.head&&x&&i.length<65536&&(i.head.name+=String.fromCharCode(x)),x&&h>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,l+=n[r++]<>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,l+=n[r++]<>>=1)){case 0:i.mode=14;break;case 1:if(H(i),i.mode=20,6!==t)break;l>>>=2,d-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}l>>>=2,d-=2;break;case 14:for(l>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,l+=n[r++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&l,d=l=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(h=i.length){if(s>>=5,d-=5,i.ndist=1+(31&l),l>>>=5,d-=5,i.ncode=4+(15&l),l>>>=4,d-=4,286>>=3,d-=3}for(;i.have<19;)i.lens[A[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,S={bits:i.lenbits},y=C(0,i.lens,0,19,i.lencode,0,i.work,S),i.lenbits=S.bits,y){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,_=65535&Z,!((w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>>=w,d-=w,i.lens[i.have++]=_;else{if(16===_){for(E=w+2;d>>=w,d-=w,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}x=i.lens[i.have-1],h=3+(3&l),l>>>=2,d-=2}else if(17===_){for(E=w+3;d>>=w)),l>>>=3,d-=3}else{for(E=w+7;d>>=w)),l>>>=7,d-=7}if(i.have+h>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;h--;)i.lens[i.have++]=x}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,S={bits:i.lenbits},y=C(I,i.lens,0,i.nlen,i.lencode,0,i.work,S),i.lenbits=S.bits,y){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,S={bits:i.distbits},y=C(D,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,S),i.distbits=S.bits,y){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=s&&258<=f){e.next_out=o,e.avail_out=f,e.next_in=r,e.avail_in=s,i.hold=l,i.bits=d,O(e,u),o=e.next_out,a=e.output,f=e.avail_out,r=e.next_in,n=e.input,s=e.avail_in,l=i.hold,d=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;k=(Z=i.lencode[l&(1<>>16&255,_=65535&Z,!((w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>g)])>>>16&255,_=65535&Z,!(g+(w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>>=g,d-=g,i.back+=g}if(l>>>=w,d-=w,i.back+=w,i.length=_,0===k){i.mode=26;break}if(32&k){i.back=-1,i.mode=12;break}if(64&k){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&k,i.mode=22;case 22:if(i.extra){for(E=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;k=(Z=i.distcode[l&(1<>>16&255,_=65535&Z,!((w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>g)])>>>16&255,_=65535&Z,!(g+(w=Z>>>24)<=d);){if(0===s)break e;s--,l+=n[r++]<>>=g,d-=g,i.back+=g}if(l>>>=w,d-=w,i.back+=w,64&k){e.msg="invalid distance code",i.mode=30;break}i.offset=_,i.extra=15&k,i.mode=24;case 24:if(i.extra){for(E=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===f)break e;if(h=u-f,i.offset>h){if((h=i.offset-h)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}h>i.wnext?(h-=i.wnext,b=i.wsize-h):b=i.wnext-h,h>i.length&&(h=i.length),m=i.window}else m=a,b=o-i.offset,h=i.length;for(fh?(m=O[C+o[g]],w=A[z+o[g]]):(m=96,w=0),f=1<<_-S,v=l=1<>S)+(l-=f)]=b<<24|m<<16|w|0,0!==l;);for(f=1<<_-1;B&f;)f>>=1;if(0!==f?(B&=f-1,B+=f):B=0,g++,0==--R[_]){if(_===p)break;_=t[i+o[g]]}if(x<_&&(B&c)!==d){for(0===S&&(S=x),u+=v,E=1<<(y=_-S);y+S Array 41 | * 42 | * Chunks of output data, if [[Deflate#onData]] not overridden. 43 | **/ 44 | 45 | /** 46 | * Deflate.result -> Uint8Array|Array 47 | * 48 | * Compressed result, generated by default [[Deflate#onData]] 49 | * and [[Deflate#onEnd]] handlers. Filled after you push last chunk 50 | * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you 51 | * push a chunk with explicit flush (call [[Deflate#push]] with 52 | * `Z_SYNC_FLUSH` param). 53 | **/ 54 | 55 | /** 56 | * Deflate.err -> Number 57 | * 58 | * Error code after deflate finished. 0 (Z_OK) on success. 59 | * You will not need it in real life, because deflate errors 60 | * are possible only on wrong options or bad `onData` / `onEnd` 61 | * custom handlers. 62 | **/ 63 | 64 | /** 65 | * Deflate.msg -> String 66 | * 67 | * Error message, if [[Deflate.err]] != 0 68 | **/ 69 | 70 | 71 | /** 72 | * new Deflate(options) 73 | * - options (Object): zlib deflate options. 74 | * 75 | * Creates new deflator instance with specified params. Throws exception 76 | * on bad params. Supported options: 77 | * 78 | * - `level` 79 | * - `windowBits` 80 | * - `memLevel` 81 | * - `strategy` 82 | * - `dictionary` 83 | * 84 | * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 85 | * for more information on these. 86 | * 87 | * Additional options, for internal needs: 88 | * 89 | * - `chunkSize` - size of generated data chunks (16K by default) 90 | * - `raw` (Boolean) - do raw deflate 91 | * - `gzip` (Boolean) - create gzip wrapper 92 | * - `to` (String) - if equal to 'string', then result will be "binary string" 93 | * (each char code [0..255]) 94 | * - `header` (Object) - custom header for gzip 95 | * - `text` (Boolean) - true if compressed data believed to be text 96 | * - `time` (Number) - modification time, unix timestamp 97 | * - `os` (Number) - operation system code 98 | * - `extra` (Array) - array of bytes with extra data (max 65536) 99 | * - `name` (String) - file name (binary string) 100 | * - `comment` (String) - comment (binary string) 101 | * - `hcrc` (Boolean) - true if header crc should be added 102 | * 103 | * ##### Example: 104 | * 105 | * ```javascript 106 | * var pako = require('pako') 107 | * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) 108 | * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); 109 | * 110 | * var deflate = new pako.Deflate({ level: 3}); 111 | * 112 | * deflate.push(chunk1, false); 113 | * deflate.push(chunk2, true); // true -> last chunk 114 | * 115 | * if (deflate.err) { throw new Error(deflate.err); } 116 | * 117 | * console.log(deflate.result); 118 | * ``` 119 | **/ 120 | function Deflate(options) { 121 | if (!(this instanceof Deflate)) return new Deflate(options); 122 | 123 | this.options = utils.assign({ 124 | level: Z_DEFAULT_COMPRESSION, 125 | method: Z_DEFLATED, 126 | chunkSize: 16384, 127 | windowBits: 15, 128 | memLevel: 8, 129 | strategy: Z_DEFAULT_STRATEGY, 130 | to: '' 131 | }, options || {}); 132 | 133 | var opt = this.options; 134 | 135 | if (opt.raw && (opt.windowBits > 0)) { 136 | opt.windowBits = -opt.windowBits; 137 | } 138 | 139 | else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { 140 | opt.windowBits += 16; 141 | } 142 | 143 | this.err = 0; // error code, if happens (0 = Z_OK) 144 | this.msg = ''; // error message 145 | this.ended = false; // used to avoid multiple onEnd() calls 146 | this.chunks = []; // chunks of compressed data 147 | 148 | this.strm = new ZStream(); 149 | this.strm.avail_out = 0; 150 | 151 | var status = zlib_deflate.deflateInit2( 152 | this.strm, 153 | opt.level, 154 | opt.method, 155 | opt.windowBits, 156 | opt.memLevel, 157 | opt.strategy 158 | ); 159 | 160 | if (status !== Z_OK) { 161 | throw new Error(msg[status]); 162 | } 163 | 164 | if (opt.header) { 165 | zlib_deflate.deflateSetHeader(this.strm, opt.header); 166 | } 167 | 168 | if (opt.dictionary) { 169 | var dict; 170 | // Convert data if needed 171 | if (typeof opt.dictionary === 'string') { 172 | // If we need to compress text, change encoding to utf8. 173 | dict = strings.string2buf(opt.dictionary); 174 | } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { 175 | dict = new Uint8Array(opt.dictionary); 176 | } else { 177 | dict = opt.dictionary; 178 | } 179 | 180 | status = zlib_deflate.deflateSetDictionary(this.strm, dict); 181 | 182 | if (status !== Z_OK) { 183 | throw new Error(msg[status]); 184 | } 185 | 186 | this._dict_set = true; 187 | } 188 | } 189 | 190 | /** 191 | * Deflate#push(data[, mode]) -> Boolean 192 | * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be 193 | * converted to utf8 byte sequence. 194 | * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. 195 | * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. 196 | * 197 | * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with 198 | * new compressed chunks. Returns `true` on success. The last data block must have 199 | * mode Z_FINISH (or `true`). That will flush internal pending buffers and call 200 | * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you 201 | * can use mode Z_SYNC_FLUSH, keeping the compression context. 202 | * 203 | * On fail call [[Deflate#onEnd]] with error code and return false. 204 | * 205 | * We strongly recommend to use `Uint8Array` on input for best speed (output 206 | * array format is detected automatically). Also, don't skip last param and always 207 | * use the same type in your code (boolean or number). That will improve JS speed. 208 | * 209 | * For regular `Array`-s make sure all elements are [0..255]. 210 | * 211 | * ##### Example 212 | * 213 | * ```javascript 214 | * push(chunk, false); // push one of data chunks 215 | * ... 216 | * push(chunk, true); // push last chunk 217 | * ``` 218 | **/ 219 | Deflate.prototype.push = function (data, mode) { 220 | var strm = this.strm; 221 | var chunkSize = this.options.chunkSize; 222 | var status, _mode; 223 | 224 | if (this.ended) { return false; } 225 | 226 | _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); 227 | 228 | // Convert data if needed 229 | if (typeof data === 'string') { 230 | // If we need to compress text, change encoding to utf8. 231 | strm.input = strings.string2buf(data); 232 | } else if (toString.call(data) === '[object ArrayBuffer]') { 233 | strm.input = new Uint8Array(data); 234 | } else { 235 | strm.input = data; 236 | } 237 | 238 | strm.next_in = 0; 239 | strm.avail_in = strm.input.length; 240 | 241 | do { 242 | if (strm.avail_out === 0) { 243 | strm.output = new utils.Buf8(chunkSize); 244 | strm.next_out = 0; 245 | strm.avail_out = chunkSize; 246 | } 247 | status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ 248 | 249 | if (status !== Z_STREAM_END && status !== Z_OK) { 250 | this.onEnd(status); 251 | this.ended = true; 252 | return false; 253 | } 254 | if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { 255 | if (this.options.to === 'string') { 256 | this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); 257 | } else { 258 | this.onData(utils.shrinkBuf(strm.output, strm.next_out)); 259 | } 260 | } 261 | } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); 262 | 263 | // Finalize on the last chunk. 264 | if (_mode === Z_FINISH) { 265 | status = zlib_deflate.deflateEnd(this.strm); 266 | this.onEnd(status); 267 | this.ended = true; 268 | return status === Z_OK; 269 | } 270 | 271 | // callback interim results if Z_SYNC_FLUSH. 272 | if (_mode === Z_SYNC_FLUSH) { 273 | this.onEnd(Z_OK); 274 | strm.avail_out = 0; 275 | return true; 276 | } 277 | 278 | return true; 279 | }; 280 | 281 | 282 | /** 283 | * Deflate#onData(chunk) -> Void 284 | * - chunk (Uint8Array|Array|String): output data. Type of array depends 285 | * on js engine support. When string output requested, each chunk 286 | * will be string. 287 | * 288 | * By default, stores data blocks in `chunks[]` property and glue 289 | * those in `onEnd`. Override this handler, if you need another behaviour. 290 | **/ 291 | Deflate.prototype.onData = function (chunk) { 292 | this.chunks.push(chunk); 293 | }; 294 | 295 | 296 | /** 297 | * Deflate#onEnd(status) -> Void 298 | * - status (Number): deflate status. 0 (Z_OK) on success, 299 | * other if not. 300 | * 301 | * Called once after you tell deflate that the input stream is 302 | * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) 303 | * or if an error happened. By default - join collected chunks, 304 | * free memory and fill `results` / `err` properties. 305 | **/ 306 | Deflate.prototype.onEnd = function (status) { 307 | // On success - join 308 | if (status === Z_OK) { 309 | if (this.options.to === 'string') { 310 | this.result = this.chunks.join(''); 311 | } else { 312 | this.result = utils.flattenChunks(this.chunks); 313 | } 314 | } 315 | this.chunks = []; 316 | this.err = status; 317 | this.msg = this.strm.msg; 318 | }; 319 | 320 | 321 | /** 322 | * deflate(data[, options]) -> Uint8Array|Array|String 323 | * - data (Uint8Array|Array|String): input data to compress. 324 | * - options (Object): zlib deflate options. 325 | * 326 | * Compress `data` with deflate algorithm and `options`. 327 | * 328 | * Supported options are: 329 | * 330 | * - level 331 | * - windowBits 332 | * - memLevel 333 | * - strategy 334 | * - dictionary 335 | * 336 | * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 337 | * for more information on these. 338 | * 339 | * Sugar (options): 340 | * 341 | * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify 342 | * negative windowBits implicitly. 343 | * - `to` (String) - if equal to 'string', then result will be "binary string" 344 | * (each char code [0..255]) 345 | * 346 | * ##### Example: 347 | * 348 | * ```javascript 349 | * var pako = require('pako') 350 | * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); 351 | * 352 | * console.log(pako.deflate(data)); 353 | * ``` 354 | **/ 355 | function deflate(input, options) { 356 | var deflator = new Deflate(options); 357 | 358 | deflator.push(input, true); 359 | 360 | // That will never happens, if you don't cheat with options :) 361 | if (deflator.err) { throw deflator.msg || msg[deflator.err]; } 362 | 363 | return deflator.result; 364 | } 365 | 366 | 367 | /** 368 | * deflateRaw(data[, options]) -> Uint8Array|Array|String 369 | * - data (Uint8Array|Array|String): input data to compress. 370 | * - options (Object): zlib deflate options. 371 | * 372 | * The same as [[deflate]], but creates raw data, without wrapper 373 | * (header and adler32 crc). 374 | **/ 375 | function deflateRaw(input, options) { 376 | options = options || {}; 377 | options.raw = true; 378 | return deflate(input, options); 379 | } 380 | 381 | 382 | /** 383 | * gzip(data[, options]) -> Uint8Array|Array|String 384 | * - data (Uint8Array|Array|String): input data to compress. 385 | * - options (Object): zlib deflate options. 386 | * 387 | * The same as [[deflate]], but create gzip wrapper instead of 388 | * deflate one. 389 | **/ 390 | function gzip(input, options) { 391 | options = options || {}; 392 | options.gzip = true; 393 | return deflate(input, options); 394 | } 395 | 396 | 397 | exports.Deflate = Deflate; 398 | exports.deflate = deflate; 399 | exports.deflateRaw = deflateRaw; 400 | exports.gzip = gzip; 401 | -------------------------------------------------------------------------------- /node_modules/pako/lib/inflate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | var zlib_inflate = require('./zlib/inflate'); 5 | var utils = require('./utils/common'); 6 | var strings = require('./utils/strings'); 7 | var c = require('./zlib/constants'); 8 | var msg = require('./zlib/messages'); 9 | var ZStream = require('./zlib/zstream'); 10 | var GZheader = require('./zlib/gzheader'); 11 | 12 | var toString = Object.prototype.toString; 13 | 14 | /** 15 | * class Inflate 16 | * 17 | * Generic JS-style wrapper for zlib calls. If you don't need 18 | * streaming behaviour - use more simple functions: [[inflate]] 19 | * and [[inflateRaw]]. 20 | **/ 21 | 22 | /* internal 23 | * inflate.chunks -> Array 24 | * 25 | * Chunks of output data, if [[Inflate#onData]] not overridden. 26 | **/ 27 | 28 | /** 29 | * Inflate.result -> Uint8Array|Array|String 30 | * 31 | * Uncompressed result, generated by default [[Inflate#onData]] 32 | * and [[Inflate#onEnd]] handlers. Filled after you push last chunk 33 | * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you 34 | * push a chunk with explicit flush (call [[Inflate#push]] with 35 | * `Z_SYNC_FLUSH` param). 36 | **/ 37 | 38 | /** 39 | * Inflate.err -> Number 40 | * 41 | * Error code after inflate finished. 0 (Z_OK) on success. 42 | * Should be checked if broken data possible. 43 | **/ 44 | 45 | /** 46 | * Inflate.msg -> String 47 | * 48 | * Error message, if [[Inflate.err]] != 0 49 | **/ 50 | 51 | 52 | /** 53 | * new Inflate(options) 54 | * - options (Object): zlib inflate options. 55 | * 56 | * Creates new inflator instance with specified params. Throws exception 57 | * on bad params. Supported options: 58 | * 59 | * - `windowBits` 60 | * - `dictionary` 61 | * 62 | * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 63 | * for more information on these. 64 | * 65 | * Additional options, for internal needs: 66 | * 67 | * - `chunkSize` - size of generated data chunks (16K by default) 68 | * - `raw` (Boolean) - do raw inflate 69 | * - `to` (String) - if equal to 'string', then result will be converted 70 | * from utf8 to utf16 (javascript) string. When string output requested, 71 | * chunk length can differ from `chunkSize`, depending on content. 72 | * 73 | * By default, when no options set, autodetect deflate/gzip data format via 74 | * wrapper header. 75 | * 76 | * ##### Example: 77 | * 78 | * ```javascript 79 | * var pako = require('pako') 80 | * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) 81 | * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); 82 | * 83 | * var inflate = new pako.Inflate({ level: 3}); 84 | * 85 | * inflate.push(chunk1, false); 86 | * inflate.push(chunk2, true); // true -> last chunk 87 | * 88 | * if (inflate.err) { throw new Error(inflate.err); } 89 | * 90 | * console.log(inflate.result); 91 | * ``` 92 | **/ 93 | function Inflate(options) { 94 | if (!(this instanceof Inflate)) return new Inflate(options); 95 | 96 | this.options = utils.assign({ 97 | chunkSize: 16384, 98 | windowBits: 0, 99 | to: '' 100 | }, options || {}); 101 | 102 | var opt = this.options; 103 | 104 | // Force window size for `raw` data, if not set directly, 105 | // because we have no header for autodetect. 106 | if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { 107 | opt.windowBits = -opt.windowBits; 108 | if (opt.windowBits === 0) { opt.windowBits = -15; } 109 | } 110 | 111 | // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate 112 | if ((opt.windowBits >= 0) && (opt.windowBits < 16) && 113 | !(options && options.windowBits)) { 114 | opt.windowBits += 32; 115 | } 116 | 117 | // Gzip header has no info about windows size, we can do autodetect only 118 | // for deflate. So, if window size not set, force it to max when gzip possible 119 | if ((opt.windowBits > 15) && (opt.windowBits < 48)) { 120 | // bit 3 (16) -> gzipped data 121 | // bit 4 (32) -> autodetect gzip/deflate 122 | if ((opt.windowBits & 15) === 0) { 123 | opt.windowBits |= 15; 124 | } 125 | } 126 | 127 | this.err = 0; // error code, if happens (0 = Z_OK) 128 | this.msg = ''; // error message 129 | this.ended = false; // used to avoid multiple onEnd() calls 130 | this.chunks = []; // chunks of compressed data 131 | 132 | this.strm = new ZStream(); 133 | this.strm.avail_out = 0; 134 | 135 | var status = zlib_inflate.inflateInit2( 136 | this.strm, 137 | opt.windowBits 138 | ); 139 | 140 | if (status !== c.Z_OK) { 141 | throw new Error(msg[status]); 142 | } 143 | 144 | this.header = new GZheader(); 145 | 146 | zlib_inflate.inflateGetHeader(this.strm, this.header); 147 | 148 | // Setup dictionary 149 | if (opt.dictionary) { 150 | // Convert data if needed 151 | if (typeof opt.dictionary === 'string') { 152 | opt.dictionary = strings.string2buf(opt.dictionary); 153 | } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { 154 | opt.dictionary = new Uint8Array(opt.dictionary); 155 | } 156 | if (opt.raw) { //In raw mode we need to set the dictionary early 157 | status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); 158 | if (status !== c.Z_OK) { 159 | throw new Error(msg[status]); 160 | } 161 | } 162 | } 163 | } 164 | 165 | /** 166 | * Inflate#push(data[, mode]) -> Boolean 167 | * - data (Uint8Array|Array|ArrayBuffer|String): input data 168 | * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. 169 | * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. 170 | * 171 | * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with 172 | * new output chunks. Returns `true` on success. The last data block must have 173 | * mode Z_FINISH (or `true`). That will flush internal pending buffers and call 174 | * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you 175 | * can use mode Z_SYNC_FLUSH, keeping the decompression context. 176 | * 177 | * On fail call [[Inflate#onEnd]] with error code and return false. 178 | * 179 | * We strongly recommend to use `Uint8Array` on input for best speed (output 180 | * format is detected automatically). Also, don't skip last param and always 181 | * use the same type in your code (boolean or number). That will improve JS speed. 182 | * 183 | * For regular `Array`-s make sure all elements are [0..255]. 184 | * 185 | * ##### Example 186 | * 187 | * ```javascript 188 | * push(chunk, false); // push one of data chunks 189 | * ... 190 | * push(chunk, true); // push last chunk 191 | * ``` 192 | **/ 193 | Inflate.prototype.push = function (data, mode) { 194 | var strm = this.strm; 195 | var chunkSize = this.options.chunkSize; 196 | var dictionary = this.options.dictionary; 197 | var status, _mode; 198 | var next_out_utf8, tail, utf8str; 199 | 200 | // Flag to properly process Z_BUF_ERROR on testing inflate call 201 | // when we check that all output data was flushed. 202 | var allowBufError = false; 203 | 204 | if (this.ended) { return false; } 205 | _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); 206 | 207 | // Convert data if needed 208 | if (typeof data === 'string') { 209 | // Only binary strings can be decompressed on practice 210 | strm.input = strings.binstring2buf(data); 211 | } else if (toString.call(data) === '[object ArrayBuffer]') { 212 | strm.input = new Uint8Array(data); 213 | } else { 214 | strm.input = data; 215 | } 216 | 217 | strm.next_in = 0; 218 | strm.avail_in = strm.input.length; 219 | 220 | do { 221 | if (strm.avail_out === 0) { 222 | strm.output = new utils.Buf8(chunkSize); 223 | strm.next_out = 0; 224 | strm.avail_out = chunkSize; 225 | } 226 | 227 | status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ 228 | 229 | if (status === c.Z_NEED_DICT && dictionary) { 230 | status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); 231 | } 232 | 233 | if (status === c.Z_BUF_ERROR && allowBufError === true) { 234 | status = c.Z_OK; 235 | allowBufError = false; 236 | } 237 | 238 | if (status !== c.Z_STREAM_END && status !== c.Z_OK) { 239 | this.onEnd(status); 240 | this.ended = true; 241 | return false; 242 | } 243 | 244 | if (strm.next_out) { 245 | if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { 246 | 247 | if (this.options.to === 'string') { 248 | 249 | next_out_utf8 = strings.utf8border(strm.output, strm.next_out); 250 | 251 | tail = strm.next_out - next_out_utf8; 252 | utf8str = strings.buf2string(strm.output, next_out_utf8); 253 | 254 | // move tail 255 | strm.next_out = tail; 256 | strm.avail_out = chunkSize - tail; 257 | if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } 258 | 259 | this.onData(utf8str); 260 | 261 | } else { 262 | this.onData(utils.shrinkBuf(strm.output, strm.next_out)); 263 | } 264 | } 265 | } 266 | 267 | // When no more input data, we should check that internal inflate buffers 268 | // are flushed. The only way to do it when avail_out = 0 - run one more 269 | // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. 270 | // Here we set flag to process this error properly. 271 | // 272 | // NOTE. Deflate does not return error in this case and does not needs such 273 | // logic. 274 | if (strm.avail_in === 0 && strm.avail_out === 0) { 275 | allowBufError = true; 276 | } 277 | 278 | } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); 279 | 280 | if (status === c.Z_STREAM_END) { 281 | _mode = c.Z_FINISH; 282 | } 283 | 284 | // Finalize on the last chunk. 285 | if (_mode === c.Z_FINISH) { 286 | status = zlib_inflate.inflateEnd(this.strm); 287 | this.onEnd(status); 288 | this.ended = true; 289 | return status === c.Z_OK; 290 | } 291 | 292 | // callback interim results if Z_SYNC_FLUSH. 293 | if (_mode === c.Z_SYNC_FLUSH) { 294 | this.onEnd(c.Z_OK); 295 | strm.avail_out = 0; 296 | return true; 297 | } 298 | 299 | return true; 300 | }; 301 | 302 | 303 | /** 304 | * Inflate#onData(chunk) -> Void 305 | * - chunk (Uint8Array|Array|String): output data. Type of array depends 306 | * on js engine support. When string output requested, each chunk 307 | * will be string. 308 | * 309 | * By default, stores data blocks in `chunks[]` property and glue 310 | * those in `onEnd`. Override this handler, if you need another behaviour. 311 | **/ 312 | Inflate.prototype.onData = function (chunk) { 313 | this.chunks.push(chunk); 314 | }; 315 | 316 | 317 | /** 318 | * Inflate#onEnd(status) -> Void 319 | * - status (Number): inflate status. 0 (Z_OK) on success, 320 | * other if not. 321 | * 322 | * Called either after you tell inflate that the input stream is 323 | * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) 324 | * or if an error happened. By default - join collected chunks, 325 | * free memory and fill `results` / `err` properties. 326 | **/ 327 | Inflate.prototype.onEnd = function (status) { 328 | // On success - join 329 | if (status === c.Z_OK) { 330 | if (this.options.to === 'string') { 331 | // Glue & convert here, until we teach pako to send 332 | // utf8 aligned strings to onData 333 | this.result = this.chunks.join(''); 334 | } else { 335 | this.result = utils.flattenChunks(this.chunks); 336 | } 337 | } 338 | this.chunks = []; 339 | this.err = status; 340 | this.msg = this.strm.msg; 341 | }; 342 | 343 | 344 | /** 345 | * inflate(data[, options]) -> Uint8Array|Array|String 346 | * - data (Uint8Array|Array|String): input data to decompress. 347 | * - options (Object): zlib inflate options. 348 | * 349 | * Decompress `data` with inflate/ungzip and `options`. Autodetect 350 | * format via wrapper header by default. That's why we don't provide 351 | * separate `ungzip` method. 352 | * 353 | * Supported options are: 354 | * 355 | * - windowBits 356 | * 357 | * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) 358 | * for more information. 359 | * 360 | * Sugar (options): 361 | * 362 | * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify 363 | * negative windowBits implicitly. 364 | * - `to` (String) - if equal to 'string', then result will be converted 365 | * from utf8 to utf16 (javascript) string. When string output requested, 366 | * chunk length can differ from `chunkSize`, depending on content. 367 | * 368 | * 369 | * ##### Example: 370 | * 371 | * ```javascript 372 | * var pako = require('pako') 373 | * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) 374 | * , output; 375 | * 376 | * try { 377 | * output = pako.inflate(input); 378 | * } catch (err) 379 | * console.log(err); 380 | * } 381 | * ``` 382 | **/ 383 | function inflate(input, options) { 384 | var inflator = new Inflate(options); 385 | 386 | inflator.push(input, true); 387 | 388 | // That will never happens, if you don't cheat with options :) 389 | if (inflator.err) { throw inflator.msg || msg[inflator.err]; } 390 | 391 | return inflator.result; 392 | } 393 | 394 | 395 | /** 396 | * inflateRaw(data[, options]) -> Uint8Array|Array|String 397 | * - data (Uint8Array|Array|String): input data to decompress. 398 | * - options (Object): zlib inflate options. 399 | * 400 | * The same as [[inflate]], but creates raw data, without wrapper 401 | * (header and adler32 crc). 402 | **/ 403 | function inflateRaw(input, options) { 404 | options = options || {}; 405 | options.raw = true; 406 | return inflate(input, options); 407 | } 408 | 409 | 410 | /** 411 | * ungzip(data[, options]) -> Uint8Array|Array|String 412 | * - data (Uint8Array|Array|String): input data to decompress. 413 | * - options (Object): zlib inflate options. 414 | * 415 | * Just shortcut to [[inflate]], because it autodetects format 416 | * by header.content. Done for convenience. 417 | **/ 418 | 419 | 420 | exports.Inflate = Inflate; 421 | exports.inflate = inflate; 422 | exports.inflateRaw = inflateRaw; 423 | exports.ungzip = inflate; 424 | -------------------------------------------------------------------------------- /node_modules/pako/lib/utils/common.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | var TYPED_OK = (typeof Uint8Array !== 'undefined') && 5 | (typeof Uint16Array !== 'undefined') && 6 | (typeof Int32Array !== 'undefined'); 7 | 8 | function _has(obj, key) { 9 | return Object.prototype.hasOwnProperty.call(obj, key); 10 | } 11 | 12 | exports.assign = function (obj /*from1, from2, from3, ...*/) { 13 | var sources = Array.prototype.slice.call(arguments, 1); 14 | while (sources.length) { 15 | var source = sources.shift(); 16 | if (!source) { continue; } 17 | 18 | if (typeof source !== 'object') { 19 | throw new TypeError(source + 'must be non-object'); 20 | } 21 | 22 | for (var p in source) { 23 | if (_has(source, p)) { 24 | obj[p] = source[p]; 25 | } 26 | } 27 | } 28 | 29 | return obj; 30 | }; 31 | 32 | 33 | // reduce buffer size, avoiding mem copy 34 | exports.shrinkBuf = function (buf, size) { 35 | if (buf.length === size) { return buf; } 36 | if (buf.subarray) { return buf.subarray(0, size); } 37 | buf.length = size; 38 | return buf; 39 | }; 40 | 41 | 42 | var fnTyped = { 43 | arraySet: function (dest, src, src_offs, len, dest_offs) { 44 | if (src.subarray && dest.subarray) { 45 | dest.set(src.subarray(src_offs, src_offs + len), dest_offs); 46 | return; 47 | } 48 | // Fallback to ordinary array 49 | for (var i = 0; i < len; i++) { 50 | dest[dest_offs + i] = src[src_offs + i]; 51 | } 52 | }, 53 | // Join array of chunks to single array. 54 | flattenChunks: function (chunks) { 55 | var i, l, len, pos, chunk, result; 56 | 57 | // calculate data length 58 | len = 0; 59 | for (i = 0, l = chunks.length; i < l; i++) { 60 | len += chunks[i].length; 61 | } 62 | 63 | // join chunks 64 | result = new Uint8Array(len); 65 | pos = 0; 66 | for (i = 0, l = chunks.length; i < l; i++) { 67 | chunk = chunks[i]; 68 | result.set(chunk, pos); 69 | pos += chunk.length; 70 | } 71 | 72 | return result; 73 | } 74 | }; 75 | 76 | var fnUntyped = { 77 | arraySet: function (dest, src, src_offs, len, dest_offs) { 78 | for (var i = 0; i < len; i++) { 79 | dest[dest_offs + i] = src[src_offs + i]; 80 | } 81 | }, 82 | // Join array of chunks to single array. 83 | flattenChunks: function (chunks) { 84 | return [].concat.apply([], chunks); 85 | } 86 | }; 87 | 88 | 89 | // Enable/Disable typed arrays use, for testing 90 | // 91 | exports.setTyped = function (on) { 92 | if (on) { 93 | exports.Buf8 = Uint8Array; 94 | exports.Buf16 = Uint16Array; 95 | exports.Buf32 = Int32Array; 96 | exports.assign(exports, fnTyped); 97 | } else { 98 | exports.Buf8 = Array; 99 | exports.Buf16 = Array; 100 | exports.Buf32 = Array; 101 | exports.assign(exports, fnUntyped); 102 | } 103 | }; 104 | 105 | exports.setTyped(TYPED_OK); 106 | -------------------------------------------------------------------------------- /node_modules/pako/lib/utils/strings.js: -------------------------------------------------------------------------------- 1 | // String encode/decode helpers 2 | 'use strict'; 3 | 4 | 5 | var utils = require('./common'); 6 | 7 | 8 | // Quick check if we can use fast array to bin string conversion 9 | // 10 | // - apply(Array) can fail on Android 2.2 11 | // - apply(Uint8Array) can fail on iOS 5.1 Safari 12 | // 13 | var STR_APPLY_OK = true; 14 | var STR_APPLY_UIA_OK = true; 15 | 16 | try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } 17 | try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } 18 | 19 | 20 | // Table with utf8 lengths (calculated by first byte of sequence) 21 | // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, 22 | // because max possible codepoint is 0x10ffff 23 | var _utf8len = new utils.Buf8(256); 24 | for (var q = 0; q < 256; q++) { 25 | _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); 26 | } 27 | _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start 28 | 29 | 30 | // convert string to array (typed, when possible) 31 | exports.string2buf = function (str) { 32 | var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; 33 | 34 | // count binary size 35 | for (m_pos = 0; m_pos < str_len; m_pos++) { 36 | c = str.charCodeAt(m_pos); 37 | if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 38 | c2 = str.charCodeAt(m_pos + 1); 39 | if ((c2 & 0xfc00) === 0xdc00) { 40 | c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 41 | m_pos++; 42 | } 43 | } 44 | buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; 45 | } 46 | 47 | // allocate buffer 48 | buf = new utils.Buf8(buf_len); 49 | 50 | // convert 51 | for (i = 0, m_pos = 0; i < buf_len; m_pos++) { 52 | c = str.charCodeAt(m_pos); 53 | if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { 54 | c2 = str.charCodeAt(m_pos + 1); 55 | if ((c2 & 0xfc00) === 0xdc00) { 56 | c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); 57 | m_pos++; 58 | } 59 | } 60 | if (c < 0x80) { 61 | /* one byte */ 62 | buf[i++] = c; 63 | } else if (c < 0x800) { 64 | /* two bytes */ 65 | buf[i++] = 0xC0 | (c >>> 6); 66 | buf[i++] = 0x80 | (c & 0x3f); 67 | } else if (c < 0x10000) { 68 | /* three bytes */ 69 | buf[i++] = 0xE0 | (c >>> 12); 70 | buf[i++] = 0x80 | (c >>> 6 & 0x3f); 71 | buf[i++] = 0x80 | (c & 0x3f); 72 | } else { 73 | /* four bytes */ 74 | buf[i++] = 0xf0 | (c >>> 18); 75 | buf[i++] = 0x80 | (c >>> 12 & 0x3f); 76 | buf[i++] = 0x80 | (c >>> 6 & 0x3f); 77 | buf[i++] = 0x80 | (c & 0x3f); 78 | } 79 | } 80 | 81 | return buf; 82 | }; 83 | 84 | // Helper (used in 2 places) 85 | function buf2binstring(buf, len) { 86 | // On Chrome, the arguments in a function call that are allowed is `65534`. 87 | // If the length of the buffer is smaller than that, we can use this optimization, 88 | // otherwise we will take a slower path. 89 | if (len < 65534) { 90 | if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { 91 | return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); 92 | } 93 | } 94 | 95 | var result = ''; 96 | for (var i = 0; i < len; i++) { 97 | result += String.fromCharCode(buf[i]); 98 | } 99 | return result; 100 | } 101 | 102 | 103 | // Convert byte array to binary string 104 | exports.buf2binstring = function (buf) { 105 | return buf2binstring(buf, buf.length); 106 | }; 107 | 108 | 109 | // Convert binary string (typed, when possible) 110 | exports.binstring2buf = function (str) { 111 | var buf = new utils.Buf8(str.length); 112 | for (var i = 0, len = buf.length; i < len; i++) { 113 | buf[i] = str.charCodeAt(i); 114 | } 115 | return buf; 116 | }; 117 | 118 | 119 | // convert array to string 120 | exports.buf2string = function (buf, max) { 121 | var i, out, c, c_len; 122 | var len = max || buf.length; 123 | 124 | // Reserve max possible length (2 words per char) 125 | // NB: by unknown reasons, Array is significantly faster for 126 | // String.fromCharCode.apply than Uint16Array. 127 | var utf16buf = new Array(len * 2); 128 | 129 | for (out = 0, i = 0; i < len;) { 130 | c = buf[i++]; 131 | // quick process ascii 132 | if (c < 0x80) { utf16buf[out++] = c; continue; } 133 | 134 | c_len = _utf8len[c]; 135 | // skip 5 & 6 byte codes 136 | if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } 137 | 138 | // apply mask on first byte 139 | c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; 140 | // join the rest 141 | while (c_len > 1 && i < len) { 142 | c = (c << 6) | (buf[i++] & 0x3f); 143 | c_len--; 144 | } 145 | 146 | // terminated by end of string? 147 | if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } 148 | 149 | if (c < 0x10000) { 150 | utf16buf[out++] = c; 151 | } else { 152 | c -= 0x10000; 153 | utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); 154 | utf16buf[out++] = 0xdc00 | (c & 0x3ff); 155 | } 156 | } 157 | 158 | return buf2binstring(utf16buf, out); 159 | }; 160 | 161 | 162 | // Calculate max possible position in utf8 buffer, 163 | // that will not break sequence. If that's not possible 164 | // - (very small limits) return max size as is. 165 | // 166 | // buf[] - utf8 bytes array 167 | // max - length limit (mandatory); 168 | exports.utf8border = function (buf, max) { 169 | var pos; 170 | 171 | max = max || buf.length; 172 | if (max > buf.length) { max = buf.length; } 173 | 174 | // go back from last position, until start of sequence found 175 | pos = max - 1; 176 | while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } 177 | 178 | // Very small and broken sequence, 179 | // return max, because we should return something anyway. 180 | if (pos < 0) { return max; } 181 | 182 | // If we came to start of buffer - that means buffer is too small, 183 | // return max too. 184 | if (pos === 0) { return max; } 185 | 186 | return (pos + _utf8len[buf[pos]] > max) ? pos : max; 187 | }; 188 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/README: -------------------------------------------------------------------------------- 1 | Content of this folder follows zlib C sources as close as possible. 2 | That's intended to simplify maintainability and guarantee equal API 3 | and result. 4 | 5 | Key differences: 6 | 7 | - Everything is in JavaScript. 8 | - No platform-dependent blocks. 9 | - Some things like crc32 rewritten to keep size small and make JIT 10 | work better. 11 | - Some code is different due missed features in JS (macros, pointers, 12 | structures, header files) 13 | - Specific API methods are not implemented (see notes in root readme) 14 | 15 | This port is based on zlib 1.2.8. 16 | 17 | This port is under zlib license (see below) with contribution and addition of javascript 18 | port under expat license (see LICENSE at root of project) 19 | 20 | Copyright: 21 | (C) 1995-2013 Jean-loup Gailly and Mark Adler 22 | (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 23 | 24 | 25 | From zlib's README 26 | ============================================================================= 27 | 28 | Acknowledgments: 29 | 30 | The deflate format used by zlib was defined by Phil Katz. The deflate and 31 | zlib specifications were written by L. Peter Deutsch. Thanks to all the 32 | people who reported problems and suggested various improvements in zlib; they 33 | are too numerous to cite here. 34 | 35 | Copyright notice: 36 | 37 | (C) 1995-2013 Jean-loup Gailly and Mark Adler 38 | 39 | Copyright (c) <''year''> <''copyright holders''> 40 | 41 | This software is provided 'as-is', without any express or implied 42 | warranty. In no event will the authors be held liable for any damages 43 | arising from the use of this software. 44 | 45 | Permission is granted to anyone to use this software for any purpose, 46 | including commercial applications, and to alter it and redistribute it 47 | freely, subject to the following restrictions: 48 | 49 | 1. The origin of this software must not be misrepresented; you must not 50 | claim that you wrote the original software. If you use this software 51 | in a product, an acknowledgment in the product documentation would be 52 | appreciated but is not required. 53 | 2. Altered source versions must be plainly marked as such, and must not be 54 | misrepresented as being the original software. 55 | 3. This notice may not be removed or altered from any source distribution. 56 | 57 | 58 | Jean-loup Gailly Mark Adler 59 | jloup@gzip.org madler@alumni.caltech.edu 60 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/adler32.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Note: adler32 takes 12% for level 0 and 2% for level 6. 4 | // It isn't worth it to make additional optimizations as in original. 5 | // Small size is preferable. 6 | 7 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 8 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 9 | // 10 | // This software is provided 'as-is', without any express or implied 11 | // warranty. In no event will the authors be held liable for any damages 12 | // arising from the use of this software. 13 | // 14 | // Permission is granted to anyone to use this software for any purpose, 15 | // including commercial applications, and to alter it and redistribute it 16 | // freely, subject to the following restrictions: 17 | // 18 | // 1. The origin of this software must not be misrepresented; you must not 19 | // claim that you wrote the original software. If you use this software 20 | // in a product, an acknowledgment in the product documentation would be 21 | // appreciated but is not required. 22 | // 2. Altered source versions must be plainly marked as such, and must not be 23 | // misrepresented as being the original software. 24 | // 3. This notice may not be removed or altered from any source distribution. 25 | 26 | function adler32(adler, buf, len, pos) { 27 | var s1 = (adler & 0xffff) |0, 28 | s2 = ((adler >>> 16) & 0xffff) |0, 29 | n = 0; 30 | 31 | while (len !== 0) { 32 | // Set limit ~ twice less than 5552, to keep 33 | // s2 in 31-bits, because we force signed ints. 34 | // in other case %= will fail. 35 | n = len > 2000 ? 2000 : len; 36 | len -= n; 37 | 38 | do { 39 | s1 = (s1 + buf[pos++]) |0; 40 | s2 = (s2 + s1) |0; 41 | } while (--n); 42 | 43 | s1 %= 65521; 44 | s2 %= 65521; 45 | } 46 | 47 | return (s1 | (s2 << 16)) |0; 48 | } 49 | 50 | 51 | module.exports = adler32; 52 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/constants.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | 22 | module.exports = { 23 | 24 | /* Allowed flush values; see deflate() and inflate() below for details */ 25 | Z_NO_FLUSH: 0, 26 | Z_PARTIAL_FLUSH: 1, 27 | Z_SYNC_FLUSH: 2, 28 | Z_FULL_FLUSH: 3, 29 | Z_FINISH: 4, 30 | Z_BLOCK: 5, 31 | Z_TREES: 6, 32 | 33 | /* Return codes for the compression/decompression functions. Negative values 34 | * are errors, positive values are used for special but normal events. 35 | */ 36 | Z_OK: 0, 37 | Z_STREAM_END: 1, 38 | Z_NEED_DICT: 2, 39 | Z_ERRNO: -1, 40 | Z_STREAM_ERROR: -2, 41 | Z_DATA_ERROR: -3, 42 | //Z_MEM_ERROR: -4, 43 | Z_BUF_ERROR: -5, 44 | //Z_VERSION_ERROR: -6, 45 | 46 | /* compression levels */ 47 | Z_NO_COMPRESSION: 0, 48 | Z_BEST_SPEED: 1, 49 | Z_BEST_COMPRESSION: 9, 50 | Z_DEFAULT_COMPRESSION: -1, 51 | 52 | 53 | Z_FILTERED: 1, 54 | Z_HUFFMAN_ONLY: 2, 55 | Z_RLE: 3, 56 | Z_FIXED: 4, 57 | Z_DEFAULT_STRATEGY: 0, 58 | 59 | /* Possible values of the data_type field (though see inflate()) */ 60 | Z_BINARY: 0, 61 | Z_TEXT: 1, 62 | //Z_ASCII: 1, // = Z_TEXT (deprecated) 63 | Z_UNKNOWN: 2, 64 | 65 | /* The deflate compression method */ 66 | Z_DEFLATED: 8 67 | //Z_NULL: null // Use -1 or null inline, depending on var type 68 | }; 69 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/crc32.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Note: we can't get significant speed boost here. 4 | // So write code to minimize size - no pregenerated tables 5 | // and array tools dependencies. 6 | 7 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 8 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 9 | // 10 | // This software is provided 'as-is', without any express or implied 11 | // warranty. In no event will the authors be held liable for any damages 12 | // arising from the use of this software. 13 | // 14 | // Permission is granted to anyone to use this software for any purpose, 15 | // including commercial applications, and to alter it and redistribute it 16 | // freely, subject to the following restrictions: 17 | // 18 | // 1. The origin of this software must not be misrepresented; you must not 19 | // claim that you wrote the original software. If you use this software 20 | // in a product, an acknowledgment in the product documentation would be 21 | // appreciated but is not required. 22 | // 2. Altered source versions must be plainly marked as such, and must not be 23 | // misrepresented as being the original software. 24 | // 3. This notice may not be removed or altered from any source distribution. 25 | 26 | // Use ordinary array, since untyped makes no boost here 27 | function makeTable() { 28 | var c, table = []; 29 | 30 | for (var n = 0; n < 256; n++) { 31 | c = n; 32 | for (var k = 0; k < 8; k++) { 33 | c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); 34 | } 35 | table[n] = c; 36 | } 37 | 38 | return table; 39 | } 40 | 41 | // Create table on load. Just 255 signed longs. Not a problem. 42 | var crcTable = makeTable(); 43 | 44 | 45 | function crc32(crc, buf, len, pos) { 46 | var t = crcTable, 47 | end = pos + len; 48 | 49 | crc ^= -1; 50 | 51 | for (var i = pos; i < end; i++) { 52 | crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; 53 | } 54 | 55 | return (crc ^ (-1)); // >>> 0; 56 | } 57 | 58 | 59 | module.exports = crc32; 60 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/gzheader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | 22 | function GZheader() { 23 | /* true if compressed data believed to be text */ 24 | this.text = 0; 25 | /* modification time */ 26 | this.time = 0; 27 | /* extra flags (not used when writing a gzip file) */ 28 | this.xflags = 0; 29 | /* operating system */ 30 | this.os = 0; 31 | /* pointer to extra field or Z_NULL if none */ 32 | this.extra = null; 33 | /* extra field length (valid if extra != Z_NULL) */ 34 | this.extra_len = 0; // Actually, we don't need it in JS, 35 | // but leave for few code modifications 36 | 37 | // 38 | // Setup limits is not necessary because in js we should not preallocate memory 39 | // for inflate use constant limit in 65536 bytes 40 | // 41 | 42 | /* space at extra (only when reading header) */ 43 | // this.extra_max = 0; 44 | /* pointer to zero-terminated file name or Z_NULL */ 45 | this.name = ''; 46 | /* space at name (only when reading header) */ 47 | // this.name_max = 0; 48 | /* pointer to zero-terminated comment or Z_NULL */ 49 | this.comment = ''; 50 | /* space at comment (only when reading header) */ 51 | // this.comm_max = 0; 52 | /* true if there was or will be a header crc */ 53 | this.hcrc = 0; 54 | /* true when done reading gzip header (not used when writing a gzip file) */ 55 | this.done = false; 56 | } 57 | 58 | module.exports = GZheader; 59 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/inffast.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | 22 | // See state defs from inflate.js 23 | var BAD = 30; /* got a data error -- remain here until reset */ 24 | var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ 25 | 26 | /* 27 | Decode literal, length, and distance codes and write out the resulting 28 | literal and match bytes until either not enough input or output is 29 | available, an end-of-block is encountered, or a data error is encountered. 30 | When large enough input and output buffers are supplied to inflate(), for 31 | example, a 16K input buffer and a 64K output buffer, more than 95% of the 32 | inflate execution time is spent in this routine. 33 | 34 | Entry assumptions: 35 | 36 | state.mode === LEN 37 | strm.avail_in >= 6 38 | strm.avail_out >= 258 39 | start >= strm.avail_out 40 | state.bits < 8 41 | 42 | On return, state.mode is one of: 43 | 44 | LEN -- ran out of enough output space or enough available input 45 | TYPE -- reached end of block code, inflate() to interpret next block 46 | BAD -- error in block data 47 | 48 | Notes: 49 | 50 | - The maximum input bits used by a length/distance pair is 15 bits for the 51 | length code, 5 bits for the length extra, 15 bits for the distance code, 52 | and 13 bits for the distance extra. This totals 48 bits, or six bytes. 53 | Therefore if strm.avail_in >= 6, then there is enough input to avoid 54 | checking for available input while decoding. 55 | 56 | - The maximum bytes that a single length/distance pair can output is 258 57 | bytes, which is the maximum length that can be coded. inflate_fast() 58 | requires strm.avail_out >= 258 for each loop to avoid checking for 59 | output space. 60 | */ 61 | module.exports = function inflate_fast(strm, start) { 62 | var state; 63 | var _in; /* local strm.input */ 64 | var last; /* have enough input while in < last */ 65 | var _out; /* local strm.output */ 66 | var beg; /* inflate()'s initial strm.output */ 67 | var end; /* while out < end, enough space available */ 68 | //#ifdef INFLATE_STRICT 69 | var dmax; /* maximum distance from zlib header */ 70 | //#endif 71 | var wsize; /* window size or zero if not using window */ 72 | var whave; /* valid bytes in the window */ 73 | var wnext; /* window write index */ 74 | // Use `s_window` instead `window`, avoid conflict with instrumentation tools 75 | var s_window; /* allocated sliding window, if wsize != 0 */ 76 | var hold; /* local strm.hold */ 77 | var bits; /* local strm.bits */ 78 | var lcode; /* local strm.lencode */ 79 | var dcode; /* local strm.distcode */ 80 | var lmask; /* mask for first level of length codes */ 81 | var dmask; /* mask for first level of distance codes */ 82 | var here; /* retrieved table entry */ 83 | var op; /* code bits, operation, extra bits, or */ 84 | /* window position, window bytes to copy */ 85 | var len; /* match length, unused bytes */ 86 | var dist; /* match distance */ 87 | var from; /* where to copy match from */ 88 | var from_source; 89 | 90 | 91 | var input, output; // JS specific, because we have no pointers 92 | 93 | /* copy state to local variables */ 94 | state = strm.state; 95 | //here = state.here; 96 | _in = strm.next_in; 97 | input = strm.input; 98 | last = _in + (strm.avail_in - 5); 99 | _out = strm.next_out; 100 | output = strm.output; 101 | beg = _out - (start - strm.avail_out); 102 | end = _out + (strm.avail_out - 257); 103 | //#ifdef INFLATE_STRICT 104 | dmax = state.dmax; 105 | //#endif 106 | wsize = state.wsize; 107 | whave = state.whave; 108 | wnext = state.wnext; 109 | s_window = state.window; 110 | hold = state.hold; 111 | bits = state.bits; 112 | lcode = state.lencode; 113 | dcode = state.distcode; 114 | lmask = (1 << state.lenbits) - 1; 115 | dmask = (1 << state.distbits) - 1; 116 | 117 | 118 | /* decode literals and length/distances until end-of-block or not enough 119 | input data or output space */ 120 | 121 | top: 122 | do { 123 | if (bits < 15) { 124 | hold += input[_in++] << bits; 125 | bits += 8; 126 | hold += input[_in++] << bits; 127 | bits += 8; 128 | } 129 | 130 | here = lcode[hold & lmask]; 131 | 132 | dolen: 133 | for (;;) { // Goto emulation 134 | op = here >>> 24/*here.bits*/; 135 | hold >>>= op; 136 | bits -= op; 137 | op = (here >>> 16) & 0xff/*here.op*/; 138 | if (op === 0) { /* literal */ 139 | //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? 140 | // "inflate: literal '%c'\n" : 141 | // "inflate: literal 0x%02x\n", here.val)); 142 | output[_out++] = here & 0xffff/*here.val*/; 143 | } 144 | else if (op & 16) { /* length base */ 145 | len = here & 0xffff/*here.val*/; 146 | op &= 15; /* number of extra bits */ 147 | if (op) { 148 | if (bits < op) { 149 | hold += input[_in++] << bits; 150 | bits += 8; 151 | } 152 | len += hold & ((1 << op) - 1); 153 | hold >>>= op; 154 | bits -= op; 155 | } 156 | //Tracevv((stderr, "inflate: length %u\n", len)); 157 | if (bits < 15) { 158 | hold += input[_in++] << bits; 159 | bits += 8; 160 | hold += input[_in++] << bits; 161 | bits += 8; 162 | } 163 | here = dcode[hold & dmask]; 164 | 165 | dodist: 166 | for (;;) { // goto emulation 167 | op = here >>> 24/*here.bits*/; 168 | hold >>>= op; 169 | bits -= op; 170 | op = (here >>> 16) & 0xff/*here.op*/; 171 | 172 | if (op & 16) { /* distance base */ 173 | dist = here & 0xffff/*here.val*/; 174 | op &= 15; /* number of extra bits */ 175 | if (bits < op) { 176 | hold += input[_in++] << bits; 177 | bits += 8; 178 | if (bits < op) { 179 | hold += input[_in++] << bits; 180 | bits += 8; 181 | } 182 | } 183 | dist += hold & ((1 << op) - 1); 184 | //#ifdef INFLATE_STRICT 185 | if (dist > dmax) { 186 | strm.msg = 'invalid distance too far back'; 187 | state.mode = BAD; 188 | break top; 189 | } 190 | //#endif 191 | hold >>>= op; 192 | bits -= op; 193 | //Tracevv((stderr, "inflate: distance %u\n", dist)); 194 | op = _out - beg; /* max distance in output */ 195 | if (dist > op) { /* see if copy from window */ 196 | op = dist - op; /* distance back in window */ 197 | if (op > whave) { 198 | if (state.sane) { 199 | strm.msg = 'invalid distance too far back'; 200 | state.mode = BAD; 201 | break top; 202 | } 203 | 204 | // (!) This block is disabled in zlib defaults, 205 | // don't enable it for binary compatibility 206 | //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR 207 | // if (len <= op - whave) { 208 | // do { 209 | // output[_out++] = 0; 210 | // } while (--len); 211 | // continue top; 212 | // } 213 | // len -= op - whave; 214 | // do { 215 | // output[_out++] = 0; 216 | // } while (--op > whave); 217 | // if (op === 0) { 218 | // from = _out - dist; 219 | // do { 220 | // output[_out++] = output[from++]; 221 | // } while (--len); 222 | // continue top; 223 | // } 224 | //#endif 225 | } 226 | from = 0; // window index 227 | from_source = s_window; 228 | if (wnext === 0) { /* very common case */ 229 | from += wsize - op; 230 | if (op < len) { /* some from window */ 231 | len -= op; 232 | do { 233 | output[_out++] = s_window[from++]; 234 | } while (--op); 235 | from = _out - dist; /* rest from output */ 236 | from_source = output; 237 | } 238 | } 239 | else if (wnext < op) { /* wrap around window */ 240 | from += wsize + wnext - op; 241 | op -= wnext; 242 | if (op < len) { /* some from end of window */ 243 | len -= op; 244 | do { 245 | output[_out++] = s_window[from++]; 246 | } while (--op); 247 | from = 0; 248 | if (wnext < len) { /* some from start of window */ 249 | op = wnext; 250 | len -= op; 251 | do { 252 | output[_out++] = s_window[from++]; 253 | } while (--op); 254 | from = _out - dist; /* rest from output */ 255 | from_source = output; 256 | } 257 | } 258 | } 259 | else { /* contiguous in window */ 260 | from += wnext - op; 261 | if (op < len) { /* some from window */ 262 | len -= op; 263 | do { 264 | output[_out++] = s_window[from++]; 265 | } while (--op); 266 | from = _out - dist; /* rest from output */ 267 | from_source = output; 268 | } 269 | } 270 | while (len > 2) { 271 | output[_out++] = from_source[from++]; 272 | output[_out++] = from_source[from++]; 273 | output[_out++] = from_source[from++]; 274 | len -= 3; 275 | } 276 | if (len) { 277 | output[_out++] = from_source[from++]; 278 | if (len > 1) { 279 | output[_out++] = from_source[from++]; 280 | } 281 | } 282 | } 283 | else { 284 | from = _out - dist; /* copy direct from output */ 285 | do { /* minimum length is three */ 286 | output[_out++] = output[from++]; 287 | output[_out++] = output[from++]; 288 | output[_out++] = output[from++]; 289 | len -= 3; 290 | } while (len > 2); 291 | if (len) { 292 | output[_out++] = output[from++]; 293 | if (len > 1) { 294 | output[_out++] = output[from++]; 295 | } 296 | } 297 | } 298 | } 299 | else if ((op & 64) === 0) { /* 2nd level distance code */ 300 | here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 301 | continue dodist; 302 | } 303 | else { 304 | strm.msg = 'invalid distance code'; 305 | state.mode = BAD; 306 | break top; 307 | } 308 | 309 | break; // need to emulate goto via "continue" 310 | } 311 | } 312 | else if ((op & 64) === 0) { /* 2nd level length code */ 313 | here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; 314 | continue dolen; 315 | } 316 | else if (op & 32) { /* end-of-block */ 317 | //Tracevv((stderr, "inflate: end of block\n")); 318 | state.mode = TYPE; 319 | break top; 320 | } 321 | else { 322 | strm.msg = 'invalid literal/length code'; 323 | state.mode = BAD; 324 | break top; 325 | } 326 | 327 | break; // need to emulate goto via "continue" 328 | } 329 | } while (_in < last && _out < end); 330 | 331 | /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ 332 | len = bits >> 3; 333 | _in -= len; 334 | bits -= len << 3; 335 | hold &= (1 << bits) - 1; 336 | 337 | /* update state and return */ 338 | strm.next_in = _in; 339 | strm.next_out = _out; 340 | strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); 341 | strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); 342 | state.hold = hold; 343 | state.bits = bits; 344 | return; 345 | }; 346 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/inftrees.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | 22 | var utils = require('../utils/common'); 23 | 24 | var MAXBITS = 15; 25 | var ENOUGH_LENS = 852; 26 | var ENOUGH_DISTS = 592; 27 | //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); 28 | 29 | var CODES = 0; 30 | var LENS = 1; 31 | var DISTS = 2; 32 | 33 | var lbase = [ /* Length codes 257..285 base */ 34 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 36 | ]; 37 | 38 | var lext = [ /* Length codes 257..285 extra */ 39 | 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 40 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 41 | ]; 42 | 43 | var dbase = [ /* Distance codes 0..29 base */ 44 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 45 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 46 | 8193, 12289, 16385, 24577, 0, 0 47 | ]; 48 | 49 | var dext = [ /* Distance codes 0..29 extra */ 50 | 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 51 | 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 52 | 28, 28, 29, 29, 64, 64 53 | ]; 54 | 55 | module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) 56 | { 57 | var bits = opts.bits; 58 | //here = opts.here; /* table entry for duplication */ 59 | 60 | var len = 0; /* a code's length in bits */ 61 | var sym = 0; /* index of code symbols */ 62 | var min = 0, max = 0; /* minimum and maximum code lengths */ 63 | var root = 0; /* number of index bits for root table */ 64 | var curr = 0; /* number of index bits for current table */ 65 | var drop = 0; /* code bits to drop for sub-table */ 66 | var left = 0; /* number of prefix codes available */ 67 | var used = 0; /* code entries in table used */ 68 | var huff = 0; /* Huffman code */ 69 | var incr; /* for incrementing code, index */ 70 | var fill; /* index for replicating entries */ 71 | var low; /* low bits for current root entry */ 72 | var mask; /* mask for low root bits */ 73 | var next; /* next available space in table */ 74 | var base = null; /* base value table to use */ 75 | var base_index = 0; 76 | // var shoextra; /* extra bits table to use */ 77 | var end; /* use base and extra for symbol > end */ 78 | var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ 79 | var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ 80 | var extra = null; 81 | var extra_index = 0; 82 | 83 | var here_bits, here_op, here_val; 84 | 85 | /* 86 | Process a set of code lengths to create a canonical Huffman code. The 87 | code lengths are lens[0..codes-1]. Each length corresponds to the 88 | symbols 0..codes-1. The Huffman code is generated by first sorting the 89 | symbols by length from short to long, and retaining the symbol order 90 | for codes with equal lengths. Then the code starts with all zero bits 91 | for the first code of the shortest length, and the codes are integer 92 | increments for the same length, and zeros are appended as the length 93 | increases. For the deflate format, these bits are stored backwards 94 | from their more natural integer increment ordering, and so when the 95 | decoding tables are built in the large loop below, the integer codes 96 | are incremented backwards. 97 | 98 | This routine assumes, but does not check, that all of the entries in 99 | lens[] are in the range 0..MAXBITS. The caller must assure this. 100 | 1..MAXBITS is interpreted as that code length. zero means that that 101 | symbol does not occur in this code. 102 | 103 | The codes are sorted by computing a count of codes for each length, 104 | creating from that a table of starting indices for each length in the 105 | sorted table, and then entering the symbols in order in the sorted 106 | table. The sorted table is work[], with that space being provided by 107 | the caller. 108 | 109 | The length counts are used for other purposes as well, i.e. finding 110 | the minimum and maximum length codes, determining if there are any 111 | codes at all, checking for a valid set of lengths, and looking ahead 112 | at length counts to determine sub-table sizes when building the 113 | decoding tables. 114 | */ 115 | 116 | /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ 117 | for (len = 0; len <= MAXBITS; len++) { 118 | count[len] = 0; 119 | } 120 | for (sym = 0; sym < codes; sym++) { 121 | count[lens[lens_index + sym]]++; 122 | } 123 | 124 | /* bound code lengths, force root to be within code lengths */ 125 | root = bits; 126 | for (max = MAXBITS; max >= 1; max--) { 127 | if (count[max] !== 0) { break; } 128 | } 129 | if (root > max) { 130 | root = max; 131 | } 132 | if (max === 0) { /* no symbols to code at all */ 133 | //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ 134 | //table.bits[opts.table_index] = 1; //here.bits = (var char)1; 135 | //table.val[opts.table_index++] = 0; //here.val = (var short)0; 136 | table[table_index++] = (1 << 24) | (64 << 16) | 0; 137 | 138 | 139 | //table.op[opts.table_index] = 64; 140 | //table.bits[opts.table_index] = 1; 141 | //table.val[opts.table_index++] = 0; 142 | table[table_index++] = (1 << 24) | (64 << 16) | 0; 143 | 144 | opts.bits = 1; 145 | return 0; /* no symbols, but wait for decoding to report error */ 146 | } 147 | for (min = 1; min < max; min++) { 148 | if (count[min] !== 0) { break; } 149 | } 150 | if (root < min) { 151 | root = min; 152 | } 153 | 154 | /* check for an over-subscribed or incomplete set of lengths */ 155 | left = 1; 156 | for (len = 1; len <= MAXBITS; len++) { 157 | left <<= 1; 158 | left -= count[len]; 159 | if (left < 0) { 160 | return -1; 161 | } /* over-subscribed */ 162 | } 163 | if (left > 0 && (type === CODES || max !== 1)) { 164 | return -1; /* incomplete set */ 165 | } 166 | 167 | /* generate offsets into symbol table for each length for sorting */ 168 | offs[1] = 0; 169 | for (len = 1; len < MAXBITS; len++) { 170 | offs[len + 1] = offs[len] + count[len]; 171 | } 172 | 173 | /* sort symbols by length, by symbol order within each length */ 174 | for (sym = 0; sym < codes; sym++) { 175 | if (lens[lens_index + sym] !== 0) { 176 | work[offs[lens[lens_index + sym]]++] = sym; 177 | } 178 | } 179 | 180 | /* 181 | Create and fill in decoding tables. In this loop, the table being 182 | filled is at next and has curr index bits. The code being used is huff 183 | with length len. That code is converted to an index by dropping drop 184 | bits off of the bottom. For codes where len is less than drop + curr, 185 | those top drop + curr - len bits are incremented through all values to 186 | fill the table with replicated entries. 187 | 188 | root is the number of index bits for the root table. When len exceeds 189 | root, sub-tables are created pointed to by the root entry with an index 190 | of the low root bits of huff. This is saved in low to check for when a 191 | new sub-table should be started. drop is zero when the root table is 192 | being filled, and drop is root when sub-tables are being filled. 193 | 194 | When a new sub-table is needed, it is necessary to look ahead in the 195 | code lengths to determine what size sub-table is needed. The length 196 | counts are used for this, and so count[] is decremented as codes are 197 | entered in the tables. 198 | 199 | used keeps track of how many table entries have been allocated from the 200 | provided *table space. It is checked for LENS and DIST tables against 201 | the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in 202 | the initial root table size constants. See the comments in inftrees.h 203 | for more information. 204 | 205 | sym increments through all symbols, and the loop terminates when 206 | all codes of length max, i.e. all codes, have been processed. This 207 | routine permits incomplete codes, so another loop after this one fills 208 | in the rest of the decoding tables with invalid code markers. 209 | */ 210 | 211 | /* set up for code type */ 212 | // poor man optimization - use if-else instead of switch, 213 | // to avoid deopts in old v8 214 | if (type === CODES) { 215 | base = extra = work; /* dummy value--not used */ 216 | end = 19; 217 | 218 | } else if (type === LENS) { 219 | base = lbase; 220 | base_index -= 257; 221 | extra = lext; 222 | extra_index -= 257; 223 | end = 256; 224 | 225 | } else { /* DISTS */ 226 | base = dbase; 227 | extra = dext; 228 | end = -1; 229 | } 230 | 231 | /* initialize opts for loop */ 232 | huff = 0; /* starting code */ 233 | sym = 0; /* starting code symbol */ 234 | len = min; /* starting code length */ 235 | next = table_index; /* current table to fill in */ 236 | curr = root; /* current table index bits */ 237 | drop = 0; /* current bits to drop from code for index */ 238 | low = -1; /* trigger new sub-table when len > root */ 239 | used = 1 << root; /* use root table entries */ 240 | mask = used - 1; /* mask for comparing low */ 241 | 242 | /* check available table space */ 243 | if ((type === LENS && used > ENOUGH_LENS) || 244 | (type === DISTS && used > ENOUGH_DISTS)) { 245 | return 1; 246 | } 247 | 248 | /* process all codes and make table entries */ 249 | for (;;) { 250 | /* create table entry */ 251 | here_bits = len - drop; 252 | if (work[sym] < end) { 253 | here_op = 0; 254 | here_val = work[sym]; 255 | } 256 | else if (work[sym] > end) { 257 | here_op = extra[extra_index + work[sym]]; 258 | here_val = base[base_index + work[sym]]; 259 | } 260 | else { 261 | here_op = 32 + 64; /* end of block */ 262 | here_val = 0; 263 | } 264 | 265 | /* replicate for those indices with low len bits equal to huff */ 266 | incr = 1 << (len - drop); 267 | fill = 1 << curr; 268 | min = fill; /* save offset to next table */ 269 | do { 270 | fill -= incr; 271 | table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; 272 | } while (fill !== 0); 273 | 274 | /* backwards increment the len-bit code huff */ 275 | incr = 1 << (len - 1); 276 | while (huff & incr) { 277 | incr >>= 1; 278 | } 279 | if (incr !== 0) { 280 | huff &= incr - 1; 281 | huff += incr; 282 | } else { 283 | huff = 0; 284 | } 285 | 286 | /* go to next symbol, update count, len */ 287 | sym++; 288 | if (--count[len] === 0) { 289 | if (len === max) { break; } 290 | len = lens[lens_index + work[sym]]; 291 | } 292 | 293 | /* create new sub-table if needed */ 294 | if (len > root && (huff & mask) !== low) { 295 | /* if first time, transition to sub-tables */ 296 | if (drop === 0) { 297 | drop = root; 298 | } 299 | 300 | /* increment past last table */ 301 | next += min; /* here min is 1 << curr */ 302 | 303 | /* determine length of next table */ 304 | curr = len - drop; 305 | left = 1 << curr; 306 | while (curr + drop < max) { 307 | left -= count[curr + drop]; 308 | if (left <= 0) { break; } 309 | curr++; 310 | left <<= 1; 311 | } 312 | 313 | /* check for enough space */ 314 | used += 1 << curr; 315 | if ((type === LENS && used > ENOUGH_LENS) || 316 | (type === DISTS && used > ENOUGH_DISTS)) { 317 | return 1; 318 | } 319 | 320 | /* point entry in root table to sub-table */ 321 | low = huff & mask; 322 | /*table.op[low] = curr; 323 | table.bits[low] = root; 324 | table.val[low] = next - opts.table_index;*/ 325 | table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; 326 | } 327 | } 328 | 329 | /* fill in remaining table entry if code is incomplete (guaranteed to have 330 | at most one remaining entry, since if the code is incomplete, the 331 | maximum code length that was allowed to get this far is one bit) */ 332 | if (huff !== 0) { 333 | //table.op[next + huff] = 64; /* invalid code marker */ 334 | //table.bits[next + huff] = len - drop; 335 | //table.val[next + huff] = 0; 336 | table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; 337 | } 338 | 339 | /* set return parameters */ 340 | //opts.table_index += used; 341 | opts.bits = root; 342 | return 0; 343 | }; 344 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/messages.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | 22 | module.exports = { 23 | 2: 'need dictionary', /* Z_NEED_DICT 2 */ 24 | 1: 'stream end', /* Z_STREAM_END 1 */ 25 | 0: '', /* Z_OK 0 */ 26 | '-1': 'file error', /* Z_ERRNO (-1) */ 27 | '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ 28 | '-3': 'data error', /* Z_DATA_ERROR (-3) */ 29 | '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ 30 | '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ 31 | '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ 32 | }; 33 | -------------------------------------------------------------------------------- /node_modules/pako/lib/zlib/zstream.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // (C) 1995-2013 Jean-loup Gailly and Mark Adler 4 | // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | 22 | function ZStream() { 23 | /* next input byte */ 24 | this.input = null; // JS specific, because we have no pointers 25 | this.next_in = 0; 26 | /* number of bytes available at input */ 27 | this.avail_in = 0; 28 | /* total number of input bytes read so far */ 29 | this.total_in = 0; 30 | /* next output byte should be put there */ 31 | this.output = null; // JS specific, because we have no pointers 32 | this.next_out = 0; 33 | /* remaining free space at output */ 34 | this.avail_out = 0; 35 | /* total number of bytes output so far */ 36 | this.total_out = 0; 37 | /* last error message, NULL if no error */ 38 | this.msg = ''/*Z_NULL*/; 39 | /* not visible by applications */ 40 | this.state = null; 41 | /* best guess about the data type: binary or text */ 42 | this.data_type = 2/*Z_UNKNOWN*/; 43 | /* adler32 value of the uncompressed data */ 44 | this.adler = 0; 45 | } 46 | 47 | module.exports = ZStream; 48 | -------------------------------------------------------------------------------- /node_modules/pako/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "pako@^1.0.5", 3 | "_id": "pako@1.0.10", 4 | "_inBundle": false, 5 | "_integrity": "sha1-Qyi621CGpCaqkPVBl31JVdpclzI=", 6 | "_location": "/pako", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "pako@^1.0.5", 12 | "name": "pako", 13 | "escapedName": "pako", 14 | "rawSpec": "^1.0.5", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.5" 17 | }, 18 | "_requiredBy": [ 19 | "/upng-js" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/pako/download/pako-1.0.10.tgz", 22 | "_shasum": "4328badb5086a426aa90f541977d4955da5c9732", 23 | "_spec": "pako@^1.0.5", 24 | "_where": "/Users/xiaoqingsong/WxProject/Housekeeping/node_modules/upng-js", 25 | "bugs": { 26 | "url": "https://github.com/nodeca/pako/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "contributors": [ 30 | { 31 | "name": "Andrei Tuputcyn", 32 | "url": "https://github.com/andr83" 33 | }, 34 | { 35 | "name": "Vitaly Puzrin", 36 | "url": "https://github.com/puzrin" 37 | }, 38 | { 39 | "name": "Friedel Ziegelmayer", 40 | "url": "https://github.com/dignifiedquire" 41 | }, 42 | { 43 | "name": "Kirill Efimov", 44 | "url": "https://github.com/Kirill89" 45 | }, 46 | { 47 | "name": "Jean-loup Gailly" 48 | }, 49 | { 50 | "name": "Mark Adler" 51 | } 52 | ], 53 | "dependencies": {}, 54 | "deprecated": false, 55 | "description": "zlib port to javascript - fast, modularized, with browser support", 56 | "devDependencies": { 57 | "ansi": "^0.3.1", 58 | "benchmark": "^2.1.4", 59 | "browserify": "^16.2.3", 60 | "buffer-from": "^1.1.1", 61 | "eslint": "^5.9.0", 62 | "istanbul": "^0.4.5", 63 | "mocha": "^5.2.0", 64 | "multiparty": "^4.1.3", 65 | "ndoc": "^5.0.1", 66 | "uglify-js": "=3.4.8", 67 | "zlibjs": "^0.3.1" 68 | }, 69 | "files": [ 70 | "index.js", 71 | "dist/", 72 | "lib/" 73 | ], 74 | "homepage": "https://github.com/nodeca/pako", 75 | "keywords": [ 76 | "zlib", 77 | "deflate", 78 | "inflate", 79 | "gzip" 80 | ], 81 | "license": "(MIT AND Zlib)", 82 | "name": "pako", 83 | "repository": { 84 | "type": "git", 85 | "url": "git+https://github.com/nodeca/pako.git" 86 | }, 87 | "scripts": { 88 | "test": "make test" 89 | }, 90 | "version": "1.0.10" 91 | } 92 | -------------------------------------------------------------------------------- /node_modules/upng-js/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Photopea 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/upng-js/README.md: -------------------------------------------------------------------------------- 1 | # UPNG.js 2 | A small, fast and advanced PNG / APNG encoder and decoder. It is the main PNG engine for [Photopea image editor](https://www.photopea.com). 3 | 4 | * [Examples of PNGs minified by UPNG.js](https://blog.photopea.com/png-minifier-inside-photopea.html#examples) 5 | * [Try UPNG.js in Photopea](https://www.photopea.com) - open an image and press File - Save for web, play with the Quality 6 | * [UPNG.Photopea.com](http://upng.photopea.com) - a separate minifier app, that uses UPNG.js 7 | * Support us by [making a donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ivan%40kuckir%2ecom&lc=CZ&item_name=UPNG%2ejs¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted). 8 | 9 | Download and include the `UPNG.js` file in your code, or get it from NPM: 10 | 11 | ```sh 12 | npm install upng-js 13 | ``` 14 | 15 | ## Encoder 16 | 17 | UPNG.js supports APNG and the interface expects "frames". Regular PNG is just a single-frame animation (single-item array). 18 | 19 | #### `UPNG.encode(imgs, w, h, cnum, [dels])` 20 | * `imgs`: array of frames. A frame is an ArrayBuffer containing the pixel data (RGBA, 8 bits per channel) 21 | * `w`, `h` : width and height of the image 22 | * `cnum`: number of colors in the result; 0: all colors (lossless PNG) 23 | * `dels`: array of delays for each frame (only when 2 or more frames) 24 | * returns an ArrayBuffer with binary data of a PNG file 25 | 26 | UPNG.js can do a lossy minification of PNG files, similar to [TinyPNG](https://tinypng.com/) and other tools. It performs color quantization using the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering). 27 | 28 | Lossy compression is allowed by the last parameter `cnum`. Set it to zero for a lossless compression, or write the number of allowed colors in the image. Smaller values produce smaller files. **Or just use 0 for lossless / 256 for lossy.** 29 | 30 | ## Decoder 31 | 32 | Supports all color types (including Grayscale and Palettes), all channel depths (1, 2, 4, 8, 16), interlaced images etc. Opens PNGs which other libraries can not open (tested with [PngSuite](http://www.schaik.com/pngsuite/)). 33 | 34 | #### `UPNG.decode(buffer)` 35 | * `buffer`: ArrayBuffer containing the PNG file 36 | * returns an image object with following properties: 37 | * * `width`: the width of the image 38 | * * `height`: the height of the image 39 | * * `depth`: number of bits per channel 40 | * * `ctype`: color type of the file (Truecolor, Grayscale, Palette ...) 41 | * * `frames`: additional info about frames (frame delays etc.) 42 | * * `tabs`: additional chunks of the PNG file 43 | * * `data`: pixel data of the image 44 | 45 | PNG files may have a various number of channels and a various color depth. The interpretation of `data` depends on the current color type and color depth (see the [PNG specification](https://www.w3.org/TR/PNG/)). 46 | 47 | #### `UPNG.toRGBA8(img)` 48 | * `img`: PNG image object (returned by UPNG.decode()) 49 | * returns an array of frames. A frame is ArrayBuffer of the image in RGBA format, 8 bits per channel. 50 | 51 | ### Example 52 | var img = UPNG.decode(buff); // put ArrayBuffer of the PNG file into UPNG.decode 53 | var rgba = UPNG.toRGBA8(img)[0]; // UPNG.toRGBA8 returns array of frames, size: width * height * 4 bytes. 54 | 55 | PNG format uses the Inflate algorithm. Right now, UPNG.js calls [Pako.js](https://github.com/nodeca/pako) for the Inflate and Deflate method. 56 | -------------------------------------------------------------------------------- /node_modules/upng-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "upng-js", 3 | "_id": "upng-js@2.1.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-cXbnOXPbNhypXQ+hT5WDhdtrndI=", 6 | "_location": "/upng-js", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "upng-js", 12 | "name": "upng-js", 13 | "escapedName": "upng-js", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npm.taobao.org/upng-js/download/upng-js-2.1.0.tgz", 23 | "_shasum": "7176e73973db361ca95d0fa14f958385db6b9dd2", 24 | "_spec": "upng-js", 25 | "_where": "/Users/xiaoqingsong/WxProject/Housekeeping", 26 | "author": { 27 | "name": "photopea", 28 | "url": "https://github.com/photopea" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/photopea/UPNG.js/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "contributors": [ 35 | { 36 | "name": "Scimonster", 37 | "url": "https://github.com/Scimonster" 38 | } 39 | ], 40 | "dependencies": { 41 | "pako": "^1.0.5" 42 | }, 43 | "deprecated": false, 44 | "description": "Small, fast and advanced PNG / APNG encoder and decoder", 45 | "homepage": "https://github.com/photopea/UPNG.js", 46 | "keywords": [ 47 | "png", 48 | "apng", 49 | "image", 50 | "conversion" 51 | ], 52 | "license": "MIT", 53 | "main": "UPNG", 54 | "name": "upng-js", 55 | "repository": { 56 | "type": "git", 57 | "url": "git+https://github.com/photopea/UPNG.js.git" 58 | }, 59 | "version": "2.1.0" 60 | } 61 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "pako": { 6 | "version": "1.0.10", 7 | "resolved": "https://registry.npm.taobao.org/pako/download/pako-1.0.10.tgz", 8 | "integrity": "sha1-Qyi621CGpCaqkPVBl31JVdpclzI=" 9 | }, 10 | "upng-js": { 11 | "version": "2.1.0", 12 | "resolved": "https://registry.npm.taobao.org/upng-js/download/upng-js-2.1.0.tgz", 13 | "integrity": "sha1-cXbnOXPbNhypXQ+hT5WDhdtrndI=", 14 | "requires": { 15 | "pako": "^1.0.5" 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | 2 | var api=require('../../utils/api.js'); 3 | var config=require('../../utils/config.js'); 4 | var util=require('../../utils/util.js'); 5 | //获取应用实例 6 | var app = getApp() 7 | Page({ 8 | data: { 9 | swiper:null, 10 | img220:config.img220, 11 | img800:config.img800, 12 | version:null, 13 | currentTab:1, 14 | userInfo: {}, 15 | products:[] 16 | }, 17 | 18 | onLoad: function (options) { 19 | var that = this 20 | 21 | this.init(); 22 | 23 | this.chooseAll(); 24 | 25 | //swiper广告 26 | this.getSwiper(); 27 | 28 | // 处理跳转 29 | this.handleNav(options); 30 | }, 31 | 32 | onShareAppMessage:function(){ 33 | return { 34 | title: '生活服务预约', 35 | desc: '预约小程序', 36 | path: '/pages/index/index' 37 | } 38 | }, 39 | 40 | init:function(){ 41 | var v=new Date().getTime(); 42 | this.setData({ 43 | version:v 44 | }) 45 | }, 46 | 47 | // 处理跳转 48 | handleNav:function(options){ 49 | if (options.action) { 50 | console.log("--->" + options.action); 51 | var action = options.action; 52 | var id = options.id; 53 | if(action == 'product'){ 54 | wx.navigateTo({ 55 | url: '../product/product?id=' + id 56 | }) 57 | } 58 | } 59 | }, 60 | 61 | 62 | //筛选 63 | chooseItemClick:function(e){ 64 | var ds=e.currentTarget.dataset; 65 | var clickedTab=ds.tab; 66 | var currentTab=this.data.currentTab; 67 | if(currentTab==clickedTab){ 68 | return; 69 | } 70 | this.setData({ 71 | currentTab:ds.tab 72 | }) 73 | var ct=this.data.currentTab; 74 | if(ct==1){ 75 | this.chooseAll(); 76 | }else if(ct==2){ 77 | this.chooseHot(); 78 | }else if(ct==3){ 79 | this.chooseRecent(); 80 | }else if(ct==4){ 81 | this.chooseMode(1); 82 | } 83 | }, 84 | 85 | //点击单个 86 | itemClick:function(e){ 87 | var ds = e.currentTarget.dataset; 88 | wx.navigateTo({ 89 | url:'../product/product?id='+ds.id 90 | }) 91 | }, 92 | 93 | 94 | getSwiper:function(){ 95 | var that=this; 96 | 97 | api.getSwiperData(config.mid,function(res){ 98 | var products=res.data.products; 99 | var swiper=new Array(); 100 | for(var i=0;i<3;i++){ 101 | swiper.push(products[i].p_icon); 102 | } 103 | console.log("广告返回:==========="+swiper); 104 | wx.setStorageSync('swiper', swiper); 105 | that.setData({ 106 | swiper:swiper 107 | }) 108 | }); 109 | }, 110 | 111 | chooseAll:function(){ 112 | var that=this; 113 | 114 | api.getProductData(config.mid,function a(res){ 115 | that.setData({ 116 | products:res.data.products 117 | }); 118 | console.log("请求返回:==========="+res.data.products); 119 | //存本地 120 | wx.setStorageSync('products', that.data.products); 121 | }); 122 | 123 | }, 124 | 125 | chooseHot:function(){ 126 | var that=this; 127 | api.getHotProductData(config.mid,function(res){ 128 | that.setData({ 129 | products:res.data.products 130 | }); 131 | console.log("请求返回:==========="+res.data.products); 132 | }) 133 | }, 134 | 135 | chooseRecent:function(){ 136 | var that = this; 137 | api.getRecentProductData(config.mid, function(res){ 138 | that.setData({ 139 | products: res.data.products 140 | }); 141 | console.log("请求返回:===========" + res.data.products); 142 | }); 143 | }, 144 | 145 | chooseMode:function(mode){ 146 | var that=this; 147 | api.getModeProductData(config.mid,mode,function(res){ 148 | that.setData({ 149 | products:res.data.products 150 | }); 151 | console.log("请求返回:==========="+res.data.products); 152 | }) 153 | }, 154 | 155 | 156 | 157 | }) 158 | 159 | -------------------------------------------------------------------------------- /pages/index/index.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 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 | 热门 30 | 31 | 32 | | 33 | 34 | 35 | 最新 36 | 37 | 38 | 最新 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 刘老师 52 | 温柔可爱型 53 | ¥100 54 | 200分钟 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 刘老师 65 | 温柔可爱型 66 | ¥100 67 | 200分钟 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | 3 | .page{ 4 | background-color: #fff; 5 | font-family: "PingFang SC","Microsoft YaHei",Arial,sans-serif; 6 | } 7 | 8 | image,view{ 9 | /*border:1px #f00 solid;*/ 10 | } 11 | 12 | .swiper-image{ 13 | width:100%; 14 | height: 100%; 15 | } 16 | 17 | /**筛选**/ 18 | .choose-wrap{ 19 | width:100%; 20 | display: flex; 21 | flex-direction: row; 22 | justify-content: center; 23 | background-color: #fafafa; 24 | } 25 | .choose-item{ 26 | flex:1; 27 | font-size: 12px; 28 | padding-bottom: 5rpx; 29 | } 30 | .choose-item-divider{ 31 | color:#eee; 32 | width: 2rpx; 33 | } 34 | .choose-item-label{ 35 | color:#333; 36 | padding: 20rpx 30rpx; 37 | border-bottom: 8rpx #fafafa solid; 38 | } 39 | .choose-item-selected{ 40 | color:#f275ac; 41 | border-bottom: 8rpx #f275ac solid; 42 | } 43 | 44 | /**每一条的**/ 45 | 46 | .list-item{ 47 | display: flex; 48 | flex-direction: row; 49 | border-bottom: 1px #ccc solid; 50 | } 51 | 52 | .list-item-left-icon{ 53 | width:220rpx; 54 | height:220rpx; 55 | border-radius:110rpx; 56 | margin: 30rpx; 57 | } 58 | 59 | .list-item-right{ 60 | flex:1; 61 | margin: 30rpx 30rpx 30rpx 0rpx; 62 | } 63 | 64 | .item-name{ 65 | color:#333; 66 | font-size: 14px; 67 | margin-bottom: 20rpx; 68 | } 69 | .item-desc{ 70 | color:#333; 71 | font-size: 12px; 72 | margin-bottom: 20rpx; 73 | } 74 | .item-price{ 75 | color:#ff62a7; 76 | font-size: 14px; 77 | margin-bottom: 20rpx; 78 | } 79 | .item-duration{ 80 | color:#ff62a7; 81 | font-size: 12px; 82 | } -------------------------------------------------------------------------------- /pages/meirongshi/meirongshi.js: -------------------------------------------------------------------------------- 1 | var api=require('../../utils/api.js') 2 | var config=require('../../utils/config.js') 3 | var util=require('../../utils/util.js') 4 | 5 | Page({ 6 | data:{ 7 | 8 | version:null, 9 | img800:config.img800, 10 | 11 | staffs:null, 12 | }, 13 | 14 | onLoad:function(){ 15 | var that=this; 16 | 17 | this.init(); 18 | 19 | api.getStaffList(config.mid,function(res){ 20 | that.setData({ 21 | staffs:res.data.staffs 22 | }); 23 | console.log("请求返回:==========="+res.data.staffs); 24 | }); 25 | }, 26 | 27 | init:function(){ 28 | var v=new Date().getTime(); 29 | this.setData({ 30 | version:v 31 | }) 32 | }, 33 | 34 | //去预约页面 35 | yyClick(e){ 36 | var ds = e.currentTarget.dataset; 37 | var isFrom="staff"; 38 | wx.navigateTo({ 39 | url: '../order/orderAddress?id='+ds.id+'&isFrom='+isFrom 40 | }) 41 | } 42 | }) -------------------------------------------------------------------------------- /pages/meirongshi/meirongshi.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/meirongshi/meirongshi.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{staff.s_name}} 11 | 12 | 手法:10分 13 | 礼仪:10分 14 | 知识:10分 15 | 16 | {{staff.s_introduce}} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /pages/meirongshi/meirongshi.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | height: 100%; 3 | } 4 | .page{ 5 | font-family: "PingFang SC","Microsoft YaHei",Arial,sans-serif; 6 | background-color: #f9f9f9; 7 | height: 100%; 8 | } 9 | 10 | image,view{ 11 | /*border:1px #f00 solid;*/ 12 | } 13 | 14 | 15 | /**每一条的**/ 16 | 17 | .list-item{ 18 | display: flex; 19 | flex-direction: row; 20 | background-color: #fff; 21 | border-bottom: 1px #f9f9f9 solid; 22 | } 23 | 24 | .list-item-left-icon{ 25 | width:180rpx; 26 | height:180rpx; 27 | margin: 30rpx; 28 | } 29 | 30 | .list-item-right{ 31 | flex:1; 32 | margin: 30rpx 30rpx 30rpx 0rpx; 33 | } 34 | 35 | .item-name{ 36 | color:#000; 37 | font-size: 14px; 38 | margin-bottom: 20rpx; 39 | } 40 | .item-remark{ 41 | color:#555; 42 | font-size: 12px; 43 | margin-bottom: 20rpx; 44 | } 45 | .item-remark-val{ 46 | color:#df6fa8; 47 | } 48 | .item-intr{ 49 | color:#555; 50 | font-size: 12px; 51 | margin-bottom: 20rpx; 52 | } 53 | 54 | /**预约按钮**/ 55 | .item-yuyue{ 56 | padding: 0 20rpx; 57 | } 58 | .item-yuyue-btn{ 59 | color:#eee; 60 | font-size: 14px; 61 | height: 58rpx; 62 | background-color: #e84445; 63 | } 64 | .btn-hover{ 65 | background-color: #e84445; 66 | opacity: 0.7; 67 | } -------------------------------------------------------------------------------- /pages/my/my.js: -------------------------------------------------------------------------------- 1 | 2 | var util=require('../../utils/util.js') 3 | 4 | Page({ 5 | data:{ 6 | userInfo:null 7 | }, 8 | 9 | onLoad:function(){ 10 | var userInfo=wx.getStorageSync('userInfo'); 11 | if(userInfo){ 12 | this.setData({ 13 | userInfo:userInfo 14 | }) 15 | } 16 | }, 17 | 18 | yuyueClick(){ 19 | wx.navigateTo({ 20 | url: '../myYuyue/myYuyue' 21 | }) 22 | }, 23 | 24 | addressClick(){ 25 | wx.navigateTo({ 26 | url: '../myAddress/myAddress' 27 | }) 28 | }, 29 | 30 | discountClick(){ 31 | util.showModal("暂无优惠券"); 32 | } 33 | }) -------------------------------------------------------------------------------- /pages/my/my.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/my/my.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{userInfo.nickName}} 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 我的预约 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 我的地址 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 优惠券 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /pages/my/my.wxss: -------------------------------------------------------------------------------- 1 | 2 | .page{ 3 | width:100%; 4 | height: 100%; 5 | font-family: "PingFang SC","Microsoft Yahei",Arial, Helvetica, sans-serif; 6 | font-size: 14px; 7 | background-color: #fff; 8 | } 9 | 10 | view,image{ 11 | /*border: 1px #d6d6d6 solid;*/ 12 | } 13 | 14 | /**图片区**/ 15 | .page-header{ 16 | position: relative; 17 | } 18 | 19 | .swiper-image{ 20 | width:100%; 21 | height: 100%; 22 | filter: blur(2px); 23 | } 24 | 25 | .header-info{ 26 | position: absolute; 27 | top:0px; 28 | width:100%; 29 | height: 100%; 30 | display: flex; 31 | flex-direction: column; 32 | } 33 | 34 | .header-icon{ 35 | width:120rpx; 36 | height: 120rpx; 37 | border-radius: 60rpx; 38 | } 39 | .info-name{ 40 | color:#333; 41 | font-size: 12px; 42 | margin: 8rpx; 43 | } 44 | 45 | /**订单**/ 46 | .page-item{ 47 | margin: 0 30rpx; 48 | padding:40rpx 0; 49 | border-bottom: 1px #ccc solid; 50 | display: flex; 51 | flex-direction: row; 52 | } 53 | 54 | .p-icon{ 55 | width:40rpx; 56 | height: 40rpx; 57 | } 58 | 59 | .item-name{ 60 | flex:1; 61 | color:#333; 62 | font-size: 14px; 63 | margin-left: 20rpx; 64 | } -------------------------------------------------------------------------------- /pages/myAddress/myAddress.js: -------------------------------------------------------------------------------- 1 | 2 | Page({ 3 | data:{ 4 | name:'', 5 | phone:'', 6 | address:'' 7 | }, 8 | 9 | 10 | onLoad:function(){ 11 | var address=wx.getStorageSync('address'); 12 | if(address){ 13 | this.setData({ 14 | name:address.name, 15 | phone:address.phone, 16 | address:address.address 17 | }) 18 | } 19 | }, 20 | 21 | formSubmit:function(e){ 22 | var that=this; 23 | var uuid=wx.getStorageSync('uuid'); 24 | 25 | var formData=e.detail.value; 26 | 27 | 28 | 29 | if(!that.isValid(formData)){ 30 | return; 31 | } 32 | 33 | 34 | //基本信息存本地 35 | wx.setStorageSync('address', formData); 36 | 37 | that.showModal("保存成功"); 38 | 39 | }, 40 | 41 | isValid:function(formData){ 42 | if(formData.name==''){ 43 | this.showModal("请输入姓名"); 44 | return false; 45 | }else if(formData.phone==''){ 46 | this.showModal("请输入手机号"); 47 | return false; 48 | }else if(formData.address==''){ 49 | this.showModal("请输入详细地址"); 50 | return false; 51 | } 52 | return true; 53 | }, 54 | 55 | showModal:function(content){ 56 | wx.showModal({ 57 | title: '提示', 58 | showCancel:false, 59 | confirmText:'知道了', 60 | content: content 61 | }) 62 | } 63 | 64 | }) -------------------------------------------------------------------------------- /pages/myAddress/myAddress.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "navigationBarTitleText": "我的地址" 4 | } -------------------------------------------------------------------------------- /pages/myAddress/myAddress.wxml: -------------------------------------------------------------------------------- 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 |
-------------------------------------------------------------------------------- /pages/myAddress/myAddress.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | height: 100%; 3 | background-color: #f4f4f4; 4 | } 5 | 6 | .page{ 7 | font-family: "PingFang SC","Microsoft Yahei",Arial, Helvetica, sans-serif; 8 | font-size: 14px; 9 | background-color: #f4f4f4; 10 | } 11 | .field-item{ 12 | display: flex; 13 | flex-direction: row; 14 | padding: 10px; 15 | border-bottom:1px #eaeaea solid; 16 | background-color: #fff; 17 | } 18 | .field-item-2{ 19 | display: flex; 20 | flex-direction: row; 21 | padding:0 10px; 22 | } 23 | .field-item-label{ 24 | flex:1; 25 | } 26 | .field-item-val{ 27 | flex:3; 28 | } 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | /**底部按钮**/ 38 | .footer{ 39 | margin: 20rpx 30rpx; 40 | } 41 | .field-ok{ 42 | color:#eee; 43 | font-size: 14px; 44 | height: 80rpx; 45 | background-color: #e84445; 46 | } 47 | .field-ok-hover{ 48 | background-color: #e84445; 49 | opacity: 0.7; 50 | } -------------------------------------------------------------------------------- /pages/myYuyue/myYuyue.js: -------------------------------------------------------------------------------- 1 | var api=require('../../utils/api.js') 2 | var config=require('../../utils/config.js') 3 | var util=require('../../utils/util.js') 4 | 5 | 6 | Page({ 7 | data:{ 8 | img220:config.img220, 9 | books:null 10 | }, 11 | 12 | onLoad:function(){ 13 | var that=this; 14 | 15 | this.init(); 16 | 17 | this.getBookData(); 18 | 19 | }, 20 | 21 | 22 | init:function(){ 23 | 24 | }, 25 | 26 | getBookData(){ 27 | var that=this; 28 | var uuid=wx.getStorageSync('uuid'); 29 | if(uuid){ 30 | api.getAllBook(uuid,function(res){ 31 | console.log("===="+res.data.books) 32 | that.setData({ 33 | books:res.data.books 34 | }) 35 | that.processData(); 36 | }); 37 | } 38 | }, 39 | 40 | processData:function(){ 41 | var products=wx.getStorageSync('products'); 42 | var books=this.data.books; 43 | 44 | for(var i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 预约号:{{book.b_id}} 9 | ¥{{book.b_price}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | {{book.p_title}} 17 | 预约时间:{{book.b_time}} 18 | 19 | 20 | 21 | 22 | 23 | 商家已应答 24 | 25 | 26 | 已取消 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 暂无预约 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /pages/myYuyue/myYuyue.wxss: -------------------------------------------------------------------------------- 1 | 2 | .page{ 3 | width:100%; 4 | height: 100%; 5 | background-color: #eaf1f0; 6 | font-family: "PingFang SC","Microsoft YaHei",Arial,sans-serif; 7 | } 8 | 9 | /**每一条的**/ 10 | .list-item{ 11 | display: flex; 12 | flex-direction: column; 13 | background-color: #fff; 14 | margin: 20rpx 0; 15 | } 16 | .list-item-top{ 17 | display: flex; 18 | flex-direction: row; 19 | margin: 0 30rpx; 20 | padding:30rpx 0; 21 | border-bottom: 2rpx #dbc5ba solid; 22 | } 23 | .top-left{ 24 | flex:1; 25 | color:#dbc5ba; 26 | font-size: 12px; 27 | } 28 | .top-right{ 29 | color:#f45e4e; 30 | font-size: 12px; 31 | } 32 | 33 | .list-item-bottom{ 34 | display: flex; 35 | flex-direction: row; 36 | } 37 | 38 | .list-item-left-icon{ 39 | width:200rpx; 40 | height:200rpx; 41 | border-radius:100rpx; 42 | margin: 30rpx; 43 | } 44 | 45 | .list-item-right{ 46 | flex:1; 47 | margin: 30rpx 30rpx 30rpx 0rpx; 48 | } 49 | 50 | .item-name{ 51 | color:#632714; 52 | font-size: 14px; 53 | margin-bottom: 20rpx; 54 | } 55 | .item-desc{ 56 | color:#333; 57 | font-size: 12px; 58 | margin-bottom: 20rpx; 59 | } 60 | .item-time{ 61 | color:#ff62a7; 62 | font-size: 12px; 63 | margin-bottom: 20rpx; 64 | } 65 | .item-tip{ 66 | color:#ff62a7; 67 | font-size: 12px; 68 | } 69 | .item-operate{ 70 | /*border:1px #333 solid;*/ 71 | } 72 | .btn-cancel{ 73 | width:200rpx; 74 | color:#eee; 75 | font-size: 14px; 76 | height: 58rpx; 77 | margin-left: 2rpx; 78 | background-color: #26a69a; 79 | } 80 | .btn-cancel-selected{ 81 | opacity: 0.6; 82 | } 83 | 84 | .tip{ 85 | height: 100%; 86 | } -------------------------------------------------------------------------------- /pages/order/orderAddress.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var config=require('../../utils/config.js') 4 | var util=require('../../utils/util.js') 5 | var api=require('../../utils/api.js') 6 | 7 | Page({ 8 | data:{ 9 | isFrom:null, 10 | name:'', 11 | phone:'', 12 | date: null, 13 | startDate:null, 14 | endDate:null, 15 | time:'09:00', 16 | startTime:'09:00', 17 | endTime:'23:59', 18 | pids:null, 19 | selectedId:null, 20 | selectedInfo:'请选择项目', 21 | sid:null 22 | }, 23 | 24 | onLoad:function(options){ 25 | var that=this; 26 | //清缓存 27 | wx.setStorageSync('selected_product_id', null); 28 | 29 | this.init(); 30 | 31 | var isFrom=options.isFrom; 32 | if(isFrom&&isFrom=="product"){ 33 | var pid=options.id; 34 | var pName=util.getProductNameById(pid); 35 | this.setData({ 36 | isFrom:isFrom, 37 | selectedId:pid, 38 | selectedInfo:pName, 39 | }) 40 | 41 | }else if(isFrom&&isFrom=="staff"){ 42 | api.getOneStaff(config.mid,options.id,function(res){ 43 | var pids=res.data.staff.p_ids; 44 | console.log("请求返回:==========="+pids); 45 | that.setData({ 46 | pids:pids 47 | }) 48 | }); 49 | that.setData({ 50 | isFrom:isFrom, 51 | sid:options.id 52 | }) 53 | } 54 | 55 | 56 | }, 57 | 58 | init:function(){ 59 | //地址信息 60 | // var formData=wx.getStorageSync('formData'); 61 | var address=wx.getStorageSync('address'); 62 | console.log('address:'+address); 63 | if(address){ 64 | this.setData({ 65 | name:address.name, 66 | phone:address.phone 67 | }) 68 | } 69 | 70 | var ts=new Date(); 71 | ts.setDate(ts.getDate()+1); 72 | var start=util.formatTime2(ts); 73 | ts.setDate(ts.getDate()+7); 74 | var end=util.formatTime2(ts); 75 | this.setData({ 76 | date:start, 77 | startDate:start, 78 | endDate:end 79 | }) 80 | }, 81 | 82 | 83 | onShow:function(){ 84 | 85 | //拿缓存显示,用于人员来源 86 | var selectedProductId=wx.getStorageSync('selected_product_id'); 87 | if(selectedProductId){ 88 | var product=util.getProductById(selectedProductId); 89 | var pName=product.p_title; 90 | this.setData({ 91 | selectedId:selectedProductId, 92 | selectedInfo:pName, 93 | }) 94 | 95 | } 96 | 97 | 98 | }, 99 | 100 | bindDateChange: function(e) { 101 | this.setData({ 102 | date: e.detail.value 103 | }) 104 | }, 105 | 106 | bindTimeChange:function(e){ 107 | this.setData({ 108 | time: e.detail.value 109 | }) 110 | }, 111 | 112 | pClick:function(e){ 113 | 114 | if(this.data.isFrom=='product'){return;} 115 | var pids=this.data.pids; 116 | wx.navigateTo({ 117 | url: 'orderProducts?pids='+pids 118 | }) 119 | }, 120 | 121 | 122 | formSubmit:function(e){ 123 | var that=this; 124 | var uuid=wx.getStorageSync('uuid'); 125 | 126 | var formData=e.detail.value; 127 | formData.mid=config.mid; 128 | formData.uuid=uuid; 129 | formData.pid=this.data.selectedId; 130 | formData.sid=this.data.sid; 131 | 132 | 133 | 134 | if(!that.isValid(formData)){ 135 | return; 136 | } 137 | 138 | var product=util.getProductById(this.data.selectedId); 139 | //价格 140 | formData.price=product.p_priceA; 141 | 142 | //基本信息存本地 143 | this.saveAddressInfo(formData); 144 | 145 | api.bookStaff(formData,function(res){ 146 | var code=res.data.code; 147 | console.log("返回:"+code); 148 | if(code==0){ 149 | that.showSuccess(); 150 | }else{ 151 | that.showFail(); 152 | } 153 | }) 154 | }, 155 | 156 | isValid:function(formData){ 157 | if(formData.name==''){ 158 | this.showModal("请输入姓名"); 159 | return false; 160 | }else if(formData.phone==''){ 161 | this.showModal("请输入手机号"); 162 | return false; 163 | }else if(formData.time==''){ 164 | this.showModal("请选择预约时间"); 165 | return false; 166 | }else if(formData.pid==null){ 167 | this.showModal("请选择项目"); 168 | return false; 169 | } 170 | return true; 171 | }, 172 | 173 | saveAddressInfo:function(formData){ 174 | var address=new Object(); 175 | address.name=formData.name; 176 | address.phone=formData.phone; 177 | if(formData.address){ 178 | address.address=formData.address; 179 | }else{ 180 | address.address=''; 181 | } 182 | wx.setStorageSync('address', address); 183 | }, 184 | 185 | showSuccess:function(){ 186 | wx.showToast({ 187 | title: '预约成功', 188 | icon: 'success', 189 | duration: 1000 190 | }) 191 | setTimeout(function(){ 192 | wx.navigateBack() 193 | },1000) 194 | }, 195 | 196 | showFail:function(){ 197 | this.showModal('预约失败') 198 | }, 199 | 200 | showModal:function(content){ 201 | wx.showModal({ 202 | title: '提示', 203 | showCancel:false, 204 | confirmText:'知道了', 205 | content: content 206 | }) 207 | } 208 | 209 | 210 | }) -------------------------------------------------------------------------------- /pages/order/orderAddress.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "navigationBarTitleText": "预约" 4 | } -------------------------------------------------------------------------------- /pages/order/orderAddress.wxml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 姓名 8 | 9 | 10 | 11 | 手机号码 12 | 13 | 14 | 15 | 预约时间 16 | 17 | {{date}} 18 | 19 | 20 | {{time}} 21 | 22 | 23 | 24 | 25 | 26 | 27 | 预约项目 28 | 29 | {{selectedInfo}} 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
-------------------------------------------------------------------------------- /pages/order/orderAddress.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | height: 100%; 3 | background-color: #f4f4f4; 4 | } 5 | 6 | .page{ 7 | font-family: "PingFang SC","Microsoft Yahei",Arial, Helvetica, sans-serif; 8 | font-size: 14px; 9 | background-color: #f4f4f4; 10 | } 11 | .field-item{ 12 | display: flex; 13 | flex-direction: row; 14 | padding: 10px; 15 | border-bottom:1px #eaeaea solid; 16 | background-color: #fff; 17 | } 18 | .field-item-2{ 19 | display: flex; 20 | flex-direction: row; 21 | padding:0 10px; 22 | } 23 | .field-item-label{ 24 | flex:1; 25 | } 26 | .field-item-val{ 27 | flex:3; 28 | } 29 | 30 | .field-item-val-2{ 31 | flex: 1.5; 32 | } 33 | 34 | .val-2{ 35 | padding: 10px 0; 36 | border-bottom:1px #eaeaea solid; 37 | } 38 | 39 | 40 | .field-item-3{ 41 | display: flex; 42 | flex-direction: row; 43 | padding:10px 10px; 44 | border-bottom: 1px #eaeaea solid; 45 | } 46 | 47 | 48 | 49 | /**中间项目**/ 50 | .pro-info{ 51 | margin: 30rpx 0; 52 | border-top:1px #d6d6d6 solid; 53 | border-bottom:1px #d6d6d6 solid; 54 | background-color: #fff; 55 | } 56 | .info-item{ 57 | display: flex; 58 | flex-direction: row; 59 | padding:20rpx 30rpx; 60 | } 61 | .item-left{ 62 | flex:1; 63 | } 64 | .item-right{ 65 | display: flex; 66 | flex-direction: row; 67 | } 68 | .item-right-val{ 69 | padding:12rpx; 70 | } 71 | 72 | .p-icon{ 73 | width:40rpx; 74 | height: 40rpx; 75 | } 76 | 77 | /**底部按钮**/ 78 | .footer{ 79 | margin: 20rpx 30rpx; 80 | } 81 | .field-ok{ 82 | color:#eee; 83 | font-size: 14px; 84 | height: 80rpx; 85 | background-color: #e84445; 86 | } 87 | .field-ok-hover{ 88 | background-color: #e84445; 89 | opacity: 0.7; 90 | } -------------------------------------------------------------------------------- /pages/order/orderProducts.js: -------------------------------------------------------------------------------- 1 | 2 | Page({ 3 | 4 | data:{ 5 | pidsArr:null, 6 | products:null 7 | }, 8 | 9 | onLoad:function(options){ 10 | 11 | if(options.pids){ 12 | var pids= options.pids; 13 | var pidsArr=pids.split(','); 14 | this.setData({ 15 | pidsArr:pidsArr 16 | }) 17 | } 18 | 19 | //get storage 20 | var products=wx.getStorageSync('products'); 21 | 22 | //filter 23 | var i=0; 24 | var pidsArr=this.data.pidsArr; 25 | var newArr=new Array(); 26 | for(i=0;i-1){ 29 | newArr.push(products[i]) 30 | } 31 | } 32 | this.setData({ 33 | products:newArr 34 | }) 35 | }, 36 | 37 | itemClick:function(e){ 38 | var ds=e.currentTarget.dataset; 39 | var id=ds.id; 40 | console.log(id); 41 | //存缓存 42 | wx.setStorageSync('selected_product_id', id); 43 | wx.navigateBack(); 44 | } 45 | }) -------------------------------------------------------------------------------- /pages/order/orderProducts.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/order/orderProducts.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{product.p_title}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /pages/order/orderProducts.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | height: 100%; 3 | background-color: #f4f4f4; 4 | } 5 | 6 | .page{ 7 | font-family: "PingFang SC","Microsoft Yahei",Arial, Helvetica, sans-serif; 8 | font-size: 14px; 9 | background-color: #f4f4f4; 10 | } 11 | .field-item{ 12 | display: flex; 13 | flex-direction: row; 14 | padding: 10px; 15 | border-bottom:1px #eaeaea solid; 16 | background-color: #fff; 17 | } -------------------------------------------------------------------------------- /pages/product/product.js: -------------------------------------------------------------------------------- 1 | 2 | var api=require('../../utils/api.js') 3 | var config=require('../../utils/config.js') 4 | 5 | Page({ 6 | data:{ 7 | img800:config.img800, 8 | product:null 9 | }, 10 | 11 | onLoad:function(options){ 12 | var that=this; 13 | 14 | if(options.id){ 15 | var pid=options.id; 16 | api.getProductById(pid, 17 | function(res){ 18 | console.log("请求成功:==========="+res.data.product); 19 | that.setData({ 20 | product:res.data.product 21 | }) 22 | }) 23 | 24 | this.sendPv(pid); 25 | } 26 | }, 27 | 28 | sendPv:function(id){ 29 | 30 | var that=this; 31 | 32 | api.sendPv(id,function(res){ 33 | console.log("sendPv成功:==========="); 34 | }); 35 | 36 | }, 37 | 38 | yuyueClick(e){ 39 | var ds = e.currentTarget.dataset; 40 | var id=ds.id; 41 | var isFrom="product"; 42 | wx.navigateTo({ 43 | url: '../order/orderAddress?id='+id+'&isFrom='+isFrom 44 | }) 45 | } 46 | }) -------------------------------------------------------------------------------- /pages/product/product.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "产品详情" 3 | } -------------------------------------------------------------------------------- /pages/product/product.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{product.p_duration}}分钟 13 | 14 | 线下价格:{{product.p_priceA}}元 15 | 16 | 17 | 18 | 19 | 20 | {{product.p_title}} 21 | {{product.p_priceA}}元 22 | 23 | 24 | 25 | 26 | 27 | 项目介绍 28 | 29 | {{product.p_introduce}} 30 | 31 | 32 | 33 | 34 | 35 | 适用场景 36 | 37 | {{product.p_fit_people}} 38 | 39 | 40 | 41 | 42 | 一键预约 43 | 44 | -------------------------------------------------------------------------------- /pages/product/product.wxss: -------------------------------------------------------------------------------- 1 | 2 | .page{ 3 | width:100%; 4 | font-family: "PingFang SC","Microsoft Yahei",Arial, Helvetica, sans-serif; 5 | font-size: 14px; 6 | background-color: #f4f4f4; 7 | } 8 | 9 | view,image,text{ 10 | /*border: 1px #f00 solid;*/ 11 | } 12 | 13 | /**图片区**/ 14 | .page-header{ 15 | position: relative; 16 | } 17 | 18 | .swiper-image{ 19 | width:100%; 20 | height: 100%; 21 | } 22 | 23 | .header-info{ 24 | position: absolute; 25 | bottom:0; 26 | width:100%; 27 | padding: 20rpx 0; 28 | background-color: rgba(0,0,0,0.3); 29 | display: flex; 30 | flex-direction: row; 31 | } 32 | 33 | .info-duration{ 34 | color:#fff; 35 | font-size: 12px; 36 | margin-left: 30rpx; 37 | flex:1; 38 | } 39 | .info-name{ 40 | color:#ddd; 41 | font-size: 12px; 42 | margin-left: 20rpx; 43 | flex:1; 44 | } 45 | .info-price{ 46 | color:#ddd; 47 | font-size: 12px; 48 | margin-right: 30rpx; 49 | } 50 | .info-price-val{ 51 | color:#fff; 52 | text-decoration: line-through; 53 | } 54 | 55 | /**name区**/ 56 | .page-title-wrap{ 57 | display: flex; 58 | flex-direction: row; 59 | background-color: #fff; 60 | padding: 0 30rpx 10rpx; 61 | border-bottom: 1px #d6d6d6 solid; 62 | } 63 | .page-title{ 64 | flex:1; 65 | color:#333; 66 | font-size: 16px; 67 | margin: 30rpx 0; 68 | } 69 | .page-title-price{ 70 | color:#fff; 71 | font-size: 14px; 72 | padding: 24rpx; 73 | background-color: #f275ac; 74 | } 75 | 76 | /**项目条目等**/ 77 | .project-item{ 78 | margin-top: 30rpx; 79 | display: flex; 80 | flex-direction: column; 81 | background-color: #fff; 82 | padding: 0 30rpx 10rpx; 83 | border-top: 1px #d6d6d6 solid; 84 | border-bottom: 1px #d6d6d6 solid; 85 | } 86 | 87 | .project-label{ 88 | width:95%; 89 | } 90 | 91 | .project-label-val{ 92 | color:#929292; 93 | font-size: 16px; 94 | width:95%; 95 | padding: 20rpx; 96 | border-bottom: 1px #d6d6d6 solid; 97 | } 98 | .project-val{ 99 | width: 95%; 100 | color:#333; 101 | font-size: 12px; 102 | margin: 30rpx 0; 103 | } 104 | 105 | /**预约按钮**/ 106 | .yuyue-wrap{ 107 | color:#eee; 108 | position: fixed; 109 | bottom: 0px; 110 | width:100%; 111 | padding: 30rpx; 112 | background-color: #f275ac; 113 | } -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Project configuration file, more information: https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": true, 6 | "postcss": true, 7 | "minified": true, 8 | "newFeature": true, 9 | "checkInvalidKey": true, 10 | "uploadWithSourceMap": true, 11 | "babelSetting": { 12 | "ignore": [], 13 | "disablePlugins": [], 14 | "outputPath": "" 15 | }, 16 | "packNpmManually": false, 17 | "packNpmRelationList": [], 18 | "minifyWXSS": true, 19 | "disableUseStrict": false, 20 | "useStaticServer": true, 21 | "showES6CompileOption": false, 22 | "useCompilerPlugins": false 23 | }, 24 | "compileType": "miniprogram", 25 | "libVersion": "2.10.0", 26 | "appid": "wx69d100a1a9b2738d", 27 | "projectname": "Housekeeping", 28 | "condition": {}, 29 | "packOptions": { 30 | "ignore": [], 31 | "include": [] 32 | }, 33 | "editorSetting": { 34 | "tabIndent": "insertSpaces", 35 | "tabSize": 2 36 | } 37 | } -------------------------------------------------------------------------------- /sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /utils/api.js: -------------------------------------------------------------------------------- 1 | 2 | var config=require('config.js') 3 | var util=require('util.js') 4 | 5 | /** 6 | * 发送pv 7 | */ 8 | function sendPv(id,su){ 9 | var url=config.api_send_one_pv; 10 | wx.request({ 11 | url: url, 12 | data: { 13 | pid:id 14 | }, 15 | method: 'POST', 16 | success: su 17 | }) 18 | } 19 | 20 | 21 | /** 22 | * 获取swiper数据 23 | */ 24 | function getSwiperData(mid,su){ 25 | util.showLoading(); 26 | var url=config.api_get_hot_product; 27 | wx.request({ 28 | url:url, 29 | method:'GET', 30 | data:{ 31 | mid:mid 32 | }, 33 | success:su, 34 | fail:function(){ 35 | util.showFailModal(); 36 | }, 37 | complete:function(){ 38 | util.hideLoading(); 39 | } 40 | }) 41 | } 42 | 43 | 44 | /** 45 | * 获取全部产品 46 | */ 47 | function getProductData(mid,su){ 48 | util.showLoading(); 49 | var url=config.api_get_all_product; 50 | console.log("url:"+url+" mid:"+mid); 51 | wx.request({ 52 | url:url, 53 | method:'GET', 54 | data:{ 55 | mid:mid 56 | }, 57 | success:su, 58 | fail:function(){ 59 | util.showFailModal(); 60 | }, 61 | complete:function(){ 62 | util.hideLoading(); 63 | } 64 | }) 65 | } 66 | 67 | 68 | 69 | /** 70 | * 获取热门产品 71 | */ 72 | function getHotProductData(mid,su,fa){ 73 | util.showLoading(); 74 | var url=config.api_get_hot_product; 75 | wx.request({ 76 | url:url, 77 | method:'GET', 78 | data:{ 79 | mid:mid 80 | }, 81 | success:su, 82 | fail:function(){ 83 | util.showFailModal(); 84 | }, 85 | complete:function(){ 86 | util.hideLoading(); 87 | } 88 | }) 89 | } 90 | 91 | 92 | /** 93 | * 获取最近产品 94 | */ 95 | function getRecentProductData(mid, su, fa) { 96 | util.showLoading(); 97 | var url = config.api_get_recent_product; 98 | wx.request({ 99 | url: url, 100 | method: 'GET', 101 | data: { 102 | mid: mid 103 | }, 104 | success: su, 105 | fail: function () { 106 | util.showFailModal(); 107 | }, 108 | complete: function () { 109 | util.hideLoading(); 110 | } 111 | }) 112 | } 113 | 114 | 115 | /** 116 | * 服务模式:上门,到店 117 | */ 118 | function getModeProductData(mid,mode,su,fa){ 119 | util.showLoading(); 120 | var url=config.api_get_mode_product; 121 | wx.request({ 122 | url:url, 123 | method:'GET', 124 | data:{ 125 | mid:mid, 126 | mode:mode 127 | }, 128 | success:su, 129 | fail:function(){ 130 | util.showFailModal(); 131 | }, 132 | complete:function(){ 133 | util.hideLoading(); 134 | } 135 | }) 136 | } 137 | 138 | /** 139 | * 获取单个产品 140 | */ 141 | function getProductById(pid,su,fa){ 142 | util.showLoading(); 143 | var url=config.api_get_one_product; 144 | wx.request({ 145 | url:url, 146 | method:'GET', 147 | data:{ 148 | pid:pid 149 | }, 150 | success:su, 151 | fail:function(){ 152 | util.showFailModal(); 153 | }, 154 | complete:function(){ 155 | util.hideLoading(); 156 | } 157 | }) 158 | } 159 | 160 | 161 | /** 162 | * 获取人员 163 | */ 164 | function getStaffList(mid,su){ 165 | util.showLoading(); 166 | var url=config.api_get_all_staff; 167 | wx.request({ 168 | url:url, 169 | method:'GET', 170 | data:{ 171 | mid:mid 172 | }, 173 | success:su, 174 | fail:function(){ 175 | util.showFailModal(); 176 | }, 177 | complete:function(){ 178 | util.hideLoading(); 179 | } 180 | }) 181 | } 182 | 183 | /** 184 | * 获取单个人员 185 | */ 186 | function getOneStaff(mid,sid,su){ 187 | util.showLoading(); 188 | var url=config.api_get_one_staff; 189 | wx.request({ 190 | url:url, 191 | method:'GET', 192 | data:{ 193 | mid:mid, 194 | sid:sid 195 | }, 196 | success:su, 197 | fail:function(){ 198 | util.showFailModal(); 199 | }, 200 | complete:function(){ 201 | util.hideLoading(); 202 | } 203 | }) 204 | } 205 | 206 | 207 | /** 208 | * 预约人员 209 | */ 210 | function bookStaff(data,su){ 211 | util.showLoading(); 212 | var url=config.api_post_one_book; 213 | wx.request({ 214 | url:url, 215 | method:'POST', 216 | data:data, 217 | success:su, 218 | fail:function(){ 219 | util.showFailModal(); 220 | }, 221 | complete:function(){ 222 | // util.hideLoading(); 223 | } 224 | }) 225 | } 226 | 227 | /** 228 | * 所有预约 229 | */ 230 | function getAllBook(userId,su){ 231 | util.showLoading(); 232 | var url=config.api_get_all_book; 233 | wx.request({ 234 | url:url, 235 | method:'GET', 236 | data:{ 237 | userId:userId 238 | }, 239 | success:su, 240 | fail:function(){ 241 | util.showFailModal(); 242 | }, 243 | complete:function(){ 244 | util.hideLoading(); 245 | } 246 | }) 247 | } 248 | 249 | /** 250 | * 取消预约 251 | */ 252 | function cancelOneBook(bid,su){ 253 | util.showLoading(); 254 | var url=config.api_cancel_one_book; 255 | wx.request({ 256 | url:url, 257 | method:'POST', 258 | data:{ 259 | bid:bid 260 | }, 261 | success:su, 262 | fail:function(){ 263 | util.showFailModal(); 264 | }, 265 | complete:function(){ 266 | // util.hideLoading(); 267 | } 268 | }) 269 | } 270 | 271 | 272 | 273 | module.exports={ 274 | getSwiperData:getSwiperData, 275 | getProductData:getProductData, 276 | getHotProductData:getHotProductData, 277 | getRecentProductData:getRecentProductData, 278 | getModeProductData:getModeProductData, 279 | getStaffList:getStaffList, 280 | getProductById:getProductById, 281 | getOneStaff:getOneStaff, 282 | bookStaff:bookStaff, 283 | sendPv:sendPv, 284 | getAllBook:getAllBook, 285 | cancelOneBook:cancelOneBook 286 | } -------------------------------------------------------------------------------- /utils/config.js: -------------------------------------------------------------------------------- 1 | // var appPath='https://www.wxfont.com'; 2 | var appPath='http://localhost'; 3 | 4 | //图片资源 5 | var img220=appPath+'/upload/img_220'; 6 | var img800=appPath+'/upload/img_800'; 7 | 8 | //api请求 9 | var api_get_all_product=appPath+'/api/product/all'; 10 | var api_get_hot_product=appPath+'/api/product/hot'; 11 | var api_get_mode_product=appPath+'/api/product/mode'; 12 | var api_get_recent_product=appPath+'/api/product/recent' 13 | var api_get_one_product=appPath+'/api/product/one'; 14 | var api_get_all_staff=appPath+'/api/staff/all'; 15 | var api_get_one_staff=appPath+'/api/staff/one'; 16 | var api_post_one_book=appPath+'/api/book/one'; 17 | var api_send_one_pv=appPath+'/api/pv/one'; 18 | var api_get_all_book=appPath+'/api/book/all'; 19 | var api_cancel_one_book=appPath+'/api/book/cancel' 20 | 21 | 22 | module.exports = { 23 | img220:img220, 24 | img800:img800, 25 | 26 | api_get_all_product, 27 | api_get_hot_product, 28 | api_get_recent_product, 29 | api_get_mode_product, 30 | api_get_one_product, 31 | api_get_all_staff, 32 | api_get_one_staff, 33 | api_post_one_book, 34 | api_send_one_pv, 35 | api_get_all_book, 36 | api_cancel_one_book, 37 | 38 | // 后台用户名 39 | mid:'100' 40 | } -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | function formatTime(date) { 2 | var year = date.getFullYear() 3 | var month = date.getMonth() + 1 4 | var day = date.getDate() 5 | 6 | var hour = date.getHours() 7 | var minute = date.getMinutes() 8 | var second = date.getSeconds() 9 | 10 | 11 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') 12 | } 13 | 14 | function formatTime2(date){ 15 | var year = date.getFullYear() 16 | var month = date.getMonth() + 1 17 | var day = date.getDate() 18 | 19 | var hour = date.getHours() 20 | var minute = date.getMinutes() 21 | var second = date.getSeconds() 22 | 23 | 24 | return [year, month, day].map(formatNumber).join('-') 25 | } 26 | 27 | function formatNumber(n) { 28 | n = n.toString() 29 | return n[1] ? n : '0' + n 30 | } 31 | 32 | function showLoading(){ 33 | console.log("showloading-----"); 34 | wx.showToast({ 35 | title: '请稍后', 36 | icon: 'loading', 37 | duration: 5000 38 | }); 39 | } 40 | 41 | function hideLoading(){ 42 | wx.hideToast(); 43 | } 44 | 45 | function showModal(text){ 46 | wx.showModal({ 47 | title: '提示', 48 | content: text, 49 | showCancel:false, 50 | success: function(res) { 51 | if (res.confirm) { 52 | 53 | } 54 | } 55 | }) 56 | } 57 | 58 | function showFailModal(){ 59 | wx.showModal({ 60 | title: '提示', 61 | content: '网络异常,请检查网络', 62 | success: function(res) { 63 | if (res.confirm) { 64 | console.log('用户点击确定') 65 | } 66 | } 67 | }) 68 | } 69 | 70 | function getProductNameById(id){ 71 | var products=wx.getStorageSync('products'); 72 | for(var i=0;i