blue-chestnut-solar-expert 0.0.67 → 0.0.68
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/dist/stencil-library/assets/tutorial4.mp4 +0 -0
- package/dist/{collection/config.js → stencil-library/config-CWfV1nKn.js} +10 -4
- package/dist/stencil-library/config-CWfV1nKn.js.map +1 -0
- package/dist/stencil-library/constants-hboFofU4.js +1522 -0
- package/dist/stencil-library/constants-hboFofU4.js.map +1 -0
- package/dist/stencil-library/decoder-DNOvLSaS.js +39 -0
- package/dist/stencil-library/decoder-DNOvLSaS.js.map +1 -0
- package/dist/stencil-library/deflate-0Vdd6-55.js +21 -0
- package/dist/{esm/deflate-DHgPf9CO.js.map → stencil-library/deflate-0Vdd6-55.js.map} +1 -1
- package/dist/stencil-library/eraser-icon.entry.esm.js.map +1 -0
- package/dist/{components/p-CL74Q4VR.js → stencil-library/eraser-icon.entry.js} +9 -27
- package/dist/stencil-library/eraser-icon.entry.js.map +1 -0
- package/dist/stencil-library/house-icon.entry.esm.js.map +1 -0
- package/dist/{components/p-D8w3bTPO.js → stencil-library/house-icon.entry.js} +9 -27
- package/dist/stencil-library/house-icon.entry.js.map +1 -0
- package/dist/{components/loading-widget.js → stencil-library/icon-selector.entry.esm.js.map} +1 -38
- package/dist/stencil-library/icon-selector.entry.js +47 -0
- package/dist/stencil-library/icon-selector.entry.js.map +1 -0
- package/dist/stencil-library/index-CChkgM3J.js +414 -0
- package/dist/stencil-library/index-CChkgM3J.js.map +1 -0
- package/dist/stencil-library/index-ICfDNUMe.js +4172 -0
- package/dist/stencil-library/index-ICfDNUMe.js.map +1 -0
- package/dist/stencil-library/index.esm.js +13 -1
- package/dist/stencil-library/index.esm.js.map +1 -1
- package/dist/{esm/jpeg-CJLm1GkA.js → stencil-library/jpeg-Dd5nnHR5.js} +11 -3
- package/dist/stencil-library/jpeg-Dd5nnHR5.js.map +1 -0
- package/dist/{components/p-BcVa4_YP.js → stencil-library/lerc-7W4E8EBs.js} +27 -1981
- package/dist/stencil-library/lerc-7W4E8EBs.js.map +1 -0
- package/dist/{esm → stencil-library}/loading-widget.entry.js +3 -3
- package/dist/{components/p-P28NBglk.js.map → stencil-library/loading-widget.entry.js.map} +1 -1
- package/dist/{esm/lzw-DaOzWJUD.js → stencil-library/lzw--P4c0ZHH.js} +10 -4
- package/dist/stencil-library/lzw--P4c0ZHH.js.map +1 -0
- package/dist/stencil-library/map-draw-Cx9WZoKH.js +25567 -0
- package/dist/stencil-library/map-draw-Cx9WZoKH.js.map +1 -0
- package/dist/stencil-library/map-draw.entry.esm.js.map +1 -0
- package/dist/stencil-library/map-draw.entry.js +12 -0
- package/dist/stencil-library/map-draw.entry.js.map +1 -0
- package/dist/stencil-library/map-selector.entry.esm.js.map +1 -0
- package/dist/{components/p-C5QieOat.js → stencil-library/map-selector.entry.js} +164 -96
- package/dist/stencil-library/map-selector.entry.js.map +1 -0
- package/dist/{components/loading-widget.js.map → stencil-library/marker-icon.entry.esm.js.map} +1 -1
- package/dist/{components/p-Umz6nJIv.js → stencil-library/marker-icon.entry.js} +9 -27
- package/dist/stencil-library/marker-icon.entry.js.map +1 -0
- package/dist/stencil-library/move-icon.entry.esm.js.map +1 -0
- package/dist/{components/p-FdEV2qPo.js → stencil-library/move-icon.entry.js} +9 -27
- package/dist/stencil-library/move-icon.entry.js.map +1 -0
- package/dist/{components/p-DTXeHbuh.js.map → stencil-library/octagon-minus-icon.entry.esm.js.map} +1 -1
- package/dist/{components/p-BJLO76Yi.js → stencil-library/octagon-minus-icon.entry.js} +9 -27
- package/dist/stencil-library/octagon-minus-icon.entry.js.map +1 -0
- package/dist/{components/p-ByX6QP-E.js → stencil-library/packbits-X3R_utTs.js} +9 -3
- package/dist/stencil-library/packbits-X3R_utTs.js.map +1 -0
- package/dist/stencil-library/pako.esm-CPorU236.js +6881 -0
- package/dist/{esm/pako.esm-B5WTRCh8.js.map → stencil-library/pako.esm-CPorU236.js.map} +1 -1
- package/dist/{components/p-B4X-RCW0.js.map → stencil-library/polygon-buttons.entry.esm.js.map} +1 -1
- package/dist/{cjs/loading-widget.cjs.entry.js → stencil-library/polygon-buttons.entry.js} +16 -10
- package/dist/stencil-library/polygon-buttons.entry.js.map +1 -0
- package/dist/{cjs/loading-widget.cjs.entry.js.map → stencil-library/polygon-information.entry.esm.js.map} +1 -1
- package/dist/{components/p-BFJHTJPM.js → stencil-library/polygon-information.entry.js} +13 -70
- package/dist/stencil-library/polygon-information.entry.js.map +1 -0
- package/dist/stencil-library/raw-BxukYehy.js +20 -0
- package/dist/stencil-library/raw-BxukYehy.js.map +1 -0
- package/dist/stencil-library/search-icon.entry.esm.js.map +1 -0
- package/dist/{components/p-DBwr8xSB.js → stencil-library/search-icon.entry.js} +9 -27
- package/dist/stencil-library/{p-ab0f2031.entry.js → search-icon.entry.js.map} +1 -2
- package/dist/stencil-library/settings-icon.entry.esm.js.map +1 -0
- package/dist/{components/p-DTXeHbuh.js → stencil-library/settings-icon.entry.js} +9 -27
- package/dist/stencil-library/settings-icon.entry.js.map +1 -0
- package/dist/stencil-library/settings-modal.entry.esm.js.map +1 -0
- package/dist/{components/p-B4X-RCW0.js → stencil-library/settings-modal.entry.js} +20 -38
- package/dist/stencil-library/settings-modal.entry.js.map +1 -0
- package/dist/stencil-library/solar-expert.entry.esm.js.map +1 -0
- package/dist/{components/solar-expert.js → stencil-library/solar-expert.entry.js} +14 -150
- package/dist/{components/p-i1uLweD0.js.map → stencil-library/solar-expert.entry.js.map} +1 -1
- package/dist/stencil-library/solar-system-form.entry.esm.js.map +1 -0
- package/dist/stencil-library/solar-system-form.entry.js +553 -0
- package/dist/stencil-library/solar-system-form.entry.js.map +1 -0
- package/dist/stencil-library/stencil-library.esm.js +52 -1
- package/dist/stencil-library/stencil-library.esm.js.map +1 -1
- package/dist/{components/p-eDwaXClX.js → stencil-library/store-CcqrFuBK.js} +24 -3
- package/dist/stencil-library/store-CcqrFuBK.js.map +1 -0
- package/dist/stencil-library/toast-notification.entry.esm.js.map +1 -0
- package/dist/{components/p-P28NBglk.js → stencil-library/toast-notification.entry.js} +9 -30
- package/dist/stencil-library/toast-notification.entry.js.map +1 -0
- package/dist/stencil-library/tool-box.entry.esm.js.map +1 -0
- package/dist/{components/p-i1uLweD0.js → stencil-library/tool-box.entry.js} +27 -35
- package/dist/stencil-library/tool-box.entry.js.map +1 -0
- package/dist/{collection/utils/render/tools.js → stencil-library/tools-BNYKV5H5.js} +14 -8
- package/dist/stencil-library/tools-BNYKV5H5.js.map +1 -0
- package/dist/stencil-library/tutorial-component.entry.esm.js.map +1 -0
- package/dist/{components/p-Dzl6kfPI.js → stencil-library/tutorial-component.entry.js} +42 -35
- package/dist/stencil-library/tutorial-component.entry.js.map +1 -0
- package/dist/stencil-library/undo-icon.entry.esm.js.map +1 -0
- package/dist/{components/p-waOPoUcA.js → stencil-library/undo-icon.entry.js} +9 -27
- package/dist/stencil-library/undo-icon.entry.js.map +1 -0
- package/dist/{collection/utils/utils.js → stencil-library/utils-BCUZxI9u.js} +9 -3
- package/dist/stencil-library/utils-BCUZxI9u.js.map +1 -0
- package/dist/{esm/webimage-BiHardhv.js → stencil-library/webimage-CBrfoxHM.js} +9 -3
- package/dist/{esm/webimage-BiHardhv.js.map → stencil-library/webimage-CBrfoxHM.js.map} +1 -1
- package/dist/types/components/map-draw/map-draw.d.ts +5 -0
- package/dist/types/components/map-draw/tutorial-component.d.ts +7 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/types/lang.d.ts +7 -0
- package/package.json +1 -1
- package/dist/cjs/app-globals-I24yU8do.js +0 -10
- package/dist/cjs/app-globals-I24yU8do.js.map +0 -1
- package/dist/cjs/basedecoder-CQuzfSgz.js +0 -116
- package/dist/cjs/basedecoder-CQuzfSgz.js.map +0 -1
- package/dist/cjs/deflate-AzGzQSW2.js +0 -17
- package/dist/cjs/deflate-AzGzQSW2.js.map +0 -1
- package/dist/cjs/eraser-icon_19.cjs.entry.js +0 -31
- package/dist/cjs/eraser-icon_19.cjs.entry.js.map +0 -1
- package/dist/cjs/index-HgRXF6kp.js +0 -1470
- package/dist/cjs/index-HgRXF6kp.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -7
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/jpeg-Bx3bTm32.js +0 -904
- package/dist/cjs/jpeg-Bx3bTm32.js.map +0 -1
- package/dist/cjs/lerc-v64rYVDy.js +0 -4427
- package/dist/cjs/lerc-v64rYVDy.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -18
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/loading-widget.entry.cjs.js.map +0 -1
- package/dist/cjs/lzw-BmFug486.js +0 -140
- package/dist/cjs/lzw-BmFug486.js.map +0 -1
- package/dist/cjs/packbits-CYx9fB0v.js +0 -35
- package/dist/cjs/packbits-CYx9fB0v.js.map +0 -1
- package/dist/cjs/pako.esm-0mKI6Jik.js +0 -3243
- package/dist/cjs/pako.esm-0mKI6Jik.js.map +0 -1
- package/dist/cjs/raw-DC82yoyr.js +0 -16
- package/dist/cjs/raw-DC82yoyr.js.map +0 -1
- package/dist/cjs/stencil-library.cjs.js +0 -30
- package/dist/cjs/stencil-library.cjs.js.map +0 -1
- package/dist/cjs/webimage-Dc0t2xAB.js +0 -49
- package/dist/cjs/webimage-Dc0t2xAB.js.map +0 -1
- package/dist/collection/collection-manifest.json +0 -31
- package/dist/collection/components/icons/eraser.js +0 -64
- package/dist/collection/components/icons/eraser.js.map +0 -1
- package/dist/collection/components/icons/house.js +0 -64
- package/dist/collection/components/icons/house.js.map +0 -1
- package/dist/collection/components/icons/icon.js +0 -108
- package/dist/collection/components/icons/icon.js.map +0 -1
- package/dist/collection/components/icons/marker.js +0 -64
- package/dist/collection/components/icons/marker.js.map +0 -1
- package/dist/collection/components/icons/move.js +0 -64
- package/dist/collection/components/icons/move.js.map +0 -1
- package/dist/collection/components/icons/octagonMinus.js +0 -64
- package/dist/collection/components/icons/octagonMinus.js.map +0 -1
- package/dist/collection/components/icons/search.js +0 -64
- package/dist/collection/components/icons/search.js.map +0 -1
- package/dist/collection/components/icons/settings.js +0 -64
- package/dist/collection/components/icons/settings.js.map +0 -1
- package/dist/collection/components/icons/undo.js +0 -64
- package/dist/collection/components/icons/undo.js.map +0 -1
- package/dist/collection/components/map-draw/map-draw.js +0 -795
- package/dist/collection/components/map-draw/map-draw.js.map +0 -1
- package/dist/collection/components/map-draw/map-selector.js +0 -246
- package/dist/collection/components/map-draw/map-selector.js.map +0 -1
- package/dist/collection/components/map-draw/polygon-buttons.js +0 -86
- package/dist/collection/components/map-draw/polygon-buttons.js.map +0 -1
- package/dist/collection/components/map-draw/polygon-information.js +0 -211
- package/dist/collection/components/map-draw/polygon-information.js.map +0 -1
- package/dist/collection/components/map-draw/tool-box.js +0 -108
- package/dist/collection/components/map-draw/tool-box.js.map +0 -1
- package/dist/collection/components/map-draw/tutorial-component.js +0 -151
- package/dist/collection/components/map-draw/tutorial-component.js.map +0 -1
- package/dist/collection/components/settings/settings.js +0 -127
- package/dist/collection/components/settings/settings.js.map +0 -1
- package/dist/collection/components/solar-expert/solar-expert.js +0 -241
- package/dist/collection/components/solar-expert/solar-expert.js.map +0 -1
- package/dist/collection/components/solar-system-form/solar-system-form.js +0 -596
- package/dist/collection/components/solar-system-form/solar-system-form.js.map +0 -1
- package/dist/collection/components/widgets/loading-widget.js +0 -18
- package/dist/collection/components/widgets/loading-widget.js.map +0 -1
- package/dist/collection/components/widgets/toast-notification.js +0 -133
- package/dist/collection/components/widgets/toast-notification.js.map +0 -1
- package/dist/collection/config.js.map +0 -1
- package/dist/collection/constants.js +0 -90
- package/dist/collection/constants.js.map +0 -1
- package/dist/collection/index.js +0 -2
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/output.css +0 -1126
- package/dist/collection/store.js +0 -43
- package/dist/collection/store.js.map +0 -1
- package/dist/collection/types/lang.js +0 -2
- package/dist/collection/types/lang.js.map +0 -1
- package/dist/collection/types/shapes.js +0 -2
- package/dist/collection/types/shapes.js.map +0 -1
- package/dist/collection/utils/api.js +0 -93
- package/dist/collection/utils/api.js.map +0 -1
- package/dist/collection/utils/images.js +0 -2
- package/dist/collection/utils/images.js.map +0 -1
- package/dist/collection/utils/lang/english.js +0 -157
- package/dist/collection/utils/lang/english.js.map +0 -1
- package/dist/collection/utils/lang/general.js +0 -30
- package/dist/collection/utils/lang/general.js.map +0 -1
- package/dist/collection/utils/lang/german.js +0 -157
- package/dist/collection/utils/lang/german.js.map +0 -1
- package/dist/collection/utils/lang/spanish.js +0 -157
- package/dist/collection/utils/lang/spanish.js.map +0 -1
- package/dist/collection/utils/render/tools.js.map +0 -1
- package/dist/collection/utils/solar.js +0 -136
- package/dist/collection/utils/solar.js.map +0 -1
- package/dist/collection/utils/theme.js +0 -97
- package/dist/collection/utils/theme.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/eraser-icon.js +0 -11
- package/dist/components/eraser-icon.js.map +0 -1
- package/dist/components/house-icon.js +0 -11
- package/dist/components/house-icon.js.map +0 -1
- package/dist/components/icon-selector.js +0 -11
- package/dist/components/icon-selector.js.map +0 -1
- package/dist/components/index.js +0 -1269
- package/dist/components/index.js.map +0 -1
- package/dist/components/map-draw.js +0 -11
- package/dist/components/map-draw.js.map +0 -1
- package/dist/components/map-selector.js +0 -11
- package/dist/components/map-selector.js.map +0 -1
- package/dist/components/marker-icon.js +0 -11
- package/dist/components/marker-icon.js.map +0 -1
- package/dist/components/move-icon.js +0 -11
- package/dist/components/move-icon.js.map +0 -1
- package/dist/components/octagon-minus-icon.js +0 -11
- package/dist/components/octagon-minus-icon.js.map +0 -1
- package/dist/components/p-B54Ul0nf.js +0 -15
- package/dist/components/p-B54Ul0nf.js.map +0 -1
- package/dist/components/p-B5WTRCh8.js +0 -3241
- package/dist/components/p-B5WTRCh8.js.map +0 -1
- package/dist/components/p-BFJHTJPM.js.map +0 -1
- package/dist/components/p-BGoSj_DR.js +0 -902
- package/dist/components/p-BGoSj_DR.js.map +0 -1
- package/dist/components/p-BJLO76Yi.js.map +0 -1
- package/dist/components/p-BcVa4_YP.js.map +0 -1
- package/dist/components/p-Bopprtc7.js +0 -623
- package/dist/components/p-Bopprtc7.js.map +0 -1
- package/dist/components/p-ByX6QP-E.js.map +0 -1
- package/dist/components/p-C5QieOat.js.map +0 -1
- package/dist/components/p-CL74Q4VR.js.map +0 -1
- package/dist/components/p-Cgchl6bA.js +0 -47
- package/dist/components/p-Cgchl6bA.js.map +0 -1
- package/dist/components/p-D8w3bTPO.js.map +0 -1
- package/dist/components/p-DBwr8xSB.js.map +0 -1
- package/dist/components/p-DWirjxpO.js +0 -163
- package/dist/components/p-DWirjxpO.js.map +0 -1
- package/dist/components/p-DlNHVTGB.js +0 -15949
- package/dist/components/p-DlNHVTGB.js.map +0 -1
- package/dist/components/p-Dzl6kfPI.js.map +0 -1
- package/dist/components/p-FdEV2qPo.js.map +0 -1
- package/dist/components/p-PkMjF2if.js +0 -1985
- package/dist/components/p-PkMjF2if.js.map +0 -1
- package/dist/components/p-Umz6nJIv.js.map +0 -1
- package/dist/components/p-WmcSqXD8.js +0 -14
- package/dist/components/p-WmcSqXD8.js.map +0 -1
- package/dist/components/p-eDwaXClX.js.map +0 -1
- package/dist/components/p-j-vOrhhh.js +0 -114
- package/dist/components/p-j-vOrhhh.js.map +0 -1
- package/dist/components/p-q8auDIJ2.js +0 -138
- package/dist/components/p-q8auDIJ2.js.map +0 -1
- package/dist/components/p-waOPoUcA.js.map +0 -1
- package/dist/components/polygon-buttons.js +0 -11
- package/dist/components/polygon-buttons.js.map +0 -1
- package/dist/components/polygon-information.js +0 -11
- package/dist/components/polygon-information.js.map +0 -1
- package/dist/components/search-icon.js +0 -11
- package/dist/components/search-icon.js.map +0 -1
- package/dist/components/settings-icon.js +0 -11
- package/dist/components/settings-icon.js.map +0 -1
- package/dist/components/settings-modal.js +0 -11
- package/dist/components/settings-modal.js.map +0 -1
- package/dist/components/solar-expert.js.map +0 -1
- package/dist/components/solar-system-form.js +0 -11
- package/dist/components/solar-system-form.js.map +0 -1
- package/dist/components/toast-notification.js +0 -11
- package/dist/components/toast-notification.js.map +0 -1
- package/dist/components/tool-box.js +0 -11
- package/dist/components/tool-box.js.map +0 -1
- package/dist/components/tutorial-component.js +0 -11
- package/dist/components/tutorial-component.js.map +0 -1
- package/dist/components/undo-icon.js +0 -11
- package/dist/components/undo-icon.js.map +0 -1
- package/dist/esm/basedecoder-j-vOrhhh.js +0 -114
- package/dist/esm/basedecoder-j-vOrhhh.js.map +0 -1
- package/dist/esm/deflate-DHgPf9CO.js +0 -15
- package/dist/esm/eraser-icon_19.entry.js +0 -7
- package/dist/esm/eraser-icon_19.entry.js.map +0 -1
- package/dist/esm/index-C2JRBB5c.js +0 -1458
- package/dist/esm/index-C2JRBB5c.js.map +0 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/jpeg-CJLm1GkA.js.map +0 -1
- package/dist/esm/lerc-CAiDQjTu.js +0 -4424
- package/dist/esm/lerc-CAiDQjTu.js.map +0 -1
- package/dist/esm/loader.js +0 -16
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/loading-widget.entry.js.map +0 -1
- package/dist/esm/lzw-DaOzWJUD.js.map +0 -1
- package/dist/esm/packbits-CZPyx9kx.js +0 -33
- package/dist/esm/packbits-CZPyx9kx.js.map +0 -1
- package/dist/esm/pako.esm-B5WTRCh8.js +0 -3241
- package/dist/esm/raw-pqeeWc2_.js +0 -14
- package/dist/esm/raw-pqeeWc2_.js.map +0 -1
- package/dist/esm/stencil-library.js +0 -26
- package/dist/esm/stencil-library.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/stencil-library/p-B54Ul0nf.js +0 -2
- package/dist/stencil-library/p-B54Ul0nf.js.map +0 -1
- package/dist/stencil-library/p-B5WTRCh8.js +0 -2
- package/dist/stencil-library/p-B5WTRCh8.js.map +0 -1
- package/dist/stencil-library/p-BBtmpSUK.js +0 -2
- package/dist/stencil-library/p-BBtmpSUK.js.map +0 -1
- package/dist/stencil-library/p-BGoSj_DR.js +0 -2
- package/dist/stencil-library/p-BGoSj_DR.js.map +0 -1
- package/dist/stencil-library/p-ByX6QP-E.js +0 -2
- package/dist/stencil-library/p-ByX6QP-E.js.map +0 -1
- package/dist/stencil-library/p-C2JRBB5c.js +0 -3
- package/dist/stencil-library/p-C2JRBB5c.js.map +0 -1
- package/dist/stencil-library/p-CX8V3eiN.js +0 -2
- package/dist/stencil-library/p-CX8V3eiN.js.map +0 -1
- package/dist/stencil-library/p-Cgchl6bA.js +0 -2
- package/dist/stencil-library/p-Cgchl6bA.js.map +0 -1
- package/dist/stencil-library/p-WmcSqXD8.js +0 -2
- package/dist/stencil-library/p-WmcSqXD8.js.map +0 -1
- package/dist/stencil-library/p-ab0f2031.entry.js.map +0 -1
- package/dist/stencil-library/p-cAuhy_jT.js +0 -10
- package/dist/stencil-library/p-cAuhy_jT.js.map +0 -1
- package/dist/stencil-library/p-e7b94dbb.entry.js +0 -2
- package/dist/stencil-library/p-e7b94dbb.entry.js.map +0 -1
- package/dist/stencil-library/p-j-vOrhhh.js +0 -2
- package/dist/stencil-library/p-j-vOrhhh.js.map +0 -1
- package/dist/stencil-library/p-q8auDIJ2.js +0 -2
- package/dist/stencil-library/p-q8auDIJ2.js.map +0 -1
- /package/dist/{esm → stencil-library}/app-globals-CX8V3eiN.js +0 -0
- /package/dist/{esm → stencil-library}/app-globals-CX8V3eiN.js.map +0 -0
|
@@ -1,1984 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
if (typeof global === "undefined") { var global = globalThis || window || self; }
|
|
3
|
-
import { i as inflate_1 } from './
|
|
4
|
-
import
|
|
5
|
-
import { B as BaseDecoder } from './
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function init$1 () {
|
|
12
|
-
inited = true;
|
|
13
|
-
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
14
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
15
|
-
lookup[i] = code[i];
|
|
16
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
revLookup['-'.charCodeAt(0)] = 62;
|
|
20
|
-
revLookup['_'.charCodeAt(0)] = 63;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function toByteArray (b64) {
|
|
24
|
-
if (!inited) {
|
|
25
|
-
init$1();
|
|
26
|
-
}
|
|
27
|
-
var i, j, l, tmp, placeHolders, arr;
|
|
28
|
-
var len = b64.length;
|
|
29
|
-
|
|
30
|
-
if (len % 4 > 0) {
|
|
31
|
-
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// the number of equal signs (place holders)
|
|
35
|
-
// if there are two placeholders, than the two characters before it
|
|
36
|
-
// represent one byte
|
|
37
|
-
// if there is only one, then the three characters before it represent 2 bytes
|
|
38
|
-
// this is just a cheap hack to not do indexOf twice
|
|
39
|
-
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
|
|
40
|
-
|
|
41
|
-
// base64 is 4/3 + up to two characters of the original data
|
|
42
|
-
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
43
|
-
|
|
44
|
-
// if there are placeholders, only get up to the last complete 4 chars
|
|
45
|
-
l = placeHolders > 0 ? len - 4 : len;
|
|
46
|
-
|
|
47
|
-
var L = 0;
|
|
48
|
-
|
|
49
|
-
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
50
|
-
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
|
|
51
|
-
arr[L++] = (tmp >> 16) & 0xFF;
|
|
52
|
-
arr[L++] = (tmp >> 8) & 0xFF;
|
|
53
|
-
arr[L++] = tmp & 0xFF;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (placeHolders === 2) {
|
|
57
|
-
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
|
|
58
|
-
arr[L++] = tmp & 0xFF;
|
|
59
|
-
} else if (placeHolders === 1) {
|
|
60
|
-
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
|
|
61
|
-
arr[L++] = (tmp >> 8) & 0xFF;
|
|
62
|
-
arr[L++] = tmp & 0xFF;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return arr
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function tripletToBase64 (num) {
|
|
69
|
-
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function encodeChunk (uint8, start, end) {
|
|
73
|
-
var tmp;
|
|
74
|
-
var output = [];
|
|
75
|
-
for (var i = start; i < end; i += 3) {
|
|
76
|
-
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
|
|
77
|
-
output.push(tripletToBase64(tmp));
|
|
78
|
-
}
|
|
79
|
-
return output.join('')
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function fromByteArray (uint8) {
|
|
83
|
-
if (!inited) {
|
|
84
|
-
init$1();
|
|
85
|
-
}
|
|
86
|
-
var tmp;
|
|
87
|
-
var len = uint8.length;
|
|
88
|
-
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
89
|
-
var output = '';
|
|
90
|
-
var parts = [];
|
|
91
|
-
var maxChunkLength = 16383; // must be multiple of 3
|
|
92
|
-
|
|
93
|
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
94
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
95
|
-
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
99
|
-
if (extraBytes === 1) {
|
|
100
|
-
tmp = uint8[len - 1];
|
|
101
|
-
output += lookup[tmp >> 2];
|
|
102
|
-
output += lookup[(tmp << 4) & 0x3F];
|
|
103
|
-
output += '==';
|
|
104
|
-
} else if (extraBytes === 2) {
|
|
105
|
-
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
|
|
106
|
-
output += lookup[tmp >> 10];
|
|
107
|
-
output += lookup[(tmp >> 4) & 0x3F];
|
|
108
|
-
output += lookup[(tmp << 2) & 0x3F];
|
|
109
|
-
output += '=';
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
parts.push(output);
|
|
113
|
-
|
|
114
|
-
return parts.join('')
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function read (buffer, offset, isLE, mLen, nBytes) {
|
|
118
|
-
var e, m;
|
|
119
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
120
|
-
var eMax = (1 << eLen) - 1;
|
|
121
|
-
var eBias = eMax >> 1;
|
|
122
|
-
var nBits = -7;
|
|
123
|
-
var i = isLE ? (nBytes - 1) : 0;
|
|
124
|
-
var d = isLE ? -1 : 1;
|
|
125
|
-
var s = buffer[offset + i];
|
|
126
|
-
|
|
127
|
-
i += d;
|
|
128
|
-
|
|
129
|
-
e = s & ((1 << (-nBits)) - 1);
|
|
130
|
-
s >>= (-nBits);
|
|
131
|
-
nBits += eLen;
|
|
132
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
133
|
-
|
|
134
|
-
m = e & ((1 << (-nBits)) - 1);
|
|
135
|
-
e >>= (-nBits);
|
|
136
|
-
nBits += mLen;
|
|
137
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
138
|
-
|
|
139
|
-
if (e === 0) {
|
|
140
|
-
e = 1 - eBias;
|
|
141
|
-
} else if (e === eMax) {
|
|
142
|
-
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
143
|
-
} else {
|
|
144
|
-
m = m + Math.pow(2, mLen);
|
|
145
|
-
e = e - eBias;
|
|
146
|
-
}
|
|
147
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function write (buffer, value, offset, isLE, mLen, nBytes) {
|
|
151
|
-
var e, m, c;
|
|
152
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
153
|
-
var eMax = (1 << eLen) - 1;
|
|
154
|
-
var eBias = eMax >> 1;
|
|
155
|
-
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
|
|
156
|
-
var i = isLE ? 0 : (nBytes - 1);
|
|
157
|
-
var d = isLE ? 1 : -1;
|
|
158
|
-
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
|
|
159
|
-
|
|
160
|
-
value = Math.abs(value);
|
|
161
|
-
|
|
162
|
-
if (isNaN(value) || value === Infinity) {
|
|
163
|
-
m = isNaN(value) ? 1 : 0;
|
|
164
|
-
e = eMax;
|
|
165
|
-
} else {
|
|
166
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
167
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
168
|
-
e--;
|
|
169
|
-
c *= 2;
|
|
170
|
-
}
|
|
171
|
-
if (e + eBias >= 1) {
|
|
172
|
-
value += rt / c;
|
|
173
|
-
} else {
|
|
174
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
175
|
-
}
|
|
176
|
-
if (value * c >= 2) {
|
|
177
|
-
e++;
|
|
178
|
-
c /= 2;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (e + eBias >= eMax) {
|
|
182
|
-
m = 0;
|
|
183
|
-
e = eMax;
|
|
184
|
-
} else if (e + eBias >= 1) {
|
|
185
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
186
|
-
e = e + eBias;
|
|
187
|
-
} else {
|
|
188
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
189
|
-
e = 0;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
194
|
-
|
|
195
|
-
e = (e << mLen) | m;
|
|
196
|
-
eLen += mLen;
|
|
197
|
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
198
|
-
|
|
199
|
-
buffer[offset + i - d] |= s * 128;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
var toString = {}.toString;
|
|
203
|
-
|
|
204
|
-
var isArray = Array.isArray || function (arr) {
|
|
205
|
-
return toString.call(arr) == '[object Array]';
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
/*!
|
|
209
|
-
* The buffer module from node.js, for the browser.
|
|
210
|
-
*
|
|
211
|
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
212
|
-
* @license MIT
|
|
213
|
-
*/
|
|
214
|
-
|
|
215
|
-
var INSPECT_MAX_BYTES = 50;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
219
|
-
* === true Use Uint8Array implementation (fastest)
|
|
220
|
-
* === false Use Object implementation (most compatible, even IE6)
|
|
221
|
-
*
|
|
222
|
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
223
|
-
* Opera 11.6+, iOS 4.2+.
|
|
224
|
-
*
|
|
225
|
-
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
226
|
-
* when the browser supports typed arrays.
|
|
227
|
-
*
|
|
228
|
-
* Note:
|
|
229
|
-
*
|
|
230
|
-
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
231
|
-
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
232
|
-
*
|
|
233
|
-
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
234
|
-
*
|
|
235
|
-
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
236
|
-
* incorrect length in some situations.
|
|
237
|
-
|
|
238
|
-
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
239
|
-
* get the Object implementation, which is slower but behaves correctly.
|
|
240
|
-
*/
|
|
241
|
-
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
|
242
|
-
? global.TYPED_ARRAY_SUPPORT
|
|
243
|
-
: true;
|
|
244
|
-
|
|
245
|
-
function kMaxLength () {
|
|
246
|
-
return Buffer.TYPED_ARRAY_SUPPORT
|
|
247
|
-
? 0x7fffffff
|
|
248
|
-
: 0x3fffffff
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function createBuffer (that, length) {
|
|
252
|
-
if (kMaxLength() < length) {
|
|
253
|
-
throw new RangeError('Invalid typed array length')
|
|
254
|
-
}
|
|
255
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
256
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
257
|
-
that = new Uint8Array(length);
|
|
258
|
-
that.__proto__ = Buffer.prototype;
|
|
259
|
-
} else {
|
|
260
|
-
// Fallback: Return an object instance of the Buffer class
|
|
261
|
-
if (that === null) {
|
|
262
|
-
that = new Buffer(length);
|
|
263
|
-
}
|
|
264
|
-
that.length = length;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return that
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
272
|
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
273
|
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
274
|
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
275
|
-
* returns a single octet.
|
|
276
|
-
*
|
|
277
|
-
* The `Uint8Array` prototype remains unmodified.
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
function Buffer (arg, encodingOrOffset, length) {
|
|
281
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
282
|
-
return new Buffer(arg, encodingOrOffset, length)
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Common case.
|
|
286
|
-
if (typeof arg === 'number') {
|
|
287
|
-
if (typeof encodingOrOffset === 'string') {
|
|
288
|
-
throw new Error(
|
|
289
|
-
'If encoding is specified then the first argument must be a string'
|
|
290
|
-
)
|
|
291
|
-
}
|
|
292
|
-
return allocUnsafe(this, arg)
|
|
293
|
-
}
|
|
294
|
-
return from(this, arg, encodingOrOffset, length)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
Buffer.poolSize = 8192; // not used by this implementation
|
|
298
|
-
|
|
299
|
-
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
300
|
-
Buffer._augment = function (arr) {
|
|
301
|
-
arr.__proto__ = Buffer.prototype;
|
|
302
|
-
return arr
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
function from (that, value, encodingOrOffset, length) {
|
|
306
|
-
if (typeof value === 'number') {
|
|
307
|
-
throw new TypeError('"value" argument must not be a number')
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
311
|
-
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (typeof value === 'string') {
|
|
315
|
-
return fromString(that, value, encodingOrOffset)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
return fromObject(that, value)
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
323
|
-
* if value is a number.
|
|
324
|
-
* Buffer.from(str[, encoding])
|
|
325
|
-
* Buffer.from(array)
|
|
326
|
-
* Buffer.from(buffer)
|
|
327
|
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
328
|
-
**/
|
|
329
|
-
Buffer.from = function (value, encodingOrOffset, length) {
|
|
330
|
-
return from(null, value, encodingOrOffset, length)
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
334
|
-
Buffer.prototype.__proto__ = Uint8Array.prototype;
|
|
335
|
-
Buffer.__proto__ = Uint8Array;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function assertSize (size) {
|
|
339
|
-
if (typeof size !== 'number') {
|
|
340
|
-
throw new TypeError('"size" argument must be a number')
|
|
341
|
-
} else if (size < 0) {
|
|
342
|
-
throw new RangeError('"size" argument must not be negative')
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function alloc (that, size, fill, encoding) {
|
|
347
|
-
assertSize(size);
|
|
348
|
-
if (size <= 0) {
|
|
349
|
-
return createBuffer(that, size)
|
|
350
|
-
}
|
|
351
|
-
if (fill !== undefined) {
|
|
352
|
-
// Only pay attention to encoding if it's a string. This
|
|
353
|
-
// prevents accidentally sending in a number that would
|
|
354
|
-
// be interpretted as a start offset.
|
|
355
|
-
return typeof encoding === 'string'
|
|
356
|
-
? createBuffer(that, size).fill(fill, encoding)
|
|
357
|
-
: createBuffer(that, size).fill(fill)
|
|
358
|
-
}
|
|
359
|
-
return createBuffer(that, size)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Creates a new filled Buffer instance.
|
|
364
|
-
* alloc(size[, fill[, encoding]])
|
|
365
|
-
**/
|
|
366
|
-
Buffer.alloc = function (size, fill, encoding) {
|
|
367
|
-
return alloc(null, size, fill, encoding)
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
function allocUnsafe (that, size) {
|
|
371
|
-
assertSize(size);
|
|
372
|
-
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
|
|
373
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
374
|
-
for (var i = 0; i < size; ++i) {
|
|
375
|
-
that[i] = 0;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return that
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
383
|
-
* */
|
|
384
|
-
Buffer.allocUnsafe = function (size) {
|
|
385
|
-
return allocUnsafe(null, size)
|
|
386
|
-
};
|
|
387
|
-
/**
|
|
388
|
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
389
|
-
*/
|
|
390
|
-
Buffer.allocUnsafeSlow = function (size) {
|
|
391
|
-
return allocUnsafe(null, size)
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
function fromString (that, string, encoding) {
|
|
395
|
-
if (typeof encoding !== 'string' || encoding === '') {
|
|
396
|
-
encoding = 'utf8';
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
if (!Buffer.isEncoding(encoding)) {
|
|
400
|
-
throw new TypeError('"encoding" must be a valid string encoding')
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
var length = byteLength(string, encoding) | 0;
|
|
404
|
-
that = createBuffer(that, length);
|
|
405
|
-
|
|
406
|
-
var actual = that.write(string, encoding);
|
|
407
|
-
|
|
408
|
-
if (actual !== length) {
|
|
409
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
410
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
411
|
-
// 'abxxcd' will be treated as 'ab')
|
|
412
|
-
that = that.slice(0, actual);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return that
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function fromArrayLike (that, array) {
|
|
419
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
420
|
-
that = createBuffer(that, length);
|
|
421
|
-
for (var i = 0; i < length; i += 1) {
|
|
422
|
-
that[i] = array[i] & 255;
|
|
423
|
-
}
|
|
424
|
-
return that
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
428
|
-
|
|
429
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
430
|
-
throw new RangeError('\'offset\' is out of bounds')
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
434
|
-
throw new RangeError('\'length\' is out of bounds')
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
if (byteOffset === undefined && length === undefined) {
|
|
438
|
-
array = new Uint8Array(array);
|
|
439
|
-
} else if (length === undefined) {
|
|
440
|
-
array = new Uint8Array(array, byteOffset);
|
|
441
|
-
} else {
|
|
442
|
-
array = new Uint8Array(array, byteOffset, length);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
446
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
447
|
-
that = array;
|
|
448
|
-
that.__proto__ = Buffer.prototype;
|
|
449
|
-
} else {
|
|
450
|
-
// Fallback: Return an object instance of the Buffer class
|
|
451
|
-
that = fromArrayLike(that, array);
|
|
452
|
-
}
|
|
453
|
-
return that
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
function fromObject (that, obj) {
|
|
457
|
-
if (internalIsBuffer(obj)) {
|
|
458
|
-
var len = checked(obj.length) | 0;
|
|
459
|
-
that = createBuffer(that, len);
|
|
460
|
-
|
|
461
|
-
if (that.length === 0) {
|
|
462
|
-
return that
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
obj.copy(that, 0, 0, len);
|
|
466
|
-
return that
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (obj) {
|
|
470
|
-
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
471
|
-
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
472
|
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
473
|
-
return createBuffer(that, 0)
|
|
474
|
-
}
|
|
475
|
-
return fromArrayLike(that, obj)
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (obj.type === 'Buffer' && isArray(obj.data)) {
|
|
479
|
-
return fromArrayLike(that, obj.data)
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
function checked (length) {
|
|
487
|
-
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
488
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
489
|
-
if (length >= kMaxLength()) {
|
|
490
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
491
|
-
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
|
492
|
-
}
|
|
493
|
-
return length | 0
|
|
494
|
-
}
|
|
495
|
-
Buffer.isBuffer = isBuffer;
|
|
496
|
-
function internalIsBuffer (b) {
|
|
497
|
-
return !!(b != null && b._isBuffer)
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
Buffer.compare = function compare (a, b) {
|
|
501
|
-
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
502
|
-
throw new TypeError('Arguments must be Buffers')
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
if (a === b) return 0
|
|
506
|
-
|
|
507
|
-
var x = a.length;
|
|
508
|
-
var y = b.length;
|
|
509
|
-
|
|
510
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
511
|
-
if (a[i] !== b[i]) {
|
|
512
|
-
x = a[i];
|
|
513
|
-
y = b[i];
|
|
514
|
-
break
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
if (x < y) return -1
|
|
519
|
-
if (y < x) return 1
|
|
520
|
-
return 0
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
Buffer.isEncoding = function isEncoding (encoding) {
|
|
524
|
-
switch (String(encoding).toLowerCase()) {
|
|
525
|
-
case 'hex':
|
|
526
|
-
case 'utf8':
|
|
527
|
-
case 'utf-8':
|
|
528
|
-
case 'ascii':
|
|
529
|
-
case 'latin1':
|
|
530
|
-
case 'binary':
|
|
531
|
-
case 'base64':
|
|
532
|
-
case 'ucs2':
|
|
533
|
-
case 'ucs-2':
|
|
534
|
-
case 'utf16le':
|
|
535
|
-
case 'utf-16le':
|
|
536
|
-
return true
|
|
537
|
-
default:
|
|
538
|
-
return false
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
Buffer.concat = function concat (list, length) {
|
|
543
|
-
if (!isArray(list)) {
|
|
544
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
if (list.length === 0) {
|
|
548
|
-
return Buffer.alloc(0)
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
var i;
|
|
552
|
-
if (length === undefined) {
|
|
553
|
-
length = 0;
|
|
554
|
-
for (i = 0; i < list.length; ++i) {
|
|
555
|
-
length += list[i].length;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
var buffer = Buffer.allocUnsafe(length);
|
|
560
|
-
var pos = 0;
|
|
561
|
-
for (i = 0; i < list.length; ++i) {
|
|
562
|
-
var buf = list[i];
|
|
563
|
-
if (!internalIsBuffer(buf)) {
|
|
564
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
565
|
-
}
|
|
566
|
-
buf.copy(buffer, pos);
|
|
567
|
-
pos += buf.length;
|
|
568
|
-
}
|
|
569
|
-
return buffer
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
function byteLength (string, encoding) {
|
|
573
|
-
if (internalIsBuffer(string)) {
|
|
574
|
-
return string.length
|
|
575
|
-
}
|
|
576
|
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
577
|
-
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
578
|
-
return string.byteLength
|
|
579
|
-
}
|
|
580
|
-
if (typeof string !== 'string') {
|
|
581
|
-
string = '' + string;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
var len = string.length;
|
|
585
|
-
if (len === 0) return 0
|
|
586
|
-
|
|
587
|
-
// Use a for loop to avoid recursion
|
|
588
|
-
var loweredCase = false;
|
|
589
|
-
for (;;) {
|
|
590
|
-
switch (encoding) {
|
|
591
|
-
case 'ascii':
|
|
592
|
-
case 'latin1':
|
|
593
|
-
case 'binary':
|
|
594
|
-
return len
|
|
595
|
-
case 'utf8':
|
|
596
|
-
case 'utf-8':
|
|
597
|
-
case undefined:
|
|
598
|
-
return utf8ToBytes(string).length
|
|
599
|
-
case 'ucs2':
|
|
600
|
-
case 'ucs-2':
|
|
601
|
-
case 'utf16le':
|
|
602
|
-
case 'utf-16le':
|
|
603
|
-
return len * 2
|
|
604
|
-
case 'hex':
|
|
605
|
-
return len >>> 1
|
|
606
|
-
case 'base64':
|
|
607
|
-
return base64ToBytes(string).length
|
|
608
|
-
default:
|
|
609
|
-
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
|
610
|
-
encoding = ('' + encoding).toLowerCase();
|
|
611
|
-
loweredCase = true;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
Buffer.byteLength = byteLength;
|
|
616
|
-
|
|
617
|
-
function slowToString (encoding, start, end) {
|
|
618
|
-
var loweredCase = false;
|
|
619
|
-
|
|
620
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
621
|
-
// property of a typed array.
|
|
622
|
-
|
|
623
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
624
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
625
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
626
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
627
|
-
if (start === undefined || start < 0) {
|
|
628
|
-
start = 0;
|
|
629
|
-
}
|
|
630
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
631
|
-
// coercion fail below.
|
|
632
|
-
if (start > this.length) {
|
|
633
|
-
return ''
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
if (end === undefined || end > this.length) {
|
|
637
|
-
end = this.length;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
if (end <= 0) {
|
|
641
|
-
return ''
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
645
|
-
end >>>= 0;
|
|
646
|
-
start >>>= 0;
|
|
647
|
-
|
|
648
|
-
if (end <= start) {
|
|
649
|
-
return ''
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
if (!encoding) encoding = 'utf8';
|
|
653
|
-
|
|
654
|
-
while (true) {
|
|
655
|
-
switch (encoding) {
|
|
656
|
-
case 'hex':
|
|
657
|
-
return hexSlice(this, start, end)
|
|
658
|
-
|
|
659
|
-
case 'utf8':
|
|
660
|
-
case 'utf-8':
|
|
661
|
-
return utf8Slice(this, start, end)
|
|
662
|
-
|
|
663
|
-
case 'ascii':
|
|
664
|
-
return asciiSlice(this, start, end)
|
|
665
|
-
|
|
666
|
-
case 'latin1':
|
|
667
|
-
case 'binary':
|
|
668
|
-
return latin1Slice(this, start, end)
|
|
669
|
-
|
|
670
|
-
case 'base64':
|
|
671
|
-
return base64Slice(this, start, end)
|
|
672
|
-
|
|
673
|
-
case 'ucs2':
|
|
674
|
-
case 'ucs-2':
|
|
675
|
-
case 'utf16le':
|
|
676
|
-
case 'utf-16le':
|
|
677
|
-
return utf16leSlice(this, start, end)
|
|
678
|
-
|
|
679
|
-
default:
|
|
680
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
681
|
-
encoding = (encoding + '').toLowerCase();
|
|
682
|
-
loweredCase = true;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
688
|
-
// Buffer instances.
|
|
689
|
-
Buffer.prototype._isBuffer = true;
|
|
690
|
-
|
|
691
|
-
function swap (b, n, m) {
|
|
692
|
-
var i = b[n];
|
|
693
|
-
b[n] = b[m];
|
|
694
|
-
b[m] = i;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
Buffer.prototype.swap16 = function swap16 () {
|
|
698
|
-
var len = this.length;
|
|
699
|
-
if (len % 2 !== 0) {
|
|
700
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
701
|
-
}
|
|
702
|
-
for (var i = 0; i < len; i += 2) {
|
|
703
|
-
swap(this, i, i + 1);
|
|
704
|
-
}
|
|
705
|
-
return this
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
Buffer.prototype.swap32 = function swap32 () {
|
|
709
|
-
var len = this.length;
|
|
710
|
-
if (len % 4 !== 0) {
|
|
711
|
-
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
712
|
-
}
|
|
713
|
-
for (var i = 0; i < len; i += 4) {
|
|
714
|
-
swap(this, i, i + 3);
|
|
715
|
-
swap(this, i + 1, i + 2);
|
|
716
|
-
}
|
|
717
|
-
return this
|
|
718
|
-
};
|
|
719
|
-
|
|
720
|
-
Buffer.prototype.swap64 = function swap64 () {
|
|
721
|
-
var len = this.length;
|
|
722
|
-
if (len % 8 !== 0) {
|
|
723
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
724
|
-
}
|
|
725
|
-
for (var i = 0; i < len; i += 8) {
|
|
726
|
-
swap(this, i, i + 7);
|
|
727
|
-
swap(this, i + 1, i + 6);
|
|
728
|
-
swap(this, i + 2, i + 5);
|
|
729
|
-
swap(this, i + 3, i + 4);
|
|
730
|
-
}
|
|
731
|
-
return this
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
Buffer.prototype.toString = function toString () {
|
|
735
|
-
var length = this.length | 0;
|
|
736
|
-
if (length === 0) return ''
|
|
737
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
738
|
-
return slowToString.apply(this, arguments)
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
Buffer.prototype.equals = function equals (b) {
|
|
742
|
-
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
743
|
-
if (this === b) return true
|
|
744
|
-
return Buffer.compare(this, b) === 0
|
|
745
|
-
};
|
|
746
|
-
|
|
747
|
-
Buffer.prototype.inspect = function inspect () {
|
|
748
|
-
var str = '';
|
|
749
|
-
var max = INSPECT_MAX_BYTES;
|
|
750
|
-
if (this.length > 0) {
|
|
751
|
-
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
|
|
752
|
-
if (this.length > max) str += ' ... ';
|
|
753
|
-
}
|
|
754
|
-
return '<Buffer ' + str + '>'
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
758
|
-
if (!internalIsBuffer(target)) {
|
|
759
|
-
throw new TypeError('Argument must be a Buffer')
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
if (start === undefined) {
|
|
763
|
-
start = 0;
|
|
764
|
-
}
|
|
765
|
-
if (end === undefined) {
|
|
766
|
-
end = target ? target.length : 0;
|
|
767
|
-
}
|
|
768
|
-
if (thisStart === undefined) {
|
|
769
|
-
thisStart = 0;
|
|
770
|
-
}
|
|
771
|
-
if (thisEnd === undefined) {
|
|
772
|
-
thisEnd = this.length;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
776
|
-
throw new RangeError('out of range index')
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
780
|
-
return 0
|
|
781
|
-
}
|
|
782
|
-
if (thisStart >= thisEnd) {
|
|
783
|
-
return -1
|
|
784
|
-
}
|
|
785
|
-
if (start >= end) {
|
|
786
|
-
return 1
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
start >>>= 0;
|
|
790
|
-
end >>>= 0;
|
|
791
|
-
thisStart >>>= 0;
|
|
792
|
-
thisEnd >>>= 0;
|
|
793
|
-
|
|
794
|
-
if (this === target) return 0
|
|
795
|
-
|
|
796
|
-
var x = thisEnd - thisStart;
|
|
797
|
-
var y = end - start;
|
|
798
|
-
var len = Math.min(x, y);
|
|
799
|
-
|
|
800
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
801
|
-
var targetCopy = target.slice(start, end);
|
|
802
|
-
|
|
803
|
-
for (var i = 0; i < len; ++i) {
|
|
804
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
805
|
-
x = thisCopy[i];
|
|
806
|
-
y = targetCopy[i];
|
|
807
|
-
break
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
if (x < y) return -1
|
|
812
|
-
if (y < x) return 1
|
|
813
|
-
return 0
|
|
814
|
-
};
|
|
815
|
-
|
|
816
|
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
817
|
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
818
|
-
//
|
|
819
|
-
// Arguments:
|
|
820
|
-
// - buffer - a Buffer to search
|
|
821
|
-
// - val - a string, Buffer, or number
|
|
822
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
823
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
824
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
825
|
-
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
826
|
-
// Empty buffer means no match
|
|
827
|
-
if (buffer.length === 0) return -1
|
|
828
|
-
|
|
829
|
-
// Normalize byteOffset
|
|
830
|
-
if (typeof byteOffset === 'string') {
|
|
831
|
-
encoding = byteOffset;
|
|
832
|
-
byteOffset = 0;
|
|
833
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
834
|
-
byteOffset = 0x7fffffff;
|
|
835
|
-
} else if (byteOffset < -2147483648) {
|
|
836
|
-
byteOffset = -2147483648;
|
|
837
|
-
}
|
|
838
|
-
byteOffset = +byteOffset; // Coerce to Number.
|
|
839
|
-
if (isNaN(byteOffset)) {
|
|
840
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
841
|
-
byteOffset = dir ? 0 : (buffer.length - 1);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
845
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
846
|
-
if (byteOffset >= buffer.length) {
|
|
847
|
-
if (dir) return -1
|
|
848
|
-
else byteOffset = buffer.length - 1;
|
|
849
|
-
} else if (byteOffset < 0) {
|
|
850
|
-
if (dir) byteOffset = 0;
|
|
851
|
-
else return -1
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
// Normalize val
|
|
855
|
-
if (typeof val === 'string') {
|
|
856
|
-
val = Buffer.from(val, encoding);
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
860
|
-
if (internalIsBuffer(val)) {
|
|
861
|
-
// Special case: looking for empty string/buffer always fails
|
|
862
|
-
if (val.length === 0) {
|
|
863
|
-
return -1
|
|
864
|
-
}
|
|
865
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
866
|
-
} else if (typeof val === 'number') {
|
|
867
|
-
val = val & 0xFF; // Search for a byte value [0-255]
|
|
868
|
-
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
|
869
|
-
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
870
|
-
if (dir) {
|
|
871
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
872
|
-
} else {
|
|
873
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
throw new TypeError('val must be string, number or Buffer')
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
883
|
-
var indexSize = 1;
|
|
884
|
-
var arrLength = arr.length;
|
|
885
|
-
var valLength = val.length;
|
|
886
|
-
|
|
887
|
-
if (encoding !== undefined) {
|
|
888
|
-
encoding = String(encoding).toLowerCase();
|
|
889
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
890
|
-
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
891
|
-
if (arr.length < 2 || val.length < 2) {
|
|
892
|
-
return -1
|
|
893
|
-
}
|
|
894
|
-
indexSize = 2;
|
|
895
|
-
arrLength /= 2;
|
|
896
|
-
valLength /= 2;
|
|
897
|
-
byteOffset /= 2;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
function read (buf, i) {
|
|
902
|
-
if (indexSize === 1) {
|
|
903
|
-
return buf[i]
|
|
904
|
-
} else {
|
|
905
|
-
return buf.readUInt16BE(i * indexSize)
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
var i;
|
|
910
|
-
if (dir) {
|
|
911
|
-
var foundIndex = -1;
|
|
912
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
913
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
914
|
-
if (foundIndex === -1) foundIndex = i;
|
|
915
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
916
|
-
} else {
|
|
917
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
918
|
-
foundIndex = -1;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
} else {
|
|
922
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
923
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
924
|
-
var found = true;
|
|
925
|
-
for (var j = 0; j < valLength; j++) {
|
|
926
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
927
|
-
found = false;
|
|
928
|
-
break
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
if (found) return i
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
return -1
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
939
|
-
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
940
|
-
};
|
|
941
|
-
|
|
942
|
-
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
943
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
947
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
function hexWrite (buf, string, offset, length) {
|
|
951
|
-
offset = Number(offset) || 0;
|
|
952
|
-
var remaining = buf.length - offset;
|
|
953
|
-
if (!length) {
|
|
954
|
-
length = remaining;
|
|
955
|
-
} else {
|
|
956
|
-
length = Number(length);
|
|
957
|
-
if (length > remaining) {
|
|
958
|
-
length = remaining;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
// must be an even number of digits
|
|
963
|
-
var strLen = string.length;
|
|
964
|
-
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
|
965
|
-
|
|
966
|
-
if (length > strLen / 2) {
|
|
967
|
-
length = strLen / 2;
|
|
968
|
-
}
|
|
969
|
-
for (var i = 0; i < length; ++i) {
|
|
970
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
971
|
-
if (isNaN(parsed)) return i
|
|
972
|
-
buf[offset + i] = parsed;
|
|
973
|
-
}
|
|
974
|
-
return i
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
function utf8Write (buf, string, offset, length) {
|
|
978
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
function asciiWrite (buf, string, offset, length) {
|
|
982
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
function latin1Write (buf, string, offset, length) {
|
|
986
|
-
return asciiWrite(buf, string, offset, length)
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
function base64Write (buf, string, offset, length) {
|
|
990
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
function ucs2Write (buf, string, offset, length) {
|
|
994
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
998
|
-
// Buffer#write(string)
|
|
999
|
-
if (offset === undefined) {
|
|
1000
|
-
encoding = 'utf8';
|
|
1001
|
-
length = this.length;
|
|
1002
|
-
offset = 0;
|
|
1003
|
-
// Buffer#write(string, encoding)
|
|
1004
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
1005
|
-
encoding = offset;
|
|
1006
|
-
length = this.length;
|
|
1007
|
-
offset = 0;
|
|
1008
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
1009
|
-
} else if (isFinite(offset)) {
|
|
1010
|
-
offset = offset | 0;
|
|
1011
|
-
if (isFinite(length)) {
|
|
1012
|
-
length = length | 0;
|
|
1013
|
-
if (encoding === undefined) encoding = 'utf8';
|
|
1014
|
-
} else {
|
|
1015
|
-
encoding = length;
|
|
1016
|
-
length = undefined;
|
|
1017
|
-
}
|
|
1018
|
-
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
1019
|
-
} else {
|
|
1020
|
-
throw new Error(
|
|
1021
|
-
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
1022
|
-
)
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
var remaining = this.length - offset;
|
|
1026
|
-
if (length === undefined || length > remaining) length = remaining;
|
|
1027
|
-
|
|
1028
|
-
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
1029
|
-
throw new RangeError('Attempt to write outside buffer bounds')
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
if (!encoding) encoding = 'utf8';
|
|
1033
|
-
|
|
1034
|
-
var loweredCase = false;
|
|
1035
|
-
for (;;) {
|
|
1036
|
-
switch (encoding) {
|
|
1037
|
-
case 'hex':
|
|
1038
|
-
return hexWrite(this, string, offset, length)
|
|
1039
|
-
|
|
1040
|
-
case 'utf8':
|
|
1041
|
-
case 'utf-8':
|
|
1042
|
-
return utf8Write(this, string, offset, length)
|
|
1043
|
-
|
|
1044
|
-
case 'ascii':
|
|
1045
|
-
return asciiWrite(this, string, offset, length)
|
|
1046
|
-
|
|
1047
|
-
case 'latin1':
|
|
1048
|
-
case 'binary':
|
|
1049
|
-
return latin1Write(this, string, offset, length)
|
|
1050
|
-
|
|
1051
|
-
case 'base64':
|
|
1052
|
-
// Warning: maxLength not taken into account in base64Write
|
|
1053
|
-
return base64Write(this, string, offset, length)
|
|
1054
|
-
|
|
1055
|
-
case 'ucs2':
|
|
1056
|
-
case 'ucs-2':
|
|
1057
|
-
case 'utf16le':
|
|
1058
|
-
case 'utf-16le':
|
|
1059
|
-
return ucs2Write(this, string, offset, length)
|
|
1060
|
-
|
|
1061
|
-
default:
|
|
1062
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
1063
|
-
encoding = ('' + encoding).toLowerCase();
|
|
1064
|
-
loweredCase = true;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
};
|
|
1068
|
-
|
|
1069
|
-
Buffer.prototype.toJSON = function toJSON () {
|
|
1070
|
-
return {
|
|
1071
|
-
type: 'Buffer',
|
|
1072
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1073
|
-
}
|
|
1074
|
-
};
|
|
1075
|
-
|
|
1076
|
-
function base64Slice (buf, start, end) {
|
|
1077
|
-
if (start === 0 && end === buf.length) {
|
|
1078
|
-
return fromByteArray(buf)
|
|
1079
|
-
} else {
|
|
1080
|
-
return fromByteArray(buf.slice(start, end))
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
function utf8Slice (buf, start, end) {
|
|
1085
|
-
end = Math.min(buf.length, end);
|
|
1086
|
-
var res = [];
|
|
1087
|
-
|
|
1088
|
-
var i = start;
|
|
1089
|
-
while (i < end) {
|
|
1090
|
-
var firstByte = buf[i];
|
|
1091
|
-
var codePoint = null;
|
|
1092
|
-
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
|
1093
|
-
: (firstByte > 0xDF) ? 3
|
|
1094
|
-
: (firstByte > 0xBF) ? 2
|
|
1095
|
-
: 1;
|
|
1096
|
-
|
|
1097
|
-
if (i + bytesPerSequence <= end) {
|
|
1098
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
1099
|
-
|
|
1100
|
-
switch (bytesPerSequence) {
|
|
1101
|
-
case 1:
|
|
1102
|
-
if (firstByte < 0x80) {
|
|
1103
|
-
codePoint = firstByte;
|
|
1104
|
-
}
|
|
1105
|
-
break
|
|
1106
|
-
case 2:
|
|
1107
|
-
secondByte = buf[i + 1];
|
|
1108
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
1109
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
|
|
1110
|
-
if (tempCodePoint > 0x7F) {
|
|
1111
|
-
codePoint = tempCodePoint;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
break
|
|
1115
|
-
case 3:
|
|
1116
|
-
secondByte = buf[i + 1];
|
|
1117
|
-
thirdByte = buf[i + 2];
|
|
1118
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
1119
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
|
|
1120
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
1121
|
-
codePoint = tempCodePoint;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
break
|
|
1125
|
-
case 4:
|
|
1126
|
-
secondByte = buf[i + 1];
|
|
1127
|
-
thirdByte = buf[i + 2];
|
|
1128
|
-
fourthByte = buf[i + 3];
|
|
1129
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
1130
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
|
|
1131
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
1132
|
-
codePoint = tempCodePoint;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
if (codePoint === null) {
|
|
1139
|
-
// we did not generate a valid codePoint so insert a
|
|
1140
|
-
// replacement char (U+FFFD) and advance only 1 byte
|
|
1141
|
-
codePoint = 0xFFFD;
|
|
1142
|
-
bytesPerSequence = 1;
|
|
1143
|
-
} else if (codePoint > 0xFFFF) {
|
|
1144
|
-
// encode to utf16 (surrogate pair dance)
|
|
1145
|
-
codePoint -= 0x10000;
|
|
1146
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
1147
|
-
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
res.push(codePoint);
|
|
1151
|
-
i += bytesPerSequence;
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
return decodeCodePointsArray(res)
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
1158
|
-
// the lowest limit is Chrome, with 0x10000 args.
|
|
1159
|
-
// We go 1 magnitude less, for safety
|
|
1160
|
-
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
1161
|
-
|
|
1162
|
-
function decodeCodePointsArray (codePoints) {
|
|
1163
|
-
var len = codePoints.length;
|
|
1164
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
1165
|
-
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
// Decode in chunks to avoid "call stack size exceeded".
|
|
1169
|
-
var res = '';
|
|
1170
|
-
var i = 0;
|
|
1171
|
-
while (i < len) {
|
|
1172
|
-
res += String.fromCharCode.apply(
|
|
1173
|
-
String,
|
|
1174
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1175
|
-
);
|
|
1176
|
-
}
|
|
1177
|
-
return res
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
function asciiSlice (buf, start, end) {
|
|
1181
|
-
var ret = '';
|
|
1182
|
-
end = Math.min(buf.length, end);
|
|
1183
|
-
|
|
1184
|
-
for (var i = start; i < end; ++i) {
|
|
1185
|
-
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
1186
|
-
}
|
|
1187
|
-
return ret
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
function latin1Slice (buf, start, end) {
|
|
1191
|
-
var ret = '';
|
|
1192
|
-
end = Math.min(buf.length, end);
|
|
1193
|
-
|
|
1194
|
-
for (var i = start; i < end; ++i) {
|
|
1195
|
-
ret += String.fromCharCode(buf[i]);
|
|
1196
|
-
}
|
|
1197
|
-
return ret
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
function hexSlice (buf, start, end) {
|
|
1201
|
-
var len = buf.length;
|
|
1202
|
-
|
|
1203
|
-
if (!start || start < 0) start = 0;
|
|
1204
|
-
if (!end || end < 0 || end > len) end = len;
|
|
1205
|
-
|
|
1206
|
-
var out = '';
|
|
1207
|
-
for (var i = start; i < end; ++i) {
|
|
1208
|
-
out += toHex(buf[i]);
|
|
1209
|
-
}
|
|
1210
|
-
return out
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
function utf16leSlice (buf, start, end) {
|
|
1214
|
-
var bytes = buf.slice(start, end);
|
|
1215
|
-
var res = '';
|
|
1216
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
1217
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
1218
|
-
}
|
|
1219
|
-
return res
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
Buffer.prototype.slice = function slice (start, end) {
|
|
1223
|
-
var len = this.length;
|
|
1224
|
-
start = ~~start;
|
|
1225
|
-
end = end === undefined ? len : ~~end;
|
|
1226
|
-
|
|
1227
|
-
if (start < 0) {
|
|
1228
|
-
start += len;
|
|
1229
|
-
if (start < 0) start = 0;
|
|
1230
|
-
} else if (start > len) {
|
|
1231
|
-
start = len;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if (end < 0) {
|
|
1235
|
-
end += len;
|
|
1236
|
-
if (end < 0) end = 0;
|
|
1237
|
-
} else if (end > len) {
|
|
1238
|
-
end = len;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
if (end < start) end = start;
|
|
1242
|
-
|
|
1243
|
-
var newBuf;
|
|
1244
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1245
|
-
newBuf = this.subarray(start, end);
|
|
1246
|
-
newBuf.__proto__ = Buffer.prototype;
|
|
1247
|
-
} else {
|
|
1248
|
-
var sliceLen = end - start;
|
|
1249
|
-
newBuf = new Buffer(sliceLen, undefined);
|
|
1250
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
1251
|
-
newBuf[i] = this[i + start];
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
return newBuf
|
|
1256
|
-
};
|
|
1257
|
-
|
|
1258
|
-
/*
|
|
1259
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
1260
|
-
*/
|
|
1261
|
-
function checkOffset (offset, ext, length) {
|
|
1262
|
-
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
1263
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
1267
|
-
offset = offset | 0;
|
|
1268
|
-
byteLength = byteLength | 0;
|
|
1269
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
1270
|
-
|
|
1271
|
-
var val = this[offset];
|
|
1272
|
-
var mul = 1;
|
|
1273
|
-
var i = 0;
|
|
1274
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1275
|
-
val += this[offset + i] * mul;
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
return val
|
|
1279
|
-
};
|
|
1280
|
-
|
|
1281
|
-
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
1282
|
-
offset = offset | 0;
|
|
1283
|
-
byteLength = byteLength | 0;
|
|
1284
|
-
if (!noAssert) {
|
|
1285
|
-
checkOffset(offset, byteLength, this.length);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
var val = this[offset + --byteLength];
|
|
1289
|
-
var mul = 1;
|
|
1290
|
-
while (byteLength > 0 && (mul *= 0x100)) {
|
|
1291
|
-
val += this[offset + --byteLength] * mul;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
return val
|
|
1295
|
-
};
|
|
1296
|
-
|
|
1297
|
-
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
1298
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1299
|
-
return this[offset]
|
|
1300
|
-
};
|
|
1301
|
-
|
|
1302
|
-
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
1303
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1304
|
-
return this[offset] | (this[offset + 1] << 8)
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
|
-
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
1308
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1309
|
-
return (this[offset] << 8) | this[offset + 1]
|
|
1310
|
-
};
|
|
1311
|
-
|
|
1312
|
-
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
1313
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1314
|
-
|
|
1315
|
-
return ((this[offset]) |
|
|
1316
|
-
(this[offset + 1] << 8) |
|
|
1317
|
-
(this[offset + 2] << 16)) +
|
|
1318
|
-
(this[offset + 3] * 0x1000000)
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
1322
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1323
|
-
|
|
1324
|
-
return (this[offset] * 0x1000000) +
|
|
1325
|
-
((this[offset + 1] << 16) |
|
|
1326
|
-
(this[offset + 2] << 8) |
|
|
1327
|
-
this[offset + 3])
|
|
1328
|
-
};
|
|
1329
|
-
|
|
1330
|
-
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
1331
|
-
offset = offset | 0;
|
|
1332
|
-
byteLength = byteLength | 0;
|
|
1333
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
1334
|
-
|
|
1335
|
-
var val = this[offset];
|
|
1336
|
-
var mul = 1;
|
|
1337
|
-
var i = 0;
|
|
1338
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1339
|
-
val += this[offset + i] * mul;
|
|
1340
|
-
}
|
|
1341
|
-
mul *= 0x80;
|
|
1342
|
-
|
|
1343
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
1344
|
-
|
|
1345
|
-
return val
|
|
1346
|
-
};
|
|
1347
|
-
|
|
1348
|
-
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
1349
|
-
offset = offset | 0;
|
|
1350
|
-
byteLength = byteLength | 0;
|
|
1351
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
1352
|
-
|
|
1353
|
-
var i = byteLength;
|
|
1354
|
-
var mul = 1;
|
|
1355
|
-
var val = this[offset + --i];
|
|
1356
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
1357
|
-
val += this[offset + --i] * mul;
|
|
1358
|
-
}
|
|
1359
|
-
mul *= 0x80;
|
|
1360
|
-
|
|
1361
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
1362
|
-
|
|
1363
|
-
return val
|
|
1364
|
-
};
|
|
1365
|
-
|
|
1366
|
-
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
1367
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
1368
|
-
if (!(this[offset] & 0x80)) return (this[offset])
|
|
1369
|
-
return ((0xff - this[offset] + 1) * -1)
|
|
1370
|
-
};
|
|
1371
|
-
|
|
1372
|
-
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
1373
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1374
|
-
var val = this[offset] | (this[offset + 1] << 8);
|
|
1375
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1376
|
-
};
|
|
1377
|
-
|
|
1378
|
-
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
1379
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
1380
|
-
var val = this[offset + 1] | (this[offset] << 8);
|
|
1381
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1382
|
-
};
|
|
1383
|
-
|
|
1384
|
-
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
1385
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1386
|
-
|
|
1387
|
-
return (this[offset]) |
|
|
1388
|
-
(this[offset + 1] << 8) |
|
|
1389
|
-
(this[offset + 2] << 16) |
|
|
1390
|
-
(this[offset + 3] << 24)
|
|
1391
|
-
};
|
|
1392
|
-
|
|
1393
|
-
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
1394
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1395
|
-
|
|
1396
|
-
return (this[offset] << 24) |
|
|
1397
|
-
(this[offset + 1] << 16) |
|
|
1398
|
-
(this[offset + 2] << 8) |
|
|
1399
|
-
(this[offset + 3])
|
|
1400
|
-
};
|
|
1401
|
-
|
|
1402
|
-
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
1403
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1404
|
-
return read(this, offset, true, 23, 4)
|
|
1405
|
-
};
|
|
1406
|
-
|
|
1407
|
-
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
1408
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
1409
|
-
return read(this, offset, false, 23, 4)
|
|
1410
|
-
};
|
|
1411
|
-
|
|
1412
|
-
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
1413
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1414
|
-
return read(this, offset, true, 52, 8)
|
|
1415
|
-
};
|
|
1416
|
-
|
|
1417
|
-
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
1418
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
1419
|
-
return read(this, offset, false, 52, 8)
|
|
1420
|
-
};
|
|
1421
|
-
|
|
1422
|
-
function checkInt (buf, value, offset, ext, max, min) {
|
|
1423
|
-
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
1424
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
1425
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
1429
|
-
value = +value;
|
|
1430
|
-
offset = offset | 0;
|
|
1431
|
-
byteLength = byteLength | 0;
|
|
1432
|
-
if (!noAssert) {
|
|
1433
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
1434
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
var mul = 1;
|
|
1438
|
-
var i = 0;
|
|
1439
|
-
this[offset] = value & 0xFF;
|
|
1440
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1441
|
-
this[offset + i] = (value / mul) & 0xFF;
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
return offset + byteLength
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
1448
|
-
value = +value;
|
|
1449
|
-
offset = offset | 0;
|
|
1450
|
-
byteLength = byteLength | 0;
|
|
1451
|
-
if (!noAssert) {
|
|
1452
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
1453
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
var i = byteLength - 1;
|
|
1457
|
-
var mul = 1;
|
|
1458
|
-
this[offset + i] = value & 0xFF;
|
|
1459
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
1460
|
-
this[offset + i] = (value / mul) & 0xFF;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
return offset + byteLength
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
1467
|
-
value = +value;
|
|
1468
|
-
offset = offset | 0;
|
|
1469
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
1470
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
1471
|
-
this[offset] = (value & 0xff);
|
|
1472
|
-
return offset + 1
|
|
1473
|
-
};
|
|
1474
|
-
|
|
1475
|
-
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
|
1476
|
-
if (value < 0) value = 0xffff + value + 1;
|
|
1477
|
-
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
1478
|
-
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
|
1479
|
-
(littleEndian ? i : 1 - i) * 8;
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
1484
|
-
value = +value;
|
|
1485
|
-
offset = offset | 0;
|
|
1486
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
1487
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1488
|
-
this[offset] = (value & 0xff);
|
|
1489
|
-
this[offset + 1] = (value >>> 8);
|
|
1490
|
-
} else {
|
|
1491
|
-
objectWriteUInt16(this, value, offset, true);
|
|
1492
|
-
}
|
|
1493
|
-
return offset + 2
|
|
1494
|
-
};
|
|
1495
|
-
|
|
1496
|
-
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
1497
|
-
value = +value;
|
|
1498
|
-
offset = offset | 0;
|
|
1499
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
1500
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1501
|
-
this[offset] = (value >>> 8);
|
|
1502
|
-
this[offset + 1] = (value & 0xff);
|
|
1503
|
-
} else {
|
|
1504
|
-
objectWriteUInt16(this, value, offset, false);
|
|
1505
|
-
}
|
|
1506
|
-
return offset + 2
|
|
1507
|
-
};
|
|
1508
|
-
|
|
1509
|
-
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
|
1510
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
1511
|
-
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
1512
|
-
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
1517
|
-
value = +value;
|
|
1518
|
-
offset = offset | 0;
|
|
1519
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
1520
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1521
|
-
this[offset + 3] = (value >>> 24);
|
|
1522
|
-
this[offset + 2] = (value >>> 16);
|
|
1523
|
-
this[offset + 1] = (value >>> 8);
|
|
1524
|
-
this[offset] = (value & 0xff);
|
|
1525
|
-
} else {
|
|
1526
|
-
objectWriteUInt32(this, value, offset, true);
|
|
1527
|
-
}
|
|
1528
|
-
return offset + 4
|
|
1529
|
-
};
|
|
1530
|
-
|
|
1531
|
-
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
1532
|
-
value = +value;
|
|
1533
|
-
offset = offset | 0;
|
|
1534
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
1535
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1536
|
-
this[offset] = (value >>> 24);
|
|
1537
|
-
this[offset + 1] = (value >>> 16);
|
|
1538
|
-
this[offset + 2] = (value >>> 8);
|
|
1539
|
-
this[offset + 3] = (value & 0xff);
|
|
1540
|
-
} else {
|
|
1541
|
-
objectWriteUInt32(this, value, offset, false);
|
|
1542
|
-
}
|
|
1543
|
-
return offset + 4
|
|
1544
|
-
};
|
|
1545
|
-
|
|
1546
|
-
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
1547
|
-
value = +value;
|
|
1548
|
-
offset = offset | 0;
|
|
1549
|
-
if (!noAssert) {
|
|
1550
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
1551
|
-
|
|
1552
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
var i = 0;
|
|
1556
|
-
var mul = 1;
|
|
1557
|
-
var sub = 0;
|
|
1558
|
-
this[offset] = value & 0xFF;
|
|
1559
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1560
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
1561
|
-
sub = 1;
|
|
1562
|
-
}
|
|
1563
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
return offset + byteLength
|
|
1567
|
-
};
|
|
1568
|
-
|
|
1569
|
-
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
1570
|
-
value = +value;
|
|
1571
|
-
offset = offset | 0;
|
|
1572
|
-
if (!noAssert) {
|
|
1573
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
1574
|
-
|
|
1575
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
var i = byteLength - 1;
|
|
1579
|
-
var mul = 1;
|
|
1580
|
-
var sub = 0;
|
|
1581
|
-
this[offset + i] = value & 0xFF;
|
|
1582
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
1583
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
1584
|
-
sub = 1;
|
|
1585
|
-
}
|
|
1586
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
return offset + byteLength
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
1593
|
-
value = +value;
|
|
1594
|
-
offset = offset | 0;
|
|
1595
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
|
|
1596
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
1597
|
-
if (value < 0) value = 0xff + value + 1;
|
|
1598
|
-
this[offset] = (value & 0xff);
|
|
1599
|
-
return offset + 1
|
|
1600
|
-
};
|
|
1601
|
-
|
|
1602
|
-
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
1603
|
-
value = +value;
|
|
1604
|
-
offset = offset | 0;
|
|
1605
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
|
|
1606
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1607
|
-
this[offset] = (value & 0xff);
|
|
1608
|
-
this[offset + 1] = (value >>> 8);
|
|
1609
|
-
} else {
|
|
1610
|
-
objectWriteUInt16(this, value, offset, true);
|
|
1611
|
-
}
|
|
1612
|
-
return offset + 2
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
1616
|
-
value = +value;
|
|
1617
|
-
offset = offset | 0;
|
|
1618
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
|
|
1619
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1620
|
-
this[offset] = (value >>> 8);
|
|
1621
|
-
this[offset + 1] = (value & 0xff);
|
|
1622
|
-
} else {
|
|
1623
|
-
objectWriteUInt16(this, value, offset, false);
|
|
1624
|
-
}
|
|
1625
|
-
return offset + 2
|
|
1626
|
-
};
|
|
1627
|
-
|
|
1628
|
-
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
1629
|
-
value = +value;
|
|
1630
|
-
offset = offset | 0;
|
|
1631
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
|
|
1632
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1633
|
-
this[offset] = (value & 0xff);
|
|
1634
|
-
this[offset + 1] = (value >>> 8);
|
|
1635
|
-
this[offset + 2] = (value >>> 16);
|
|
1636
|
-
this[offset + 3] = (value >>> 24);
|
|
1637
|
-
} else {
|
|
1638
|
-
objectWriteUInt32(this, value, offset, true);
|
|
1639
|
-
}
|
|
1640
|
-
return offset + 4
|
|
1641
|
-
};
|
|
1642
|
-
|
|
1643
|
-
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
1644
|
-
value = +value;
|
|
1645
|
-
offset = offset | 0;
|
|
1646
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
|
|
1647
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
1648
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1649
|
-
this[offset] = (value >>> 24);
|
|
1650
|
-
this[offset + 1] = (value >>> 16);
|
|
1651
|
-
this[offset + 2] = (value >>> 8);
|
|
1652
|
-
this[offset + 3] = (value & 0xff);
|
|
1653
|
-
} else {
|
|
1654
|
-
objectWriteUInt32(this, value, offset, false);
|
|
1655
|
-
}
|
|
1656
|
-
return offset + 4
|
|
1657
|
-
};
|
|
1658
|
-
|
|
1659
|
-
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
1660
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1661
|
-
if (offset < 0) throw new RangeError('Index out of range')
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
1665
|
-
if (!noAssert) {
|
|
1666
|
-
checkIEEE754(buf, value, offset, 4);
|
|
1667
|
-
}
|
|
1668
|
-
write(buf, value, offset, littleEndian, 23, 4);
|
|
1669
|
-
return offset + 4
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
1673
|
-
return writeFloat(this, value, offset, true, noAssert)
|
|
1674
|
-
};
|
|
1675
|
-
|
|
1676
|
-
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
1677
|
-
return writeFloat(this, value, offset, false, noAssert)
|
|
1678
|
-
};
|
|
1679
|
-
|
|
1680
|
-
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
1681
|
-
if (!noAssert) {
|
|
1682
|
-
checkIEEE754(buf, value, offset, 8);
|
|
1683
|
-
}
|
|
1684
|
-
write(buf, value, offset, littleEndian, 52, 8);
|
|
1685
|
-
return offset + 8
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
1689
|
-
return writeDouble(this, value, offset, true, noAssert)
|
|
1690
|
-
};
|
|
1691
|
-
|
|
1692
|
-
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
1693
|
-
return writeDouble(this, value, offset, false, noAssert)
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
1697
|
-
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
1698
|
-
if (!start) start = 0;
|
|
1699
|
-
if (!end && end !== 0) end = this.length;
|
|
1700
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
1701
|
-
if (!targetStart) targetStart = 0;
|
|
1702
|
-
if (end > 0 && end < start) end = start;
|
|
1703
|
-
|
|
1704
|
-
// Copy 0 bytes; we're done
|
|
1705
|
-
if (end === start) return 0
|
|
1706
|
-
if (target.length === 0 || this.length === 0) return 0
|
|
1707
|
-
|
|
1708
|
-
// Fatal error conditions
|
|
1709
|
-
if (targetStart < 0) {
|
|
1710
|
-
throw new RangeError('targetStart out of bounds')
|
|
1711
|
-
}
|
|
1712
|
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
1713
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
1714
|
-
|
|
1715
|
-
// Are we oob?
|
|
1716
|
-
if (end > this.length) end = this.length;
|
|
1717
|
-
if (target.length - targetStart < end - start) {
|
|
1718
|
-
end = target.length - targetStart + start;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
var len = end - start;
|
|
1722
|
-
var i;
|
|
3
|
+
import { i as inflate_1 } from './pako.esm-CPorU236.js';
|
|
4
|
+
import './constants-hboFofU4.js';
|
|
5
|
+
import { B as Buffer, a as BaseDecoder, L as LercParameters, b as LercAddCompression } from './map-draw-Cx9WZoKH.js';
|
|
6
|
+
import './index-ICfDNUMe.js';
|
|
7
|
+
import './tools-BNYKV5H5.js';
|
|
8
|
+
import './config-CWfV1nKn.js';
|
|
9
|
+
import './utils-BCUZxI9u.js';
|
|
10
|
+
import './store-CcqrFuBK.js';
|
|
1723
11
|
|
|
1724
|
-
|
|
1725
|
-
// descending copy from end
|
|
1726
|
-
for (i = len - 1; i >= 0; --i) {
|
|
1727
|
-
target[i + targetStart] = this[i + start];
|
|
1728
|
-
}
|
|
1729
|
-
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1730
|
-
// ascending copy from start
|
|
1731
|
-
for (i = 0; i < len; ++i) {
|
|
1732
|
-
target[i + targetStart] = this[i + start];
|
|
1733
|
-
}
|
|
1734
|
-
} else {
|
|
1735
|
-
Uint8Array.prototype.set.call(
|
|
1736
|
-
target,
|
|
1737
|
-
this.subarray(start, start + len),
|
|
1738
|
-
targetStart
|
|
1739
|
-
);
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
return len
|
|
1743
|
-
};
|
|
1744
|
-
|
|
1745
|
-
// Usage:
|
|
1746
|
-
// buffer.fill(number[, offset[, end]])
|
|
1747
|
-
// buffer.fill(buffer[, offset[, end]])
|
|
1748
|
-
// buffer.fill(string[, offset[, end]][, encoding])
|
|
1749
|
-
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
1750
|
-
// Handle string cases:
|
|
1751
|
-
if (typeof val === 'string') {
|
|
1752
|
-
if (typeof start === 'string') {
|
|
1753
|
-
encoding = start;
|
|
1754
|
-
start = 0;
|
|
1755
|
-
end = this.length;
|
|
1756
|
-
} else if (typeof end === 'string') {
|
|
1757
|
-
encoding = end;
|
|
1758
|
-
end = this.length;
|
|
1759
|
-
}
|
|
1760
|
-
if (val.length === 1) {
|
|
1761
|
-
var code = val.charCodeAt(0);
|
|
1762
|
-
if (code < 256) {
|
|
1763
|
-
val = code;
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
1767
|
-
throw new TypeError('encoding must be a string')
|
|
1768
|
-
}
|
|
1769
|
-
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
1770
|
-
throw new TypeError('Unknown encoding: ' + encoding)
|
|
1771
|
-
}
|
|
1772
|
-
} else if (typeof val === 'number') {
|
|
1773
|
-
val = val & 255;
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
1777
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
1778
|
-
throw new RangeError('Out of range index')
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
if (end <= start) {
|
|
1782
|
-
return this
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
start = start >>> 0;
|
|
1786
|
-
end = end === undefined ? this.length : end >>> 0;
|
|
1787
|
-
|
|
1788
|
-
if (!val) val = 0;
|
|
1789
|
-
|
|
1790
|
-
var i;
|
|
1791
|
-
if (typeof val === 'number') {
|
|
1792
|
-
for (i = start; i < end; ++i) {
|
|
1793
|
-
this[i] = val;
|
|
1794
|
-
}
|
|
1795
|
-
} else {
|
|
1796
|
-
var bytes = internalIsBuffer(val)
|
|
1797
|
-
? val
|
|
1798
|
-
: utf8ToBytes(new Buffer(val, encoding).toString());
|
|
1799
|
-
var len = bytes.length;
|
|
1800
|
-
for (i = 0; i < end - start; ++i) {
|
|
1801
|
-
this[i + start] = bytes[i % len];
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
return this
|
|
1806
|
-
};
|
|
1807
|
-
|
|
1808
|
-
// HELPER FUNCTIONS
|
|
1809
|
-
// ================
|
|
1810
|
-
|
|
1811
|
-
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
1812
|
-
|
|
1813
|
-
function base64clean (str) {
|
|
1814
|
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
1815
|
-
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
|
|
1816
|
-
// Node converts strings with length < 2 to ''
|
|
1817
|
-
if (str.length < 2) return ''
|
|
1818
|
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
1819
|
-
while (str.length % 4 !== 0) {
|
|
1820
|
-
str = str + '=';
|
|
1821
|
-
}
|
|
1822
|
-
return str
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
function stringtrim (str) {
|
|
1826
|
-
if (str.trim) return str.trim()
|
|
1827
|
-
return str.replace(/^\s+|\s+$/g, '')
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
function toHex (n) {
|
|
1831
|
-
if (n < 16) return '0' + n.toString(16)
|
|
1832
|
-
return n.toString(16)
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
function utf8ToBytes (string, units) {
|
|
1836
|
-
units = units || Infinity;
|
|
1837
|
-
var codePoint;
|
|
1838
|
-
var length = string.length;
|
|
1839
|
-
var leadSurrogate = null;
|
|
1840
|
-
var bytes = [];
|
|
1841
|
-
|
|
1842
|
-
for (var i = 0; i < length; ++i) {
|
|
1843
|
-
codePoint = string.charCodeAt(i);
|
|
1844
|
-
|
|
1845
|
-
// is surrogate component
|
|
1846
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
1847
|
-
// last char was a lead
|
|
1848
|
-
if (!leadSurrogate) {
|
|
1849
|
-
// no lead yet
|
|
1850
|
-
if (codePoint > 0xDBFF) {
|
|
1851
|
-
// unexpected trail
|
|
1852
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
1853
|
-
continue
|
|
1854
|
-
} else if (i + 1 === length) {
|
|
1855
|
-
// unpaired lead
|
|
1856
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
1857
|
-
continue
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
// valid lead
|
|
1861
|
-
leadSurrogate = codePoint;
|
|
1862
|
-
|
|
1863
|
-
continue
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
// 2 leads in a row
|
|
1867
|
-
if (codePoint < 0xDC00) {
|
|
1868
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
1869
|
-
leadSurrogate = codePoint;
|
|
1870
|
-
continue
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
// valid surrogate pair
|
|
1874
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
1875
|
-
} else if (leadSurrogate) {
|
|
1876
|
-
// valid bmp char, but last char was a lead
|
|
1877
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
leadSurrogate = null;
|
|
1881
|
-
|
|
1882
|
-
// encode utf8
|
|
1883
|
-
if (codePoint < 0x80) {
|
|
1884
|
-
if ((units -= 1) < 0) break
|
|
1885
|
-
bytes.push(codePoint);
|
|
1886
|
-
} else if (codePoint < 0x800) {
|
|
1887
|
-
if ((units -= 2) < 0) break
|
|
1888
|
-
bytes.push(
|
|
1889
|
-
codePoint >> 0x6 | 0xC0,
|
|
1890
|
-
codePoint & 0x3F | 0x80
|
|
1891
|
-
);
|
|
1892
|
-
} else if (codePoint < 0x10000) {
|
|
1893
|
-
if ((units -= 3) < 0) break
|
|
1894
|
-
bytes.push(
|
|
1895
|
-
codePoint >> 0xC | 0xE0,
|
|
1896
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
1897
|
-
codePoint & 0x3F | 0x80
|
|
1898
|
-
);
|
|
1899
|
-
} else if (codePoint < 0x110000) {
|
|
1900
|
-
if ((units -= 4) < 0) break
|
|
1901
|
-
bytes.push(
|
|
1902
|
-
codePoint >> 0x12 | 0xF0,
|
|
1903
|
-
codePoint >> 0xC & 0x3F | 0x80,
|
|
1904
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
1905
|
-
codePoint & 0x3F | 0x80
|
|
1906
|
-
);
|
|
1907
|
-
} else {
|
|
1908
|
-
throw new Error('Invalid code point')
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
return bytes
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
function asciiToBytes (str) {
|
|
1916
|
-
var byteArray = [];
|
|
1917
|
-
for (var i = 0; i < str.length; ++i) {
|
|
1918
|
-
// Node's code seems to be doing this and not & 0x7F..
|
|
1919
|
-
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
1920
|
-
}
|
|
1921
|
-
return byteArray
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
function utf16leToBytes (str, units) {
|
|
1925
|
-
var c, hi, lo;
|
|
1926
|
-
var byteArray = [];
|
|
1927
|
-
for (var i = 0; i < str.length; ++i) {
|
|
1928
|
-
if ((units -= 2) < 0) break
|
|
1929
|
-
|
|
1930
|
-
c = str.charCodeAt(i);
|
|
1931
|
-
hi = c >> 8;
|
|
1932
|
-
lo = c % 256;
|
|
1933
|
-
byteArray.push(lo);
|
|
1934
|
-
byteArray.push(hi);
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
return byteArray
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
function base64ToBytes (str) {
|
|
1942
|
-
return toByteArray(base64clean(str))
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
function blitBuffer (src, dst, offset, length) {
|
|
1946
|
-
for (var i = 0; i < length; ++i) {
|
|
1947
|
-
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
1948
|
-
dst[i + offset] = src[i];
|
|
1949
|
-
}
|
|
1950
|
-
return i
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
function isnan (val) {
|
|
1954
|
-
return val !== val // eslint-disable-line no-self-compare
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
|
1959
|
-
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|
1960
|
-
// Object.prototype.constructor. Remove this eventually
|
|
1961
|
-
function isBuffer(obj) {
|
|
1962
|
-
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
function isFastBuffer (obj) {
|
|
1966
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
// For Node v0.10 support. Remove this eventually.
|
|
1970
|
-
function isSlowBuffer (obj) {
|
|
1971
|
-
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
|
|
1972
|
-
}
|
|
1973
|
-
|
|
1974
|
-
var LercDecode = {exports: {}};
|
|
12
|
+
var LercDecode$1 = {exports: {}};
|
|
1975
13
|
|
|
1976
14
|
/* jshint forin: false, bitwise: false */
|
|
15
|
+
var LercDecode = LercDecode$1.exports;
|
|
1977
16
|
|
|
1978
17
|
var hasRequiredLercDecode;
|
|
1979
18
|
|
|
1980
19
|
function requireLercDecode () {
|
|
1981
|
-
if (hasRequiredLercDecode) return LercDecode.exports;
|
|
20
|
+
if (hasRequiredLercDecode) return LercDecode$1.exports;
|
|
1982
21
|
hasRequiredLercDecode = 1;
|
|
1983
22
|
(function (module) {
|
|
1984
23
|
/*
|
|
@@ -2024,7 +63,7 @@ function requireLercDecode () {
|
|
|
2024
63
|
|
|
2025
64
|
var CntZImage = {};
|
|
2026
65
|
|
|
2027
|
-
CntZImage.defaultNoDataValue = -
|
|
66
|
+
CntZImage.defaultNoDataValue = -3.4027999387901484e+38; // smallest Float32 value
|
|
2028
67
|
|
|
2029
68
|
/**
|
|
2030
69
|
* Decode a LERC byte stream and return an object containing the pixel data and some required and optional
|
|
@@ -2454,6 +493,7 @@ function requireLercDecode () {
|
|
|
2454
493
|
|
|
2455
494
|
//version 2. Supports 2.1, 2.2, 2.3
|
|
2456
495
|
var Lerc2Decode = (function() {
|
|
496
|
+
"use strict";
|
|
2457
497
|
// Note: currently, this module only has an implementation for decoding LERC data, not encoding. The name of
|
|
2458
498
|
// the class was chosen to be future proof, following LercDecode.
|
|
2459
499
|
|
|
@@ -3341,11 +1381,12 @@ function requireLercDecode () {
|
|
|
3341
1381
|
//offset = offset || 0;
|
|
3342
1382
|
var scale = 2 * headerInfo.maxZError;
|
|
3343
1383
|
var stuffedData, arrayBuf, store8, dataBytes, dataWords;
|
|
3344
|
-
var lutArr, lutData, lutBytes, bitsPerPixel;
|
|
1384
|
+
var lutArr, lutData, lutBytes, lutBitsPerElement, bitsPerPixel;
|
|
3345
1385
|
var zMax = headerInfo.numDims > 1 ? headerInfo.maxValues[iDim] : headerInfo.zMax;
|
|
3346
1386
|
if (doLut) {
|
|
3347
1387
|
data.counter.lut++;
|
|
3348
1388
|
lutBytes = view.getUint8(blockPtr);
|
|
1389
|
+
lutBitsPerElement = numBits;
|
|
3349
1390
|
blockPtr++;
|
|
3350
1391
|
dataBytes = Math.ceil((lutBytes - 1) * numBits / 8);
|
|
3351
1392
|
dataWords = Math.ceil(dataBytes / 4);
|
|
@@ -3831,10 +1872,10 @@ function requireLercDecode () {
|
|
|
3831
1872
|
isValid = val >= 0 && val <= 4294967296;
|
|
3832
1873
|
break;
|
|
3833
1874
|
case 6:
|
|
3834
|
-
isValid = val >= -
|
|
1875
|
+
isValid = val >= -3.4027999387901484e+38 && val <= 3.4027999387901484e+38;
|
|
3835
1876
|
break;
|
|
3836
1877
|
case 7:
|
|
3837
|
-
isValid = val >= -
|
|
1878
|
+
isValid = val >= -1.7976931348623157e+308 && val <= 1.7976931348623157e+308;
|
|
3838
1879
|
break;
|
|
3839
1880
|
default:
|
|
3840
1881
|
isValid = false;
|
|
@@ -4286,7 +2327,12 @@ function requireLercDecode () {
|
|
|
4286
2327
|
}
|
|
4287
2328
|
};
|
|
4288
2329
|
|
|
4289
|
-
if (
|
|
2330
|
+
if (typeof undefined === "function" && undefined.amd) {/* jshint ignore:line */
|
|
2331
|
+
//amd loaders such as dojo and requireJS
|
|
2332
|
+
//http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition
|
|
2333
|
+
undefined([], function() { return Lerc; });/* jshint ignore:line */
|
|
2334
|
+
}
|
|
2335
|
+
else if ('object' !== "undefined" && module.exports) {/* jshint ignore:line */
|
|
4290
2336
|
//commonJS module 1.0/1.1/1.1.1 systems, such as nodeJS
|
|
4291
2337
|
//http://wiki.commonjs.org/wiki/Modules
|
|
4292
2338
|
module.exports = Lerc;/* jshint ignore:line */
|
|
@@ -4297,8 +2343,8 @@ function requireLercDecode () {
|
|
|
4297
2343
|
}
|
|
4298
2344
|
|
|
4299
2345
|
})();
|
|
4300
|
-
} (LercDecode));
|
|
4301
|
-
return LercDecode.exports;
|
|
2346
|
+
} (LercDecode$1));
|
|
2347
|
+
return LercDecode$1.exports;
|
|
4302
2348
|
}
|
|
4303
2349
|
|
|
4304
2350
|
var LercDecodeExports = requireLercDecode();
|
|
@@ -4418,6 +2464,6 @@ class LercDecoder extends BaseDecoder {
|
|
|
4418
2464
|
}
|
|
4419
2465
|
|
|
4420
2466
|
export { LercDecoder as default, zstd };
|
|
4421
|
-
//# sourceMappingURL=
|
|
2467
|
+
//# sourceMappingURL=lerc-7W4E8EBs.js.map
|
|
4422
2468
|
|
|
4423
|
-
//# sourceMappingURL=
|
|
2469
|
+
//# sourceMappingURL=lerc-7W4E8EBs.js.map
|