@postnord/pn-marketweb-components 2.3.11 → 2.3.13
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/cjs/{index-e3e27c79.js → index-4199ff85.js} +828 -278
- package/cjs/{index-28bbc937.js → index-95e5b7f9.js} +1 -1
- package/cjs/loader.cjs.js +3 -2
- package/cjs/pn-animated-tile.cjs.entry.js +7 -7
- package/cjs/pn-bonus-progressbar-level.cjs.entry.js +2 -2
- package/cjs/pn-bonus-progressbar.cjs.entry.js +2 -2
- package/cjs/pn-breakpoints.cjs.entry.js +2 -2
- package/cjs/pn-chart.cjs.entry.js +3 -2
- package/cjs/pn-charts-card.cjs.entry.js +10 -3
- package/cjs/pn-choice-button.cjs.entry.js +5 -2
- package/cjs/pn-customernumber-selector-option.cjs.entry.js +2 -2
- package/cjs/pn-customernumber-selector.cjs.entry.js +2 -2
- package/cjs/pn-filter-checkbox.cjs.entry.js +5 -2
- package/cjs/pn-find-price-result.cjs.entry.js +7 -4
- package/cjs/{pn-find-price-store-a91ce3f6.js → pn-find-price-store-e0d1e412.js} +1 -1
- package/cjs/pn-find-price.cjs.entry.js +4 -4
- package/cjs/pn-find-service-and-price-result.cjs.entry.js +4 -4
- package/cjs/{pn-find-service-and-price-store-16a7936c.js → pn-find-service-and-price-store-6e26630d.js} +1 -1
- package/cjs/pn-find-service-and-price.cjs.entry.js +4 -4
- package/cjs/pn-language-selector_9.cjs.entry.js +18 -42
- package/cjs/pn-line-shape.cjs.entry.js +2 -2
- package/cjs/pn-mainnav-link.cjs.entry.js +4 -10
- package/cjs/{pn-mainnav-store-61a75ea0.js → pn-mainnav-store-8c337865.js} +1 -1
- package/cjs/pn-market-web-components.cjs.js +6 -2
- package/cjs/pn-marketweb-input.cjs.entry.js +2 -7
- package/cjs/pn-marketweb-search.cjs.entry.js +2 -6
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +10 -15
- package/cjs/pn-marketweb-siteheader-login-button_5.cjs.entry.js +12 -10
- package/cjs/pn-marketweb-siteheader-login-linklist.cjs.entry.js +4 -4
- package/cjs/{pn-marketweb-siteheader-store-e29ad918.js → pn-marketweb-siteheader-store-5ced6902.js} +1 -1
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +10 -38
- package/cjs/pn-multi-formfield.cjs.entry.js +10 -10
- package/cjs/pn-parcel-tracker.cjs.entry.js +2 -2
- package/cjs/pn-pex-pricefinder.cjs.entry.js +2 -5
- package/cjs/pn-product-card_3.cjs.entry.js +15 -4
- package/cjs/pn-product-pricelist-result.cjs.entry.js +3 -3
- package/cjs/pn-product-pricelist.cjs.entry.js +4 -4
- package/cjs/pn-product-tile-info_2.cjs.entry.js +10 -3
- package/cjs/pn-product-tile.cjs.entry.js +2 -2
- package/cjs/pn-profile-modal-customernumber.cjs.entry.js +2 -2
- package/cjs/pn-profile-modal-profile.cjs.entry.js +4 -4
- package/cjs/{pn-profile-modal-store-6117e304.js → pn-profile-modal-store-947b08ae.js} +1 -1
- package/cjs/pn-profile-modal-type.cjs.entry.js +4 -4
- package/cjs/pn-profile-modal.cjs.entry.js +4 -4
- package/cjs/pn-profile-selector-option.cjs.entry.js +2 -2
- package/cjs/pn-profile-selector.cjs.entry.js +5 -5
- package/cjs/pn-proxio-findprice-result.cjs.entry.js +5 -2
- package/cjs/pn-proxio-findprice.cjs.entry.js +4 -4
- package/cjs/pn-proxio-pricegroup.cjs.entry.js +3 -5
- package/cjs/pn-proxio-productcard_4.cjs.entry.js +12 -5
- package/cjs/pn-quick-cta.cjs.entry.js +2 -2
- package/cjs/pn-quote-card.cjs.entry.js +2 -3
- package/cjs/pn-scroll.cjs.entry.js +2 -2
- package/cjs/pn-share-item.cjs.entry.js +2 -2
- package/cjs/pn-share.cjs.entry.js +3 -2
- package/cjs/pn-sidenav-level.cjs.entry.js +4 -4
- package/cjs/pn-sidenav-link.cjs.entry.js +4 -12
- package/cjs/{pn-sidenav-store-d9bd9e00.js → pn-sidenav-store-d2389306.js} +1 -1
- package/cjs/pn-sidenav-togglebutton.cjs.entry.js +4 -5
- package/cjs/pn-sidenav.cjs.entry.js +4 -6
- package/cjs/pn-site-footer_2.cjs.entry.js +3 -4
- package/cjs/pn-spotlight.cjs.entry.js +2 -2
- package/cjs/pn-stats-info-data.cjs.entry.js +8 -8
- package/cjs/pn-stats-info.cjs.entry.js +3 -2
- package/cjs/pn-teaser-card.cjs.entry.js +3 -4
- package/cjs/pn-titletag.cjs.entry.js +2 -4
- package/collection/collection-manifest.json +2 -2
- package/collection/components/animation/pn-animated-tile/pn-animated-tile.css +13 -5
- package/collection/components/animation/pn-animated-tile/pn-animated-tile.js +28 -26
- package/collection/components/animation/pn-scroll/pn-scroll.js +92 -86
- package/collection/components/cards/pn-quote-card/pn-line-shape/pn-line-shape.js +12 -11
- package/collection/components/cards/pn-quote-card/pn-quote-card.js +68 -79
- package/collection/components/cards/pn-teaser-card/pn-teaser-card.js +109 -113
- package/collection/components/charts/pn-chart/pn-chart.js +83 -74
- package/collection/components/charts/pn-charts-card/pn-charts-card.js +162 -169
- package/collection/components/cta/pn-parcel-tracker/pn-parcel-tracker.js +133 -128
- package/collection/components/cta/pn-quick-cta/pn-quick-cta.js +51 -49
- package/collection/components/cta/pn-share/pn-share-item.js +51 -50
- package/collection/components/cta/pn-share/pn-share.js +65 -60
- package/collection/components/cta/pn-spotlight/pn-spotlight.js +73 -71
- package/collection/components/data-visualization/pn-stats-info/pn-stats-info-data/pn-stats-info-data.js +120 -115
- package/collection/components/data-visualization/pn-stats-info/pn-stats-info.js +82 -78
- package/collection/components/input/pn-bonus-progressbar/pn-bonus-progressbar-level.js +93 -87
- package/collection/components/input/pn-bonus-progressbar/pn-bonus-progressbar.js +193 -195
- package/collection/components/input/pn-choice-button/pn-choice-button.js +145 -137
- package/collection/components/input/pn-filter-checkbox/pn-filter-checkbox.js +128 -122
- package/collection/components/input/pn-marketweb-input/pn-marketweb-input.js +347 -355
- package/collection/components/input/pn-marketweb-search/pn-marketweb-search.js +258 -260
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter-types.js +0 -3
- package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.js +201 -221
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-button.js +34 -29
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-linklist.js +101 -101
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-links.js +110 -105
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-mypage-button.js +51 -45
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login-profileselection.js +174 -181
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-login.js +259 -256
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-search.js +170 -172
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader-unified-login.js +84 -75
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +509 -560
- package/collection/components/layout-components/pn-multi-formfield/pn-multi-formfield.js +105 -99
- package/collection/components/minor/pn-titletag/pn-titletag.js +51 -49
- package/collection/components/navigation/pn-language-selector/pn-language-selector-option.js +119 -123
- package/collection/components/navigation/pn-language-selector/pn-language-selector.js +71 -64
- package/collection/components/navigation/pn-mainnav/pn-mainnav-level.js +58 -58
- package/collection/components/navigation/pn-mainnav/pn-mainnav-link.js +92 -97
- package/collection/components/navigation/pn-mainnav/pn-mainnav-list.js +39 -33
- package/collection/components/navigation/pn-mainnav/pn-mainnav.js +182 -183
- package/collection/components/navigation/pn-sidenav/pn-sidenav-level.js +29 -22
- package/collection/components/navigation/pn-sidenav/pn-sidenav-link.js +128 -134
- package/collection/components/navigation/pn-sidenav/pn-sidenav-togglebutton.js +39 -34
- package/collection/components/navigation/pn-sidenav/pn-sidenav.js +71 -66
- package/collection/components/navigation/pn-site-footer/pn-site-footer-col.js +34 -29
- package/collection/components/navigation/pn-site-footer/pn-site-footer.js +68 -75
- package/collection/components/navigation/pn-site-selector/pn-site-selector-item.js +85 -89
- package/collection/components/navigation/pn-site-selector/pn-site-selector.js +73 -73
- package/collection/components/profile/pn-customernumber-selector/pn-customernumber-selector-option.js +68 -67
- package/collection/components/profile/pn-customernumber-selector/pn-customernumber-selector.js +90 -90
- package/collection/components/profile/pn-profile-modal/pn-profile-modal-customernumber.js +85 -79
- package/collection/components/profile/pn-profile-modal/pn-profile-modal-profile.js +182 -188
- package/collection/components/profile/pn-profile-modal/pn-profile-modal-type.js +91 -84
- package/collection/components/profile/pn-profile-modal/pn-profile-modal.js +116 -115
- package/collection/components/profile/pn-profile-selector/pn-profile-selector-option.js +68 -67
- package/collection/components/profile/pn-profile-selector/pn-profile-selector.js +78 -76
- package/collection/components/utilities/pn-breakpoints/pn-breakpoints.js +48 -42
- package/collection/components/widgets/pn-find-price/pn-find-price-result.js +163 -179
- package/collection/components/widgets/pn-find-price/pn-find-price.js +99 -113
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price-result.js +66 -67
- package/collection/components/widgets/pn-find-service-and-price/pn-find-service-and-price.js +133 -148
- package/collection/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder.js +87 -102
- package/collection/components/widgets/pn-product-card/pn-product-card-info.js +92 -94
- package/collection/components/widgets/pn-product-card/pn-product-card-price.js +138 -131
- package/collection/components/widgets/pn-product-card/pn-product-card.js +12 -21
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist-result.js +101 -108
- package/collection/components/widgets/pn-product-pricelist/pn-product-pricelist.js +137 -140
- package/collection/components/widgets/pn-product-tile/pn-product-tile-info.js +70 -62
- package/collection/components/widgets/pn-product-tile/pn-product-tile-price.js +87 -83
- package/collection/components/widgets/pn-product-tile/pn-product-tile.js +12 -16
- package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice-result.js +205 -206
- package/collection/components/widgets/pn-proxio-findprice/pn-proxio-findprice.js +134 -152
- package/collection/components/widgets/pn-proxio-pricegroup/pn-proxio-pricegroup.js +130 -145
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-description.js +87 -82
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-information.js +55 -57
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-pricelink.js +85 -81
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard.js +12 -20
- package/components/MarketWebContextService.js +318 -0
- package/components/_commonjsHelpers.js +32 -0
- package/components/convert.js +1823 -0
- package/components/data.js +37 -0
- package/components/index.d.ts +105 -0
- package/components/index.js +76 -0
- package/components/index2.js +59 -0
- package/components/index3.js +187 -0
- package/components/pn-animated-tile.d.ts +11 -0
- package/components/pn-animated-tile.js +52 -0
- package/components/pn-bonus-progressbar-level.d.ts +11 -0
- package/components/pn-bonus-progressbar-level.js +65 -0
- package/components/pn-bonus-progressbar.d.ts +11 -0
- package/components/pn-bonus-progressbar.js +128 -0
- package/components/pn-breakpoints.d.ts +11 -0
- package/components/pn-breakpoints.js +45 -0
- package/components/pn-chart.d.ts +11 -0
- package/components/pn-chart.js +22151 -0
- package/components/pn-charts-card.d.ts +11 -0
- package/components/pn-charts-card.js +57 -0
- package/components/pn-choice-button.d.ts +11 -0
- package/components/pn-choice-button.js +6 -0
- package/components/pn-choice-button2.js +61 -0
- package/components/pn-customernumber-selector-option.d.ts +11 -0
- package/components/pn-customernumber-selector-option.js +41 -0
- package/components/pn-customernumber-selector.d.ts +11 -0
- package/components/pn-customernumber-selector.js +77 -0
- package/components/pn-filter-checkbox.d.ts +11 -0
- package/components/pn-filter-checkbox.js +93 -0
- package/components/pn-find-price-result.d.ts +11 -0
- package/components/pn-find-price-result.js +6 -0
- package/components/pn-find-price-result2.js +192 -0
- package/components/pn-find-price.d.ts +11 -0
- package/components/pn-find-price.js +281 -0
- package/components/pn-find-service-and-price-result.d.ts +11 -0
- package/components/pn-find-service-and-price-result.js +6 -0
- package/components/pn-find-service-and-price-result2.js +96 -0
- package/components/pn-find-service-and-price.d.ts +11 -0
- package/components/pn-find-service-and-price.js +314 -0
- package/components/pn-language-selector-option.d.ts +11 -0
- package/components/pn-language-selector-option.js +6 -0
- package/components/pn-language-selector-option2.js +51 -0
- package/components/pn-language-selector.d.ts +11 -0
- package/components/pn-language-selector.js +6 -0
- package/components/pn-language-selector2.js +142 -0
- package/components/pn-line-shape.d.ts +11 -0
- package/components/pn-line-shape.js +35 -0
- package/components/pn-mainnav-level.d.ts +11 -0
- package/components/pn-mainnav-level.js +6 -0
- package/components/pn-mainnav-level2.js +117 -0
- package/components/pn-mainnav-link.d.ts +11 -0
- package/components/pn-mainnav-link.js +6 -0
- package/components/pn-mainnav-link2.js +57 -0
- package/components/pn-mainnav-list.d.ts +11 -0
- package/components/pn-mainnav-list.js +6 -0
- package/components/pn-mainnav-list2.js +39 -0
- package/{esm/pn-mainnav-store-28571e54.js → components/pn-mainnav-store.js} +1 -1
- package/components/pn-mainnav.d.ts +11 -0
- package/components/pn-mainnav.js +6 -0
- package/components/pn-mainnav2.js +120 -0
- package/components/pn-marketweb-input.d.ts +11 -0
- package/components/pn-marketweb-input.js +6 -0
- package/components/pn-marketweb-input2.js +102 -0
- package/components/pn-marketweb-search.d.ts +11 -0
- package/components/pn-marketweb-search.js +129 -0
- package/components/pn-marketweb-sitefooter.d.ts +11 -0
- package/components/pn-marketweb-sitefooter.js +335 -0
- package/components/pn-marketweb-siteheader-login-button.d.ts +11 -0
- package/components/pn-marketweb-siteheader-login-button.js +6 -0
- package/components/pn-marketweb-siteheader-login-button2.js +79 -0
- package/components/pn-marketweb-siteheader-login-linklist.d.ts +11 -0
- package/components/pn-marketweb-siteheader-login-linklist.js +6 -0
- package/components/pn-marketweb-siteheader-login-linklist2.js +105 -0
- package/components/pn-marketweb-siteheader-login-links.d.ts +11 -0
- package/components/pn-marketweb-siteheader-login-links.js +6 -0
- package/components/pn-marketweb-siteheader-login-links2.js +116 -0
- package/components/pn-marketweb-siteheader-login-mypage-button.d.ts +11 -0
- package/components/pn-marketweb-siteheader-login-mypage-button.js +6 -0
- package/components/pn-marketweb-siteheader-login-mypage-button2.js +36 -0
- package/components/pn-marketweb-siteheader-login-profileselection.d.ts +11 -0
- package/components/pn-marketweb-siteheader-login-profileselection.js +6 -0
- package/components/pn-marketweb-siteheader-login-profileselection2.js +244 -0
- package/components/pn-marketweb-siteheader-login.d.ts +11 -0
- package/components/pn-marketweb-siteheader-login.js +6 -0
- package/components/pn-marketweb-siteheader-login2.js +589 -0
- package/components/pn-marketweb-siteheader-search.d.ts +11 -0
- package/components/pn-marketweb-siteheader-search.js +6 -0
- package/components/pn-marketweb-siteheader-search2.js +131 -0
- package/components/pn-marketweb-siteheader-unified-login.d.ts +11 -0
- package/components/pn-marketweb-siteheader-unified-login.js +6 -0
- package/components/pn-marketweb-siteheader-unified-login2.js +52 -0
- package/components/pn-marketweb-siteheader.d.ts +11 -0
- package/components/pn-marketweb-siteheader.js +560 -0
- package/components/pn-multi-formfield.d.ts +11 -0
- package/components/pn-multi-formfield.js +277 -0
- package/components/pn-parcel-tracker.d.ts +11 -0
- package/components/pn-parcel-tracker.js +58 -0
- package/components/pn-pex-pricefinder.d.ts +11 -0
- package/components/pn-pex-pricefinder.js +156 -0
- package/components/pn-product-card-info.d.ts +11 -0
- package/components/pn-product-card-info.js +6 -0
- package/components/pn-product-card-info2.js +45 -0
- package/components/pn-product-card-price.d.ts +11 -0
- package/components/pn-product-card-price.js +6 -0
- package/components/pn-product-card-price2.js +48 -0
- package/components/pn-product-card.d.ts +11 -0
- package/components/pn-product-card.js +6 -0
- package/components/pn-product-card2.js +30 -0
- package/components/pn-product-pricelist-result.d.ts +11 -0
- package/components/pn-product-pricelist-result.js +130 -0
- package/components/pn-product-pricelist.d.ts +11 -0
- package/components/pn-product-pricelist.js +259 -0
- package/components/pn-product-tile-info.d.ts +11 -0
- package/components/pn-product-tile-info.js +6 -0
- package/components/pn-product-tile-info2.js +38 -0
- package/components/pn-product-tile-price.d.ts +11 -0
- package/components/pn-product-tile-price.js +6 -0
- package/components/pn-product-tile-price2.js +42 -0
- package/components/pn-product-tile.d.ts +11 -0
- package/components/pn-product-tile.js +33 -0
- package/components/pn-profile-modal-customernumber.d.ts +11 -0
- package/components/pn-profile-modal-customernumber.js +46 -0
- package/components/pn-profile-modal-profile.d.ts +11 -0
- package/components/pn-profile-modal-profile.js +71 -0
- package/{esm/pn-profile-modal-store-ae9e0d5a.js → components/pn-profile-modal-store.js} +1 -1
- package/components/pn-profile-modal-type.d.ts +11 -0
- package/components/pn-profile-modal-type.js +56 -0
- package/components/pn-profile-modal.d.ts +11 -0
- package/components/pn-profile-modal.js +92 -0
- package/components/pn-profile-selector-option.d.ts +11 -0
- package/components/pn-profile-selector-option.js +41 -0
- package/components/pn-profile-selector.d.ts +11 -0
- package/components/pn-profile-selector.js +79 -0
- package/components/pn-proxio-findprice-result.d.ts +11 -0
- package/components/pn-proxio-findprice-result.js +6 -0
- package/components/pn-proxio-findprice-result2.js +124 -0
- package/components/pn-proxio-findprice.d.ts +11 -0
- package/components/pn-proxio-findprice.js +454 -0
- package/components/pn-proxio-pricegroup.d.ts +11 -0
- package/components/pn-proxio-pricegroup.js +194 -0
- package/components/pn-proxio-productcard-description.d.ts +11 -0
- package/components/pn-proxio-productcard-description.js +6 -0
- package/components/pn-proxio-productcard-description2.js +43 -0
- package/components/pn-proxio-productcard-information.d.ts +11 -0
- package/components/pn-proxio-productcard-information.js +6 -0
- package/components/pn-proxio-productcard-information2.js +37 -0
- package/components/pn-proxio-productcard-pricelink.d.ts +11 -0
- package/components/pn-proxio-productcard-pricelink.js +6 -0
- package/components/pn-proxio-productcard-pricelink2.js +40 -0
- package/components/pn-proxio-productcard.d.ts +11 -0
- package/components/pn-proxio-productcard.js +6 -0
- package/components/pn-proxio-productcard2.js +30 -0
- package/components/pn-quick-cta.d.ts +11 -0
- package/components/pn-quick-cta.js +39 -0
- package/components/pn-quote-card.d.ts +11 -0
- package/components/pn-quote-card.js +41 -0
- package/components/pn-scroll.d.ts +11 -0
- package/components/pn-scroll.js +79 -0
- package/components/pn-share-item.d.ts +11 -0
- package/components/pn-share-item.js +6 -0
- package/components/pn-share-item2.js +36 -0
- package/components/pn-share.d.ts +11 -0
- package/components/pn-share.js +89 -0
- package/components/pn-sidenav-level.d.ts +11 -0
- package/components/pn-sidenav-level.js +84 -0
- package/components/pn-sidenav-link.d.ts +11 -0
- package/components/pn-sidenav-link.js +87 -0
- package/{esm/pn-sidenav-store-50b186d6.js → components/pn-sidenav-store.js} +1 -1
- package/components/pn-sidenav-togglebutton.d.ts +11 -0
- package/components/pn-sidenav-togglebutton.js +45 -0
- package/components/pn-sidenav.d.ts +11 -0
- package/components/pn-sidenav.js +95 -0
- package/components/pn-site-footer-col.d.ts +11 -0
- package/components/pn-site-footer-col.js +6 -0
- package/components/pn-site-footer-col2.js +33 -0
- package/components/pn-site-footer.d.ts +11 -0
- package/components/pn-site-footer.js +6 -0
- package/components/pn-site-footer2.js +38 -0
- package/components/pn-site-selector-item.d.ts +11 -0
- package/components/pn-site-selector-item.js +6 -0
- package/components/pn-site-selector-item2.js +39 -0
- package/components/pn-site-selector.d.ts +11 -0
- package/components/pn-site-selector.js +6 -0
- package/components/pn-site-selector2.js +69 -0
- package/components/pn-spotlight.d.ts +11 -0
- package/components/pn-spotlight.js +47 -0
- package/components/pn-stats-info-data.d.ts +11 -0
- package/components/pn-stats-info-data.js +6 -0
- package/components/pn-stats-info-data2.js +93 -0
- package/components/pn-stats-info.d.ts +11 -0
- package/components/pn-stats-info.js +59 -0
- package/components/pn-teaser-card.d.ts +11 -0
- package/components/pn-teaser-card.js +56 -0
- package/components/pn-titletag.d.ts +11 -0
- package/components/pn-titletag.js +6 -0
- package/components/pn-titletag2.js +36 -0
- package/components/translations.js +19 -0
- package/components/v4.js +66 -0
- package/esm/{index-7b21ecff.js → index-7f77b0ba.js} +1 -1
- package/esm/{index-5397620b.js → index-c118284d.js} +828 -279
- package/esm/loader.js +3 -2
- package/esm/pn-animated-tile.entry.js +7 -7
- package/esm/pn-bonus-progressbar-level.entry.js +2 -2
- package/esm/pn-bonus-progressbar.entry.js +2 -2
- package/esm/pn-breakpoints.entry.js +2 -2
- package/esm/pn-chart.entry.js +3 -2
- package/esm/pn-charts-card.entry.js +10 -3
- package/esm/pn-choice-button.entry.js +5 -2
- package/esm/pn-customernumber-selector-option.entry.js +2 -2
- package/esm/pn-customernumber-selector.entry.js +2 -2
- package/esm/pn-filter-checkbox.entry.js +5 -2
- package/esm/pn-find-price-result.entry.js +7 -4
- package/esm/{pn-find-price-store-bde5071d.js → pn-find-price-store-e13b6651.js} +1 -1
- package/esm/pn-find-price.entry.js +4 -4
- package/esm/pn-find-service-and-price-result.entry.js +4 -4
- package/esm/{pn-find-service-and-price-store-65df46a0.js → pn-find-service-and-price-store-f09ca219.js} +1 -1
- package/esm/pn-find-service-and-price.entry.js +4 -4
- package/esm/pn-language-selector_9.entry.js +18 -42
- package/esm/pn-line-shape.entry.js +2 -2
- package/esm/pn-mainnav-link.entry.js +4 -10
- package/esm/pn-mainnav-store-5d91f523.js +17 -0
- package/esm/pn-market-web-components.js +3 -2
- package/esm/pn-marketweb-input.entry.js +2 -7
- package/esm/pn-marketweb-search.entry.js +2 -6
- package/esm/pn-marketweb-sitefooter.entry.js +10 -15
- package/esm/pn-marketweb-siteheader-login-button_5.entry.js +12 -10
- package/esm/pn-marketweb-siteheader-login-linklist.entry.js +4 -4
- package/esm/{pn-marketweb-siteheader-store-cd0a1dab.js → pn-marketweb-siteheader-store-9df5290d.js} +1 -1
- package/esm/pn-marketweb-siteheader.entry.js +10 -38
- package/esm/pn-multi-formfield.entry.js +10 -10
- package/esm/pn-parcel-tracker.entry.js +2 -2
- package/esm/pn-pex-pricefinder.entry.js +2 -5
- package/esm/pn-product-card_3.entry.js +15 -4
- package/esm/pn-product-pricelist-result.entry.js +3 -3
- package/esm/pn-product-pricelist.entry.js +4 -4
- package/esm/pn-product-tile-info_2.entry.js +10 -3
- package/esm/pn-product-tile.entry.js +2 -2
- package/esm/pn-profile-modal-customernumber.entry.js +2 -2
- package/esm/pn-profile-modal-profile.entry.js +4 -4
- package/esm/pn-profile-modal-store-81f53310.js +15 -0
- package/esm/pn-profile-modal-type.entry.js +4 -4
- package/esm/pn-profile-modal.entry.js +4 -4
- package/esm/pn-profile-selector-option.entry.js +2 -2
- package/esm/pn-profile-selector.entry.js +5 -5
- package/esm/pn-proxio-findprice-result.entry.js +5 -2
- package/esm/pn-proxio-findprice.entry.js +4 -4
- package/esm/pn-proxio-pricegroup.entry.js +3 -5
- package/esm/pn-proxio-productcard_4.entry.js +12 -5
- package/esm/pn-quick-cta.entry.js +2 -2
- package/esm/pn-quote-card.entry.js +2 -3
- package/esm/pn-scroll.entry.js +2 -2
- package/esm/pn-share-item.entry.js +2 -2
- package/esm/pn-share.entry.js +3 -2
- package/esm/pn-sidenav-level.entry.js +4 -4
- package/esm/pn-sidenav-link.entry.js +4 -12
- package/esm/pn-sidenav-store-94be19c8.js +14 -0
- package/esm/pn-sidenav-togglebutton.entry.js +4 -5
- package/esm/pn-sidenav.entry.js +4 -6
- package/esm/pn-site-footer_2.entry.js +3 -4
- package/esm/pn-spotlight.entry.js +2 -2
- package/esm/pn-stats-info-data.entry.js +8 -8
- package/esm/pn-stats-info.entry.js +3 -2
- package/esm/pn-teaser-card.entry.js +3 -4
- package/esm/pn-titletag.entry.js +2 -4
- package/esm/polyfills/css-shim.js +1 -1
- package/esm-es5/MarketWebContextService-3ed3fe80.js +1 -1
- package/esm-es5/convert-f6377d13.js +1 -1
- package/esm-es5/{index-7b21ecff.js → index-7f77b0ba.js} +1 -1
- package/esm-es5/index-c118284d.js +1 -0
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-animated-tile.entry.js +1 -1
- package/esm-es5/pn-bonus-progressbar-level.entry.js +1 -1
- package/esm-es5/pn-bonus-progressbar.entry.js +1 -1
- package/esm-es5/pn-breakpoints.entry.js +1 -1
- package/esm-es5/pn-chart.entry.js +2 -2
- package/esm-es5/pn-charts-card.entry.js +1 -1
- package/esm-es5/pn-choice-button.entry.js +1 -1
- package/esm-es5/pn-customernumber-selector-option.entry.js +1 -1
- package/esm-es5/pn-customernumber-selector.entry.js +1 -1
- package/esm-es5/pn-filter-checkbox.entry.js +1 -1
- package/esm-es5/pn-find-price-result.entry.js +1 -1
- package/esm-es5/{pn-find-price-store-bde5071d.js → pn-find-price-store-e13b6651.js} +1 -1
- package/esm-es5/pn-find-price.entry.js +1 -1
- package/esm-es5/pn-find-service-and-price-result.entry.js +1 -1
- package/esm-es5/{pn-find-service-and-price-store-65df46a0.js → pn-find-service-and-price-store-f09ca219.js} +1 -1
- package/esm-es5/pn-find-service-and-price.entry.js +1 -1
- package/esm-es5/pn-language-selector_9.entry.js +1 -1
- package/esm-es5/pn-line-shape.entry.js +1 -1
- package/esm-es5/pn-mainnav-link.entry.js +1 -1
- package/esm-es5/{pn-mainnav-store-28571e54.js → pn-mainnav-store-5d91f523.js} +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-input.entry.js +1 -1
- package/esm-es5/pn-marketweb-search.entry.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader-login-button_5.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader-login-linklist.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader-store-9df5290d.js +1 -0
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/esm-es5/pn-multi-formfield.entry.js +1 -1
- package/esm-es5/pn-parcel-tracker.entry.js +1 -1
- package/esm-es5/pn-pex-pricefinder.entry.js +1 -1
- package/esm-es5/pn-product-card_3.entry.js +1 -1
- package/esm-es5/pn-product-pricelist-result.entry.js +1 -1
- package/esm-es5/pn-product-pricelist.entry.js +1 -1
- package/esm-es5/pn-product-tile-info_2.entry.js +1 -1
- package/esm-es5/pn-product-tile.entry.js +1 -1
- package/esm-es5/pn-profile-modal-customernumber.entry.js +1 -1
- package/esm-es5/pn-profile-modal-profile.entry.js +1 -1
- package/esm-es5/{pn-profile-modal-store-ae9e0d5a.js → pn-profile-modal-store-81f53310.js} +1 -1
- package/esm-es5/pn-profile-modal-type.entry.js +1 -1
- package/esm-es5/pn-profile-modal.entry.js +1 -1
- package/esm-es5/pn-profile-selector-option.entry.js +1 -1
- package/esm-es5/pn-profile-selector.entry.js +1 -1
- package/esm-es5/pn-proxio-findprice-result.entry.js +1 -1
- package/esm-es5/pn-proxio-findprice.entry.js +1 -1
- package/esm-es5/pn-proxio-pricegroup.entry.js +1 -1
- package/esm-es5/pn-proxio-productcard_4.entry.js +1 -1
- package/esm-es5/pn-quick-cta.entry.js +1 -1
- package/esm-es5/pn-quote-card.entry.js +1 -1
- package/esm-es5/pn-scroll.entry.js +1 -1
- package/esm-es5/pn-share-item.entry.js +1 -1
- package/esm-es5/pn-share.entry.js +1 -1
- package/esm-es5/pn-sidenav-level.entry.js +1 -1
- package/esm-es5/pn-sidenav-link.entry.js +1 -1
- package/esm-es5/{pn-sidenav-store-50b186d6.js → pn-sidenav-store-94be19c8.js} +1 -1
- package/esm-es5/pn-sidenav-togglebutton.entry.js +1 -1
- package/esm-es5/pn-sidenav.entry.js +1 -1
- package/esm-es5/pn-site-footer_2.entry.js +1 -1
- package/esm-es5/pn-spotlight.entry.js +1 -1
- package/esm-es5/pn-stats-info-data.entry.js +1 -1
- package/esm-es5/pn-stats-info.entry.js +1 -1
- package/esm-es5/pn-teaser-card.entry.js +1 -1
- package/esm-es5/pn-titletag.entry.js +1 -1
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/{umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/polyfills/es5-html-element.js → loader/index.js} +4 -1
- package/loader/package.json +11 -0
- package/package.json +7 -5
- package/pn-market-web-components/{p-3d05a6c1.system.entry.js → p-0159804c.system.entry.js} +1 -1
- package/pn-market-web-components/{p-13baed17.system.entry.js → p-02632961.system.entry.js} +1 -1
- package/pn-market-web-components/p-0f1115aa.entry.js +1 -0
- package/pn-market-web-components/p-0fbcacf3.system.entry.js +1 -0
- package/pn-market-web-components/p-12f461db.entry.js +1 -0
- package/pn-market-web-components/{p-3738a2df.system.js → p-13d2d138.system.js} +1 -1
- package/pn-market-web-components/p-14d288d5.entry.js +1 -0
- package/pn-market-web-components/p-1545fb34.entry.js +1 -0
- package/pn-market-web-components/p-156fedd7.entry.js +1 -0
- package/pn-market-web-components/p-15e680a8.entry.js +1 -0
- package/pn-market-web-components/p-1646c170.system.entry.js +1 -0
- package/pn-market-web-components/p-17fb8d9e.entry.js +1 -0
- package/pn-market-web-components/p-186266ae.system.entry.js +1 -0
- package/pn-market-web-components/p-18abec91.entry.js +1 -0
- package/pn-market-web-components/p-1a064ded.entry.js +1 -0
- package/pn-market-web-components/p-1a9b2a0e.system.entry.js +1 -0
- package/pn-market-web-components/p-1c382898.entry.js +1 -0
- package/pn-market-web-components/{p-fc1083d2.system.entry.js → p-1d50340b.system.entry.js} +1 -1
- package/pn-market-web-components/p-1d9de480.system.entry.js +1 -0
- package/pn-market-web-components/{p-1ce871c5.system.entry.js → p-1fb4eae4.system.entry.js} +1 -1
- package/pn-market-web-components/{p-80dce81e.system.entry.js → p-2145d5e0.system.entry.js} +1 -1
- package/pn-market-web-components/{p-a1cf4618.system.entry.js → p-2844f3b2.system.entry.js} +1 -1
- package/pn-market-web-components/{p-8e890ab1.system.entry.js → p-29d0ec91.system.entry.js} +1 -1
- package/pn-market-web-components/p-2a5cd298.entry.js +1 -0
- package/pn-market-web-components/{p-c9fb0f01.system.entry.js → p-2e507907.system.entry.js} +2 -2
- package/pn-market-web-components/p-31b703f9.entry.js +1 -0
- package/pn-market-web-components/p-34c0b146.entry.js +1 -0
- package/pn-market-web-components/p-368dbf3c.system.entry.js +1 -0
- package/pn-market-web-components/p-37d26cef.entry.js +1 -0
- package/pn-market-web-components/p-38f135fd.entry.js +1 -0
- package/pn-market-web-components/{p-a5f75560.system.js → p-396b254a.system.js} +1 -1
- package/pn-market-web-components/{p-94958580.system.js → p-3a450371.system.js} +1 -1
- package/pn-market-web-components/p-3d8925bd.entry.js +1 -0
- package/pn-market-web-components/p-3d89445b.entry.js +1 -0
- package/pn-market-web-components/{p-add7d76c.system.js → p-441249d9.system.js} +1 -1
- package/pn-market-web-components/p-44c05fba.entry.js +1 -0
- package/pn-market-web-components/p-44f58f15.js +1 -0
- package/pn-market-web-components/p-47d717a3.entry.js +1 -0
- package/pn-market-web-components/p-48c74c53.entry.js +1 -0
- package/pn-market-web-components/p-49f60496.entry.js +1 -0
- package/pn-market-web-components/p-4b2e76e9.entry.js +1 -0
- package/pn-market-web-components/{p-7079df88.system.entry.js → p-4d561de4.system.entry.js} +1 -1
- package/pn-market-web-components/p-4ef54288.entry.js +1 -0
- package/pn-market-web-components/p-507f8886.entry.js +1 -0
- package/pn-market-web-components/p-530be6fe.entry.js +1 -0
- package/pn-market-web-components/p-54544560.system.entry.js +1 -0
- package/pn-market-web-components/{p-74d35edf.system.entry.js → p-545a40a7.system.entry.js} +1 -1
- package/pn-market-web-components/p-5521aeaa.entry.js +1 -0
- package/pn-market-web-components/{p-4a03854b.system.entry.js → p-589a9a4c.system.entry.js} +1 -1
- package/pn-market-web-components/p-59024d31.entry.js +1 -0
- package/pn-market-web-components/{p-c62a91ba.system.entry.js → p-5a41c1bb.system.entry.js} +1 -1
- package/pn-market-web-components/{p-723b9901.system.entry.js → p-5a506356.system.entry.js} +1 -1
- package/pn-market-web-components/p-5a6761da.js +1 -0
- package/pn-market-web-components/p-5e768b73.entry.js +1 -0
- package/pn-market-web-components/{p-f782ce94.system.entry.js → p-658f6ff7.system.entry.js} +1 -1
- package/pn-market-web-components/{p-8117b79e.system.entry.js → p-68324e6f.system.entry.js} +1 -1
- package/pn-market-web-components/{p-9c3de760.system.entry.js → p-6a4ae9af.system.entry.js} +1 -1
- package/pn-market-web-components/p-6b5ff47f.entry.js +1 -0
- package/pn-market-web-components/{p-7b9fb94f.system.entry.js → p-6d050c3a.system.entry.js} +1 -1
- package/pn-market-web-components/{p-02ea55ad.system.js → p-6f1d6a1a.system.js} +1 -1
- package/pn-market-web-components/p-73ee3141.entry.js +1 -0
- package/pn-market-web-components/{p-ecf712bb.system.entry.js → p-752616b7.system.entry.js} +1 -1
- package/pn-market-web-components/p-7620beb6.entry.js +1 -0
- package/pn-market-web-components/p-773b59c0.entry.js +24 -0
- package/pn-market-web-components/p-7c1b31e8.js +2 -0
- package/pn-market-web-components/p-7d992089.entry.js +1 -0
- package/pn-market-web-components/p-7dff99ed.entry.js +1 -0
- package/pn-market-web-components/p-8079dfd5.system.entry.js +1 -0
- package/pn-market-web-components/p-82db879c.entry.js +1 -0
- package/pn-market-web-components/p-833bab34.entry.js +1 -0
- package/pn-market-web-components/{p-290d5824.system.entry.js → p-853e6559.system.entry.js} +1 -1
- package/pn-market-web-components/{p-f58bde56.js → p-8666d14d.js} +1 -1
- package/pn-market-web-components/p-8766fa86.system.js +1 -1
- package/pn-market-web-components/p-87fd21d8.entry.js +1 -0
- package/pn-market-web-components/{p-054f8b3a.system.entry.js → p-8805bc30.system.entry.js} +1 -1
- package/pn-market-web-components/{p-086a72ca.system.entry.js → p-893a4a26.system.entry.js} +1 -1
- package/pn-market-web-components/{p-450cbe76.system.entry.js → p-8ca063a9.system.entry.js} +1 -1
- package/pn-market-web-components/{p-9edaf6b6.system.entry.js → p-8cefd900.system.entry.js} +1 -1
- package/pn-market-web-components/p-8e62ef84.system.entry.js +1 -0
- package/pn-market-web-components/p-8f32fa2b.system.entry.js +1 -0
- package/pn-market-web-components/{p-58a57436.system.entry.js → p-8fee0115.system.entry.js} +1 -1
- package/pn-market-web-components/{p-aa271997.system.entry.js → p-9010c32a.system.entry.js} +1 -1
- package/pn-market-web-components/{p-f312ff98.system.entry.js → p-939b5792.system.entry.js} +1 -1
- package/pn-market-web-components/p-97564852.entry.js +1 -0
- package/pn-market-web-components/p-9a1c267d.entry.js +1 -0
- package/pn-market-web-components/p-9ed7a18f.entry.js +1 -0
- package/pn-market-web-components/{p-4f67721e.system.entry.js → p-9f95b3c9.system.entry.js} +1 -1
- package/pn-market-web-components/{p-0cacf9fb.js → p-a1a58fe4.js} +1 -1
- package/pn-market-web-components/p-a5faec68.system.js +2 -0
- package/pn-market-web-components/p-a799fee1.entry.js +1 -0
- package/pn-market-web-components/p-aaa94bee.system.entry.js +1 -0
- package/pn-market-web-components/{p-2718b89a.system.entry.js → p-abfed655.system.entry.js} +1 -1
- package/pn-market-web-components/p-ac62dc33.entry.js +1 -0
- package/pn-market-web-components/p-ad1f57dc.entry.js +1 -0
- package/pn-market-web-components/{p-dbe032f7.system.js → p-ad836c55.system.js} +1 -1
- package/pn-market-web-components/p-b0102ff6.entry.js +1 -0
- package/pn-market-web-components/{p-625fb7fb.system.entry.js → p-b890f3f9.system.entry.js} +1 -1
- package/pn-market-web-components/{p-d790293c.system.entry.js → p-bab17118.system.entry.js} +1 -1
- package/pn-market-web-components/p-bdd1ec55.entry.js +1 -0
- package/pn-market-web-components/p-beefd9f7.entry.js +1 -0
- package/pn-market-web-components/p-bfe239ca.js +1 -1
- package/pn-market-web-components/p-c0db1ffd.js +1 -0
- package/pn-market-web-components/p-c1d9a064.entry.js +1 -0
- package/pn-market-web-components/{p-84699999.js → p-c5727e83.js} +1 -1
- package/pn-market-web-components/{p-447ef543.system.entry.js → p-c576ac3e.system.entry.js} +1 -1
- package/pn-market-web-components/p-c668f453.entry.js +1 -0
- package/pn-market-web-components/p-cb53b67f.system.js +1 -1
- package/pn-market-web-components/{p-879c0887.system.entry.js → p-cccb53f2.system.entry.js} +1 -1
- package/pn-market-web-components/p-d295ef71.system.js +1 -0
- package/pn-market-web-components/{p-825b8fb8.system.js → p-d34c9be2.system.js} +1 -1
- package/pn-market-web-components/p-d3c1d6f0.entry.js +1 -0
- package/pn-market-web-components/p-d5ae9797.entry.js +1 -0
- package/pn-market-web-components/p-d6ee168b.system.entry.js +1 -0
- package/pn-market-web-components/p-d70e685c.entry.js +1 -0
- package/pn-market-web-components/p-dbd7837e.entry.js +1 -0
- package/pn-market-web-components/p-dc598ef8.entry.js +1 -0
- package/pn-market-web-components/p-dce8a335.system.entry.js +1 -0
- package/pn-market-web-components/p-e0e45eb0.system.entry.js +1 -0
- package/pn-market-web-components/p-e2abebd7.entry.js +1 -0
- package/pn-market-web-components/{p-36a1b8e1.system.entry.js → p-e4961116.system.entry.js} +1 -1
- package/pn-market-web-components/p-e4fbd06c.entry.js +1 -0
- package/pn-market-web-components/p-e54c80d8.system.entry.js +1 -0
- package/pn-market-web-components/{p-93cecc43.system.entry.js → p-e737c51d.system.entry.js} +1 -1
- package/pn-market-web-components/p-e7f43cc2.entry.js +1 -0
- package/pn-market-web-components/{p-86f06e26.js → p-ecaad0c1.js} +1 -1
- package/pn-market-web-components/p-ed5e91eb.system.entry.js +1 -0
- package/pn-market-web-components/{p-e6fa11ad.system.entry.js → p-ef721555.system.entry.js} +1 -1
- package/pn-market-web-components/{p-41220f82.system.entry.js → p-f2817445.system.entry.js} +1 -1
- package/pn-market-web-components/{p-1151bf60.system.entry.js → p-f7cb2ef9.system.entry.js} +1 -1
- package/pn-market-web-components/{p-a864fbed.system.entry.js → p-fca11f16.system.entry.js} +1 -1
- package/pn-market-web-components/p-fe0d832d.system.entry.js +1 -0
- package/pn-market-web-components/{p-b88337dd.system.entry.js → p-ffe18938.system.entry.js} +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/pn-market-web-components/pn-market-web-components.js +2 -1
- package/types/components/navigation/pn-sidenav/pn-sidenav-link.d.ts +1 -1
- package/types/components.d.ts +58 -22
- package/types/stencil-public-runtime.d.ts +79 -7
- package/custom-elements/index.d.ts +0 -489
- package/custom-elements/index.js +0 -30532
- package/esm-es5/index-5397620b.js +0 -1
- package/esm-es5/pn-marketweb-siteheader-store-cd0a1dab.js +0 -1
- package/pn-market-web-components/p-0796f9b2.entry.js +0 -1
- package/pn-market-web-components/p-07ca420d.entry.js +0 -1
- package/pn-market-web-components/p-138b1e76.entry.js +0 -1
- package/pn-market-web-components/p-15112837.entry.js +0 -1
- package/pn-market-web-components/p-16c4bc50.entry.js +0 -1
- package/pn-market-web-components/p-17c4004f.entry.js +0 -1
- package/pn-market-web-components/p-1ca41ab1.entry.js +0 -1
- package/pn-market-web-components/p-21c01c47.entry.js +0 -1
- package/pn-market-web-components/p-227e1d46.entry.js +0 -1
- package/pn-market-web-components/p-2da8e5e8.system.entry.js +0 -1
- package/pn-market-web-components/p-2e2dfb79.entry.js +0 -1
- package/pn-market-web-components/p-2e3bde56.entry.js +0 -1
- package/pn-market-web-components/p-3343610e.entry.js +0 -1
- package/pn-market-web-components/p-33db2f10.entry.js +0 -1
- package/pn-market-web-components/p-35fcd76c.system.entry.js +0 -1
- package/pn-market-web-components/p-36654f2a.system.js +0 -1
- package/pn-market-web-components/p-381b3ec0.entry.js +0 -1
- package/pn-market-web-components/p-381c034b.entry.js +0 -1
- package/pn-market-web-components/p-3969ec4d.entry.js +0 -1
- package/pn-market-web-components/p-397514bc.system.entry.js +0 -1
- package/pn-market-web-components/p-3f4a0538.entry.js +0 -1
- package/pn-market-web-components/p-468025b2.system.entry.js +0 -1
- package/pn-market-web-components/p-479b970a.entry.js +0 -1
- package/pn-market-web-components/p-499bb3ac.entry.js +0 -1
- package/pn-market-web-components/p-4bef1bf3.entry.js +0 -1
- package/pn-market-web-components/p-4c6a2bc9.system.entry.js +0 -1
- package/pn-market-web-components/p-557328e3.system.entry.js +0 -1
- package/pn-market-web-components/p-5776275b.entry.js +0 -1
- package/pn-market-web-components/p-58e8d7d5.js +0 -1
- package/pn-market-web-components/p-5f0acbbd.entry.js +0 -1
- package/pn-market-web-components/p-61dbe832.entry.js +0 -1
- package/pn-market-web-components/p-67380aa4.entry.js +0 -1
- package/pn-market-web-components/p-67887512.system.js +0 -1
- package/pn-market-web-components/p-6f28cfba.entry.js +0 -1
- package/pn-market-web-components/p-715d1ef7.entry.js +0 -1
- package/pn-market-web-components/p-77c907d9.entry.js +0 -1
- package/pn-market-web-components/p-7ce41d14.entry.js +0 -1
- package/pn-market-web-components/p-81d764a0.entry.js +0 -1
- package/pn-market-web-components/p-861def61.entry.js +0 -1
- package/pn-market-web-components/p-88185835.entry.js +0 -1
- package/pn-market-web-components/p-885bc8d7.system.entry.js +0 -1
- package/pn-market-web-components/p-8b684578.entry.js +0 -1
- package/pn-market-web-components/p-8e146205.entry.js +0 -1
- package/pn-market-web-components/p-8e4d292f.entry.js +0 -1
- package/pn-market-web-components/p-8f1b7c70.system.entry.js +0 -1
- package/pn-market-web-components/p-906719be.system.entry.js +0 -1
- package/pn-market-web-components/p-91c5cd79.entry.js +0 -1
- package/pn-market-web-components/p-9344cd23.js +0 -1
- package/pn-market-web-components/p-93d454ea.entry.js +0 -1
- package/pn-market-web-components/p-951861fa.entry.js +0 -1
- package/pn-market-web-components/p-98a7ddd1.system.entry.js +0 -1
- package/pn-market-web-components/p-996d8a6a.entry.js +0 -1
- package/pn-market-web-components/p-9b855b11.entry.js +0 -24
- package/pn-market-web-components/p-9c2c1aa2.entry.js +0 -1
- package/pn-market-web-components/p-a247058b.system.entry.js +0 -1
- package/pn-market-web-components/p-a5171cb9.system.entry.js +0 -1
- package/pn-market-web-components/p-a7bb94a0.entry.js +0 -1
- package/pn-market-web-components/p-a921d3fd.system.entry.js +0 -1
- package/pn-market-web-components/p-b1474b9e.entry.js +0 -1
- package/pn-market-web-components/p-b9a84e67.entry.js +0 -1
- package/pn-market-web-components/p-bb4f0673.system.entry.js +0 -1
- package/pn-market-web-components/p-bb626ab4.js +0 -1
- package/pn-market-web-components/p-bd22aaac.entry.js +0 -1
- package/pn-market-web-components/p-c2e55f38.entry.js +0 -1
- package/pn-market-web-components/p-c5179a9b.system.entry.js +0 -1
- package/pn-market-web-components/p-c714a790.entry.js +0 -1
- package/pn-market-web-components/p-d0155ddf.entry.js +0 -1
- package/pn-market-web-components/p-d7e3d918.entry.js +0 -1
- package/pn-market-web-components/p-e32dc098.entry.js +0 -1
- package/pn-market-web-components/p-e9576f26.entry.js +0 -1
- package/pn-market-web-components/p-e9fe5c54.entry.js +0 -1
- package/pn-market-web-components/p-ecdf2b69.system.entry.js +0 -1
- package/pn-market-web-components/p-ee589138.entry.js +0 -1
- package/pn-market-web-components/p-f008015e.system.entry.js +0 -1
- package/pn-market-web-components/p-f61342c3.js +0 -1
- package/pn-market-web-components/p-f774e2cc.entry.js +0 -1
- package/pn-market-web-components/p-f82c5d08.entry.js +0 -1
- package/pn-market-web-components/p-fc974bca.entry.js +0 -1
- package/pn-market-web-components/p-fea72975.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/LICENSE.md +0 -27
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/bin/stencil +0 -57
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/cli/config-flags.d.ts +0 -122
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/cli/index.cjs +0 -2609
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/cli/index.d.ts +0 -19
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/cli/index.js +0 -2583
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/cli/package.json +0 -14
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.d.ts +0 -24
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.dom.d.ts +0 -18505
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.dom.iterable.d.ts +0 -341
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.collection.d.ts +0 -150
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.core.d.ts +0 -559
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.d.ts +0 -30
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.generator.d.ts +0 -79
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.iterable.d.ts +0 -498
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.promise.d.ts +0 -83
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.proxy.d.ts +0 -130
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.reflect.d.ts +0 -146
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.symbol.d.ts +0 -48
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2015.symbol.wellknown.d.ts +0 -324
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2016.array.include.d.ts +0 -118
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2016.d.ts +0 -22
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2016.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.d.ts +0 -26
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.intl.d.ts +0 -47
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.object.d.ts +0 -51
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.sharedmemory.d.ts +0 -137
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.string.d.ts +0 -47
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2017.typedarrays.d.ts +0 -55
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.asyncgenerator.d.ts +0 -79
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.asynciterable.d.ts +0 -45
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.d.ts +0 -26
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.intl.d.ts +0 -73
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.promise.d.ts +0 -32
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2018.regexp.d.ts +0 -39
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.array.d.ts +0 -85
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.d.ts +0 -26
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.intl.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.object.d.ts +0 -35
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.string.d.ts +0 -39
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2019.symbol.d.ts +0 -26
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.bigint.d.ts +0 -730
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.d.ts +0 -29
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.date.d.ts +0 -44
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.intl.d.ts +0 -433
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.number.d.ts +0 -30
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.promise.d.ts +0 -49
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.sharedmemory.d.ts +0 -99
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.string.d.ts +0 -30
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2020.symbol.wellknown.d.ts +0 -39
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2021.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2021.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2021.intl.d.ts +0 -154
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2021.promise.d.ts +0 -50
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2021.string.d.ts +0 -35
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2021.weakref.d.ts +0 -75
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.array.d.ts +0 -123
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.d.ts +0 -27
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.error.d.ts +0 -75
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.intl.d.ts +0 -111
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.object.d.ts +0 -28
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.sharedmemory.d.ts +0 -27
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es2022.string.d.ts +0 -27
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es5.d.ts +0 -4526
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.es6.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.esnext.d.ts +0 -22
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.esnext.full.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.esnext.intl.d.ts +0 -30
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.esnext.promise.d.ts +0 -43
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.esnext.string.d.ts +0 -35
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.esnext.weakref.d.ts +0 -75
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.scripthost.d.ts +0 -327
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.webworker.d.ts +0 -6192
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.webworker.importscripts.d.ts +0 -26
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/lib.webworker.iterable.d.ts +0 -175
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/package.json +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/stencil.d.ts +0 -73
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/stencil.js +0 -70673
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/stencil.min.js +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/sys/in-memory-fs.d.ts +0 -218
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/compiler/transpile.d.ts +0 -32
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dependencies.json +0 -120
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/app-error.d.ts +0 -18
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/events.d.ts +0 -6
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/hmr-components.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/hmr-external-styles.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/hmr-images.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/hmr-inline-styles.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/hmr-util.d.ts +0 -9
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/hmr-window.d.ts +0 -10
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/index.d.ts +0 -6
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/index.js +0 -808
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/logger.d.ts +0 -5
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/package.json +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/progress.d.ts +0 -3
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/status.d.ts +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/test/hmr-util.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/client/test/status.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/connector.html +0 -6
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/index.d.ts +0 -3
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/index.js +0 -264
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/open-in-editor-api.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/package.json +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/server-process.js +0 -1799
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/server-worker-thread.js +0 -39
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/static/favicon.ico +0 -0
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/templates/directory-index.html +0 -132
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/templates/initial-load.html +0 -160
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/visualstudio.vbs +0 -82
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/ws.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/dev-server/xdg-open +0 -1066
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/app-data/index.cjs +0 -92
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/app-data/index.d.ts +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/app-data/index.js +0 -88
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/app-data/package.json +0 -15
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/css-shim.js +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/dom.js +0 -73
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/index.js +0 -3371
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/package.json +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/patch-browser.js +0 -142
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/patch-esm.js +0 -23
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/polyfills/core-js.js +0 -11
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/polyfills/css-shim.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/polyfills/dom.js +0 -79
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/polyfills/index.js +0 -34
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/polyfills/system.js +0 -6
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/client/shadow-css.js +0 -387
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/hydrate/index.js +0 -1143
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/hydrate/package.json +0 -7
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/hydrate/runner.d.ts +0 -217
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/hydrate/runner.js +0 -777
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/hydrate/shadow-css.js +0 -143
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/index.d.ts +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/index.js +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/package.json +0 -9
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-core/index.cjs +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-core/index.d.ts +0 -51
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-core/index.js +0 -16
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-ext-modules.d.ts +0 -41
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-private.d.ts +0 -2268
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-public-compiler.d.ts +0 -2338
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-public-docs.d.ts +0 -140
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/stencil-public-runtime.d.ts +0 -1637
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/testing/index.js +0 -1105
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/testing/package.json +0 -7
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/internal/testing/shadow-css.js +0 -143
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/mock-doc/index.cjs +0 -4858
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/mock-doc/index.d.ts +0 -1020
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/mock-doc/index.js +0 -4822
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/mock-doc/package.json +0 -15
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/package.json +0 -190
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/readme.md +0 -99
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/assets/favicon.ico +0 -0
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/assets/logo.png +0 -0
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/app.css +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/app.esm.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/app.js +0 -33
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/index.esm.js +0 -0
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-081b0641.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-227a1e18.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-2c298727.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-5479268c.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-573ec8a4.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-6ba08604.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-6bc63295.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-7a3759fd.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-7b4e3ba7.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-988eb362.css +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-9b6a9315.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-b4cc611c.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-d1bf53f5.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-e2efe0df.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-e8ca6d97.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-ec2f13e0.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-f0b99977.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-f4745c2f.entry.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/build/p-fbbae598.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/host.config.json +0 -15
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/index.html +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/compare/manifest.json +0 -13
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/connector.js +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/index.js +0 -661
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/local-connector.js +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/package.json +0 -15
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/pixel-match.js +0 -2807
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/autoprefixer.js +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/glob.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/graceful-fs.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/index.d.ts +0 -22
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/index.js +0 -6121
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/node-fetch.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/package.json +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/prompts.js +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/sys/node/worker.js +0 -52
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/index.d.ts +0 -12
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/index.js +0 -4155
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-config.d.ts +0 -16
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-environment.d.ts +0 -15
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-preprocessor.d.ts +0 -59
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-runner.d.ts +0 -10
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-screenshot.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-serializer.d.ts +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/jest-setup-test-framework.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/test/jest-config.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/test/jest-preprocessor.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/test/jest-runner.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest/test/jest-serializer.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest-environment.js +0 -3
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest-preprocessor.js +0 -3
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest-preset.js +0 -37
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest-runner.js +0 -3
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/jest-setuptestframework.js +0 -3
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/attributes.d.ts +0 -14
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/class-list.d.ts +0 -12
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/events.d.ts +0 -21
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/html.d.ts +0 -12
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/index.d.ts +0 -23
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/screenshot.d.ts +0 -5
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/matchers/text.d.ts +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/mock-fetch.d.ts +0 -11
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/mocks.d.ts +0 -56
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/package.json +0 -8
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/index.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-browser.d.ts +0 -6
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-declarations.d.ts +0 -429
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-element.d.ts +0 -67
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-events.d.ts +0 -21
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-page.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/puppeteer/puppeteer-screenshot.d.ts +0 -4
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/reset-build-conditionals.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/spec-page.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/test/testing-utils.spec.d.ts +0 -1
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/test-transpile.d.ts +0 -2
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/testing-logger.d.ts +0 -25
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/testing-sys.d.ts +0 -6
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/testing-utils.d.ts +0 -79
- package/umd/modules/@postnord/web-components/node_modules/@stencil/core/testing/testing.d.ts +0 -2
- /package/{custom-elements → components}/mockresponse.js +0 -0
package/umd/modules/@postnord/web-components/node_modules/@stencil/core/screenshot/pixel-match.js
DELETED
|
@@ -1,2807 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var util = require('util');
|
|
5
|
-
var Stream = require('stream');
|
|
6
|
-
var zlib = require('zlib');
|
|
7
|
-
var require$$0 = require('assert');
|
|
8
|
-
var require$$1 = require('buffer');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
13
|
-
var util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
|
14
|
-
var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream);
|
|
15
|
-
var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
|
|
16
|
-
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
17
|
-
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
18
|
-
|
|
19
|
-
var pixelmatch_1 = pixelmatch;
|
|
20
|
-
|
|
21
|
-
const defaultOptions = {
|
|
22
|
-
threshold: 0.1, // matching threshold (0 to 1); smaller is more sensitive
|
|
23
|
-
includeAA: false, // whether to skip anti-aliasing detection
|
|
24
|
-
alpha: 0.1, // opacity of original image in diff output
|
|
25
|
-
aaColor: [255, 255, 0], // color of anti-aliased pixels in diff output
|
|
26
|
-
diffColor: [255, 0, 0], // color of different pixels in diff output
|
|
27
|
-
diffColorAlt: null, // whether to detect dark on light differences between img1 and img2 and set an alternative color to differentiate between the two
|
|
28
|
-
diffMask: false // draw the diff over a transparent background (a mask)
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function pixelmatch(img1, img2, output, width, height, options) {
|
|
32
|
-
|
|
33
|
-
if (!isPixelData(img1) || !isPixelData(img2) || (output && !isPixelData(output)))
|
|
34
|
-
throw new Error('Image data: Uint8Array, Uint8ClampedArray or Buffer expected.');
|
|
35
|
-
|
|
36
|
-
if (img1.length !== img2.length || (output && output.length !== img1.length))
|
|
37
|
-
throw new Error('Image sizes do not match.');
|
|
38
|
-
|
|
39
|
-
if (img1.length !== width * height * 4) throw new Error('Image data size does not match width/height.');
|
|
40
|
-
|
|
41
|
-
options = Object.assign({}, defaultOptions, options);
|
|
42
|
-
|
|
43
|
-
// check if images are identical
|
|
44
|
-
const len = width * height;
|
|
45
|
-
const a32 = new Uint32Array(img1.buffer, img1.byteOffset, len);
|
|
46
|
-
const b32 = new Uint32Array(img2.buffer, img2.byteOffset, len);
|
|
47
|
-
let identical = true;
|
|
48
|
-
|
|
49
|
-
for (let i = 0; i < len; i++) {
|
|
50
|
-
if (a32[i] !== b32[i]) { identical = false; break; }
|
|
51
|
-
}
|
|
52
|
-
if (identical) { // fast path if identical
|
|
53
|
-
if (output && !options.diffMask) {
|
|
54
|
-
for (let i = 0; i < len; i++) drawGrayPixel(img1, 4 * i, options.alpha, output);
|
|
55
|
-
}
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// maximum acceptable square distance between two colors;
|
|
60
|
-
// 35215 is the maximum possible value for the YIQ difference metric
|
|
61
|
-
const maxDelta = 35215 * options.threshold * options.threshold;
|
|
62
|
-
let diff = 0;
|
|
63
|
-
|
|
64
|
-
// compare each pixel of one image against the other one
|
|
65
|
-
for (let y = 0; y < height; y++) {
|
|
66
|
-
for (let x = 0; x < width; x++) {
|
|
67
|
-
|
|
68
|
-
const pos = (y * width + x) * 4;
|
|
69
|
-
|
|
70
|
-
// squared YUV distance between colors at this pixel position, negative if the img2 pixel is darker
|
|
71
|
-
const delta = colorDelta(img1, img2, pos, pos);
|
|
72
|
-
|
|
73
|
-
// the color difference is above the threshold
|
|
74
|
-
if (Math.abs(delta) > maxDelta) {
|
|
75
|
-
// check it's a real rendering difference or just anti-aliasing
|
|
76
|
-
if (!options.includeAA && (antialiased(img1, x, y, width, height, img2) ||
|
|
77
|
-
antialiased(img2, x, y, width, height, img1))) {
|
|
78
|
-
// one of the pixels is anti-aliasing; draw as yellow and do not count as difference
|
|
79
|
-
// note that we do not include such pixels in a mask
|
|
80
|
-
if (output && !options.diffMask) drawPixel(output, pos, ...options.aaColor);
|
|
81
|
-
|
|
82
|
-
} else {
|
|
83
|
-
// found substantial difference not caused by anti-aliasing; draw it as such
|
|
84
|
-
if (output) {
|
|
85
|
-
drawPixel(output, pos, ...(delta < 0 && options.diffColorAlt || options.diffColor));
|
|
86
|
-
}
|
|
87
|
-
diff++;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
} else if (output) {
|
|
91
|
-
// pixels are similar; draw background as grayscale image blended with white
|
|
92
|
-
if (!options.diffMask) drawGrayPixel(img1, pos, options.alpha, output);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// return the number of different pixels
|
|
98
|
-
return diff;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function isPixelData(arr) {
|
|
102
|
-
// work around instanceof Uint8Array not working properly in some Jest environments
|
|
103
|
-
return ArrayBuffer.isView(arr) && arr.constructor.BYTES_PER_ELEMENT === 1;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// check if a pixel is likely a part of anti-aliasing;
|
|
107
|
-
// based on "Anti-aliased Pixel and Intensity Slope Detector" paper by V. Vysniauskas, 2009
|
|
108
|
-
|
|
109
|
-
function antialiased(img, x1, y1, width, height, img2) {
|
|
110
|
-
const x0 = Math.max(x1 - 1, 0);
|
|
111
|
-
const y0 = Math.max(y1 - 1, 0);
|
|
112
|
-
const x2 = Math.min(x1 + 1, width - 1);
|
|
113
|
-
const y2 = Math.min(y1 + 1, height - 1);
|
|
114
|
-
const pos = (y1 * width + x1) * 4;
|
|
115
|
-
let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
|
|
116
|
-
let min = 0;
|
|
117
|
-
let max = 0;
|
|
118
|
-
let minX, minY, maxX, maxY;
|
|
119
|
-
|
|
120
|
-
// go through 8 adjacent pixels
|
|
121
|
-
for (let x = x0; x <= x2; x++) {
|
|
122
|
-
for (let y = y0; y <= y2; y++) {
|
|
123
|
-
if (x === x1 && y === y1) continue;
|
|
124
|
-
|
|
125
|
-
// brightness delta between the center pixel and adjacent one
|
|
126
|
-
const delta = colorDelta(img, img, pos, (y * width + x) * 4, true);
|
|
127
|
-
|
|
128
|
-
// count the number of equal, darker and brighter adjacent pixels
|
|
129
|
-
if (delta === 0) {
|
|
130
|
-
zeroes++;
|
|
131
|
-
// if found more than 2 equal siblings, it's definitely not anti-aliasing
|
|
132
|
-
if (zeroes > 2) return false;
|
|
133
|
-
|
|
134
|
-
// remember the darkest pixel
|
|
135
|
-
} else if (delta < min) {
|
|
136
|
-
min = delta;
|
|
137
|
-
minX = x;
|
|
138
|
-
minY = y;
|
|
139
|
-
|
|
140
|
-
// remember the brightest pixel
|
|
141
|
-
} else if (delta > max) {
|
|
142
|
-
max = delta;
|
|
143
|
-
maxX = x;
|
|
144
|
-
maxY = y;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// if there are no both darker and brighter pixels among siblings, it's not anti-aliasing
|
|
150
|
-
if (min === 0 || max === 0) return false;
|
|
151
|
-
|
|
152
|
-
// if either the darkest or the brightest pixel has 3+ equal siblings in both images
|
|
153
|
-
// (definitely not anti-aliased), this pixel is anti-aliased
|
|
154
|
-
return (hasManySiblings(img, minX, minY, width, height) && hasManySiblings(img2, minX, minY, width, height)) ||
|
|
155
|
-
(hasManySiblings(img, maxX, maxY, width, height) && hasManySiblings(img2, maxX, maxY, width, height));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// check if a pixel has 3+ adjacent pixels of the same color.
|
|
159
|
-
function hasManySiblings(img, x1, y1, width, height) {
|
|
160
|
-
const x0 = Math.max(x1 - 1, 0);
|
|
161
|
-
const y0 = Math.max(y1 - 1, 0);
|
|
162
|
-
const x2 = Math.min(x1 + 1, width - 1);
|
|
163
|
-
const y2 = Math.min(y1 + 1, height - 1);
|
|
164
|
-
const pos = (y1 * width + x1) * 4;
|
|
165
|
-
let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
|
|
166
|
-
|
|
167
|
-
// go through 8 adjacent pixels
|
|
168
|
-
for (let x = x0; x <= x2; x++) {
|
|
169
|
-
for (let y = y0; y <= y2; y++) {
|
|
170
|
-
if (x === x1 && y === y1) continue;
|
|
171
|
-
|
|
172
|
-
const pos2 = (y * width + x) * 4;
|
|
173
|
-
if (img[pos] === img[pos2] &&
|
|
174
|
-
img[pos + 1] === img[pos2 + 1] &&
|
|
175
|
-
img[pos + 2] === img[pos2 + 2] &&
|
|
176
|
-
img[pos + 3] === img[pos2 + 3]) zeroes++;
|
|
177
|
-
|
|
178
|
-
if (zeroes > 2) return true;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// calculate color difference according to the paper "Measuring perceived color difference
|
|
186
|
-
// using YIQ NTSC transmission color space in mobile applications" by Y. Kotsarenko and F. Ramos
|
|
187
|
-
|
|
188
|
-
function colorDelta(img1, img2, k, m, yOnly) {
|
|
189
|
-
let r1 = img1[k + 0];
|
|
190
|
-
let g1 = img1[k + 1];
|
|
191
|
-
let b1 = img1[k + 2];
|
|
192
|
-
let a1 = img1[k + 3];
|
|
193
|
-
|
|
194
|
-
let r2 = img2[m + 0];
|
|
195
|
-
let g2 = img2[m + 1];
|
|
196
|
-
let b2 = img2[m + 2];
|
|
197
|
-
let a2 = img2[m + 3];
|
|
198
|
-
|
|
199
|
-
if (a1 === a2 && r1 === r2 && g1 === g2 && b1 === b2) return 0;
|
|
200
|
-
|
|
201
|
-
if (a1 < 255) {
|
|
202
|
-
a1 /= 255;
|
|
203
|
-
r1 = blend(r1, a1);
|
|
204
|
-
g1 = blend(g1, a1);
|
|
205
|
-
b1 = blend(b1, a1);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (a2 < 255) {
|
|
209
|
-
a2 /= 255;
|
|
210
|
-
r2 = blend(r2, a2);
|
|
211
|
-
g2 = blend(g2, a2);
|
|
212
|
-
b2 = blend(b2, a2);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const y1 = rgb2y(r1, g1, b1);
|
|
216
|
-
const y2 = rgb2y(r2, g2, b2);
|
|
217
|
-
const y = y1 - y2;
|
|
218
|
-
|
|
219
|
-
if (yOnly) return y; // brightness difference only
|
|
220
|
-
|
|
221
|
-
const i = rgb2i(r1, g1, b1) - rgb2i(r2, g2, b2);
|
|
222
|
-
const q = rgb2q(r1, g1, b1) - rgb2q(r2, g2, b2);
|
|
223
|
-
|
|
224
|
-
const delta = 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;
|
|
225
|
-
|
|
226
|
-
// encode whether the pixel lightens or darkens in the sign
|
|
227
|
-
return y1 > y2 ? -delta : delta;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function rgb2y(r, g, b) { return r * 0.29889531 + g * 0.58662247 + b * 0.11448223; }
|
|
231
|
-
function rgb2i(r, g, b) { return r * 0.59597799 - g * 0.27417610 - b * 0.32180189; }
|
|
232
|
-
function rgb2q(r, g, b) { return r * 0.21147017 - g * 0.52261711 + b * 0.31114694; }
|
|
233
|
-
|
|
234
|
-
// blend semi-transparent color with white
|
|
235
|
-
function blend(c, a) {
|
|
236
|
-
return 255 + (c - 255) * a;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function drawPixel(output, pos, r, g, b) {
|
|
240
|
-
output[pos + 0] = r;
|
|
241
|
-
output[pos + 1] = g;
|
|
242
|
-
output[pos + 2] = b;
|
|
243
|
-
output[pos + 3] = 255;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function drawGrayPixel(img, i, alpha, output) {
|
|
247
|
-
const r = img[i + 0];
|
|
248
|
-
const g = img[i + 1];
|
|
249
|
-
const b = img[i + 2];
|
|
250
|
-
const val = blend(rgb2y(r, g, b), alpha * img[i + 3] / 255);
|
|
251
|
-
drawPixel(output, i, val, val, val);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function createCommonjsModule(fn, basedir, module) {
|
|
255
|
-
return module = {
|
|
256
|
-
path: basedir,
|
|
257
|
-
exports: {},
|
|
258
|
-
require: function (path, base) {
|
|
259
|
-
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
260
|
-
}
|
|
261
|
-
}, fn(module, module.exports), module.exports;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function commonjsRequire () {
|
|
265
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
var chunkstream = createCommonjsModule(function (module) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
let ChunkStream = (module.exports = function () {
|
|
274
|
-
Stream__default['default'].call(this);
|
|
275
|
-
|
|
276
|
-
this._buffers = [];
|
|
277
|
-
this._buffered = 0;
|
|
278
|
-
|
|
279
|
-
this._reads = [];
|
|
280
|
-
this._paused = false;
|
|
281
|
-
|
|
282
|
-
this._encoding = "utf8";
|
|
283
|
-
this.writable = true;
|
|
284
|
-
});
|
|
285
|
-
util__default['default'].inherits(ChunkStream, Stream__default['default']);
|
|
286
|
-
|
|
287
|
-
ChunkStream.prototype.read = function (length, callback) {
|
|
288
|
-
this._reads.push({
|
|
289
|
-
length: Math.abs(length), // if length < 0 then at most this length
|
|
290
|
-
allowLess: length < 0,
|
|
291
|
-
func: callback,
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
process.nextTick(
|
|
295
|
-
function () {
|
|
296
|
-
this._process();
|
|
297
|
-
|
|
298
|
-
// its paused and there is not enought data then ask for more
|
|
299
|
-
if (this._paused && this._reads && this._reads.length > 0) {
|
|
300
|
-
this._paused = false;
|
|
301
|
-
|
|
302
|
-
this.emit("drain");
|
|
303
|
-
}
|
|
304
|
-
}.bind(this)
|
|
305
|
-
);
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
ChunkStream.prototype.write = function (data, encoding) {
|
|
309
|
-
if (!this.writable) {
|
|
310
|
-
this.emit("error", new Error("Stream not writable"));
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
let dataBuffer;
|
|
315
|
-
if (Buffer.isBuffer(data)) {
|
|
316
|
-
dataBuffer = data;
|
|
317
|
-
} else {
|
|
318
|
-
dataBuffer = Buffer.from(data, encoding || this._encoding);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
this._buffers.push(dataBuffer);
|
|
322
|
-
this._buffered += dataBuffer.length;
|
|
323
|
-
|
|
324
|
-
this._process();
|
|
325
|
-
|
|
326
|
-
// ok if there are no more read requests
|
|
327
|
-
if (this._reads && this._reads.length === 0) {
|
|
328
|
-
this._paused = true;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return this.writable && !this._paused;
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
ChunkStream.prototype.end = function (data, encoding) {
|
|
335
|
-
if (data) {
|
|
336
|
-
this.write(data, encoding);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
this.writable = false;
|
|
340
|
-
|
|
341
|
-
// already destroyed
|
|
342
|
-
if (!this._buffers) {
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// enqueue or handle end
|
|
347
|
-
if (this._buffers.length === 0) {
|
|
348
|
-
this._end();
|
|
349
|
-
} else {
|
|
350
|
-
this._buffers.push(null);
|
|
351
|
-
this._process();
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
ChunkStream.prototype.destroySoon = ChunkStream.prototype.end;
|
|
356
|
-
|
|
357
|
-
ChunkStream.prototype._end = function () {
|
|
358
|
-
if (this._reads.length > 0) {
|
|
359
|
-
this.emit("error", new Error("Unexpected end of input"));
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
this.destroy();
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
ChunkStream.prototype.destroy = function () {
|
|
366
|
-
if (!this._buffers) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
this.writable = false;
|
|
371
|
-
this._reads = null;
|
|
372
|
-
this._buffers = null;
|
|
373
|
-
|
|
374
|
-
this.emit("close");
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
ChunkStream.prototype._processReadAllowingLess = function (read) {
|
|
378
|
-
// ok there is any data so that we can satisfy this request
|
|
379
|
-
this._reads.shift(); // == read
|
|
380
|
-
|
|
381
|
-
// first we need to peek into first buffer
|
|
382
|
-
let smallerBuf = this._buffers[0];
|
|
383
|
-
|
|
384
|
-
// ok there is more data than we need
|
|
385
|
-
if (smallerBuf.length > read.length) {
|
|
386
|
-
this._buffered -= read.length;
|
|
387
|
-
this._buffers[0] = smallerBuf.slice(read.length);
|
|
388
|
-
|
|
389
|
-
read.func.call(this, smallerBuf.slice(0, read.length));
|
|
390
|
-
} else {
|
|
391
|
-
// ok this is less than maximum length so use it all
|
|
392
|
-
this._buffered -= smallerBuf.length;
|
|
393
|
-
this._buffers.shift(); // == smallerBuf
|
|
394
|
-
|
|
395
|
-
read.func.call(this, smallerBuf);
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
ChunkStream.prototype._processRead = function (read) {
|
|
400
|
-
this._reads.shift(); // == read
|
|
401
|
-
|
|
402
|
-
let pos = 0;
|
|
403
|
-
let count = 0;
|
|
404
|
-
let data = Buffer.alloc(read.length);
|
|
405
|
-
|
|
406
|
-
// create buffer for all data
|
|
407
|
-
while (pos < read.length) {
|
|
408
|
-
let buf = this._buffers[count++];
|
|
409
|
-
let len = Math.min(buf.length, read.length - pos);
|
|
410
|
-
|
|
411
|
-
buf.copy(data, pos, 0, len);
|
|
412
|
-
pos += len;
|
|
413
|
-
|
|
414
|
-
// last buffer wasn't used all so just slice it and leave
|
|
415
|
-
if (len !== buf.length) {
|
|
416
|
-
this._buffers[--count] = buf.slice(len);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// remove all used buffers
|
|
421
|
-
if (count > 0) {
|
|
422
|
-
this._buffers.splice(0, count);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
this._buffered -= read.length;
|
|
426
|
-
|
|
427
|
-
read.func.call(this, data);
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
ChunkStream.prototype._process = function () {
|
|
431
|
-
try {
|
|
432
|
-
// as long as there is any data and read requests
|
|
433
|
-
while (this._buffered > 0 && this._reads && this._reads.length > 0) {
|
|
434
|
-
let read = this._reads[0];
|
|
435
|
-
|
|
436
|
-
// read any data (but no more than length)
|
|
437
|
-
if (read.allowLess) {
|
|
438
|
-
this._processReadAllowingLess(read);
|
|
439
|
-
} else if (this._buffered >= read.length) {
|
|
440
|
-
// ok we can meet some expectations
|
|
441
|
-
|
|
442
|
-
this._processRead(read);
|
|
443
|
-
} else {
|
|
444
|
-
// not enought data to satisfy first request in queue
|
|
445
|
-
// so we need to wait for more
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (this._buffers && !this.writable) {
|
|
451
|
-
this._end();
|
|
452
|
-
}
|
|
453
|
-
} catch (ex) {
|
|
454
|
-
this.emit("error", ex);
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
// Adam 7
|
|
460
|
-
// 0 1 2 3 4 5 6 7
|
|
461
|
-
// 0 x 6 4 6 x 6 4 6
|
|
462
|
-
// 1 7 7 7 7 7 7 7 7
|
|
463
|
-
// 2 5 6 5 6 5 6 5 6
|
|
464
|
-
// 3 7 7 7 7 7 7 7 7
|
|
465
|
-
// 4 3 6 4 6 3 6 4 6
|
|
466
|
-
// 5 7 7 7 7 7 7 7 7
|
|
467
|
-
// 6 5 6 5 6 5 6 5 6
|
|
468
|
-
// 7 7 7 7 7 7 7 7 7
|
|
469
|
-
|
|
470
|
-
let imagePasses = [
|
|
471
|
-
{
|
|
472
|
-
// pass 1 - 1px
|
|
473
|
-
x: [0],
|
|
474
|
-
y: [0],
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
// pass 2 - 1px
|
|
478
|
-
x: [4],
|
|
479
|
-
y: [0],
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
// pass 3 - 2px
|
|
483
|
-
x: [0, 4],
|
|
484
|
-
y: [4],
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
// pass 4 - 4px
|
|
488
|
-
x: [2, 6],
|
|
489
|
-
y: [0, 4],
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
// pass 5 - 8px
|
|
493
|
-
x: [0, 2, 4, 6],
|
|
494
|
-
y: [2, 6],
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
// pass 6 - 16px
|
|
498
|
-
x: [1, 3, 5, 7],
|
|
499
|
-
y: [0, 2, 4, 6],
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
// pass 7 - 32px
|
|
503
|
-
x: [0, 1, 2, 3, 4, 5, 6, 7],
|
|
504
|
-
y: [1, 3, 5, 7],
|
|
505
|
-
},
|
|
506
|
-
];
|
|
507
|
-
|
|
508
|
-
var getImagePasses = function (width, height) {
|
|
509
|
-
let images = [];
|
|
510
|
-
let xLeftOver = width % 8;
|
|
511
|
-
let yLeftOver = height % 8;
|
|
512
|
-
let xRepeats = (width - xLeftOver) / 8;
|
|
513
|
-
let yRepeats = (height - yLeftOver) / 8;
|
|
514
|
-
for (let i = 0; i < imagePasses.length; i++) {
|
|
515
|
-
let pass = imagePasses[i];
|
|
516
|
-
let passWidth = xRepeats * pass.x.length;
|
|
517
|
-
let passHeight = yRepeats * pass.y.length;
|
|
518
|
-
for (let j = 0; j < pass.x.length; j++) {
|
|
519
|
-
if (pass.x[j] < xLeftOver) {
|
|
520
|
-
passWidth++;
|
|
521
|
-
} else {
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
for (let j = 0; j < pass.y.length; j++) {
|
|
526
|
-
if (pass.y[j] < yLeftOver) {
|
|
527
|
-
passHeight++;
|
|
528
|
-
} else {
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
if (passWidth > 0 && passHeight > 0) {
|
|
533
|
-
images.push({ width: passWidth, height: passHeight, index: i });
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
return images;
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
var getInterlaceIterator = function (width) {
|
|
540
|
-
return function (x, y, pass) {
|
|
541
|
-
let outerXLeftOver = x % imagePasses[pass].x.length;
|
|
542
|
-
let outerX =
|
|
543
|
-
((x - outerXLeftOver) / imagePasses[pass].x.length) * 8 +
|
|
544
|
-
imagePasses[pass].x[outerXLeftOver];
|
|
545
|
-
let outerYLeftOver = y % imagePasses[pass].y.length;
|
|
546
|
-
let outerY =
|
|
547
|
-
((y - outerYLeftOver) / imagePasses[pass].y.length) * 8 +
|
|
548
|
-
imagePasses[pass].y[outerYLeftOver];
|
|
549
|
-
return outerX * 4 + outerY * width * 4;
|
|
550
|
-
};
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
var interlace = {
|
|
554
|
-
getImagePasses: getImagePasses,
|
|
555
|
-
getInterlaceIterator: getInterlaceIterator
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
var paethPredictor = function paethPredictor(left, above, upLeft) {
|
|
559
|
-
let paeth = left + above - upLeft;
|
|
560
|
-
let pLeft = Math.abs(paeth - left);
|
|
561
|
-
let pAbove = Math.abs(paeth - above);
|
|
562
|
-
let pUpLeft = Math.abs(paeth - upLeft);
|
|
563
|
-
|
|
564
|
-
if (pLeft <= pAbove && pLeft <= pUpLeft) {
|
|
565
|
-
return left;
|
|
566
|
-
}
|
|
567
|
-
if (pAbove <= pUpLeft) {
|
|
568
|
-
return above;
|
|
569
|
-
}
|
|
570
|
-
return upLeft;
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
var filterParse = createCommonjsModule(function (module) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
function getByteWidth(width, bpp, depth) {
|
|
579
|
-
let byteWidth = width * bpp;
|
|
580
|
-
if (depth !== 8) {
|
|
581
|
-
byteWidth = Math.ceil(byteWidth / (8 / depth));
|
|
582
|
-
}
|
|
583
|
-
return byteWidth;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
let Filter = (module.exports = function (bitmapInfo, dependencies) {
|
|
587
|
-
let width = bitmapInfo.width;
|
|
588
|
-
let height = bitmapInfo.height;
|
|
589
|
-
let interlace$1 = bitmapInfo.interlace;
|
|
590
|
-
let bpp = bitmapInfo.bpp;
|
|
591
|
-
let depth = bitmapInfo.depth;
|
|
592
|
-
|
|
593
|
-
this.read = dependencies.read;
|
|
594
|
-
this.write = dependencies.write;
|
|
595
|
-
this.complete = dependencies.complete;
|
|
596
|
-
|
|
597
|
-
this._imageIndex = 0;
|
|
598
|
-
this._images = [];
|
|
599
|
-
if (interlace$1) {
|
|
600
|
-
let passes = interlace.getImagePasses(width, height);
|
|
601
|
-
for (let i = 0; i < passes.length; i++) {
|
|
602
|
-
this._images.push({
|
|
603
|
-
byteWidth: getByteWidth(passes[i].width, bpp, depth),
|
|
604
|
-
height: passes[i].height,
|
|
605
|
-
lineIndex: 0,
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
} else {
|
|
609
|
-
this._images.push({
|
|
610
|
-
byteWidth: getByteWidth(width, bpp, depth),
|
|
611
|
-
height: height,
|
|
612
|
-
lineIndex: 0,
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// when filtering the line we look at the pixel to the left
|
|
617
|
-
// the spec also says it is done on a byte level regardless of the number of pixels
|
|
618
|
-
// so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back
|
|
619
|
-
// a pixel rather than just a different byte part. However if we are sub byte, we ignore.
|
|
620
|
-
if (depth === 8) {
|
|
621
|
-
this._xComparison = bpp;
|
|
622
|
-
} else if (depth === 16) {
|
|
623
|
-
this._xComparison = bpp * 2;
|
|
624
|
-
} else {
|
|
625
|
-
this._xComparison = 1;
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
Filter.prototype.start = function () {
|
|
630
|
-
this.read(
|
|
631
|
-
this._images[this._imageIndex].byteWidth + 1,
|
|
632
|
-
this._reverseFilterLine.bind(this)
|
|
633
|
-
);
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
Filter.prototype._unFilterType1 = function (
|
|
637
|
-
rawData,
|
|
638
|
-
unfilteredLine,
|
|
639
|
-
byteWidth
|
|
640
|
-
) {
|
|
641
|
-
let xComparison = this._xComparison;
|
|
642
|
-
let xBiggerThan = xComparison - 1;
|
|
643
|
-
|
|
644
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
645
|
-
let rawByte = rawData[1 + x];
|
|
646
|
-
let f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;
|
|
647
|
-
unfilteredLine[x] = rawByte + f1Left;
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
Filter.prototype._unFilterType2 = function (
|
|
652
|
-
rawData,
|
|
653
|
-
unfilteredLine,
|
|
654
|
-
byteWidth
|
|
655
|
-
) {
|
|
656
|
-
let lastLine = this._lastLine;
|
|
657
|
-
|
|
658
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
659
|
-
let rawByte = rawData[1 + x];
|
|
660
|
-
let f2Up = lastLine ? lastLine[x] : 0;
|
|
661
|
-
unfilteredLine[x] = rawByte + f2Up;
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
Filter.prototype._unFilterType3 = function (
|
|
666
|
-
rawData,
|
|
667
|
-
unfilteredLine,
|
|
668
|
-
byteWidth
|
|
669
|
-
) {
|
|
670
|
-
let xComparison = this._xComparison;
|
|
671
|
-
let xBiggerThan = xComparison - 1;
|
|
672
|
-
let lastLine = this._lastLine;
|
|
673
|
-
|
|
674
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
675
|
-
let rawByte = rawData[1 + x];
|
|
676
|
-
let f3Up = lastLine ? lastLine[x] : 0;
|
|
677
|
-
let f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;
|
|
678
|
-
let f3Add = Math.floor((f3Left + f3Up) / 2);
|
|
679
|
-
unfilteredLine[x] = rawByte + f3Add;
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
Filter.prototype._unFilterType4 = function (
|
|
684
|
-
rawData,
|
|
685
|
-
unfilteredLine,
|
|
686
|
-
byteWidth
|
|
687
|
-
) {
|
|
688
|
-
let xComparison = this._xComparison;
|
|
689
|
-
let xBiggerThan = xComparison - 1;
|
|
690
|
-
let lastLine = this._lastLine;
|
|
691
|
-
|
|
692
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
693
|
-
let rawByte = rawData[1 + x];
|
|
694
|
-
let f4Up = lastLine ? lastLine[x] : 0;
|
|
695
|
-
let f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;
|
|
696
|
-
let f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0;
|
|
697
|
-
let f4Add = paethPredictor(f4Left, f4Up, f4UpLeft);
|
|
698
|
-
unfilteredLine[x] = rawByte + f4Add;
|
|
699
|
-
}
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
Filter.prototype._reverseFilterLine = function (rawData) {
|
|
703
|
-
let filter = rawData[0];
|
|
704
|
-
let unfilteredLine;
|
|
705
|
-
let currentImage = this._images[this._imageIndex];
|
|
706
|
-
let byteWidth = currentImage.byteWidth;
|
|
707
|
-
|
|
708
|
-
if (filter === 0) {
|
|
709
|
-
unfilteredLine = rawData.slice(1, byteWidth + 1);
|
|
710
|
-
} else {
|
|
711
|
-
unfilteredLine = Buffer.alloc(byteWidth);
|
|
712
|
-
|
|
713
|
-
switch (filter) {
|
|
714
|
-
case 1:
|
|
715
|
-
this._unFilterType1(rawData, unfilteredLine, byteWidth);
|
|
716
|
-
break;
|
|
717
|
-
case 2:
|
|
718
|
-
this._unFilterType2(rawData, unfilteredLine, byteWidth);
|
|
719
|
-
break;
|
|
720
|
-
case 3:
|
|
721
|
-
this._unFilterType3(rawData, unfilteredLine, byteWidth);
|
|
722
|
-
break;
|
|
723
|
-
case 4:
|
|
724
|
-
this._unFilterType4(rawData, unfilteredLine, byteWidth);
|
|
725
|
-
break;
|
|
726
|
-
default:
|
|
727
|
-
throw new Error("Unrecognised filter type - " + filter);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
this.write(unfilteredLine);
|
|
732
|
-
|
|
733
|
-
currentImage.lineIndex++;
|
|
734
|
-
if (currentImage.lineIndex >= currentImage.height) {
|
|
735
|
-
this._lastLine = null;
|
|
736
|
-
this._imageIndex++;
|
|
737
|
-
currentImage = this._images[this._imageIndex];
|
|
738
|
-
} else {
|
|
739
|
-
this._lastLine = unfilteredLine;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
if (currentImage) {
|
|
743
|
-
// read, using the byte width that may be from the new current image
|
|
744
|
-
this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this));
|
|
745
|
-
} else {
|
|
746
|
-
this._lastLine = null;
|
|
747
|
-
this.complete();
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
});
|
|
751
|
-
|
|
752
|
-
var filterParseAsync = createCommonjsModule(function (module) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
let FilterAsync = (module.exports = function (bitmapInfo) {
|
|
759
|
-
chunkstream.call(this);
|
|
760
|
-
|
|
761
|
-
let buffers = [];
|
|
762
|
-
let that = this;
|
|
763
|
-
this._filter = new filterParse(bitmapInfo, {
|
|
764
|
-
read: this.read.bind(this),
|
|
765
|
-
write: function (buffer) {
|
|
766
|
-
buffers.push(buffer);
|
|
767
|
-
},
|
|
768
|
-
complete: function () {
|
|
769
|
-
that.emit("complete", Buffer.concat(buffers));
|
|
770
|
-
},
|
|
771
|
-
});
|
|
772
|
-
|
|
773
|
-
this._filter.start();
|
|
774
|
-
});
|
|
775
|
-
util__default['default'].inherits(FilterAsync, chunkstream);
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
var constants = {
|
|
779
|
-
PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a],
|
|
780
|
-
|
|
781
|
-
TYPE_IHDR: 0x49484452,
|
|
782
|
-
TYPE_IEND: 0x49454e44,
|
|
783
|
-
TYPE_IDAT: 0x49444154,
|
|
784
|
-
TYPE_PLTE: 0x504c5445,
|
|
785
|
-
TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase
|
|
786
|
-
TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase
|
|
787
|
-
|
|
788
|
-
// color-type bits
|
|
789
|
-
COLORTYPE_GRAYSCALE: 0,
|
|
790
|
-
COLORTYPE_PALETTE: 1,
|
|
791
|
-
COLORTYPE_COLOR: 2,
|
|
792
|
-
COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha
|
|
793
|
-
|
|
794
|
-
// color-type combinations
|
|
795
|
-
COLORTYPE_PALETTE_COLOR: 3,
|
|
796
|
-
COLORTYPE_COLOR_ALPHA: 6,
|
|
797
|
-
|
|
798
|
-
COLORTYPE_TO_BPP_MAP: {
|
|
799
|
-
0: 1,
|
|
800
|
-
2: 3,
|
|
801
|
-
3: 1,
|
|
802
|
-
4: 2,
|
|
803
|
-
6: 4,
|
|
804
|
-
},
|
|
805
|
-
|
|
806
|
-
GAMMA_DIVISION: 100000,
|
|
807
|
-
};
|
|
808
|
-
|
|
809
|
-
var crc = createCommonjsModule(function (module) {
|
|
810
|
-
|
|
811
|
-
let crcTable = [];
|
|
812
|
-
|
|
813
|
-
(function () {
|
|
814
|
-
for (let i = 0; i < 256; i++) {
|
|
815
|
-
let currentCrc = i;
|
|
816
|
-
for (let j = 0; j < 8; j++) {
|
|
817
|
-
if (currentCrc & 1) {
|
|
818
|
-
currentCrc = 0xedb88320 ^ (currentCrc >>> 1);
|
|
819
|
-
} else {
|
|
820
|
-
currentCrc = currentCrc >>> 1;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
crcTable[i] = currentCrc;
|
|
824
|
-
}
|
|
825
|
-
})();
|
|
826
|
-
|
|
827
|
-
let CrcCalculator = (module.exports = function () {
|
|
828
|
-
this._crc = -1;
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
CrcCalculator.prototype.write = function (data) {
|
|
832
|
-
for (let i = 0; i < data.length; i++) {
|
|
833
|
-
this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8);
|
|
834
|
-
}
|
|
835
|
-
return true;
|
|
836
|
-
};
|
|
837
|
-
|
|
838
|
-
CrcCalculator.prototype.crc32 = function () {
|
|
839
|
-
return this._crc ^ -1;
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
CrcCalculator.crc32 = function (buf) {
|
|
843
|
-
let crc = -1;
|
|
844
|
-
for (let i = 0; i < buf.length; i++) {
|
|
845
|
-
crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);
|
|
846
|
-
}
|
|
847
|
-
return crc ^ -1;
|
|
848
|
-
};
|
|
849
|
-
});
|
|
850
|
-
|
|
851
|
-
var parser = createCommonjsModule(function (module) {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
let Parser = (module.exports = function (options, dependencies) {
|
|
857
|
-
this._options = options;
|
|
858
|
-
options.checkCRC = options.checkCRC !== false;
|
|
859
|
-
|
|
860
|
-
this._hasIHDR = false;
|
|
861
|
-
this._hasIEND = false;
|
|
862
|
-
this._emittedHeadersFinished = false;
|
|
863
|
-
|
|
864
|
-
// input flags/metadata
|
|
865
|
-
this._palette = [];
|
|
866
|
-
this._colorType = 0;
|
|
867
|
-
|
|
868
|
-
this._chunks = {};
|
|
869
|
-
this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this);
|
|
870
|
-
this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this);
|
|
871
|
-
this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this);
|
|
872
|
-
this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this);
|
|
873
|
-
this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this);
|
|
874
|
-
this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this);
|
|
875
|
-
|
|
876
|
-
this.read = dependencies.read;
|
|
877
|
-
this.error = dependencies.error;
|
|
878
|
-
this.metadata = dependencies.metadata;
|
|
879
|
-
this.gamma = dependencies.gamma;
|
|
880
|
-
this.transColor = dependencies.transColor;
|
|
881
|
-
this.palette = dependencies.palette;
|
|
882
|
-
this.parsed = dependencies.parsed;
|
|
883
|
-
this.inflateData = dependencies.inflateData;
|
|
884
|
-
this.finished = dependencies.finished;
|
|
885
|
-
this.simpleTransparency = dependencies.simpleTransparency;
|
|
886
|
-
this.headersFinished = dependencies.headersFinished || function () {};
|
|
887
|
-
});
|
|
888
|
-
|
|
889
|
-
Parser.prototype.start = function () {
|
|
890
|
-
this.read(constants.PNG_SIGNATURE.length, this._parseSignature.bind(this));
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
Parser.prototype._parseSignature = function (data) {
|
|
894
|
-
let signature = constants.PNG_SIGNATURE;
|
|
895
|
-
|
|
896
|
-
for (let i = 0; i < signature.length; i++) {
|
|
897
|
-
if (data[i] !== signature[i]) {
|
|
898
|
-
this.error(new Error("Invalid file signature"));
|
|
899
|
-
return;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
this.read(8, this._parseChunkBegin.bind(this));
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
Parser.prototype._parseChunkBegin = function (data) {
|
|
906
|
-
// chunk content length
|
|
907
|
-
let length = data.readUInt32BE(0);
|
|
908
|
-
|
|
909
|
-
// chunk type
|
|
910
|
-
let type = data.readUInt32BE(4);
|
|
911
|
-
let name = "";
|
|
912
|
-
for (let i = 4; i < 8; i++) {
|
|
913
|
-
name += String.fromCharCode(data[i]);
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
//console.log('chunk ', name, length);
|
|
917
|
-
|
|
918
|
-
// chunk flags
|
|
919
|
-
let ancillary = Boolean(data[4] & 0x20); // or critical
|
|
920
|
-
// priv = Boolean(data[5] & 0x20), // or public
|
|
921
|
-
// safeToCopy = Boolean(data[7] & 0x20); // or unsafe
|
|
922
|
-
|
|
923
|
-
if (!this._hasIHDR && type !== constants.TYPE_IHDR) {
|
|
924
|
-
this.error(new Error("Expected IHDR on beggining"));
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
this._crc = new crc();
|
|
929
|
-
this._crc.write(Buffer.from(name));
|
|
930
|
-
|
|
931
|
-
if (this._chunks[type]) {
|
|
932
|
-
return this._chunks[type](length);
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
if (!ancillary) {
|
|
936
|
-
this.error(new Error("Unsupported critical chunk type " + name));
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
this.read(length + 4, this._skipChunk.bind(this));
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
Parser.prototype._skipChunk = function (/*data*/) {
|
|
944
|
-
this.read(8, this._parseChunkBegin.bind(this));
|
|
945
|
-
};
|
|
946
|
-
|
|
947
|
-
Parser.prototype._handleChunkEnd = function () {
|
|
948
|
-
this.read(4, this._parseChunkEnd.bind(this));
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
Parser.prototype._parseChunkEnd = function (data) {
|
|
952
|
-
let fileCrc = data.readInt32BE(0);
|
|
953
|
-
let calcCrc = this._crc.crc32();
|
|
954
|
-
|
|
955
|
-
// check CRC
|
|
956
|
-
if (this._options.checkCRC && calcCrc !== fileCrc) {
|
|
957
|
-
this.error(new Error("Crc error - " + fileCrc + " - " + calcCrc));
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
if (!this._hasIEND) {
|
|
962
|
-
this.read(8, this._parseChunkBegin.bind(this));
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
Parser.prototype._handleIHDR = function (length) {
|
|
967
|
-
this.read(length, this._parseIHDR.bind(this));
|
|
968
|
-
};
|
|
969
|
-
Parser.prototype._parseIHDR = function (data) {
|
|
970
|
-
this._crc.write(data);
|
|
971
|
-
|
|
972
|
-
let width = data.readUInt32BE(0);
|
|
973
|
-
let height = data.readUInt32BE(4);
|
|
974
|
-
let depth = data[8];
|
|
975
|
-
let colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha
|
|
976
|
-
let compr = data[10];
|
|
977
|
-
let filter = data[11];
|
|
978
|
-
let interlace = data[12];
|
|
979
|
-
|
|
980
|
-
// console.log(' width', width, 'height', height,
|
|
981
|
-
// 'depth', depth, 'colorType', colorType,
|
|
982
|
-
// 'compr', compr, 'filter', filter, 'interlace', interlace
|
|
983
|
-
// );
|
|
984
|
-
|
|
985
|
-
if (
|
|
986
|
-
depth !== 8 &&
|
|
987
|
-
depth !== 4 &&
|
|
988
|
-
depth !== 2 &&
|
|
989
|
-
depth !== 1 &&
|
|
990
|
-
depth !== 16
|
|
991
|
-
) {
|
|
992
|
-
this.error(new Error("Unsupported bit depth " + depth));
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) {
|
|
996
|
-
this.error(new Error("Unsupported color type"));
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
if (compr !== 0) {
|
|
1000
|
-
this.error(new Error("Unsupported compression method"));
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
if (filter !== 0) {
|
|
1004
|
-
this.error(new Error("Unsupported filter method"));
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
if (interlace !== 0 && interlace !== 1) {
|
|
1008
|
-
this.error(new Error("Unsupported interlace method"));
|
|
1009
|
-
return;
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
this._colorType = colorType;
|
|
1013
|
-
|
|
1014
|
-
let bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType];
|
|
1015
|
-
|
|
1016
|
-
this._hasIHDR = true;
|
|
1017
|
-
|
|
1018
|
-
this.metadata({
|
|
1019
|
-
width: width,
|
|
1020
|
-
height: height,
|
|
1021
|
-
depth: depth,
|
|
1022
|
-
interlace: Boolean(interlace),
|
|
1023
|
-
palette: Boolean(colorType & constants.COLORTYPE_PALETTE),
|
|
1024
|
-
color: Boolean(colorType & constants.COLORTYPE_COLOR),
|
|
1025
|
-
alpha: Boolean(colorType & constants.COLORTYPE_ALPHA),
|
|
1026
|
-
bpp: bpp,
|
|
1027
|
-
colorType: colorType,
|
|
1028
|
-
});
|
|
1029
|
-
|
|
1030
|
-
this._handleChunkEnd();
|
|
1031
|
-
};
|
|
1032
|
-
|
|
1033
|
-
Parser.prototype._handlePLTE = function (length) {
|
|
1034
|
-
this.read(length, this._parsePLTE.bind(this));
|
|
1035
|
-
};
|
|
1036
|
-
Parser.prototype._parsePLTE = function (data) {
|
|
1037
|
-
this._crc.write(data);
|
|
1038
|
-
|
|
1039
|
-
let entries = Math.floor(data.length / 3);
|
|
1040
|
-
// console.log('Palette:', entries);
|
|
1041
|
-
|
|
1042
|
-
for (let i = 0; i < entries; i++) {
|
|
1043
|
-
this._palette.push([data[i * 3], data[i * 3 + 1], data[i * 3 + 2], 0xff]);
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
this.palette(this._palette);
|
|
1047
|
-
|
|
1048
|
-
this._handleChunkEnd();
|
|
1049
|
-
};
|
|
1050
|
-
|
|
1051
|
-
Parser.prototype._handleTRNS = function (length) {
|
|
1052
|
-
this.simpleTransparency();
|
|
1053
|
-
this.read(length, this._parseTRNS.bind(this));
|
|
1054
|
-
};
|
|
1055
|
-
Parser.prototype._parseTRNS = function (data) {
|
|
1056
|
-
this._crc.write(data);
|
|
1057
|
-
|
|
1058
|
-
// palette
|
|
1059
|
-
if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) {
|
|
1060
|
-
if (this._palette.length === 0) {
|
|
1061
|
-
this.error(new Error("Transparency chunk must be after palette"));
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
if (data.length > this._palette.length) {
|
|
1065
|
-
this.error(new Error("More transparent colors than palette size"));
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
for (let i = 0; i < data.length; i++) {
|
|
1069
|
-
this._palette[i][3] = data[i];
|
|
1070
|
-
}
|
|
1071
|
-
this.palette(this._palette);
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
// for colorType 0 (grayscale) and 2 (rgb)
|
|
1075
|
-
// there might be one gray/color defined as transparent
|
|
1076
|
-
if (this._colorType === constants.COLORTYPE_GRAYSCALE) {
|
|
1077
|
-
// grey, 2 bytes
|
|
1078
|
-
this.transColor([data.readUInt16BE(0)]);
|
|
1079
|
-
}
|
|
1080
|
-
if (this._colorType === constants.COLORTYPE_COLOR) {
|
|
1081
|
-
this.transColor([
|
|
1082
|
-
data.readUInt16BE(0),
|
|
1083
|
-
data.readUInt16BE(2),
|
|
1084
|
-
data.readUInt16BE(4),
|
|
1085
|
-
]);
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
this._handleChunkEnd();
|
|
1089
|
-
};
|
|
1090
|
-
|
|
1091
|
-
Parser.prototype._handleGAMA = function (length) {
|
|
1092
|
-
this.read(length, this._parseGAMA.bind(this));
|
|
1093
|
-
};
|
|
1094
|
-
Parser.prototype._parseGAMA = function (data) {
|
|
1095
|
-
this._crc.write(data);
|
|
1096
|
-
this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION);
|
|
1097
|
-
|
|
1098
|
-
this._handleChunkEnd();
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
Parser.prototype._handleIDAT = function (length) {
|
|
1102
|
-
if (!this._emittedHeadersFinished) {
|
|
1103
|
-
this._emittedHeadersFinished = true;
|
|
1104
|
-
this.headersFinished();
|
|
1105
|
-
}
|
|
1106
|
-
this.read(-length, this._parseIDAT.bind(this, length));
|
|
1107
|
-
};
|
|
1108
|
-
Parser.prototype._parseIDAT = function (length, data) {
|
|
1109
|
-
this._crc.write(data);
|
|
1110
|
-
|
|
1111
|
-
if (
|
|
1112
|
-
this._colorType === constants.COLORTYPE_PALETTE_COLOR &&
|
|
1113
|
-
this._palette.length === 0
|
|
1114
|
-
) {
|
|
1115
|
-
throw new Error("Expected palette not found");
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
this.inflateData(data);
|
|
1119
|
-
let leftOverLength = length - data.length;
|
|
1120
|
-
|
|
1121
|
-
if (leftOverLength > 0) {
|
|
1122
|
-
this._handleIDAT(leftOverLength);
|
|
1123
|
-
} else {
|
|
1124
|
-
this._handleChunkEnd();
|
|
1125
|
-
}
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
Parser.prototype._handleIEND = function (length) {
|
|
1129
|
-
this.read(length, this._parseIEND.bind(this));
|
|
1130
|
-
};
|
|
1131
|
-
Parser.prototype._parseIEND = function (data) {
|
|
1132
|
-
this._crc.write(data);
|
|
1133
|
-
|
|
1134
|
-
this._hasIEND = true;
|
|
1135
|
-
this._handleChunkEnd();
|
|
1136
|
-
|
|
1137
|
-
if (this.finished) {
|
|
1138
|
-
this.finished();
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
});
|
|
1142
|
-
|
|
1143
|
-
let pixelBppMapper = [
|
|
1144
|
-
// 0 - dummy entry
|
|
1145
|
-
function () {},
|
|
1146
|
-
|
|
1147
|
-
// 1 - L
|
|
1148
|
-
// 0: 0, 1: 0, 2: 0, 3: 0xff
|
|
1149
|
-
function (pxData, data, pxPos, rawPos) {
|
|
1150
|
-
if (rawPos === data.length) {
|
|
1151
|
-
throw new Error("Ran out of data");
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
let pixel = data[rawPos];
|
|
1155
|
-
pxData[pxPos] = pixel;
|
|
1156
|
-
pxData[pxPos + 1] = pixel;
|
|
1157
|
-
pxData[pxPos + 2] = pixel;
|
|
1158
|
-
pxData[pxPos + 3] = 0xff;
|
|
1159
|
-
},
|
|
1160
|
-
|
|
1161
|
-
// 2 - LA
|
|
1162
|
-
// 0: 0, 1: 0, 2: 0, 3: 1
|
|
1163
|
-
function (pxData, data, pxPos, rawPos) {
|
|
1164
|
-
if (rawPos + 1 >= data.length) {
|
|
1165
|
-
throw new Error("Ran out of data");
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
let pixel = data[rawPos];
|
|
1169
|
-
pxData[pxPos] = pixel;
|
|
1170
|
-
pxData[pxPos + 1] = pixel;
|
|
1171
|
-
pxData[pxPos + 2] = pixel;
|
|
1172
|
-
pxData[pxPos + 3] = data[rawPos + 1];
|
|
1173
|
-
},
|
|
1174
|
-
|
|
1175
|
-
// 3 - RGB
|
|
1176
|
-
// 0: 0, 1: 1, 2: 2, 3: 0xff
|
|
1177
|
-
function (pxData, data, pxPos, rawPos) {
|
|
1178
|
-
if (rawPos + 2 >= data.length) {
|
|
1179
|
-
throw new Error("Ran out of data");
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
pxData[pxPos] = data[rawPos];
|
|
1183
|
-
pxData[pxPos + 1] = data[rawPos + 1];
|
|
1184
|
-
pxData[pxPos + 2] = data[rawPos + 2];
|
|
1185
|
-
pxData[pxPos + 3] = 0xff;
|
|
1186
|
-
},
|
|
1187
|
-
|
|
1188
|
-
// 4 - RGBA
|
|
1189
|
-
// 0: 0, 1: 1, 2: 2, 3: 3
|
|
1190
|
-
function (pxData, data, pxPos, rawPos) {
|
|
1191
|
-
if (rawPos + 3 >= data.length) {
|
|
1192
|
-
throw new Error("Ran out of data");
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
pxData[pxPos] = data[rawPos];
|
|
1196
|
-
pxData[pxPos + 1] = data[rawPos + 1];
|
|
1197
|
-
pxData[pxPos + 2] = data[rawPos + 2];
|
|
1198
|
-
pxData[pxPos + 3] = data[rawPos + 3];
|
|
1199
|
-
},
|
|
1200
|
-
];
|
|
1201
|
-
|
|
1202
|
-
let pixelBppCustomMapper = [
|
|
1203
|
-
// 0 - dummy entry
|
|
1204
|
-
function () {},
|
|
1205
|
-
|
|
1206
|
-
// 1 - L
|
|
1207
|
-
// 0: 0, 1: 0, 2: 0, 3: 0xff
|
|
1208
|
-
function (pxData, pixelData, pxPos, maxBit) {
|
|
1209
|
-
let pixel = pixelData[0];
|
|
1210
|
-
pxData[pxPos] = pixel;
|
|
1211
|
-
pxData[pxPos + 1] = pixel;
|
|
1212
|
-
pxData[pxPos + 2] = pixel;
|
|
1213
|
-
pxData[pxPos + 3] = maxBit;
|
|
1214
|
-
},
|
|
1215
|
-
|
|
1216
|
-
// 2 - LA
|
|
1217
|
-
// 0: 0, 1: 0, 2: 0, 3: 1
|
|
1218
|
-
function (pxData, pixelData, pxPos) {
|
|
1219
|
-
let pixel = pixelData[0];
|
|
1220
|
-
pxData[pxPos] = pixel;
|
|
1221
|
-
pxData[pxPos + 1] = pixel;
|
|
1222
|
-
pxData[pxPos + 2] = pixel;
|
|
1223
|
-
pxData[pxPos + 3] = pixelData[1];
|
|
1224
|
-
},
|
|
1225
|
-
|
|
1226
|
-
// 3 - RGB
|
|
1227
|
-
// 0: 0, 1: 1, 2: 2, 3: 0xff
|
|
1228
|
-
function (pxData, pixelData, pxPos, maxBit) {
|
|
1229
|
-
pxData[pxPos] = pixelData[0];
|
|
1230
|
-
pxData[pxPos + 1] = pixelData[1];
|
|
1231
|
-
pxData[pxPos + 2] = pixelData[2];
|
|
1232
|
-
pxData[pxPos + 3] = maxBit;
|
|
1233
|
-
},
|
|
1234
|
-
|
|
1235
|
-
// 4 - RGBA
|
|
1236
|
-
// 0: 0, 1: 1, 2: 2, 3: 3
|
|
1237
|
-
function (pxData, pixelData, pxPos) {
|
|
1238
|
-
pxData[pxPos] = pixelData[0];
|
|
1239
|
-
pxData[pxPos + 1] = pixelData[1];
|
|
1240
|
-
pxData[pxPos + 2] = pixelData[2];
|
|
1241
|
-
pxData[pxPos + 3] = pixelData[3];
|
|
1242
|
-
},
|
|
1243
|
-
];
|
|
1244
|
-
|
|
1245
|
-
function bitRetriever(data, depth) {
|
|
1246
|
-
let leftOver = [];
|
|
1247
|
-
let i = 0;
|
|
1248
|
-
|
|
1249
|
-
function split() {
|
|
1250
|
-
if (i === data.length) {
|
|
1251
|
-
throw new Error("Ran out of data");
|
|
1252
|
-
}
|
|
1253
|
-
let byte = data[i];
|
|
1254
|
-
i++;
|
|
1255
|
-
let byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1;
|
|
1256
|
-
switch (depth) {
|
|
1257
|
-
default:
|
|
1258
|
-
throw new Error("unrecognised depth");
|
|
1259
|
-
case 16:
|
|
1260
|
-
byte2 = data[i];
|
|
1261
|
-
i++;
|
|
1262
|
-
leftOver.push((byte << 8) + byte2);
|
|
1263
|
-
break;
|
|
1264
|
-
case 4:
|
|
1265
|
-
byte2 = byte & 0x0f;
|
|
1266
|
-
byte1 = byte >> 4;
|
|
1267
|
-
leftOver.push(byte1, byte2);
|
|
1268
|
-
break;
|
|
1269
|
-
case 2:
|
|
1270
|
-
byte4 = byte & 3;
|
|
1271
|
-
byte3 = (byte >> 2) & 3;
|
|
1272
|
-
byte2 = (byte >> 4) & 3;
|
|
1273
|
-
byte1 = (byte >> 6) & 3;
|
|
1274
|
-
leftOver.push(byte1, byte2, byte3, byte4);
|
|
1275
|
-
break;
|
|
1276
|
-
case 1:
|
|
1277
|
-
byte8 = byte & 1;
|
|
1278
|
-
byte7 = (byte >> 1) & 1;
|
|
1279
|
-
byte6 = (byte >> 2) & 1;
|
|
1280
|
-
byte5 = (byte >> 3) & 1;
|
|
1281
|
-
byte4 = (byte >> 4) & 1;
|
|
1282
|
-
byte3 = (byte >> 5) & 1;
|
|
1283
|
-
byte2 = (byte >> 6) & 1;
|
|
1284
|
-
byte1 = (byte >> 7) & 1;
|
|
1285
|
-
leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8);
|
|
1286
|
-
break;
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
return {
|
|
1291
|
-
get: function (count) {
|
|
1292
|
-
while (leftOver.length < count) {
|
|
1293
|
-
split();
|
|
1294
|
-
}
|
|
1295
|
-
let returner = leftOver.slice(0, count);
|
|
1296
|
-
leftOver = leftOver.slice(count);
|
|
1297
|
-
return returner;
|
|
1298
|
-
},
|
|
1299
|
-
resetAfterLine: function () {
|
|
1300
|
-
leftOver.length = 0;
|
|
1301
|
-
},
|
|
1302
|
-
end: function () {
|
|
1303
|
-
if (i !== data.length) {
|
|
1304
|
-
throw new Error("extra data found");
|
|
1305
|
-
}
|
|
1306
|
-
},
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) {
|
|
1311
|
-
// eslint-disable-line max-params
|
|
1312
|
-
let imageWidth = image.width;
|
|
1313
|
-
let imageHeight = image.height;
|
|
1314
|
-
let imagePass = image.index;
|
|
1315
|
-
for (let y = 0; y < imageHeight; y++) {
|
|
1316
|
-
for (let x = 0; x < imageWidth; x++) {
|
|
1317
|
-
let pxPos = getPxPos(x, y, imagePass);
|
|
1318
|
-
pixelBppMapper[bpp](pxData, data, pxPos, rawPos);
|
|
1319
|
-
rawPos += bpp; //eslint-disable-line no-param-reassign
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
return rawPos;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) {
|
|
1326
|
-
// eslint-disable-line max-params
|
|
1327
|
-
let imageWidth = image.width;
|
|
1328
|
-
let imageHeight = image.height;
|
|
1329
|
-
let imagePass = image.index;
|
|
1330
|
-
for (let y = 0; y < imageHeight; y++) {
|
|
1331
|
-
for (let x = 0; x < imageWidth; x++) {
|
|
1332
|
-
let pixelData = bits.get(bpp);
|
|
1333
|
-
let pxPos = getPxPos(x, y, imagePass);
|
|
1334
|
-
pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit);
|
|
1335
|
-
}
|
|
1336
|
-
bits.resetAfterLine();
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
var dataToBitMap = function (data, bitmapInfo) {
|
|
1341
|
-
let width = bitmapInfo.width;
|
|
1342
|
-
let height = bitmapInfo.height;
|
|
1343
|
-
let depth = bitmapInfo.depth;
|
|
1344
|
-
let bpp = bitmapInfo.bpp;
|
|
1345
|
-
let interlace$1 = bitmapInfo.interlace;
|
|
1346
|
-
let bits;
|
|
1347
|
-
|
|
1348
|
-
if (depth !== 8) {
|
|
1349
|
-
bits = bitRetriever(data, depth);
|
|
1350
|
-
}
|
|
1351
|
-
let pxData;
|
|
1352
|
-
if (depth <= 8) {
|
|
1353
|
-
pxData = Buffer.alloc(width * height * 4);
|
|
1354
|
-
} else {
|
|
1355
|
-
pxData = new Uint16Array(width * height * 4);
|
|
1356
|
-
}
|
|
1357
|
-
let maxBit = Math.pow(2, depth) - 1;
|
|
1358
|
-
let rawPos = 0;
|
|
1359
|
-
let images;
|
|
1360
|
-
let getPxPos;
|
|
1361
|
-
|
|
1362
|
-
if (interlace$1) {
|
|
1363
|
-
images = interlace.getImagePasses(width, height);
|
|
1364
|
-
getPxPos = interlace.getInterlaceIterator(width, height);
|
|
1365
|
-
} else {
|
|
1366
|
-
let nonInterlacedPxPos = 0;
|
|
1367
|
-
getPxPos = function () {
|
|
1368
|
-
let returner = nonInterlacedPxPos;
|
|
1369
|
-
nonInterlacedPxPos += 4;
|
|
1370
|
-
return returner;
|
|
1371
|
-
};
|
|
1372
|
-
images = [{ width: width, height: height }];
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
for (let imageIndex = 0; imageIndex < images.length; imageIndex++) {
|
|
1376
|
-
if (depth === 8) {
|
|
1377
|
-
rawPos = mapImage8Bit(
|
|
1378
|
-
images[imageIndex],
|
|
1379
|
-
pxData,
|
|
1380
|
-
getPxPos,
|
|
1381
|
-
bpp,
|
|
1382
|
-
data,
|
|
1383
|
-
rawPos
|
|
1384
|
-
);
|
|
1385
|
-
} else {
|
|
1386
|
-
mapImageCustomBit(
|
|
1387
|
-
images[imageIndex],
|
|
1388
|
-
pxData,
|
|
1389
|
-
getPxPos,
|
|
1390
|
-
bpp,
|
|
1391
|
-
bits,
|
|
1392
|
-
maxBit
|
|
1393
|
-
);
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
if (depth === 8) {
|
|
1397
|
-
if (rawPos !== data.length) {
|
|
1398
|
-
throw new Error("extra data found");
|
|
1399
|
-
}
|
|
1400
|
-
} else {
|
|
1401
|
-
bits.end();
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
return pxData;
|
|
1405
|
-
};
|
|
1406
|
-
|
|
1407
|
-
var bitmapper = {
|
|
1408
|
-
dataToBitMap: dataToBitMap
|
|
1409
|
-
};
|
|
1410
|
-
|
|
1411
|
-
function dePalette(indata, outdata, width, height, palette) {
|
|
1412
|
-
let pxPos = 0;
|
|
1413
|
-
// use values from palette
|
|
1414
|
-
for (let y = 0; y < height; y++) {
|
|
1415
|
-
for (let x = 0; x < width; x++) {
|
|
1416
|
-
let color = palette[indata[pxPos]];
|
|
1417
|
-
|
|
1418
|
-
if (!color) {
|
|
1419
|
-
throw new Error("index " + indata[pxPos] + " not in palette");
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
for (let i = 0; i < 4; i++) {
|
|
1423
|
-
outdata[pxPos + i] = color[i];
|
|
1424
|
-
}
|
|
1425
|
-
pxPos += 4;
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
function replaceTransparentColor(indata, outdata, width, height, transColor) {
|
|
1431
|
-
let pxPos = 0;
|
|
1432
|
-
for (let y = 0; y < height; y++) {
|
|
1433
|
-
for (let x = 0; x < width; x++) {
|
|
1434
|
-
let makeTrans = false;
|
|
1435
|
-
|
|
1436
|
-
if (transColor.length === 1) {
|
|
1437
|
-
if (transColor[0] === indata[pxPos]) {
|
|
1438
|
-
makeTrans = true;
|
|
1439
|
-
}
|
|
1440
|
-
} else if (
|
|
1441
|
-
transColor[0] === indata[pxPos] &&
|
|
1442
|
-
transColor[1] === indata[pxPos + 1] &&
|
|
1443
|
-
transColor[2] === indata[pxPos + 2]
|
|
1444
|
-
) {
|
|
1445
|
-
makeTrans = true;
|
|
1446
|
-
}
|
|
1447
|
-
if (makeTrans) {
|
|
1448
|
-
for (let i = 0; i < 4; i++) {
|
|
1449
|
-
outdata[pxPos + i] = 0;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
pxPos += 4;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
function scaleDepth(indata, outdata, width, height, depth) {
|
|
1458
|
-
let maxOutSample = 255;
|
|
1459
|
-
let maxInSample = Math.pow(2, depth) - 1;
|
|
1460
|
-
let pxPos = 0;
|
|
1461
|
-
|
|
1462
|
-
for (let y = 0; y < height; y++) {
|
|
1463
|
-
for (let x = 0; x < width; x++) {
|
|
1464
|
-
for (let i = 0; i < 4; i++) {
|
|
1465
|
-
outdata[pxPos + i] = Math.floor(
|
|
1466
|
-
(indata[pxPos + i] * maxOutSample) / maxInSample + 0.5
|
|
1467
|
-
);
|
|
1468
|
-
}
|
|
1469
|
-
pxPos += 4;
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
var formatNormaliser = function (indata, imageData, skipRescale = false) {
|
|
1475
|
-
let depth = imageData.depth;
|
|
1476
|
-
let width = imageData.width;
|
|
1477
|
-
let height = imageData.height;
|
|
1478
|
-
let colorType = imageData.colorType;
|
|
1479
|
-
let transColor = imageData.transColor;
|
|
1480
|
-
let palette = imageData.palette;
|
|
1481
|
-
|
|
1482
|
-
let outdata = indata; // only different for 16 bits
|
|
1483
|
-
|
|
1484
|
-
if (colorType === 3) {
|
|
1485
|
-
// paletted
|
|
1486
|
-
dePalette(indata, outdata, width, height, palette);
|
|
1487
|
-
} else {
|
|
1488
|
-
if (transColor) {
|
|
1489
|
-
replaceTransparentColor(indata, outdata, width, height, transColor);
|
|
1490
|
-
}
|
|
1491
|
-
// if it needs scaling
|
|
1492
|
-
if (depth !== 8 && !skipRescale) {
|
|
1493
|
-
// if we need to change the buffer size
|
|
1494
|
-
if (depth === 16) {
|
|
1495
|
-
outdata = Buffer.alloc(width * height * 4);
|
|
1496
|
-
}
|
|
1497
|
-
scaleDepth(indata, outdata, width, height, depth);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
return outdata;
|
|
1501
|
-
};
|
|
1502
|
-
|
|
1503
|
-
var parserAsync = createCommonjsModule(function (module) {
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
let ParserAsync = (module.exports = function (options) {
|
|
1514
|
-
chunkstream.call(this);
|
|
1515
|
-
|
|
1516
|
-
this._parser = new parser(options, {
|
|
1517
|
-
read: this.read.bind(this),
|
|
1518
|
-
error: this._handleError.bind(this),
|
|
1519
|
-
metadata: this._handleMetaData.bind(this),
|
|
1520
|
-
gamma: this.emit.bind(this, "gamma"),
|
|
1521
|
-
palette: this._handlePalette.bind(this),
|
|
1522
|
-
transColor: this._handleTransColor.bind(this),
|
|
1523
|
-
finished: this._finished.bind(this),
|
|
1524
|
-
inflateData: this._inflateData.bind(this),
|
|
1525
|
-
simpleTransparency: this._simpleTransparency.bind(this),
|
|
1526
|
-
headersFinished: this._headersFinished.bind(this),
|
|
1527
|
-
});
|
|
1528
|
-
this._options = options;
|
|
1529
|
-
this.writable = true;
|
|
1530
|
-
|
|
1531
|
-
this._parser.start();
|
|
1532
|
-
});
|
|
1533
|
-
util__default['default'].inherits(ParserAsync, chunkstream);
|
|
1534
|
-
|
|
1535
|
-
ParserAsync.prototype._handleError = function (err) {
|
|
1536
|
-
this.emit("error", err);
|
|
1537
|
-
|
|
1538
|
-
this.writable = false;
|
|
1539
|
-
|
|
1540
|
-
this.destroy();
|
|
1541
|
-
|
|
1542
|
-
if (this._inflate && this._inflate.destroy) {
|
|
1543
|
-
this._inflate.destroy();
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
if (this._filter) {
|
|
1547
|
-
this._filter.destroy();
|
|
1548
|
-
// For backward compatibility with Node 7 and below.
|
|
1549
|
-
// Suppress errors due to _inflate calling write() even after
|
|
1550
|
-
// it's destroy()'ed.
|
|
1551
|
-
this._filter.on("error", function () {});
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
this.errord = true;
|
|
1555
|
-
};
|
|
1556
|
-
|
|
1557
|
-
ParserAsync.prototype._inflateData = function (data) {
|
|
1558
|
-
if (!this._inflate) {
|
|
1559
|
-
if (this._bitmapInfo.interlace) {
|
|
1560
|
-
this._inflate = zlib__default['default'].createInflate();
|
|
1561
|
-
|
|
1562
|
-
this._inflate.on("error", this.emit.bind(this, "error"));
|
|
1563
|
-
this._filter.on("complete", this._complete.bind(this));
|
|
1564
|
-
|
|
1565
|
-
this._inflate.pipe(this._filter);
|
|
1566
|
-
} else {
|
|
1567
|
-
let rowSize =
|
|
1568
|
-
((this._bitmapInfo.width *
|
|
1569
|
-
this._bitmapInfo.bpp *
|
|
1570
|
-
this._bitmapInfo.depth +
|
|
1571
|
-
7) >>
|
|
1572
|
-
3) +
|
|
1573
|
-
1;
|
|
1574
|
-
let imageSize = rowSize * this._bitmapInfo.height;
|
|
1575
|
-
let chunkSize = Math.max(imageSize, zlib__default['default'].Z_MIN_CHUNK);
|
|
1576
|
-
|
|
1577
|
-
this._inflate = zlib__default['default'].createInflate({ chunkSize: chunkSize });
|
|
1578
|
-
let leftToInflate = imageSize;
|
|
1579
|
-
|
|
1580
|
-
let emitError = this.emit.bind(this, "error");
|
|
1581
|
-
this._inflate.on("error", function (err) {
|
|
1582
|
-
if (!leftToInflate) {
|
|
1583
|
-
return;
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
emitError(err);
|
|
1587
|
-
});
|
|
1588
|
-
this._filter.on("complete", this._complete.bind(this));
|
|
1589
|
-
|
|
1590
|
-
let filterWrite = this._filter.write.bind(this._filter);
|
|
1591
|
-
this._inflate.on("data", function (chunk) {
|
|
1592
|
-
if (!leftToInflate) {
|
|
1593
|
-
return;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
if (chunk.length > leftToInflate) {
|
|
1597
|
-
chunk = chunk.slice(0, leftToInflate);
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
leftToInflate -= chunk.length;
|
|
1601
|
-
|
|
1602
|
-
filterWrite(chunk);
|
|
1603
|
-
});
|
|
1604
|
-
|
|
1605
|
-
this._inflate.on("end", this._filter.end.bind(this._filter));
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
this._inflate.write(data);
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
|
-
ParserAsync.prototype._handleMetaData = function (metaData) {
|
|
1612
|
-
this._metaData = metaData;
|
|
1613
|
-
this._bitmapInfo = Object.create(metaData);
|
|
1614
|
-
|
|
1615
|
-
this._filter = new filterParseAsync(this._bitmapInfo);
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
ParserAsync.prototype._handleTransColor = function (transColor) {
|
|
1619
|
-
this._bitmapInfo.transColor = transColor;
|
|
1620
|
-
};
|
|
1621
|
-
|
|
1622
|
-
ParserAsync.prototype._handlePalette = function (palette) {
|
|
1623
|
-
this._bitmapInfo.palette = palette;
|
|
1624
|
-
};
|
|
1625
|
-
|
|
1626
|
-
ParserAsync.prototype._simpleTransparency = function () {
|
|
1627
|
-
this._metaData.alpha = true;
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
ParserAsync.prototype._headersFinished = function () {
|
|
1631
|
-
// Up until this point, we don't know if we have a tRNS chunk (alpha)
|
|
1632
|
-
// so we can't emit metadata any earlier
|
|
1633
|
-
this.emit("metadata", this._metaData);
|
|
1634
|
-
};
|
|
1635
|
-
|
|
1636
|
-
ParserAsync.prototype._finished = function () {
|
|
1637
|
-
if (this.errord) {
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
if (!this._inflate) {
|
|
1642
|
-
this.emit("error", "No Inflate block");
|
|
1643
|
-
} else {
|
|
1644
|
-
// no more data to inflate
|
|
1645
|
-
this._inflate.end();
|
|
1646
|
-
}
|
|
1647
|
-
};
|
|
1648
|
-
|
|
1649
|
-
ParserAsync.prototype._complete = function (filteredData) {
|
|
1650
|
-
if (this.errord) {
|
|
1651
|
-
return;
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
let normalisedBitmapData;
|
|
1655
|
-
|
|
1656
|
-
try {
|
|
1657
|
-
let bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo);
|
|
1658
|
-
|
|
1659
|
-
normalisedBitmapData = formatNormaliser(
|
|
1660
|
-
bitmapData,
|
|
1661
|
-
this._bitmapInfo,
|
|
1662
|
-
this._options.skipRescale
|
|
1663
|
-
);
|
|
1664
|
-
bitmapData = null;
|
|
1665
|
-
} catch (ex) {
|
|
1666
|
-
this._handleError(ex);
|
|
1667
|
-
return;
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
this.emit("parsed", normalisedBitmapData);
|
|
1671
|
-
};
|
|
1672
|
-
});
|
|
1673
|
-
|
|
1674
|
-
var bitpacker = function (dataIn, width, height, options) {
|
|
1675
|
-
let outHasAlpha =
|
|
1676
|
-
[constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(
|
|
1677
|
-
options.colorType
|
|
1678
|
-
) !== -1;
|
|
1679
|
-
if (options.colorType === options.inputColorType) {
|
|
1680
|
-
let bigEndian = (function () {
|
|
1681
|
-
let buffer = new ArrayBuffer(2);
|
|
1682
|
-
new DataView(buffer).setInt16(0, 256, true /* littleEndian */);
|
|
1683
|
-
// Int16Array uses the platform's endianness.
|
|
1684
|
-
return new Int16Array(buffer)[0] !== 256;
|
|
1685
|
-
})();
|
|
1686
|
-
// If no need to convert to grayscale and alpha is present/absent in both, take a fast route
|
|
1687
|
-
if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) {
|
|
1688
|
-
return dataIn;
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
// map to a UInt16 array if data is 16bit, fix endianness below
|
|
1693
|
-
let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer);
|
|
1694
|
-
|
|
1695
|
-
let maxValue = 255;
|
|
1696
|
-
let inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];
|
|
1697
|
-
if (inBpp === 4 && !options.inputHasAlpha) {
|
|
1698
|
-
inBpp = 3;
|
|
1699
|
-
}
|
|
1700
|
-
let outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];
|
|
1701
|
-
if (options.bitDepth === 16) {
|
|
1702
|
-
maxValue = 65535;
|
|
1703
|
-
outBpp *= 2;
|
|
1704
|
-
}
|
|
1705
|
-
let outData = Buffer.alloc(width * height * outBpp);
|
|
1706
|
-
|
|
1707
|
-
let inIndex = 0;
|
|
1708
|
-
let outIndex = 0;
|
|
1709
|
-
|
|
1710
|
-
let bgColor = options.bgColor || {};
|
|
1711
|
-
if (bgColor.red === undefined) {
|
|
1712
|
-
bgColor.red = maxValue;
|
|
1713
|
-
}
|
|
1714
|
-
if (bgColor.green === undefined) {
|
|
1715
|
-
bgColor.green = maxValue;
|
|
1716
|
-
}
|
|
1717
|
-
if (bgColor.blue === undefined) {
|
|
1718
|
-
bgColor.blue = maxValue;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
function getRGBA() {
|
|
1722
|
-
let red;
|
|
1723
|
-
let green;
|
|
1724
|
-
let blue;
|
|
1725
|
-
let alpha = maxValue;
|
|
1726
|
-
switch (options.inputColorType) {
|
|
1727
|
-
case constants.COLORTYPE_COLOR_ALPHA:
|
|
1728
|
-
alpha = data[inIndex + 3];
|
|
1729
|
-
red = data[inIndex];
|
|
1730
|
-
green = data[inIndex + 1];
|
|
1731
|
-
blue = data[inIndex + 2];
|
|
1732
|
-
break;
|
|
1733
|
-
case constants.COLORTYPE_COLOR:
|
|
1734
|
-
red = data[inIndex];
|
|
1735
|
-
green = data[inIndex + 1];
|
|
1736
|
-
blue = data[inIndex + 2];
|
|
1737
|
-
break;
|
|
1738
|
-
case constants.COLORTYPE_ALPHA:
|
|
1739
|
-
alpha = data[inIndex + 1];
|
|
1740
|
-
red = data[inIndex];
|
|
1741
|
-
green = red;
|
|
1742
|
-
blue = red;
|
|
1743
|
-
break;
|
|
1744
|
-
case constants.COLORTYPE_GRAYSCALE:
|
|
1745
|
-
red = data[inIndex];
|
|
1746
|
-
green = red;
|
|
1747
|
-
blue = red;
|
|
1748
|
-
break;
|
|
1749
|
-
default:
|
|
1750
|
-
throw new Error(
|
|
1751
|
-
"input color type:" +
|
|
1752
|
-
options.inputColorType +
|
|
1753
|
-
" is not supported at present"
|
|
1754
|
-
);
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
if (options.inputHasAlpha) {
|
|
1758
|
-
if (!outHasAlpha) {
|
|
1759
|
-
alpha /= maxValue;
|
|
1760
|
-
red = Math.min(
|
|
1761
|
-
Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0),
|
|
1762
|
-
maxValue
|
|
1763
|
-
);
|
|
1764
|
-
green = Math.min(
|
|
1765
|
-
Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0),
|
|
1766
|
-
maxValue
|
|
1767
|
-
);
|
|
1768
|
-
blue = Math.min(
|
|
1769
|
-
Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0),
|
|
1770
|
-
maxValue
|
|
1771
|
-
);
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
return { red: red, green: green, blue: blue, alpha: alpha };
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
for (let y = 0; y < height; y++) {
|
|
1778
|
-
for (let x = 0; x < width; x++) {
|
|
1779
|
-
let rgba = getRGBA();
|
|
1780
|
-
|
|
1781
|
-
switch (options.colorType) {
|
|
1782
|
-
case constants.COLORTYPE_COLOR_ALPHA:
|
|
1783
|
-
case constants.COLORTYPE_COLOR:
|
|
1784
|
-
if (options.bitDepth === 8) {
|
|
1785
|
-
outData[outIndex] = rgba.red;
|
|
1786
|
-
outData[outIndex + 1] = rgba.green;
|
|
1787
|
-
outData[outIndex + 2] = rgba.blue;
|
|
1788
|
-
if (outHasAlpha) {
|
|
1789
|
-
outData[outIndex + 3] = rgba.alpha;
|
|
1790
|
-
}
|
|
1791
|
-
} else {
|
|
1792
|
-
outData.writeUInt16BE(rgba.red, outIndex);
|
|
1793
|
-
outData.writeUInt16BE(rgba.green, outIndex + 2);
|
|
1794
|
-
outData.writeUInt16BE(rgba.blue, outIndex + 4);
|
|
1795
|
-
if (outHasAlpha) {
|
|
1796
|
-
outData.writeUInt16BE(rgba.alpha, outIndex + 6);
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
break;
|
|
1800
|
-
case constants.COLORTYPE_ALPHA:
|
|
1801
|
-
case constants.COLORTYPE_GRAYSCALE: {
|
|
1802
|
-
// Convert to grayscale and alpha
|
|
1803
|
-
let grayscale = (rgba.red + rgba.green + rgba.blue) / 3;
|
|
1804
|
-
if (options.bitDepth === 8) {
|
|
1805
|
-
outData[outIndex] = grayscale;
|
|
1806
|
-
if (outHasAlpha) {
|
|
1807
|
-
outData[outIndex + 1] = rgba.alpha;
|
|
1808
|
-
}
|
|
1809
|
-
} else {
|
|
1810
|
-
outData.writeUInt16BE(grayscale, outIndex);
|
|
1811
|
-
if (outHasAlpha) {
|
|
1812
|
-
outData.writeUInt16BE(rgba.alpha, outIndex + 2);
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
break;
|
|
1816
|
-
}
|
|
1817
|
-
default:
|
|
1818
|
-
throw new Error("unrecognised color Type " + options.colorType);
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
inIndex += inBpp;
|
|
1822
|
-
outIndex += outBpp;
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
return outData;
|
|
1827
|
-
};
|
|
1828
|
-
|
|
1829
|
-
function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {
|
|
1830
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1831
|
-
rawData[rawPos + x] = pxData[pxPos + x];
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
function filterSumNone(pxData, pxPos, byteWidth) {
|
|
1836
|
-
let sum = 0;
|
|
1837
|
-
let length = pxPos + byteWidth;
|
|
1838
|
-
|
|
1839
|
-
for (let i = pxPos; i < length; i++) {
|
|
1840
|
-
sum += Math.abs(pxData[i]);
|
|
1841
|
-
}
|
|
1842
|
-
return sum;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
1846
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1847
|
-
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
1848
|
-
let val = pxData[pxPos + x] - left;
|
|
1849
|
-
|
|
1850
|
-
rawData[rawPos + x] = val;
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
function filterSumSub(pxData, pxPos, byteWidth, bpp) {
|
|
1855
|
-
let sum = 0;
|
|
1856
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1857
|
-
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
1858
|
-
let val = pxData[pxPos + x] - left;
|
|
1859
|
-
|
|
1860
|
-
sum += Math.abs(val);
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
return sum;
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) {
|
|
1867
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1868
|
-
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
1869
|
-
let val = pxData[pxPos + x] - up;
|
|
1870
|
-
|
|
1871
|
-
rawData[rawPos + x] = val;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
function filterSumUp(pxData, pxPos, byteWidth) {
|
|
1876
|
-
let sum = 0;
|
|
1877
|
-
let length = pxPos + byteWidth;
|
|
1878
|
-
for (let x = pxPos; x < length; x++) {
|
|
1879
|
-
let up = pxPos > 0 ? pxData[x - byteWidth] : 0;
|
|
1880
|
-
let val = pxData[x] - up;
|
|
1881
|
-
|
|
1882
|
-
sum += Math.abs(val);
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
return sum;
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
1889
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1890
|
-
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
1891
|
-
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
1892
|
-
let val = pxData[pxPos + x] - ((left + up) >> 1);
|
|
1893
|
-
|
|
1894
|
-
rawData[rawPos + x] = val;
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
function filterSumAvg(pxData, pxPos, byteWidth, bpp) {
|
|
1899
|
-
let sum = 0;
|
|
1900
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1901
|
-
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
1902
|
-
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
1903
|
-
let val = pxData[pxPos + x] - ((left + up) >> 1);
|
|
1904
|
-
|
|
1905
|
-
sum += Math.abs(val);
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
return sum;
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
|
-
function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
1912
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1913
|
-
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
1914
|
-
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
1915
|
-
let upleft =
|
|
1916
|
-
pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;
|
|
1917
|
-
let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);
|
|
1918
|
-
|
|
1919
|
-
rawData[rawPos + x] = val;
|
|
1920
|
-
}
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
function filterSumPaeth(pxData, pxPos, byteWidth, bpp) {
|
|
1924
|
-
let sum = 0;
|
|
1925
|
-
for (let x = 0; x < byteWidth; x++) {
|
|
1926
|
-
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
1927
|
-
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
1928
|
-
let upleft =
|
|
1929
|
-
pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;
|
|
1930
|
-
let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);
|
|
1931
|
-
|
|
1932
|
-
sum += Math.abs(val);
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
return sum;
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
let filters = {
|
|
1939
|
-
0: filterNone,
|
|
1940
|
-
1: filterSub,
|
|
1941
|
-
2: filterUp,
|
|
1942
|
-
3: filterAvg,
|
|
1943
|
-
4: filterPaeth,
|
|
1944
|
-
};
|
|
1945
|
-
|
|
1946
|
-
let filterSums = {
|
|
1947
|
-
0: filterSumNone,
|
|
1948
|
-
1: filterSumSub,
|
|
1949
|
-
2: filterSumUp,
|
|
1950
|
-
3: filterSumAvg,
|
|
1951
|
-
4: filterSumPaeth,
|
|
1952
|
-
};
|
|
1953
|
-
|
|
1954
|
-
var filterPack = function (pxData, width, height, options, bpp) {
|
|
1955
|
-
let filterTypes;
|
|
1956
|
-
if (!("filterType" in options) || options.filterType === -1) {
|
|
1957
|
-
filterTypes = [0, 1, 2, 3, 4];
|
|
1958
|
-
} else if (typeof options.filterType === "number") {
|
|
1959
|
-
filterTypes = [options.filterType];
|
|
1960
|
-
} else {
|
|
1961
|
-
throw new Error("unrecognised filter types");
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
if (options.bitDepth === 16) {
|
|
1965
|
-
bpp *= 2;
|
|
1966
|
-
}
|
|
1967
|
-
let byteWidth = width * bpp;
|
|
1968
|
-
let rawPos = 0;
|
|
1969
|
-
let pxPos = 0;
|
|
1970
|
-
let rawData = Buffer.alloc((byteWidth + 1) * height);
|
|
1971
|
-
|
|
1972
|
-
let sel = filterTypes[0];
|
|
1973
|
-
|
|
1974
|
-
for (let y = 0; y < height; y++) {
|
|
1975
|
-
if (filterTypes.length > 1) {
|
|
1976
|
-
// find best filter for this line (with lowest sum of values)
|
|
1977
|
-
let min = Infinity;
|
|
1978
|
-
|
|
1979
|
-
for (let i = 0; i < filterTypes.length; i++) {
|
|
1980
|
-
let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp);
|
|
1981
|
-
if (sum < min) {
|
|
1982
|
-
sel = filterTypes[i];
|
|
1983
|
-
min = sum;
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
rawData[rawPos] = sel;
|
|
1989
|
-
rawPos++;
|
|
1990
|
-
filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp);
|
|
1991
|
-
rawPos += byteWidth;
|
|
1992
|
-
pxPos += byteWidth;
|
|
1993
|
-
}
|
|
1994
|
-
return rawData;
|
|
1995
|
-
};
|
|
1996
|
-
|
|
1997
|
-
var packer = createCommonjsModule(function (module) {
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
let Packer = (module.exports = function (options) {
|
|
2006
|
-
this._options = options;
|
|
2007
|
-
|
|
2008
|
-
options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;
|
|
2009
|
-
options.deflateLevel =
|
|
2010
|
-
options.deflateLevel != null ? options.deflateLevel : 9;
|
|
2011
|
-
options.deflateStrategy =
|
|
2012
|
-
options.deflateStrategy != null ? options.deflateStrategy : 3;
|
|
2013
|
-
options.inputHasAlpha =
|
|
2014
|
-
options.inputHasAlpha != null ? options.inputHasAlpha : true;
|
|
2015
|
-
options.deflateFactory = options.deflateFactory || zlib__default['default'].createDeflate;
|
|
2016
|
-
options.bitDepth = options.bitDepth || 8;
|
|
2017
|
-
// This is outputColorType
|
|
2018
|
-
options.colorType =
|
|
2019
|
-
typeof options.colorType === "number"
|
|
2020
|
-
? options.colorType
|
|
2021
|
-
: constants.COLORTYPE_COLOR_ALPHA;
|
|
2022
|
-
options.inputColorType =
|
|
2023
|
-
typeof options.inputColorType === "number"
|
|
2024
|
-
? options.inputColorType
|
|
2025
|
-
: constants.COLORTYPE_COLOR_ALPHA;
|
|
2026
|
-
|
|
2027
|
-
if (
|
|
2028
|
-
[
|
|
2029
|
-
constants.COLORTYPE_GRAYSCALE,
|
|
2030
|
-
constants.COLORTYPE_COLOR,
|
|
2031
|
-
constants.COLORTYPE_COLOR_ALPHA,
|
|
2032
|
-
constants.COLORTYPE_ALPHA,
|
|
2033
|
-
].indexOf(options.colorType) === -1
|
|
2034
|
-
) {
|
|
2035
|
-
throw new Error(
|
|
2036
|
-
"option color type:" + options.colorType + " is not supported at present"
|
|
2037
|
-
);
|
|
2038
|
-
}
|
|
2039
|
-
if (
|
|
2040
|
-
[
|
|
2041
|
-
constants.COLORTYPE_GRAYSCALE,
|
|
2042
|
-
constants.COLORTYPE_COLOR,
|
|
2043
|
-
constants.COLORTYPE_COLOR_ALPHA,
|
|
2044
|
-
constants.COLORTYPE_ALPHA,
|
|
2045
|
-
].indexOf(options.inputColorType) === -1
|
|
2046
|
-
) {
|
|
2047
|
-
throw new Error(
|
|
2048
|
-
"option input color type:" +
|
|
2049
|
-
options.inputColorType +
|
|
2050
|
-
" is not supported at present"
|
|
2051
|
-
);
|
|
2052
|
-
}
|
|
2053
|
-
if (options.bitDepth !== 8 && options.bitDepth !== 16) {
|
|
2054
|
-
throw new Error(
|
|
2055
|
-
"option bit depth:" + options.bitDepth + " is not supported at present"
|
|
2056
|
-
);
|
|
2057
|
-
}
|
|
2058
|
-
});
|
|
2059
|
-
|
|
2060
|
-
Packer.prototype.getDeflateOptions = function () {
|
|
2061
|
-
return {
|
|
2062
|
-
chunkSize: this._options.deflateChunkSize,
|
|
2063
|
-
level: this._options.deflateLevel,
|
|
2064
|
-
strategy: this._options.deflateStrategy,
|
|
2065
|
-
};
|
|
2066
|
-
};
|
|
2067
|
-
|
|
2068
|
-
Packer.prototype.createDeflate = function () {
|
|
2069
|
-
return this._options.deflateFactory(this.getDeflateOptions());
|
|
2070
|
-
};
|
|
2071
|
-
|
|
2072
|
-
Packer.prototype.filterData = function (data, width, height) {
|
|
2073
|
-
// convert to correct format for filtering (e.g. right bpp and bit depth)
|
|
2074
|
-
let packedData = bitpacker(data, width, height, this._options);
|
|
2075
|
-
|
|
2076
|
-
// filter pixel data
|
|
2077
|
-
let bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType];
|
|
2078
|
-
let filteredData = filterPack(packedData, width, height, this._options, bpp);
|
|
2079
|
-
return filteredData;
|
|
2080
|
-
};
|
|
2081
|
-
|
|
2082
|
-
Packer.prototype._packChunk = function (type, data) {
|
|
2083
|
-
let len = data ? data.length : 0;
|
|
2084
|
-
let buf = Buffer.alloc(len + 12);
|
|
2085
|
-
|
|
2086
|
-
buf.writeUInt32BE(len, 0);
|
|
2087
|
-
buf.writeUInt32BE(type, 4);
|
|
2088
|
-
|
|
2089
|
-
if (data) {
|
|
2090
|
-
data.copy(buf, 8);
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
buf.writeInt32BE(
|
|
2094
|
-
crc.crc32(buf.slice(4, buf.length - 4)),
|
|
2095
|
-
buf.length - 4
|
|
2096
|
-
);
|
|
2097
|
-
return buf;
|
|
2098
|
-
};
|
|
2099
|
-
|
|
2100
|
-
Packer.prototype.packGAMA = function (gamma) {
|
|
2101
|
-
let buf = Buffer.alloc(4);
|
|
2102
|
-
buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0);
|
|
2103
|
-
return this._packChunk(constants.TYPE_gAMA, buf);
|
|
2104
|
-
};
|
|
2105
|
-
|
|
2106
|
-
Packer.prototype.packIHDR = function (width, height) {
|
|
2107
|
-
let buf = Buffer.alloc(13);
|
|
2108
|
-
buf.writeUInt32BE(width, 0);
|
|
2109
|
-
buf.writeUInt32BE(height, 4);
|
|
2110
|
-
buf[8] = this._options.bitDepth; // Bit depth
|
|
2111
|
-
buf[9] = this._options.colorType; // colorType
|
|
2112
|
-
buf[10] = 0; // compression
|
|
2113
|
-
buf[11] = 0; // filter
|
|
2114
|
-
buf[12] = 0; // interlace
|
|
2115
|
-
|
|
2116
|
-
return this._packChunk(constants.TYPE_IHDR, buf);
|
|
2117
|
-
};
|
|
2118
|
-
|
|
2119
|
-
Packer.prototype.packIDAT = function (data) {
|
|
2120
|
-
return this._packChunk(constants.TYPE_IDAT, data);
|
|
2121
|
-
};
|
|
2122
|
-
|
|
2123
|
-
Packer.prototype.packIEND = function () {
|
|
2124
|
-
return this._packChunk(constants.TYPE_IEND, null);
|
|
2125
|
-
};
|
|
2126
|
-
});
|
|
2127
|
-
|
|
2128
|
-
var packerAsync = createCommonjsModule(function (module) {
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
let PackerAsync = (module.exports = function (opt) {
|
|
2136
|
-
Stream__default['default'].call(this);
|
|
2137
|
-
|
|
2138
|
-
let options = opt || {};
|
|
2139
|
-
|
|
2140
|
-
this._packer = new packer(options);
|
|
2141
|
-
this._deflate = this._packer.createDeflate();
|
|
2142
|
-
|
|
2143
|
-
this.readable = true;
|
|
2144
|
-
});
|
|
2145
|
-
util__default['default'].inherits(PackerAsync, Stream__default['default']);
|
|
2146
|
-
|
|
2147
|
-
PackerAsync.prototype.pack = function (data, width, height, gamma) {
|
|
2148
|
-
// Signature
|
|
2149
|
-
this.emit("data", Buffer.from(constants.PNG_SIGNATURE));
|
|
2150
|
-
this.emit("data", this._packer.packIHDR(width, height));
|
|
2151
|
-
|
|
2152
|
-
if (gamma) {
|
|
2153
|
-
this.emit("data", this._packer.packGAMA(gamma));
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
let filteredData = this._packer.filterData(data, width, height);
|
|
2157
|
-
|
|
2158
|
-
// compress it
|
|
2159
|
-
this._deflate.on("error", this.emit.bind(this, "error"));
|
|
2160
|
-
|
|
2161
|
-
this._deflate.on(
|
|
2162
|
-
"data",
|
|
2163
|
-
function (compressedData) {
|
|
2164
|
-
this.emit("data", this._packer.packIDAT(compressedData));
|
|
2165
|
-
}.bind(this)
|
|
2166
|
-
);
|
|
2167
|
-
|
|
2168
|
-
this._deflate.on(
|
|
2169
|
-
"end",
|
|
2170
|
-
function () {
|
|
2171
|
-
this.emit("data", this._packer.packIEND());
|
|
2172
|
-
this.emit("end");
|
|
2173
|
-
}.bind(this)
|
|
2174
|
-
);
|
|
2175
|
-
|
|
2176
|
-
this._deflate.end(filteredData);
|
|
2177
|
-
};
|
|
2178
|
-
});
|
|
2179
|
-
|
|
2180
|
-
var syncInflate = createCommonjsModule(function (module, exports) {
|
|
2181
|
-
|
|
2182
|
-
let assert = require$$0__default['default'].ok;
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
let kMaxLength = require$$1__default['default'].kMaxLength;
|
|
2187
|
-
|
|
2188
|
-
function Inflate(opts) {
|
|
2189
|
-
if (!(this instanceof Inflate)) {
|
|
2190
|
-
return new Inflate(opts);
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
if (opts && opts.chunkSize < zlib__default['default'].Z_MIN_CHUNK) {
|
|
2194
|
-
opts.chunkSize = zlib__default['default'].Z_MIN_CHUNK;
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
zlib__default['default'].Inflate.call(this, opts);
|
|
2198
|
-
|
|
2199
|
-
// Node 8 --> 9 compatibility check
|
|
2200
|
-
this._offset = this._offset === undefined ? this._outOffset : this._offset;
|
|
2201
|
-
this._buffer = this._buffer || this._outBuffer;
|
|
2202
|
-
|
|
2203
|
-
if (opts && opts.maxLength != null) {
|
|
2204
|
-
this._maxLength = opts.maxLength;
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
function createInflate(opts) {
|
|
2209
|
-
return new Inflate(opts);
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
function _close(engine, callback) {
|
|
2213
|
-
if (callback) {
|
|
2214
|
-
process.nextTick(callback);
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
// Caller may invoke .close after a zlib error (which will null _handle).
|
|
2218
|
-
if (!engine._handle) {
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
engine._handle.close();
|
|
2223
|
-
engine._handle = null;
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
Inflate.prototype._processChunk = function (chunk, flushFlag, asyncCb) {
|
|
2227
|
-
if (typeof asyncCb === "function") {
|
|
2228
|
-
return zlib__default['default'].Inflate._processChunk.call(this, chunk, flushFlag, asyncCb);
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
let self = this;
|
|
2232
|
-
|
|
2233
|
-
let availInBefore = chunk && chunk.length;
|
|
2234
|
-
let availOutBefore = this._chunkSize - this._offset;
|
|
2235
|
-
let leftToInflate = this._maxLength;
|
|
2236
|
-
let inOff = 0;
|
|
2237
|
-
|
|
2238
|
-
let buffers = [];
|
|
2239
|
-
let nread = 0;
|
|
2240
|
-
|
|
2241
|
-
let error;
|
|
2242
|
-
this.on("error", function (err) {
|
|
2243
|
-
error = err;
|
|
2244
|
-
});
|
|
2245
|
-
|
|
2246
|
-
function handleChunk(availInAfter, availOutAfter) {
|
|
2247
|
-
if (self._hadError) {
|
|
2248
|
-
return;
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
let have = availOutBefore - availOutAfter;
|
|
2252
|
-
assert(have >= 0, "have should not go down");
|
|
2253
|
-
|
|
2254
|
-
if (have > 0) {
|
|
2255
|
-
let out = self._buffer.slice(self._offset, self._offset + have);
|
|
2256
|
-
self._offset += have;
|
|
2257
|
-
|
|
2258
|
-
if (out.length > leftToInflate) {
|
|
2259
|
-
out = out.slice(0, leftToInflate);
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
buffers.push(out);
|
|
2263
|
-
nread += out.length;
|
|
2264
|
-
leftToInflate -= out.length;
|
|
2265
|
-
|
|
2266
|
-
if (leftToInflate === 0) {
|
|
2267
|
-
return false;
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
if (availOutAfter === 0 || self._offset >= self._chunkSize) {
|
|
2272
|
-
availOutBefore = self._chunkSize;
|
|
2273
|
-
self._offset = 0;
|
|
2274
|
-
self._buffer = Buffer.allocUnsafe(self._chunkSize);
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
if (availOutAfter === 0) {
|
|
2278
|
-
inOff += availInBefore - availInAfter;
|
|
2279
|
-
availInBefore = availInAfter;
|
|
2280
|
-
|
|
2281
|
-
return true;
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
return false;
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
|
-
assert(this._handle, "zlib binding closed");
|
|
2288
|
-
let res;
|
|
2289
|
-
do {
|
|
2290
|
-
res = this._handle.writeSync(
|
|
2291
|
-
flushFlag,
|
|
2292
|
-
chunk, // in
|
|
2293
|
-
inOff, // in_off
|
|
2294
|
-
availInBefore, // in_len
|
|
2295
|
-
this._buffer, // out
|
|
2296
|
-
this._offset, //out_off
|
|
2297
|
-
availOutBefore
|
|
2298
|
-
); // out_len
|
|
2299
|
-
// Node 8 --> 9 compatibility check
|
|
2300
|
-
res = res || this._writeState;
|
|
2301
|
-
} while (!this._hadError && handleChunk(res[0], res[1]));
|
|
2302
|
-
|
|
2303
|
-
if (this._hadError) {
|
|
2304
|
-
throw error;
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
if (nread >= kMaxLength) {
|
|
2308
|
-
_close(this);
|
|
2309
|
-
throw new RangeError(
|
|
2310
|
-
"Cannot create final Buffer. It would be larger than 0x" +
|
|
2311
|
-
kMaxLength.toString(16) +
|
|
2312
|
-
" bytes"
|
|
2313
|
-
);
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
|
-
let buf = Buffer.concat(buffers, nread);
|
|
2317
|
-
_close(this);
|
|
2318
|
-
|
|
2319
|
-
return buf;
|
|
2320
|
-
};
|
|
2321
|
-
|
|
2322
|
-
util__default['default'].inherits(Inflate, zlib__default['default'].Inflate);
|
|
2323
|
-
|
|
2324
|
-
function zlibBufferSync(engine, buffer) {
|
|
2325
|
-
if (typeof buffer === "string") {
|
|
2326
|
-
buffer = Buffer.from(buffer);
|
|
2327
|
-
}
|
|
2328
|
-
if (!(buffer instanceof Buffer)) {
|
|
2329
|
-
throw new TypeError("Not a string or buffer");
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
let flushFlag = engine._finishFlushFlag;
|
|
2333
|
-
if (flushFlag == null) {
|
|
2334
|
-
flushFlag = zlib__default['default'].Z_FINISH;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
return engine._processChunk(buffer, flushFlag);
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
function inflateSync(buffer, opts) {
|
|
2341
|
-
return zlibBufferSync(new Inflate(opts), buffer);
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
module.exports = exports = inflateSync;
|
|
2345
|
-
exports.Inflate = Inflate;
|
|
2346
|
-
exports.createInflate = createInflate;
|
|
2347
|
-
exports.inflateSync = inflateSync;
|
|
2348
|
-
});
|
|
2349
|
-
|
|
2350
|
-
var syncReader = createCommonjsModule(function (module) {
|
|
2351
|
-
|
|
2352
|
-
let SyncReader = (module.exports = function (buffer) {
|
|
2353
|
-
this._buffer = buffer;
|
|
2354
|
-
this._reads = [];
|
|
2355
|
-
});
|
|
2356
|
-
|
|
2357
|
-
SyncReader.prototype.read = function (length, callback) {
|
|
2358
|
-
this._reads.push({
|
|
2359
|
-
length: Math.abs(length), // if length < 0 then at most this length
|
|
2360
|
-
allowLess: length < 0,
|
|
2361
|
-
func: callback,
|
|
2362
|
-
});
|
|
2363
|
-
};
|
|
2364
|
-
|
|
2365
|
-
SyncReader.prototype.process = function () {
|
|
2366
|
-
// as long as there is any data and read requests
|
|
2367
|
-
while (this._reads.length > 0 && this._buffer.length) {
|
|
2368
|
-
let read = this._reads[0];
|
|
2369
|
-
|
|
2370
|
-
if (
|
|
2371
|
-
this._buffer.length &&
|
|
2372
|
-
(this._buffer.length >= read.length || read.allowLess)
|
|
2373
|
-
) {
|
|
2374
|
-
// ok there is any data so that we can satisfy this request
|
|
2375
|
-
this._reads.shift(); // == read
|
|
2376
|
-
|
|
2377
|
-
let buf = this._buffer;
|
|
2378
|
-
|
|
2379
|
-
this._buffer = buf.slice(read.length);
|
|
2380
|
-
|
|
2381
|
-
read.func.call(this, buf.slice(0, read.length));
|
|
2382
|
-
} else {
|
|
2383
|
-
break;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
|
-
if (this._reads.length > 0) {
|
|
2388
|
-
throw new Error("There are some read requests waitng on finished stream");
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
if (this._buffer.length > 0) {
|
|
2392
|
-
throw new Error("unrecognised content at end of stream");
|
|
2393
|
-
}
|
|
2394
|
-
};
|
|
2395
|
-
});
|
|
2396
|
-
|
|
2397
|
-
var process_1 = function (inBuffer, bitmapInfo) {
|
|
2398
|
-
let outBuffers = [];
|
|
2399
|
-
let reader = new syncReader(inBuffer);
|
|
2400
|
-
let filter = new filterParse(bitmapInfo, {
|
|
2401
|
-
read: reader.read.bind(reader),
|
|
2402
|
-
write: function (bufferPart) {
|
|
2403
|
-
outBuffers.push(bufferPart);
|
|
2404
|
-
},
|
|
2405
|
-
complete: function () {},
|
|
2406
|
-
});
|
|
2407
|
-
|
|
2408
|
-
filter.start();
|
|
2409
|
-
reader.process();
|
|
2410
|
-
|
|
2411
|
-
return Buffer.concat(outBuffers);
|
|
2412
|
-
};
|
|
2413
|
-
|
|
2414
|
-
var filterParseSync = {
|
|
2415
|
-
process: process_1
|
|
2416
|
-
};
|
|
2417
|
-
|
|
2418
|
-
let hasSyncZlib$1 = true;
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
if (!zlib__default['default'].deflateSync) {
|
|
2422
|
-
hasSyncZlib$1 = false;
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
var parserSync = function (buffer, options) {
|
|
2431
|
-
if (!hasSyncZlib$1) {
|
|
2432
|
-
throw new Error(
|
|
2433
|
-
"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0"
|
|
2434
|
-
);
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
let err;
|
|
2438
|
-
function handleError(_err_) {
|
|
2439
|
-
err = _err_;
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
let metaData;
|
|
2443
|
-
function handleMetaData(_metaData_) {
|
|
2444
|
-
metaData = _metaData_;
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
function handleTransColor(transColor) {
|
|
2448
|
-
metaData.transColor = transColor;
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
|
-
function handlePalette(palette) {
|
|
2452
|
-
metaData.palette = palette;
|
|
2453
|
-
}
|
|
2454
|
-
|
|
2455
|
-
function handleSimpleTransparency() {
|
|
2456
|
-
metaData.alpha = true;
|
|
2457
|
-
}
|
|
2458
|
-
|
|
2459
|
-
let gamma;
|
|
2460
|
-
function handleGamma(_gamma_) {
|
|
2461
|
-
gamma = _gamma_;
|
|
2462
|
-
}
|
|
2463
|
-
|
|
2464
|
-
let inflateDataList = [];
|
|
2465
|
-
function handleInflateData(inflatedData) {
|
|
2466
|
-
inflateDataList.push(inflatedData);
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
let reader = new syncReader(buffer);
|
|
2470
|
-
|
|
2471
|
-
let parser$1 = new parser(options, {
|
|
2472
|
-
read: reader.read.bind(reader),
|
|
2473
|
-
error: handleError,
|
|
2474
|
-
metadata: handleMetaData,
|
|
2475
|
-
gamma: handleGamma,
|
|
2476
|
-
palette: handlePalette,
|
|
2477
|
-
transColor: handleTransColor,
|
|
2478
|
-
inflateData: handleInflateData,
|
|
2479
|
-
simpleTransparency: handleSimpleTransparency,
|
|
2480
|
-
});
|
|
2481
|
-
|
|
2482
|
-
parser$1.start();
|
|
2483
|
-
reader.process();
|
|
2484
|
-
|
|
2485
|
-
if (err) {
|
|
2486
|
-
throw err;
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
//join together the inflate datas
|
|
2490
|
-
let inflateData = Buffer.concat(inflateDataList);
|
|
2491
|
-
inflateDataList.length = 0;
|
|
2492
|
-
|
|
2493
|
-
let inflatedData;
|
|
2494
|
-
if (metaData.interlace) {
|
|
2495
|
-
inflatedData = zlib__default['default'].inflateSync(inflateData);
|
|
2496
|
-
} else {
|
|
2497
|
-
let rowSize =
|
|
2498
|
-
((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;
|
|
2499
|
-
let imageSize = rowSize * metaData.height;
|
|
2500
|
-
inflatedData = syncInflate(inflateData, {
|
|
2501
|
-
chunkSize: imageSize,
|
|
2502
|
-
maxLength: imageSize,
|
|
2503
|
-
});
|
|
2504
|
-
}
|
|
2505
|
-
inflateData = null;
|
|
2506
|
-
|
|
2507
|
-
if (!inflatedData || !inflatedData.length) {
|
|
2508
|
-
throw new Error("bad png - invalid inflate data response");
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
let unfilteredData = filterParseSync.process(inflatedData, metaData);
|
|
2512
|
-
inflateData = null;
|
|
2513
|
-
|
|
2514
|
-
let bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData);
|
|
2515
|
-
unfilteredData = null;
|
|
2516
|
-
|
|
2517
|
-
let normalisedBitmapData = formatNormaliser(
|
|
2518
|
-
bitmapData,
|
|
2519
|
-
metaData,
|
|
2520
|
-
options.skipRescale
|
|
2521
|
-
);
|
|
2522
|
-
|
|
2523
|
-
metaData.data = normalisedBitmapData;
|
|
2524
|
-
metaData.gamma = gamma || 0;
|
|
2525
|
-
|
|
2526
|
-
return metaData;
|
|
2527
|
-
};
|
|
2528
|
-
|
|
2529
|
-
let hasSyncZlib = true;
|
|
2530
|
-
|
|
2531
|
-
if (!zlib__default['default'].deflateSync) {
|
|
2532
|
-
hasSyncZlib = false;
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
var packerSync = function (metaData, opt) {
|
|
2538
|
-
if (!hasSyncZlib) {
|
|
2539
|
-
throw new Error(
|
|
2540
|
-
"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0"
|
|
2541
|
-
);
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
let options = opt || {};
|
|
2545
|
-
|
|
2546
|
-
let packer$1 = new packer(options);
|
|
2547
|
-
|
|
2548
|
-
let chunks = [];
|
|
2549
|
-
|
|
2550
|
-
// Signature
|
|
2551
|
-
chunks.push(Buffer.from(constants.PNG_SIGNATURE));
|
|
2552
|
-
|
|
2553
|
-
// Header
|
|
2554
|
-
chunks.push(packer$1.packIHDR(metaData.width, metaData.height));
|
|
2555
|
-
|
|
2556
|
-
if (metaData.gamma) {
|
|
2557
|
-
chunks.push(packer$1.packGAMA(metaData.gamma));
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
let filteredData = packer$1.filterData(
|
|
2561
|
-
metaData.data,
|
|
2562
|
-
metaData.width,
|
|
2563
|
-
metaData.height
|
|
2564
|
-
);
|
|
2565
|
-
|
|
2566
|
-
// compress it
|
|
2567
|
-
let compressedData = zlib__default['default'].deflateSync(
|
|
2568
|
-
filteredData,
|
|
2569
|
-
packer$1.getDeflateOptions()
|
|
2570
|
-
);
|
|
2571
|
-
filteredData = null;
|
|
2572
|
-
|
|
2573
|
-
if (!compressedData || !compressedData.length) {
|
|
2574
|
-
throw new Error("bad png - invalid compressed data response");
|
|
2575
|
-
}
|
|
2576
|
-
chunks.push(packer$1.packIDAT(compressedData));
|
|
2577
|
-
|
|
2578
|
-
// End
|
|
2579
|
-
chunks.push(packer$1.packIEND());
|
|
2580
|
-
|
|
2581
|
-
return Buffer.concat(chunks);
|
|
2582
|
-
};
|
|
2583
|
-
|
|
2584
|
-
var read = function (buffer, options) {
|
|
2585
|
-
return parserSync(buffer, options || {});
|
|
2586
|
-
};
|
|
2587
|
-
|
|
2588
|
-
var write = function (png, options) {
|
|
2589
|
-
return packerSync(png, options);
|
|
2590
|
-
};
|
|
2591
|
-
|
|
2592
|
-
var pngSync = {
|
|
2593
|
-
read: read,
|
|
2594
|
-
write: write
|
|
2595
|
-
};
|
|
2596
|
-
|
|
2597
|
-
var png = createCommonjsModule(function (module, exports) {
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
let PNG = (exports.PNG = function (options) {
|
|
2606
|
-
Stream__default['default'].call(this);
|
|
2607
|
-
|
|
2608
|
-
options = options || {}; // eslint-disable-line no-param-reassign
|
|
2609
|
-
|
|
2610
|
-
// coerce pixel dimensions to integers (also coerces undefined -> 0):
|
|
2611
|
-
this.width = options.width | 0;
|
|
2612
|
-
this.height = options.height | 0;
|
|
2613
|
-
|
|
2614
|
-
this.data =
|
|
2615
|
-
this.width > 0 && this.height > 0
|
|
2616
|
-
? Buffer.alloc(4 * this.width * this.height)
|
|
2617
|
-
: null;
|
|
2618
|
-
|
|
2619
|
-
if (options.fill && this.data) {
|
|
2620
|
-
this.data.fill(0);
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
this.gamma = 0;
|
|
2624
|
-
this.readable = this.writable = true;
|
|
2625
|
-
|
|
2626
|
-
this._parser = new parserAsync(options);
|
|
2627
|
-
|
|
2628
|
-
this._parser.on("error", this.emit.bind(this, "error"));
|
|
2629
|
-
this._parser.on("close", this._handleClose.bind(this));
|
|
2630
|
-
this._parser.on("metadata", this._metadata.bind(this));
|
|
2631
|
-
this._parser.on("gamma", this._gamma.bind(this));
|
|
2632
|
-
this._parser.on(
|
|
2633
|
-
"parsed",
|
|
2634
|
-
function (data) {
|
|
2635
|
-
this.data = data;
|
|
2636
|
-
this.emit("parsed", data);
|
|
2637
|
-
}.bind(this)
|
|
2638
|
-
);
|
|
2639
|
-
|
|
2640
|
-
this._packer = new packerAsync(options);
|
|
2641
|
-
this._packer.on("data", this.emit.bind(this, "data"));
|
|
2642
|
-
this._packer.on("end", this.emit.bind(this, "end"));
|
|
2643
|
-
this._parser.on("close", this._handleClose.bind(this));
|
|
2644
|
-
this._packer.on("error", this.emit.bind(this, "error"));
|
|
2645
|
-
});
|
|
2646
|
-
util__default['default'].inherits(PNG, Stream__default['default']);
|
|
2647
|
-
|
|
2648
|
-
PNG.sync = pngSync;
|
|
2649
|
-
|
|
2650
|
-
PNG.prototype.pack = function () {
|
|
2651
|
-
if (!this.data || !this.data.length) {
|
|
2652
|
-
this.emit("error", "No data provided");
|
|
2653
|
-
return this;
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
process.nextTick(
|
|
2657
|
-
function () {
|
|
2658
|
-
this._packer.pack(this.data, this.width, this.height, this.gamma);
|
|
2659
|
-
}.bind(this)
|
|
2660
|
-
);
|
|
2661
|
-
|
|
2662
|
-
return this;
|
|
2663
|
-
};
|
|
2664
|
-
|
|
2665
|
-
PNG.prototype.parse = function (data, callback) {
|
|
2666
|
-
if (callback) {
|
|
2667
|
-
let onParsed, onError;
|
|
2668
|
-
|
|
2669
|
-
onParsed = function (parsedData) {
|
|
2670
|
-
this.removeListener("error", onError);
|
|
2671
|
-
|
|
2672
|
-
this.data = parsedData;
|
|
2673
|
-
callback(null, this);
|
|
2674
|
-
}.bind(this);
|
|
2675
|
-
|
|
2676
|
-
onError = function (err) {
|
|
2677
|
-
this.removeListener("parsed", onParsed);
|
|
2678
|
-
|
|
2679
|
-
callback(err, null);
|
|
2680
|
-
}.bind(this);
|
|
2681
|
-
|
|
2682
|
-
this.once("parsed", onParsed);
|
|
2683
|
-
this.once("error", onError);
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
this.end(data);
|
|
2687
|
-
return this;
|
|
2688
|
-
};
|
|
2689
|
-
|
|
2690
|
-
PNG.prototype.write = function (data) {
|
|
2691
|
-
this._parser.write(data);
|
|
2692
|
-
return true;
|
|
2693
|
-
};
|
|
2694
|
-
|
|
2695
|
-
PNG.prototype.end = function (data) {
|
|
2696
|
-
this._parser.end(data);
|
|
2697
|
-
};
|
|
2698
|
-
|
|
2699
|
-
PNG.prototype._metadata = function (metadata) {
|
|
2700
|
-
this.width = metadata.width;
|
|
2701
|
-
this.height = metadata.height;
|
|
2702
|
-
|
|
2703
|
-
this.emit("metadata", metadata);
|
|
2704
|
-
};
|
|
2705
|
-
|
|
2706
|
-
PNG.prototype._gamma = function (gamma) {
|
|
2707
|
-
this.gamma = gamma;
|
|
2708
|
-
};
|
|
2709
|
-
|
|
2710
|
-
PNG.prototype._handleClose = function () {
|
|
2711
|
-
if (!this._parser.writable && !this._packer.readable) {
|
|
2712
|
-
this.emit("close");
|
|
2713
|
-
}
|
|
2714
|
-
};
|
|
2715
|
-
|
|
2716
|
-
PNG.bitblt = function (src, dst, srcX, srcY, width, height, deltaX, deltaY) {
|
|
2717
|
-
// eslint-disable-line max-params
|
|
2718
|
-
// coerce pixel dimensions to integers (also coerces undefined -> 0):
|
|
2719
|
-
/* eslint-disable no-param-reassign */
|
|
2720
|
-
srcX |= 0;
|
|
2721
|
-
srcY |= 0;
|
|
2722
|
-
width |= 0;
|
|
2723
|
-
height |= 0;
|
|
2724
|
-
deltaX |= 0;
|
|
2725
|
-
deltaY |= 0;
|
|
2726
|
-
/* eslint-enable no-param-reassign */
|
|
2727
|
-
|
|
2728
|
-
if (
|
|
2729
|
-
srcX > src.width ||
|
|
2730
|
-
srcY > src.height ||
|
|
2731
|
-
srcX + width > src.width ||
|
|
2732
|
-
srcY + height > src.height
|
|
2733
|
-
) {
|
|
2734
|
-
throw new Error("bitblt reading outside image");
|
|
2735
|
-
}
|
|
2736
|
-
|
|
2737
|
-
if (
|
|
2738
|
-
deltaX > dst.width ||
|
|
2739
|
-
deltaY > dst.height ||
|
|
2740
|
-
deltaX + width > dst.width ||
|
|
2741
|
-
deltaY + height > dst.height
|
|
2742
|
-
) {
|
|
2743
|
-
throw new Error("bitblt writing outside image");
|
|
2744
|
-
}
|
|
2745
|
-
|
|
2746
|
-
for (let y = 0; y < height; y++) {
|
|
2747
|
-
src.data.copy(
|
|
2748
|
-
dst.data,
|
|
2749
|
-
((deltaY + y) * dst.width + deltaX) << 2,
|
|
2750
|
-
((srcY + y) * src.width + srcX) << 2,
|
|
2751
|
-
((srcY + y) * src.width + srcX + width) << 2
|
|
2752
|
-
);
|
|
2753
|
-
}
|
|
2754
|
-
};
|
|
2755
|
-
|
|
2756
|
-
PNG.prototype.bitblt = function (
|
|
2757
|
-
dst,
|
|
2758
|
-
srcX,
|
|
2759
|
-
srcY,
|
|
2760
|
-
width,
|
|
2761
|
-
height,
|
|
2762
|
-
deltaX,
|
|
2763
|
-
deltaY
|
|
2764
|
-
) {
|
|
2765
|
-
// eslint-disable-line max-params
|
|
2766
|
-
|
|
2767
|
-
PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY);
|
|
2768
|
-
return this;
|
|
2769
|
-
};
|
|
2770
|
-
|
|
2771
|
-
PNG.adjustGamma = function (src) {
|
|
2772
|
-
if (src.gamma) {
|
|
2773
|
-
for (let y = 0; y < src.height; y++) {
|
|
2774
|
-
for (let x = 0; x < src.width; x++) {
|
|
2775
|
-
let idx = (src.width * y + x) << 2;
|
|
2776
|
-
|
|
2777
|
-
for (let i = 0; i < 3; i++) {
|
|
2778
|
-
let sample = src.data[idx + i] / 255;
|
|
2779
|
-
sample = Math.pow(sample, 1 / 2.2 / src.gamma);
|
|
2780
|
-
src.data[idx + i] = Math.round(sample * 255);
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
}
|
|
2784
|
-
src.gamma = 0;
|
|
2785
|
-
}
|
|
2786
|
-
};
|
|
2787
|
-
|
|
2788
|
-
PNG.prototype.adjustGamma = function () {
|
|
2789
|
-
PNG.adjustGamma(this);
|
|
2790
|
-
};
|
|
2791
|
-
});
|
|
2792
|
-
|
|
2793
|
-
function getMismatchedPixels(pixelMatchInput) {
|
|
2794
|
-
const imgA = fs__default['default'].createReadStream(pixelMatchInput.imageAPath).pipe(new png.PNG()).on('parsed', doneReading);
|
|
2795
|
-
const imgB = fs__default['default'].createReadStream(pixelMatchInput.imageBPath).pipe(new png.PNG()).on('parsed', doneReading);
|
|
2796
|
-
let filesRead = 0;
|
|
2797
|
-
function doneReading() {
|
|
2798
|
-
if (++filesRead < 2)
|
|
2799
|
-
return;
|
|
2800
|
-
const mismatchedPixels = pixelmatch_1(imgA.data, imgB.data, null, pixelMatchInput.width, pixelMatchInput.height, {
|
|
2801
|
-
threshold: pixelMatchInput.pixelmatchThreshold,
|
|
2802
|
-
includeAA: false,
|
|
2803
|
-
});
|
|
2804
|
-
process.send(mismatchedPixels);
|
|
2805
|
-
}
|
|
2806
|
-
}
|
|
2807
|
-
process.on('message', getMismatchedPixels);
|