UNPKG

7.83 kBJavaScriptView Raw
1/**
2 * @license Angular v10.2.3
3 * (c) 2010-2020 Google LLC. https://angular.io/
4 * License: MIT
5 */
6!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define("@angular/service-worker/config",["exports"],r):r(((e=e||self).ng=e.ng||{},e.ng.serviceWorker=e.ng.serviceWorker||{},e.ng.serviceWorker.config={}))}(this,(function(e){"use strict";
7/*! *****************************************************************************
8 Copyright (c) Microsoft Corporation.
9
10 Permission to use, copy, modify, and/or distribute this software for any
11 purpose with or without fee is hereby granted.
12
13 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 PERFORMANCE OF THIS SOFTWARE.
20 ***************************************************************************** */function r(e,r,t,n){return new(t||(t=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):function r(e){return e instanceof t?e:new t((function(r){r(e)}))}(e.value).then(s,a)}u((n=n.apply(e,r||[])).next())}))}function t(e,r){var t,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function u(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=r.call(e,s)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function n(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function o(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(n(arguments[r]));return e}
21/**
22 * @license
23 * Copyright Google LLC All Rights Reserved.
24 *
25 * Use of this source code is governed by an MIT-style license that can be
26 * found in the LICENSE file at https://angular.io/license
27 */
28var i=/([0-9]+[^0-9]+)/g,s=/^([0-9]+)([dhmsu]+)$/;function a(e){for(var r,t=[];null!==(r=i.exec(e));)t.push(r[0]);return t.map((function(e){var r=s.exec(e);if(null===r)throw new Error("Not a valid duration: "+e);var t=0;switch(r[2]){case"d":t=864e5;break;case"h":t=36e5;break;case"m":t=6e4;break;case"s":t=1e3;break;case"u":t=1;break;default:throw new Error("Not a valid duration unit: "+r[2])}return parseInt(r[1])*t})).reduce((function(e,r){return e+r}),0)}
29/**
30 * @license
31 * Copyright Google LLC All Rights Reserved.
32 *
33 * Use of this source code is governed by an MIT-style license that can be
34 * found in the LICENSE file at https://angular.io/license
35 */var u=[{replace:/\./g,with:"\\."},{replace:/\+/g,with:"\\+"},{replace:/\*/g,with:"[^/]*"}],c=o(u,[{replace:/\?/g,with:"[^/]"}]),f=o(u,[{replace:/\?/g,with:"\\?"}]);function l(e,r){void 0===r&&(r=!1);for(var t=r?f:c,n=e.split("/").reverse(),o="";n.length>0;){var i=n.pop();"**"===i?o+=n.length>0?"(?:.+\\/)?":".*":(o+=t.reduce((function(e,r){return e.replace(r.replace,r.with)}),i),n.length>0&&(o+="\\/"))}return o}var p=["/**","!/**/*.*","!/**/*__*","!/**/*__*/**"],h=function(){function e(e,r){this.fs=e,this.baseHref=r}return e.prototype.process=function(e){return r(this,void 0,void 0,(function(){var r,n;return t(this,(function(t){switch(t.label){case 0:return[4,this.processAssetGroups(e,r={})];case 1:return n=t.sent(),[2,{configVersion:1,timestamp:Date.now(),appData:e.appData,index:v(this.baseHref,e.index),assetGroups:n,dataGroups:this.processDataGroups(e),hashTable:(s=r,a={},Object.keys(s).sort().forEach((function(e){return a[e]=s[e]})),a),navigationUrls:(o=this.baseHref,i=e.navigationUrls,void 0===i&&(i=p),i.map((function(e){var r=!e.startsWith("!");return{positive:r,regex:"^"+d(e=r?e:e.substr(1),o)+"$"}})))}]}var o,i,s,a}))}))},e.prototype.processAssetGroups=function(e,n){return r(this,void 0,void 0,(function(){var o,i=this;return t(this,(function(s){return o=new Set,[2,Promise.all((e.assetGroups||[]).map((function(e){return r(i,void 0,void 0,(function(){var i,s,a,u=this;return t(this,(function(c){switch(c.label){case 0:if(e.resources.versionedFiles)throw new Error("Asset-group '"+e.name+"' in 'ngsw-config.json' uses the 'versionedFiles' option, which is no longer supported. Use 'files' instead.");return i=function f(e){var r=e.map((function(e){return e.startsWith("!")?{positive:!1,regex:new RegExp("^"+l(e.substr(1))+"$")}:{positive:!0,regex:new RegExp("^"+l(e)+"$")}}));return function(e){return function t(e,r){return r.reduce((function(r,t){return t.positive?r||t.regex.test(e):r&&!t.regex.test(e)}),!1)}(e,r)}}(e.resources.files||[]),[4,this.fs.list("/")];case 1:return s=c.sent(),(a=s.filter(i).filter((function(e){return!o.has(e)})).sort()).forEach((function(e){return o.add(e)})),[4,a.reduce((function(e,o){return r(u,void 0,void 0,(function(){var r;return t(this,(function(t){switch(t.label){case 0:return[4,e];case 1:return t.sent(),[4,this.fs.hash(o)];case 2:return r=t.sent(),n[v(this.baseHref,o)]=r,[2]}}))}))}),Promise.resolve())];case 2:return c.sent(),[2,{name:e.name,installMode:e.installMode||"prefetch",updateMode:e.updateMode||e.installMode||"prefetch",cacheQueryOptions:g(e.cacheQueryOptions),urls:a.map((function(e){return v(u.baseHref,e)})),patterns:(e.resources.urls||[]).map((function(e){return d(e,u.baseHref,!0)}))}]}}))}))})))]}))}))},e.prototype.processDataGroups=function(e){var r=this;return(e.dataGroups||[]).map((function(e){return{name:e.name,patterns:e.urls.map((function(e){return d(e,r.baseHref,!0)})),strategy:e.cacheConfig.strategy||"performance",maxSize:e.cacheConfig.maxSize,maxAge:a(e.cacheConfig.maxAge),timeoutMs:e.cacheConfig.timeout&&a(e.cacheConfig.timeout),cacheQueryOptions:g(e.cacheQueryOptions),version:void 0!==e.version?e.version:1}}))},e}();function d(e,r,t){return e.startsWith("/")||-1!==e.indexOf("://")||(e=v(r.replace(/^\.(?=\/)/,""),e)),l(e,t)}function v(e,r){return e.endsWith("/")&&r.startsWith("/")?e+r.substr(1):e.endsWith("/")||r.startsWith("/")?e+r:e+"/"+r}function g(e){return Object.assign({ignoreVary:!0},e)}
36/**
37 * @license
38 * Copyright Google LLC All Rights Reserved.
39 *
40 * Use of this source code is governed by an MIT-style license that can be
41 * found in the LICENSE file at https://angular.io/license
42 */
43/**
44 * @license
45 * Copyright Google LLC All Rights Reserved.
46 *
47 * Use of this source code is governed by an MIT-style license that can be
48 * found in the LICENSE file at https://angular.io/license
49 */e.Generator=h,Object.defineProperty(e,"__esModule",{value:!0})}));
\No newline at end of file