shopar-plugin 0.8.2-alpha.2 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,7 +32,7 @@ There are two distinct ways of integrating the plugin: via Script tag and via NP
32
32
  Add the following script to your HTML.
33
33
 
34
34
  ```html
35
- <script src="https://cdn.jsdelivr.net/npm/shopar-plugin@{{VERSION}}/dist/shopar-plugin.js"></script>
35
+ <script src="https://cdn.jsdelivr.net/npm/shopar-plugin@0.8.2/dist/shopar-plugin.js"></script>
36
36
  ```
37
37
 
38
38
  It is possible to use a different CDN instead of [jsDelivr](https://www.jsdelivr.com/) (e.g. [cdnjs](https://cdnjs.com/), [unpkg](https://www.unpkg.com/)), or even a relative path if the plugin is distributed as a static asset to your app. Just make sure to set the `baseUrl` parameter accordingly (see [setup options](#shoparpluginsetupoptions) for more details).
@@ -153,7 +153,7 @@ Options used for the plugin setup:
153
153
  - `baseUrl` (optional)
154
154
  - Type: `string`
155
155
  - If provided, defines where the additional ShopAR plugin files are fetched from.
156
- - Default value: `https://cdn.jsdelivr.net/npm/shopar-plugin@{{VERSION}}/dist`
156
+ - Default value: `https://cdn.jsdelivr.net/npm/shopar-plugin@0.8.2/dist`
157
157
  - `defaultUI` (optional)
158
158
  - Type: `boolean`
159
159
  - If provided and set to `false`, disables the default UI such as buttons, loading and error views.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__analytics={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){return Number.isInteger(t)&&t>=0}function n(t){this.name="ArgumentError",this.message=t}var s=e((function(t,e){if(e=e||{},"function"!=typeof t)throw new n("fetch must be a function");if("object"!=typeof e)throw new n("defaults must be an object");if(void 0!==e.retries&&!i(e.retries))throw new n("retries must be a positive integer");if(void 0!==e.retryDelay&&!i(e.retryDelay)&&"function"!=typeof e.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==e.retryOn&&!Array.isArray(e.retryOn)&&"function"!=typeof e.retryOn)throw new n("retryOn property expects an array or function");return e=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},e),function(s,r){var a=e.retries,o=e.retryDelay,c=e.retryOn;if(r&&void 0!==r.retries){if(!i(r.retries))throw new n("retries must be a positive integer");a=r.retries}if(r&&void 0!==r.retryDelay){if(!i(r.retryDelay)&&"function"!=typeof r.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");o=r.retryDelay}if(r&&r.retryOn){if(!Array.isArray(r.retryOn)&&"function"!=typeof r.retryOn)throw new n("retryOn property expects an array or function");c=r.retryOn}return new Promise((function(e,i){var n=function(n){var o="undefined"!=typeof Request&&s instanceof Request?s.clone():s;t(o,r).then((function(t){if(Array.isArray(c)&&-1===c.indexOf(t.status))e(t);else if("function"==typeof c)try{return Promise.resolve(c(n,null,t)).then((function(i){i?u(n,null,t):e(t)})).catch(i)}catch(t){i(t)}else n<a?u(n,null,t):e(t)})).catch((function(t){if("function"==typeof c)try{Promise.resolve(c(n,t,null)).then((function(e){e?u(n,t,null):i(t)})).catch((function(t){i(t)}))}catch(t){i(t)}else n<a?u(n,t,null):i(t)}))};function u(t,e,i){var s="function"==typeof o?o(t,e,i):o;setTimeout((function(){n(++t)}),s)}n(0)}))}}));var r,a;!function(t){t.unknown="unknown",t.user="user",t.organization="organization",t.anonymous="anonymous"}(r||(r={})),function(t){t.api="api",t.query="query",t.ingest="ingest"}(a||(a={}));class o{scope;type;value;remaining;reset;constructor(t=r.unknown,e=a.api,i=0,n=-1,s=new Date){this.scope=t,this.type=e,this.value=i,this.remaining=n,this.reset=s}}function c(t,e,i,n,s){let a=new o;const c=t.headers.get(e.toLowerCase())||r.unknown;a.scope=r[c];const u=t.headers.get(i.toLowerCase())||"",h=parseInt(u,10);isNaN(h)||(a.value=h);const l=t.headers.get(n.toLowerCase())||"",f=parseInt(l,10);isNaN(f)||(a.remaining=f);const m=t.headers.get(s.toLowerCase())||"",y=parseInt(m,10);return isNaN(y)||(a.reset=new Date(1e3*y)),a}class u{config;constructor(t){this.config=t}async doReq(t,e,i={},n={}){let r=`${this.config.baseUrl}${t}`;const o=this._prepareSearchParams(n);o&&(r+=`?${o.toString()}`);const u={...this.config.headers,...i.headers},l=await s(fetch)(r,{retries:3,retryDelay:function(t,e,i){return 1e3*Math.pow(2,t)},retryOn:[503,502,504,500],headers:u,method:e,body:i.body?i.body:void 0});if(204===l.status)return l;if(429==l.status){const t=function(t){let e;return t.url?.endsWith("/ingest")?(e=c(t,"","X-IngestLimit-Limit","X-IngestLimit-Remaining","X-IngestLimit-Reset"),e.type=a.ingest):t.url?.endsWith("/query")||t.url?.endsWith("/_apl")?(e=c(t,"","X-QueryLimit-Limit","X-QueryLimit-Remaining","X-QueryLimit-Reset"),e.type=a.query):(e=c(t,"X-RateLimit-Scope","X-RateLimit-Limit","X-RateLimit-Remaining","X-RateLimit-Reset"),e.type=a.api),e}(l);return Promise.reject(new h(t))}if(401===l.status)return Promise.reject(new Error("Forbidden"));if(l.status>=400){const t=await l.json();return Promise.reject(new Error(t.message))}return await l.json()}post(t,e={},i={}){return this.doReq(t,"POST",e,i)}get(t,e={},i={}){return this.doReq(t,"GET",e,i)}put(t,e={},i={}){return this.doReq(t,"PUT",e,i)}delete(t,e={},i={}){return this.doReq(t,"DELETE",e,i)}_prepareSearchParams=t=>{const e=new URLSearchParams;let i=!1;return Object.keys(t).forEach((n=>{t[n]&&(e.append(n,t[n]),i=!0)})),i?e:null}}class h extends Error{limit;shortcircuit;message="";constructor(t,e=!1){super(),this.limit=t,this.shortcircuit=e,Object.setPrototypeOf(this,h.prototype);const i=h.timeUntilReset(t);this.message=`${t.type} limit exceeded, try again in ${i.minutes}m${i.seconds}s`,t.type==a.api&&(this.message=`${t.scope} `+this.message)}static timeUntilReset(t){const e=t.reset.getTime()-(new Date).getTime(),i=Math.floor(e/1e3%60);return{total:e,minutes:Math.floor(e/1e3/60%60),seconds:i}}}class l{client;constructor({orgId:t="",token:e,url:i}){e||console.warn("Missing Axiom token");const n=i??"https://api.axiom.co",s={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+e};"undefined"==typeof window&&(s["User-Agent"]="axiom-js/1.0.0-rc.1"),t&&(s["X-Axiom-Org-Id"]=t),this.client=new u({baseUrl:n,headers:s,timeout:3e3})}}var f,m,y,p,d,g;!function(t){t.TimestampField="_time";t.Service=class extends l{localPath="/v1/datasets";list=()=>this.client.get(this.localPath);get=t=>this.client.get(this.localPath+"/"+t);create=t=>this.client.post(this.localPath,{body:JSON.stringify(t)});update=(t,e)=>this.client.put(this.localPath+"/"+t,{body:JSON.stringify(e)});delete=t=>this.client.delete(this.localPath+"/"+t);trim=(t,e)=>{const i={maxDuration:e};return this.client.post(this.localPath+"/"+t+"/trim",{body:JSON.stringify(i)})}}}(f||(f={})),function(t){t.Service=class extends l{current=()=>this.client.get("/v1/user")}}(m||(m={}));class w{ingestFn;id;options;events=[];activeFlush=Promise.resolve();nextFlush=setTimeout((()=>{}),0);lastFlush=new Date;constructor(t,e,i){this.ingestFn=t,this.id=e,this.options=i}ingest=t=>{Array.isArray(t)?this.events=this.events.concat(t):this.events.push(t),this.events.length>=1e3||this.lastFlush.getTime()<Date.now()-1e3?(clearTimeout(this.nextFlush),this.activeFlush=this.flush()):(clearTimeout(this.nextFlush),this.nextFlush=setTimeout((()=>{this.activeFlush=this.flush()}),1e3))};flush=async()=>{const t=this.events.splice(0,this.events.length);if(clearTimeout(this.nextFlush),await this.activeFlush,0===t.length)return void(this.lastFlush=new Date);const e=await this.ingestFn(this.id,t,this.options);return this.lastFlush=new Date,e}}class v extends l{datasets;users;localPath="/v1";constructor(t){super(t),this.datasets=new f.Service(t),this.users=new m.Service(t)}ingestRaw=(t,e,i=y.JSON,n=p.Identity,s)=>this.client.post(this.localPath+"/datasets/"+t+"/ingest",{headers:{"Content-Type":i,"Content-Encoding":n},body:e},{"timestamp-field":s?.timestampField,"timestamp-format":s?.timestampFormat,"csv-delimiter":s?.csvDelimiter});queryLegacy=(t,e,i)=>this.client.post(this.localPath+"/datasets/"+t+"/query",{body:JSON.stringify(e)},{"streaming-duration":i?.streamingDuration,nocache:i?.noCache});query=(t,e)=>{const i={apl:t};return e?.startTime&&(i.startTime=e?.startTime),e?.endTime&&(i.endTime=e?.endTime),this.client.post(this.localPath+"/datasets/_apl",{body:JSON.stringify(i)},{"streaming-duration":e?.streamingDuration,nocache:e?.noCache,format:"legacy"})};aplQuery=(t,e)=>this.query(t,e)}class b extends v{batch={};ingest=(t,e,i)=>{const n=function(t,e){return`${t}:${e?.timestampField||"-"}:${e?.timestampFormat||"-"}:${e?.csvDelimiter||"-"}`}(t,i);return this.batch[n]||(this.batch[n]=new w(((t,e,i)=>{const n=(Array.isArray(e)?e:[e]).map((t=>JSON.stringify(t))).join("\n");return this.ingestRaw(t,n,y.NDJSON,p.Identity,i)}),t,i)),this.batch[n].ingest(e)};flush=async()=>{let t=[];for(const e in this.batch)t.push(this.batch[e].flush());await Promise.all(t)}}let x;!function(t){t.JSON="application/json",t.NDJSON="application/x-ndjson",t.CSV="text/csv"}(y||(y={})),function(t){t.Identity="",t.GZIP="gzip"}(p||(p={})),function(t){t.Count="count",t.Distinct="distinct",t.Sum="sum",t.Avg="avg",t.Min="min",t.Max="max",t.Topk="topk",t.Percentiles="percentiles",t.Histogram="histogram",t.Variance="variance",t.Stdev="stdev",t.ArgMin="argmin",t.ArgMax="argmax",t.MakeSet="makeset",t.MakeSetIf="makesetif",t.CountIf="countif",t.CountDistinctIf="distinctif"}(d||(d={})),function(t){t.And="and",t.Or="or",t.Not="not",t.Equal="==",t.NotEqual="!=",t.Exists="exists",t.NotExists="not-exists",t.GreaterThan=">",t.GreaterThanOrEqualTo=">=",t.LessThan="<",t.LessThanOrEqualTo="<=",t.Gt="gt",t.Gte="gte",t.Lt="lt",t.Lte="lte",t.StartsWith="starts-with",t.NotStartsWith="not-starts-with",t.EndsWith="ends-with",t.NotEndsWith="not-ends-with",t.Contains="contains",t.NotContains="not-contains",t.Regexp="regexp",t.NotRegexp="not-regexp"}(g||(g={})),t.initializeImpl=function(){x=new b({token:"xaat-16d05fdd-4ab9-4990-acba-7cee24974bfb"})},t.trackEventImpl=function(t,e){x.ingest("shopar-plugin-alpha",Object.assign({name:t},e))}}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__analytics={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){return Number.isInteger(t)&&t>=0}function n(t){this.name="ArgumentError",this.message=t}var s=e((function(t,e){if(e=e||{},"function"!=typeof t)throw new n("fetch must be a function");if("object"!=typeof e)throw new n("defaults must be an object");if(void 0!==e.retries&&!i(e.retries))throw new n("retries must be a positive integer");if(void 0!==e.retryDelay&&!i(e.retryDelay)&&"function"!=typeof e.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==e.retryOn&&!Array.isArray(e.retryOn)&&"function"!=typeof e.retryOn)throw new n("retryOn property expects an array or function");return e=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},e),function(s,r){var a=e.retries,o=e.retryDelay,c=e.retryOn;if(r&&void 0!==r.retries){if(!i(r.retries))throw new n("retries must be a positive integer");a=r.retries}if(r&&void 0!==r.retryDelay){if(!i(r.retryDelay)&&"function"!=typeof r.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");o=r.retryDelay}if(r&&r.retryOn){if(!Array.isArray(r.retryOn)&&"function"!=typeof r.retryOn)throw new n("retryOn property expects an array or function");c=r.retryOn}return new Promise((function(e,i){var n=function(n){var o="undefined"!=typeof Request&&s instanceof Request?s.clone():s;t(o,r).then((function(t){if(Array.isArray(c)&&-1===c.indexOf(t.status))e(t);else if("function"==typeof c)try{return Promise.resolve(c(n,null,t)).then((function(i){i?u(n,null,t):e(t)})).catch(i)}catch(t){i(t)}else n<a?u(n,null,t):e(t)})).catch((function(t){if("function"==typeof c)try{Promise.resolve(c(n,t,null)).then((function(e){e?u(n,t,null):i(t)})).catch((function(t){i(t)}))}catch(t){i(t)}else n<a?u(n,t,null):i(t)}))};function u(t,e,i){var s="function"==typeof o?o(t,e,i):o;setTimeout((function(){n(++t)}),s)}n(0)}))}}));var r,a;!function(t){t.unknown="unknown",t.user="user",t.organization="organization",t.anonymous="anonymous"}(r||(r={})),function(t){t.api="api",t.query="query",t.ingest="ingest"}(a||(a={}));class o{scope;type;value;remaining;reset;constructor(t=r.unknown,e=a.api,i=0,n=-1,s=new Date){this.scope=t,this.type=e,this.value=i,this.remaining=n,this.reset=s}}function c(t,e,i,n,s){let a=new o;const c=t.headers.get(e.toLowerCase())||r.unknown;a.scope=r[c];const u=t.headers.get(i.toLowerCase())||"",h=parseInt(u,10);isNaN(h)||(a.value=h);const l=t.headers.get(n.toLowerCase())||"",f=parseInt(l,10);isNaN(f)||(a.remaining=f);const m=t.headers.get(s.toLowerCase())||"",y=parseInt(m,10);return isNaN(y)||(a.reset=new Date(1e3*y)),a}class u{config;constructor(t){this.config=t}async doReq(t,e,i={},n={}){let r=`${this.config.baseUrl}${t}`;const o=this._prepareSearchParams(n);o&&(r+=`?${o.toString()}`);const u={...this.config.headers,...i.headers},l=await s(fetch)(r,{retries:3,retryDelay:function(t,e,i){return 1e3*Math.pow(2,t)},retryOn:[503,502,504,500],headers:u,method:e,body:i.body?i.body:void 0});if(204===l.status)return l;if(429==l.status){const t=function(t){let e;return t.url?.endsWith("/ingest")?(e=c(t,"","X-IngestLimit-Limit","X-IngestLimit-Remaining","X-IngestLimit-Reset"),e.type=a.ingest):t.url?.endsWith("/query")||t.url?.endsWith("/_apl")?(e=c(t,"","X-QueryLimit-Limit","X-QueryLimit-Remaining","X-QueryLimit-Reset"),e.type=a.query):(e=c(t,"X-RateLimit-Scope","X-RateLimit-Limit","X-RateLimit-Remaining","X-RateLimit-Reset"),e.type=a.api),e}(l);return Promise.reject(new h(t))}if(401===l.status)return Promise.reject(new Error("Forbidden"));if(l.status>=400){const t=await l.json();return Promise.reject(new Error(t.message))}return await l.json()}post(t,e={},i={}){return this.doReq(t,"POST",e,i)}get(t,e={},i={}){return this.doReq(t,"GET",e,i)}put(t,e={},i={}){return this.doReq(t,"PUT",e,i)}delete(t,e={},i={}){return this.doReq(t,"DELETE",e,i)}_prepareSearchParams=t=>{const e=new URLSearchParams;let i=!1;return Object.keys(t).forEach((n=>{t[n]&&(e.append(n,t[n]),i=!0)})),i?e:null}}class h extends Error{limit;shortcircuit;message="";constructor(t,e=!1){super(),this.limit=t,this.shortcircuit=e,Object.setPrototypeOf(this,h.prototype);const i=h.timeUntilReset(t);this.message=`${t.type} limit exceeded, try again in ${i.minutes}m${i.seconds}s`,t.type==a.api&&(this.message=`${t.scope} `+this.message)}static timeUntilReset(t){const e=t.reset.getTime()-(new Date).getTime(),i=Math.floor(e/1e3%60);return{total:e,minutes:Math.floor(e/1e3/60%60),seconds:i}}}class l{client;constructor({orgId:t="",token:e,url:i}){e||console.warn("Missing Axiom token");const n=i??"https://api.axiom.co",s={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+e};"undefined"==typeof window&&(s["User-Agent"]="axiom-js/1.0.0-rc.1"),t&&(s["X-Axiom-Org-Id"]=t),this.client=new u({baseUrl:n,headers:s,timeout:3e3})}}var f,m,y,p,d,g;!function(t){t.TimestampField="_time";t.Service=class extends l{localPath="/v1/datasets";list=()=>this.client.get(this.localPath);get=t=>this.client.get(this.localPath+"/"+t);create=t=>this.client.post(this.localPath,{body:JSON.stringify(t)});update=(t,e)=>this.client.put(this.localPath+"/"+t,{body:JSON.stringify(e)});delete=t=>this.client.delete(this.localPath+"/"+t);trim=(t,e)=>{const i={maxDuration:e};return this.client.post(this.localPath+"/"+t+"/trim",{body:JSON.stringify(i)})}}}(f||(f={})),function(t){t.Service=class extends l{current=()=>this.client.get("/v1/user")}}(m||(m={}));class w{ingestFn;id;options;events=[];activeFlush=Promise.resolve();nextFlush=setTimeout((()=>{}),0);lastFlush=new Date;constructor(t,e,i){this.ingestFn=t,this.id=e,this.options=i}ingest=t=>{Array.isArray(t)?this.events=this.events.concat(t):this.events.push(t),this.events.length>=1e3||this.lastFlush.getTime()<Date.now()-1e3?(clearTimeout(this.nextFlush),this.activeFlush=this.flush()):(clearTimeout(this.nextFlush),this.nextFlush=setTimeout((()=>{this.activeFlush=this.flush()}),1e3))};flush=async()=>{const t=this.events.splice(0,this.events.length);if(clearTimeout(this.nextFlush),await this.activeFlush,0===t.length)return void(this.lastFlush=new Date);const e=await this.ingestFn(this.id,t,this.options);return this.lastFlush=new Date,e}}class v extends l{datasets;users;localPath="/v1";constructor(t){super(t),this.datasets=new f.Service(t),this.users=new m.Service(t)}ingestRaw=(t,e,i=y.JSON,n=p.Identity,s)=>this.client.post(this.localPath+"/datasets/"+t+"/ingest",{headers:{"Content-Type":i,"Content-Encoding":n},body:e},{"timestamp-field":s?.timestampField,"timestamp-format":s?.timestampFormat,"csv-delimiter":s?.csvDelimiter});queryLegacy=(t,e,i)=>this.client.post(this.localPath+"/datasets/"+t+"/query",{body:JSON.stringify(e)},{"streaming-duration":i?.streamingDuration,nocache:i?.noCache});query=(t,e)=>{const i={apl:t};return e?.startTime&&(i.startTime=e?.startTime),e?.endTime&&(i.endTime=e?.endTime),this.client.post(this.localPath+"/datasets/_apl",{body:JSON.stringify(i)},{"streaming-duration":e?.streamingDuration,nocache:e?.noCache,format:"legacy"})};aplQuery=(t,e)=>this.query(t,e)}class x extends v{batch={};ingest=(t,e,i)=>{const n=function(t,e){return`${t}:${e?.timestampField||"-"}:${e?.timestampFormat||"-"}:${e?.csvDelimiter||"-"}`}(t,i);return this.batch[n]||(this.batch[n]=new w(((t,e,i)=>{const n=(Array.isArray(e)?e:[e]).map((t=>JSON.stringify(t))).join("\n");return this.ingestRaw(t,n,y.NDJSON,p.Identity,i)}),t,i)),this.batch[n].ingest(e)};flush=async()=>{let t=[];for(const e in this.batch)t.push(this.batch[e].flush());await Promise.all(t)}}let b;!function(t){t.JSON="application/json",t.NDJSON="application/x-ndjson",t.CSV="text/csv"}(y||(y={})),function(t){t.Identity="",t.GZIP="gzip"}(p||(p={})),function(t){t.Count="count",t.Distinct="distinct",t.Sum="sum",t.Avg="avg",t.Min="min",t.Max="max",t.Topk="topk",t.Percentiles="percentiles",t.Histogram="histogram",t.Variance="variance",t.Stdev="stdev",t.ArgMin="argmin",t.ArgMax="argmax",t.MakeSet="makeset",t.MakeSetIf="makesetif",t.CountIf="countif",t.CountDistinctIf="distinctif"}(d||(d={})),function(t){t.And="and",t.Or="or",t.Not="not",t.Equal="==",t.NotEqual="!=",t.Exists="exists",t.NotExists="not-exists",t.GreaterThan=">",t.GreaterThanOrEqualTo=">=",t.LessThan="<",t.LessThanOrEqualTo="<=",t.Gt="gt",t.Gte="gte",t.Lt="lt",t.Lte="lte",t.StartsWith="starts-with",t.NotStartsWith="not-starts-with",t.EndsWith="ends-with",t.NotEndsWith="not-ends-with",t.Contains="contains",t.NotContains="not-contains",t.Regexp="regexp",t.NotRegexp="not-regexp"}(g||(g={})),t.initializeImpl=function(){b=new x({token:"xaat-f69a9dd7-3988-4fc2-849b-4a0978468c25"})},t.trackEventImpl=function(t,e){b.ingest("shopar-plugin",Object.assign({name:t},e))}}));
@@ -1,4 +1,4 @@
1
- function e(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}!function(){const e={css:".shopar-btn-container{position:absolute;width:100%;bottom:0;padding-bottom:2rem;display:flex;justify-content:center;gap:.5rem}.shopar-btn{padding:.5rem .75rem;display:flex;justify-content:center;align-items:center;gap:.25rem;background-color:#fff;border:1px solid #ddd;border-radius:9999px;cursor:pointer}.shopar-btn:hover{background-color:#f5f5f5}.shopar-loading-container{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#fff}.shopar-loading-text{text-align:center}.shopar-loading-bar-bg{width:80%;height:.5rem;background-color:#e5e7eb;border-radius:9999px}.shopar-loading-bar-fg{background-color:#1434f7;border-radius:9999px;transition:none;transform:translateX(-100%);will-change:transform}.shopar-loading-bar-fg.active{transition:transform 5s cubic-bezier(0,0,.2,1);transform:none}.shopar-qr{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:#fff}.shopar-ar-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#1e293bb2;transition:.3s ease-in-out opacity}.shopar-ar-prompt-text{text-align:center;color:#fff}.shopar-ar-prompt-img{max-width:80%;max-height:50%;object-fit:contain}.shopar-3d{background-color:#fff}.shopar-3d-poster{background-color:#fff}"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}(),"function"==typeof SuppressedError&&SuppressedError;class t extends Error{constructor(e){super(`ShopAR Plugin: ${e}`)}}const n=[Uint8Array,Uint32Array].length-2,i=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],r=[2,12,7,1],a=window[i[r[r[n]]]][i[r[r[r.length-1]]]];function s(){const e=(new TextEncoder).encode(a),t=i.map((e=>e.length));for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[i[t[2]]](String.fromCodePoint(...e))}a.charCodeAt(n);const o=[1e3,2e3,4e3],l=o.length;function c(t,n=0){return e(this,void 0,void 0,(function*(){try{return yield t()}catch(e){if(n>=l)throw e;return yield new Promise((e=>setTimeout(e,o[n]))),c(t,n+1)}}))}function h(e){return e*(180/Math.PI)}function A(e){return Math.round(100*e)/100}const u=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],d=["Shoes"];const p={};function f(n){return null==p[n]&&(p[n]=function(n){return e(this,void 0,void 0,(function*(){const i=yield c((()=>e(this,void 0,void 0,(function*(){const e=yield fetch(n).catch((e=>{throw console.error(e),new t("Resource unavailable.")}));if(!e.ok)throw new t(`Resource download failed with status ${e.status}.`);return e}))));try{return yield(yield i.blob()).arrayBuffer()}catch(e){throw console.error(e),new t("Resource has invalid body.")}}))}(n)),p[n]}const g="0.8.2-alpha.2";let m=`https://cdn.jsdelivr.net/npm/shopar-plugin@${g}/dist`;const v={update:e=>{null!=e&&(m=e.endsWith("/")?e.substring(0,e.length-1):e)},toString:()=>m};function E(t){return e(this,void 0,void 0,(function*(){if("function"!=typeof importScripts){const e=document.createElement("script");return e.setAttribute("src",t),e.setAttribute("crossorigin","anonymous"),new Promise((t=>{e.addEventListener("load",(()=>t()),!1),e.addEventListener("error",(()=>t()),!1),document.body.appendChild(e)}))}importScripts(t.toString())}))}let b;function C(t,n){let i=!0;return{qrPaused:()=>i,qrDraw:(r,a)=>e(this,void 0,void 0,(function*(){!function(){e(this,void 0,void 0,(function*(){null==b&&(b=E(`${v}/shopar-qr.js`))}))}(),yield b;const s=`https://ar.shopar.ai/${g.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:r,s:a,h:location.href})}`,o=yield window.ShopAR__QR.toDataURL(s),l=new Promise(((e,t)=>{n.onload=e,n.onerror=t}));n.src=o,yield l,i=!1,t.style.display=""})),qrPause:()=>e(this,void 0,void 0,(function*(){i=!0,t.style.display="none"}))}}const _={"loading.ar":"Loading Try On...","loading.3d":"Loading 3D..."},I=Object.keys(_);const x="shopar-error";function y(e,t,n,i){const r=document.createElement("button");r.id=e,r.type="button",r.className="shopar-btn",r.appendChild(i);{const e=document.createElement("span");e.textContent=t,r.appendChild(e)}r.ariaLabel=n;const a=r.style;return a.display="none",a.pointerEvents="auto",r}const M="shopar-control";const w="shopar-deepar-output";const S="shopar-main";const B="shopar-qr-output";function T(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}function R(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function D(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const Q=4,U=.001,L=1e-7,P=10,N=11,F=1/(N-1),O="function"==typeof Float32Array;function k(e,t){return 1-3*t+3*e}function G(e,t){return 3*t-6*e}function H(e){return 3*e}function z(e,t,n){return((k(t,n)*e+G(t,n))*e+H(t))*e}function V(e,t,n){return 3*k(t,n)*e*e+2*G(t,n)*e+H(t)}function W(e){return e}function q(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return W;const r=O?new Float32Array(N):new Array(N);for(let t=0;t<N;++t)r[t]=z(t*F,e,n);function a(t){let i=0,a=1;const s=N-1;for(;a!==s&&r[a]<=t;++a)i+=F;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*F,l=V(o,e,n);return l>=U?function(e,t,n,i){for(let r=0;r<Q;++r){const r=V(t,n,i);if(0===r)return t;t-=(z(t,n,i)-e)/r}return t}(t,o,e,n):0===l?o:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=z(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>L&&++o<P);return s}(t,i,i+F,e,n)}return function(e){return 0===e||1===e?e:z(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function j(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort(((e,t)=>e.time-t.time)).map((({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:q(n)})));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const Y="#",X="time",K="interpolation",J="yaw",Z="pitch",$="fov",ee=[X,J,Z,$,K],te="s",ne="ms",ie=1e3,re="deg",ae="rad",se=Math.PI/180,oe="ease-in-out",le="cubic-bezier(",ce=")";function he(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map((e=>function(e){const t=e.indexOf(Y);return(-1!==t?e.substring(0,t):e).trim()}(e))).filter((e=>""!==e))}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!ee.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(X))throw new Error(`Missing required token: '${X}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=Ae(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=de(null!==(t=i.interpolation)&&void 0!==t?t:oe);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*se,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*se,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*se,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every((t=>t.length!==e.length)))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function Ae(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter((e=>!(null==n?void 0:n.includes(e)))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter((t=>!e.includes(t))).join(", ")}'.`);const i=e.indexOf(X),r=function(e){return e.endsWith(ne)?fe(e.substring(0,e.length-ne.length)):e.endsWith(te)?fe(e.substring(0,e.length-te.length))*ie:fe(e)}(n[i]),a=e.indexOf(K),s=de(-1===a?oe:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case J:o.theta={time:r,value:ue(c),interpolation:s};break;case Z:o.phi={time:r,value:ue(c),interpolation:s};break;case $:o.fov={time:r,value:ue(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function ue(e){return e.endsWith(re)?fe(e.substring(0,e.length-re.length))*se:e.endsWith(ae)?fe(e.substring(0,e.length-ae.length)):fe(e)*se}function de(e){if("hold"===e)return{type:"hold"};if("linear"===e)return pe(0,0,1,1);if("sine"===e)return pe(.37,0,.63,1);if("sine-in"===e)return pe(.12,0,.39,0);if("sine-out"===e)return pe(.61,1,.88,1);if("ease"===e)return pe(.25,.1,.25,1);if("ease-in"===e)return pe(.42,0,1,1);if("ease-out"===e)return pe(0,0,.58,1);if("ease-in-out"===e)return pe(.42,0,.58,1);if(e.startsWith(le)&&e.endsWith(ce)){const t=e.substring(le.length,e.length-ce.length).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:fe(t[0]),y1:fe(t[1]),x2:fe(t[2]),y2:fe(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function pe(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function fe(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
1
+ function e(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}!function(){const e={css:".shopar-btn-container{position:absolute;width:100%;bottom:0;padding-bottom:2rem;display:flex;justify-content:center;gap:.5rem}.shopar-btn{padding:.5rem .75rem;display:flex;justify-content:center;align-items:center;gap:.25rem;background-color:#fff;border:1px solid #ddd;border-radius:9999px;cursor:pointer}.shopar-btn:hover{background-color:#f5f5f5}.shopar-loading-container{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#fff}.shopar-loading-text{text-align:center}.shopar-loading-bar-bg{width:80%;height:.5rem;background-color:#e5e7eb;border-radius:9999px}.shopar-loading-bar-fg{background-color:#1434f7;border-radius:9999px;transition:none;transform:translateX(-100%);will-change:transform}.shopar-loading-bar-fg.active{transition:transform 5s cubic-bezier(0,0,.2,1);transform:none}.shopar-qr{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:#fff}.shopar-ar-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#1e293bb2;transition:.3s ease-in-out opacity}.shopar-ar-prompt-text{text-align:center;color:#fff}.shopar-ar-prompt-img{max-width:80%;max-height:50%;object-fit:contain}.shopar-3d{background-color:#fff}.shopar-3d-poster{background-color:#fff}"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}(),"function"==typeof SuppressedError&&SuppressedError;class t extends Error{constructor(e){super(`ShopAR Plugin: ${e}`)}}const n=[Uint8Array,Uint32Array].length-2,i=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],r=[2,12,7,1],a=window[i[r[r[n]]]][i[r[r[r.length-1]]]];function s(){const e=(new TextEncoder).encode(a),t=i.map((e=>e.length));for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[i[t[2]]](String.fromCodePoint(...e))}a.charCodeAt(n);const o=[1e3,2e3,4e3],l=o.length;function c(t,n=0){return e(this,void 0,void 0,(function*(){try{return yield t()}catch(e){if(n>=l)throw e;return yield new Promise((e=>setTimeout(e,o[n]))),c(t,n+1)}}))}function h(e){return e*(180/Math.PI)}function A(e){return Math.round(100*e)/100}const u=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],d=["Shoes"];const p={};function f(n){return null==p[n]&&(p[n]=function(n){return e(this,void 0,void 0,(function*(){const i=yield c((()=>e(this,void 0,void 0,(function*(){const e=yield fetch(n).catch((e=>{throw console.error(e),new t("Resource unavailable.")}));if(!e.ok)throw new t(`Resource download failed with status ${e.status}.`);return e}))));try{return yield(yield i.blob()).arrayBuffer()}catch(e){throw console.error(e),new t("Resource has invalid body.")}}))}(n)),p[n]}const g="0.8.2";let m=`https://cdn.jsdelivr.net/npm/shopar-plugin@${g}/dist`;const v={update:e=>{null!=e&&(m=e.endsWith("/")?e.substring(0,e.length-1):e)},toString:()=>m};function E(t){return e(this,void 0,void 0,(function*(){if("function"!=typeof importScripts){const e=document.createElement("script");return e.setAttribute("src",t),e.setAttribute("crossorigin","anonymous"),new Promise((t=>{e.addEventListener("load",(()=>t()),!1),e.addEventListener("error",(()=>t()),!1),document.body.appendChild(e)}))}importScripts(t.toString())}))}let b;function C(t,n){let i=!0;return{qrPaused:()=>i,qrDraw:(r,a)=>e(this,void 0,void 0,(function*(){!function(){e(this,void 0,void 0,(function*(){null==b&&(b=E(`${v}/shopar-qr.js`))}))}(),yield b;const s=`https://ar.shopar.ai/${g.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:r,s:a,h:location.href})}`,o=yield window.ShopAR__QR.toDataURL(s),l=new Promise(((e,t)=>{n.onload=e,n.onerror=t}));n.src=o,yield l,i=!1,t.style.display=""})),qrPause:()=>e(this,void 0,void 0,(function*(){i=!0,t.style.display="none"}))}}const _={"loading.ar":"Loading Try On...","loading.3d":"Loading 3D..."},I=Object.keys(_);const x="shopar-error";function y(e,t,n,i){const r=document.createElement("button");r.id=e,r.type="button",r.className="shopar-btn",r.appendChild(i);{const e=document.createElement("span");e.textContent=t,r.appendChild(e)}r.ariaLabel=n;const a=r.style;return a.display="none",a.pointerEvents="auto",r}const M="shopar-control";const w="shopar-deepar-output";const S="shopar-main";const B="shopar-qr-output";function T(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}function R(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function D(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const Q=4,U=.001,L=1e-7,P=10,N=11,F=1/(N-1),O="function"==typeof Float32Array;function k(e,t){return 1-3*t+3*e}function G(e,t){return 3*t-6*e}function H(e){return 3*e}function z(e,t,n){return((k(t,n)*e+G(t,n))*e+H(t))*e}function V(e,t,n){return 3*k(t,n)*e*e+2*G(t,n)*e+H(t)}function W(e){return e}function q(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return W;const r=O?new Float32Array(N):new Array(N);for(let t=0;t<N;++t)r[t]=z(t*F,e,n);function a(t){let i=0,a=1;const s=N-1;for(;a!==s&&r[a]<=t;++a)i+=F;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*F,l=V(o,e,n);return l>=U?function(e,t,n,i){for(let r=0;r<Q;++r){const r=V(t,n,i);if(0===r)return t;t-=(z(t,n,i)-e)/r}return t}(t,o,e,n):0===l?o:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=z(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>L&&++o<P);return s}(t,i,i+F,e,n)}return function(e){return 0===e||1===e?e:z(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function j(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort(((e,t)=>e.time-t.time)).map((({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:q(n)})));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const Y="#",X="time",K="interpolation",J="yaw",Z="pitch",$="fov",ee=[X,J,Z,$,K],te="s",ne="ms",ie=1e3,re="deg",ae="rad",se=Math.PI/180,oe="ease-in-out",le="cubic-bezier(",ce=")";function he(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map((e=>function(e){const t=e.indexOf(Y);return(-1!==t?e.substring(0,t):e).trim()}(e))).filter((e=>""!==e))}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!ee.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(X))throw new Error(`Missing required token: '${X}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=Ae(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=de(null!==(t=i.interpolation)&&void 0!==t?t:oe);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*se,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*se,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*se,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every((t=>t.length!==e.length)))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function Ae(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter((e=>!(null==n?void 0:n.includes(e)))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter((t=>!e.includes(t))).join(", ")}'.`);const i=e.indexOf(X),r=function(e){return e.endsWith(ne)?fe(e.substring(0,e.length-ne.length)):e.endsWith(te)?fe(e.substring(0,e.length-te.length))*ie:fe(e)}(n[i]),a=e.indexOf(K),s=de(-1===a?oe:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case J:o.theta={time:r,value:ue(c),interpolation:s};break;case Z:o.phi={time:r,value:ue(c),interpolation:s};break;case $:o.fov={time:r,value:ue(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function ue(e){return e.endsWith(re)?fe(e.substring(0,e.length-re.length))*se:e.endsWith(ae)?fe(e.substring(0,e.length-ae.length)):fe(e)*se}function de(e){if("hold"===e)return{type:"hold"};if("linear"===e)return pe(0,0,1,1);if("sine"===e)return pe(.37,0,.63,1);if("sine-in"===e)return pe(.12,0,.39,0);if("sine-out"===e)return pe(.61,1,.88,1);if("ease"===e)return pe(.25,.1,.25,1);if("ease-in"===e)return pe(.42,0,1,1);if("ease-out"===e)return pe(0,0,.58,1);if("ease-in-out"===e)return pe(.42,0,.58,1);if(e.startsWith(le)&&e.endsWith(ce)){const t=e.substring(le.length,e.length-ce.length).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:fe(t[0]),y1:fe(t[1]),x2:fe(t[2]),y2:fe(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function pe(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function fe(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2010-2024 Three.js Authors
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ShopAR={})}(this,(function(e){"use strict";function t(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}!function(){const e={css:".shopar-btn-container{position:absolute;width:100%;bottom:0;padding-bottom:2rem;display:flex;justify-content:center;gap:.5rem}.shopar-btn{padding:.5rem .75rem;display:flex;justify-content:center;align-items:center;gap:.25rem;background-color:#fff;border:1px solid #ddd;border-radius:9999px;cursor:pointer}.shopar-btn:hover{background-color:#f5f5f5}.shopar-loading-container{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#fff}.shopar-loading-text{text-align:center}.shopar-loading-bar-bg{width:80%;height:.5rem;background-color:#e5e7eb;border-radius:9999px}.shopar-loading-bar-fg{background-color:#1434f7;border-radius:9999px;transition:none;transform:translateX(-100%);will-change:transform}.shopar-loading-bar-fg.active{transition:transform 5s cubic-bezier(0,0,.2,1);transform:none}.shopar-qr{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:#fff}.shopar-ar-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#1e293bb2;transition:.3s ease-in-out opacity}.shopar-ar-prompt-text{text-align:center;color:#fff}.shopar-ar-prompt-img{max-width:80%;max-height:50%;object-fit:contain}.shopar-3d{background-color:#fff}.shopar-3d-poster{background-color:#fff}"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}(),"function"==typeof SuppressedError&&SuppressedError;class n extends Error{constructor(e){super(`ShopAR Plugin: ${e}`)}}const i=[Uint8Array,Uint32Array].length-2,r=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],a=[2,12,7,1],s=window[r[a[a[i]]]][r[a[a[a.length-1]]]];function o(){const e=(new TextEncoder).encode(s),t=r.map((e=>e.length));for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[r[t[2]]](String.fromCodePoint(...e))}s.charCodeAt(i);const l=[1e3,2e3,4e3],c=l.length;function h(e,n=0){return t(this,void 0,void 0,(function*(){try{return yield e()}catch(t){if(n>=c)throw t;return yield new Promise((e=>setTimeout(e,l[n]))),h(e,n+1)}}))}function A(e){return e*(180/Math.PI)}function u(e){return Math.round(100*e)/100}const d=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],p=["Shoes"];const f={};function g(e){return null==f[e]&&(f[e]=function(e){return t(this,void 0,void 0,(function*(){const i=yield h((()=>t(this,void 0,void 0,(function*(){const t=yield fetch(e).catch((e=>{throw console.error(e),new n("Resource unavailable.")}));if(!t.ok)throw new n(`Resource download failed with status ${t.status}.`);return t}))));try{return yield(yield i.blob()).arrayBuffer()}catch(e){throw console.error(e),new n("Resource has invalid body.")}}))}(e)),f[e]}const m="0.8.2-alpha.2";let v=`https://cdn.jsdelivr.net/npm/shopar-plugin@${m}/dist`;const E={update:e=>{null!=e&&(v=e.endsWith("/")?e.substring(0,e.length-1):e)},toString:()=>v};function b(e){return t(this,void 0,void 0,(function*(){if("function"!=typeof importScripts){const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise((e=>{t.addEventListener("load",(()=>e()),!1),t.addEventListener("error",(()=>e()),!1),document.body.appendChild(t)}))}importScripts(e.toString())}))}let C;function _(e,n){let i=!0;return{qrPaused:()=>i,qrDraw:(r,a)=>t(this,void 0,void 0,(function*(){!function(){t(this,void 0,void 0,(function*(){null==C&&(C=b(`${E}/shopar-qr.js`))}))}(),yield C;const s=`https://ar.shopar.ai/${m.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:r,s:a,h:location.href})}`,o=yield window.ShopAR__QR.toDataURL(s),l=new Promise(((e,t)=>{n.onload=e,n.onerror=t}));n.src=o,yield l,i=!1,e.style.display=""})),qrPause:()=>t(this,void 0,void 0,(function*(){i=!0,e.style.display="none"}))}}const I={"loading.ar":"Loading Try On...","loading.3d":"Loading 3D..."},x=Object.keys(I);const y="shopar-error";function M(e,t,n,i){const r=document.createElement("button");r.id=e,r.type="button",r.className="shopar-btn",r.appendChild(i);{const e=document.createElement("span");e.textContent=t,r.appendChild(e)}r.ariaLabel=n;const a=r.style;return a.display="none",a.pointerEvents="auto",r}const w="shopar-control";const S="shopar-deepar-output";const B="shopar-main";const T="shopar-qr-output";function R(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}function D(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function Q(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const U=4,L=.001,P=1e-7,N=10,F=11,O=1/(F-1),k="function"==typeof Float32Array;function G(e,t){return 1-3*t+3*e}function H(e,t){return 3*t-6*e}function z(e){return 3*e}function V(e,t,n){return((G(t,n)*e+H(t,n))*e+z(t))*e}function W(e,t,n){return 3*G(t,n)*e*e+2*H(t,n)*e+z(t)}function q(e){return e}function j(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return q;const r=k?new Float32Array(F):new Array(F);for(let t=0;t<F;++t)r[t]=V(t*O,e,n);function a(t){let i=0,a=1;const s=F-1;for(;a!==s&&r[a]<=t;++a)i+=O;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*O,l=W(o,e,n);return l>=L?function(e,t,n,i){for(let r=0;r<U;++r){const r=W(t,n,i);if(0===r)return t;t-=(V(t,n,i)-e)/r}return t}(t,o,e,n):0===l?o:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=V(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>P&&++o<N);return s}(t,i,i+O,e,n)}return function(e){return 0===e||1===e?e:V(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function Y(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort(((e,t)=>e.time-t.time)).map((({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:j(n)})));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const X="#",K="time",J="interpolation",Z="yaw",$="pitch",ee="fov",te=[K,Z,$,ee,J],ne="s",ie="ms",re=1e3,ae="deg",se="rad",oe=Math.PI/180,le="ease-in-out",ce="cubic-bezier(",he=")";function Ae(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map((e=>function(e){const t=e.indexOf(X);return(-1!==t?e.substring(0,t):e).trim()}(e))).filter((e=>""!==e))}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!te.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(K))throw new Error(`Missing required token: '${K}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=ue(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=pe(null!==(t=i.interpolation)&&void 0!==t?t:le);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*oe,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*oe,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*oe,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every((t=>t.length!==e.length)))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function ue(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter((e=>!(null==n?void 0:n.includes(e)))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter((t=>!e.includes(t))).join(", ")}'.`);const i=e.indexOf(K),r=function(e){return e.endsWith(ie)?ge(e.substring(0,e.length-ie.length)):e.endsWith(ne)?ge(e.substring(0,e.length-ne.length))*re:ge(e)}(n[i]),a=e.indexOf(J),s=pe(-1===a?le:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case Z:o.theta={time:r,value:de(c),interpolation:s};break;case $:o.phi={time:r,value:de(c),interpolation:s};break;case ee:o.fov={time:r,value:de(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function de(e){return e.endsWith(ae)?ge(e.substring(0,e.length-ae.length))*oe:e.endsWith(se)?ge(e.substring(0,e.length-se.length)):ge(e)*oe}function pe(e){if("hold"===e)return{type:"hold"};if("linear"===e)return fe(0,0,1,1);if("sine"===e)return fe(.37,0,.63,1);if("sine-in"===e)return fe(.12,0,.39,0);if("sine-out"===e)return fe(.61,1,.88,1);if("ease"===e)return fe(.25,.1,.25,1);if("ease-in"===e)return fe(.42,0,1,1);if("ease-out"===e)return fe(0,0,.58,1);if("ease-in-out"===e)return fe(.42,0,.58,1);if(e.startsWith(ce)&&e.endsWith(he)){const t=e.substring(ce.length,e.length-he.length).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:ge(t[0]),y1:ge(t[1]),x2:ge(t[2]),y2:ge(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function fe(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function ge(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ShopAR={})}(this,(function(e){"use strict";function t(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}!function(){const e={css:".shopar-btn-container{position:absolute;width:100%;bottom:0;padding-bottom:2rem;display:flex;justify-content:center;gap:.5rem}.shopar-btn{padding:.5rem .75rem;display:flex;justify-content:center;align-items:center;gap:.25rem;background-color:#fff;border:1px solid #ddd;border-radius:9999px;cursor:pointer}.shopar-btn:hover{background-color:#f5f5f5}.shopar-loading-container{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#fff}.shopar-loading-text{text-align:center}.shopar-loading-bar-bg{width:80%;height:.5rem;background-color:#e5e7eb;border-radius:9999px}.shopar-loading-bar-fg{background-color:#1434f7;border-radius:9999px;transition:none;transform:translateX(-100%);will-change:transform}.shopar-loading-bar-fg.active{transition:transform 5s cubic-bezier(0,0,.2,1);transform:none}.shopar-qr{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:#fff}.shopar-ar-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem;background-color:#1e293bb2;transition:.3s ease-in-out opacity}.shopar-ar-prompt-text{text-align:center;color:#fff}.shopar-ar-prompt-img{max-width:80%;max-height:50%;object-fit:contain}.shopar-3d{background-color:#fff}.shopar-3d-poster{background-color:#fff}"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}(),"function"==typeof SuppressedError&&SuppressedError;class n extends Error{constructor(e){super(`ShopAR Plugin: ${e}`)}}const i=[Uint8Array,Uint32Array].length-2,r=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],a=[2,12,7,1],s=window[r[a[a[i]]]][r[a[a[a.length-1]]]];function o(){const e=(new TextEncoder).encode(s),t=r.map((e=>e.length));for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[r[t[2]]](String.fromCodePoint(...e))}s.charCodeAt(i);const l=[1e3,2e3,4e3],c=l.length;function h(e,n=0){return t(this,void 0,void 0,(function*(){try{return yield e()}catch(t){if(n>=c)throw t;return yield new Promise((e=>setTimeout(e,l[n]))),h(e,n+1)}}))}function A(e){return e*(180/Math.PI)}function u(e){return Math.round(100*e)/100}const d=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],p=["Shoes"];const f={};function g(e){return null==f[e]&&(f[e]=function(e){return t(this,void 0,void 0,(function*(){const i=yield h((()=>t(this,void 0,void 0,(function*(){const t=yield fetch(e).catch((e=>{throw console.error(e),new n("Resource unavailable.")}));if(!t.ok)throw new n(`Resource download failed with status ${t.status}.`);return t}))));try{return yield(yield i.blob()).arrayBuffer()}catch(e){throw console.error(e),new n("Resource has invalid body.")}}))}(e)),f[e]}const m="0.8.2";let v=`https://cdn.jsdelivr.net/npm/shopar-plugin@${m}/dist`;const E={update:e=>{null!=e&&(v=e.endsWith("/")?e.substring(0,e.length-1):e)},toString:()=>v};function b(e){return t(this,void 0,void 0,(function*(){if("function"!=typeof importScripts){const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise((e=>{t.addEventListener("load",(()=>e()),!1),t.addEventListener("error",(()=>e()),!1),document.body.appendChild(t)}))}importScripts(e.toString())}))}let C;function _(e,n){let i=!0;return{qrPaused:()=>i,qrDraw:(r,a)=>t(this,void 0,void 0,(function*(){!function(){t(this,void 0,void 0,(function*(){null==C&&(C=b(`${E}/shopar-qr.js`))}))}(),yield C;const s=`https://ar.shopar.ai/${m.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:r,s:a,h:location.href})}`,o=yield window.ShopAR__QR.toDataURL(s),l=new Promise(((e,t)=>{n.onload=e,n.onerror=t}));n.src=o,yield l,i=!1,e.style.display=""})),qrPause:()=>t(this,void 0,void 0,(function*(){i=!0,e.style.display="none"}))}}const I={"loading.ar":"Loading Try On...","loading.3d":"Loading 3D..."},x=Object.keys(I);const y="shopar-error";function M(e,t,n,i){const r=document.createElement("button");r.id=e,r.type="button",r.className="shopar-btn",r.appendChild(i);{const e=document.createElement("span");e.textContent=t,r.appendChild(e)}r.ariaLabel=n;const a=r.style;return a.display="none",a.pointerEvents="auto",r}const w="shopar-control";const S="shopar-deepar-output";const B="shopar-main";const T="shopar-qr-output";function R(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}function D(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function Q(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const U=4,L=.001,P=1e-7,N=10,F=11,O=1/(F-1),k="function"==typeof Float32Array;function G(e,t){return 1-3*t+3*e}function H(e,t){return 3*t-6*e}function z(e){return 3*e}function V(e,t,n){return((G(t,n)*e+H(t,n))*e+z(t))*e}function W(e,t,n){return 3*G(t,n)*e*e+2*H(t,n)*e+z(t)}function q(e){return e}function j(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return q;const r=k?new Float32Array(F):new Array(F);for(let t=0;t<F;++t)r[t]=V(t*O,e,n);function a(t){let i=0,a=1;const s=F-1;for(;a!==s&&r[a]<=t;++a)i+=O;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*O,l=W(o,e,n);return l>=L?function(e,t,n,i){for(let r=0;r<U;++r){const r=W(t,n,i);if(0===r)return t;t-=(V(t,n,i)-e)/r}return t}(t,o,e,n):0===l?o:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=V(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>P&&++o<N);return s}(t,i,i+O,e,n)}return function(e){return 0===e||1===e?e:V(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function Y(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort(((e,t)=>e.time-t.time)).map((({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:j(n)})));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const X="#",K="time",J="interpolation",Z="yaw",$="pitch",ee="fov",te=[K,Z,$,ee,J],ne="s",ie="ms",re=1e3,ae="deg",se="rad",oe=Math.PI/180,le="ease-in-out",ce="cubic-bezier(",he=")";function Ae(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map((e=>function(e){const t=e.indexOf(X);return(-1!==t?e.substring(0,t):e).trim()}(e))).filter((e=>""!==e))}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!te.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(K))throw new Error(`Missing required token: '${K}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=ue(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=pe(null!==(t=i.interpolation)&&void 0!==t?t:le);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*oe,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*oe,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*oe,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every((t=>t.length!==e.length)))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function ue(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter((e=>!(null==n?void 0:n.includes(e)))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter((t=>!e.includes(t))).join(", ")}'.`);const i=e.indexOf(K),r=function(e){return e.endsWith(ie)?ge(e.substring(0,e.length-ie.length)):e.endsWith(ne)?ge(e.substring(0,e.length-ne.length))*re:ge(e)}(n[i]),a=e.indexOf(J),s=pe(-1===a?le:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case Z:o.theta={time:r,value:de(c),interpolation:s};break;case $:o.phi={time:r,value:de(c),interpolation:s};break;case ee:o.fov={time:r,value:de(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function de(e){return e.endsWith(ae)?ge(e.substring(0,e.length-ae.length))*oe:e.endsWith(se)?ge(e.substring(0,e.length-se.length)):ge(e)*oe}function pe(e){if("hold"===e)return{type:"hold"};if("linear"===e)return fe(0,0,1,1);if("sine"===e)return fe(.37,0,.63,1);if("sine-in"===e)return fe(.12,0,.39,0);if("sine-out"===e)return fe(.61,1,.88,1);if("ease"===e)return fe(.25,.1,.25,1);if("ease-in"===e)return fe(.42,0,1,1);if("ease-out"===e)return fe(0,0,.58,1);if("ease-in-out"===e)return fe(.42,0,.58,1);if(e.startsWith(ce)&&e.endsWith(he)){const t=e.substring(ce.length,e.length-he.length).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:ge(t[0]),y1:ge(t[1]),x2:ge(t[2]),y2:ge(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function fe(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function ge(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2010-2024 Three.js Authors
package/dist/shopar-qr.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__QR={})}(this,(function(t){"use strict";function e(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var n={},r=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},i={},o={};let a;const s=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];o.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},o.getSymbolTotalCodewords=function(t){return s[t]},o.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},o.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');a=t},o.isKanjiModeEnabled=function(){return void 0!==a},o.toSJIS=function(t){return a(t)};var h={};function l(){this.buffer=[],this.length=0}!function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(t){return n}}}(h),l.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var u=l;function f(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}f.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n,r&&(this.reservedBit[i]=!0)},f.prototype.get=function(t,e){return this.data[t*this.size+e]},f.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},f.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var c=f,d={};!function(t){const e=o.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),o=[r-7];for(let t=1;t<n-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),i=r.length;for(let t=0;t<i;t++)for(let e=0;e<i;e++)0===t&&0===e||0===t&&e===i-1||t===i-1&&0===e||n.push([r[t],r[e]]);return n}}(d);var p={};const g=o.getSymbolSize;p.getPositions=function(t){const e=g(t);return[[0,0],[e-7,0],[0,e-7]]};var _={};!function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,n=3,r=40,i=10;function o(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,i=0,o=0,a=null,s=null;for(let h=0;h<n;h++){i=o=0,a=s=null;for(let l=0;l<n;l++){let n=t.get(h,l);n===a?i++:(i>=5&&(r+=e+(i-5)),a=n,i=1),n=t.get(l,h),n===s?o++:(o>=5&&(r+=e+(o-5)),s=n,o=1)}i>=5&&(r+=e+(i-5)),o>=5&&(r+=e+(o-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n<e-1;n++)for(let i=0;i<e-1;i++){const e=t.get(n,i)+t.get(n,i+1)+t.get(n+1,i)+t.get(n+1,i+1);4!==e&&0!==e||r++}return r*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,i=0,o=0;for(let r=0;r<e;r++){i=o=0;for(let a=0;a<e;a++)i=i<<1&2047|t.get(r,a),a>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|t.get(a,r),a>=10&&(1488===o||93===o)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*i},t.applyMask=function(t,e){const n=e.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.isReserved(i,r)||e.xor(i,r,o(t,i,r))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let i=0,o=1/0;for(let a=0;a<r;a++){n(a),t.applyMask(a,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(a,e),r<o&&(o=r,i=a)}return i}}(_);var w={};const m=h,b=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],y=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];w.getBlocksCount=function(t,e){switch(e){case m.L:return b[4*(t-1)+0];case m.M:return b[4*(t-1)+1];case m.Q:return b[4*(t-1)+2];case m.H:return b[4*(t-1)+3];default:return}},w.getTotalCodewordsCount=function(t,e){switch(e){case m.L:return y[4*(t-1)+0];case m.M:return y[4*(t-1)+1];case m.Q:return y[4*(t-1)+2];case m.H:return y[4*(t-1)+3];default:return}};var v={},E={};const k=new Uint8Array(512),T=new Uint8Array(256);!function(){let t=1;for(let e=0;e<255;e++)k[e]=t,T[t]=e,t<<=1,256&t&&(t^=285);for(let t=255;t<512;t++)k[t]=k[t-255]}(),E.log=function(t){if(t<1)throw new Error("log("+t+")");return T[t]},E.exp=function(t){return k[t]},E.mul=function(t,e){return 0===t||0===e?0:k[T[t]+T[e]]},function(t){const e=E;t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<n.length;o++)r[i+o]^=e.mul(t[i],n[o]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let i=0;i<n.length;i++)r[i]^=e.mul(n[i],t);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=t.mul(r,new Uint8Array([1,e.exp(i)]));return r}}(v);const R=v;function A(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}A.prototype.initialize=function(t){this.degree=t,this.genPoly=R.generateECPolynomial(this.degree)},A.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const n=R.mod(e,this.genPoly),r=this.degree-n.length;if(r>0){const t=new Uint8Array(this.degree);return t.set(n,r),t}return n};var L=A,x={},S={},C={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},I={};const O="[0-9]+";let P="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";P=P.replace(/u/g,"\\u");const M="(?:(?![A-Z0-9 $%*+\\-./:]|"+P+")(?:.|[\r\n]))+";I.KANJI=new RegExp(P,"g"),I.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),I.BYTE=new RegExp(M,"g"),I.NUMERIC=new RegExp(O,"g"),I.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const B=new RegExp("^"+P+"$"),D=new RegExp("^"+O+"$"),z=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");I.testKanji=function(t){return B.test(t)},I.testNumeric=function(t){return D.test(t)},I.testAlphanumeric=function(t){return z.test(t)},function(t){const e=C,n=I;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(t){return n}}}(S),function(t){const e=o,n=w,r=h,i=S,a=C,s=e.getBCHDigit(7973);function l(t,e){return i.getCharCountIndicator(t,e)+4}function u(t,e){let n=0;return t.forEach((function(t){const r=l(t.mode,e);n+=r+t.getBitsLength()})),n}t.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,o){if(!a.isValid(t))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const s=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(o===i.MIXED)return s;const h=s-l(o,t);switch(o){case i.NUMERIC:return Math.floor(h/10*3);case i.ALPHANUMERIC:return Math.floor(h/11*2);case i.KANJI:return Math.floor(h/13);case i.BYTE:default:return Math.floor(h/8)}},t.getBestVersionForData=function(e,n){let o;const a=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(u(e,r)<=t.getCapacity(r,n,i.MIXED))return r}(e,a);if(0===e.length)return 1;o=e[0]}else o=e;return function(e,n,r){for(let i=1;i<=40;i++)if(n<=t.getCapacity(i,r,e))return i}(o.mode,o.getLength(),a)},t.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-s>=0;)n^=7973<<e.getBCHDigit(n)-s;return t<<12|n}}(x);var N={};const U=o,F=U.getBCHDigit(1335);N.getEncodedBits=function(t,e){const n=t.bit<<3|e;let r=n<<10;for(;U.getBCHDigit(r)-F>=0;)r^=1335<<U.getBCHDigit(r)-F;return 21522^(n<<10|r)};var Y={};const j=S;function Z(t){this.mode=j.NUMERIC,this.data=t.toString()}Z.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},Z.prototype.getLength=function(){return this.data.length},Z.prototype.getBitsLength=function(){return Z.getBitsLength(this.data.length)},Z.prototype.write=function(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const i=this.data.length-e;i>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*i+1))};var H=Z;const W=S,q=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function G(t){this.mode=W.ALPHANUMERIC,this.data=t}G.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},G.prototype.getLength=function(){return this.data.length},G.prototype.getBitsLength=function(){return G.getBitsLength(this.data.length)},G.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*q.indexOf(this.data[e]);n+=q.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(q.indexOf(this.data[e]),6)};var V=G;const K=function(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var o=t.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?e.push(i):i<2048?(e.push(i>>6|192),e.push(63&i|128)):i<55296||i>=57344&&i<65536?(e.push(i>>12|224),e.push(i>>6&63|128),e.push(63&i|128)):i>=65536&&i<=1114111?(e.push(i>>18|240),e.push(i>>12&63|128),e.push(i>>6&63|128),e.push(63&i|128)):e.push(239,191,189)}return new Uint8Array(e).buffer},J=S;function X(t){this.mode=J.BYTE,"string"==typeof t&&(t=K(t)),this.data=new Uint8Array(t)}X.getBitsLength=function(t){return 8*t},X.prototype.getLength=function(){return this.data.length},X.prototype.getBitsLength=function(){return X.getBitsLength(this.data.length)},X.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};var Q=X;const $=S,tt=o;function et(t){this.mode=$.KANJI,this.data=t}et.getBitsLength=function(t){return 13*t},et.prototype.getLength=function(){return this.data.length},et.prototype.getBitsLength=function(){return et.getBitsLength(this.data.length)},et.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=tt.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}};var nt=et,rt={exports:{}};!function(t){var e={single_source_shortest_paths:function(t,n,r){var i={},o={};o[n]=0;var a,s,h,l,u,f,c,d=e.PriorityQueue.make();for(d.push(n,0);!d.empty();)for(h in s=(a=d.pop()).value,l=a.cost,u=t[s]||{})u.hasOwnProperty(h)&&(f=l+u[h],c=o[h],(void 0===o[h]||c>f)&&(o[h]=f,d.push(h,f),i[h]=s));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,n,r){var i=e.single_source_shortest_paths(t,n,r);return e.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var n,r=e.PriorityQueue,i={};for(n in t=t||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=e}(rt);var it=rt.exports;!function(t){const e=S,n=H,r=V,i=Q,a=nt,s=I,h=o,l=it;function u(t){return unescape(encodeURIComponent(t)).length}function f(t,e,n){const r=[];let i;for(;null!==(i=t.exec(n));)r.push({data:i[0],index:i.index,mode:e,length:i[0].length});return r}function c(t){const n=f(s.NUMERIC,e.NUMERIC,t),r=f(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let i,o;h.isKanjiModeEnabled()?(i=f(s.BYTE,e.BYTE,t),o=f(s.KANJI,e.KANJI,t)):(i=f(s.BYTE_KANJI,e.BYTE,t),o=[]);return n.concat(r,i,o).sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function d(t,o){switch(o){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return a.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function p(t,o){let s;const l=e.getBestModeForData(t);if(s=e.from(o,l),s!==e.BYTE&&s.bit<l.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(s)+".\n Suggested mode is: "+e.toString(l));switch(s!==e.KANJI||h.isKanjiModeEnabled()||(s=e.BYTE),s){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new a(t);case e.BYTE:return new i(t)}}t.fromArray=function(t){return t.reduce((function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t}),[])},t.fromString=function(n,r){const i=function(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:u(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:u(i.data)}])}}return n}(c(n,h.isKanjiModeEnabled())),o=function(t,n){const r={},i={start:{}};let o=["start"];for(let a=0;a<t.length;a++){const s=t[a],h=[];for(let t=0;t<s.length;t++){const l=s[t],u=""+a+t;h.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let t=0;t<o.length;t++){const a=o[t];r[a]&&r[a].node.mode===l.mode?(i[a][u]=d(r[a].lastCount+l.length,l.mode)-d(r[a].lastCount,l.mode),r[a].lastCount+=l.length):(r[a]&&(r[a].lastCount=l.length),i[a][u]=d(l.length,l.mode)+4+e.getCharCountIndicator(l.mode,n))}}o=h}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:r}}(i,r),a=l.find_path(o.map,"start","end"),s=[];for(let t=1;t<a.length-1;t++)s.push(o.table[a[t]].node);return t.fromArray(function(t){return t.reduce((function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(s))},t.rawSplit=function(e){return t.fromArray(c(e,h.isKanjiModeEnabled()))}}(Y);const ot=o,at=h,st=u,ht=c,lt=d,ut=p,ft=_,ct=w,dt=L,pt=x,gt=N,_t=S,wt=Y;function mt(t,e,n){const r=t.size,i=gt.getEncodedBits(e,n);let o,a;for(o=0;o<15;o++)a=1==(i>>o&1),o<6?t.set(o,8,a,!0):o<8?t.set(o+1,8,a,!0):t.set(r-15+o,8,a,!0),o<8?t.set(8,r-o-1,a,!0):o<9?t.set(8,15-o-1+1,a,!0):t.set(8,15-o-1,a,!0);t.set(r-8,8,1,!0)}function bt(t,e,n){const r=new st;n.forEach((function(e){r.put(e.mode.bit,4),r.put(e.getLength(),_t.getCharCountIndicator(e.mode,t)),e.write(r)}));const i=8*(ot.getSymbolTotalCodewords(t)-ct.getTotalCodewordsCount(t,e));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const o=(i-r.getLengthInBits())/8;for(let t=0;t<o;t++)r.put(t%2?17:236,8);return function(t,e,n){const r=ot.getSymbolTotalCodewords(e),i=ct.getTotalCodewordsCount(e,n),o=r-i,a=ct.getBlocksCount(e,n),s=r%a,h=a-s,l=Math.floor(r/a),u=Math.floor(o/a),f=u+1,c=l-u,d=new dt(c);let p=0;const g=new Array(a),_=new Array(a);let w=0;const m=new Uint8Array(t.buffer);for(let t=0;t<a;t++){const e=t<h?u:f;g[t]=m.slice(p,p+e),_[t]=d.encode(g[t]),p+=e,w=Math.max(w,e)}const b=new Uint8Array(r);let y,v,E=0;for(y=0;y<w;y++)for(v=0;v<a;v++)y<g[v].length&&(b[E++]=g[v][y]);for(y=0;y<c;y++)for(v=0;v<a;v++)b[E++]=_[v][y];return b}(r,t,e)}function yt(t,e,n,r){let i;if(Array.isArray(t))i=wt.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let r=e;if(!r){const e=wt.rawSplit(t);r=pt.getBestVersionForData(e,n)}i=wt.fromString(t,r||40)}}const o=pt.getBestVersionForData(i,n);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<o)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+o+".\n")}else e=o;const a=bt(e,n,i),s=ot.getSymbolSize(e),h=new ht(s);return function(t,e){const n=t.size,r=ut.getPositions(e);for(let e=0;e<r.length;e++){const i=r[e][0],o=r[e][1];for(let e=-1;e<=7;e++)if(!(i+e<=-1||n<=i+e))for(let r=-1;r<=7;r++)o+r<=-1||n<=o+r||(e>=0&&e<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===e||6===e)||e>=2&&e<=4&&r>=2&&r<=4?t.set(i+e,o+r,!0,!0):t.set(i+e,o+r,!1,!0))}}(h,e),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(h),function(t,e){const n=lt.getPositions(e);for(let e=0;e<n.length;e++){const r=n[e][0],i=n[e][1];for(let e=-2;e<=2;e++)for(let n=-2;n<=2;n++)-2===e||2===e||-2===n||2===n||0===e&&0===n?t.set(r+e,i+n,!0,!0):t.set(r+e,i+n,!1,!0)}}(h,e),mt(h,n,0),e>=7&&function(t,e){const n=t.size,r=pt.getEncodedBits(e);let i,o,a;for(let e=0;e<18;e++)i=Math.floor(e/3),o=e%3+n-8-3,a=1==(r>>e&1),t.set(i,o,a,!0),t.set(o,i,a,!0)}(h,e),function(t,e){const n=t.size;let r=-1,i=n-1,o=7,a=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!t.isReserved(i,s-n)){let r=!1;a<e.length&&(r=1==(e[a]>>>o&1)),t.set(i,s-n,r),o--,-1===o&&(a++,o=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(h,a),isNaN(r)&&(r=ft.getBestMask(h,mt.bind(null,h,n))),ft.applyMask(r,h),mt(h,n,r),{modules:h,version:e,errorCorrectionLevel:n,maskPattern:r,segments:i}}i.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let n,r,i=at.M;return void 0!==e&&(i=at.from(e.errorCorrectionLevel,at.M),n=pt.from(e.version),r=ft.from(e.maskPattern),e.toSJISFunc&&ot.setToSJISFunction(e.toSJISFunc)),yt(t,n,i,r)};var vt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Et=[],kt=[],Tt="undefined"!=typeof Uint8Array?Uint8Array:Array,Rt=!1;function At(){Rt=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Et[e]=t[e],kt[t.charCodeAt(e)]=e;kt["-".charCodeAt(0)]=62,kt["_".charCodeAt(0)]=63}function Lt(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Et[(i=r)>>18&63]+Et[i>>12&63]+Et[i>>6&63]+Et[63&i]);return o.join("")}function xt(t){var e;Rt||At();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,h=n-r;s<h;s+=a)o.push(Lt(t,s,s+a>h?h:s+a));return 1===r?(e=t[n-1],i+=Et[e>>2],i+=Et[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=Et[e>>10],i+=Et[e>>4&63],i+=Et[e<<2&63],i+="="),o.push(i),o.join("")}function St(t,e,n,r,i){var o,a,s=8*i-r-1,h=(1<<s)-1,l=h>>1,u=-7,f=n?i-1:0,c=n?-1:1,d=t[e+f];for(f+=c,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+t[e+f],f+=c,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+f],f+=c,u-=8);if(0===o)o=1-l;else{if(o===h)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)}function Ct(t,e,n,r,i,o){var a,s,h,l=8*o-i-1,u=(1<<l)-1,f=u>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+f>=1?c/h:c*Math.pow(2,1-f))*h>=2&&(a++,h/=2),a+f>=u?(s=0,a=u):a+f>=1?(s=(e*h-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[n+d]=255&a,d+=p,a/=256,l-=8);t[n+d-p]|=128*g}var It={}.toString,Ot=Array.isArray||function(t){return"[object Array]"==It.call(t)};Dt.TYPED_ARRAY_SUPPORT=void 0===vt.TYPED_ARRAY_SUPPORT||vt.TYPED_ARRAY_SUPPORT;var Pt=Mt();function Mt(){return Dt.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Bt(t,e){if(Mt()<e)throw new RangeError("Invalid typed array length");return Dt.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Dt.prototype:(null===t&&(t=new Dt(e)),t.length=e),t}function Dt(t,e,n){if(!(Dt.TYPED_ARRAY_SUPPORT||this instanceof Dt))return new Dt(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Ut(this,t)}return zt(this,t,e,n)}function zt(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);Dt.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Dt.prototype:t=Ft(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!Dt.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Zt(e,n);t=Bt(t,r);var i=t.write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(jt(e)){var n=0|Yt(e.length);return 0===(t=Bt(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?Bt(t,0):Ft(t,e);if("Buffer"===e.type&&Ot(e.data))return Ft(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function Nt(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ut(t,e){if(Nt(e),t=Bt(t,e<0?0:0|Yt(e)),!Dt.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Ft(t,e){var n=e.length<0?0:0|Yt(e.length);t=Bt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function Yt(t){if(t>=Mt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mt().toString(16)+" bytes");return 0|t}function jt(t){return!(null==t||!t._isBuffer)}function Zt(t,e){if(jt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return _e(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return we(t).length;default:if(r)return _e(t).length;e=(""+e).toLowerCase(),r=!0}}function Ht(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return oe(this,e,n);case"utf8":case"utf-8":return ee(this,e,n);case"ascii":return re(this,e,n);case"latin1":case"binary":return ie(this,e,n);case"base64":return te(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Wt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function qt(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=Dt.from(e,r)),jt(e))return 0===e.length?-1:Gt(t,e,n,r,i);if("number"==typeof e)return e&=255,Dt.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):Gt(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Gt(t,e,n,r,i){var o,a=1,s=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,h/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var u=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===h)return u*a}else-1!==u&&(o-=o-u),u=-1}else for(n+h>s&&(n=s-h),o=n;o>=0;o--){for(var f=!0,c=0;c<h;c++)if(l(t,o+c)!==l(e,c)){f=!1;break}if(f)return o}return-1}function Vt(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function Kt(t,e,n,r){return me(_e(e,t.length-n),t,n,r)}function Jt(t,e,n,r){return me(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function Xt(t,e,n,r){return Jt(t,e,n,r)}function Qt(t,e,n,r){return me(we(e),t,n,r)}function $t(t,e,n,r){return me(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(n=t.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function te(t,e,n){return 0===e&&n===t.length?xt(t):xt(t.slice(e,n))}function ee(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,h,l=t[i],u=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(u=l);break;case 2:128==(192&(o=t[i+1]))&&(h=(31&l)<<6|63&o)>127&&(u=h);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(h=(15&l)<<12|(63&o)<<6|63&a)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(h=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&h<1114112&&(u=h)}null===u?(u=65533,f=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=f}return function(t){var e=t.length;if(e<=ne)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=ne));return n}(r)}Dt.poolSize=8192,Dt._augment=function(t){return t.__proto__=Dt.prototype,t},Dt.from=function(t,e,n){return zt(null,t,e,n)},Dt.TYPED_ARRAY_SUPPORT&&(Dt.prototype.__proto__=Uint8Array.prototype,Dt.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Dt[Symbol.species]),Dt.alloc=function(t,e,n){return function(t,e,n,r){return Nt(e),e<=0?Bt(t,e):void 0!==n?"string"==typeof r?Bt(t,e).fill(n,r):Bt(t,e).fill(n):Bt(t,e)}(null,t,e,n)},Dt.allocUnsafe=function(t){return Ut(null,t)},Dt.allocUnsafeSlow=function(t){return Ut(null,t)},Dt.isBuffer=be,Dt.compare=function(t,e){if(!jt(t)||!jt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},Dt.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Dt.concat=function(t,e){if(!Ot(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Dt.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=Dt.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!jt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Dt.byteLength=Zt,Dt.prototype._isBuffer=!0,Dt.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Wt(this,e,e+1);return this},Dt.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Wt(this,e,e+3),Wt(this,e+1,e+2);return this},Dt.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Wt(this,e,e+7),Wt(this,e+1,e+6),Wt(this,e+2,e+5),Wt(this,e+3,e+4);return this},Dt.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?ee(this,0,t):Ht.apply(this,arguments)},Dt.prototype.equals=function(t){if(!jt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Dt.compare(this,t)},Dt.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Dt.prototype.compare=function(t,e,n,r,i){if(!jt(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),h=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(h[u]!==l[u]){o=h[u],a=l[u];break}return o<a?-1:a<o?1:0},Dt.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},Dt.prototype.indexOf=function(t,e,n){return qt(this,t,e,n,!0)},Dt.prototype.lastIndexOf=function(t,e,n){return qt(this,t,e,n,!1)},Dt.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Vt(this,t,e,n);case"utf8":case"utf-8":return Kt(this,t,e,n);case"ascii":return Jt(this,t,e,n);case"latin1":case"binary":return Xt(this,t,e,n);case"base64":return Qt(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Dt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;function re(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function ie(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function oe(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=ge(t[o]);return i}function ae(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function se(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function he(t,e,n,r,i,o){if(!jt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function le(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ue(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function fe(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ce(t,e,n,r,i){return i||fe(t,0,n,4),Ct(t,e,n,r,23,4),n+4}function de(t,e,n,r,i){return i||fe(t,0,n,8),Ct(t,e,n,r,52,8),n+8}Dt.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),Dt.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=Dt.prototype;else{var i=e-t;n=new Dt(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},Dt.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},Dt.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},Dt.prototype.readUInt8=function(t,e){return e||se(t,1,this.length),this[t]},Dt.prototype.readUInt16LE=function(t,e){return e||se(t,2,this.length),this[t]|this[t+1]<<8},Dt.prototype.readUInt16BE=function(t,e){return e||se(t,2,this.length),this[t]<<8|this[t+1]},Dt.prototype.readUInt32LE=function(t,e){return e||se(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Dt.prototype.readUInt32BE=function(t,e){return e||se(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Dt.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},Dt.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Dt.prototype.readInt8=function(t,e){return e||se(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Dt.prototype.readInt16LE=function(t,e){e||se(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Dt.prototype.readInt16BE=function(t,e){e||se(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Dt.prototype.readInt32LE=function(t,e){return e||se(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Dt.prototype.readInt32BE=function(t,e){return e||se(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Dt.prototype.readFloatLE=function(t,e){return e||se(t,4,this.length),St(this,t,!0,23,4)},Dt.prototype.readFloatBE=function(t,e){return e||se(t,4,this.length),St(this,t,!1,23,4)},Dt.prototype.readDoubleLE=function(t,e){return e||se(t,8,this.length),St(this,t,!0,52,8)},Dt.prototype.readDoubleBE=function(t,e){return e||se(t,8,this.length),St(this,t,!1,52,8)},Dt.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||he(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},Dt.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||he(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},Dt.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,1,255,0),Dt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Dt.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,65535,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):le(this,t,e,!0),e+2},Dt.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,65535,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):le(this,t,e,!1),e+2},Dt.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,4294967295,0),Dt.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ue(this,t,e,!0),e+4},Dt.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,4294967295,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ue(this,t,e,!1),e+4},Dt.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);he(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Dt.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);he(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Dt.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,1,127,-128),Dt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Dt.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,32767,-32768),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):le(this,t,e,!0),e+2},Dt.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,32767,-32768),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):le(this,t,e,!1),e+2},Dt.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,2147483647,-2147483648),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ue(this,t,e,!0),e+4},Dt.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ue(this,t,e,!1),e+4},Dt.prototype.writeFloatLE=function(t,e,n){return ce(this,t,e,!0,n)},Dt.prototype.writeFloatBE=function(t,e,n){return ce(this,t,e,!1,n)},Dt.prototype.writeDoubleLE=function(t,e,n){return de(this,t,e,!0,n)},Dt.prototype.writeDoubleBE=function(t,e,n){return de(this,t,e,!1,n)},Dt.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!Dt.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},Dt.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Dt.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=jt(t)?t:_e(new Dt(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var pe=/[^+\/0-9A-Za-z-_]/g;function ge(t){return t<16?"0"+t.toString(16):t.toString(16)}function _e(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function we(t){return function(t){var e,n,r,i,o,a;Rt||At();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new Tt(3*s/4-o),r=o>0?s-4:s;var h=0;for(e=0,n=0;e<r;e+=4,n+=3)i=kt[t.charCodeAt(e)]<<18|kt[t.charCodeAt(e+1)]<<12|kt[t.charCodeAt(e+2)]<<6|kt[t.charCodeAt(e+3)],a[h++]=i>>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=kt[t.charCodeAt(e)]<<2|kt[t.charCodeAt(e+1)]>>4,a[h++]=255&i):1===o&&(i=kt[t.charCodeAt(e)]<<10|kt[t.charCodeAt(e+1)]<<4|kt[t.charCodeAt(e+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(pe,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function me(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function be(t){return null!=t&&(!!t._isBuffer||ye(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ye(t.slice(0,0))}(t))}function ye(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var ve=Object.freeze({__proto__:null,Buffer:Dt,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Dt.alloc(+t)},isBuffer:be,kMaxLength:Pt}),Ee={},ke=e(Object.freeze({__proto__:null,default:{}}));function Te(){throw new Error("setTimeout has not been defined")}function Re(){throw new Error("clearTimeout has not been defined")}var Ae=Te,Le=Re;function xe(t){if(Ae===setTimeout)return setTimeout(t,0);if((Ae===Te||!Ae)&&setTimeout)return Ae=setTimeout,setTimeout(t,0);try{return Ae(t,0)}catch(e){try{return Ae.call(null,t,0)}catch(e){return Ae.call(this,t,0)}}}"function"==typeof vt.setTimeout&&(Ae=setTimeout),"function"==typeof vt.clearTimeout&&(Le=clearTimeout);var Se,Ce=[],Ie=!1,Oe=-1;function Pe(){Ie&&Se&&(Ie=!1,Se.length?Ce=Se.concat(Ce):Oe=-1,Ce.length&&Me())}function Me(){if(!Ie){var t=xe(Pe);Ie=!0;for(var e=Ce.length;e;){for(Se=Ce,Ce=[];++Oe<e;)Se&&Se[Oe].run();Oe=-1,e=Ce.length}Se=null,Ie=!1,function(t){if(Le===clearTimeout)return clearTimeout(t);if((Le===Re||!Le)&&clearTimeout)return Le=clearTimeout,clearTimeout(t);try{return Le(t)}catch(e){try{return Le.call(null,t)}catch(e){return Le.call(this,t)}}}(t)}}function Be(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Ce.push(new De(t,e)),1!==Ce.length||Ie||xe(Me)}function De(t,e){this.fun=t,this.array=e}De.prototype.run=function(){this.fun.apply(null,this.array)};function ze(){}var Ne=ze,Ue=ze,Fe=ze,Ye=ze,je=ze,Ze=ze,He=ze;var We=vt.performance||{},qe=We.now||We.mozNow||We.msNow||We.oNow||We.webkitNow||function(){return(new Date).getTime()};var Ge=new Date;var Ve={nextTick:Be,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ne,addListener:Ue,once:Fe,off:Ye,removeListener:je,removeAllListeners:Ze,emit:He,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*qe.call(We),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Ge)/1e3}},Ke={},Je="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Xe=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},Qe=/%[sdj%]/g;function $e(t){if(!_n(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(on(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(Qe,(function(t){if("%%"===t)return"%";if(n>=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),a=r[n];n<i;a=r[++n])dn(a)||!yn(a)?o+=" "+a:o+=" "+on(a);return o}function tn(t,e){if(mn(vt.process))return function(){return tn(t,e).apply(this,arguments)};if(!0===Ve.noDeprecation)return t;var n=!1;return function(){if(!n){if(Ve.throwDeprecation)throw new Error(e);Ve.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var en,nn={};function rn(t){if(mn(en)&&(en=Ve.env.NODE_DEBUG||""),t=t.toUpperCase(),!nn[t])if(new RegExp("\\b"+t+"\\b","i").test(en)){nn[t]=function(){var e=$e.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else nn[t]=function(){};return nn[t]}function on(t,e){var n={seen:[],stylize:sn};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),cn(e)?n.showHidden=e:e&&Cn(n,e),mn(n.showHidden)&&(n.showHidden=!1),mn(n.depth)&&(n.depth=2),mn(n.colors)&&(n.colors=!1),mn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=an),hn(n,t,n.depth)}function an(t,e){var n=on.styles[e];return n?"["+on.colors[n][0]+"m"+t+"["+on.colors[n][1]+"m":t}function sn(t,e){return t}function hn(t,e,n){if(t.customInspect&&e&&kn(e.inspect)&&e.inspect!==on&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return _n(r)||(r=hn(t,r,n)),r}var i=function(t,e){if(mn(e))return t.stylize("undefined","undefined");if(_n(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(gn(e))return t.stylize(""+e,"number");if(cn(e))return t.stylize(""+e,"boolean");if(dn(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),En(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ln(e);if(0===o.length){if(kn(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(bn(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(vn(e))return t.stylize(Date.prototype.toString.call(e),"date");if(En(e))return ln(e)}var h,l="",u=!1,f=["{","}"];(fn(e)&&(u=!0,f=["[","]"]),kn(e))&&(l=" [Function"+(e.name?": "+e.name:"")+"]");return bn(e)&&(l=" "+RegExp.prototype.toString.call(e)),vn(e)&&(l=" "+Date.prototype.toUTCString.call(e)),En(e)&&(l=" "+ln(e)),0!==o.length||u&&0!=e.length?n<0?bn(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),h=u?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a<s;++a)In(e,String(a))?o.push(un(t,e,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(un(t,e,n,r,i,!0))})),o}(t,e,n,a,o):o.map((function(r){return un(t,e,n,a,r,u)})),t.seen.pop(),function(t,e,n){var r=t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(h,l,f)):f[0]+l+f[1]}function ln(t){return"["+Error.prototype.toString.call(t)+"]"}function un(t,e,n,r,i,o){var a,s,h;if((h=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),In(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(h.value)<0?(s=dn(n)?hn(t,h.value,null):hn(t,h.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),mn(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function fn(t){return Array.isArray(t)}function cn(t){return"boolean"==typeof t}function dn(t){return null===t}function pn(t){return null==t}function gn(t){return"number"==typeof t}function _n(t){return"string"==typeof t}function wn(t){return"symbol"==typeof t}function mn(t){return void 0===t}function bn(t){return yn(t)&&"[object RegExp]"===An(t)}function yn(t){return"object"==typeof t&&null!==t}function vn(t){return yn(t)&&"[object Date]"===An(t)}function En(t){return yn(t)&&("[object Error]"===An(t)||t instanceof Error)}function kn(t){return"function"==typeof t}function Tn(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function Rn(t){return Dt.isBuffer(t)}function An(t){return Object.prototype.toString.call(t)}function Ln(t){return t<10?"0"+t.toString(10):t.toString(10)}on.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},on.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var xn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Sn(){var t,e;console.log("%s - %s",(t=new Date,e=[Ln(t.getHours()),Ln(t.getMinutes()),Ln(t.getSeconds())].join(":"),[t.getDate(),xn[t.getMonth()],e].join(" ")),$e.apply(null,arguments))}function Cn(t,e){if(!e||!yn(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function In(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var On="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Pn(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(On&&t[On]){var e;if("function"!=typeof(e=t[On]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,On,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,n,r=new Promise((function(t,r){e=t,n=r})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(t,r){t?n(t):e(r)}));try{t.apply(this,i)}catch(t){n(t)}return r}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),On&&Object.defineProperty(e,On,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Xe(t))}function Mn(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function Bn(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function e(){for(var e=[],n=0;n<arguments.length;n++)e.push(arguments[n]);var r=e.pop();if("function"!=typeof r)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return r.apply(i,arguments)};t.apply(this,e).then((function(t){Ve.nextTick(o.bind(null,null,t))}),(function(t){Ve.nextTick(Mn.bind(null,t,o))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,Xe(t)),e}Pn.custom=On;var Dn={inherits:Je,_extend:Cn,log:Sn,isBuffer:Rn,isPrimitive:Tn,isFunction:kn,isError:En,isDate:vn,isObject:yn,isRegExp:bn,isUndefined:mn,isSymbol:wn,isString:_n,isNumber:gn,isNullOrUndefined:pn,isNull:dn,isBoolean:cn,isArray:fn,inspect:on,deprecate:tn,format:$e,debuglog:rn,promisify:Pn,callbackify:Bn},zn=e(Object.freeze({__proto__:null,_extend:Cn,callbackify:Bn,debuglog:rn,default:Dn,deprecate:tn,format:$e,inherits:Je,inspect:on,isArray:fn,isBoolean:cn,isBuffer:Rn,isDate:vn,isError:En,isFunction:kn,isNull:dn,isNullOrUndefined:pn,isNumber:gn,isObject:yn,isPrimitive:Tn,isRegExp:bn,isString:_n,isSymbol:wn,isUndefined:mn,log:Sn,promisify:Pn}));function Nn(){}function Un(){Un.init.call(this)}function Fn(t){return void 0===t._maxListeners?Un.defaultMaxListeners:t._maxListeners}function Yn(t,e,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]):(o=t._events=new Nn,t._eventsCount=0),a){if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=Fn(t))&&i>0&&a.length>i){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,s=h,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[e]=n,++t._eventsCount;return t}function jn(t,e,n){var r=!1;function i(){t.removeListener(e,i),r||(r=!0,n.apply(t,arguments))}return i.listener=n,i}function Zn(t){var e=this._events;if(e){var n=e[t];if("function"==typeof n)return 1;if(n)return n.length}return 0}function Hn(t,e){for(var n=new Array(e);e--;)n[e]=t[e];return n}function Wn(){this.head=null,this.tail=null,this.length=0}Nn.prototype=Object.create(null),Un.EventEmitter=Un,Un.usingDomains=!1,Un.prototype.domain=void 0,Un.prototype._events=void 0,Un.prototype._maxListeners=void 0,Un.defaultMaxListeners=10,Un.init=function(){this.domain=null,Un.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Nn,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Un.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},Un.prototype.getMaxListeners=function(){return Fn(this)},Un.prototype.emit=function(t){var e,n,r,i,o,a,s,h="error"===t;if(a=this._events)h=h&&null==a.error;else if(!h)return!1;if(s=this.domain,h){if(e=arguments[1],!s){if(e instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=s,e.domainThrown=!1,s.emit("error",e),!1}if(!(n=a[t]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:!function(t,e,n){if(e)t.call(n);else for(var r=t.length,i=Hn(t,r),o=0;o<r;++o)i[o].call(n)}(n,u,this);break;case 2:!function(t,e,n,r){if(e)t.call(n,r);else for(var i=t.length,o=Hn(t,i),a=0;a<i;++a)o[a].call(n,r)}(n,u,this,arguments[1]);break;case 3:!function(t,e,n,r,i){if(e)t.call(n,r,i);else for(var o=t.length,a=Hn(t,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,u,this,arguments[1],arguments[2]);break;case 4:!function(t,e,n,r,i,o){if(e)t.call(n,r,i,o);else for(var a=t.length,s=Hn(t,a),h=0;h<a;++h)s[h].call(n,r,i,o)}(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(t,e,n,r){if(e)t.apply(n,r);else for(var i=t.length,o=Hn(t,i),a=0;a<i;++a)o[a].apply(n,r)}(n,u,this,i)}return!0},Un.prototype.addListener=function(t,e){return Yn(this,t,e,!1)},Un.prototype.on=Un.prototype.addListener,Un.prototype.prependListener=function(t,e){return Yn(this,t,e,!0)},Un.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,jn(this,t,e)),this},Un.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,jn(this,t,e)),this},Un.prototype.removeListener=function(t,e){var n,r,i,o,a;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener&&n.listener===e)0==--this._eventsCount?this._events=new Nn:(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new Nn,this;delete r[t]}else!function(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}(n,i);r.removeListener&&this.emit("removeListener",t,a||e)}return this},Un.prototype.off=function(t,e){return this.removeListener(t,e)},Un.prototype.removeAllListeners=function(t){var e,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new Nn,this._eventsCount=0):n[t]&&(0==--this._eventsCount?this._events=new Nn:delete n[t]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new Nn,this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(e)do{this.removeListener(t,e[e.length-1])}while(e[0]);return this},Un.prototype.listeners=function(t){var e,n=this._events;return n&&(e=n[t])?"function"==typeof e?[e.listener||e]:function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(e):[]},Un.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):Zn.call(t,e)},Un.prototype.listenerCount=Zn,Un.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]},Wn.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},Wn.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},Wn.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},Wn.prototype.clear=function(){this.head=this.tail=null,this.length=0},Wn.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},Wn.prototype.concat=function(t){if(0===this.length)return Dt.alloc(0);if(1===this.length)return this.head.data;for(var e=Dt.allocUnsafe(t>>>0),n=this.head,r=0;n;)n.data.copy(e,r),r+=n.data.length,n=n.next;return e};var qn=Dt.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Gn(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!qn(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Kn;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Jn;break;default:return void(this.write=Vn)}this.charBuffer=new Dt(6),this.charReceived=0,this.charLength=0}function Vn(t){return t.toString(this.encoding)}function Kn(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function Jn(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}Gn.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(t=t.slice(n,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;r=(e+=t.toString(this.encoding,0,r)).length-1;if((i=e.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,r)}return e},Gn.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},Gn.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e},$n.ReadableState=Qn;var Xn=rn("stream");function Qn(t,e){t=t||{},this.objectMode=!!t.objectMode,e instanceof Lr&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Wn,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(this.decoder=new Gn(t.encoding),this.encoding=t.encoding)}function $n(t){if(!(this instanceof $n))return new $n(t);this._readableState=new Qn(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),Un.call(this)}function tr(t,e,n,r,i){var o=function(t,e){var n=null;Dt.isBuffer(e)||"string"==typeof e||null==e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(e,n);if(o)t.emit("error",o);else if(null===n)e.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,rr(t)}(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!i){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&i){var s=new Error("stream.unshift() after end event");t.emit("error",s)}else{var h;!e.decoder||i||r||(n=e.decoder.write(n),h=!e.objectMode&&0===n.length),i||(e.reading=!1),h||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&rr(t))),function(t,e){e.readingMore||(e.readingMore=!0,Be(or,t,e))}(t,e)}else i||(e.reading=!1);return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(e)}Je($n,Un),$n.prototype.push=function(t,e){var n=this._readableState;return n.objectMode||"string"!=typeof t||(e=e||n.defaultEncoding)!==n.encoding&&(t=Dt.from(t,e),e=""),tr(this,n,t,e,!1)},$n.prototype.unshift=function(t){return tr(this,this._readableState,t,"",!0)},$n.prototype.isPaused=function(){return!1===this._readableState.flowing},$n.prototype.setEncoding=function(t){return this._readableState.decoder=new Gn(t),this._readableState.encoding=t,this};var er=8388608;function nr(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=er?t=er:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function rr(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(Xn("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?Be(ir,t):ir(t))}function ir(t){Xn("emit readable"),t.emit("readable"),hr(t)}function or(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(Xn("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function ar(t){Xn("readable nexttick read 0"),t.read(0)}function sr(t,e){e.reading||(Xn("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),hr(t),e.flowing&&!e.reading&&t.read(0)}function hr(t){var e=t._readableState;for(Xn("flow",e.flowing);e.flowing&&null!==t.read(););}function lr(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=Dt.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),0===(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function ur(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,Be(fr,e,t))}function fr(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function cr(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}function dr(){}function pr(t,e,n){this.chunk=t,this.encoding=e,this.callback=n,this.next=null}function gr(t,e){Object.defineProperty(this,"buffer",{get:tn((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),t=t||{},this.objectMode=!!t.objectMode,e instanceof Lr&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===t.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?Be(i,r):i(r);t._writableState.errorEmitted=!0,t.emit("error",r)}(t,n,r,e,i);else{var o=yr(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||br(t,n),r?Be(mr,t,n,o,i):mr(t,n,o,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new kr(this)}function _r(t){if(!(this instanceof _r||this instanceof Lr))return new _r(t);this._writableState=new gr(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),Un.call(this)}function wr(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function mr(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),Er(t,e)}function br(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;wr(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new kr(e)}else{for(;n;){var s=n.chunk,h=n.encoding,l=n.callback;if(wr(t,e,!1,e.objectMode?1:s.length,s,h,l),n=n.next,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequestCount=0,e.bufferedRequest=n,e.bufferProcessing=!1}function yr(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function vr(t,e){e.prefinished||(e.prefinished=!0,t.emit("prefinish"))}function Er(t,e){var n=yr(e);return n&&(0===e.pendingcb?(vr(t,e),e.finished=!0,t.emit("finish")):vr(t,e)),n}function kr(t){var e=this;this.next=null,this.entry=null,this.finish=function(n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}}$n.prototype.read=function(t){Xn("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return Xn("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?ur(this):rr(this),null;if(0===(t=nr(t,e))&&e.ended)return 0===e.length&&ur(this),null;var r,i=e.needReadable;return Xn("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&Xn("length less than watermark",i=!0),e.ended||e.reading?Xn("reading or ended",i=!1):i&&(Xn("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=nr(n,e))),null===(r=t>0?lr(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&ur(this)),null!==r&&this.emit("data",r),r},$n.prototype._read=function(t){this.emit("error",new Error("not implemented"))},$n.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,Xn("pipe count=%d opts=%j",r.pipesCount,e);var i=!e||!1!==e.end?a:l;function o(t){Xn("onunpipe"),t===n&&l()}function a(){Xn("onend"),t.end()}r.endEmitted?Be(i):n.once("end",i),t.on("unpipe",o);var s=function(t){return function(){var e=t._readableState;Xn("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&t.listeners("data").length&&(e.flowing=!0,hr(t))}}(n);t.on("drain",s);var h=!1;function l(){Xn("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",s),t.removeListener("error",c),t.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",f),h=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||s()}var u=!1;function f(e){Xn("ondata"),u=!1,!1!==t.write(e)||u||((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==cr(r.pipes,t))&&!h&&(Xn("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,u=!0),n.pause())}function c(e){var n;Xn("onerror",e),g(),t.removeListener("error",c),0===(n="error",t.listeners(n).length)&&t.emit("error",e)}function d(){t.removeListener("finish",p),g()}function p(){Xn("onfinish"),t.removeListener("close",d),g()}function g(){Xn("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",c),t.once("close",d),t.once("finish",p),t.emit("pipe",n),r.flowing||(Xn("pipe resume"),n.resume()),t},$n.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this)),this;if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=cr(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this)),this},$n.prototype.on=function(t,e){var n=Un.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&rr(this):Be(ar,this))}return n},$n.prototype.addListener=$n.prototype.on,$n.prototype.resume=function(){var t=this._readableState;return t.flowing||(Xn("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Be(sr,t,e))}(this,t)),this},$n.prototype.pause=function(){return Xn("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Xn("pause"),this._readableState.flowing=!1,this.emit("pause")),this},$n.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;for(var i in t.on("end",(function(){if(Xn("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)})),t.on("data",(function(i){(Xn("wrapped data"),e.decoder&&(i=e.decoder.write(i)),e.objectMode&&null==i)||(e.objectMode||i&&i.length)&&(r.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));return function(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}(["error","close","destroy","pause","resume"],(function(e){t.on(e,r.emit.bind(r,e))})),r._read=function(e){Xn("wrapped _read",e),n&&(n=!1,t.resume())},r},$n._fromList=lr,_r.WritableState=gr,Je(_r,Un),gr.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},_r.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_r.prototype.write=function(t,e,n){var r=this._writableState,i=!1;return"function"==typeof e&&(n=e,e=null),Dt.isBuffer(t)?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=dr),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),Be(e,n)}(this,n):function(t,e,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):Dt.isBuffer(n)||"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),Be(r,o),i=!1),i}(this,r,t,n)&&(r.pendingcb++,i=function(t,e,n,r,i){n=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=Dt.from(e,n));return e}(e,n,r),Dt.isBuffer(n)&&(r="buffer");var o=e.objectMode?1:n.length;e.length+=o;var a=e.length<e.highWaterMark;a||(e.needDrain=!0);if(e.writing||e.corked){var s=e.lastBufferedRequest;e.lastBufferedRequest=new pr(n,r,i),s?s.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else wr(t,e,!1,o,n,r,i);return a}(this,r,t,e,n)),i},_r.prototype.cork=function(){this._writableState.corked++},_r.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||br(this,t))},_r.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},_r.prototype._write=function(t,e,n){n(new Error("not implemented"))},_r.prototype._writev=null,_r.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,Er(t,e),n&&(e.finished?Be(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Je(Lr,$n);for(var Tr=Object.keys(_r.prototype),Rr=0;Rr<Tr.length;Rr++){var Ar=Tr[Rr];Lr.prototype[Ar]||(Lr.prototype[Ar]=_r.prototype[Ar])}function Lr(t){if(!(this instanceof Lr))return new Lr(t);$n.call(this,t),_r.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",xr)}function xr(){this.allowHalfOpen||this._writableState.ended||Be(Sr,this)}function Sr(t){t.end()}function Cr(t){this.afterTransform=function(e,n){return function(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&t.push(n);i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Ir(t){if(!(this instanceof Ir))return new Ir(t);Lr.call(this,t),this._transformState=new Cr(this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(t){Or(e,t)})):Or(e)}))}function Or(t,e){if(e)return t.emit("error",e);var n=t._writableState,r=t._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}function Pr(t){if(!(this instanceof Pr))return new Pr(t);Ir.call(this,t)}function Mr(){Un.call(this)}Je(Ir,Lr),Ir.prototype.push=function(t,e){return this._transformState.needTransform=!1,Lr.prototype.push.call(this,t,e)},Ir.prototype._transform=function(t,e,n){throw new Error("Not implemented")},Ir.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Ir.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},Je(Pr,Ir),Pr.prototype._transform=function(t,e,n){n(null,t)},Je(Mr,Un),Mr.Readable=$n,Mr.Writable=_r,Mr.Duplex=Lr,Mr.Transform=Ir,Mr.PassThrough=Pr,Mr.Stream=Mr,Mr.prototype.pipe=function(t,e){var n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",i),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(l(),0===Un.listenerCount(this,"error"))throw t}function l(){n.removeListener("data",r),t.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",h),t.removeListener("error",h),n.removeListener("end",l),n.removeListener("close",l),t.removeListener("close",l)}return n.on("error",h),t.on("error",h),n.on("end",l),n.on("close",l),t.on("close",l),t.emit("pipe",n),t};var Br=e(Object.freeze({__proto__:null,Duplex:Lr,PassThrough:Pr,Readable:$n,Stream:Mr,Transform:Ir,Writable:_r,default:Mr})),Dr={exports:{}},zr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function Nr(){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}function Ur(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]}var Fr=Uint8Array,Yr=Uint16Array,jr=Int32Array,Zr=4,Hr=0,Wr=1,qr=2;function Gr(t){for(var e=t.length;--e>=0;)t[e]=0}var Vr=0,Kr=1,Jr=2,Xr=29,Qr=256,$r=Qr+1+Xr,ti=30,ei=19,ni=2*$r+1,ri=15,ii=16,oi=7,ai=256,si=16,hi=17,li=18,ui=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],fi=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ci=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],di=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],pi=new Array(2*($r+2));Gr(pi);var gi=new Array(2*ti);Gr(gi);var _i=new Array(512);Gr(_i);var wi=new Array(256);Gr(wi);var mi=new Array(Xr);Gr(mi);var bi,yi,vi,Ei=new Array(ti);function ki(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function Ti(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Ri(t){return t<256?_i[t]:_i[256+(t>>>7)]}function Ai(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function Li(t,e,n){t.bi_valid>ii-n?(t.bi_buf|=e<<t.bi_valid&65535,Ai(t,t.bi_buf),t.bi_buf=e>>ii-t.bi_valid,t.bi_valid+=n-ii):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function xi(t,e,n){Li(t,n[2*e],n[2*e+1])}function Si(t,e){var n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}function Ci(t,e,n){var r,i,o=new Array(ri+1),a=0;for(r=1;r<=ri;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=Si(o[s]++,s))}}function Ii(t){var e;for(e=0;e<$r;e++)t.dyn_ltree[2*e]=0;for(e=0;e<ti;e++)t.dyn_dtree[2*e]=0;for(e=0;e<ei;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*ai]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Oi(t){t.bi_valid>8?Ai(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Pi(t,e,n,r){var i=2*e,o=2*n;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function Mi(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&Pi(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Pi(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function Bi(t,e,n){var r,i,o,a,s=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*s]<<8|t.pending_buf[t.d_buf+2*s+1],i=t.pending_buf[t.l_buf+s],s++,0===r?xi(t,i,e):(xi(t,(o=wi[i])+Qr+1,e),0!==(a=ui[o])&&Li(t,i-=mi[o],a),xi(t,o=Ri(--r),n),0!==(a=fi[o])&&Li(t,r-=Ei[o],a))}while(s<t.last_lit);xi(t,ai,e)}function Di(t,e){var n,r,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,h=e.stat_desc.elems,l=-1;for(t.heap_len=0,t.heap_max=ni,n=0;n<h;n++)0!==o[2*n]?(t.heap[++t.heap_len]=l=n,t.depth[n]=0):o[2*n+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=l<2?++l:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=l,n=t.heap_len>>1;n>=1;n--)Mi(t,o,n);i=h;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Mi(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,Mi(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,h=e.dyn_tree,l=e.max_code,u=e.stat_desc.static_tree,f=e.stat_desc.has_stree,c=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;o<=ri;o++)t.bl_count[o]=0;for(h[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<ni;n++)(o=h[2*h[2*(r=t.heap[n])+1]+1]+1)>p&&(o=p,g++),h[2*r+1]=o,r>l||(t.bl_count[o]++,a=0,r>=d&&(a=c[r-d]),s=h[2*r],t.opt_len+=s*(o+a),f&&(t.static_len+=s*(u[2*r+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(i=t.heap[--n])>l||(h[2*i+1]!==o&&(t.opt_len+=(o-h[2*i+1])*h[2*i],h[2*i+1]=o),r--)}}(t,e),Ci(o,l,t.bl_count)}function zi(t,e,n){var r,i,o=-1,a=e[1],s=0,h=7,l=4;for(0===a&&(h=138,l=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=e[2*(r+1)+1],++s<h&&i===a||(s<l?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[2*si]++):s<=10?t.bl_tree[2*hi]++:t.bl_tree[2*li]++,s=0,o=i,0===a?(h=138,l=3):i===a?(h=6,l=3):(h=7,l=4))}function Ni(t,e,n){var r,i,o=-1,a=e[1],s=0,h=7,l=4;for(0===a&&(h=138,l=3),r=0;r<=n;r++)if(i=a,a=e[2*(r+1)+1],!(++s<h&&i===a)){if(s<l)do{xi(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(xi(t,i,t.bl_tree),s--),xi(t,si,t.bl_tree),Li(t,s-3,2)):s<=10?(xi(t,hi,t.bl_tree),Li(t,s-3,3)):(xi(t,li,t.bl_tree),Li(t,s-11,7));s=0,o=i,0===a?(h=138,l=3):i===a?(h=6,l=3):(h=7,l=4)}}Gr(Ei);var Ui=!1;function Fi(t){Ui||(!function(){var t,e,n,r,i,o=new Array(ri+1);for(n=0,r=0;r<Xr-1;r++)for(mi[r]=n,t=0;t<1<<ui[r];t++)wi[n++]=r;for(wi[n-1]=r,i=0,r=0;r<16;r++)for(Ei[r]=i,t=0;t<1<<fi[r];t++)_i[i++]=r;for(i>>=7;r<ti;r++)for(Ei[r]=i<<7,t=0;t<1<<fi[r]-7;t++)_i[256+i++]=r;for(e=0;e<=ri;e++)o[e]=0;for(t=0;t<=143;)pi[2*t+1]=8,t++,o[8]++;for(;t<=255;)pi[2*t+1]=9,t++,o[9]++;for(;t<=279;)pi[2*t+1]=7,t++,o[7]++;for(;t<=287;)pi[2*t+1]=8,t++,o[8]++;for(Ci(pi,$r+1,o),t=0;t<ti;t++)gi[2*t+1]=5,gi[2*t]=Si(t,5);bi=new ki(pi,ui,Qr+1,$r,ri),yi=new ki(gi,fi,0,ti,ri),vi=new ki(new Array(0),ci,0,ei,oi)}(),Ui=!0),t.l_desc=new Ti(t.dyn_ltree,bi),t.d_desc=new Ti(t.dyn_dtree,yi),t.bl_desc=new Ti(t.bl_tree,vi),t.bi_buf=0,t.bi_valid=0,Ii(t)}function Yi(t,e,n,r){Li(t,(Vr<<1)+(r?1:0),3),function(t,e,n,r){Oi(t),r&&(Ai(t,n),Ai(t,~n)),Ur(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}function ji(t){Li(t,Kr<<1,3),xi(t,ai,pi),function(t){16===t.bi_valid?(Ai(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}function Zi(t,e,n,r){var i,o,a=0;t.level>0?(t.strm.data_type===qr&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return Hr;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return Wr;for(e=32;e<Qr;e++)if(0!==t.dyn_ltree[2*e])return Wr;return Hr}(t)),Di(t,t.l_desc),Di(t,t.d_desc),a=function(t){var e;for(zi(t,t.dyn_ltree,t.l_desc.max_code),zi(t,t.dyn_dtree,t.d_desc.max_code),Di(t,t.bl_desc),e=ei-1;e>=3&&0===t.bl_tree[2*di[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?Yi(t,e,n,r):t.strategy===Zr||o===i?(Li(t,(Kr<<1)+(r?1:0),3),Bi(t,pi,gi)):(Li(t,(Jr<<1)+(r?1:0),3),function(t,e,n,r){var i;for(Li(t,e-257,5),Li(t,n-1,5),Li(t,r-4,4),i=0;i<r;i++)Li(t,t.bl_tree[2*di[i]+1],3);Ni(t,t.dyn_ltree,e-1),Ni(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),Bi(t,t.dyn_ltree,t.dyn_dtree)),Ii(t),r&&Oi(t)}function Hi(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>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&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(wi[n]+Qr+1)]++,t.dyn_dtree[2*Ri(e)]++),t.last_lit===t.lit_bufsize-1}function Wi(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}var qi=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();function Gi(t,e,n,r){var i=qi,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^i[255&(t^e[a])];return-1^t}var Vi,Ki=0,Ji=4,Xi=0,Qi=-2,$i=2,to=8,eo=286,no=30,ro=19,io=2*eo+1,oo=15,ao=3,so=258,ho=so+ao+1,lo=42,uo=103,fo=113,co=666,po=1,go=2,_o=3,wo=4;function mo(t,e){return t.msg=zr[e],e}function bo(t){return(t<<1)-(t>4?9:0)}function yo(t){for(var e=t.length;--e>=0;)t[e]=0}function vo(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(Ur(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function Eo(t,e){Zi(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,vo(t.strm)}function ko(t,e){t.pending_buf[t.pending++]=e}function To(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function Ro(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-ho?t.strstart-(t.w_size-ho):0,l=t.window,u=t.w_mask,f=t.prev,c=t.strstart+so,d=l[o+a-1],p=l[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(n=e)+a]===p&&l[n+a-1]===d&&l[n]===l[o]&&l[++n]===l[o+1]){o+=2,n++;do{}while(l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&o<c);if(r=so-(c-o),o=c-so,r>a){if(t.match_start=e,a=r,r>=s)break;d=l[o+a-1],p=l[o+a]}}}while((e=f[e&u])>h&&0!=--i);return a<=t.lookahead?a:t.lookahead}function Ao(t){var e,n,r,i,o,a,s,h,l,u,f=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-ho)){Ur(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=f?r-f:0}while(--n);e=n=f;do{r=t.prev[--e],t.prev[e]=r>=f?r-f:0}while(--n);i+=f}if(0===t.strm.avail_in)break;if(a=t.strm,s=t.window,h=t.strstart+t.lookahead,l=i,u=void 0,(u=a.avail_in)>l&&(u=l),n=0===u?0:(a.avail_in-=u,Ur(s,a.input,a.next_in,u,h),1===a.state.wrap?a.adler=Wi(a.adler,s,u,h):2===a.state.wrap&&(a.adler=Gi(a.adler,s,u,h)),a.next_in+=u,a.total_in+=u,u),t.lookahead+=n,t.lookahead+t.insert>=ao)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+ao-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<ao)););}while(t.lookahead<ho&&0!==t.strm.avail_in)}function Lo(t,e){for(var n,r;;){if(t.lookahead<ho){if(Ao(t),t.lookahead<ho&&e===Ki)return po;if(0===t.lookahead)break}if(n=0,t.lookahead>=ao&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-ho&&(t.match_length=Ro(t,n)),t.match_length>=ao)if(r=Hi(t,t.strstart-t.match_start,t.match_length-ao),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ao){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=Hi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=t.strstart<ao-1?t.strstart:ao-1,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}function xo(t,e){for(var n,r,i;;){if(t.lookahead<ho){if(Ao(t),t.lookahead<ho&&e===Ki)return po;if(0===t.lookahead)break}if(n=0,t.lookahead>=ao&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ao-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-ho&&(t.match_length=Ro(t,n),t.match_length<=5&&(1===t.strategy||t.match_length===ao&&t.strstart-t.match_start>4096)&&(t.match_length=ao-1)),t.prev_length>=ao&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ao,r=Hi(t,t.strstart-1-t.prev_match,t.prev_length-ao),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=ao-1,t.strstart++,r&&(Eo(t,!1),0===t.strm.avail_out))return po}else if(t.match_available){if((r=Hi(t,0,t.window[t.strstart-1]))&&Eo(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return po}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=Hi(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ao-1?t.strstart:ao-1,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}function So(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function Co(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=to,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Yr(2*io),this.dyn_dtree=new Yr(2*(2*no+1)),this.bl_tree=new Yr(2*(2*ro+1)),yo(this.dyn_ltree),yo(this.dyn_dtree),yo(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Yr(oo+1),this.heap=new Yr(2*eo+1),yo(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Yr(2*eo+1),yo(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Io(t){var e,n=function(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=$i,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?lo:fo,t.adler=2===e.wrap?0:1,e.last_flush=Ki,Fi(e),Xi):mo(t,Qi)}(t);return n===Xi&&((e=t.state).window_size=2*e.w_size,yo(e.head),e.max_lazy_match=Vi[e.level].max_lazy,e.good_match=Vi[e.level].good_length,e.nice_match=Vi[e.level].nice_length,e.max_chain_length=Vi[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ao-1,e.match_available=0,e.ins_h=0),n}function Oo(t,e){var n,r,i,o;if(!t||!t.state||e>5||e<0)return t?mo(t,Qi):Qi;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||r.status===co&&e!==Ji)return mo(t,0===t.avail_out?-5:Qi);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===lo)if(2===r.wrap)t.adler=0,ko(r,31),ko(r,139),ko(r,8),r.gzhead?(ko(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ko(r,255&r.gzhead.time),ko(r,r.gzhead.time>>8&255),ko(r,r.gzhead.time>>16&255),ko(r,r.gzhead.time>>24&255),ko(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),ko(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ko(r,255&r.gzhead.extra.length),ko(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Gi(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(ko(r,0),ko(r,0),ko(r,0),ko(r,0),ko(r,0),ko(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),ko(r,3),r.status=fo);else{var a=to+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=fo,To(r,a),0!==r.strstart&&(To(r,t.adler>>>16),To(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),vo(t),i=r.pending,r.pending!==r.pending_buf_size));)ko(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),vo(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ko(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),vo(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ko(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.status=uo)}else r.status=uo;if(r.status===uo&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&vo(t),r.pending+2<=r.pending_buf_size&&(ko(r,255&t.adler),ko(r,t.adler>>8&255),t.adler=0,r.status=fo)):r.status=fo),0!==r.pending){if(vo(t),0===t.avail_out)return r.last_flush=-1,Xi}else if(0===t.avail_in&&bo(e)<=bo(n)&&e!==Ji)return mo(t,-5);if(r.status===co&&0!==t.avail_in)return mo(t,-5);if(0!==t.avail_in||0!==r.lookahead||e!==Ki&&r.status!==co){var s=2===r.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(Ao(t),0===t.lookahead)){if(e===Ki)return po;break}if(t.match_length=0,n=Hi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=0,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}(r,e):3===r.strategy?function(t,e){for(var n,r,i,o,a=t.window;;){if(t.lookahead<=so){if(Ao(t),t.lookahead<=so&&e===Ki)return po;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=ao&&t.strstart>0&&(r=a[i=t.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){o=t.strstart+so;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);t.match_length=so-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ao?(n=Hi(t,1,t.match_length-ao),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Hi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=0,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}(r,e):Vi[r.level].func(r,e);if(s!==_o&&s!==wo||(r.status=co),s===po||s===_o)return 0===t.avail_out&&(r.last_flush=-1),Xi;if(s===go&&(1===e?ji(r):5!==e&&(Yi(r,0,0,!1),3===e&&(yo(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),vo(t),0===t.avail_out))return r.last_flush=-1,Xi}return e!==Ji?Xi:r.wrap<=0?1:(2===r.wrap?(ko(r,255&t.adler),ko(r,t.adler>>8&255),ko(r,t.adler>>16&255),ko(r,t.adler>>24&255),ko(r,255&t.total_in),ko(r,t.total_in>>8&255),ko(r,t.total_in>>16&255),ko(r,t.total_in>>24&255)):(To(r,t.adler>>>16),To(r,65535&t.adler)),vo(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Xi:1)}Vi=[new So(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ao(t),0===t.lookahead&&e===Ki)return po;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,Eo(t,!1),0===t.strm.avail_out))return po;if(t.strstart-t.block_start>=t.w_size-ho&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=0,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):(t.strstart>t.block_start&&(Eo(t,!1),t.strm.avail_out),po)})),new So(4,4,8,4,Lo),new So(4,5,16,8,Lo),new So(4,6,32,32,Lo),new So(4,4,16,16,xo),new So(8,16,32,32,xo),new So(8,16,128,128,xo),new So(8,32,128,256,xo),new So(32,128,258,1024,xo),new So(32,258,258,4096,xo)];var Po=30,Mo=12;function Bo(t,e){var n,r,i,o,a,s,h,l,u,f,c,d,p,g,_,w,m,b,y,v,E,k,T,R,A;n=t.state,r=t.next_in,R=t.input,i=r+(t.avail_in-5),o=t.next_out,A=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),h=n.dmax,l=n.wsize,u=n.whave,f=n.wnext,c=n.window,d=n.hold,p=n.bits,g=n.lencode,_=n.distcode,w=(1<<n.lenbits)-1,m=(1<<n.distbits)-1;t:do{p<15&&(d+=R[r++]<<p,p+=8,d+=R[r++]<<p,p+=8),b=g[d&w];e:for(;;){if(d>>>=y=b>>>24,p-=y,0===(y=b>>>16&255))A[o++]=65535&b;else{if(!(16&y)){if(0==(64&y)){b=g[(65535&b)+(d&(1<<y)-1)];continue e}if(32&y){n.mode=Mo;break t}t.msg="invalid literal/length code",n.mode=Po;break t}v=65535&b,(y&=15)&&(p<y&&(d+=R[r++]<<p,p+=8),v+=d&(1<<y)-1,d>>>=y,p-=y),p<15&&(d+=R[r++]<<p,p+=8,d+=R[r++]<<p,p+=8),b=_[d&m];n:for(;;){if(d>>>=y=b>>>24,p-=y,!(16&(y=b>>>16&255))){if(0==(64&y)){b=_[(65535&b)+(d&(1<<y)-1)];continue n}t.msg="invalid distance code",n.mode=Po;break t}if(E=65535&b,p<(y&=15)&&(d+=R[r++]<<p,(p+=8)<y&&(d+=R[r++]<<p,p+=8)),(E+=d&(1<<y)-1)>h){t.msg="invalid distance too far back",n.mode=Po;break t}if(d>>>=y,p-=y,E>(y=o-a)){if((y=E-y)>u&&n.sane){t.msg="invalid distance too far back",n.mode=Po;break t}if(k=0,T=c,0===f){if(k+=l-y,y<v){v-=y;do{A[o++]=c[k++]}while(--y);k=o-E,T=A}}else if(f<y){if(k+=l+f-y,(y-=f)<v){v-=y;do{A[o++]=c[k++]}while(--y);if(k=0,f<v){v-=y=f;do{A[o++]=c[k++]}while(--y);k=o-E,T=A}}}else if(k+=f-y,y<v){v-=y;do{A[o++]=c[k++]}while(--y);k=o-E,T=A}for(;v>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],v-=3;v&&(A[o++]=T[k++],v>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],v-=3}while(v>2);v&&(A[o++]=A[k++],v>1&&(A[o++]=A[k++]))}break}}break}}while(r<i&&o<s);r-=v=p>>3,d&=(1<<(p-=v<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<s?s-o+257:257-(o-s),n.hold=d,n.bits=p}var Do=15,zo=852,No=592,Uo=0,Fo=1,Yo=2,jo=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Zo=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Ho=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Wo=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function qo(t,e,n,r,i,o,a,s){var h,l,u,f,c,d,p,g,_,w=s.bits,m=0,b=0,y=0,v=0,E=0,k=0,T=0,R=0,A=0,L=0,x=null,S=0,C=new Yr(Do+1),I=new Yr(Do+1),O=null,P=0;for(m=0;m<=Do;m++)C[m]=0;for(b=0;b<r;b++)C[e[n+b]]++;for(E=w,v=Do;v>=1&&0===C[v];v--);if(E>v&&(E=v),0===v)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(y=1;y<v&&0===C[y];y++);for(E<y&&(E=y),R=1,m=1;m<=Do;m++)if(R<<=1,(R-=C[m])<0)return-1;if(R>0&&(t===Uo||1!==v))return-1;for(I[1]=0,m=1;m<Do;m++)I[m+1]=I[m]+C[m];for(b=0;b<r;b++)0!==e[n+b]&&(a[I[e[n+b]]++]=b);if(t===Uo?(x=O=a,d=19):t===Fo?(x=jo,S-=257,O=Zo,P-=257,d=256):(x=Ho,O=Wo,d=-1),L=0,b=0,m=y,c=o,k=E,T=0,u=-1,f=(A=1<<E)-1,t===Fo&&A>zo||t===Yo&&A>No)return 1;for(;;){p=m-T,a[b]<d?(g=0,_=a[b]):a[b]>d?(g=O[P+a[b]],_=x[S+a[b]]):(g=96,_=0),h=1<<m-T,y=l=1<<k;do{i[c+(L>>T)+(l-=h)]=p<<24|g<<16|_|0}while(0!==l);for(h=1<<m-1;L&h;)h>>=1;if(0!==h?(L&=h-1,L+=h):L=0,b++,0==--C[m]){if(m===v)break;m=e[n+a[b]]}if(m>E&&(L&f)!==u){for(0===T&&(T=E),c+=y,R=1<<(k=m-T);k+T<v&&!((R-=C[k+T])<=0);)k++,R<<=1;if(A+=1<<k,t===Fo&&A>zo||t===Yo&&A>No)return 1;i[u=L&f]=E<<24|k<<16|c-o|0}}return 0!==L&&(i[c+L]=m-T<<24|64<<16|0),s.bits=E,0}var Go=1,Vo=2,Ko=0,Jo=-2,Xo=1,Qo=12,$o=30,ta=852,ea=592;function na(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function ra(){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 Yr(320),this.work=new Yr(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ia(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Xo,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new jr(ta),e.distcode=e.distdyn=new jr(ea),e.sane=1,e.back=-1,Ko):Jo}(t)):Jo}function oa(t,e){var n,r;return t?(r=new ra,t.state=r,r.window=null,n=function(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Jo:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,ia(t))):Jo}(t,e),n!==Ko&&(t.state=null),n):Jo}var aa,sa,ha=!0;function la(t){if(ha){var e;for(aa=new jr(512),sa=new jr(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(qo(Go,t.lens,0,288,aa,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;qo(Vo,t.lens,0,32,sa,0,t.work,{bits:5}),ha=!1}t.lencode=aa,t.lenbits=9,t.distcode=sa,t.distbits=5}function ua(t,e){var n,r,i,o,a,s,h,l,u,f,c,d,p,g,_,w,m,b,y,v,E,k,T,R,A=0,L=new Fr(4),x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return Jo;(n=t.state).mode===Qo&&(n.mode=13),a=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,l=n.hold,u=n.bits,f=s,c=h,k=Ko;t:for(;;)switch(n.mode){case Xo:if(0===n.wrap){n.mode=13;break}for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(2&n.wrap&&35615===l){n.check=0,L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0),l=0,u=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",n.mode=$o;break}if(8!=(15&l)){t.msg="unknown compression method",n.mode=$o;break}if(u-=4,E=8+(15&(l>>>=4)),0===n.wbits)n.wbits=E;else if(E>n.wbits){t.msg="invalid window size",n.mode=$o;break}n.dmax=1<<E,t.adler=n.check=1,n.mode=512&l?10:Qo,l=0,u=0;break;case 2:for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(n.flags=l,8!=(255&n.flags)){t.msg="unknown compression method",n.mode=$o;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=$o;break}n.head&&(n.head.text=l>>8&1),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0)),l=0,u=0,n.mode=3;case 3:for(;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.head&&(n.head.time=l),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,L[2]=l>>>16&255,L[3]=l>>>24&255,n.check=Gi(n.check,L,4,0)),l=0,u=0,n.mode=4;case 4:for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.head&&(n.head.xflags=255&l,n.head.os=l>>8),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0)),l=0,u=0,n.mode=5;case 5:if(1024&n.flags){for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((d=n.length)>s&&(d=s),d&&(n.head&&(E=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Ur(n.head.extra,r,o,d,E)),512&n.flags&&(n.check=Gi(n.check,r,d,o)),s-=d,o+=d,n.length-=d),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break t;d=0;do{E=r[o+d++],n.head&&E&&n.length<65536&&(n.head.name+=String.fromCharCode(E))}while(E&&d<s);if(512&n.flags&&(n.check=Gi(n.check,r,d,o)),s-=d,o+=d,E)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break t;d=0;do{E=r[o+d++],n.head&&E&&n.length<65536&&(n.head.comment+=String.fromCharCode(E))}while(E&&d<s);if(512&n.flags&&(n.check=Gi(n.check,r,d,o)),s-=d,o+=d,E)break t}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(l!==(65535&n.check)){t.msg="header crc mismatch",n.mode=$o;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Qo;break;case 10:for(;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}t.adler=n.check=na(l),l=0,u=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=a,t.avail_out=h,t.next_in=o,t.avail_in=s,n.hold=l,n.bits=u,2;t.adler=n.check=1,n.mode=Qo;case Qo:if(5===e||6===e)break t;case 13:if(n.last){l>>>=7&u,u-=7&u,n.mode=27;break}for(;u<3;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}switch(n.last=1&l,u-=1,3&(l>>>=1)){case 0:n.mode=14;break;case 1:if(la(n),n.mode=20,6===e){l>>>=2,u-=2;break t}break;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=$o}l>>>=2,u-=2;break;case 14:for(l>>>=7&u,u-=7&u;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",n.mode=$o;break}if(n.length=65535&l,l=0,u=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(d=n.length){if(d>s&&(d=s),d>h&&(d=h),0===d)break t;Ur(i,r,o,d,a),s-=d,o+=d,h-=d,a+=d,n.length-=d;break}n.mode=Qo;break;case 17:for(;u<14;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(n.nlen=257+(31&l),l>>>=5,u-=5,n.ndist=1+(31&l),l>>>=5,u-=5,n.ncode=4+(15&l),l>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=$o;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;u<3;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.lens[x[n.have++]]=7&l,l>>>=3,u-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},k=qo(0,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,k){t.msg="invalid code lengths set",n.mode=$o;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;w=(A=n.lencode[l&(1<<n.lenbits)-1])>>>16&255,m=65535&A,!((_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(m<16)l>>>=_,u-=_,n.lens[n.have++]=m;else{if(16===m){for(R=_+2;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(l>>>=_,u-=_,0===n.have){t.msg="invalid bit length repeat",n.mode=$o;break}E=n.lens[n.have-1],d=3+(3&l),l>>>=2,u-=2}else if(17===m){for(R=_+3;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}u-=_,E=0,d=3+(7&(l>>>=_)),l>>>=3,u-=3}else{for(R=_+7;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}u-=_,E=0,d=11+(127&(l>>>=_)),l>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=$o;break}for(;d--;)n.lens[n.have++]=E}}if(n.mode===$o)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=$o;break}if(n.lenbits=9,T={bits:n.lenbits},k=qo(Go,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,k){t.msg="invalid literal/lengths set",n.mode=$o;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},k=qo(Vo,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,k){t.msg="invalid distances set",n.mode=$o;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(s>=6&&h>=258){t.next_out=a,t.avail_out=h,t.next_in=o,t.avail_in=s,n.hold=l,n.bits=u,Bo(t,c),a=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,l=n.hold,u=n.bits,n.mode===Qo&&(n.back=-1);break}for(n.back=0;w=(A=n.lencode[l&(1<<n.lenbits)-1])>>>16&255,m=65535&A,!((_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(w&&0==(240&w)){for(b=_,y=w,v=m;w=(A=n.lencode[v+((l&(1<<b+y)-1)>>b)])>>>16&255,m=65535&A,!(b+(_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=m,0===w){n.mode=26;break}if(32&w){n.back=-1,n.mode=Qo;break}if(64&w){t.msg="invalid literal/length code",n.mode=$o;break}n.extra=15&w,n.mode=22;case 22:if(n.extra){for(R=n.extra;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;w=(A=n.distcode[l&(1<<n.distbits)-1])>>>16&255,m=65535&A,!((_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(0==(240&w)){for(b=_,y=w,v=m;w=(A=n.distcode[v+((l&(1<<b+y)-1)>>b)])>>>16&255,m=65535&A,!(b+(_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,64&w){t.msg="invalid distance code",n.mode=$o;break}n.offset=m,n.extra=15&w,n.mode=24;case 24:if(n.extra){for(R=n.extra;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=$o;break}n.mode=25;case 25:if(0===h)break t;if(d=c-h,n.offset>d){if((d=n.offset-d)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=$o;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=a-n.offset,d=n.length;d>h&&(d=h),h-=d,n.length-=d;do{i[a++]=g[p++]}while(--d);0===n.length&&(n.mode=21);break;case 26:if(0===h)break t;i[a++]=n.length,h--,n.mode=21;break;case 27:if(n.wrap){for(;u<32;){if(0===s)break t;s--,l|=r[o++]<<u,u+=8}if(c-=h,t.total_out+=c,n.total+=c,c&&(t.adler=n.check=n.flags?Gi(n.check,i,c,a-c):Wi(n.check,i,c,a-c)),c=h,(n.flags?l:na(l))!==n.check){t.msg="incorrect data check",n.mode=$o;break}l=0,u=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(l!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=$o;break}l=0,u=0}n.mode=29;case 29:k=1;break t;case $o:k=-3;break t;case 31:return-4;default:return Jo}return t.next_out=a,t.avail_out=h,t.next_in=o,t.avail_in=s,n.hold=l,n.bits=u,(n.wsize||c!==t.avail_out&&n.mode<$o&&(n.mode<27||4!==e))&&function(t,e,n,r){var i,o=t.state;null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Fr(o.wsize)),r>=o.wsize?(Ur(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>r&&(i=r),Ur(o.window,e,n-r,i,o.wnext),(r-=i)?(Ur(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i)))}(t,t.output,t.next_out,c-t.avail_out),f-=t.avail_in,c-=t.avail_out,t.total_in+=f,t.total_out+=c,n.total+=c,n.wrap&&c&&(t.adler=n.check=n.flags?Gi(n.check,i,c,t.next_out-c):Wi(n.check,i,c,t.next_out-c)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Qo?128:0)+(20===n.mode||15===n.mode?256:0),(0===f&&0===c||4===e)&&k===Ko&&(k=-5),k}var fa;function ca(t){if(t<1||t>7)throw new TypeError("Bad argument");this.mode=t,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function da(t,e){for(var n=0;n<t.length;n++)this[e+n]=t[n]}ca.prototype.init=function(t,e,n,r,i){var o;switch(this.windowBits=t,this.level=e,this.memLevel=n,this.strategy=r,3!==this.mode&&4!==this.mode||(this.windowBits+=16),7===this.mode&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new Nr,this.mode){case 1:case 3:case 5:o=function(t,e,n,r,i,o){if(!t)return Qi;var a=1;if(-1===e&&(e=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||n!==to||r<8||r>15||e<0||e>9||o<0||o>4)return mo(t,Qi);8===r&&(r=9);var s=new Co;return t.state=s,s.strm=t,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ao-1)/ao),s.window=new Fr(2*s.w_size),s.head=new Yr(s.hash_size),s.prev=new Yr(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Fr(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=o,s.method=n,Io(t)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case 7:o=oa(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===o?(this.write_in_progress=!1,this.init_done=!0):this._error(o)},ca.prototype.params=function(){throw new Error("deflateParams Not supported")},ca.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},ca.prototype.write=function(t,e,n,r,i,o,a){this._writeCheck(),this.write_in_progress=!0;var s=this;return Ve.nextTick((function(){s.write_in_progress=!1;var h=s._write(t,e,n,r,i,o,a);s.callback(h[0],h[1]),s.pending_close&&s.close()})),this},ca.prototype.writeSync=function(t,e,n,r,i,o,a){return this._writeCheck(),this._write(t,e,n,r,i,o,a)},ca.prototype._write=function(t,e,n,r,i,o,a){if(this.write_in_progress=!0,0!==t&&1!==t&&2!==t&&3!==t&&4!==t&&5!==t)throw new Error("Invalid flush value");null==e&&(e=new Dt(0),r=0,n=0),i._set?i.set=i._set:i.set=da;var s,h=this.strm;switch(h.avail_in=r,h.input=e,h.next_in=n,h.avail_out=a,h.output=i,h.next_out=o,this.mode){case 1:case 3:case 5:s=Oo(h,t);break;case 7:case 2:case 4:case 6:s=ua(h,t);break;default:throw new Error("Unknown mode "+this.mode)}return this._checkError(s,h,t)||this._error(s),this.write_in_progress=!1,[h.avail_in,h.avail_out]},ca.prototype._checkError=function(t,e,n){switch(t){case 0:case-5:if(0!==e.avail_out&&4===n)return!1;break;case 1:break;default:return!1}return!0},ca.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,1===this.mode||3===this.mode||5===this.mode?function(t){var e;t&&t.state&&((e=t.state.status)!==lo&&69!==e&&73!==e&&91!==e&&e!==uo&&e!==fo&&e!==co?mo(t,Qi):(t.state=null,e===fo&&mo(t,-3)))}(this.strm):function(t){if(!t||!t.state)return Jo;var e=t.state;e.window&&(e.window=null),t.state=null}(this.strm),this.mode=0)},ca.prototype.reset=function(){switch(this.mode){case 1:case 5:fa=Io(this.strm);break;case 2:case 6:fa=ia(this.strm)}0!==fa&&this._error(fa)},ca.prototype._error=function(t){this.onerror(zr[t]+": "+this.strm.msg,t),this.write_in_progress=!1,this.pending_close&&this.close()};var pa=Object.freeze({__proto__:null,DEFLATE:1,DEFLATERAW:5,GUNZIP:4,GZIP:3,INFLATE:2,INFLATERAW:6,NONE:0,UNZIP:7,Z_BEST_COMPRESSION:9,Z_BEST_SPEED:1,Z_BINARY:0,Z_BLOCK:5,Z_BUF_ERROR:-5,Z_DATA_ERROR:-3,Z_DEFAULT_COMPRESSION:-1,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8,Z_ERRNO:-1,Z_FILTERED:1,Z_FINISH:4,Z_FIXED:4,Z_FULL_FLUSH:3,Z_HUFFMAN_ONLY:2,Z_NEED_DICT:2,Z_NO_COMPRESSION:0,Z_NO_FLUSH:0,Z_OK:0,Z_PARTIAL_FLUSH:1,Z_RLE:3,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_SYNC_FLUSH:2,Z_TEXT:1,Z_TREES:6,Z_UNKNOWN:2,Zlib:ca});var ga={};Object.keys(pa).forEach((function(t){ga[t]=pa[t]})),ga.Z_MIN_WINDOWBITS=8,ga.Z_MAX_WINDOWBITS=15,ga.Z_DEFAULT_WINDOWBITS=15,ga.Z_MIN_CHUNK=64,ga.Z_MAX_CHUNK=1/0,ga.Z_DEFAULT_CHUNK=16384,ga.Z_MIN_MEMLEVEL=1,ga.Z_MAX_MEMLEVEL=9,ga.Z_DEFAULT_MEMLEVEL=8,ga.Z_MIN_LEVEL=-1,ga.Z_MAX_LEVEL=9,ga.Z_DEFAULT_LEVEL=ga.Z_DEFAULT_COMPRESSION;var _a={Z_OK:ga.Z_OK,Z_STREAM_END:ga.Z_STREAM_END,Z_NEED_DICT:ga.Z_NEED_DICT,Z_ERRNO:ga.Z_ERRNO,Z_STREAM_ERROR:ga.Z_STREAM_ERROR,Z_DATA_ERROR:ga.Z_DATA_ERROR,Z_MEM_ERROR:ga.Z_MEM_ERROR,Z_BUF_ERROR:ga.Z_BUF_ERROR,Z_VERSION_ERROR:ga.Z_VERSION_ERROR};function wa(t){return new Fa(t)}function ma(t){return new Ya(t)}function ba(t){return new Ha(t)}function ya(t){return new Wa(t)}function va(t){return new ja(t)}function Ea(t){return new Za(t)}function ka(t){return new qa(t)}function Ta(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Fa(e),t,n)}function Ra(t,e){return Ua(new Fa(e),t)}function Aa(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new ja(e),t,n)}function La(t,e){return Ua(new ja(e),t)}function xa(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Ha(e),t,n)}function Sa(t,e){return Ua(new Ha(e),t)}function Ca(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new qa(e),t,n)}function Ia(t,e){return Ua(new qa(e),t)}function Oa(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Ya(e),t,n)}function Pa(t,e){return Ua(new Ya(e),t)}function Ma(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Za(e),t,n)}function Ba(t,e){return Ua(new Za(e),t)}function Da(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Wa(e),t,n)}function za(t,e){return Ua(new Wa(e),t)}function Na(t,e,n){var r=[],i=0;function o(){for(var e;null!==(e=t.read());)r.push(e),i+=e.length;t.once("readable",o)}function a(){var e=Dt.concat(r,i);r=[],n(null,e),t.close()}t.on("error",(function(e){t.removeListener("end",a),t.removeListener("readable",o),n(e)})),t.on("end",a),t.end(e),o()}function Ua(t,e){if("string"==typeof e&&(e=new Dt(e)),!Dt.isBuffer(e))throw new TypeError("Not a string or buffer");var n=ga.Z_FINISH;return t._processChunk(e,n)}function Fa(t){if(!(this instanceof Fa))return new Fa(t);Ga.call(this,t,ga.DEFLATE)}function Ya(t){if(!(this instanceof Ya))return new Ya(t);Ga.call(this,t,ga.INFLATE)}function ja(t){if(!(this instanceof ja))return new ja(t);Ga.call(this,t,ga.GZIP)}function Za(t){if(!(this instanceof Za))return new Za(t);Ga.call(this,t,ga.GUNZIP)}function Ha(t){if(!(this instanceof Ha))return new Ha(t);Ga.call(this,t,ga.DEFLATERAW)}function Wa(t){if(!(this instanceof Wa))return new Wa(t);Ga.call(this,t,ga.INFLATERAW)}function qa(t){if(!(this instanceof qa))return new qa(t);Ga.call(this,t,ga.UNZIP)}function Ga(t,e){if(this._opts=t=t||{},this._chunkSize=t.chunkSize||ga.Z_DEFAULT_CHUNK,Ir.call(this,t),t.flush&&t.flush!==ga.Z_NO_FLUSH&&t.flush!==ga.Z_PARTIAL_FLUSH&&t.flush!==ga.Z_SYNC_FLUSH&&t.flush!==ga.Z_FULL_FLUSH&&t.flush!==ga.Z_FINISH&&t.flush!==ga.Z_BLOCK)throw new Error("Invalid flush flag: "+t.flush);if(this._flushFlag=t.flush||ga.Z_NO_FLUSH,t.chunkSize&&(t.chunkSize<ga.Z_MIN_CHUNK||t.chunkSize>ga.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<ga.Z_MIN_WINDOWBITS||t.windowBits>ga.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<ga.Z_MIN_LEVEL||t.level>ga.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<ga.Z_MIN_MEMLEVEL||t.memLevel>ga.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=ga.Z_FILTERED&&t.strategy!=ga.Z_HUFFMAN_ONLY&&t.strategy!=ga.Z_RLE&&t.strategy!=ga.Z_FIXED&&t.strategy!=ga.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!Dt.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new ga.Zlib(e);var n=this;this._hadError=!1,this._binding.onerror=function(t,e){n._binding=null,n._hadError=!0;var r=new Error(t);r.errno=e,r.code=_a[e],n.emit("error",r)};var r=ga.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(r=t.level);var i=ga.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(i=t.strategy),this._binding.init(t.windowBits||ga.Z_DEFAULT_WINDOWBITS,r,t.memLevel||ga.Z_DEFAULT_MEMLEVEL,i,t.dictionary),this._buffer=new Dt(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once("end",this.close)}Object.keys(_a).forEach((function(t){_a[_a[t]]=t})),Je(Ga,Ir),Ga.prototype.params=function(t,e,n){if(t<ga.Z_MIN_LEVEL||t>ga.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(e!=ga.Z_FILTERED&&e!=ga.Z_HUFFMAN_ONLY&&e!=ga.Z_RLE&&e!=ga.Z_FIXED&&e!=ga.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+e);if(this._level!==t||this._strategy!==e){var r=this;this.flush(ga.Z_SYNC_FLUSH,(function(){r._binding.params(t,e),r._hadError||(r._level=t,r._strategy=e,n&&n())}))}else Ve.nextTick(n)},Ga.prototype.reset=function(){return this._binding.reset()},Ga.prototype._flush=function(t){this._transform(new Dt(0),"",t)},Ga.prototype.flush=function(t,e){var n=this._writableState;if(("function"==typeof t||void 0===t&&!e)&&(e=t,t=ga.Z_FULL_FLUSH),n.ended)e&&Ve.nextTick(e);else if(n.ending)e&&this.once("end",e);else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(e)}))}else this._flushFlag=t,this.write(new Dt(0),"",e)},Ga.prototype.close=function(t){if(t&&Ve.nextTick(t),!this._closed){this._closed=!0,this._binding.close();var e=this;Ve.nextTick((function(){e.emit("close")}))}},Ga.prototype._transform=function(t,e,n){var r,i=this._writableState,o=(i.ending||i.ended)&&(!t||i.length===t.length);if(null===!t&&!Dt.isBuffer(t))return n(new Error("invalid input"));o?r=ga.Z_FINISH:(r=this._flushFlag,t.length>=i.length&&(this._flushFlag=this._opts.flush||ga.Z_NO_FLUSH)),this._processChunk(t,r,n)},Ga.prototype._processChunk=function(t,e,n){var r=t&&t.length,i=this._chunkSize-this._offset,o=0,a=this,s="function"==typeof n;if(!s){var h,l=[],u=0;this.on("error",(function(t){h=t}));do{var f=this._binding.writeSync(e,t,o,r,this._buffer,this._offset,i)}while(!this._hadError&&p(f[0],f[1]));if(this._hadError)throw h;var c=Dt.concat(l,u);return this.close(),c}var d=this._binding.write(e,t,o,r,this._buffer,this._offset,i);function p(h,f){if(!a._hadError){var c=i-f;if(function(t,e){if(!t)throw new Error(e)}(c>=0,"have should not go down"),c>0){var d=a._buffer.slice(a._offset,a._offset+c);a._offset+=c,s?a.push(d):(l.push(d),u+=d.length)}if((0===f||a._offset>=a._chunkSize)&&(i=a._chunkSize,a._offset=0,a._buffer=new Dt(a._chunkSize)),0===f){if(o+=r-h,r=h,!s)return!0;var g=a._binding.write(e,t,o,r,a._buffer,a._offset,a._chunkSize);return g.callback=p,void(g.buffer=t)}if(!s)return!1;n()}}d.buffer=t,d.callback=p},Je(Fa,Ga),Je(Ya,Ga),Je(ja,Ga),Je(Za,Ga),Je(Ha,Ga),Je(Wa,Ga),Je(qa,Ga);var Va={codes:_a,createDeflate:wa,createInflate:ma,createDeflateRaw:ba,createInflateRaw:ya,createGzip:va,createGunzip:Ea,createUnzip:ka,deflate:Ta,deflateSync:Ra,gzip:Aa,gzipSync:La,deflateRaw:xa,deflateRawSync:Sa,unzip:Ca,unzipSync:Ia,inflate:Oa,inflateSync:Pa,gunzip:Ma,gunzipSync:Ba,inflateRaw:Da,inflateRawSync:za,Deflate:Fa,Inflate:Ya,Gzip:ja,Gunzip:Za,DeflateRaw:Ha,InflateRaw:Wa,Unzip:qa,Zlib:Ga},Ka=e(Object.freeze({__proto__:null,Deflate:Fa,DeflateRaw:Ha,Gunzip:Za,Gzip:ja,Inflate:Ya,InflateRaw:Wa,Unzip:qa,Zlib:Ga,codes:_a,createDeflate:wa,createDeflateRaw:ba,createGunzip:Ea,createGzip:va,createInflate:ma,createInflateRaw:ya,createUnzip:ka,default:Va,deflate:Ta,deflateRaw:xa,deflateRawSync:Sa,deflateSync:Ra,gunzip:Ma,gunzipSync:Ba,gzip:Aa,gzipSync:La,inflate:Oa,inflateRaw:Da,inflateRawSync:za,inflateSync:Pa,unzip:Ca,unzipSync:Ia})),Ja={exports:{}};let Xa=zn,Qa=Br,$a=Ja.exports=function(){Qa.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};Xa.inherits($a,Qa),$a.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),Ve.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},$a.prototype.write=function(t,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let n;return n=Dt.isBuffer(t)?t:Dt.from(t,e||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused},$a.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},$a.prototype.destroySoon=$a.prototype.end,$a.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},$a.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},$a.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},$a.prototype._processRead=function(t){this._reads.shift();let e=0,n=0,r=Dt.alloc(t.length);for(;e<t.length;){let i=this._buffers[n++],o=Math.min(i.length,t.length-e);i.copy(r,e,0,o),e+=o,o!==i.length&&(this._buffers[--n]=i.slice(o))}n>0&&this._buffers.splice(0,n),this._buffered-=t.length,t.func.call(this,r)},$a.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}};var ts=Ja.exports,es={exports:{}},ns={exports:{}},rs={};let is=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];rs.getImagePasses=function(t,e){let n=[],r=t%8,i=e%8,o=(t-r)/8,a=(e-i)/8;for(let t=0;t<is.length;t++){let e=is[t],s=o*e.x.length,h=a*e.y.length;for(let t=0;t<e.x.length&&e.x[t]<r;t++)s++;for(let t=0;t<e.y.length&&e.y[t]<i;t++)h++;s>0&&h>0&&n.push({width:s,height:h,index:t})}return n},rs.getInterlaceIterator=function(t){return function(e,n,r){let i=e%is[r].x.length,o=(e-i)/is[r].x.length*8+is[r].x[i],a=n%is[r].y.length;return 4*o+((n-a)/is[r].y.length*8+is[r].y[a])*t*4}};var os=function(t,e,n){let r=t+e-n,i=Math.abs(r-t),o=Math.abs(r-e),a=Math.abs(r-n);return i<=o&&i<=a?t:o<=a?e:n};let as=rs,ss=os;function hs(t,e,n){let r=t*e;return 8!==n&&(r=Math.ceil(r/(8/n))),r}let ls=ns.exports=function(t,e){let n=t.width,r=t.height,i=t.interlace,o=t.bpp,a=t.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],i){let t=as.getImagePasses(n,r);for(let e=0;e<t.length;e++)this._images.push({byteWidth:hs(t[e].width,o,a),height:t[e].height,lineIndex:0})}else this._images.push({byteWidth:hs(n,o,a),height:r,lineIndex:0});this._xComparison=8===a?o:16===a?2*o:1};ls.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},ls.prototype._unFilterType1=function(t,e,n){let r=this._xComparison,i=r-1;for(let o=0;o<n;o++){let n=t[1+o],a=o>i?e[o-r]:0;e[o]=n+a}},ls.prototype._unFilterType2=function(t,e,n){let r=this._lastLine;for(let i=0;i<n;i++){let n=t[1+i],o=r?r[i]:0;e[i]=n+o}},ls.prototype._unFilterType3=function(t,e,n){let r=this._xComparison,i=r-1,o=this._lastLine;for(let a=0;a<n;a++){let n=t[1+a],s=o?o[a]:0,h=a>i?e[a-r]:0,l=Math.floor((h+s)/2);e[a]=n+l}},ls.prototype._unFilterType4=function(t,e,n){let r=this._xComparison,i=r-1,o=this._lastLine;for(let a=0;a<n;a++){let n=t[1+a],s=o?o[a]:0,h=a>i?e[a-r]:0,l=a>i&&o?o[a-r]:0,u=ss(h,s,l);e[a]=n+u}},ls.prototype._reverseFilterLine=function(t){let e,n=t[0],r=this._images[this._imageIndex],i=r.byteWidth;if(0===n)e=t.slice(1,i+1);else switch(e=Dt.alloc(i),n){case 1:this._unFilterType1(t,e,i);break;case 2:this._unFilterType2(t,e,i);break;case 3:this._unFilterType3(t,e,i);break;case 4:this._unFilterType4(t,e,i);break;default:throw new Error("Unrecognised filter type - "+n)}this.write(e),r.lineIndex++,r.lineIndex>=r.height?(this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex]):this._lastLine=e,r?this.read(r.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())};var us=ns.exports;let fs=zn,cs=ts,ds=us,ps=es.exports=function(t){cs.call(this);let e=[],n=this;this._filter=new ds(t,{read:this.read.bind(this),write:function(t){e.push(t)},complete:function(){n.emit("complete",Dt.concat(e))}}),this._filter.start()};fs.inherits(ps,cs);var gs=es.exports,_s={exports:{}},ws={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5},ms={exports:{}};let bs=[];!function(){for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;bs[t]=e}}();let ys=ms.exports=function(){this._crc=-1};ys.prototype.write=function(t){for(let e=0;e<t.length;e++)this._crc=bs[255&(this._crc^t[e])]^this._crc>>>8;return!0},ys.prototype.crc32=function(){return-1^this._crc},ys.crc32=function(t){let e=-1;for(let n=0;n<t.length;n++)e=bs[255&(e^t[n])]^e>>>8;return-1^e};var vs=ms.exports;let Es=ws,ks=vs,Ts=_s.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[Es.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[Es.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[Es.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[Es.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[Es.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[Es.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};Ts.prototype.start=function(){this.read(Es.PNG_SIGNATURE.length,this._parseSignature.bind(this))},Ts.prototype._parseSignature=function(t){let e=Es.PNG_SIGNATURE;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return void this.error(new Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},Ts.prototype._parseChunkBegin=function(t){let e=t.readUInt32BE(0),n=t.readUInt32BE(4),r="";for(let e=4;e<8;e++)r+=String.fromCharCode(t[e]);let i=Boolean(32&t[4]);if(this._hasIHDR||n===Es.TYPE_IHDR){if(this._crc=new ks,this._crc.write(Dt.from(r)),this._chunks[n])return this._chunks[n](e);i?this.read(e+4,this._skipChunk.bind(this)):this.error(new Error("Unsupported critical chunk type "+r))}else this.error(new Error("Expected IHDR on beggining"))},Ts.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},Ts.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},Ts.prototype._parseChunkEnd=function(t){let e=t.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==e?this.error(new Error("Crc error - "+e+" - "+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},Ts.prototype._handleIHDR=function(t){this.read(t,this._parseIHDR.bind(this))},Ts.prototype._parseIHDR=function(t){this._crc.write(t);let e=t.readUInt32BE(0),n=t.readUInt32BE(4),r=t[8],i=t[9],o=t[10],a=t[11],s=t[12];if(8!==r&&4!==r&&2!==r&&1!==r&&16!==r)return void this.error(new Error("Unsupported bit depth "+r));if(!(i in Es.COLORTYPE_TO_BPP_MAP))return void this.error(new Error("Unsupported color type"));if(0!==o)return void this.error(new Error("Unsupported compression method"));if(0!==a)return void this.error(new Error("Unsupported filter method"));if(0!==s&&1!==s)return void this.error(new Error("Unsupported interlace method"));this._colorType=i;let h=Es.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:n,depth:r,interlace:Boolean(s),palette:Boolean(i&Es.COLORTYPE_PALETTE),color:Boolean(i&Es.COLORTYPE_COLOR),alpha:Boolean(i&Es.COLORTYPE_ALPHA),bpp:h,colorType:i}),this._handleChunkEnd()},Ts.prototype._handlePLTE=function(t){this.read(t,this._parsePLTE.bind(this))},Ts.prototype._parsePLTE=function(t){this._crc.write(t);let e=Math.floor(t.length/3);for(let n=0;n<e;n++)this._palette.push([t[3*n],t[3*n+1],t[3*n+2],255]);this.palette(this._palette),this._handleChunkEnd()},Ts.prototype._handleTRNS=function(t){this.simpleTransparency(),this.read(t,this._parseTRNS.bind(this))},Ts.prototype._parseTRNS=function(t){if(this._crc.write(t),this._colorType===Es.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(new Error("Transparency chunk must be after palette"));if(t.length>this._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(let e=0;e<t.length;e++)this._palette[e][3]=t[e];this.palette(this._palette)}this._colorType===Es.COLORTYPE_GRAYSCALE&&this.transColor([t.readUInt16BE(0)]),this._colorType===Es.COLORTYPE_COLOR&&this.transColor([t.readUInt16BE(0),t.readUInt16BE(2),t.readUInt16BE(4)]),this._handleChunkEnd()},Ts.prototype._handleGAMA=function(t){this.read(t,this._parseGAMA.bind(this))},Ts.prototype._parseGAMA=function(t){this._crc.write(t),this.gamma(t.readUInt32BE(0)/Es.GAMMA_DIVISION),this._handleChunkEnd()},Ts.prototype._handleIDAT=function(t){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-t,this._parseIDAT.bind(this,t))},Ts.prototype._parseIDAT=function(t,e){if(this._crc.write(e),this._colorType===Es.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw new Error("Expected palette not found");this.inflateData(e);let n=t-e.length;n>0?this._handleIDAT(n):this._handleChunkEnd()},Ts.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},Ts.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()};var Rs=_s.exports,As={};let Ls=rs,xs=[function(){},function(t,e,n,r){if(r===e.length)throw new Error("Ran out of data");let i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=255},function(t,e,n,r){if(r+1>=e.length)throw new Error("Ran out of data");let i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=e[r+1]},function(t,e,n,r){if(r+2>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=255},function(t,e,n,r){if(r+3>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=e[r+3]}],Ss=[function(){},function(t,e,n,r){let i=e[0];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=r},function(t,e,n){let r=e[0];t[n]=r,t[n+1]=r,t[n+2]=r,t[n+3]=e[1]},function(t,e,n,r){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=r},function(t,e,n){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3]}];function Cs(t,e,n,r,i,o){let a=t.width,s=t.height,h=t.index;for(let t=0;t<s;t++)for(let s=0;s<a;s++){let a=n(s,t,h);xs[r](e,i,a,o),o+=r}return o}function Is(t,e,n,r,i,o){let a=t.width,s=t.height,h=t.index;for(let t=0;t<s;t++){for(let s=0;s<a;s++){let a=i.get(r),l=n(s,t,h);Ss[r](e,a,l,o)}i.resetAfterLine()}}As.dataToBitMap=function(t,e){let n,r,i=e.width,o=e.height,a=e.depth,s=e.bpp,h=e.interlace;8!==a&&(n=function(t,e){let n=[],r=0;function i(){if(r===t.length)throw new Error("Ran out of data");let i,o,a,s,h,l,u,f,c=t[r];switch(r++,e){default:throw new Error("unrecognised depth");case 16:u=t[r],r++,n.push((c<<8)+u);break;case 4:u=15&c,f=c>>4,n.push(f,u);break;case 2:h=3&c,l=c>>2&3,u=c>>4&3,f=c>>6&3,n.push(f,u,l,h);break;case 1:i=1&c,o=c>>1&1,a=c>>2&1,s=c>>3&1,h=c>>4&1,l=c>>5&1,u=c>>6&1,f=c>>7&1,n.push(f,u,l,h,s,a,o,i)}}return{get:function(t){for(;n.length<t;)i();let e=n.slice(0,t);return n=n.slice(t),e},resetAfterLine:function(){n.length=0},end:function(){if(r!==t.length)throw new Error("extra data found")}}}(t,a)),r=a<=8?Dt.alloc(i*o*4):new Uint16Array(i*o*4);let l,u,f=Math.pow(2,a)-1,c=0;if(h)l=Ls.getImagePasses(i,o),u=Ls.getInterlaceIterator(i,o);else{let t=0;u=function(){let e=t;return t+=4,e},l=[{width:i,height:o}]}for(let e=0;e<l.length;e++)8===a?c=Cs(l[e],r,u,s,t,c):Is(l[e],r,u,s,n,f);if(8===a){if(c!==t.length)throw new Error("extra data found")}else n.end();return r};var Os=function(t,e){let n=e.depth,r=e.width,i=e.height,o=e.colorType,a=e.transColor,s=e.palette,h=t;return 3===o?function(t,e,n,r,i){let o=0;for(let a=0;a<r;a++)for(let r=0;r<n;r++){let n=i[t[o]];if(!n)throw new Error("index "+t[o]+" not in palette");for(let t=0;t<4;t++)e[o+t]=n[t];o+=4}}(t,h,r,i,s):(a&&function(t,e,n,r,i){let o=0;for(let a=0;a<r;a++)for(let r=0;r<n;r++){let n=!1;if(1===i.length?i[0]===t[o]&&(n=!0):i[0]===t[o]&&i[1]===t[o+1]&&i[2]===t[o+2]&&(n=!0),n)for(let t=0;t<4;t++)e[o+t]=0;o+=4}}(t,h,r,i,a),8!==n&&(16===n&&(h=Dt.alloc(r*i*4)),function(t,e,n,r,i){let o=Math.pow(2,i)-1,a=0;for(let i=0;i<r;i++)for(let r=0;r<n;r++){for(let n=0;n<4;n++)e[a+n]=Math.floor(255*t[a+n]/o+.5);a+=4}}(t,h,r,i,n))),h};let Ps=zn,Ms=Ka,Bs=ts,Ds=gs,zs=Rs,Ns=As,Us=Os,Fs=Dr.exports=function(t){Bs.call(this),this._parser=new zs(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};Ps.inherits(Fs,Bs),Fs.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},Fs.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=Ms.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,e=Math.max(t,Ms.Z_MIN_CHUNK);this._inflate=Ms.createInflate({chunkSize:e});let n=t,r=this.emit.bind(this,"error");this._inflate.on("error",(function(t){n&&r(t)})),this._filter.on("complete",this._complete.bind(this));let i=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){n&&(t.length>n&&(t=t.slice(0,n)),n-=t.length,i(t))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)},Fs.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new Ds(this._bitmapInfo)},Fs.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},Fs.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},Fs.prototype._simpleTransparency=function(){this._metaData.alpha=!0},Fs.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},Fs.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},Fs.prototype._complete=function(t){if(this.errord)return;let e;try{let n=Ns.dataToBitMap(t,this._bitmapInfo);e=Us(n,this._bitmapInfo),n=null}catch(t){return void this._handleError(t)}this.emit("parsed",e)};var Ys=Dr.exports,js={exports:{}},Zs={exports:{}};let Hs=ws;let Ws=os;let qs={0:function(t,e,n,r,i){for(let o=0;o<n;o++)r[i+o]=t[e+o]},1:function(t,e,n,r,i,o){for(let a=0;a<n;a++){let n=a>=o?t[e+a-o]:0,s=t[e+a]-n;r[i+a]=s}},2:function(t,e,n,r,i){for(let o=0;o<n;o++){let a=e>0?t[e+o-n]:0,s=t[e+o]-a;r[i+o]=s}},3:function(t,e,n,r,i,o){for(let a=0;a<n;a++){let s=a>=o?t[e+a-o]:0,h=e>0?t[e+a-n]:0,l=t[e+a]-(s+h>>1);r[i+a]=l}},4:function(t,e,n,r,i,o){for(let a=0;a<n;a++){let s=a>=o?t[e+a-o]:0,h=e>0?t[e+a-n]:0,l=e>0&&a>=o?t[e+a-(n+o)]:0,u=t[e+a]-Ws(s,h,l);r[i+a]=u}}},Gs={0:function(t,e,n){let r=0,i=e+n;for(let n=e;n<i;n++)r+=Math.abs(t[n]);return r},1:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let n=o>=r?t[e+o-r]:0,a=t[e+o]-n;i+=Math.abs(a)}return i},2:function(t,e,n){let r=0,i=e+n;for(let o=e;o<i;o++){let i=e>0?t[o-n]:0,a=t[o]-i;r+=Math.abs(a)}return r},3:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let a=o>=r?t[e+o-r]:0,s=e>0?t[e+o-n]:0,h=t[e+o]-(a+s>>1);i+=Math.abs(h)}return i},4:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let a=o>=r?t[e+o-r]:0,s=e>0?t[e+o-n]:0,h=e>0&&o>=r?t[e+o-(n+r)]:0,l=t[e+o]-Ws(a,s,h);i+=Math.abs(l)}return i}};let Vs=ws,Ks=vs,Js=function(t,e,n,r){let i=-1!==[Hs.COLORTYPE_COLOR_ALPHA,Hs.COLORTYPE_ALPHA].indexOf(r.colorType);if(r.colorType===r.inputColorType){let e=function(){let t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256!==new Int16Array(t)[0]}();if(8===r.bitDepth||16===r.bitDepth&&e)return t}let o=16!==r.bitDepth?t:new Uint16Array(t.buffer),a=255,s=Hs.COLORTYPE_TO_BPP_MAP[r.inputColorType];4!==s||r.inputHasAlpha||(s=3);let h=Hs.COLORTYPE_TO_BPP_MAP[r.colorType];16===r.bitDepth&&(a=65535,h*=2);let l=Dt.alloc(e*n*h),u=0,f=0,c=r.bgColor||{};function d(){let t,e,n,s=a;switch(r.inputColorType){case Hs.COLORTYPE_COLOR_ALPHA:s=o[u+3],t=o[u],e=o[u+1],n=o[u+2];break;case Hs.COLORTYPE_COLOR:t=o[u],e=o[u+1],n=o[u+2];break;case Hs.COLORTYPE_ALPHA:s=o[u+1],t=o[u],e=t,n=t;break;case Hs.COLORTYPE_GRAYSCALE:t=o[u],e=t,n=t;break;default:throw new Error("input color type:"+r.inputColorType+" is not supported at present")}return r.inputHasAlpha&&(i||(s/=a,t=Math.min(Math.max(Math.round((1-s)*c.red+s*t),0),a),e=Math.min(Math.max(Math.round((1-s)*c.green+s*e),0),a),n=Math.min(Math.max(Math.round((1-s)*c.blue+s*n),0),a))),{red:t,green:e,blue:n,alpha:s}}void 0===c.red&&(c.red=a),void 0===c.green&&(c.green=a),void 0===c.blue&&(c.blue=a);for(let t=0;t<n;t++)for(let t=0;t<e;t++){let t=d();switch(r.colorType){case Hs.COLORTYPE_COLOR_ALPHA:case Hs.COLORTYPE_COLOR:8===r.bitDepth?(l[f]=t.red,l[f+1]=t.green,l[f+2]=t.blue,i&&(l[f+3]=t.alpha)):(l.writeUInt16BE(t.red,f),l.writeUInt16BE(t.green,f+2),l.writeUInt16BE(t.blue,f+4),i&&l.writeUInt16BE(t.alpha,f+6));break;case Hs.COLORTYPE_ALPHA:case Hs.COLORTYPE_GRAYSCALE:{let e=(t.red+t.green+t.blue)/3;8===r.bitDepth?(l[f]=e,i&&(l[f+1]=t.alpha)):(l.writeUInt16BE(e,f),i&&l.writeUInt16BE(t.alpha,f+2));break}default:throw new Error("unrecognised color Type "+r.colorType)}u+=s,f+=h}return l},Xs=function(t,e,n,r,i){let o;if("filterType"in r&&-1!==r.filterType){if("number"!=typeof r.filterType)throw new Error("unrecognised filter types");o=[r.filterType]}else o=[0,1,2,3,4];16===r.bitDepth&&(i*=2);let a=e*i,s=0,h=0,l=Dt.alloc((a+1)*n),u=o[0];for(let e=0;e<n;e++){if(o.length>1){let e=1/0;for(let n=0;n<o.length;n++){let r=Gs[o[n]](t,h,a,i);r<e&&(u=o[n],e=r)}}l[s]=u,s++,qs[u](t,h,a,l,s,i),s+=a,h+=a}return l},Qs=Ka,$s=Zs.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||Qs.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:Vs.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:Vs.COLORTYPE_COLOR_ALPHA,-1===[Vs.COLORTYPE_GRAYSCALE,Vs.COLORTYPE_COLOR,Vs.COLORTYPE_COLOR_ALPHA,Vs.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[Vs.COLORTYPE_GRAYSCALE,Vs.COLORTYPE_COLOR,Vs.COLORTYPE_COLOR_ALPHA,Vs.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};$s.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},$s.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},$s.prototype.filterData=function(t,e,n){let r=Js(t,e,n,this._options),i=Vs.COLORTYPE_TO_BPP_MAP[this._options.colorType];return Xs(r,e,n,this._options,i)},$s.prototype._packChunk=function(t,e){let n=e?e.length:0,r=Dt.alloc(n+12);return r.writeUInt32BE(n,0),r.writeUInt32BE(t,4),e&&e.copy(r,8),r.writeInt32BE(Ks.crc32(r.slice(4,r.length-4)),r.length-4),r},$s.prototype.packGAMA=function(t){let e=Dt.alloc(4);return e.writeUInt32BE(Math.floor(t*Vs.GAMMA_DIVISION),0),this._packChunk(Vs.TYPE_gAMA,e)},$s.prototype.packIHDR=function(t,e){let n=Dt.alloc(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(Vs.TYPE_IHDR,n)},$s.prototype.packIDAT=function(t){return this._packChunk(Vs.TYPE_IDAT,t)},$s.prototype.packIEND=function(){return this._packChunk(Vs.TYPE_IEND,null)};var th=Zs.exports;let eh=zn,nh=Br,rh=ws,ih=th,oh=js.exports=function(t){nh.call(this);let e=t||{};this._packer=new ih(e),this._deflate=this._packer.createDeflate(),this.readable=!0};eh.inherits(oh,nh),oh.prototype.pack=function(t,e,n,r){this.emit("data",Dt.from(rh.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,n)),r&&this.emit("data",this._packer.packGAMA(r));let i=this._packer.filterData(t,e,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(i)};var ah=js.exports,sh={},hh={exports:{}};function lh(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0}var uh,fh=Object.prototype.hasOwnProperty,ch=Object.keys||function(t){var e=[];for(var n in t)fh.call(t,n)&&e.push(n);return e},dh=Array.prototype.slice;function ph(){return void 0!==uh?uh:uh="foo"===function(){}.name}function gh(t){return Object.prototype.toString.call(t)}function _h(t){return!be(t)&&("function"==typeof vt.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function wh(t,e){t||kh(t,!0,e,"==",Th)}var mh=/\s*function\s+([^\(\s]*)\s*/;function bh(t){if(kn(t)){if(ph())return t.name;var e=t.toString().match(mh);return e&&e[1]}}function yh(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return vh(Eh(t.actual),128)+" "+t.operator+" "+vh(Eh(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||kh;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=bh(e),o=r.indexOf("\n"+i);if(o>=0){var a=r.indexOf("\n",o+1);r=r.substring(a+1)}this.stack=r}}}function vh(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function Eh(t){if(ph()||!kn(t))return on(t);var e=bh(t);return"[Function"+(e?": "+e:"")+"]"}function kh(t,e,n,r,i){throw new yh({message:n,actual:t,expected:e,operator:r,stackStartFunction:i})}function Th(t,e){t||kh(t,!0,e,"==",Th)}function Rh(t,e,n){t!=e&&kh(t,e,n,"==",Rh)}function Ah(t,e,n){t==e&&kh(t,e,n,"!=",Ah)}function Lh(t,e,n){Sh(t,e,!1)||kh(t,e,n,"deepEqual",Lh)}function xh(t,e,n){Sh(t,e,!0)||kh(t,e,n,"deepStrictEqual",xh)}function Sh(t,e,n,r){if(t===e)return!0;if(be(t)&&be(e))return 0===lh(t,e);if(vn(t)&&vn(e))return t.getTime()===e.getTime();if(bn(t)&&bn(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(_h(t)&&_h(e)&&gh(t)===gh(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===lh(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(be(t)!==be(e))return!1;var i=(r=r||{actual:[],expected:[]}).actual.indexOf(t);return-1!==i&&i===r.expected.indexOf(e)||(r.actual.push(t),r.expected.push(e),function(t,e,n,r){if(null==t||null==e)return!1;if(Tn(t)||Tn(e))return t===e;if(n&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=Ch(t),o=Ch(e);if(i&&!o||!i&&o)return!1;if(i)return Sh(t=dh.call(t),e=dh.call(e),n);var a,s,h=ch(t),l=ch(e);if(h.length!==l.length)return!1;for(h.sort(),l.sort(),s=h.length-1;s>=0;s--)if(h[s]!==l[s])return!1;for(s=h.length-1;s>=0;s--)if(!Sh(t[a=h[s]],e[a],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function Ch(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function Ih(t,e,n){Sh(t,e,!1)&&kh(t,e,n,"notDeepEqual",Ih)}function Oh(t,e,n){Sh(t,e,!0)&&kh(t,e,n,"notDeepStrictEqual",Oh)}function Ph(t,e,n){t!==e&&kh(t,e,n,"===",Ph)}function Mh(t,e,n){t===e&&kh(t,e,n,"!==",Mh)}function Bh(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function Dh(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&kh(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!t&&i&&!n;if((!t&&En(i)&&o&&Bh(i,n)||a)&&kh(i,n,"Got unwanted exception"+r),t&&i&&n&&!Bh(i,n)||!t&&i)throw i}function zh(t,e,n){Dh(!0,t,e,n)}function Nh(t,e,n){Dh(!1,t,e,n)}function Uh(t){if(t)throw t}wh.AssertionError=yh,Je(yh,Error),wh.fail=kh,wh.ok=Th,wh.equal=Rh,wh.notEqual=Ah,wh.deepEqual=Lh,wh.deepStrictEqual=xh,wh.notDeepEqual=Ih,wh.notDeepStrictEqual=Oh,wh.strictEqual=Ph,wh.notStrictEqual=Mh,wh.throws=zh,wh.doesNotThrow=Nh,wh.ifError=Uh;var Fh=e(Object.freeze({__proto__:null,AssertionError:yh,assert:Th,deepEqual:Lh,deepStrictEqual:xh,default:wh,doesNotThrow:Nh,equal:Rh,fail:kh,ifError:Uh,notDeepEqual:Ih,notDeepStrictEqual:Oh,notEqual:Ah,notStrictEqual:Mh,ok:Th,strictEqual:Ph,throws:zh})),Yh=e(ve);!function(t,e){let n=Fh.ok,r=Ka,i=zn,o=Yh.kMaxLength;function a(t){if(!(this instanceof a))return new a(t);t&&t.chunkSize<r.Z_MIN_CHUNK&&(t.chunkSize=r.Z_MIN_CHUNK),r.Inflate.call(this,t),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,t&&null!=t.maxLength&&(this._maxLength=t.maxLength)}function s(t,e){e&&Ve.nextTick(e),t._handle&&(t._handle.close(),t._handle=null)}function h(t,e){return function(t,e){if("string"==typeof e&&(e=Dt.from(e)),!(e instanceof Dt))throw new TypeError("Not a string or buffer");let n=t._finishFlushFlag;return null==n&&(n=r.Z_FINISH),t._processChunk(e,n)}(new a(e),t)}a.prototype._processChunk=function(t,e,i){if("function"==typeof i)return r.Inflate._processChunk.call(this,t,e,i);let a,h,l=this,u=t&&t.length,f=this._chunkSize-this._offset,c=this._maxLength,d=0,p=[],g=0;function _(t,e){if(l._hadError)return;let r=f-e;if(n(r>=0,"have should not go down"),r>0){let t=l._buffer.slice(l._offset,l._offset+r);if(l._offset+=r,t.length>c&&(t=t.slice(0,c)),p.push(t),g+=t.length,c-=t.length,0===c)return!1}return(0===e||l._offset>=l._chunkSize)&&(f=l._chunkSize,l._offset=0,l._buffer=Dt.allocUnsafe(l._chunkSize)),0===e&&(d+=u-t,u=t,!0)}this.on("error",(function(t){a=t})),n(this._handle,"zlib binding closed");do{h=this._handle.writeSync(e,t,d,u,this._buffer,this._offset,f),h=h||this._writeState}while(!this._hadError&&_(h[0],h[1]));if(this._hadError)throw a;if(g>=o)throw s(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+o.toString(16)+" bytes");let w=Dt.concat(p,g);return s(this),w},i.inherits(a,r.Inflate),t.exports=e=h,e.Inflate=a,e.createInflate=function(t){return new a(t)},e.inflateSync=h}(hh,hh.exports);var jh=hh.exports,Zh={exports:{}};let Hh=Zh.exports=function(t){this._buffer=t,this._reads=[]};Hh.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})},Hh.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;{this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0};var Wh=Zh.exports,qh={};let Gh=Wh,Vh=us;qh.process=function(t,e){let n=[],r=new Gh(t);return new Vh(e,{read:r.read.bind(r),write:function(t){n.push(t)},complete:function(){}}).start(),r.process(),Dt.concat(n)};let Kh=!0,Jh=Ka,Xh=jh;Jh.deflateSync||(Kh=!1);let Qh=Wh,$h=qh,tl=Rs,el=As,nl=Os;let rl=!0,il=Ka;il.deflateSync||(rl=!1);let ol=ws,al=th;let sl=function(t,e){if(!Kh)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n,r,i;let o=[];let a=new Qh(t),s=new tl(e,{read:a.read.bind(a),error:function(t){n=t},metadata:function(t){r=t},gamma:function(t){i=t},palette:function(t){r.palette=t},transColor:function(t){r.transColor=t},inflateData:function(t){o.push(t)},simpleTransparency:function(){r.alpha=!0}});if(s.start(),a.process(),n)throw n;let h,l=Dt.concat(o);if(o.length=0,r.interlace)h=Jh.inflateSync(l);else{let t=(1+(r.width*r.bpp*r.depth+7>>3))*r.height;h=Xh(l,{chunkSize:t,maxLength:t})}if(l=null,!h||!h.length)throw new Error("bad png - invalid inflate data response");let u=$h.process(h,r);l=null;let f=el.dataToBitMap(u,r);u=null;let c=nl(f,r);return r.data=c,r.gamma=i||0,r},hl=function(t,e){if(!rl)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n=new al(e||{}),r=[];r.push(Dt.from(ol.PNG_SIGNATURE)),r.push(n.packIHDR(t.width,t.height)),t.gamma&&r.push(n.packGAMA(t.gamma));let i=n.filterData(t.data,t.width,t.height),o=il.deflateSync(i,n.getDeflateOptions());if(i=null,!o||!o.length)throw new Error("bad png - invalid compressed data response");return r.push(n.packIDAT(o)),r.push(n.packIEND()),Dt.concat(r)};sh.read=function(t,e){return sl(t,e||{})},sh.write=function(t,e){return hl(t,e)};let ll=zn,ul=Br,fl=Ys,cl=ah,dl=sh,pl=Ke.PNG=function(t){ul.call(this),t=t||{},this.width=0|t.width,this.height=0|t.height,this.data=this.width>0&&this.height>0?Dt.alloc(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new fl(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new cl(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};ll.inherits(pl,ul),pl.sync=dl,pl.prototype.pack=function(){return this.data&&this.data.length?(Ve.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},pl.prototype.parse=function(t,e){if(e){let t,n;t=function(t){this.removeListener("error",n),this.data=t,e(null,this)}.bind(this),n=function(n){this.removeListener("parsed",t),e(n,null)}.bind(this),this.once("parsed",t),this.once("error",n)}return this.end(t),this},pl.prototype.write=function(t){return this._parser.write(t),!0},pl.prototype.end=function(t){this._parser.end(t)},pl.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},pl.prototype._gamma=function(t){this.gamma=t},pl.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},pl.bitblt=function(t,e,n,r,i,o,a,s){if(r|=0,i|=0,o|=0,a|=0,s|=0,(n|=0)>t.width||r>t.height||n+i>t.width||r+o>t.height)throw new Error("bitblt reading outside image");if(a>e.width||s>e.height||a+i>e.width||s+o>e.height)throw new Error("bitblt writing outside image");for(let h=0;h<o;h++)t.data.copy(e.data,(s+h)*e.width+a<<2,(r+h)*t.width+n<<2,(r+h)*t.width+n+i<<2)},pl.prototype.bitblt=function(t,e,n,r,i,o,a){return pl.bitblt(this,t,e,n,r,i,o,a),this},pl.adjustGamma=function(t){if(t.gamma){for(let e=0;e<t.height;e++)for(let n=0;n<t.width;n++){let r=t.width*e+n<<2;for(let e=0;e<3;e++){let n=t.data[r+e]/255;n=Math.pow(n,1/2.2/t.gamma),t.data[r+e]=Math.round(255*n)}}t.gamma=0}},pl.prototype.adjustGamma=function(){pl.adjustGamma(this)};var gl={};!function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map((function(t){return[t,t]})))),6===e.length&&e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const i=n.modules.size,o=n.modules.data,a=t.getScale(i,r),s=Math.floor((i+2*r.margin)*a),h=r.margin*a,l=[r.color.light,r.color.dark];for(let t=0;t<s;t++)for(let n=0;n<s;n++){let u=4*(t*s+n),f=r.color.light;if(t>=h&&n>=h&&t<s-h&&n<s-h){f=l[o[Math.floor((t-h)/a)*i+Math.floor((n-h)/a)]?1:0]}e[u++]=f.r,e[u++]=f.g,e[u++]=f.b,e[u]=f.a}}}(gl),function(t){const e=ke,n=Ke.PNG,r=gl;t.render=function(t,e){const i=r.getOptions(e),o=i.rendererOpts,a=r.getImageWidth(t.modules.size,i);o.width=a,o.height=a;const s=new n(o);return r.qrToImageData(s.data,t,i),s},t.renderToDataURL=function(e,n,r){void 0===r&&(r=n,n=void 0),t.renderToBuffer(e,n,(function(t,e){t&&r(t);let n="data:image/png;base64,";n+=e.toString("base64"),r(null,n)}))},t.renderToBuffer=function(e,n,r){void 0===r&&(r=n,n=void 0);const i=t.render(e,n),o=[];i.on("error",r),i.on("data",(function(t){o.push(t)})),i.on("end",(function(){r(null,Dt.concat(o))})),i.pack()},t.renderToFile=function(n,r,i,o){void 0===o&&(o=i,i=void 0);let a=!1;const s=(...t)=>{a||(a=!0,o.apply(null,t))},h=e.createWriteStream(n);h.on("error",s),h.on("close",s),t.renderToFileStream(h,r,i)},t.renderToFileStream=function(e,n,r){t.render(n,r).pack().pipe(e)}}(Ee);var _l={};!function(t){const e=gl,n={WW:" ",WB:"▄",BB:"█",BW:"▀"},r={BB:" ",BW:"▄",WW:"█",WB:"▀"};function i(t,e,n){return t&&e?n.BB:t&&!e?n.BW:!t&&e?n.WB:n.WW}t.render=function(t,o,a){const s=e.getOptions(o);let h=n;"#ffffff"!==s.color.dark.hex&&"#000000"!==s.color.light.hex||(h=r);const l=t.modules.size,u=t.modules.data;let f="",c=Array(l+2*s.margin+1).join(h.WW);c=Array(s.margin/2+1).join(c+"\n");const d=Array(s.margin+1).join(h.WW);f+=c;for(let t=0;t<l;t+=2){f+=d;for(let e=0;e<l;e++){f+=i(u[t*l+e],u[(t+1)*l+e],h)}f+=d+"\n"}return f+=c.slice(0,-1),"function"==typeof a&&a(null,f),f},t.renderToFile=function(e,n,r,i){void 0===i&&(i=r,r=void 0);const o=ke,a=t.render(n,r);o.writeFile(e,a,i)}}(_l);var wl={},ml={render:function(t,e,n){const r=t.modules.size,i=t.modules.data,o=" ";let a="";const s=Array(r+3).join(o),h=Array(2).join(o);a+=s+"\n";for(let t=0;t<r;++t){a+=o;for(let e=0;e<r;e++)a+=i[t*r+e]?" ":o;a+=h+"\n"}return a+=s+"\n","function"==typeof n&&n(null,a),a}},bl={};const yl="",vl="",El="",kl=""+vl,Tl=""+yl,Rl=function(t,e,n,r){const i=e+1;if(n>=i||r>=i||r<-1||n<-1)return"0";if(n>=e||r>=e||r<0||n<0)return"1";return t[r*e+n]?"2":"1"},Al=function(t,e,n,r){return Rl(t,e,n,r)+Rl(t,e,n,r+1)};bl.render=function(t,e,n){const r=t.modules.size,i=t.modules.data,o=!(!e||!e.inverse),a=e&&e.inverse?Tl:kl,s=function(t,e,n){return{"00":El+" "+t,"01":El+e+"▄"+t,"02":El+n+"▄"+t,10:El+e+"▀"+t,11:" ",12:"▄",20:El+n+"▀"+t,21:"▀",22:"█"}}(a,o?vl:yl,o?yl:vl),h=El+"\n"+a;let l=a;for(let t=-1;t<r+1;t+=2){for(let e=-1;e<r;e++)l+=s[Al(i,r,e,t)];l+=s[Al(i,r,r,t)]+h}return l+=El,"function"==typeof n&&n(null,l),l};const Ll=ml,xl=bl;wl.render=function(t,e,n){return e&&e.small?xl.render(t,e,n):Ll.render(t,e,n)};var Sl={},Cl={};const Il=gl;function Ol(t,e){const n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function Pl(t,e,n){let r=t+e;return void 0!==n&&(r+=" "+n),r}Cl.render=function(t,e,n){const r=Il.getOptions(e),i=t.modules.size,o=t.modules.data,a=i+2*r.margin,s=r.color.light.a?"<path "+Ol(r.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",h="<path "+Ol(r.color.dark,"stroke")+' d="'+function(t,e,n){let r="",i=0,o=!1,a=0;for(let s=0;s<t.length;s++){const h=Math.floor(s%e),l=Math.floor(s/e);h||o||(o=!0),t[s]?(a++,s>0&&h>0&&t[s-1]||(r+=o?Pl("M",h+n,.5+l+n):Pl("m",i,0),i=0,o=!1),h+1<e&&t[s+1]||(r+=Pl("h",a),a=0)):i++}return r}(o,i,r.margin)+'"/>',l='viewBox="0 0 '+a+" "+a+'"',u='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+l+' shape-rendering="crispEdges">'+s+h+"</svg>\n";return"function"==typeof n&&n(null,u),u},function(t){const e=Cl;t.render=e.render,t.renderToFile=function(e,n,r,i){void 0===i&&(i=r,r=void 0);const o=ke,a='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+t.render(n,r);o.writeFile(e,a,i)}}(Sl);var Ml,Bl,Dl={},zl={};function Nl(){return Ml||(Ml=1,function(t){const e=gl;t.render=function(t,n,r){let i=r,o=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),i=e.getOptions(i);const a=e.getImageWidth(t.modules.size,i),s=o.getContext("2d"),h=s.createImageData(a,a);return e.qrToImageData(h.data,t,i),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(s,o,a),s.putImageData(h,0,0),o},t.renderToDataURL=function(e,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const o=t.render(e,n,i),a=i.type||"image/png",s=i.rendererOpts||{};return o.toDataURL(a,s.quality)}}(zl)),zl}const Ul=r,Fl=i,Yl=Ee,jl=_l,Zl=wl,Hl=Sl;function Wl(t,e,n){if(void 0===t)throw new Error("String required as first argument");if(void 0===n&&(n=e,e={}),"function"!=typeof n){if(!Ul())throw new Error("Callback required as last argument");e=n||{},n=null}return{opts:e,cb:n}}function ql(t){switch(t){case"svg":return Hl;case"txt":case"utf8":return jl;default:return Yl}}function Gl(t,e,n){if(!n.cb)return new Promise((function(r,i){try{const o=Fl.create(e,n.opts);return t(o,n.opts,(function(t,e){return t?i(t):r(e)}))}catch(t){i(t)}}));try{const r=Fl.create(e,n.opts);return t(r,n.opts,n.cb)}catch(t){n.cb(t)}}n.create=Fl.create,n.toCanvas=function(){if(Bl)return Dl;Bl=1;const t=r,e=i,n=Nl(),o=Cl;function a(n,r,i,o,a){const s=[].slice.call(arguments,1),h=s.length,l="function"==typeof s[h-1];if(!l&&!t())throw new Error("Callback required as last argument");if(!l){if(h<1)throw new Error("Too few arguments provided");return 1===h?(i=r,r=o=void 0):2!==h||r.getContext||(o=i,i=r,r=void 0),new Promise((function(t,a){try{const a=e.create(i,o);t(n(a,r,o))}catch(t){a(t)}}))}if(h<2)throw new Error("Too few arguments provided");2===h?(a=i,i=r,r=o=void 0):3===h&&(r.getContext&&void 0===a?(a=o,o=void 0):(a=o,o=i,i=r,r=void 0));try{const t=e.create(i,o);a(null,n(t,r,o))}catch(t){a(t)}}return Dl.create=e.create,Dl.toCanvas=a.bind(null,n.render),Dl.toDataURL=a.bind(null,n.renderToDataURL),Dl.toString=a.bind(null,(function(t,e,n){return o.render(t,n)})),Dl}().toCanvas,n.toString=function(t,e,n){const r=Wl(t,e,n),i=function(t){switch(t){case"svg":return Hl;case"terminal":return Zl;default:return jl}}(r.opts?r.opts.type:void 0);return Gl(i.render,t,r)},n.toDataURL=function(t,e,n){const r=Wl(t,e,n);return Gl(ql(r.opts.type).renderToDataURL,t,r)},n.toBuffer=function(t,e,n){const r=Wl(t,e,n);return Gl(ql(r.opts.type).renderToBuffer,t,r)},n.toFile=function(t,e,n,r){if("string"!=typeof t||"string"!=typeof e&&"object"!=typeof e)throw new Error("Invalid argument");if(arguments.length<3&&!Ul())throw new Error("Too few arguments provided");const i=Wl(e,n,r),o=i.opts.type||function(t){return t.slice(2+(t.lastIndexOf(".")-1>>>0)).toLowerCase()}(t);return Gl(ql(o).renderToFile.bind(null,t),e,i)},n.toFileStream=function(t,e,n){if(arguments.length<2)throw new Error("Too few arguments provided");const r=Wl(e,n,t.emit.bind(t,"error"));Gl(ql("png").renderToFileStream.bind(null,t),e,r)};var Vl=n;t.toDataURL=Vl.toDataURL}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__QR={})}(this,(function(t){"use strict";function e(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var n={},r=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},i={},o={};let a;const s=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];o.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},o.getSymbolTotalCodewords=function(t){return s[t]},o.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},o.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');a=t},o.isKanjiModeEnabled=function(){return void 0!==a},o.toSJIS=function(t){return a(t)};var h={};function l(){this.buffer=[],this.length=0}!function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(t){return n}}}(h),l.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var u=l;function f(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}f.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n,r&&(this.reservedBit[i]=!0)},f.prototype.get=function(t,e){return this.data[t*this.size+e]},f.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},f.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var c=f,d={};!function(t){const e=o.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),o=[r-7];for(let t=1;t<n-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),i=r.length;for(let t=0;t<i;t++)for(let e=0;e<i;e++)0===t&&0===e||0===t&&e===i-1||t===i-1&&0===e||n.push([r[t],r[e]]);return n}}(d);var p={};const g=o.getSymbolSize;p.getPositions=function(t){const e=g(t);return[[0,0],[e-7,0],[0,e-7]]};var _={};!function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,n=3,r=40,i=10;function o(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,i=0,o=0,a=null,s=null;for(let h=0;h<n;h++){i=o=0,a=s=null;for(let l=0;l<n;l++){let n=t.get(h,l);n===a?i++:(i>=5&&(r+=e+(i-5)),a=n,i=1),n=t.get(l,h),n===s?o++:(o>=5&&(r+=e+(o-5)),s=n,o=1)}i>=5&&(r+=e+(i-5)),o>=5&&(r+=e+(o-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n<e-1;n++)for(let i=0;i<e-1;i++){const e=t.get(n,i)+t.get(n,i+1)+t.get(n+1,i)+t.get(n+1,i+1);4!==e&&0!==e||r++}return r*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,i=0,o=0;for(let r=0;r<e;r++){i=o=0;for(let a=0;a<e;a++)i=i<<1&2047|t.get(r,a),a>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|t.get(a,r),a>=10&&(1488===o||93===o)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*i},t.applyMask=function(t,e){const n=e.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.isReserved(i,r)||e.xor(i,r,o(t,i,r))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let i=0,o=1/0;for(let a=0;a<r;a++){n(a),t.applyMask(a,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(a,e),r<o&&(o=r,i=a)}return i}}(_);var w={};const m=h,b=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],y=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];w.getBlocksCount=function(t,e){switch(e){case m.L:return b[4*(t-1)+0];case m.M:return b[4*(t-1)+1];case m.Q:return b[4*(t-1)+2];case m.H:return b[4*(t-1)+3];default:return}},w.getTotalCodewordsCount=function(t,e){switch(e){case m.L:return y[4*(t-1)+0];case m.M:return y[4*(t-1)+1];case m.Q:return y[4*(t-1)+2];case m.H:return y[4*(t-1)+3];default:return}};var v={},E={};const k=new Uint8Array(512),T=new Uint8Array(256);!function(){let t=1;for(let e=0;e<255;e++)k[e]=t,T[t]=e,t<<=1,256&t&&(t^=285);for(let t=255;t<512;t++)k[t]=k[t-255]}(),E.log=function(t){if(t<1)throw new Error("log("+t+")");return T[t]},E.exp=function(t){return k[t]},E.mul=function(t,e){return 0===t||0===e?0:k[T[t]+T[e]]},function(t){const e=E;t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<n.length;o++)r[i+o]^=e.mul(t[i],n[o]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let i=0;i<n.length;i++)r[i]^=e.mul(n[i],t);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=t.mul(r,new Uint8Array([1,e.exp(i)]));return r}}(v);const R=v;function A(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}A.prototype.initialize=function(t){this.degree=t,this.genPoly=R.generateECPolynomial(this.degree)},A.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const n=R.mod(e,this.genPoly),r=this.degree-n.length;if(r>0){const t=new Uint8Array(this.degree);return t.set(n,r),t}return n};var L=A,x={},S={},C={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},I={};const O="[0-9]+";let P="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";P=P.replace(/u/g,"\\u");const M="(?:(?![A-Z0-9 $%*+\\-./:]|"+P+")(?:.|[\r\n]))+";I.KANJI=new RegExp(P,"g"),I.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),I.BYTE=new RegExp(M,"g"),I.NUMERIC=new RegExp(O,"g"),I.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const B=new RegExp("^"+P+"$"),D=new RegExp("^"+O+"$"),z=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");I.testKanji=function(t){return B.test(t)},I.testNumeric=function(t){return D.test(t)},I.testAlphanumeric=function(t){return z.test(t)},function(t){const e=C,n=I;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(t){return n}}}(S),function(t){const e=o,n=w,r=h,i=S,a=C,s=e.getBCHDigit(7973);function l(t,e){return i.getCharCountIndicator(t,e)+4}function u(t,e){let n=0;return t.forEach((function(t){const r=l(t.mode,e);n+=r+t.getBitsLength()})),n}t.from=function(t,e){return a.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,o){if(!a.isValid(t))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const s=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(o===i.MIXED)return s;const h=s-l(o,t);switch(o){case i.NUMERIC:return Math.floor(h/10*3);case i.ALPHANUMERIC:return Math.floor(h/11*2);case i.KANJI:return Math.floor(h/13);case i.BYTE:default:return Math.floor(h/8)}},t.getBestVersionForData=function(e,n){let o;const a=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(u(e,r)<=t.getCapacity(r,n,i.MIXED))return r}(e,a);if(0===e.length)return 1;o=e[0]}else o=e;return function(e,n,r){for(let i=1;i<=40;i++)if(n<=t.getCapacity(i,r,e))return i}(o.mode,o.getLength(),a)},t.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-s>=0;)n^=7973<<e.getBCHDigit(n)-s;return t<<12|n}}(x);var N={};const U=o,F=U.getBCHDigit(1335);N.getEncodedBits=function(t,e){const n=t.bit<<3|e;let r=n<<10;for(;U.getBCHDigit(r)-F>=0;)r^=1335<<U.getBCHDigit(r)-F;return 21522^(n<<10|r)};var Y={};const j=S;function Z(t){this.mode=j.NUMERIC,this.data=t.toString()}Z.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},Z.prototype.getLength=function(){return this.data.length},Z.prototype.getBitsLength=function(){return Z.getBitsLength(this.data.length)},Z.prototype.write=function(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const i=this.data.length-e;i>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*i+1))};var H=Z;const W=S,q=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function G(t){this.mode=W.ALPHANUMERIC,this.data=t}G.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},G.prototype.getLength=function(){return this.data.length},G.prototype.getBitsLength=function(){return G.getBitsLength(this.data.length)},G.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*q.indexOf(this.data[e]);n+=q.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(q.indexOf(this.data[e]),6)};var V=G;const K=function(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var o=t.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?e.push(i):i<2048?(e.push(i>>6|192),e.push(63&i|128)):i<55296||i>=57344&&i<65536?(e.push(i>>12|224),e.push(i>>6&63|128),e.push(63&i|128)):i>=65536&&i<=1114111?(e.push(i>>18|240),e.push(i>>12&63|128),e.push(i>>6&63|128),e.push(63&i|128)):e.push(239,191,189)}return new Uint8Array(e).buffer},J=S;function X(t){this.mode=J.BYTE,"string"==typeof t&&(t=K(t)),this.data=new Uint8Array(t)}X.getBitsLength=function(t){return 8*t},X.prototype.getLength=function(){return this.data.length},X.prototype.getBitsLength=function(){return X.getBitsLength(this.data.length)},X.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};var Q=X;const $=S,tt=o;function et(t){this.mode=$.KANJI,this.data=t}et.getBitsLength=function(t){return 13*t},et.prototype.getLength=function(){return this.data.length},et.prototype.getBitsLength=function(){return et.getBitsLength(this.data.length)},et.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=tt.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}};var nt=et,rt={exports:{}};!function(t){var e={single_source_shortest_paths:function(t,n,r){var i={},o={};o[n]=0;var a,s,h,l,u,f,c,d=e.PriorityQueue.make();for(d.push(n,0);!d.empty();)for(h in s=(a=d.pop()).value,l=a.cost,u=t[s]||{})u.hasOwnProperty(h)&&(f=l+u[h],c=o[h],(void 0===o[h]||c>f)&&(o[h]=f,d.push(h,f),i[h]=s));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,n,r){var i=e.single_source_shortest_paths(t,n,r);return e.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var n,r=e.PriorityQueue,i={};for(n in t=t||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=e}(rt);var it=rt.exports;!function(t){const e=S,n=H,r=V,i=Q,a=nt,s=I,h=o,l=it;function u(t){return unescape(encodeURIComponent(t)).length}function f(t,e,n){const r=[];let i;for(;null!==(i=t.exec(n));)r.push({data:i[0],index:i.index,mode:e,length:i[0].length});return r}function c(t){const n=f(s.NUMERIC,e.NUMERIC,t),r=f(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let i,o;h.isKanjiModeEnabled()?(i=f(s.BYTE,e.BYTE,t),o=f(s.KANJI,e.KANJI,t)):(i=f(s.BYTE_KANJI,e.BYTE,t),o=[]);return n.concat(r,i,o).sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function d(t,o){switch(o){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return a.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function p(t,o){let s;const l=e.getBestModeForData(t);if(s=e.from(o,l),s!==e.BYTE&&s.bit<l.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(s)+".\n Suggested mode is: "+e.toString(l));switch(s!==e.KANJI||h.isKanjiModeEnabled()||(s=e.BYTE),s){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new a(t);case e.BYTE:return new i(t)}}t.fromArray=function(t){return t.reduce((function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t}),[])},t.fromString=function(n,r){const i=function(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:u(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:u(i.data)}])}}return n}(c(n,h.isKanjiModeEnabled())),o=function(t,n){const r={},i={start:{}};let o=["start"];for(let a=0;a<t.length;a++){const s=t[a],h=[];for(let t=0;t<s.length;t++){const l=s[t],u=""+a+t;h.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let t=0;t<o.length;t++){const a=o[t];r[a]&&r[a].node.mode===l.mode?(i[a][u]=d(r[a].lastCount+l.length,l.mode)-d(r[a].lastCount,l.mode),r[a].lastCount+=l.length):(r[a]&&(r[a].lastCount=l.length),i[a][u]=d(l.length,l.mode)+4+e.getCharCountIndicator(l.mode,n))}}o=h}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:r}}(i,r),a=l.find_path(o.map,"start","end"),s=[];for(let t=1;t<a.length-1;t++)s.push(o.table[a[t]].node);return t.fromArray(function(t){return t.reduce((function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(s))},t.rawSplit=function(e){return t.fromArray(c(e,h.isKanjiModeEnabled()))}}(Y);const ot=o,at=h,st=u,ht=c,lt=d,ut=p,ft=_,ct=w,dt=L,pt=x,gt=N,_t=S,wt=Y;function mt(t,e,n){const r=t.size,i=gt.getEncodedBits(e,n);let o,a;for(o=0;o<15;o++)a=1==(i>>o&1),o<6?t.set(o,8,a,!0):o<8?t.set(o+1,8,a,!0):t.set(r-15+o,8,a,!0),o<8?t.set(8,r-o-1,a,!0):o<9?t.set(8,15-o-1+1,a,!0):t.set(8,15-o-1,a,!0);t.set(r-8,8,1,!0)}function bt(t,e,n){const r=new st;n.forEach((function(e){r.put(e.mode.bit,4),r.put(e.getLength(),_t.getCharCountIndicator(e.mode,t)),e.write(r)}));const i=8*(ot.getSymbolTotalCodewords(t)-ct.getTotalCodewordsCount(t,e));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const o=(i-r.getLengthInBits())/8;for(let t=0;t<o;t++)r.put(t%2?17:236,8);return function(t,e,n){const r=ot.getSymbolTotalCodewords(e),i=ct.getTotalCodewordsCount(e,n),o=r-i,a=ct.getBlocksCount(e,n),s=r%a,h=a-s,l=Math.floor(r/a),u=Math.floor(o/a),f=u+1,c=l-u,d=new dt(c);let p=0;const g=new Array(a),_=new Array(a);let w=0;const m=new Uint8Array(t.buffer);for(let t=0;t<a;t++){const e=t<h?u:f;g[t]=m.slice(p,p+e),_[t]=d.encode(g[t]),p+=e,w=Math.max(w,e)}const b=new Uint8Array(r);let y,v,E=0;for(y=0;y<w;y++)for(v=0;v<a;v++)y<g[v].length&&(b[E++]=g[v][y]);for(y=0;y<c;y++)for(v=0;v<a;v++)b[E++]=_[v][y];return b}(r,t,e)}function yt(t,e,n,r){let i;if(Array.isArray(t))i=wt.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let r=e;if(!r){const e=wt.rawSplit(t);r=pt.getBestVersionForData(e,n)}i=wt.fromString(t,r||40)}}const o=pt.getBestVersionForData(i,n);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<o)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+o+".\n")}else e=o;const a=bt(e,n,i),s=ot.getSymbolSize(e),h=new ht(s);return function(t,e){const n=t.size,r=ut.getPositions(e);for(let e=0;e<r.length;e++){const i=r[e][0],o=r[e][1];for(let e=-1;e<=7;e++)if(!(i+e<=-1||n<=i+e))for(let r=-1;r<=7;r++)o+r<=-1||n<=o+r||(e>=0&&e<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===e||6===e)||e>=2&&e<=4&&r>=2&&r<=4?t.set(i+e,o+r,!0,!0):t.set(i+e,o+r,!1,!0))}}(h,e),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(h),function(t,e){const n=lt.getPositions(e);for(let e=0;e<n.length;e++){const r=n[e][0],i=n[e][1];for(let e=-2;e<=2;e++)for(let n=-2;n<=2;n++)-2===e||2===e||-2===n||2===n||0===e&&0===n?t.set(r+e,i+n,!0,!0):t.set(r+e,i+n,!1,!0)}}(h,e),mt(h,n,0),e>=7&&function(t,e){const n=t.size,r=pt.getEncodedBits(e);let i,o,a;for(let e=0;e<18;e++)i=Math.floor(e/3),o=e%3+n-8-3,a=1==(r>>e&1),t.set(i,o,a,!0),t.set(o,i,a,!0)}(h,e),function(t,e){const n=t.size;let r=-1,i=n-1,o=7,a=0;for(let s=n-1;s>0;s-=2)for(6===s&&s--;;){for(let n=0;n<2;n++)if(!t.isReserved(i,s-n)){let r=!1;a<e.length&&(r=1==(e[a]>>>o&1)),t.set(i,s-n,r),o--,-1===o&&(a++,o=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(h,a),isNaN(r)&&(r=ft.getBestMask(h,mt.bind(null,h,n))),ft.applyMask(r,h),mt(h,n,r),{modules:h,version:e,errorCorrectionLevel:n,maskPattern:r,segments:i}}i.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let n,r,i=at.M;return void 0!==e&&(i=at.from(e.errorCorrectionLevel,at.M),n=pt.from(e.version),r=ft.from(e.maskPattern),e.toSJISFunc&&ot.setToSJISFunction(e.toSJISFunc)),yt(t,n,i,r)};var vt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Et=[],kt=[],Tt="undefined"!=typeof Uint8Array?Uint8Array:Array,Rt=!1;function At(){Rt=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Et[e]=t[e],kt[t.charCodeAt(e)]=e;kt["-".charCodeAt(0)]=62,kt["_".charCodeAt(0)]=63}function Lt(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Et[(i=r)>>18&63]+Et[i>>12&63]+Et[i>>6&63]+Et[63&i]);return o.join("")}function xt(t){var e;Rt||At();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,h=n-r;s<h;s+=a)o.push(Lt(t,s,s+a>h?h:s+a));return 1===r?(e=t[n-1],i+=Et[e>>2],i+=Et[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=Et[e>>10],i+=Et[e>>4&63],i+=Et[e<<2&63],i+="="),o.push(i),o.join("")}function St(t,e,n,r,i){var o,a,s=8*i-r-1,h=(1<<s)-1,l=h>>1,u=-7,f=n?i-1:0,c=n?-1:1,d=t[e+f];for(f+=c,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+t[e+f],f+=c,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+f],f+=c,u-=8);if(0===o)o=1-l;else{if(o===h)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)}function Ct(t,e,n,r,i,o){var a,s,h,l=8*o-i-1,u=(1<<l)-1,f=u>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+f>=1?c/h:c*Math.pow(2,1-f))*h>=2&&(a++,h/=2),a+f>=u?(s=0,a=u):a+f>=1?(s=(e*h-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[n+d]=255&a,d+=p,a/=256,l-=8);t[n+d-p]|=128*g}var It={}.toString,Ot=Array.isArray||function(t){return"[object Array]"==It.call(t)};Dt.TYPED_ARRAY_SUPPORT=void 0===vt.TYPED_ARRAY_SUPPORT||vt.TYPED_ARRAY_SUPPORT;var Pt=Mt();function Mt(){return Dt.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Bt(t,e){if(Mt()<e)throw new RangeError("Invalid typed array length");return Dt.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Dt.prototype:(null===t&&(t=new Dt(e)),t.length=e),t}function Dt(t,e,n){if(!(Dt.TYPED_ARRAY_SUPPORT||this instanceof Dt))return new Dt(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Ut(this,t)}return zt(this,t,e,n)}function zt(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);Dt.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Dt.prototype:t=Ft(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!Dt.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Zt(e,n);t=Bt(t,r);var i=t.write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(jt(e)){var n=0|Yt(e.length);return 0===(t=Bt(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?Bt(t,0):Ft(t,e);if("Buffer"===e.type&&Ot(e.data))return Ft(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function Nt(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Ut(t,e){if(Nt(e),t=Bt(t,e<0?0:0|Yt(e)),!Dt.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Ft(t,e){var n=e.length<0?0:0|Yt(e.length);t=Bt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function Yt(t){if(t>=Mt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mt().toString(16)+" bytes");return 0|t}function jt(t){return!(null==t||!t._isBuffer)}function Zt(t,e){if(jt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return _e(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return we(t).length;default:if(r)return _e(t).length;e=(""+e).toLowerCase(),r=!0}}function Ht(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return oe(this,e,n);case"utf8":case"utf-8":return ee(this,e,n);case"ascii":return re(this,e,n);case"latin1":case"binary":return ie(this,e,n);case"base64":return te(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Wt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function qt(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=Dt.from(e,r)),jt(e))return 0===e.length?-1:Gt(t,e,n,r,i);if("number"==typeof e)return e&=255,Dt.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):Gt(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Gt(t,e,n,r,i){var o,a=1,s=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,h/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var u=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===h)return u*a}else-1!==u&&(o-=o-u),u=-1}else for(n+h>s&&(n=s-h),o=n;o>=0;o--){for(var f=!0,c=0;c<h;c++)if(l(t,o+c)!==l(e,c)){f=!1;break}if(f)return o}return-1}function Vt(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function Kt(t,e,n,r){return me(_e(e,t.length-n),t,n,r)}function Jt(t,e,n,r){return me(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function Xt(t,e,n,r){return Jt(t,e,n,r)}function Qt(t,e,n,r){return me(we(e),t,n,r)}function $t(t,e,n,r){return me(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(n=t.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function te(t,e,n){return 0===e&&n===t.length?xt(t):xt(t.slice(e,n))}function ee(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,h,l=t[i],u=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(u=l);break;case 2:128==(192&(o=t[i+1]))&&(h=(31&l)<<6|63&o)>127&&(u=h);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(h=(15&l)<<12|(63&o)<<6|63&a)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(h=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&h<1114112&&(u=h)}null===u?(u=65533,f=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=f}return function(t){var e=t.length;if(e<=ne)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=ne));return n}(r)}Dt.poolSize=8192,Dt._augment=function(t){return t.__proto__=Dt.prototype,t},Dt.from=function(t,e,n){return zt(null,t,e,n)},Dt.TYPED_ARRAY_SUPPORT&&(Dt.prototype.__proto__=Uint8Array.prototype,Dt.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Dt[Symbol.species]),Dt.alloc=function(t,e,n){return function(t,e,n,r){return Nt(e),e<=0?Bt(t,e):void 0!==n?"string"==typeof r?Bt(t,e).fill(n,r):Bt(t,e).fill(n):Bt(t,e)}(null,t,e,n)},Dt.allocUnsafe=function(t){return Ut(null,t)},Dt.allocUnsafeSlow=function(t){return Ut(null,t)},Dt.isBuffer=be,Dt.compare=function(t,e){if(!jt(t)||!jt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},Dt.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Dt.concat=function(t,e){if(!Ot(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Dt.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=Dt.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!jt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Dt.byteLength=Zt,Dt.prototype._isBuffer=!0,Dt.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Wt(this,e,e+1);return this},Dt.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Wt(this,e,e+3),Wt(this,e+1,e+2);return this},Dt.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Wt(this,e,e+7),Wt(this,e+1,e+6),Wt(this,e+2,e+5),Wt(this,e+3,e+4);return this},Dt.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?ee(this,0,t):Ht.apply(this,arguments)},Dt.prototype.equals=function(t){if(!jt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Dt.compare(this,t)},Dt.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Dt.prototype.compare=function(t,e,n,r,i){if(!jt(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),h=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(h[u]!==l[u]){o=h[u],a=l[u];break}return o<a?-1:a<o?1:0},Dt.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},Dt.prototype.indexOf=function(t,e,n){return qt(this,t,e,n,!0)},Dt.prototype.lastIndexOf=function(t,e,n){return qt(this,t,e,n,!1)},Dt.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Vt(this,t,e,n);case"utf8":case"utf-8":return Kt(this,t,e,n);case"ascii":return Jt(this,t,e,n);case"latin1":case"binary":return Xt(this,t,e,n);case"base64":return Qt(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Dt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;function re(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function ie(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function oe(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=ge(t[o]);return i}function ae(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function se(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function he(t,e,n,r,i,o){if(!jt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function le(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ue(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function fe(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ce(t,e,n,r,i){return i||fe(t,0,n,4),Ct(t,e,n,r,23,4),n+4}function de(t,e,n,r,i){return i||fe(t,0,n,8),Ct(t,e,n,r,52,8),n+8}Dt.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),Dt.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=Dt.prototype;else{var i=e-t;n=new Dt(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},Dt.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},Dt.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},Dt.prototype.readUInt8=function(t,e){return e||se(t,1,this.length),this[t]},Dt.prototype.readUInt16LE=function(t,e){return e||se(t,2,this.length),this[t]|this[t+1]<<8},Dt.prototype.readUInt16BE=function(t,e){return e||se(t,2,this.length),this[t]<<8|this[t+1]},Dt.prototype.readUInt32LE=function(t,e){return e||se(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Dt.prototype.readUInt32BE=function(t,e){return e||se(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Dt.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},Dt.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||se(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Dt.prototype.readInt8=function(t,e){return e||se(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Dt.prototype.readInt16LE=function(t,e){e||se(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Dt.prototype.readInt16BE=function(t,e){e||se(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Dt.prototype.readInt32LE=function(t,e){return e||se(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Dt.prototype.readInt32BE=function(t,e){return e||se(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Dt.prototype.readFloatLE=function(t,e){return e||se(t,4,this.length),St(this,t,!0,23,4)},Dt.prototype.readFloatBE=function(t,e){return e||se(t,4,this.length),St(this,t,!1,23,4)},Dt.prototype.readDoubleLE=function(t,e){return e||se(t,8,this.length),St(this,t,!0,52,8)},Dt.prototype.readDoubleBE=function(t,e){return e||se(t,8,this.length),St(this,t,!1,52,8)},Dt.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||he(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},Dt.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||he(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},Dt.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,1,255,0),Dt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Dt.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,65535,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):le(this,t,e,!0),e+2},Dt.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,65535,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):le(this,t,e,!1),e+2},Dt.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,4294967295,0),Dt.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ue(this,t,e,!0),e+4},Dt.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,4294967295,0),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ue(this,t,e,!1),e+4},Dt.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);he(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Dt.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);he(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Dt.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,1,127,-128),Dt.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Dt.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,32767,-32768),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):le(this,t,e,!0),e+2},Dt.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,2,32767,-32768),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):le(this,t,e,!1),e+2},Dt.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,2147483647,-2147483648),Dt.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ue(this,t,e,!0),e+4},Dt.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||he(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Dt.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ue(this,t,e,!1),e+4},Dt.prototype.writeFloatLE=function(t,e,n){return ce(this,t,e,!0,n)},Dt.prototype.writeFloatBE=function(t,e,n){return ce(this,t,e,!1,n)},Dt.prototype.writeDoubleLE=function(t,e,n){return de(this,t,e,!0,n)},Dt.prototype.writeDoubleBE=function(t,e,n){return de(this,t,e,!1,n)},Dt.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!Dt.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},Dt.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Dt.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=jt(t)?t:_e(new Dt(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var pe=/[^+\/0-9A-Za-z-_]/g;function ge(t){return t<16?"0"+t.toString(16):t.toString(16)}function _e(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function we(t){return function(t){var e,n,r,i,o,a;Rt||At();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new Tt(3*s/4-o),r=o>0?s-4:s;var h=0;for(e=0,n=0;e<r;e+=4,n+=3)i=kt[t.charCodeAt(e)]<<18|kt[t.charCodeAt(e+1)]<<12|kt[t.charCodeAt(e+2)]<<6|kt[t.charCodeAt(e+3)],a[h++]=i>>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=kt[t.charCodeAt(e)]<<2|kt[t.charCodeAt(e+1)]>>4,a[h++]=255&i):1===o&&(i=kt[t.charCodeAt(e)]<<10|kt[t.charCodeAt(e+1)]<<4|kt[t.charCodeAt(e+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(pe,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function me(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function be(t){return null!=t&&(!!t._isBuffer||ye(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ye(t.slice(0,0))}(t))}function ye(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var ve=Object.freeze({__proto__:null,Buffer:Dt,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),Dt.alloc(+t)},isBuffer:be,kMaxLength:Pt}),Ee={},ke=e(Object.freeze({__proto__:null,default:{}}));function Te(){throw new Error("setTimeout has not been defined")}function Re(){throw new Error("clearTimeout has not been defined")}var Ae=Te,Le=Re;function xe(t){if(Ae===setTimeout)return setTimeout(t,0);if((Ae===Te||!Ae)&&setTimeout)return Ae=setTimeout,setTimeout(t,0);try{return Ae(t,0)}catch(e){try{return Ae.call(null,t,0)}catch(e){return Ae.call(this,t,0)}}}"function"==typeof vt.setTimeout&&(Ae=setTimeout),"function"==typeof vt.clearTimeout&&(Le=clearTimeout);var Se,Ce=[],Ie=!1,Oe=-1;function Pe(){Ie&&Se&&(Ie=!1,Se.length?Ce=Se.concat(Ce):Oe=-1,Ce.length&&Me())}function Me(){if(!Ie){var t=xe(Pe);Ie=!0;for(var e=Ce.length;e;){for(Se=Ce,Ce=[];++Oe<e;)Se&&Se[Oe].run();Oe=-1,e=Ce.length}Se=null,Ie=!1,function(t){if(Le===clearTimeout)return clearTimeout(t);if((Le===Re||!Le)&&clearTimeout)return Le=clearTimeout,clearTimeout(t);try{return Le(t)}catch(e){try{return Le.call(null,t)}catch(e){return Le.call(this,t)}}}(t)}}function Be(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Ce.push(new De(t,e)),1!==Ce.length||Ie||xe(Me)}function De(t,e){this.fun=t,this.array=e}De.prototype.run=function(){this.fun.apply(null,this.array)};function ze(){}var Ne=ze,Ue=ze,Fe=ze,Ye=ze,je=ze,Ze=ze,He=ze;var We=vt.performance||{},qe=We.now||We.mozNow||We.msNow||We.oNow||We.webkitNow||function(){return(new Date).getTime()};var Ge=new Date;var Ve={nextTick:Be,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ne,addListener:Ue,once:Fe,off:Ye,removeListener:je,removeAllListeners:Ze,emit:He,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*qe.call(We),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Ge)/1e3}},Ke={},Je="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Xe=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},Qe=/%[sdj%]/g;function $e(t){if(!_n(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(on(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(Qe,(function(t){if("%%"===t)return"%";if(n>=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),a=r[n];n<i;a=r[++n])dn(a)||!yn(a)?o+=" "+a:o+=" "+on(a);return o}function tn(t,e){if(mn(vt.process))return function(){return tn(t,e).apply(this,arguments)};if(!0===Ve.noDeprecation)return t;var n=!1;return function(){if(!n){if(Ve.throwDeprecation)throw new Error(e);Ve.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var en,nn={};function rn(t){if(mn(en)&&(en=Ve.env.NODE_DEBUG||""),t=t.toUpperCase(),!nn[t])if(new RegExp("\\b"+t+"\\b","i").test(en)){nn[t]=function(){var e=$e.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else nn[t]=function(){};return nn[t]}function on(t,e){var n={seen:[],stylize:sn};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),cn(e)?n.showHidden=e:e&&Cn(n,e),mn(n.showHidden)&&(n.showHidden=!1),mn(n.depth)&&(n.depth=2),mn(n.colors)&&(n.colors=!1),mn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=an),hn(n,t,n.depth)}function an(t,e){var n=on.styles[e];return n?"["+on.colors[n][0]+"m"+t+"["+on.colors[n][1]+"m":t}function sn(t,e){return t}function hn(t,e,n){if(t.customInspect&&e&&kn(e.inspect)&&e.inspect!==on&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return _n(r)||(r=hn(t,r,n)),r}var i=function(t,e){if(mn(e))return t.stylize("undefined","undefined");if(_n(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(gn(e))return t.stylize(""+e,"number");if(cn(e))return t.stylize(""+e,"boolean");if(dn(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),En(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ln(e);if(0===o.length){if(kn(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(bn(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(vn(e))return t.stylize(Date.prototype.toString.call(e),"date");if(En(e))return ln(e)}var h,l="",u=!1,f=["{","}"];(fn(e)&&(u=!0,f=["[","]"]),kn(e))&&(l=" [Function"+(e.name?": "+e.name:"")+"]");return bn(e)&&(l=" "+RegExp.prototype.toString.call(e)),vn(e)&&(l=" "+Date.prototype.toUTCString.call(e)),En(e)&&(l=" "+ln(e)),0!==o.length||u&&0!=e.length?n<0?bn(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),h=u?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a<s;++a)In(e,String(a))?o.push(un(t,e,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(un(t,e,n,r,i,!0))})),o}(t,e,n,a,o):o.map((function(r){return un(t,e,n,a,r,u)})),t.seen.pop(),function(t,e,n){var r=t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(h,l,f)):f[0]+l+f[1]}function ln(t){return"["+Error.prototype.toString.call(t)+"]"}function un(t,e,n,r,i,o){var a,s,h;if((h=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),In(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(h.value)<0?(s=dn(n)?hn(t,h.value,null):hn(t,h.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),mn(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function fn(t){return Array.isArray(t)}function cn(t){return"boolean"==typeof t}function dn(t){return null===t}function pn(t){return null==t}function gn(t){return"number"==typeof t}function _n(t){return"string"==typeof t}function wn(t){return"symbol"==typeof t}function mn(t){return void 0===t}function bn(t){return yn(t)&&"[object RegExp]"===An(t)}function yn(t){return"object"==typeof t&&null!==t}function vn(t){return yn(t)&&"[object Date]"===An(t)}function En(t){return yn(t)&&("[object Error]"===An(t)||t instanceof Error)}function kn(t){return"function"==typeof t}function Tn(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function Rn(t){return Dt.isBuffer(t)}function An(t){return Object.prototype.toString.call(t)}function Ln(t){return t<10?"0"+t.toString(10):t.toString(10)}on.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},on.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var xn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Sn(){var t,e;console.log("%s - %s",(t=new Date,e=[Ln(t.getHours()),Ln(t.getMinutes()),Ln(t.getSeconds())].join(":"),[t.getDate(),xn[t.getMonth()],e].join(" ")),$e.apply(null,arguments))}function Cn(t,e){if(!e||!yn(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function In(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var On="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Pn(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(On&&t[On]){var e;if("function"!=typeof(e=t[On]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,On,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,n,r=new Promise((function(t,r){e=t,n=r})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(t,r){t?n(t):e(r)}));try{t.apply(this,i)}catch(t){n(t)}return r}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),On&&Object.defineProperty(e,On,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Xe(t))}function Mn(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function Bn(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function e(){for(var e=[],n=0;n<arguments.length;n++)e.push(arguments[n]);var r=e.pop();if("function"!=typeof r)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return r.apply(i,arguments)};t.apply(this,e).then((function(t){Ve.nextTick(o.bind(null,null,t))}),(function(t){Ve.nextTick(Mn.bind(null,t,o))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,Xe(t)),e}Pn.custom=On;var Dn={inherits:Je,_extend:Cn,log:Sn,isBuffer:Rn,isPrimitive:Tn,isFunction:kn,isError:En,isDate:vn,isObject:yn,isRegExp:bn,isUndefined:mn,isSymbol:wn,isString:_n,isNumber:gn,isNullOrUndefined:pn,isNull:dn,isBoolean:cn,isArray:fn,inspect:on,deprecate:tn,format:$e,debuglog:rn,promisify:Pn,callbackify:Bn},zn=e(Object.freeze({__proto__:null,_extend:Cn,callbackify:Bn,debuglog:rn,default:Dn,deprecate:tn,format:$e,inherits:Je,inspect:on,isArray:fn,isBoolean:cn,isBuffer:Rn,isDate:vn,isError:En,isFunction:kn,isNull:dn,isNullOrUndefined:pn,isNumber:gn,isObject:yn,isPrimitive:Tn,isRegExp:bn,isString:_n,isSymbol:wn,isUndefined:mn,log:Sn,promisify:Pn}));function Nn(){}function Un(){Un.init.call(this)}function Fn(t){return void 0===t._maxListeners?Un.defaultMaxListeners:t._maxListeners}function Yn(t,e,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]):(o=t._events=new Nn,t._eventsCount=0),a){if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=Fn(t))&&i>0&&a.length>i){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,s=h,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[e]=n,++t._eventsCount;return t}function jn(t,e,n){var r=!1;function i(){t.removeListener(e,i),r||(r=!0,n.apply(t,arguments))}return i.listener=n,i}function Zn(t){var e=this._events;if(e){var n=e[t];if("function"==typeof n)return 1;if(n)return n.length}return 0}function Hn(t,e){for(var n=new Array(e);e--;)n[e]=t[e];return n}function Wn(){this.head=null,this.tail=null,this.length=0}Nn.prototype=Object.create(null),Un.EventEmitter=Un,Un.usingDomains=!1,Un.prototype.domain=void 0,Un.prototype._events=void 0,Un.prototype._maxListeners=void 0,Un.defaultMaxListeners=10,Un.init=function(){this.domain=null,Un.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Nn,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Un.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},Un.prototype.getMaxListeners=function(){return Fn(this)},Un.prototype.emit=function(t){var e,n,r,i,o,a,s,h="error"===t;if(a=this._events)h=h&&null==a.error;else if(!h)return!1;if(s=this.domain,h){if(e=arguments[1],!s){if(e instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=s,e.domainThrown=!1,s.emit("error",e),!1}if(!(n=a[t]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:!function(t,e,n){if(e)t.call(n);else for(var r=t.length,i=Hn(t,r),o=0;o<r;++o)i[o].call(n)}(n,u,this);break;case 2:!function(t,e,n,r){if(e)t.call(n,r);else for(var i=t.length,o=Hn(t,i),a=0;a<i;++a)o[a].call(n,r)}(n,u,this,arguments[1]);break;case 3:!function(t,e,n,r,i){if(e)t.call(n,r,i);else for(var o=t.length,a=Hn(t,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,u,this,arguments[1],arguments[2]);break;case 4:!function(t,e,n,r,i,o){if(e)t.call(n,r,i,o);else for(var a=t.length,s=Hn(t,a),h=0;h<a;++h)s[h].call(n,r,i,o)}(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(t,e,n,r){if(e)t.apply(n,r);else for(var i=t.length,o=Hn(t,i),a=0;a<i;++a)o[a].apply(n,r)}(n,u,this,i)}return!0},Un.prototype.addListener=function(t,e){return Yn(this,t,e,!1)},Un.prototype.on=Un.prototype.addListener,Un.prototype.prependListener=function(t,e){return Yn(this,t,e,!0)},Un.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,jn(this,t,e)),this},Un.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,jn(this,t,e)),this},Un.prototype.removeListener=function(t,e){var n,r,i,o,a;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener&&n.listener===e)0==--this._eventsCount?this._events=new Nn:(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new Nn,this;delete r[t]}else!function(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}(n,i);r.removeListener&&this.emit("removeListener",t,a||e)}return this},Un.prototype.off=function(t,e){return this.removeListener(t,e)},Un.prototype.removeAllListeners=function(t){var e,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new Nn,this._eventsCount=0):n[t]&&(0==--this._eventsCount?this._events=new Nn:delete n[t]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new Nn,this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(e)do{this.removeListener(t,e[e.length-1])}while(e[0]);return this},Un.prototype.listeners=function(t){var e,n=this._events;return n&&(e=n[t])?"function"==typeof e?[e.listener||e]:function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(e):[]},Un.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):Zn.call(t,e)},Un.prototype.listenerCount=Zn,Un.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]},Wn.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},Wn.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},Wn.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},Wn.prototype.clear=function(){this.head=this.tail=null,this.length=0},Wn.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},Wn.prototype.concat=function(t){if(0===this.length)return Dt.alloc(0);if(1===this.length)return this.head.data;for(var e=Dt.allocUnsafe(t>>>0),n=this.head,r=0;n;)n.data.copy(e,r),r+=n.data.length,n=n.next;return e};var qn=Dt.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Gn(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!qn(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Kn;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Jn;break;default:return void(this.write=Vn)}this.charBuffer=new Dt(6),this.charReceived=0,this.charLength=0}function Vn(t){return t.toString(this.encoding)}function Kn(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function Jn(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}Gn.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(t=t.slice(n,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;r=(e+=t.toString(this.encoding,0,r)).length-1;if((i=e.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,r)}return e},Gn.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},Gn.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e},$n.ReadableState=Qn;var Xn=rn("stream");function Qn(t,e){t=t||{},this.objectMode=!!t.objectMode,e instanceof Lr&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Wn,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(this.decoder=new Gn(t.encoding),this.encoding=t.encoding)}function $n(t){if(!(this instanceof $n))return new $n(t);this._readableState=new Qn(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),Un.call(this)}function tr(t,e,n,r,i){var o=function(t,e){var n=null;Dt.isBuffer(e)||"string"==typeof e||null==e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(e,n);if(o)t.emit("error",o);else if(null===n)e.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,rr(t)}(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!i){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&i){var s=new Error("stream.unshift() after end event");t.emit("error",s)}else{var h;!e.decoder||i||r||(n=e.decoder.write(n),h=!e.objectMode&&0===n.length),i||(e.reading=!1),h||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&rr(t))),function(t,e){e.readingMore||(e.readingMore=!0,Be(or,t,e))}(t,e)}else i||(e.reading=!1);return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(e)}Je($n,Un),$n.prototype.push=function(t,e){var n=this._readableState;return n.objectMode||"string"!=typeof t||(e=e||n.defaultEncoding)!==n.encoding&&(t=Dt.from(t,e),e=""),tr(this,n,t,e,!1)},$n.prototype.unshift=function(t){return tr(this,this._readableState,t,"",!0)},$n.prototype.isPaused=function(){return!1===this._readableState.flowing},$n.prototype.setEncoding=function(t){return this._readableState.decoder=new Gn(t),this._readableState.encoding=t,this};var er=8388608;function nr(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=er?t=er:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function rr(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(Xn("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?Be(ir,t):ir(t))}function ir(t){Xn("emit readable"),t.emit("readable"),hr(t)}function or(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(Xn("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function ar(t){Xn("readable nexttick read 0"),t.read(0)}function sr(t,e){e.reading||(Xn("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),hr(t),e.flowing&&!e.reading&&t.read(0)}function hr(t){var e=t._readableState;for(Xn("flow",e.flowing);e.flowing&&null!==t.read(););}function lr(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=Dt.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),0===(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function ur(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,Be(fr,e,t))}function fr(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function cr(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}function dr(){}function pr(t,e,n){this.chunk=t,this.encoding=e,this.callback=n,this.next=null}function gr(t,e){Object.defineProperty(this,"buffer",{get:tn((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),t=t||{},this.objectMode=!!t.objectMode,e instanceof Lr&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===t.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?Be(i,r):i(r);t._writableState.errorEmitted=!0,t.emit("error",r)}(t,n,r,e,i);else{var o=yr(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||br(t,n),r?Be(mr,t,n,o,i):mr(t,n,o,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new kr(this)}function _r(t){if(!(this instanceof _r||this instanceof Lr))return new _r(t);this._writableState=new gr(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),Un.call(this)}function wr(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function mr(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),Er(t,e)}function br(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;wr(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new kr(e)}else{for(;n;){var s=n.chunk,h=n.encoding,l=n.callback;if(wr(t,e,!1,e.objectMode?1:s.length,s,h,l),n=n.next,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequestCount=0,e.bufferedRequest=n,e.bufferProcessing=!1}function yr(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function vr(t,e){e.prefinished||(e.prefinished=!0,t.emit("prefinish"))}function Er(t,e){var n=yr(e);return n&&(0===e.pendingcb?(vr(t,e),e.finished=!0,t.emit("finish")):vr(t,e)),n}function kr(t){var e=this;this.next=null,this.entry=null,this.finish=function(n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}}$n.prototype.read=function(t){Xn("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return Xn("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?ur(this):rr(this),null;if(0===(t=nr(t,e))&&e.ended)return 0===e.length&&ur(this),null;var r,i=e.needReadable;return Xn("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&Xn("length less than watermark",i=!0),e.ended||e.reading?Xn("reading or ended",i=!1):i&&(Xn("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=nr(n,e))),null===(r=t>0?lr(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&ur(this)),null!==r&&this.emit("data",r),r},$n.prototype._read=function(t){this.emit("error",new Error("not implemented"))},$n.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,Xn("pipe count=%d opts=%j",r.pipesCount,e);var i=!e||!1!==e.end?a:l;function o(t){Xn("onunpipe"),t===n&&l()}function a(){Xn("onend"),t.end()}r.endEmitted?Be(i):n.once("end",i),t.on("unpipe",o);var s=function(t){return function(){var e=t._readableState;Xn("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&t.listeners("data").length&&(e.flowing=!0,hr(t))}}(n);t.on("drain",s);var h=!1;function l(){Xn("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",s),t.removeListener("error",c),t.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",f),h=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||s()}var u=!1;function f(e){Xn("ondata"),u=!1,!1!==t.write(e)||u||((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==cr(r.pipes,t))&&!h&&(Xn("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,u=!0),n.pause())}function c(e){var n;Xn("onerror",e),g(),t.removeListener("error",c),0===(n="error",t.listeners(n).length)&&t.emit("error",e)}function d(){t.removeListener("finish",p),g()}function p(){Xn("onfinish"),t.removeListener("close",d),g()}function g(){Xn("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",c),t.once("close",d),t.once("finish",p),t.emit("pipe",n),r.flowing||(Xn("pipe resume"),n.resume()),t},$n.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this)),this;if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=cr(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this)),this},$n.prototype.on=function(t,e){var n=Un.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&rr(this):Be(ar,this))}return n},$n.prototype.addListener=$n.prototype.on,$n.prototype.resume=function(){var t=this._readableState;return t.flowing||(Xn("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Be(sr,t,e))}(this,t)),this},$n.prototype.pause=function(){return Xn("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Xn("pause"),this._readableState.flowing=!1,this.emit("pause")),this},$n.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;for(var i in t.on("end",(function(){if(Xn("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)})),t.on("data",(function(i){(Xn("wrapped data"),e.decoder&&(i=e.decoder.write(i)),e.objectMode&&null==i)||(e.objectMode||i&&i.length)&&(r.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));return function(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}(["error","close","destroy","pause","resume"],(function(e){t.on(e,r.emit.bind(r,e))})),r._read=function(e){Xn("wrapped _read",e),n&&(n=!1,t.resume())},r},$n._fromList=lr,_r.WritableState=gr,Je(_r,Un),gr.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},_r.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_r.prototype.write=function(t,e,n){var r=this._writableState,i=!1;return"function"==typeof e&&(n=e,e=null),Dt.isBuffer(t)?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=dr),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),Be(e,n)}(this,n):function(t,e,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):Dt.isBuffer(n)||"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),Be(r,o),i=!1),i}(this,r,t,n)&&(r.pendingcb++,i=function(t,e,n,r,i){n=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=Dt.from(e,n));return e}(e,n,r),Dt.isBuffer(n)&&(r="buffer");var o=e.objectMode?1:n.length;e.length+=o;var a=e.length<e.highWaterMark;a||(e.needDrain=!0);if(e.writing||e.corked){var s=e.lastBufferedRequest;e.lastBufferedRequest=new pr(n,r,i),s?s.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else wr(t,e,!1,o,n,r,i);return a}(this,r,t,e,n)),i},_r.prototype.cork=function(){this._writableState.corked++},_r.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||br(this,t))},_r.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},_r.prototype._write=function(t,e,n){n(new Error("not implemented"))},_r.prototype._writev=null,_r.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,Er(t,e),n&&(e.finished?Be(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Je(Lr,$n);for(var Tr=Object.keys(_r.prototype),Rr=0;Rr<Tr.length;Rr++){var Ar=Tr[Rr];Lr.prototype[Ar]||(Lr.prototype[Ar]=_r.prototype[Ar])}function Lr(t){if(!(this instanceof Lr))return new Lr(t);$n.call(this,t),_r.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",xr)}function xr(){this.allowHalfOpen||this._writableState.ended||Be(Sr,this)}function Sr(t){t.end()}function Cr(t){this.afterTransform=function(e,n){return function(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&t.push(n);i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Ir(t){if(!(this instanceof Ir))return new Ir(t);Lr.call(this,t),this._transformState=new Cr(this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(t){Or(e,t)})):Or(e)}))}function Or(t,e){if(e)return t.emit("error",e);var n=t._writableState,r=t._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}function Pr(t){if(!(this instanceof Pr))return new Pr(t);Ir.call(this,t)}function Mr(){Un.call(this)}Je(Ir,Lr),Ir.prototype.push=function(t,e){return this._transformState.needTransform=!1,Lr.prototype.push.call(this,t,e)},Ir.prototype._transform=function(t,e,n){throw new Error("Not implemented")},Ir.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Ir.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},Je(Pr,Ir),Pr.prototype._transform=function(t,e,n){n(null,t)},Je(Mr,Un),Mr.Readable=$n,Mr.Writable=_r,Mr.Duplex=Lr,Mr.Transform=Ir,Mr.PassThrough=Pr,Mr.Stream=Mr,Mr.prototype.pipe=function(t,e){var n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",i),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(l(),0===Un.listenerCount(this,"error"))throw t}function l(){n.removeListener("data",r),t.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",h),t.removeListener("error",h),n.removeListener("end",l),n.removeListener("close",l),t.removeListener("close",l)}return n.on("error",h),t.on("error",h),n.on("end",l),n.on("close",l),t.on("close",l),t.emit("pipe",n),t};var Br=e(Object.freeze({__proto__:null,Duplex:Lr,PassThrough:Pr,Readable:$n,Stream:Mr,Transform:Ir,Writable:_r,default:Mr})),Dr={exports:{}},zr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function Nr(){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}function Ur(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]}var Fr=Uint8Array,Yr=Uint16Array,jr=Int32Array,Zr=4,Hr=0,Wr=1,qr=2;function Gr(t){for(var e=t.length;--e>=0;)t[e]=0}var Vr=0,Kr=1,Jr=2,Xr=29,Qr=256,$r=Qr+1+Xr,ti=30,ei=19,ni=2*$r+1,ri=15,ii=16,oi=7,ai=256,si=16,hi=17,li=18,ui=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],fi=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ci=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],di=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],pi=new Array(2*($r+2));Gr(pi);var gi=new Array(2*ti);Gr(gi);var _i=new Array(512);Gr(_i);var wi=new Array(256);Gr(wi);var mi=new Array(Xr);Gr(mi);var bi,yi,vi,Ei=new Array(ti);function ki(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function Ti(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Ri(t){return t<256?_i[t]:_i[256+(t>>>7)]}function Ai(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function Li(t,e,n){t.bi_valid>ii-n?(t.bi_buf|=e<<t.bi_valid&65535,Ai(t,t.bi_buf),t.bi_buf=e>>ii-t.bi_valid,t.bi_valid+=n-ii):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function xi(t,e,n){Li(t,n[2*e],n[2*e+1])}function Si(t,e){var n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}function Ci(t,e,n){var r,i,o=new Array(ri+1),a=0;for(r=1;r<=ri;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=Si(o[s]++,s))}}function Ii(t){var e;for(e=0;e<$r;e++)t.dyn_ltree[2*e]=0;for(e=0;e<ti;e++)t.dyn_dtree[2*e]=0;for(e=0;e<ei;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*ai]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function Oi(t){t.bi_valid>8?Ai(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Pi(t,e,n,r){var i=2*e,o=2*n;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function Mi(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&Pi(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Pi(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function Bi(t,e,n){var r,i,o,a,s=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*s]<<8|t.pending_buf[t.d_buf+2*s+1],i=t.pending_buf[t.l_buf+s],s++,0===r?xi(t,i,e):(xi(t,(o=wi[i])+Qr+1,e),0!==(a=ui[o])&&Li(t,i-=mi[o],a),xi(t,o=Ri(--r),n),0!==(a=fi[o])&&Li(t,r-=Ei[o],a))}while(s<t.last_lit);xi(t,ai,e)}function Di(t,e){var n,r,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,h=e.stat_desc.elems,l=-1;for(t.heap_len=0,t.heap_max=ni,n=0;n<h;n++)0!==o[2*n]?(t.heap[++t.heap_len]=l=n,t.depth[n]=0):o[2*n+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=l<2?++l:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=l,n=t.heap_len>>1;n>=1;n--)Mi(t,o,n);i=h;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Mi(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,Mi(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,h=e.dyn_tree,l=e.max_code,u=e.stat_desc.static_tree,f=e.stat_desc.has_stree,c=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;o<=ri;o++)t.bl_count[o]=0;for(h[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<ni;n++)(o=h[2*h[2*(r=t.heap[n])+1]+1]+1)>p&&(o=p,g++),h[2*r+1]=o,r>l||(t.bl_count[o]++,a=0,r>=d&&(a=c[r-d]),s=h[2*r],t.opt_len+=s*(o+a),f&&(t.static_len+=s*(u[2*r+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(i=t.heap[--n])>l||(h[2*i+1]!==o&&(t.opt_len+=(o-h[2*i+1])*h[2*i],h[2*i+1]=o),r--)}}(t,e),Ci(o,l,t.bl_count)}function zi(t,e,n){var r,i,o=-1,a=e[1],s=0,h=7,l=4;for(0===a&&(h=138,l=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=e[2*(r+1)+1],++s<h&&i===a||(s<l?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[2*si]++):s<=10?t.bl_tree[2*hi]++:t.bl_tree[2*li]++,s=0,o=i,0===a?(h=138,l=3):i===a?(h=6,l=3):(h=7,l=4))}function Ni(t,e,n){var r,i,o=-1,a=e[1],s=0,h=7,l=4;for(0===a&&(h=138,l=3),r=0;r<=n;r++)if(i=a,a=e[2*(r+1)+1],!(++s<h&&i===a)){if(s<l)do{xi(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(xi(t,i,t.bl_tree),s--),xi(t,si,t.bl_tree),Li(t,s-3,2)):s<=10?(xi(t,hi,t.bl_tree),Li(t,s-3,3)):(xi(t,li,t.bl_tree),Li(t,s-11,7));s=0,o=i,0===a?(h=138,l=3):i===a?(h=6,l=3):(h=7,l=4)}}Gr(Ei);var Ui=!1;function Fi(t){Ui||(!function(){var t,e,n,r,i,o=new Array(ri+1);for(n=0,r=0;r<Xr-1;r++)for(mi[r]=n,t=0;t<1<<ui[r];t++)wi[n++]=r;for(wi[n-1]=r,i=0,r=0;r<16;r++)for(Ei[r]=i,t=0;t<1<<fi[r];t++)_i[i++]=r;for(i>>=7;r<ti;r++)for(Ei[r]=i<<7,t=0;t<1<<fi[r]-7;t++)_i[256+i++]=r;for(e=0;e<=ri;e++)o[e]=0;for(t=0;t<=143;)pi[2*t+1]=8,t++,o[8]++;for(;t<=255;)pi[2*t+1]=9,t++,o[9]++;for(;t<=279;)pi[2*t+1]=7,t++,o[7]++;for(;t<=287;)pi[2*t+1]=8,t++,o[8]++;for(Ci(pi,$r+1,o),t=0;t<ti;t++)gi[2*t+1]=5,gi[2*t]=Si(t,5);bi=new ki(pi,ui,Qr+1,$r,ri),yi=new ki(gi,fi,0,ti,ri),vi=new ki(new Array(0),ci,0,ei,oi)}(),Ui=!0),t.l_desc=new Ti(t.dyn_ltree,bi),t.d_desc=new Ti(t.dyn_dtree,yi),t.bl_desc=new Ti(t.bl_tree,vi),t.bi_buf=0,t.bi_valid=0,Ii(t)}function Yi(t,e,n,r){Li(t,(Vr<<1)+(r?1:0),3),function(t,e,n,r){Oi(t),r&&(Ai(t,n),Ai(t,~n)),Ur(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}function ji(t){Li(t,Kr<<1,3),xi(t,ai,pi),function(t){16===t.bi_valid?(Ai(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}function Zi(t,e,n,r){var i,o,a=0;t.level>0?(t.strm.data_type===qr&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return Hr;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return Wr;for(e=32;e<Qr;e++)if(0!==t.dyn_ltree[2*e])return Wr;return Hr}(t)),Di(t,t.l_desc),Di(t,t.d_desc),a=function(t){var e;for(zi(t,t.dyn_ltree,t.l_desc.max_code),zi(t,t.dyn_dtree,t.d_desc.max_code),Di(t,t.bl_desc),e=ei-1;e>=3&&0===t.bl_tree[2*di[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?Yi(t,e,n,r):t.strategy===Zr||o===i?(Li(t,(Kr<<1)+(r?1:0),3),Bi(t,pi,gi)):(Li(t,(Jr<<1)+(r?1:0),3),function(t,e,n,r){var i;for(Li(t,e-257,5),Li(t,n-1,5),Li(t,r-4,4),i=0;i<r;i++)Li(t,t.bl_tree[2*di[i]+1],3);Ni(t,t.dyn_ltree,e-1),Ni(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),Bi(t,t.dyn_ltree,t.dyn_dtree)),Ii(t),r&&Oi(t)}function Hi(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>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&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(wi[n]+Qr+1)]++,t.dyn_dtree[2*Ri(e)]++),t.last_lit===t.lit_bufsize-1}function Wi(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}var qi=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();function Gi(t,e,n,r){var i=qi,o=r+n;t^=-1;for(var a=r;a<o;a++)t=t>>>8^i[255&(t^e[a])];return-1^t}var Vi,Ki=0,Ji=4,Xi=0,Qi=-2,$i=2,to=8,eo=286,no=30,ro=19,io=2*eo+1,oo=15,ao=3,so=258,ho=so+ao+1,lo=42,uo=103,fo=113,co=666,po=1,go=2,_o=3,wo=4;function mo(t,e){return t.msg=zr[e],e}function bo(t){return(t<<1)-(t>4?9:0)}function yo(t){for(var e=t.length;--e>=0;)t[e]=0}function vo(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(Ur(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function Eo(t,e){Zi(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,vo(t.strm)}function ko(t,e){t.pending_buf[t.pending++]=e}function To(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function Ro(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-ho?t.strstart-(t.w_size-ho):0,l=t.window,u=t.w_mask,f=t.prev,c=t.strstart+so,d=l[o+a-1],p=l[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(n=e)+a]===p&&l[n+a-1]===d&&l[n]===l[o]&&l[++n]===l[o+1]){o+=2,n++;do{}while(l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&o<c);if(r=so-(c-o),o=c-so,r>a){if(t.match_start=e,a=r,r>=s)break;d=l[o+a-1],p=l[o+a]}}}while((e=f[e&u])>h&&0!=--i);return a<=t.lookahead?a:t.lookahead}function Ao(t){var e,n,r,i,o,a,s,h,l,u,f=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-ho)){Ur(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=f?r-f:0}while(--n);e=n=f;do{r=t.prev[--e],t.prev[e]=r>=f?r-f:0}while(--n);i+=f}if(0===t.strm.avail_in)break;if(a=t.strm,s=t.window,h=t.strstart+t.lookahead,l=i,u=void 0,(u=a.avail_in)>l&&(u=l),n=0===u?0:(a.avail_in-=u,Ur(s,a.input,a.next_in,u,h),1===a.state.wrap?a.adler=Wi(a.adler,s,u,h):2===a.state.wrap&&(a.adler=Gi(a.adler,s,u,h)),a.next_in+=u,a.total_in+=u,u),t.lookahead+=n,t.lookahead+t.insert>=ao)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+ao-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<ao)););}while(t.lookahead<ho&&0!==t.strm.avail_in)}function Lo(t,e){for(var n,r;;){if(t.lookahead<ho){if(Ao(t),t.lookahead<ho&&e===Ki)return po;if(0===t.lookahead)break}if(n=0,t.lookahead>=ao&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-ho&&(t.match_length=Ro(t,n)),t.match_length>=ao)if(r=Hi(t,t.strstart-t.match_start,t.match_length-ao),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ao){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=Hi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=t.strstart<ao-1?t.strstart:ao-1,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}function xo(t,e){for(var n,r,i;;){if(t.lookahead<ho){if(Ao(t),t.lookahead<ho&&e===Ki)return po;if(0===t.lookahead)break}if(n=0,t.lookahead>=ao&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ao-1,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-ho&&(t.match_length=Ro(t,n),t.match_length<=5&&(1===t.strategy||t.match_length===ao&&t.strstart-t.match_start>4096)&&(t.match_length=ao-1)),t.prev_length>=ao&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ao,r=Hi(t,t.strstart-1-t.prev_match,t.prev_length-ao),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ao-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=ao-1,t.strstart++,r&&(Eo(t,!1),0===t.strm.avail_out))return po}else if(t.match_available){if((r=Hi(t,0,t.window[t.strstart-1]))&&Eo(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return po}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=Hi(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ao-1?t.strstart:ao-1,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}function So(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function Co(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=to,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Yr(2*io),this.dyn_dtree=new Yr(2*(2*no+1)),this.bl_tree=new Yr(2*(2*ro+1)),yo(this.dyn_ltree),yo(this.dyn_dtree),yo(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Yr(oo+1),this.heap=new Yr(2*eo+1),yo(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Yr(2*eo+1),yo(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Io(t){var e,n=function(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=$i,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?lo:fo,t.adler=2===e.wrap?0:1,e.last_flush=Ki,Fi(e),Xi):mo(t,Qi)}(t);return n===Xi&&((e=t.state).window_size=2*e.w_size,yo(e.head),e.max_lazy_match=Vi[e.level].max_lazy,e.good_match=Vi[e.level].good_length,e.nice_match=Vi[e.level].nice_length,e.max_chain_length=Vi[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ao-1,e.match_available=0,e.ins_h=0),n}function Oo(t,e){var n,r,i,o;if(!t||!t.state||e>5||e<0)return t?mo(t,Qi):Qi;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||r.status===co&&e!==Ji)return mo(t,0===t.avail_out?-5:Qi);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===lo)if(2===r.wrap)t.adler=0,ko(r,31),ko(r,139),ko(r,8),r.gzhead?(ko(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ko(r,255&r.gzhead.time),ko(r,r.gzhead.time>>8&255),ko(r,r.gzhead.time>>16&255),ko(r,r.gzhead.time>>24&255),ko(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),ko(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ko(r,255&r.gzhead.extra.length),ko(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Gi(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(ko(r,0),ko(r,0),ko(r,0),ko(r,0),ko(r,0),ko(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),ko(r,3),r.status=fo);else{var a=to+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=fo,To(r,a),0!==r.strstart&&(To(r,t.adler>>>16),To(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),vo(t),i=r.pending,r.pending!==r.pending_buf_size));)ko(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),vo(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ko(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),vo(t),i=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ko(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>i&&(t.adler=Gi(t.adler,r.pending_buf,r.pending-i,i)),0===o&&(r.status=uo)}else r.status=uo;if(r.status===uo&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&vo(t),r.pending+2<=r.pending_buf_size&&(ko(r,255&t.adler),ko(r,t.adler>>8&255),t.adler=0,r.status=fo)):r.status=fo),0!==r.pending){if(vo(t),0===t.avail_out)return r.last_flush=-1,Xi}else if(0===t.avail_in&&bo(e)<=bo(n)&&e!==Ji)return mo(t,-5);if(r.status===co&&0!==t.avail_in)return mo(t,-5);if(0!==t.avail_in||0!==r.lookahead||e!==Ki&&r.status!==co){var s=2===r.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(Ao(t),0===t.lookahead)){if(e===Ki)return po;break}if(t.match_length=0,n=Hi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=0,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}(r,e):3===r.strategy?function(t,e){for(var n,r,i,o,a=t.window;;){if(t.lookahead<=so){if(Ao(t),t.lookahead<=so&&e===Ki)return po;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=ao&&t.strstart>0&&(r=a[i=t.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){o=t.strstart+so;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);t.match_length=so-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ao?(n=Hi(t,1,t.match_length-ao),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Hi(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=0,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):t.last_lit&&(Eo(t,!1),0===t.strm.avail_out)?po:go}(r,e):Vi[r.level].func(r,e);if(s!==_o&&s!==wo||(r.status=co),s===po||s===_o)return 0===t.avail_out&&(r.last_flush=-1),Xi;if(s===go&&(1===e?ji(r):5!==e&&(Yi(r,0,0,!1),3===e&&(yo(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),vo(t),0===t.avail_out))return r.last_flush=-1,Xi}return e!==Ji?Xi:r.wrap<=0?1:(2===r.wrap?(ko(r,255&t.adler),ko(r,t.adler>>8&255),ko(r,t.adler>>16&255),ko(r,t.adler>>24&255),ko(r,255&t.total_in),ko(r,t.total_in>>8&255),ko(r,t.total_in>>16&255),ko(r,t.total_in>>24&255)):(To(r,t.adler>>>16),To(r,65535&t.adler)),vo(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Xi:1)}Vi=[new So(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ao(t),0===t.lookahead&&e===Ki)return po;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,Eo(t,!1),0===t.strm.avail_out))return po;if(t.strstart-t.block_start>=t.w_size-ho&&(Eo(t,!1),0===t.strm.avail_out))return po}return t.insert=0,e===Ji?(Eo(t,!0),0===t.strm.avail_out?_o:wo):(t.strstart>t.block_start&&(Eo(t,!1),t.strm.avail_out),po)})),new So(4,4,8,4,Lo),new So(4,5,16,8,Lo),new So(4,6,32,32,Lo),new So(4,4,16,16,xo),new So(8,16,32,32,xo),new So(8,16,128,128,xo),new So(8,32,128,256,xo),new So(32,128,258,1024,xo),new So(32,258,258,4096,xo)];var Po=30,Mo=12;function Bo(t,e){var n,r,i,o,a,s,h,l,u,f,c,d,p,g,_,w,m,b,y,v,E,k,T,R,A;n=t.state,r=t.next_in,R=t.input,i=r+(t.avail_in-5),o=t.next_out,A=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),h=n.dmax,l=n.wsize,u=n.whave,f=n.wnext,c=n.window,d=n.hold,p=n.bits,g=n.lencode,_=n.distcode,w=(1<<n.lenbits)-1,m=(1<<n.distbits)-1;t:do{p<15&&(d+=R[r++]<<p,p+=8,d+=R[r++]<<p,p+=8),b=g[d&w];e:for(;;){if(d>>>=y=b>>>24,p-=y,0===(y=b>>>16&255))A[o++]=65535&b;else{if(!(16&y)){if(0==(64&y)){b=g[(65535&b)+(d&(1<<y)-1)];continue e}if(32&y){n.mode=Mo;break t}t.msg="invalid literal/length code",n.mode=Po;break t}v=65535&b,(y&=15)&&(p<y&&(d+=R[r++]<<p,p+=8),v+=d&(1<<y)-1,d>>>=y,p-=y),p<15&&(d+=R[r++]<<p,p+=8,d+=R[r++]<<p,p+=8),b=_[d&m];n:for(;;){if(d>>>=y=b>>>24,p-=y,!(16&(y=b>>>16&255))){if(0==(64&y)){b=_[(65535&b)+(d&(1<<y)-1)];continue n}t.msg="invalid distance code",n.mode=Po;break t}if(E=65535&b,p<(y&=15)&&(d+=R[r++]<<p,(p+=8)<y&&(d+=R[r++]<<p,p+=8)),(E+=d&(1<<y)-1)>h){t.msg="invalid distance too far back",n.mode=Po;break t}if(d>>>=y,p-=y,E>(y=o-a)){if((y=E-y)>u&&n.sane){t.msg="invalid distance too far back",n.mode=Po;break t}if(k=0,T=c,0===f){if(k+=l-y,y<v){v-=y;do{A[o++]=c[k++]}while(--y);k=o-E,T=A}}else if(f<y){if(k+=l+f-y,(y-=f)<v){v-=y;do{A[o++]=c[k++]}while(--y);if(k=0,f<v){v-=y=f;do{A[o++]=c[k++]}while(--y);k=o-E,T=A}}}else if(k+=f-y,y<v){v-=y;do{A[o++]=c[k++]}while(--y);k=o-E,T=A}for(;v>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],v-=3;v&&(A[o++]=T[k++],v>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],v-=3}while(v>2);v&&(A[o++]=A[k++],v>1&&(A[o++]=A[k++]))}break}}break}}while(r<i&&o<s);r-=v=p>>3,d&=(1<<(p-=v<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<s?s-o+257:257-(o-s),n.hold=d,n.bits=p}var Do=15,zo=852,No=592,Uo=0,Fo=1,Yo=2,jo=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Zo=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Ho=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Wo=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function qo(t,e,n,r,i,o,a,s){var h,l,u,f,c,d,p,g,_,w=s.bits,m=0,b=0,y=0,v=0,E=0,k=0,T=0,R=0,A=0,L=0,x=null,S=0,C=new Yr(Do+1),I=new Yr(Do+1),O=null,P=0;for(m=0;m<=Do;m++)C[m]=0;for(b=0;b<r;b++)C[e[n+b]]++;for(E=w,v=Do;v>=1&&0===C[v];v--);if(E>v&&(E=v),0===v)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(y=1;y<v&&0===C[y];y++);for(E<y&&(E=y),R=1,m=1;m<=Do;m++)if(R<<=1,(R-=C[m])<0)return-1;if(R>0&&(t===Uo||1!==v))return-1;for(I[1]=0,m=1;m<Do;m++)I[m+1]=I[m]+C[m];for(b=0;b<r;b++)0!==e[n+b]&&(a[I[e[n+b]]++]=b);if(t===Uo?(x=O=a,d=19):t===Fo?(x=jo,S-=257,O=Zo,P-=257,d=256):(x=Ho,O=Wo,d=-1),L=0,b=0,m=y,c=o,k=E,T=0,u=-1,f=(A=1<<E)-1,t===Fo&&A>zo||t===Yo&&A>No)return 1;for(;;){p=m-T,a[b]<d?(g=0,_=a[b]):a[b]>d?(g=O[P+a[b]],_=x[S+a[b]]):(g=96,_=0),h=1<<m-T,y=l=1<<k;do{i[c+(L>>T)+(l-=h)]=p<<24|g<<16|_|0}while(0!==l);for(h=1<<m-1;L&h;)h>>=1;if(0!==h?(L&=h-1,L+=h):L=0,b++,0==--C[m]){if(m===v)break;m=e[n+a[b]]}if(m>E&&(L&f)!==u){for(0===T&&(T=E),c+=y,R=1<<(k=m-T);k+T<v&&!((R-=C[k+T])<=0);)k++,R<<=1;if(A+=1<<k,t===Fo&&A>zo||t===Yo&&A>No)return 1;i[u=L&f]=E<<24|k<<16|c-o|0}}return 0!==L&&(i[c+L]=m-T<<24|64<<16|0),s.bits=E,0}var Go=1,Vo=2,Ko=0,Jo=-2,Xo=1,Qo=12,$o=30,ta=852,ea=592;function na(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function ra(){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 Yr(320),this.work=new Yr(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ia(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Xo,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new jr(ta),e.distcode=e.distdyn=new jr(ea),e.sane=1,e.back=-1,Ko):Jo}(t)):Jo}function oa(t,e){var n,r;return t?(r=new ra,t.state=r,r.window=null,n=function(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Jo:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,ia(t))):Jo}(t,e),n!==Ko&&(t.state=null),n):Jo}var aa,sa,ha=!0;function la(t){if(ha){var e;for(aa=new jr(512),sa=new jr(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(qo(Go,t.lens,0,288,aa,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;qo(Vo,t.lens,0,32,sa,0,t.work,{bits:5}),ha=!1}t.lencode=aa,t.lenbits=9,t.distcode=sa,t.distbits=5}function ua(t,e){var n,r,i,o,a,s,h,l,u,f,c,d,p,g,_,w,m,b,y,v,E,k,T,R,A=0,L=new Fr(4),x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return Jo;(n=t.state).mode===Qo&&(n.mode=13),a=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,l=n.hold,u=n.bits,f=s,c=h,k=Ko;t:for(;;)switch(n.mode){case Xo:if(0===n.wrap){n.mode=13;break}for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(2&n.wrap&&35615===l){n.check=0,L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0),l=0,u=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",n.mode=$o;break}if(8!=(15&l)){t.msg="unknown compression method",n.mode=$o;break}if(u-=4,E=8+(15&(l>>>=4)),0===n.wbits)n.wbits=E;else if(E>n.wbits){t.msg="invalid window size",n.mode=$o;break}n.dmax=1<<E,t.adler=n.check=1,n.mode=512&l?10:Qo,l=0,u=0;break;case 2:for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(n.flags=l,8!=(255&n.flags)){t.msg="unknown compression method",n.mode=$o;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=$o;break}n.head&&(n.head.text=l>>8&1),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0)),l=0,u=0,n.mode=3;case 3:for(;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.head&&(n.head.time=l),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,L[2]=l>>>16&255,L[3]=l>>>24&255,n.check=Gi(n.check,L,4,0)),l=0,u=0,n.mode=4;case 4:for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.head&&(n.head.xflags=255&l,n.head.os=l>>8),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0)),l=0,u=0,n.mode=5;case 5:if(1024&n.flags){for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),512&n.flags&&(L[0]=255&l,L[1]=l>>>8&255,n.check=Gi(n.check,L,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((d=n.length)>s&&(d=s),d&&(n.head&&(E=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Ur(n.head.extra,r,o,d,E)),512&n.flags&&(n.check=Gi(n.check,r,d,o)),s-=d,o+=d,n.length-=d),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break t;d=0;do{E=r[o+d++],n.head&&E&&n.length<65536&&(n.head.name+=String.fromCharCode(E))}while(E&&d<s);if(512&n.flags&&(n.check=Gi(n.check,r,d,o)),s-=d,o+=d,E)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break t;d=0;do{E=r[o+d++],n.head&&E&&n.length<65536&&(n.head.comment+=String.fromCharCode(E))}while(E&&d<s);if(512&n.flags&&(n.check=Gi(n.check,r,d,o)),s-=d,o+=d,E)break t}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;u<16;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(l!==(65535&n.check)){t.msg="header crc mismatch",n.mode=$o;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Qo;break;case 10:for(;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}t.adler=n.check=na(l),l=0,u=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=a,t.avail_out=h,t.next_in=o,t.avail_in=s,n.hold=l,n.bits=u,2;t.adler=n.check=1,n.mode=Qo;case Qo:if(5===e||6===e)break t;case 13:if(n.last){l>>>=7&u,u-=7&u,n.mode=27;break}for(;u<3;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}switch(n.last=1&l,u-=1,3&(l>>>=1)){case 0:n.mode=14;break;case 1:if(la(n),n.mode=20,6===e){l>>>=2,u-=2;break t}break;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=$o}l>>>=2,u-=2;break;case 14:for(l>>>=7&u,u-=7&u;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",n.mode=$o;break}if(n.length=65535&l,l=0,u=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(d=n.length){if(d>s&&(d=s),d>h&&(d=h),0===d)break t;Ur(i,r,o,d,a),s-=d,o+=d,h-=d,a+=d,n.length-=d;break}n.mode=Qo;break;case 17:for(;u<14;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(n.nlen=257+(31&l),l>>>=5,u-=5,n.ndist=1+(31&l),l>>>=5,u-=5,n.ncode=4+(15&l),l>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=$o;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;u<3;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.lens[x[n.have++]]=7&l,l>>>=3,u-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},k=qo(0,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,k){t.msg="invalid code lengths set",n.mode=$o;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;w=(A=n.lencode[l&(1<<n.lenbits)-1])>>>16&255,m=65535&A,!((_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(m<16)l>>>=_,u-=_,n.lens[n.have++]=m;else{if(16===m){for(R=_+2;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(l>>>=_,u-=_,0===n.have){t.msg="invalid bit length repeat",n.mode=$o;break}E=n.lens[n.have-1],d=3+(3&l),l>>>=2,u-=2}else if(17===m){for(R=_+3;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}u-=_,E=0,d=3+(7&(l>>>=_)),l>>>=3,u-=3}else{for(R=_+7;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}u-=_,E=0,d=11+(127&(l>>>=_)),l>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=$o;break}for(;d--;)n.lens[n.have++]=E}}if(n.mode===$o)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=$o;break}if(n.lenbits=9,T={bits:n.lenbits},k=qo(Go,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,k){t.msg="invalid literal/lengths set",n.mode=$o;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},k=qo(Vo,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,k){t.msg="invalid distances set",n.mode=$o;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(s>=6&&h>=258){t.next_out=a,t.avail_out=h,t.next_in=o,t.avail_in=s,n.hold=l,n.bits=u,Bo(t,c),a=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,l=n.hold,u=n.bits,n.mode===Qo&&(n.back=-1);break}for(n.back=0;w=(A=n.lencode[l&(1<<n.lenbits)-1])>>>16&255,m=65535&A,!((_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(w&&0==(240&w)){for(b=_,y=w,v=m;w=(A=n.lencode[v+((l&(1<<b+y)-1)>>b)])>>>16&255,m=65535&A,!(b+(_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=m,0===w){n.mode=26;break}if(32&w){n.back=-1,n.mode=Qo;break}if(64&w){t.msg="invalid literal/length code",n.mode=$o;break}n.extra=15&w,n.mode=22;case 22:if(n.extra){for(R=n.extra;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;w=(A=n.distcode[l&(1<<n.distbits)-1])>>>16&255,m=65535&A,!((_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(0==(240&w)){for(b=_,y=w,v=m;w=(A=n.distcode[v+((l&(1<<b+y)-1)>>b)])>>>16&255,m=65535&A,!(b+(_=A>>>24)<=u);){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,64&w){t.msg="invalid distance code",n.mode=$o;break}n.offset=m,n.extra=15&w,n.mode=24;case 24:if(n.extra){for(R=n.extra;u<R;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=$o;break}n.mode=25;case 25:if(0===h)break t;if(d=c-h,n.offset>d){if((d=n.offset-d)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=$o;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=a-n.offset,d=n.length;d>h&&(d=h),h-=d,n.length-=d;do{i[a++]=g[p++]}while(--d);0===n.length&&(n.mode=21);break;case 26:if(0===h)break t;i[a++]=n.length,h--,n.mode=21;break;case 27:if(n.wrap){for(;u<32;){if(0===s)break t;s--,l|=r[o++]<<u,u+=8}if(c-=h,t.total_out+=c,n.total+=c,c&&(t.adler=n.check=n.flags?Gi(n.check,i,c,a-c):Wi(n.check,i,c,a-c)),c=h,(n.flags?l:na(l))!==n.check){t.msg="incorrect data check",n.mode=$o;break}l=0,u=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;u<32;){if(0===s)break t;s--,l+=r[o++]<<u,u+=8}if(l!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=$o;break}l=0,u=0}n.mode=29;case 29:k=1;break t;case $o:k=-3;break t;case 31:return-4;default:return Jo}return t.next_out=a,t.avail_out=h,t.next_in=o,t.avail_in=s,n.hold=l,n.bits=u,(n.wsize||c!==t.avail_out&&n.mode<$o&&(n.mode<27||4!==e))&&function(t,e,n,r){var i,o=t.state;null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Fr(o.wsize)),r>=o.wsize?(Ur(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>r&&(i=r),Ur(o.window,e,n-r,i,o.wnext),(r-=i)?(Ur(o.window,e,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i)))}(t,t.output,t.next_out,c-t.avail_out),f-=t.avail_in,c-=t.avail_out,t.total_in+=f,t.total_out+=c,n.total+=c,n.wrap&&c&&(t.adler=n.check=n.flags?Gi(n.check,i,c,t.next_out-c):Wi(n.check,i,c,t.next_out-c)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Qo?128:0)+(20===n.mode||15===n.mode?256:0),(0===f&&0===c||4===e)&&k===Ko&&(k=-5),k}var fa;function ca(t){if(t<1||t>7)throw new TypeError("Bad argument");this.mode=t,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function da(t,e){for(var n=0;n<t.length;n++)this[e+n]=t[n]}ca.prototype.init=function(t,e,n,r,i){var o;switch(this.windowBits=t,this.level=e,this.memLevel=n,this.strategy=r,3!==this.mode&&4!==this.mode||(this.windowBits+=16),7===this.mode&&(this.windowBits+=32),5!==this.mode&&6!==this.mode||(this.windowBits=-this.windowBits),this.strm=new Nr,this.mode){case 1:case 3:case 5:o=function(t,e,n,r,i,o){if(!t)return Qi;var a=1;if(-1===e&&(e=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||n!==to||r<8||r>15||e<0||e>9||o<0||o>4)return mo(t,Qi);8===r&&(r=9);var s=new Co;return t.state=s,s.strm=t,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ao-1)/ao),s.window=new Fr(2*s.w_size),s.head=new Yr(s.hash_size),s.prev=new Yr(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Fr(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=e,s.strategy=o,s.method=n,Io(t)}(this.strm,this.level,8,this.windowBits,this.memLevel,this.strategy);break;case 2:case 4:case 6:case 7:o=oa(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}0===o?(this.write_in_progress=!1,this.init_done=!0):this._error(o)},ca.prototype.params=function(){throw new Error("deflateParams Not supported")},ca.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(0===this.mode)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},ca.prototype.write=function(t,e,n,r,i,o,a){this._writeCheck(),this.write_in_progress=!0;var s=this;return Ve.nextTick((function(){s.write_in_progress=!1;var h=s._write(t,e,n,r,i,o,a);s.callback(h[0],h[1]),s.pending_close&&s.close()})),this},ca.prototype.writeSync=function(t,e,n,r,i,o,a){return this._writeCheck(),this._write(t,e,n,r,i,o,a)},ca.prototype._write=function(t,e,n,r,i,o,a){if(this.write_in_progress=!0,0!==t&&1!==t&&2!==t&&3!==t&&4!==t&&5!==t)throw new Error("Invalid flush value");null==e&&(e=new Dt(0),r=0,n=0),i._set?i.set=i._set:i.set=da;var s,h=this.strm;switch(h.avail_in=r,h.input=e,h.next_in=n,h.avail_out=a,h.output=i,h.next_out=o,this.mode){case 1:case 3:case 5:s=Oo(h,t);break;case 7:case 2:case 4:case 6:s=ua(h,t);break;default:throw new Error("Unknown mode "+this.mode)}return this._checkError(s,h,t)||this._error(s),this.write_in_progress=!1,[h.avail_in,h.avail_out]},ca.prototype._checkError=function(t,e,n){switch(t){case 0:case-5:if(0!==e.avail_out&&4===n)return!1;break;case 1:break;default:return!1}return!0},ca.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,1===this.mode||3===this.mode||5===this.mode?function(t){var e;t&&t.state&&((e=t.state.status)!==lo&&69!==e&&73!==e&&91!==e&&e!==uo&&e!==fo&&e!==co?mo(t,Qi):(t.state=null,e===fo&&mo(t,-3)))}(this.strm):function(t){if(!t||!t.state)return Jo;var e=t.state;e.window&&(e.window=null),t.state=null}(this.strm),this.mode=0)},ca.prototype.reset=function(){switch(this.mode){case 1:case 5:fa=Io(this.strm);break;case 2:case 6:fa=ia(this.strm)}0!==fa&&this._error(fa)},ca.prototype._error=function(t){this.onerror(zr[t]+": "+this.strm.msg,t),this.write_in_progress=!1,this.pending_close&&this.close()};var pa=Object.freeze({__proto__:null,DEFLATE:1,DEFLATERAW:5,GUNZIP:4,GZIP:3,INFLATE:2,INFLATERAW:6,NONE:0,UNZIP:7,Z_BEST_COMPRESSION:9,Z_BEST_SPEED:1,Z_BINARY:0,Z_BLOCK:5,Z_BUF_ERROR:-5,Z_DATA_ERROR:-3,Z_DEFAULT_COMPRESSION:-1,Z_DEFAULT_STRATEGY:0,Z_DEFLATED:8,Z_ERRNO:-1,Z_FILTERED:1,Z_FINISH:4,Z_FIXED:4,Z_FULL_FLUSH:3,Z_HUFFMAN_ONLY:2,Z_NEED_DICT:2,Z_NO_COMPRESSION:0,Z_NO_FLUSH:0,Z_OK:0,Z_PARTIAL_FLUSH:1,Z_RLE:3,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_SYNC_FLUSH:2,Z_TEXT:1,Z_TREES:6,Z_UNKNOWN:2,Zlib:ca});var ga={};Object.keys(pa).forEach((function(t){ga[t]=pa[t]})),ga.Z_MIN_WINDOWBITS=8,ga.Z_MAX_WINDOWBITS=15,ga.Z_DEFAULT_WINDOWBITS=15,ga.Z_MIN_CHUNK=64,ga.Z_MAX_CHUNK=1/0,ga.Z_DEFAULT_CHUNK=16384,ga.Z_MIN_MEMLEVEL=1,ga.Z_MAX_MEMLEVEL=9,ga.Z_DEFAULT_MEMLEVEL=8,ga.Z_MIN_LEVEL=-1,ga.Z_MAX_LEVEL=9,ga.Z_DEFAULT_LEVEL=ga.Z_DEFAULT_COMPRESSION;var _a={Z_OK:ga.Z_OK,Z_STREAM_END:ga.Z_STREAM_END,Z_NEED_DICT:ga.Z_NEED_DICT,Z_ERRNO:ga.Z_ERRNO,Z_STREAM_ERROR:ga.Z_STREAM_ERROR,Z_DATA_ERROR:ga.Z_DATA_ERROR,Z_MEM_ERROR:ga.Z_MEM_ERROR,Z_BUF_ERROR:ga.Z_BUF_ERROR,Z_VERSION_ERROR:ga.Z_VERSION_ERROR};function wa(t){return new Fa(t)}function ma(t){return new Ya(t)}function ba(t){return new Ha(t)}function ya(t){return new Wa(t)}function va(t){return new ja(t)}function Ea(t){return new Za(t)}function ka(t){return new qa(t)}function Ta(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Fa(e),t,n)}function Ra(t,e){return Ua(new Fa(e),t)}function Aa(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new ja(e),t,n)}function La(t,e){return Ua(new ja(e),t)}function xa(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Ha(e),t,n)}function Sa(t,e){return Ua(new Ha(e),t)}function Ca(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new qa(e),t,n)}function Ia(t,e){return Ua(new qa(e),t)}function Oa(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Ya(e),t,n)}function Pa(t,e){return Ua(new Ya(e),t)}function Ma(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Za(e),t,n)}function Ba(t,e){return Ua(new Za(e),t)}function Da(t,e,n){return"function"==typeof e&&(n=e,e={}),Na(new Wa(e),t,n)}function za(t,e){return Ua(new Wa(e),t)}function Na(t,e,n){var r=[],i=0;function o(){for(var e;null!==(e=t.read());)r.push(e),i+=e.length;t.once("readable",o)}function a(){var e=Dt.concat(r,i);r=[],n(null,e),t.close()}t.on("error",(function(e){t.removeListener("end",a),t.removeListener("readable",o),n(e)})),t.on("end",a),t.end(e),o()}function Ua(t,e){if("string"==typeof e&&(e=new Dt(e)),!Dt.isBuffer(e))throw new TypeError("Not a string or buffer");var n=ga.Z_FINISH;return t._processChunk(e,n)}function Fa(t){if(!(this instanceof Fa))return new Fa(t);Ga.call(this,t,ga.DEFLATE)}function Ya(t){if(!(this instanceof Ya))return new Ya(t);Ga.call(this,t,ga.INFLATE)}function ja(t){if(!(this instanceof ja))return new ja(t);Ga.call(this,t,ga.GZIP)}function Za(t){if(!(this instanceof Za))return new Za(t);Ga.call(this,t,ga.GUNZIP)}function Ha(t){if(!(this instanceof Ha))return new Ha(t);Ga.call(this,t,ga.DEFLATERAW)}function Wa(t){if(!(this instanceof Wa))return new Wa(t);Ga.call(this,t,ga.INFLATERAW)}function qa(t){if(!(this instanceof qa))return new qa(t);Ga.call(this,t,ga.UNZIP)}function Ga(t,e){if(this._opts=t=t||{},this._chunkSize=t.chunkSize||ga.Z_DEFAULT_CHUNK,Ir.call(this,t),t.flush&&t.flush!==ga.Z_NO_FLUSH&&t.flush!==ga.Z_PARTIAL_FLUSH&&t.flush!==ga.Z_SYNC_FLUSH&&t.flush!==ga.Z_FULL_FLUSH&&t.flush!==ga.Z_FINISH&&t.flush!==ga.Z_BLOCK)throw new Error("Invalid flush flag: "+t.flush);if(this._flushFlag=t.flush||ga.Z_NO_FLUSH,t.chunkSize&&(t.chunkSize<ga.Z_MIN_CHUNK||t.chunkSize>ga.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBits<ga.Z_MIN_WINDOWBITS||t.windowBits>ga.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.level<ga.Z_MIN_LEVEL||t.level>ga.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevel<ga.Z_MIN_MEMLEVEL||t.memLevel>ga.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=ga.Z_FILTERED&&t.strategy!=ga.Z_HUFFMAN_ONLY&&t.strategy!=ga.Z_RLE&&t.strategy!=ga.Z_FIXED&&t.strategy!=ga.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!Dt.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new ga.Zlib(e);var n=this;this._hadError=!1,this._binding.onerror=function(t,e){n._binding=null,n._hadError=!0;var r=new Error(t);r.errno=e,r.code=_a[e],n.emit("error",r)};var r=ga.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(r=t.level);var i=ga.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(i=t.strategy),this._binding.init(t.windowBits||ga.Z_DEFAULT_WINDOWBITS,r,t.memLevel||ga.Z_DEFAULT_MEMLEVEL,i,t.dictionary),this._buffer=new Dt(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=i,this.once("end",this.close)}Object.keys(_a).forEach((function(t){_a[_a[t]]=t})),Je(Ga,Ir),Ga.prototype.params=function(t,e,n){if(t<ga.Z_MIN_LEVEL||t>ga.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(e!=ga.Z_FILTERED&&e!=ga.Z_HUFFMAN_ONLY&&e!=ga.Z_RLE&&e!=ga.Z_FIXED&&e!=ga.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+e);if(this._level!==t||this._strategy!==e){var r=this;this.flush(ga.Z_SYNC_FLUSH,(function(){r._binding.params(t,e),r._hadError||(r._level=t,r._strategy=e,n&&n())}))}else Ve.nextTick(n)},Ga.prototype.reset=function(){return this._binding.reset()},Ga.prototype._flush=function(t){this._transform(new Dt(0),"",t)},Ga.prototype.flush=function(t,e){var n=this._writableState;if(("function"==typeof t||void 0===t&&!e)&&(e=t,t=ga.Z_FULL_FLUSH),n.ended)e&&Ve.nextTick(e);else if(n.ending)e&&this.once("end",e);else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(e)}))}else this._flushFlag=t,this.write(new Dt(0),"",e)},Ga.prototype.close=function(t){if(t&&Ve.nextTick(t),!this._closed){this._closed=!0,this._binding.close();var e=this;Ve.nextTick((function(){e.emit("close")}))}},Ga.prototype._transform=function(t,e,n){var r,i=this._writableState,o=(i.ending||i.ended)&&(!t||i.length===t.length);if(null===!t&&!Dt.isBuffer(t))return n(new Error("invalid input"));o?r=ga.Z_FINISH:(r=this._flushFlag,t.length>=i.length&&(this._flushFlag=this._opts.flush||ga.Z_NO_FLUSH)),this._processChunk(t,r,n)},Ga.prototype._processChunk=function(t,e,n){var r=t&&t.length,i=this._chunkSize-this._offset,o=0,a=this,s="function"==typeof n;if(!s){var h,l=[],u=0;this.on("error",(function(t){h=t}));do{var f=this._binding.writeSync(e,t,o,r,this._buffer,this._offset,i)}while(!this._hadError&&p(f[0],f[1]));if(this._hadError)throw h;var c=Dt.concat(l,u);return this.close(),c}var d=this._binding.write(e,t,o,r,this._buffer,this._offset,i);function p(h,f){if(!a._hadError){var c=i-f;if(function(t,e){if(!t)throw new Error(e)}(c>=0,"have should not go down"),c>0){var d=a._buffer.slice(a._offset,a._offset+c);a._offset+=c,s?a.push(d):(l.push(d),u+=d.length)}if((0===f||a._offset>=a._chunkSize)&&(i=a._chunkSize,a._offset=0,a._buffer=new Dt(a._chunkSize)),0===f){if(o+=r-h,r=h,!s)return!0;var g=a._binding.write(e,t,o,r,a._buffer,a._offset,a._chunkSize);return g.callback=p,void(g.buffer=t)}if(!s)return!1;n()}}d.buffer=t,d.callback=p},Je(Fa,Ga),Je(Ya,Ga),Je(ja,Ga),Je(Za,Ga),Je(Ha,Ga),Je(Wa,Ga),Je(qa,Ga);var Va={codes:_a,createDeflate:wa,createInflate:ma,createDeflateRaw:ba,createInflateRaw:ya,createGzip:va,createGunzip:Ea,createUnzip:ka,deflate:Ta,deflateSync:Ra,gzip:Aa,gzipSync:La,deflateRaw:xa,deflateRawSync:Sa,unzip:Ca,unzipSync:Ia,inflate:Oa,inflateSync:Pa,gunzip:Ma,gunzipSync:Ba,inflateRaw:Da,inflateRawSync:za,Deflate:Fa,Inflate:Ya,Gzip:ja,Gunzip:Za,DeflateRaw:Ha,InflateRaw:Wa,Unzip:qa,Zlib:Ga},Ka=e(Object.freeze({__proto__:null,Deflate:Fa,DeflateRaw:Ha,Gunzip:Za,Gzip:ja,Inflate:Ya,InflateRaw:Wa,Unzip:qa,Zlib:Ga,codes:_a,createDeflate:wa,createDeflateRaw:ba,createGunzip:Ea,createGzip:va,createInflate:ma,createInflateRaw:ya,createUnzip:ka,default:Va,deflate:Ta,deflateRaw:xa,deflateRawSync:Sa,deflateSync:Ra,gunzip:Ma,gunzipSync:Ba,gzip:Aa,gzipSync:La,inflate:Oa,inflateRaw:Da,inflateRawSync:za,inflateSync:Pa,unzip:Ca,unzipSync:Ia})),Ja={exports:{}};let Xa=zn,Qa=Br,$a=Ja.exports=function(){Qa.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};Xa.inherits($a,Qa),$a.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),Ve.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},$a.prototype.write=function(t,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let n;return n=Dt.isBuffer(t)?t:Dt.from(t,e||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused},$a.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},$a.prototype.destroySoon=$a.prototype.end,$a.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},$a.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},$a.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},$a.prototype._processRead=function(t){this._reads.shift();let e=0,n=0,r=Dt.alloc(t.length);for(;e<t.length;){let i=this._buffers[n++],o=Math.min(i.length,t.length-e);i.copy(r,e,0,o),e+=o,o!==i.length&&(this._buffers[--n]=i.slice(o))}n>0&&this._buffers.splice(0,n),this._buffered-=t.length,t.func.call(this,r)},$a.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}};var ts=Ja.exports,es={exports:{}},ns={exports:{}},rs={};let is=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];rs.getImagePasses=function(t,e){let n=[],r=t%8,i=e%8,o=(t-r)/8,a=(e-i)/8;for(let t=0;t<is.length;t++){let e=is[t],s=o*e.x.length,h=a*e.y.length;for(let t=0;t<e.x.length&&e.x[t]<r;t++)s++;for(let t=0;t<e.y.length&&e.y[t]<i;t++)h++;s>0&&h>0&&n.push({width:s,height:h,index:t})}return n},rs.getInterlaceIterator=function(t){return function(e,n,r){let i=e%is[r].x.length,o=(e-i)/is[r].x.length*8+is[r].x[i],a=n%is[r].y.length;return 4*o+((n-a)/is[r].y.length*8+is[r].y[a])*t*4}};var os=function(t,e,n){let r=t+e-n,i=Math.abs(r-t),o=Math.abs(r-e),a=Math.abs(r-n);return i<=o&&i<=a?t:o<=a?e:n};let as=rs,ss=os;function hs(t,e,n){let r=t*e;return 8!==n&&(r=Math.ceil(r/(8/n))),r}let ls=ns.exports=function(t,e){let n=t.width,r=t.height,i=t.interlace,o=t.bpp,a=t.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],i){let t=as.getImagePasses(n,r);for(let e=0;e<t.length;e++)this._images.push({byteWidth:hs(t[e].width,o,a),height:t[e].height,lineIndex:0})}else this._images.push({byteWidth:hs(n,o,a),height:r,lineIndex:0});this._xComparison=8===a?o:16===a?2*o:1};ls.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},ls.prototype._unFilterType1=function(t,e,n){let r=this._xComparison,i=r-1;for(let o=0;o<n;o++){let n=t[1+o],a=o>i?e[o-r]:0;e[o]=n+a}},ls.prototype._unFilterType2=function(t,e,n){let r=this._lastLine;for(let i=0;i<n;i++){let n=t[1+i],o=r?r[i]:0;e[i]=n+o}},ls.prototype._unFilterType3=function(t,e,n){let r=this._xComparison,i=r-1,o=this._lastLine;for(let a=0;a<n;a++){let n=t[1+a],s=o?o[a]:0,h=a>i?e[a-r]:0,l=Math.floor((h+s)/2);e[a]=n+l}},ls.prototype._unFilterType4=function(t,e,n){let r=this._xComparison,i=r-1,o=this._lastLine;for(let a=0;a<n;a++){let n=t[1+a],s=o?o[a]:0,h=a>i?e[a-r]:0,l=a>i&&o?o[a-r]:0,u=ss(h,s,l);e[a]=n+u}},ls.prototype._reverseFilterLine=function(t){let e,n=t[0],r=this._images[this._imageIndex],i=r.byteWidth;if(0===n)e=t.slice(1,i+1);else switch(e=Dt.alloc(i),n){case 1:this._unFilterType1(t,e,i);break;case 2:this._unFilterType2(t,e,i);break;case 3:this._unFilterType3(t,e,i);break;case 4:this._unFilterType4(t,e,i);break;default:throw new Error("Unrecognised filter type - "+n)}this.write(e),r.lineIndex++,r.lineIndex>=r.height?(this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex]):this._lastLine=e,r?this.read(r.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())};var us=ns.exports;let fs=zn,cs=ts,ds=us,ps=es.exports=function(t){cs.call(this);let e=[],n=this;this._filter=new ds(t,{read:this.read.bind(this),write:function(t){e.push(t)},complete:function(){n.emit("complete",Dt.concat(e))}}),this._filter.start()};fs.inherits(ps,cs);var gs=es.exports,_s={exports:{}},ws={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5},ms={exports:{}};let bs=[];!function(){for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;bs[t]=e}}();let ys=ms.exports=function(){this._crc=-1};ys.prototype.write=function(t){for(let e=0;e<t.length;e++)this._crc=bs[255&(this._crc^t[e])]^this._crc>>>8;return!0},ys.prototype.crc32=function(){return-1^this._crc},ys.crc32=function(t){let e=-1;for(let n=0;n<t.length;n++)e=bs[255&(e^t[n])]^e>>>8;return-1^e};var vs=ms.exports;let Es=ws,ks=vs,Ts=_s.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[Es.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[Es.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[Es.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[Es.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[Es.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[Es.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};Ts.prototype.start=function(){this.read(Es.PNG_SIGNATURE.length,this._parseSignature.bind(this))},Ts.prototype._parseSignature=function(t){let e=Es.PNG_SIGNATURE;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return void this.error(new Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},Ts.prototype._parseChunkBegin=function(t){let e=t.readUInt32BE(0),n=t.readUInt32BE(4),r="";for(let e=4;e<8;e++)r+=String.fromCharCode(t[e]);let i=Boolean(32&t[4]);if(this._hasIHDR||n===Es.TYPE_IHDR){if(this._crc=new ks,this._crc.write(Dt.from(r)),this._chunks[n])return this._chunks[n](e);i?this.read(e+4,this._skipChunk.bind(this)):this.error(new Error("Unsupported critical chunk type "+r))}else this.error(new Error("Expected IHDR on beggining"))},Ts.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},Ts.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},Ts.prototype._parseChunkEnd=function(t){let e=t.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==e?this.error(new Error("Crc error - "+e+" - "+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},Ts.prototype._handleIHDR=function(t){this.read(t,this._parseIHDR.bind(this))},Ts.prototype._parseIHDR=function(t){this._crc.write(t);let e=t.readUInt32BE(0),n=t.readUInt32BE(4),r=t[8],i=t[9],o=t[10],a=t[11],s=t[12];if(8!==r&&4!==r&&2!==r&&1!==r&&16!==r)return void this.error(new Error("Unsupported bit depth "+r));if(!(i in Es.COLORTYPE_TO_BPP_MAP))return void this.error(new Error("Unsupported color type"));if(0!==o)return void this.error(new Error("Unsupported compression method"));if(0!==a)return void this.error(new Error("Unsupported filter method"));if(0!==s&&1!==s)return void this.error(new Error("Unsupported interlace method"));this._colorType=i;let h=Es.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:n,depth:r,interlace:Boolean(s),palette:Boolean(i&Es.COLORTYPE_PALETTE),color:Boolean(i&Es.COLORTYPE_COLOR),alpha:Boolean(i&Es.COLORTYPE_ALPHA),bpp:h,colorType:i}),this._handleChunkEnd()},Ts.prototype._handlePLTE=function(t){this.read(t,this._parsePLTE.bind(this))},Ts.prototype._parsePLTE=function(t){this._crc.write(t);let e=Math.floor(t.length/3);for(let n=0;n<e;n++)this._palette.push([t[3*n],t[3*n+1],t[3*n+2],255]);this.palette(this._palette),this._handleChunkEnd()},Ts.prototype._handleTRNS=function(t){this.simpleTransparency(),this.read(t,this._parseTRNS.bind(this))},Ts.prototype._parseTRNS=function(t){if(this._crc.write(t),this._colorType===Es.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(new Error("Transparency chunk must be after palette"));if(t.length>this._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(let e=0;e<t.length;e++)this._palette[e][3]=t[e];this.palette(this._palette)}this._colorType===Es.COLORTYPE_GRAYSCALE&&this.transColor([t.readUInt16BE(0)]),this._colorType===Es.COLORTYPE_COLOR&&this.transColor([t.readUInt16BE(0),t.readUInt16BE(2),t.readUInt16BE(4)]),this._handleChunkEnd()},Ts.prototype._handleGAMA=function(t){this.read(t,this._parseGAMA.bind(this))},Ts.prototype._parseGAMA=function(t){this._crc.write(t),this.gamma(t.readUInt32BE(0)/Es.GAMMA_DIVISION),this._handleChunkEnd()},Ts.prototype._handleIDAT=function(t){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-t,this._parseIDAT.bind(this,t))},Ts.prototype._parseIDAT=function(t,e){if(this._crc.write(e),this._colorType===Es.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw new Error("Expected palette not found");this.inflateData(e);let n=t-e.length;n>0?this._handleIDAT(n):this._handleChunkEnd()},Ts.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},Ts.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()};var Rs=_s.exports,As={};let Ls=rs,xs=[function(){},function(t,e,n,r){if(r===e.length)throw new Error("Ran out of data");let i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=255},function(t,e,n,r){if(r+1>=e.length)throw new Error("Ran out of data");let i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=e[r+1]},function(t,e,n,r){if(r+2>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=255},function(t,e,n,r){if(r+3>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=e[r+3]}],Ss=[function(){},function(t,e,n,r){let i=e[0];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=r},function(t,e,n){let r=e[0];t[n]=r,t[n+1]=r,t[n+2]=r,t[n+3]=e[1]},function(t,e,n,r){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=r},function(t,e,n){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3]}];function Cs(t,e,n,r,i,o){let a=t.width,s=t.height,h=t.index;for(let t=0;t<s;t++)for(let s=0;s<a;s++){let a=n(s,t,h);xs[r](e,i,a,o),o+=r}return o}function Is(t,e,n,r,i,o){let a=t.width,s=t.height,h=t.index;for(let t=0;t<s;t++){for(let s=0;s<a;s++){let a=i.get(r),l=n(s,t,h);Ss[r](e,a,l,o)}i.resetAfterLine()}}As.dataToBitMap=function(t,e){let n,r,i=e.width,o=e.height,a=e.depth,s=e.bpp,h=e.interlace;8!==a&&(n=function(t,e){let n=[],r=0;function i(){if(r===t.length)throw new Error("Ran out of data");let i,o,a,s,h,l,u,f,c=t[r];switch(r++,e){default:throw new Error("unrecognised depth");case 16:u=t[r],r++,n.push((c<<8)+u);break;case 4:u=15&c,f=c>>4,n.push(f,u);break;case 2:h=3&c,l=c>>2&3,u=c>>4&3,f=c>>6&3,n.push(f,u,l,h);break;case 1:i=1&c,o=c>>1&1,a=c>>2&1,s=c>>3&1,h=c>>4&1,l=c>>5&1,u=c>>6&1,f=c>>7&1,n.push(f,u,l,h,s,a,o,i)}}return{get:function(t){for(;n.length<t;)i();let e=n.slice(0,t);return n=n.slice(t),e},resetAfterLine:function(){n.length=0},end:function(){if(r!==t.length)throw new Error("extra data found")}}}(t,a)),r=a<=8?Dt.alloc(i*o*4):new Uint16Array(i*o*4);let l,u,f=Math.pow(2,a)-1,c=0;if(h)l=Ls.getImagePasses(i,o),u=Ls.getInterlaceIterator(i,o);else{let t=0;u=function(){let e=t;return t+=4,e},l=[{width:i,height:o}]}for(let e=0;e<l.length;e++)8===a?c=Cs(l[e],r,u,s,t,c):Is(l[e],r,u,s,n,f);if(8===a){if(c!==t.length)throw new Error("extra data found")}else n.end();return r};var Os=function(t,e){let n=e.depth,r=e.width,i=e.height,o=e.colorType,a=e.transColor,s=e.palette,h=t;return 3===o?function(t,e,n,r,i){let o=0;for(let a=0;a<r;a++)for(let r=0;r<n;r++){let n=i[t[o]];if(!n)throw new Error("index "+t[o]+" not in palette");for(let t=0;t<4;t++)e[o+t]=n[t];o+=4}}(t,h,r,i,s):(a&&function(t,e,n,r,i){let o=0;for(let a=0;a<r;a++)for(let r=0;r<n;r++){let n=!1;if(1===i.length?i[0]===t[o]&&(n=!0):i[0]===t[o]&&i[1]===t[o+1]&&i[2]===t[o+2]&&(n=!0),n)for(let t=0;t<4;t++)e[o+t]=0;o+=4}}(t,h,r,i,a),8!==n&&(16===n&&(h=Dt.alloc(r*i*4)),function(t,e,n,r,i){let o=Math.pow(2,i)-1,a=0;for(let i=0;i<r;i++)for(let r=0;r<n;r++){for(let n=0;n<4;n++)e[a+n]=Math.floor(255*t[a+n]/o+.5);a+=4}}(t,h,r,i,n))),h};let Ps=zn,Ms=Ka,Bs=ts,Ds=gs,zs=Rs,Ns=As,Us=Os,Fs=Dr.exports=function(t){Bs.call(this),this._parser=new zs(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};Ps.inherits(Fs,Bs),Fs.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},Fs.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=Ms.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,e=Math.max(t,Ms.Z_MIN_CHUNK);this._inflate=Ms.createInflate({chunkSize:e});let n=t,r=this.emit.bind(this,"error");this._inflate.on("error",(function(t){n&&r(t)})),this._filter.on("complete",this._complete.bind(this));let i=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){n&&(t.length>n&&(t=t.slice(0,n)),n-=t.length,i(t))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)},Fs.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new Ds(this._bitmapInfo)},Fs.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},Fs.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},Fs.prototype._simpleTransparency=function(){this._metaData.alpha=!0},Fs.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},Fs.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},Fs.prototype._complete=function(t){if(this.errord)return;let e;try{let n=Ns.dataToBitMap(t,this._bitmapInfo);e=Us(n,this._bitmapInfo),n=null}catch(t){return void this._handleError(t)}this.emit("parsed",e)};var Ys=Dr.exports,js={exports:{}},Zs={exports:{}};let Hs=ws;let Ws=os;let qs={0:function(t,e,n,r,i){for(let o=0;o<n;o++)r[i+o]=t[e+o]},1:function(t,e,n,r,i,o){for(let a=0;a<n;a++){let n=a>=o?t[e+a-o]:0,s=t[e+a]-n;r[i+a]=s}},2:function(t,e,n,r,i){for(let o=0;o<n;o++){let a=e>0?t[e+o-n]:0,s=t[e+o]-a;r[i+o]=s}},3:function(t,e,n,r,i,o){for(let a=0;a<n;a++){let s=a>=o?t[e+a-o]:0,h=e>0?t[e+a-n]:0,l=t[e+a]-(s+h>>1);r[i+a]=l}},4:function(t,e,n,r,i,o){for(let a=0;a<n;a++){let s=a>=o?t[e+a-o]:0,h=e>0?t[e+a-n]:0,l=e>0&&a>=o?t[e+a-(n+o)]:0,u=t[e+a]-Ws(s,h,l);r[i+a]=u}}},Gs={0:function(t,e,n){let r=0,i=e+n;for(let n=e;n<i;n++)r+=Math.abs(t[n]);return r},1:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let n=o>=r?t[e+o-r]:0,a=t[e+o]-n;i+=Math.abs(a)}return i},2:function(t,e,n){let r=0,i=e+n;for(let o=e;o<i;o++){let i=e>0?t[o-n]:0,a=t[o]-i;r+=Math.abs(a)}return r},3:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let a=o>=r?t[e+o-r]:0,s=e>0?t[e+o-n]:0,h=t[e+o]-(a+s>>1);i+=Math.abs(h)}return i},4:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let a=o>=r?t[e+o-r]:0,s=e>0?t[e+o-n]:0,h=e>0&&o>=r?t[e+o-(n+r)]:0,l=t[e+o]-Ws(a,s,h);i+=Math.abs(l)}return i}};let Vs=ws,Ks=vs,Js=function(t,e,n,r){let i=-1!==[Hs.COLORTYPE_COLOR_ALPHA,Hs.COLORTYPE_ALPHA].indexOf(r.colorType);if(r.colorType===r.inputColorType){let e=function(){let t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256!==new Int16Array(t)[0]}();if(8===r.bitDepth||16===r.bitDepth&&e)return t}let o=16!==r.bitDepth?t:new Uint16Array(t.buffer),a=255,s=Hs.COLORTYPE_TO_BPP_MAP[r.inputColorType];4!==s||r.inputHasAlpha||(s=3);let h=Hs.COLORTYPE_TO_BPP_MAP[r.colorType];16===r.bitDepth&&(a=65535,h*=2);let l=Dt.alloc(e*n*h),u=0,f=0,c=r.bgColor||{};function d(){let t,e,n,s=a;switch(r.inputColorType){case Hs.COLORTYPE_COLOR_ALPHA:s=o[u+3],t=o[u],e=o[u+1],n=o[u+2];break;case Hs.COLORTYPE_COLOR:t=o[u],e=o[u+1],n=o[u+2];break;case Hs.COLORTYPE_ALPHA:s=o[u+1],t=o[u],e=t,n=t;break;case Hs.COLORTYPE_GRAYSCALE:t=o[u],e=t,n=t;break;default:throw new Error("input color type:"+r.inputColorType+" is not supported at present")}return r.inputHasAlpha&&(i||(s/=a,t=Math.min(Math.max(Math.round((1-s)*c.red+s*t),0),a),e=Math.min(Math.max(Math.round((1-s)*c.green+s*e),0),a),n=Math.min(Math.max(Math.round((1-s)*c.blue+s*n),0),a))),{red:t,green:e,blue:n,alpha:s}}void 0===c.red&&(c.red=a),void 0===c.green&&(c.green=a),void 0===c.blue&&(c.blue=a);for(let t=0;t<n;t++)for(let t=0;t<e;t++){let t=d();switch(r.colorType){case Hs.COLORTYPE_COLOR_ALPHA:case Hs.COLORTYPE_COLOR:8===r.bitDepth?(l[f]=t.red,l[f+1]=t.green,l[f+2]=t.blue,i&&(l[f+3]=t.alpha)):(l.writeUInt16BE(t.red,f),l.writeUInt16BE(t.green,f+2),l.writeUInt16BE(t.blue,f+4),i&&l.writeUInt16BE(t.alpha,f+6));break;case Hs.COLORTYPE_ALPHA:case Hs.COLORTYPE_GRAYSCALE:{let e=(t.red+t.green+t.blue)/3;8===r.bitDepth?(l[f]=e,i&&(l[f+1]=t.alpha)):(l.writeUInt16BE(e,f),i&&l.writeUInt16BE(t.alpha,f+2));break}default:throw new Error("unrecognised color Type "+r.colorType)}u+=s,f+=h}return l},Xs=function(t,e,n,r,i){let o;if("filterType"in r&&-1!==r.filterType){if("number"!=typeof r.filterType)throw new Error("unrecognised filter types");o=[r.filterType]}else o=[0,1,2,3,4];16===r.bitDepth&&(i*=2);let a=e*i,s=0,h=0,l=Dt.alloc((a+1)*n),u=o[0];for(let e=0;e<n;e++){if(o.length>1){let e=1/0;for(let n=0;n<o.length;n++){let r=Gs[o[n]](t,h,a,i);r<e&&(u=o[n],e=r)}}l[s]=u,s++,qs[u](t,h,a,l,s,i),s+=a,h+=a}return l},Qs=Ka,$s=Zs.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||Qs.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:Vs.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:Vs.COLORTYPE_COLOR_ALPHA,-1===[Vs.COLORTYPE_GRAYSCALE,Vs.COLORTYPE_COLOR,Vs.COLORTYPE_COLOR_ALPHA,Vs.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[Vs.COLORTYPE_GRAYSCALE,Vs.COLORTYPE_COLOR,Vs.COLORTYPE_COLOR_ALPHA,Vs.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};$s.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},$s.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},$s.prototype.filterData=function(t,e,n){let r=Js(t,e,n,this._options),i=Vs.COLORTYPE_TO_BPP_MAP[this._options.colorType];return Xs(r,e,n,this._options,i)},$s.prototype._packChunk=function(t,e){let n=e?e.length:0,r=Dt.alloc(n+12);return r.writeUInt32BE(n,0),r.writeUInt32BE(t,4),e&&e.copy(r,8),r.writeInt32BE(Ks.crc32(r.slice(4,r.length-4)),r.length-4),r},$s.prototype.packGAMA=function(t){let e=Dt.alloc(4);return e.writeUInt32BE(Math.floor(t*Vs.GAMMA_DIVISION),0),this._packChunk(Vs.TYPE_gAMA,e)},$s.prototype.packIHDR=function(t,e){let n=Dt.alloc(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(Vs.TYPE_IHDR,n)},$s.prototype.packIDAT=function(t){return this._packChunk(Vs.TYPE_IDAT,t)},$s.prototype.packIEND=function(){return this._packChunk(Vs.TYPE_IEND,null)};var th=Zs.exports;let eh=zn,nh=Br,rh=ws,ih=th,oh=js.exports=function(t){nh.call(this);let e=t||{};this._packer=new ih(e),this._deflate=this._packer.createDeflate(),this.readable=!0};eh.inherits(oh,nh),oh.prototype.pack=function(t,e,n,r){this.emit("data",Dt.from(rh.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,n)),r&&this.emit("data",this._packer.packGAMA(r));let i=this._packer.filterData(t,e,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(i)};var ah=js.exports,sh={},hh={exports:{}};function lh(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0}var uh,fh=Object.prototype.hasOwnProperty,ch=Object.keys||function(t){var e=[];for(var n in t)fh.call(t,n)&&e.push(n);return e},dh=Array.prototype.slice;function ph(){return void 0!==uh?uh:uh="foo"===function(){}.name}function gh(t){return Object.prototype.toString.call(t)}function _h(t){return!be(t)&&("function"==typeof vt.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function wh(t,e){t||kh(t,!0,e,"==",Th)}var mh=/\s*function\s+([^\(\s]*)\s*/;function bh(t){if(kn(t)){if(ph())return t.name;var e=t.toString().match(mh);return e&&e[1]}}function yh(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return vh(Eh(t.actual),128)+" "+t.operator+" "+vh(Eh(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||kh;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=bh(e),o=r.indexOf("\n"+i);if(o>=0){var a=r.indexOf("\n",o+1);r=r.substring(a+1)}this.stack=r}}}function vh(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function Eh(t){if(ph()||!kn(t))return on(t);var e=bh(t);return"[Function"+(e?": "+e:"")+"]"}function kh(t,e,n,r,i){throw new yh({message:n,actual:t,expected:e,operator:r,stackStartFunction:i})}function Th(t,e){t||kh(t,!0,e,"==",Th)}function Rh(t,e,n){t!=e&&kh(t,e,n,"==",Rh)}function Ah(t,e,n){t==e&&kh(t,e,n,"!=",Ah)}function Lh(t,e,n){Sh(t,e,!1)||kh(t,e,n,"deepEqual",Lh)}function xh(t,e,n){Sh(t,e,!0)||kh(t,e,n,"deepStrictEqual",xh)}function Sh(t,e,n,r){if(t===e)return!0;if(be(t)&&be(e))return 0===lh(t,e);if(vn(t)&&vn(e))return t.getTime()===e.getTime();if(bn(t)&&bn(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(_h(t)&&_h(e)&&gh(t)===gh(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===lh(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(be(t)!==be(e))return!1;var i=(r=r||{actual:[],expected:[]}).actual.indexOf(t);return-1!==i&&i===r.expected.indexOf(e)||(r.actual.push(t),r.expected.push(e),function(t,e,n,r){if(null==t||null==e)return!1;if(Tn(t)||Tn(e))return t===e;if(n&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=Ch(t),o=Ch(e);if(i&&!o||!i&&o)return!1;if(i)return Sh(t=dh.call(t),e=dh.call(e),n);var a,s,h=ch(t),l=ch(e);if(h.length!==l.length)return!1;for(h.sort(),l.sort(),s=h.length-1;s>=0;s--)if(h[s]!==l[s])return!1;for(s=h.length-1;s>=0;s--)if(!Sh(t[a=h[s]],e[a],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function Ch(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function Ih(t,e,n){Sh(t,e,!1)&&kh(t,e,n,"notDeepEqual",Ih)}function Oh(t,e,n){Sh(t,e,!0)&&kh(t,e,n,"notDeepStrictEqual",Oh)}function Ph(t,e,n){t!==e&&kh(t,e,n,"===",Ph)}function Mh(t,e,n){t===e&&kh(t,e,n,"!==",Mh)}function Bh(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function Dh(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&kh(i,n,"Missing expected exception"+r);var o="string"==typeof r,a=!t&&i&&!n;if((!t&&En(i)&&o&&Bh(i,n)||a)&&kh(i,n,"Got unwanted exception"+r),t&&i&&n&&!Bh(i,n)||!t&&i)throw i}function zh(t,e,n){Dh(!0,t,e,n)}function Nh(t,e,n){Dh(!1,t,e,n)}function Uh(t){if(t)throw t}wh.AssertionError=yh,Je(yh,Error),wh.fail=kh,wh.ok=Th,wh.equal=Rh,wh.notEqual=Ah,wh.deepEqual=Lh,wh.deepStrictEqual=xh,wh.notDeepEqual=Ih,wh.notDeepStrictEqual=Oh,wh.strictEqual=Ph,wh.notStrictEqual=Mh,wh.throws=zh,wh.doesNotThrow=Nh,wh.ifError=Uh;var Fh=e(Object.freeze({__proto__:null,AssertionError:yh,assert:Th,deepEqual:Lh,deepStrictEqual:xh,default:wh,doesNotThrow:Nh,equal:Rh,fail:kh,ifError:Uh,notDeepEqual:Ih,notDeepStrictEqual:Oh,notEqual:Ah,notStrictEqual:Mh,ok:Th,strictEqual:Ph,throws:zh})),Yh=e(ve);!function(t,e){let n=Fh.ok,r=Ka,i=zn,o=Yh.kMaxLength;function a(t){if(!(this instanceof a))return new a(t);t&&t.chunkSize<r.Z_MIN_CHUNK&&(t.chunkSize=r.Z_MIN_CHUNK),r.Inflate.call(this,t),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,t&&null!=t.maxLength&&(this._maxLength=t.maxLength)}function s(t,e){e&&Ve.nextTick(e),t._handle&&(t._handle.close(),t._handle=null)}function h(t,e){return function(t,e){if("string"==typeof e&&(e=Dt.from(e)),!(e instanceof Dt))throw new TypeError("Not a string or buffer");let n=t._finishFlushFlag;return null==n&&(n=r.Z_FINISH),t._processChunk(e,n)}(new a(e),t)}a.prototype._processChunk=function(t,e,i){if("function"==typeof i)return r.Inflate._processChunk.call(this,t,e,i);let a,h,l=this,u=t&&t.length,f=this._chunkSize-this._offset,c=this._maxLength,d=0,p=[],g=0;function _(t,e){if(l._hadError)return;let r=f-e;if(n(r>=0,"have should not go down"),r>0){let t=l._buffer.slice(l._offset,l._offset+r);if(l._offset+=r,t.length>c&&(t=t.slice(0,c)),p.push(t),g+=t.length,c-=t.length,0===c)return!1}return(0===e||l._offset>=l._chunkSize)&&(f=l._chunkSize,l._offset=0,l._buffer=Dt.allocUnsafe(l._chunkSize)),0===e&&(d+=u-t,u=t,!0)}this.on("error",(function(t){a=t})),n(this._handle,"zlib binding closed");do{h=this._handle.writeSync(e,t,d,u,this._buffer,this._offset,f),h=h||this._writeState}while(!this._hadError&&_(h[0],h[1]));if(this._hadError)throw a;if(g>=o)throw s(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+o.toString(16)+" bytes");let w=Dt.concat(p,g);return s(this),w},i.inherits(a,r.Inflate),t.exports=e=h,e.Inflate=a,e.createInflate=function(t){return new a(t)},e.inflateSync=h}(hh,hh.exports);var jh=hh.exports,Zh={exports:{}};let Hh=Zh.exports=function(t){this._buffer=t,this._reads=[]};Hh.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})},Hh.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;{this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0};var Wh=Zh.exports,qh={};let Gh=Wh,Vh=us;qh.process=function(t,e){let n=[],r=new Gh(t);return new Vh(e,{read:r.read.bind(r),write:function(t){n.push(t)},complete:function(){}}).start(),r.process(),Dt.concat(n)};let Kh=!0,Jh=Ka,Xh=jh;Jh.deflateSync||(Kh=!1);let Qh=Wh,$h=qh,tl=Rs,el=As,nl=Os;let rl=!0,il=Ka;il.deflateSync||(rl=!1);let ol=ws,al=th;let sl=function(t,e){if(!Kh)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n,r,i;let o=[];let a=new Qh(t),s=new tl(e,{read:a.read.bind(a),error:function(t){n=t},metadata:function(t){r=t},gamma:function(t){i=t},palette:function(t){r.palette=t},transColor:function(t){r.transColor=t},inflateData:function(t){o.push(t)},simpleTransparency:function(){r.alpha=!0}});if(s.start(),a.process(),n)throw n;let h,l=Dt.concat(o);if(o.length=0,r.interlace)h=Jh.inflateSync(l);else{let t=(1+(r.width*r.bpp*r.depth+7>>3))*r.height;h=Xh(l,{chunkSize:t,maxLength:t})}if(l=null,!h||!h.length)throw new Error("bad png - invalid inflate data response");let u=$h.process(h,r);l=null;let f=el.dataToBitMap(u,r);u=null;let c=nl(f,r);return r.data=c,r.gamma=i||0,r},hl=function(t,e){if(!rl)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n=new al(e||{}),r=[];r.push(Dt.from(ol.PNG_SIGNATURE)),r.push(n.packIHDR(t.width,t.height)),t.gamma&&r.push(n.packGAMA(t.gamma));let i=n.filterData(t.data,t.width,t.height),o=il.deflateSync(i,n.getDeflateOptions());if(i=null,!o||!o.length)throw new Error("bad png - invalid compressed data response");return r.push(n.packIDAT(o)),r.push(n.packIEND()),Dt.concat(r)};sh.read=function(t,e){return sl(t,e||{})},sh.write=function(t,e){return hl(t,e)};let ll=zn,ul=Br,fl=Ys,cl=ah,dl=sh,pl=Ke.PNG=function(t){ul.call(this),t=t||{},this.width=0|t.width,this.height=0|t.height,this.data=this.width>0&&this.height>0?Dt.alloc(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new fl(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new cl(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};ll.inherits(pl,ul),pl.sync=dl,pl.prototype.pack=function(){return this.data&&this.data.length?(Ve.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},pl.prototype.parse=function(t,e){if(e){let t,n;t=function(t){this.removeListener("error",n),this.data=t,e(null,this)}.bind(this),n=function(n){this.removeListener("parsed",t),e(n,null)}.bind(this),this.once("parsed",t),this.once("error",n)}return this.end(t),this},pl.prototype.write=function(t){return this._parser.write(t),!0},pl.prototype.end=function(t){this._parser.end(t)},pl.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},pl.prototype._gamma=function(t){this.gamma=t},pl.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},pl.bitblt=function(t,e,n,r,i,o,a,s){if(r|=0,i|=0,o|=0,a|=0,s|=0,(n|=0)>t.width||r>t.height||n+i>t.width||r+o>t.height)throw new Error("bitblt reading outside image");if(a>e.width||s>e.height||a+i>e.width||s+o>e.height)throw new Error("bitblt writing outside image");for(let h=0;h<o;h++)t.data.copy(e.data,(s+h)*e.width+a<<2,(r+h)*t.width+n<<2,(r+h)*t.width+n+i<<2)},pl.prototype.bitblt=function(t,e,n,r,i,o,a){return pl.bitblt(this,t,e,n,r,i,o,a),this},pl.adjustGamma=function(t){if(t.gamma){for(let e=0;e<t.height;e++)for(let n=0;n<t.width;n++){let r=t.width*e+n<<2;for(let e=0;e<3;e++){let n=t.data[r+e]/255;n=Math.pow(n,1/2.2/t.gamma),t.data[r+e]=Math.round(255*n)}}t.gamma=0}},pl.prototype.adjustGamma=function(){pl.adjustGamma(this)};var gl={};!function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map((function(t){return[t,t]})))),6===e.length&&e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const i=n.modules.size,o=n.modules.data,a=t.getScale(i,r),s=Math.floor((i+2*r.margin)*a),h=r.margin*a,l=[r.color.light,r.color.dark];for(let t=0;t<s;t++)for(let n=0;n<s;n++){let u=4*(t*s+n),f=r.color.light;if(t>=h&&n>=h&&t<s-h&&n<s-h){f=l[o[Math.floor((t-h)/a)*i+Math.floor((n-h)/a)]?1:0]}e[u++]=f.r,e[u++]=f.g,e[u++]=f.b,e[u]=f.a}}}(gl),function(t){const e=ke,n=Ke.PNG,r=gl;t.render=function(t,e){const i=r.getOptions(e),o=i.rendererOpts,a=r.getImageWidth(t.modules.size,i);o.width=a,o.height=a;const s=new n(o);return r.qrToImageData(s.data,t,i),s},t.renderToDataURL=function(e,n,r){void 0===r&&(r=n,n=void 0),t.renderToBuffer(e,n,(function(t,e){t&&r(t);let n="data:image/png;base64,";n+=e.toString("base64"),r(null,n)}))},t.renderToBuffer=function(e,n,r){void 0===r&&(r=n,n=void 0);const i=t.render(e,n),o=[];i.on("error",r),i.on("data",(function(t){o.push(t)})),i.on("end",(function(){r(null,Dt.concat(o))})),i.pack()},t.renderToFile=function(n,r,i,o){void 0===o&&(o=i,i=void 0);let a=!1;const s=(...t)=>{a||(a=!0,o.apply(null,t))},h=e.createWriteStream(n);h.on("error",s),h.on("close",s),t.renderToFileStream(h,r,i)},t.renderToFileStream=function(e,n,r){t.render(n,r).pack().pipe(e)}}(Ee);var _l={};!function(t){const e=gl,n={WW:" ",WB:"▄",BB:"█",BW:"▀"},r={BB:" ",BW:"▄",WW:"█",WB:"▀"};function i(t,e,n){return t&&e?n.BB:t&&!e?n.BW:!t&&e?n.WB:n.WW}t.render=function(t,o,a){const s=e.getOptions(o);let h=n;"#ffffff"!==s.color.dark.hex&&"#000000"!==s.color.light.hex||(h=r);const l=t.modules.size,u=t.modules.data;let f="",c=Array(l+2*s.margin+1).join(h.WW);c=Array(s.margin/2+1).join(c+"\n");const d=Array(s.margin+1).join(h.WW);f+=c;for(let t=0;t<l;t+=2){f+=d;for(let e=0;e<l;e++){f+=i(u[t*l+e],u[(t+1)*l+e],h)}f+=d+"\n"}return f+=c.slice(0,-1),"function"==typeof a&&a(null,f),f},t.renderToFile=function(e,n,r,i){void 0===i&&(i=r,r=void 0);const o=ke,a=t.render(n,r);o.writeFile(e,a,i)}}(_l);var wl={},ml={render:function(t,e,n){const r=t.modules.size,i=t.modules.data,o=" ";let a="";const s=Array(r+3).join(o),h=Array(2).join(o);a+=s+"\n";for(let t=0;t<r;++t){a+=o;for(let e=0;e<r;e++)a+=i[t*r+e]?" ":o;a+=h+"\n"}return a+=s+"\n","function"==typeof n&&n(null,a),a}},bl={};const yl="",vl="",El="",kl=""+vl,Tl=""+yl,Rl=function(t,e,n,r){const i=e+1;if(n>=i||r>=i||r<-1||n<-1)return"0";if(n>=e||r>=e||r<0||n<0)return"1";return t[r*e+n]?"2":"1"},Al=function(t,e,n,r){return Rl(t,e,n,r)+Rl(t,e,n,r+1)};bl.render=function(t,e,n){const r=t.modules.size,i=t.modules.data,o=!(!e||!e.inverse),a=e&&e.inverse?Tl:kl,s=function(t,e,n){return{"00":El+" "+t,"01":El+e+"▄"+t,"02":El+n+"▄"+t,10:El+e+"▀"+t,11:" ",12:"▄",20:El+n+"▀"+t,21:"▀",22:"█"}}(a,o?vl:yl,o?yl:vl),h=El+"\n"+a;let l=a;for(let t=-1;t<r+1;t+=2){for(let e=-1;e<r;e++)l+=s[Al(i,r,e,t)];l+=s[Al(i,r,r,t)]+h}return l+=El,"function"==typeof n&&n(null,l),l};const Ll=ml,xl=bl;wl.render=function(t,e,n){return e&&e.small?xl.render(t,e,n):Ll.render(t,e,n)};var Sl,Cl={},Il={};function Ol(){if(Sl)return Il;Sl=1;const t=gl;function e(t,e){const n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function n(t,e,n){let r=t+e;return void 0!==n&&(r+=" "+n),r}return Il.render=function(r,i,o){const a=t.getOptions(i),s=r.modules.size,h=r.modules.data,l=s+2*a.margin,u=a.color.light.a?"<path "+e(a.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",f="<path "+e(a.color.dark,"stroke")+' d="'+function(t,e,r){let i="",o=0,a=!1,s=0;for(let h=0;h<t.length;h++){const l=Math.floor(h%e),u=Math.floor(h/e);l||a||(a=!0),t[h]?(s++,h>0&&l>0&&t[h-1]||(i+=a?n("M",l+r,.5+u+r):n("m",o,0),o=0,a=!1),l+1<e&&t[h+1]||(i+=n("h",s),s=0)):o++}return i}(h,s,a.margin)+'"/>',c='viewBox="0 0 '+l+" "+l+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+c+' shape-rendering="crispEdges">'+u+f+"</svg>\n";return"function"==typeof o&&o(null,d),d},Il}!function(t){const e=Ol();t.render=e.render,t.renderToFile=function(e,n,r,i){void 0===i&&(i=r,r=void 0);const o=ke,a='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+t.render(n,r);o.writeFile(e,a,i)}}(Cl);var Pl,Ml,Bl={},Dl={};function zl(){return Pl||(Pl=1,function(t){const e=gl;t.render=function(t,n,r){let i=r,o=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),i=e.getOptions(i);const a=e.getImageWidth(t.modules.size,i),s=o.getContext("2d"),h=s.createImageData(a,a);return e.qrToImageData(h.data,t,i),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(s,o,a),s.putImageData(h,0,0),o},t.renderToDataURL=function(e,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const o=t.render(e,n,i),a=i.type||"image/png",s=i.rendererOpts||{};return o.toDataURL(a,s.quality)}}(Dl)),Dl}const Nl=r,Ul=i,Fl=Ee,Yl=_l,jl=wl,Zl=Cl;function Hl(t,e,n){if(void 0===t)throw new Error("String required as first argument");if(void 0===n&&(n=e,e={}),"function"!=typeof n){if(!Nl())throw new Error("Callback required as last argument");e=n||{},n=null}return{opts:e,cb:n}}function Wl(t){switch(t){case"svg":return Zl;case"txt":case"utf8":return Yl;default:return Fl}}function ql(t,e,n){if(!n.cb)return new Promise((function(r,i){try{const o=Ul.create(e,n.opts);return t(o,n.opts,(function(t,e){return t?i(t):r(e)}))}catch(t){i(t)}}));try{const r=Ul.create(e,n.opts);return t(r,n.opts,n.cb)}catch(t){n.cb(t)}}n.create=Ul.create,n.toCanvas=function(){if(Ml)return Bl;Ml=1;const t=r,e=i,n=zl(),o=Ol();function a(n,r,i,o,a){const s=[].slice.call(arguments,1),h=s.length,l="function"==typeof s[h-1];if(!l&&!t())throw new Error("Callback required as last argument");if(!l){if(h<1)throw new Error("Too few arguments provided");return 1===h?(i=r,r=o=void 0):2!==h||r.getContext||(o=i,i=r,r=void 0),new Promise((function(t,a){try{const a=e.create(i,o);t(n(a,r,o))}catch(t){a(t)}}))}if(h<2)throw new Error("Too few arguments provided");2===h?(a=i,i=r,r=o=void 0):3===h&&(r.getContext&&void 0===a?(a=o,o=void 0):(a=o,o=i,i=r,r=void 0));try{const t=e.create(i,o);a(null,n(t,r,o))}catch(t){a(t)}}return Bl.create=e.create,Bl.toCanvas=a.bind(null,n.render),Bl.toDataURL=a.bind(null,n.renderToDataURL),Bl.toString=a.bind(null,(function(t,e,n){return o.render(t,n)})),Bl}().toCanvas,n.toString=function(t,e,n){const r=Hl(t,e,n),i=function(t){switch(t){case"svg":return Zl;case"terminal":return jl;default:return Yl}}(r.opts?r.opts.type:void 0);return ql(i.render,t,r)},n.toDataURL=function(t,e,n){const r=Hl(t,e,n);return ql(Wl(r.opts.type).renderToDataURL,t,r)},n.toBuffer=function(t,e,n){const r=Hl(t,e,n);return ql(Wl(r.opts.type).renderToBuffer,t,r)},n.toFile=function(t,e,n,r){if("string"!=typeof t||"string"!=typeof e&&"object"!=typeof e)throw new Error("Invalid argument");if(arguments.length<3&&!Nl())throw new Error("Too few arguments provided");const i=Hl(e,n,r),o=i.opts.type||function(t){return t.slice(2+(t.lastIndexOf(".")-1>>>0)).toLowerCase()}(t);return ql(Wl(o).renderToFile.bind(null,t),e,i)},n.toFileStream=function(t,e,n){if(arguments.length<2)throw new Error("Too few arguments provided");const r=Hl(e,n,t.emit.bind(t,"error"));ql(Wl("png").renderToFileStream.bind(null,t),e,r)};var Gl=n;t.toDataURL=Gl.toDataURL}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopar-plugin",
3
- "version": "0.8.2-alpha.2",
3
+ "version": "0.8.2",
4
4
  "description": "Plugin for the Web that seamlessly integrates into your webpage to create embedded virtual try-on and 3D preview capabilities.",
5
5
  "main": "dist/shopar-plugin.esm.js",
6
6
  "module": "dist/shopar-plugin.esm.js",