zhui-plus 1.0.0 → 1.0.10
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.
Potentially problematic release.
This version of zhui-plus might be problematic. Click here for more details.
- package/dist/Heatmap.js +689 -0
- package/dist/WSPlayer/PlaySDKInterface.js +1 -0
- package/dist/WSPlayer/WSPlayer.js +1 -0
- package/dist/WSPlayer/audioTalkWorker.js +1 -0
- package/dist/WSPlayer/commonThread/libH264Enc.js +21 -0
- package/dist/WSPlayer/commonThread/libH264Enc.wasm +0 -0
- package/dist/WSPlayer/commonThread/libIVSDrawer.js +21 -0
- package/dist/WSPlayer/commonThread/libIVSDrawer.wasm +0 -0
- package/dist/WSPlayer/commonThread/libRenderEngine.js +21 -0
- package/dist/WSPlayer/commonThread/libRenderEngine.wasm +0 -0
- package/dist/WSPlayer/commonThread/libmavasp_litepacket.data +50 -0
- package/dist/WSPlayer/commonThread/libmavasp_litepacket.js +21 -0
- package/dist/WSPlayer/commonThread/libmavasp_litepacket.wasm +0 -0
- package/dist/WSPlayer/icon/IotComboBackGround-alarm.png +0 -0
- package/dist/WSPlayer/icon/IotComboBackGround.png +0 -0
- package/dist/WSPlayer/icon/RecordHover.svg +13 -0
- package/dist/WSPlayer/icon/RecordNormal.svg +13 -0
- package/dist/WSPlayer/icon/Recording.svg +15 -0
- package/dist/WSPlayer/icon/arrow-b.svg +9 -0
- package/dist/WSPlayer/icon/arrow-l.svg +9 -0
- package/dist/WSPlayer/icon/arrow-lb.svg +10 -0
- package/dist/WSPlayer/icon/arrow-lt.svg +10 -0
- package/dist/WSPlayer/icon/arrow-r.svg +9 -0
- package/dist/WSPlayer/icon/arrow-rb.svg +10 -0
- package/dist/WSPlayer/icon/arrow-rt.svg +10 -0
- package/dist/WSPlayer/icon/arrow-t.svg +9 -0
- package/dist/WSPlayer/icon/close-all-hover.svg +18 -0
- package/dist/WSPlayer/icon/close-all.svg +18 -0
- package/dist/WSPlayer/icon/close.svg +16 -0
- package/dist/WSPlayer/icon/close_hover.svg +16 -0
- package/dist/WSPlayer/icon/default.png +0 -0
- package/dist/WSPlayer/icon/draw-triangle_off.svg +14 -0
- package/dist/WSPlayer/icon/draw-triangle_off_hover.svg +14 -0
- package/dist/WSPlayer/icon/draw-triangle_on.svg +15 -0
- package/dist/WSPlayer/icon/draw-triangle_on_hover.svg +15 -0
- package/dist/WSPlayer/icon/drops.png +0 -0
- package/dist/WSPlayer/icon/fullscreen-hover.svg +13 -0
- package/dist/WSPlayer/icon/fullscreen.svg +13 -0
- package/dist/WSPlayer/icon/hide-pantilt-on.svg +13 -0
- package/dist/WSPlayer/icon/hide-pantilt.svg +13 -0
- package/dist/WSPlayer/icon/mobile-speed-control-icon.svg +13 -0
- package/dist/WSPlayer/icon/more.svg +13 -0
- package/dist/WSPlayer/icon/play-h.png +0 -0
- package/dist/WSPlayer/icon/play-n.png +0 -0
- package/dist/WSPlayer/icon/play-p.png +0 -0
- package/dist/WSPlayer/icon/ptz-icon1.svg +4 -0
- package/dist/WSPlayer/icon/ptz-icon2.svg +13 -0
- package/dist/WSPlayer/icon/ptz-icon3.svg +10 -0
- package/dist/WSPlayer/icon/ptz-icon4.svg +10 -0
- package/dist/WSPlayer/icon/ptz-icon5.svg +12 -0
- package/dist/WSPlayer/icon/ptz-icon6.svg +14 -0
- package/dist/WSPlayer/icon/ptz-select-hover.svg +3 -0
- package/dist/WSPlayer/icon/ptz-select.svg +3 -0
- package/dist/WSPlayer/icon/record_pause.svg +5 -0
- package/dist/WSPlayer/icon/record_play.svg +5 -0
- package/dist/WSPlayer/icon/refresh-replay.svg +11 -0
- package/dist/WSPlayer/icon/refresh-replay_hover.svg +11 -0
- package/dist/WSPlayer/icon/screen-more-icon.svg +15 -0
- package/dist/WSPlayer/icon/screen_1.svg +11 -0
- package/dist/WSPlayer/icon/screen_16.svg +18 -0
- package/dist/WSPlayer/icon/screen_16_hover.svg +18 -0
- package/dist/WSPlayer/icon/screen_1_hover.svg +11 -0
- package/dist/WSPlayer/icon/screen_2.svg +18 -0
- package/dist/WSPlayer/icon/screen_25.svg +19 -0
- package/dist/WSPlayer/icon/screen_25_hover.svg +19 -0
- package/dist/WSPlayer/icon/screen_2_hover.svg +18 -0
- package/dist/WSPlayer/icon/screen_3.svg +13 -0
- package/dist/WSPlayer/icon/screen_3_hover.svg +13 -0
- package/dist/WSPlayer/icon/screen_4.svg +12 -0
- package/dist/WSPlayer/icon/screen_4_hover.svg +12 -0
- package/dist/WSPlayer/icon/screen_6.svg +16 -0
- package/dist/WSPlayer/icon/screen_6_hover.svg +16 -0
- package/dist/WSPlayer/icon/screen_8.svg +18 -0
- package/dist/WSPlayer/icon/screen_8_hover.svg +18 -0
- package/dist/WSPlayer/icon/screen_9.svg +17 -0
- package/dist/WSPlayer/icon/screen_9_hover.svg +17 -0
- package/dist/WSPlayer/icon/screen_custom_division.svg +9 -0
- package/dist/WSPlayer/icon/screen_custom_division_hover.svg +9 -0
- package/dist/WSPlayer/icon/screen_custom_division_merge.svg +3 -0
- package/dist/WSPlayer/icon/screen_custom_division_split.svg +6 -0
- package/dist/WSPlayer/icon/snapshot.svg +38 -0
- package/dist/WSPlayer/icon/snapshot_hover.svg +38 -0
- package/dist/WSPlayer/icon/speed_left.svg +15 -0
- package/dist/WSPlayer/icon/speed_right.svg +15 -0
- package/dist/WSPlayer/icon/spread.png +0 -0
- package/dist/WSPlayer/icon/tag-left-alarm.png +0 -0
- package/dist/WSPlayer/icon/tag-left-normal.png +0 -0
- package/dist/WSPlayer/icon/tag-middle-alarm.png +0 -0
- package/dist/WSPlayer/icon/tag-middle-normal.png +0 -0
- package/dist/WSPlayer/icon/tag-right-alarm.png +0 -0
- package/dist/WSPlayer/icon/tag-right-normal.png +0 -0
- package/dist/WSPlayer/icon/talk-off-hover.svg +11 -0
- package/dist/WSPlayer/icon/talk-off.svg +11 -0
- package/dist/WSPlayer/icon/talk-on.svg +9 -0
- package/dist/WSPlayer/icon/voice-have.svg +43 -0
- package/dist/WSPlayer/icon/voice-have_hover.svg +43 -0
- package/dist/WSPlayer/icon/voice-null.svg +38 -0
- package/dist/WSPlayer/icon/voice-null_hover.svg +38 -0
- package/dist/WSPlayer/icon/ws-ctrl-ellipsis-hover.svg +14 -0
- package/dist/WSPlayer/icon/ws-ctrl-ellipsis.svg +14 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-b-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-l-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-lb-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-lt-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-r-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-rb-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-rt-bg.png +0 -0
- package/dist/WSPlayer/icon/wsplayer-mobile-pantilt-t-bg.png +0 -0
- package/dist/WSPlayer/jquery-3.6.0.min.js +2 -0
- package/dist/WSPlayer/multiThread/libStreamClient.js +21 -0
- package/dist/WSPlayer/multiThread/libStreamClient.wasm +0 -0
- package/dist/WSPlayer/multiThread/libStreamClient.worker.js +1 -0
- package/dist/WSPlayer/multiThread/libplay.data +0 -0
- package/dist/WSPlayer/multiThread/libplay.js +1 -0
- package/dist/WSPlayer/multiThread/libplay.wasm +0 -0
- package/dist/WSPlayer/multiThread/libplay.worker.js +1 -0
- package/dist/WSPlayer/player.css +1490 -0
- package/dist/WSPlayer/singleThread/VideoDecodeWorker.js +1439 -0
- package/dist/WSPlayer/singleThread/libStreamClient.js +21 -0
- package/dist/WSPlayer/singleThread/libStreamClient.wasm +0 -0
- package/dist/WSPlayer/singleThread/libplay.data +0 -0
- package/dist/WSPlayer/singleThread/libplay.js +1 -0
- package/dist/WSPlayer/singleThread/libplay.wasm +0 -0
- package/dist/WSPlayer/window.division.css +80 -0
- package/dist/index.js +467 -0
- package/dist/locale/af.js +193 -0
- package/dist/locale/af.min.js +3 -0
- package/dist/locale/af.min.js.map +1 -0
- package/dist/locale/af.min.mjs +3 -0
- package/dist/locale/af.min.mjs.map +1 -0
- package/dist/locale/af.mjs +186 -0
- package/dist/locale/ar-eg.js +193 -0
- package/dist/locale/ar-eg.min.js +3 -0
- package/dist/locale/ar-eg.min.js.map +1 -0
- package/dist/locale/ar-eg.min.mjs +3 -0
- package/dist/locale/ar-eg.min.mjs.map +1 -0
- package/dist/locale/ar-eg.mjs +186 -0
- package/dist/locale/ar.js +193 -0
- package/dist/locale/ar.min.js +3 -0
- package/dist/locale/ar.min.js.map +1 -0
- package/dist/locale/ar.min.mjs +3 -0
- package/dist/locale/ar.min.mjs.map +1 -0
- package/dist/locale/ar.mjs +186 -0
- package/dist/locale/az.js +194 -0
- package/dist/locale/az.min.js +3 -0
- package/dist/locale/az.min.js.map +1 -0
- package/dist/locale/az.min.mjs +3 -0
- package/dist/locale/az.min.mjs.map +1 -0
- package/dist/locale/az.mjs +187 -0
- package/dist/locale/bg.js +193 -0
- package/dist/locale/bg.min.js +3 -0
- package/dist/locale/bg.min.js.map +1 -0
- package/dist/locale/bg.min.mjs +3 -0
- package/dist/locale/bg.min.mjs.map +1 -0
- package/dist/locale/bg.mjs +186 -0
- package/dist/locale/bn.js +193 -0
- package/dist/locale/bn.min.js +3 -0
- package/dist/locale/bn.min.js.map +1 -0
- package/dist/locale/bn.min.mjs +3 -0
- package/dist/locale/bn.min.mjs.map +1 -0
- package/dist/locale/bn.mjs +186 -0
- package/dist/locale/ca.js +193 -0
- package/dist/locale/ca.min.js +3 -0
- package/dist/locale/ca.min.js.map +1 -0
- package/dist/locale/ca.min.mjs +3 -0
- package/dist/locale/ca.min.mjs.map +1 -0
- package/dist/locale/ca.mjs +186 -0
- package/dist/locale/ckb.js +193 -0
- package/dist/locale/ckb.min.js +3 -0
- package/dist/locale/ckb.min.js.map +1 -0
- package/dist/locale/ckb.min.mjs +3 -0
- package/dist/locale/ckb.min.mjs.map +1 -0
- package/dist/locale/ckb.mjs +186 -0
- package/dist/locale/cs.js +195 -0
- package/dist/locale/cs.min.js +3 -0
- package/dist/locale/cs.min.js.map +1 -0
- package/dist/locale/cs.min.mjs +3 -0
- package/dist/locale/cs.min.mjs.map +1 -0
- package/dist/locale/cs.mjs +188 -0
- package/dist/locale/da.js +193 -0
- package/dist/locale/da.min.js +3 -0
- package/dist/locale/da.min.js.map +1 -0
- package/dist/locale/da.min.mjs +3 -0
- package/dist/locale/da.min.mjs.map +1 -0
- package/dist/locale/da.mjs +186 -0
- package/dist/locale/de.js +195 -0
- package/dist/locale/de.min.js +3 -0
- package/dist/locale/de.min.js.map +1 -0
- package/dist/locale/de.min.mjs +3 -0
- package/dist/locale/de.min.mjs.map +1 -0
- package/dist/locale/de.mjs +188 -0
- package/dist/locale/el.js +193 -0
- package/dist/locale/el.min.js +3 -0
- package/dist/locale/el.min.js.map +1 -0
- package/dist/locale/el.min.mjs +3 -0
- package/dist/locale/el.min.mjs.map +1 -0
- package/dist/locale/el.mjs +186 -0
- package/dist/locale/en.js +193 -0
- package/dist/locale/en.min.js +3 -0
- package/dist/locale/en.min.js.map +1 -0
- package/dist/locale/en.min.mjs +3 -0
- package/dist/locale/en.min.mjs.map +1 -0
- package/dist/locale/en.mjs +186 -0
- package/dist/locale/eo.js +193 -0
- package/dist/locale/eo.min.js +3 -0
- package/dist/locale/eo.min.js.map +1 -0
- package/dist/locale/eo.min.mjs +3 -0
- package/dist/locale/eo.min.mjs.map +1 -0
- package/dist/locale/eo.mjs +186 -0
- package/dist/locale/es.js +193 -0
- package/dist/locale/es.min.js +3 -0
- package/dist/locale/es.min.js.map +1 -0
- package/dist/locale/es.min.mjs +3 -0
- package/dist/locale/es.min.mjs.map +1 -0
- package/dist/locale/es.mjs +186 -0
- package/dist/locale/et.js +193 -0
- package/dist/locale/et.min.js +3 -0
- package/dist/locale/et.min.js.map +1 -0
- package/dist/locale/et.min.mjs +3 -0
- package/dist/locale/et.min.mjs.map +1 -0
- package/dist/locale/et.mjs +186 -0
- package/dist/locale/eu.js +193 -0
- package/dist/locale/eu.min.js +3 -0
- package/dist/locale/eu.min.js.map +1 -0
- package/dist/locale/eu.min.mjs +3 -0
- package/dist/locale/eu.min.mjs.map +1 -0
- package/dist/locale/eu.mjs +186 -0
- package/dist/locale/fa.js +193 -0
- package/dist/locale/fa.min.js +3 -0
- package/dist/locale/fa.min.js.map +1 -0
- package/dist/locale/fa.min.mjs +3 -0
- package/dist/locale/fa.min.mjs.map +1 -0
- package/dist/locale/fa.mjs +186 -0
- package/dist/locale/fi.js +193 -0
- package/dist/locale/fi.min.js +3 -0
- package/dist/locale/fi.min.js.map +1 -0
- package/dist/locale/fi.min.mjs +3 -0
- package/dist/locale/fi.min.mjs.map +1 -0
- package/dist/locale/fi.mjs +186 -0
- package/dist/locale/fr.js +193 -0
- package/dist/locale/fr.min.js +3 -0
- package/dist/locale/fr.min.js.map +1 -0
- package/dist/locale/fr.min.mjs +3 -0
- package/dist/locale/fr.min.mjs.map +1 -0
- package/dist/locale/fr.mjs +186 -0
- package/dist/locale/he.js +193 -0
- package/dist/locale/he.min.js +3 -0
- package/dist/locale/he.min.js.map +1 -0
- package/dist/locale/he.min.mjs +3 -0
- package/dist/locale/he.min.mjs.map +1 -0
- package/dist/locale/he.mjs +186 -0
- package/dist/locale/hi.js +193 -0
- package/dist/locale/hi.min.js +3 -0
- package/dist/locale/hi.min.js.map +1 -0
- package/dist/locale/hi.min.mjs +3 -0
- package/dist/locale/hi.min.mjs.map +1 -0
- package/dist/locale/hi.mjs +186 -0
- package/dist/locale/hr.js +193 -0
- package/dist/locale/hr.min.js +3 -0
- package/dist/locale/hr.min.js.map +1 -0
- package/dist/locale/hr.min.mjs +3 -0
- package/dist/locale/hr.min.mjs.map +1 -0
- package/dist/locale/hr.mjs +186 -0
- package/dist/locale/hu.js +193 -0
- package/dist/locale/hu.min.js +3 -0
- package/dist/locale/hu.min.js.map +1 -0
- package/dist/locale/hu.min.mjs +3 -0
- package/dist/locale/hu.min.mjs.map +1 -0
- package/dist/locale/hu.mjs +186 -0
- package/dist/locale/hy-am.js +193 -0
- package/dist/locale/hy-am.min.js +3 -0
- package/dist/locale/hy-am.min.js.map +1 -0
- package/dist/locale/hy-am.min.mjs +3 -0
- package/dist/locale/hy-am.min.mjs.map +1 -0
- package/dist/locale/hy-am.mjs +186 -0
- package/dist/locale/id.js +193 -0
- package/dist/locale/id.min.js +3 -0
- package/dist/locale/id.min.js.map +1 -0
- package/dist/locale/id.min.mjs +3 -0
- package/dist/locale/id.min.mjs.map +1 -0
- package/dist/locale/id.mjs +186 -0
- package/dist/locale/it.js +193 -0
- package/dist/locale/it.min.js +3 -0
- package/dist/locale/it.min.js.map +1 -0
- package/dist/locale/it.min.mjs +3 -0
- package/dist/locale/it.min.mjs.map +1 -0
- package/dist/locale/it.mjs +186 -0
- package/dist/locale/ja.js +193 -0
- package/dist/locale/ja.min.js +3 -0
- package/dist/locale/ja.min.js.map +1 -0
- package/dist/locale/ja.min.mjs +3 -0
- package/dist/locale/ja.min.mjs.map +1 -0
- package/dist/locale/ja.mjs +186 -0
- package/dist/locale/kk.js +193 -0
- package/dist/locale/kk.min.js +3 -0
- package/dist/locale/kk.min.js.map +1 -0
- package/dist/locale/kk.min.mjs +3 -0
- package/dist/locale/kk.min.mjs.map +1 -0
- package/dist/locale/kk.mjs +186 -0
- package/dist/locale/km.js +193 -0
- package/dist/locale/km.min.js +3 -0
- package/dist/locale/km.min.js.map +1 -0
- package/dist/locale/km.min.mjs +3 -0
- package/dist/locale/km.min.mjs.map +1 -0
- package/dist/locale/km.mjs +186 -0
- package/dist/locale/ko.js +193 -0
- package/dist/locale/ko.min.js +3 -0
- package/dist/locale/ko.min.js.map +1 -0
- package/dist/locale/ko.min.mjs +3 -0
- package/dist/locale/ko.min.mjs.map +1 -0
- package/dist/locale/ko.mjs +186 -0
- package/dist/locale/ku.js +193 -0
- package/dist/locale/ku.min.js +3 -0
- package/dist/locale/ku.min.js.map +1 -0
- package/dist/locale/ku.min.mjs +3 -0
- package/dist/locale/ku.min.mjs.map +1 -0
- package/dist/locale/ku.mjs +186 -0
- package/dist/locale/ky.js +193 -0
- package/dist/locale/ky.min.js +3 -0
- package/dist/locale/ky.min.js.map +1 -0
- package/dist/locale/ky.min.mjs +3 -0
- package/dist/locale/ky.min.mjs.map +1 -0
- package/dist/locale/ky.mjs +186 -0
- package/dist/locale/lo.js +193 -0
- package/dist/locale/lo.min.js +3 -0
- package/dist/locale/lo.min.js.map +1 -0
- package/dist/locale/lo.min.mjs +3 -0
- package/dist/locale/lo.min.mjs.map +1 -0
- package/dist/locale/lo.mjs +186 -0
- package/dist/locale/lt.js +193 -0
- package/dist/locale/lt.min.js +3 -0
- package/dist/locale/lt.min.js.map +1 -0
- package/dist/locale/lt.min.mjs +3 -0
- package/dist/locale/lt.min.mjs.map +1 -0
- package/dist/locale/lt.mjs +186 -0
- package/dist/locale/lv.js +193 -0
- package/dist/locale/lv.min.js +3 -0
- package/dist/locale/lv.min.js.map +1 -0
- package/dist/locale/lv.min.mjs +3 -0
- package/dist/locale/lv.min.mjs.map +1 -0
- package/dist/locale/lv.mjs +186 -0
- package/dist/locale/mg.js +193 -0
- package/dist/locale/mg.min.js +3 -0
- package/dist/locale/mg.min.js.map +1 -0
- package/dist/locale/mg.min.mjs +3 -0
- package/dist/locale/mg.min.mjs.map +1 -0
- package/dist/locale/mg.mjs +186 -0
- package/dist/locale/mn.js +193 -0
- package/dist/locale/mn.min.js +3 -0
- package/dist/locale/mn.min.js.map +1 -0
- package/dist/locale/mn.min.mjs +3 -0
- package/dist/locale/mn.min.mjs.map +1 -0
- package/dist/locale/mn.mjs +186 -0
- package/dist/locale/ms.js +195 -0
- package/dist/locale/ms.min.js +3 -0
- package/dist/locale/ms.min.js.map +1 -0
- package/dist/locale/ms.min.mjs +3 -0
- package/dist/locale/ms.min.mjs.map +1 -0
- package/dist/locale/ms.mjs +188 -0
- package/dist/locale/my.js +193 -0
- package/dist/locale/my.min.js +3 -0
- package/dist/locale/my.min.js.map +1 -0
- package/dist/locale/my.min.mjs +3 -0
- package/dist/locale/my.min.mjs.map +1 -0
- package/dist/locale/my.mjs +186 -0
- package/dist/locale/nb-no.js +193 -0
- package/dist/locale/nb-no.min.js +3 -0
- package/dist/locale/nb-no.min.js.map +1 -0
- package/dist/locale/nb-no.min.mjs +3 -0
- package/dist/locale/nb-no.min.mjs.map +1 -0
- package/dist/locale/nb-no.mjs +186 -0
- package/dist/locale/nl.js +193 -0
- package/dist/locale/nl.min.js +3 -0
- package/dist/locale/nl.min.js.map +1 -0
- package/dist/locale/nl.min.mjs +3 -0
- package/dist/locale/nl.min.mjs.map +1 -0
- package/dist/locale/nl.mjs +186 -0
- package/dist/locale/no.js +193 -0
- package/dist/locale/no.min.js +3 -0
- package/dist/locale/no.min.js.map +1 -0
- package/dist/locale/no.min.mjs +3 -0
- package/dist/locale/no.min.mjs.map +1 -0
- package/dist/locale/no.mjs +186 -0
- package/dist/locale/pa.js +193 -0
- package/dist/locale/pa.min.js +3 -0
- package/dist/locale/pa.min.js.map +1 -0
- package/dist/locale/pa.min.mjs +3 -0
- package/dist/locale/pa.min.mjs.map +1 -0
- package/dist/locale/pa.mjs +186 -0
- package/dist/locale/pl.js +193 -0
- package/dist/locale/pl.min.js +3 -0
- package/dist/locale/pl.min.js.map +1 -0
- package/dist/locale/pl.min.mjs +3 -0
- package/dist/locale/pl.min.mjs.map +1 -0
- package/dist/locale/pl.mjs +186 -0
- package/dist/locale/pt-br.js +193 -0
- package/dist/locale/pt-br.min.js +3 -0
- package/dist/locale/pt-br.min.js.map +1 -0
- package/dist/locale/pt-br.min.mjs +3 -0
- package/dist/locale/pt-br.min.mjs.map +1 -0
- package/dist/locale/pt-br.mjs +186 -0
- package/dist/locale/pt.js +193 -0
- package/dist/locale/pt.min.js +3 -0
- package/dist/locale/pt.min.js.map +1 -0
- package/dist/locale/pt.min.mjs +3 -0
- package/dist/locale/pt.min.mjs.map +1 -0
- package/dist/locale/pt.mjs +186 -0
- package/dist/locale/ro.js +193 -0
- package/dist/locale/ro.min.js +3 -0
- package/dist/locale/ro.min.js.map +1 -0
- package/dist/locale/ro.min.mjs +3 -0
- package/dist/locale/ro.min.mjs.map +1 -0
- package/dist/locale/ro.mjs +186 -0
- package/dist/locale/ru.js +193 -0
- package/dist/locale/ru.min.js +3 -0
- package/dist/locale/ru.min.js.map +1 -0
- package/dist/locale/ru.min.mjs +3 -0
- package/dist/locale/ru.min.mjs.map +1 -0
- package/dist/locale/ru.mjs +186 -0
- package/dist/locale/sk.js +195 -0
- package/dist/locale/sk.min.js +3 -0
- package/dist/locale/sk.min.js.map +1 -0
- package/dist/locale/sk.min.mjs +3 -0
- package/dist/locale/sk.min.mjs.map +1 -0
- package/dist/locale/sk.mjs +188 -0
- package/dist/locale/sl.js +193 -0
- package/dist/locale/sl.min.js +3 -0
- package/dist/locale/sl.min.js.map +1 -0
- package/dist/locale/sl.min.mjs +3 -0
- package/dist/locale/sl.min.mjs.map +1 -0
- package/dist/locale/sl.mjs +186 -0
- package/dist/locale/sr.js +193 -0
- package/dist/locale/sr.min.js +3 -0
- package/dist/locale/sr.min.js.map +1 -0
- package/dist/locale/sr.min.mjs +3 -0
- package/dist/locale/sr.min.mjs.map +1 -0
- package/dist/locale/sr.mjs +186 -0
- package/dist/locale/sv.js +193 -0
- package/dist/locale/sv.min.js +3 -0
- package/dist/locale/sv.min.js.map +1 -0
- package/dist/locale/sv.min.mjs +3 -0
- package/dist/locale/sv.min.mjs.map +1 -0
- package/dist/locale/sv.mjs +186 -0
- package/dist/locale/sw.js +193 -0
- package/dist/locale/sw.min.js +3 -0
- package/dist/locale/sw.min.js.map +1 -0
- package/dist/locale/sw.min.mjs +3 -0
- package/dist/locale/sw.min.mjs.map +1 -0
- package/dist/locale/sw.mjs +186 -0
- package/dist/locale/ta.js +193 -0
- package/dist/locale/ta.min.js +3 -0
- package/dist/locale/ta.min.js.map +1 -0
- package/dist/locale/ta.min.mjs +3 -0
- package/dist/locale/ta.min.mjs.map +1 -0
- package/dist/locale/ta.mjs +186 -0
- package/dist/locale/te.js +193 -0
- package/dist/locale/te.min.js +3 -0
- package/dist/locale/te.min.js.map +1 -0
- package/dist/locale/te.min.mjs +3 -0
- package/dist/locale/te.min.mjs.map +1 -0
- package/dist/locale/te.mjs +186 -0
- package/dist/locale/th.js +193 -0
- package/dist/locale/th.min.js +3 -0
- package/dist/locale/th.min.js.map +1 -0
- package/dist/locale/th.min.mjs +3 -0
- package/dist/locale/th.min.mjs.map +1 -0
- package/dist/locale/th.mjs +186 -0
- package/dist/locale/tk.js +193 -0
- package/dist/locale/tk.min.js +3 -0
- package/dist/locale/tk.min.js.map +1 -0
- package/dist/locale/tk.min.mjs +3 -0
- package/dist/locale/tk.min.mjs.map +1 -0
- package/dist/locale/tk.mjs +186 -0
- package/dist/locale/tr.js +193 -0
- package/dist/locale/tr.min.js +3 -0
- package/dist/locale/tr.min.js.map +1 -0
- package/dist/locale/tr.min.mjs +3 -0
- package/dist/locale/tr.min.mjs.map +1 -0
- package/dist/locale/tr.mjs +186 -0
- package/dist/locale/ug-cn.js +193 -0
- package/dist/locale/ug-cn.min.js +3 -0
- package/dist/locale/ug-cn.min.js.map +1 -0
- package/dist/locale/ug-cn.min.mjs +3 -0
- package/dist/locale/ug-cn.min.mjs.map +1 -0
- package/dist/locale/ug-cn.mjs +186 -0
- package/dist/locale/uk.js +193 -0
- package/dist/locale/uk.min.js +3 -0
- package/dist/locale/uk.min.js.map +1 -0
- package/dist/locale/uk.min.mjs +3 -0
- package/dist/locale/uk.min.mjs.map +1 -0
- package/dist/locale/uk.mjs +186 -0
- package/dist/locale/uz-uz.js +193 -0
- package/dist/locale/uz-uz.min.js +3 -0
- package/dist/locale/uz-uz.min.js.map +1 -0
- package/dist/locale/uz-uz.min.mjs +3 -0
- package/dist/locale/uz-uz.min.mjs.map +1 -0
- package/dist/locale/uz-uz.mjs +186 -0
- package/dist/locale/vi.js +193 -0
- package/dist/locale/vi.min.js +3 -0
- package/dist/locale/vi.min.js.map +1 -0
- package/dist/locale/vi.min.mjs +3 -0
- package/dist/locale/vi.min.mjs.map +1 -0
- package/dist/locale/vi.mjs +186 -0
- package/dist/locale/zh-cn.js +193 -0
- package/dist/locale/zh-cn.min.js +3 -0
- package/dist/locale/zh-cn.min.js.map +1 -0
- package/dist/locale/zh-cn.min.mjs +3 -0
- package/dist/locale/zh-cn.min.mjs.map +1 -0
- package/dist/locale/zh-cn.mjs +186 -0
- package/dist/locale/zh-hk.js +193 -0
- package/dist/locale/zh-hk.min.js +3 -0
- package/dist/locale/zh-hk.min.js.map +1 -0
- package/dist/locale/zh-hk.min.mjs +3 -0
- package/dist/locale/zh-hk.min.mjs.map +1 -0
- package/dist/locale/zh-hk.mjs +186 -0
- package/dist/locale/zh-mo.js +193 -0
- package/dist/locale/zh-mo.min.js +3 -0
- package/dist/locale/zh-mo.min.js.map +1 -0
- package/dist/locale/zh-mo.min.mjs +3 -0
- package/dist/locale/zh-mo.min.mjs.map +1 -0
- package/dist/locale/zh-mo.mjs +186 -0
- package/dist/locale/zh-tw.js +193 -0
- package/dist/locale/zh-tw.min.js +3 -0
- package/dist/locale/zh-tw.min.js.map +1 -0
- package/dist/locale/zh-tw.min.mjs +3 -0
- package/dist/locale/zh-tw.min.mjs.map +1 -0
- package/dist/locale/zh-tw.mjs +186 -0
- package/dist/style.css +1 -1
- package/dist/test/demo.docx +0 -0
- package/dist/test/demo.et +0 -0
- package/dist/test/demo.ofd +0 -0
- package/dist/test/demo.pdf +0 -0
- package/dist/test/test.ofd +0 -0
- package/dist/test/unzip.ofd +0 -0
- package/dist/test/zip.ofd +0 -0
- package/dist/types/auto-imports.d.ts +9 -0
- package/dist/types/components.d.ts +55 -0
- package/dist/zhui-plus.cjs.js +1 -0
- package/dist/zhui-plus.es.js +2 -0
- package/dist/zhui.svg +1 -0
- package/package.json +90 -4
- package/packages/components/AI/index.ts +10 -0
- package/packages/components/AI/src/zh-aiChat.vue +841 -0
- package/packages/components/badge/__tests__/badge.test.ts +38 -0
- package/packages/components/badge/index.ts +10 -0
- package/packages/components/badge/src/zh-badge.vue +86 -0
- package/packages/components/badge/style.scss +1 -0
- package/packages/components/button/__tests__/button.test.ts +94 -0
- package/packages/components/button/__tests__/buttonGroup.test.ts +46 -0
- package/packages/components/button/index.ts +11 -0
- package/packages/components/button/src/zh-button-group.vue +50 -0
- package/packages/components/button/src/zh-button.vue +152 -0
- package/packages/components/button/style/index.css +140 -0
- package/packages/components/charts/geo.json +11147 -0
- package/packages/components/charts/index.ts +35 -0
- package/packages/components/charts/src/zh-barChart.vue +97 -0
- package/packages/components/charts/src/zh-baseChart.vue +196 -0
- package/packages/components/charts/src/zh-lineBarChart.vue +113 -0
- package/packages/components/charts/src/zh-lineChart.vue +93 -0
- package/packages/components/charts/src/zh-mapChart.vue +214 -0
- package/packages/components/charts/src/zh-pictorialBar.vue +72 -0
- package/packages/components/charts/src/zh-pieChart.vue +67 -0
- package/packages/components/charts/src/zh-radarChart.vue +131 -0
- package/packages/components/charts/src/zh-scatterChart.vue +152 -0
- package/packages/components/chat/index.ts +10 -0
- package/packages/components/chat/src/zh-chat.vue +889 -0
- package/packages/components/container/index.ts +18 -0
- package/packages/components/container/src/zh-aside.vue +34 -0
- package/packages/components/container/src/zh-container.vue +45 -0
- package/packages/components/container/src/zh-footer.vue +33 -0
- package/packages/components/container/src/zh-header.vue +34 -0
- package/packages/components/container/src/zh-main.vue +26 -0
- package/packages/components/directive/focus.ts +14 -0
- package/packages/components/directive/idCard.ts +12 -0
- package/packages/components/directive/index.ts +19 -0
- package/packages/components/directive/number.ts +10 -0
- package/packages/components/directive/permission.ts +57 -0
- package/packages/components/directive/phone.ts +12 -0
- package/packages/components/drawer/index.ts +10 -0
- package/packages/components/drawer/src/zh-drawer.vue +78 -0
- package/packages/components/drawer/style/animation.scss +35 -0
- package/packages/components/drawer/style/index.scss +52 -0
- package/packages/components/drawer/style/media.scss +6 -0
- package/packages/components/fileViewer/index.ts +9 -0
- package/packages/components/fileViewer/src/liteofd/annotLayer.ts +203 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/LICENSE +15 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/README.md +108 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/asn1.js +627 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/base64.js +103 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/defs.js +138 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/dumpASN1.js +79 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/hex.js +69 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/int10.js +106 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/oids.js +2725 -0
- package/packages/components/fileViewer/src/liteofd/asn1js/rfcdef.js +10377 -0
- package/packages/components/fileViewer/src/liteofd/attrType.ts +173 -0
- package/packages/components/fileViewer/src/liteofd/contentLayer.ts +203 -0
- package/packages/components/fileViewer/src/liteofd/elements/AnnotationPathSvg.ts +122 -0
- package/packages/components/fileViewer/src/liteofd/elements/BaseSvg.ts +6 -0
- package/packages/components/fileViewer/src/liteofd/elements/ImageSvg.ts +212 -0
- package/packages/components/fileViewer/src/liteofd/elements/PathSvg.ts +460 -0
- package/packages/components/fileViewer/src/liteofd/elements/SignatureElement.ts +231 -0
- package/packages/components/fileViewer/src/liteofd/elements/TextSvg.ts +235 -0
- package/packages/components/fileViewer/src/liteofd/elements/ofdAnnotationElement.ts +133 -0
- package/packages/components/fileViewer/src/liteofd/elements/ofdPageContainer.ts +183 -0
- package/packages/components/fileViewer/src/liteofd/elements/ofdPageRender.ts +71 -0
- package/packages/components/fileViewer/src/liteofd/elements/signObject.json +10084 -0
- package/packages/components/fileViewer/src/liteofd/elements/signature.json +381 -0
- package/packages/components/fileViewer/src/liteofd/font/arithmetic_decoder.js +182 -0
- package/packages/components/fileViewer/src/liteofd/font/ascii_85_stream.js +98 -0
- package/packages/components/fileViewer/src/liteofd/font/ascii_hex_stream.js +79 -0
- package/packages/components/fileViewer/src/liteofd/font/base_stream.js +110 -0
- package/packages/components/fileViewer/src/liteofd/font/bidi.js +440 -0
- package/packages/components/fileViewer/src/liteofd/font/binary_cmap.js +326 -0
- package/packages/components/fileViewer/src/liteofd/font/calibri_factors.js +309 -0
- package/packages/components/fileViewer/src/liteofd/font/ccitt.js +1059 -0
- package/packages/components/fileViewer/src/liteofd/font/ccitt_stream.js +60 -0
- package/packages/components/fileViewer/src/liteofd/font/cff_font.js +139 -0
- package/packages/components/fileViewer/src/liteofd/font/cff_parser.js +1940 -0
- package/packages/components/fileViewer/src/liteofd/font/charsets.js +119 -0
- package/packages/components/fileViewer/src/liteofd/font/chunked_stream.js +94 -0
- package/packages/components/fileViewer/src/liteofd/font/cmap.js +726 -0
- package/packages/components/fileViewer/src/liteofd/font/colorspace.js +1336 -0
- package/packages/components/fileViewer/src/liteofd/font/core_utils.js +636 -0
- package/packages/components/fileViewer/src/liteofd/font/decode_stream.js +177 -0
- package/packages/components/fileViewer/src/liteofd/font/differences.js +906 -0
- package/packages/components/fileViewer/src/liteofd/font/encodings.js +301 -0
- package/packages/components/fileViewer/src/liteofd/font/flate_stream.js +413 -0
- package/packages/components/fileViewer/src/liteofd/font/font_loader.js +455 -0
- package/packages/components/fileViewer/src/liteofd/font/font_renderer.js +900 -0
- package/packages/components/fileViewer/src/liteofd/font/font_substitutions.js +553 -0
- package/packages/components/fileViewer/src/liteofd/font/fonts copy.js +3391 -0
- package/packages/components/fileViewer/src/liteofd/font/fonts.js +3585 -0
- package/packages/components/fileViewer/src/liteofd/font/fonts_utils.js +178 -0
- package/packages/components/fileViewer/src/liteofd/font/function.js +1241 -0
- package/packages/components/fileViewer/src/liteofd/font/glyf.js +701 -0
- package/packages/components/fileViewer/src/liteofd/font/glyphlist.js +4557 -0
- package/packages/components/fileViewer/src/liteofd/font/helvetica_factors.js +352 -0
- package/packages/components/fileViewer/src/liteofd/font/image.js +986 -0
- package/packages/components/fileViewer/src/liteofd/font/image_resizer.js +398 -0
- package/packages/components/fileViewer/src/liteofd/font/image_utils.js +286 -0
- package/packages/components/fileViewer/src/liteofd/font/jbig2_stream.js +74 -0
- package/packages/components/fileViewer/src/liteofd/font/jpeg_stream.js +106 -0
- package/packages/components/fileViewer/src/liteofd/font/jpg.js +1590 -0
- package/packages/components/fileViewer/src/liteofd/font/jpx.js +2349 -0
- package/packages/components/fileViewer/src/liteofd/font/jpx_stream.js +87 -0
- package/packages/components/fileViewer/src/liteofd/font/liberationsans_widths.js +429 -0
- package/packages/components/fileViewer/src/liteofd/font/lzw_stream.js +150 -0
- package/packages/components/fileViewer/src/liteofd/font/metrics.d.ts +1 -0
- package/packages/components/fileViewer/src/liteofd/font/metrics.js +3057 -0
- package/packages/components/fileViewer/src/liteofd/font/murmurhash3.js +135 -0
- package/packages/components/fileViewer/src/liteofd/font/myriadpro_factors.js +291 -0
- package/packages/components/fileViewer/src/liteofd/font/ofd_stream.js +402 -0
- package/packages/components/fileViewer/src/liteofd/font/opentype_file_builder.js +154 -0
- package/packages/components/fileViewer/src/liteofd/font/parser.js +1409 -0
- package/packages/components/fileViewer/src/liteofd/font/pattern.js +1005 -0
- package/packages/components/fileViewer/src/liteofd/font/predictor_stream.js +234 -0
- package/packages/components/fileViewer/src/liteofd/font/primitives.js +354 -0
- package/packages/components/fileViewer/src/liteofd/font/properties.json +2110 -0
- package/packages/components/fileViewer/src/liteofd/font/ps_parser.js +268 -0
- package/packages/components/fileViewer/src/liteofd/font/run_length_stream.js +61 -0
- package/packages/components/fileViewer/src/liteofd/font/segoeui_factors.js +308 -0
- package/packages/components/fileViewer/src/liteofd/font/standard_fonts.js +915 -0
- package/packages/components/fileViewer/src/liteofd/font/stream.js +99 -0
- package/packages/components/fileViewer/src/liteofd/font/to_unicode_map.js +111 -0
- package/packages/components/fileViewer/src/liteofd/font/translatedFont.js +3125 -0
- package/packages/components/fileViewer/src/liteofd/font/type1_font.js +443 -0
- package/packages/components/fileViewer/src/liteofd/font/type1_parser.js +804 -0
- package/packages/components/fileViewer/src/liteofd/font/unicode.js +274 -0
- package/packages/components/fileViewer/src/liteofd/font/util.js +1159 -0
- package/packages/components/fileViewer/src/liteofd/font/xfa_fonts.js +296 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/arithmetic_decoder.js +183 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/ccitt.js +1070 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/core_utils.js +180 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/is_node.js +27 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/jbig2.js +2589 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/jbig2_stream.js +81 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/primitives.js +371 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/stream.js +1348 -0
- package/packages/components/fileViewer/src/liteofd/jbig2/util.js +970 -0
- package/packages/components/fileViewer/src/liteofd/layer.ts +12 -0
- package/packages/components/fileViewer/src/liteofd/liteOfd.ts +185 -0
- package/packages/components/fileViewer/src/liteofd/ofdActions.ts +29 -0
- package/packages/components/fileViewer/src/liteofd/ofdCanvas.ts +19 -0
- package/packages/components/fileViewer/src/liteofd/ofdData.ts +28 -0
- package/packages/components/fileViewer/src/liteofd/ofdDocument.ts +109 -0
- package/packages/components/fileViewer/src/liteofd/ofdFont.ts +425 -0
- package/packages/components/fileViewer/src/liteofd/ofdRender.ts +259 -0
- package/packages/components/fileViewer/src/liteofd/ofdWriter.ts +142 -0
- package/packages/components/fileViewer/src/liteofd/ofdtools.ts +43 -0
- package/packages/components/fileViewer/src/liteofd/parser.ts +499 -0
- package/packages/components/fileViewer/src/liteofd/promiseCapability.ts +47 -0
- package/packages/components/fileViewer/src/liteofd/utils/commonFont.ts +15 -0
- package/packages/components/fileViewer/src/liteofd/utils/elementUtils.ts +362 -0
- package/packages/components/fileViewer/src/liteofd/utils/jsonToXml.ts +95 -0
- package/packages/components/fileViewer/src/liteofd/utils/ofdUtils.ts +301 -0
- package/packages/components/fileViewer/src/liteofd/utils/signatureUtil.ts +246 -0
- package/packages/components/fileViewer/src/liteofd/utils/sm3.ts +235 -0
- package/packages/components/fileViewer/src/liteofd/utils/utils.ts +489 -0
- package/packages/components/fileViewer/src/liteofd/utils/verify_signature_util.ts +41 -0
- package/packages/components/fileViewer/src/ofd/CircleLoading.vue +64 -0
- package/packages/components/fileViewer/src/ofd/OfdPreview.vue +456 -0
- package/packages/components/fileViewer/src/ofd/OfdViewer.vue +211 -0
- package/packages/components/fileViewer/src/ofd/PageIndicator.vue +88 -0
- package/packages/components/fileViewer/src/ofd/RatioIndicator.vue +271 -0
- package/packages/components/fileViewer/src/ofd/ToolTip.vue +81 -0
- package/packages/components/fileViewer/src/zh-fileViewer.vue +426 -0
- package/packages/components/form/index.ts +11 -0
- package/packages/components/form/src/zh-form-item.vue +299 -0
- package/packages/components/form/src/zh-form.vue +90 -0
- package/packages/components/hideNumber/index.ts +9 -0
- package/packages/components/hideNumber/src/zh-hide-number.vue +37 -0
- package/packages/components/icon/index.ts +10 -0
- package/packages/components/icon/src/zh-icon.vue +32 -0
- package/packages/components/image/index.ts +9 -0
- package/packages/components/image/src/zh-image.vue +245 -0
- package/packages/components/index.ts +112 -0
- package/packages/components/input/index.ts +10 -0
- package/packages/components/input/src/input.com.ts +30 -0
- package/packages/components/input/src/input.type.ts +1 -0
- package/packages/components/input/src/zh-input.vue +92 -0
- package/packages/components/input/style/index.scss +30 -0
- package/packages/components/layout/index.ts +12 -0
- package/packages/components/layout/src/zh-col.tsx +81 -0
- package/packages/components/layout/src/zh-row.tsx +58 -0
- package/packages/components/layout/style/row.scss +6 -0
- package/packages/components/map/index.ts +18 -0
- package/packages/components/map/src/zh-amap.vue +999 -0
- package/packages/components/map/src/zh-bmap.vue +1578 -0
- package/packages/components/map/src/zh-omap.vue +1522 -0
- package/packages/components/map/src/zh-smap.vue +1555 -0
- package/packages/components/map/src/zh-tmap.vue +1058 -0
- package/packages/components/message/index.ts +8 -0
- package/packages/components/message/src/data.com.ts +61 -0
- package/packages/components/message/src/message-icon.vue +60 -0
- package/packages/components/message/src/message.ts +89 -0
- package/packages/components/message/src/message.type.ts +40 -0
- package/packages/components/message/src/zh-message.vue +133 -0
- package/packages/components/message-box/index.ts +12 -0
- package/packages/components/message-box/src/messageBox.help.ts +40 -0
- package/packages/components/message-box/src/messageBox.ts +126 -0
- package/packages/components/message-box/src/zh-message-box.vue +94 -0
- package/packages/components/message-box/style/index.css +29 -0
- package/packages/components/noData/index.ts +9 -0
- package/packages/components/noData/src/zh-no-data.vue +42 -0
- package/packages/components/operationColumn/index.ts +9 -0
- package/packages/components/operationColumn/src/zh-operationColumn.vue +113 -0
- package/packages/components/provider/index.ts +11 -0
- package/packages/components/provider/src/zh-authControl.vue +28 -0
- package/packages/components/provider/src/zh-authProvider.vue +36 -0
- package/packages/components/qrcode/index.ts +9 -0
- package/packages/components/qrcode/src/zh-qrcode.vue +271 -0
- package/packages/components/radio/index.ts +10 -0
- package/packages/components/radio/src/zh-radio.vue +86 -0
- package/packages/components/searchForm/index.ts +9 -0
- package/packages/components/searchForm/src/zh-search-form.vue +340 -0
- package/packages/components/signature/index.ts +10 -0
- package/packages/components/signature/src/zh-signature.vue +355 -0
- package/packages/components/switch/index.ts +10 -0
- package/packages/components/switch/src/zh-switch.vue +162 -0
- package/packages/components/table/index.ts +10 -0
- package/packages/components/table/src/types.ts +62 -0
- package/packages/components/table/src/zh-table.vue +220 -0
- package/packages/components/upload/index.ts +15 -0
- package/packages/components/upload/src/zh-cupload.vue +147 -0
- package/packages/components/upload/src/zh-upload.vue +258 -0
- package/packages/components/upload/src/zh-uploadCard.vue +176 -0
- package/packages/components/upload/src/zh-uploadDialog.vue +165 -0
- package/packages/components/videoPlayer/index.ts +12 -0
- package/packages/components/videoPlayer/src/PlayerManager.js +706 -0
- package/packages/components/videoPlayer/src/api.js +354 -0
- package/packages/components/videoPlayer/src/errorHandler.ts +39 -0
- package/packages/components/videoPlayer/src/resourceLoader.ts +68 -0
- package/packages/components/videoPlayer/src/useDahuaPlayer.ts +242 -0
- package/packages/components/videoPlayer/src/zh-dhPlayer.vue +119 -0
- package/packages/components/videoPlayer/src/zh-hlsPlayer.vue +575 -0
- package/packages/resolver/index.ts +324 -0
- package/packages/styles/_element.scss +324 -0
- package/packages/styles/_variable.scss +136 -0
- package/packages/styles/index.scss +3 -0
- package/packages/tokens/tokens.ts +2 -0
- package/packages/types/form.ts +205 -0
- package/packages/types/index.ts +4 -0
- package/packages/types/player.ts +80 -0
- package/packages/types/provider.ts +4 -0
- package/packages/types/searchForm.ts +24 -0
- package/packages/utils/common/__tests__/common.test.ts +12 -0
- package/packages/utils/common/common.ts +68 -0
- package/packages/utils/constant.ts +12 -0
- package/packages/utils/copy.ts +20 -0
- package/packages/utils/data.ts +62 -0
- package/packages/utils/echarts/echarts.ts +34 -0
- package/packages/utils/event.ts +37 -0
- package/packages/utils/hooks/__tests__/hooks.test.ts +24 -0
- package/packages/utils/hooks/data.ts +100 -0
- package/packages/utils/hooks/hooks.util.ts +39 -0
- package/packages/utils/hooks/index.ts +1 -0
- package/packages/utils/hooks/useBreakpoint.ts +89 -0
- package/packages/utils/hooks/useEcharts.ts +56 -0
- package/packages/utils/hooks/useEventListener.ts +57 -0
- package/packages/utils/hooks/useLegendProcessor.ts +92 -0
- package/packages/utils/hooks/usePermission.ts +22 -0
- package/packages/utils/hooks/useTimeout.ts +45 -0
- package/packages/utils/is.ts +79 -0
- package/packages/utils/utils.ts +136 -0
- package/packages/utils/vue/util-modal.vue +61 -0
- package/types/auto-imports.d.ts +9 -0
- package/types/component.d.ts +6 -0
- package/types/components.d.ts +131 -0
- package/types/defaults.d.ts +5 -0
- package/types/el-components.d.ts +23 -0
- package/types/global.d.ts +130 -0
- package/types/index.d.ts +11 -0
- package/types/zh-components.d.ts +23 -0
- package/types/zhui.d.ts +76 -0
- package/.idea/workspace.xml +0 -72
- package/README.md +0 -1
- package/dist/zh-ui.es.js +0 -56706
- package/dist/zh-ui.umd.js +0 -67
|
@@ -0,0 +1,1590 @@
|
|
|
1
|
+
/* Copyright 2014 Mozilla Foundation
|
|
2
|
+
*
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { assert, BaseException, FeatureTest, warn } from "./util.js"
|
|
17
|
+
import { readUint16 } from "./core_utils.js";
|
|
18
|
+
|
|
19
|
+
function grayToRGBA(src, dest) {
|
|
20
|
+
if (FeatureTest.isLittleEndian()) {
|
|
21
|
+
for (let i = 0, ii = src.length; i < ii; i++) {
|
|
22
|
+
dest[i] = (src[i] * 0x10101) | 0xff000000;
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
for (let i = 0, ii = src.length; i < ii; i++) {
|
|
26
|
+
dest[i] = (src[i] * 0x1010100) | 0x000000ff;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class JpegError extends BaseException {
|
|
33
|
+
constructor(msg) {
|
|
34
|
+
super(`JPEG error: ${msg}`, "JpegError");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class DNLMarkerError extends BaseException {
|
|
39
|
+
constructor(message, scanLines) {
|
|
40
|
+
super(message, "DNLMarkerError");
|
|
41
|
+
this.scanLines = scanLines;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class EOIMarkerError extends BaseException {
|
|
46
|
+
constructor(msg) {
|
|
47
|
+
super(msg, "EOIMarkerError");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* This code was forked from https://github.com/notmasteryet/jpgjs.
|
|
53
|
+
* The original version was created by GitHub user notmasteryet.
|
|
54
|
+
*
|
|
55
|
+
* - The JPEG specification can be found in the ITU CCITT Recommendation T.81
|
|
56
|
+
* (www.w3.org/Graphics/JPEG/itu-t81.pdf)
|
|
57
|
+
* - The JFIF specification can be found in the JPEG File Interchange Format
|
|
58
|
+
* (www.w3.org/Graphics/JPEG/jfif3.pdf)
|
|
59
|
+
* - The Adobe Application-Specific JPEG markers in the
|
|
60
|
+
* Supporting the DCT Filters in PostScript Level 2, Technical Note #5116
|
|
61
|
+
* (partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf)
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
// prettier-ignore
|
|
65
|
+
const dctZigZag = new Uint8Array([
|
|
66
|
+
0,
|
|
67
|
+
1, 8,
|
|
68
|
+
16, 9, 2,
|
|
69
|
+
3, 10, 17, 24,
|
|
70
|
+
32, 25, 18, 11, 4,
|
|
71
|
+
5, 12, 19, 26, 33, 40,
|
|
72
|
+
48, 41, 34, 27, 20, 13, 6,
|
|
73
|
+
7, 14, 21, 28, 35, 42, 49, 56,
|
|
74
|
+
57, 50, 43, 36, 29, 22, 15,
|
|
75
|
+
23, 30, 37, 44, 51, 58,
|
|
76
|
+
59, 52, 45, 38, 31,
|
|
77
|
+
39, 46, 53, 60,
|
|
78
|
+
61, 54, 47,
|
|
79
|
+
55, 62,
|
|
80
|
+
63
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
const dctCos1 = 4017; // cos(pi/16)
|
|
84
|
+
const dctSin1 = 799; // sin(pi/16)
|
|
85
|
+
const dctCos3 = 3406; // cos(3*pi/16)
|
|
86
|
+
const dctSin3 = 2276; // sin(3*pi/16)
|
|
87
|
+
const dctCos6 = 1567; // cos(6*pi/16)
|
|
88
|
+
const dctSin6 = 3784; // sin(6*pi/16)
|
|
89
|
+
const dctSqrt2 = 5793; // sqrt(2)
|
|
90
|
+
const dctSqrt1d2 = 2896; // sqrt(2) / 2
|
|
91
|
+
|
|
92
|
+
function buildHuffmanTable(codeLengths, values) {
|
|
93
|
+
let k = 0,
|
|
94
|
+
i,
|
|
95
|
+
j,
|
|
96
|
+
length = 16;
|
|
97
|
+
while (length > 0 && !codeLengths[length - 1]) {
|
|
98
|
+
length--;
|
|
99
|
+
}
|
|
100
|
+
const code = [{ children: [], index: 0 }];
|
|
101
|
+
let p = code[0],
|
|
102
|
+
q;
|
|
103
|
+
for (i = 0; i < length; i++) {
|
|
104
|
+
for (j = 0; j < codeLengths[i]; j++) {
|
|
105
|
+
p = code.pop();
|
|
106
|
+
p.children[p.index] = values[k];
|
|
107
|
+
while (p.index > 0) {
|
|
108
|
+
p = code.pop();
|
|
109
|
+
}
|
|
110
|
+
p.index++;
|
|
111
|
+
code.push(p);
|
|
112
|
+
while (code.length <= i) {
|
|
113
|
+
code.push((q = { children: [], index: 0 }));
|
|
114
|
+
p.children[p.index] = q.children;
|
|
115
|
+
p = q;
|
|
116
|
+
}
|
|
117
|
+
k++;
|
|
118
|
+
}
|
|
119
|
+
if (i + 1 < length) {
|
|
120
|
+
// p here points to last code
|
|
121
|
+
code.push((q = { children: [], index: 0 }));
|
|
122
|
+
p.children[p.index] = q.children;
|
|
123
|
+
p = q;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return code[0].children;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function getBlockBufferOffset(component, row, col) {
|
|
130
|
+
return 64 * ((component.blocksPerLine + 1) * row + col);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function decodeScan(
|
|
134
|
+
data,
|
|
135
|
+
offset,
|
|
136
|
+
frame,
|
|
137
|
+
components,
|
|
138
|
+
resetInterval,
|
|
139
|
+
spectralStart,
|
|
140
|
+
spectralEnd,
|
|
141
|
+
successivePrev,
|
|
142
|
+
successive,
|
|
143
|
+
parseDNLMarker = false
|
|
144
|
+
) {
|
|
145
|
+
const mcusPerLine = frame.mcusPerLine;
|
|
146
|
+
const progressive = frame.progressive;
|
|
147
|
+
|
|
148
|
+
const startOffset = offset;
|
|
149
|
+
let bitsData = 0,
|
|
150
|
+
bitsCount = 0;
|
|
151
|
+
|
|
152
|
+
function readBit() {
|
|
153
|
+
if (bitsCount > 0) {
|
|
154
|
+
bitsCount--;
|
|
155
|
+
return (bitsData >> bitsCount) & 1;
|
|
156
|
+
}
|
|
157
|
+
bitsData = data[offset++];
|
|
158
|
+
if (bitsData === 0xff) {
|
|
159
|
+
const nextByte = data[offset++];
|
|
160
|
+
if (nextByte) {
|
|
161
|
+
if (nextByte === /* DNL = */ 0xdc && parseDNLMarker) {
|
|
162
|
+
offset += 2; // Skip marker length.
|
|
163
|
+
|
|
164
|
+
const scanLines = readUint16(data, offset);
|
|
165
|
+
offset += 2;
|
|
166
|
+
if (scanLines > 0 && scanLines !== frame.scanLines) {
|
|
167
|
+
throw new DNLMarkerError(
|
|
168
|
+
"Found DNL marker (0xFFDC) while parsing scan data",
|
|
169
|
+
scanLines
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
} else if (nextByte === /* EOI = */ 0xd9) {
|
|
173
|
+
if (parseDNLMarker) {
|
|
174
|
+
// NOTE: only 8-bit JPEG images are supported in this decoder.
|
|
175
|
+
const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
|
|
176
|
+
// Heuristic to attempt to handle corrupt JPEG images with too
|
|
177
|
+
// large `scanLines` parameter, by falling back to the currently
|
|
178
|
+
// parsed number of scanLines when it's at least (approximately)
|
|
179
|
+
// one "half" order of magnitude smaller than expected (fixes
|
|
180
|
+
// issue10880.pdf, issue10989.pdf, issue15492.pdf).
|
|
181
|
+
if (
|
|
182
|
+
maybeScanLines > 0 &&
|
|
183
|
+
Math.round(frame.scanLines / maybeScanLines) >= 5
|
|
184
|
+
) {
|
|
185
|
+
throw new DNLMarkerError(
|
|
186
|
+
"Found EOI marker (0xFFD9) while parsing scan data, " +
|
|
187
|
+
"possibly caused by incorrect `scanLines` parameter",
|
|
188
|
+
maybeScanLines
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
throw new EOIMarkerError(
|
|
193
|
+
"Found EOI marker (0xFFD9) while parsing scan data"
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
throw new JpegError(
|
|
197
|
+
`unexpected marker ${((bitsData << 8) | nextByte).toString(16)}`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
// unstuff 0
|
|
201
|
+
}
|
|
202
|
+
bitsCount = 7;
|
|
203
|
+
return bitsData >>> 7;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function decodeHuffman(tree) {
|
|
207
|
+
let node = tree;
|
|
208
|
+
while (true) {
|
|
209
|
+
node = node[readBit()];
|
|
210
|
+
switch (typeof node) {
|
|
211
|
+
case "number":
|
|
212
|
+
return node;
|
|
213
|
+
case "object":
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
throw new JpegError("invalid huffman sequence");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function receive(length) {
|
|
221
|
+
let n = 0;
|
|
222
|
+
while (length > 0) {
|
|
223
|
+
n = (n << 1) | readBit();
|
|
224
|
+
length--;
|
|
225
|
+
}
|
|
226
|
+
return n;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function receiveAndExtend(length) {
|
|
230
|
+
if (length === 1) {
|
|
231
|
+
return readBit() === 1 ? 1 : -1;
|
|
232
|
+
}
|
|
233
|
+
const n = receive(length);
|
|
234
|
+
if (n >= 1 << (length - 1)) {
|
|
235
|
+
return n;
|
|
236
|
+
}
|
|
237
|
+
return n + (-1 << length) + 1;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function decodeBaseline(component, blockOffset) {
|
|
241
|
+
const t = decodeHuffman(component.huffmanTableDC);
|
|
242
|
+
const diff = t === 0 ? 0 : receiveAndExtend(t);
|
|
243
|
+
component.blockData[blockOffset] = component.pred += diff;
|
|
244
|
+
let k = 1;
|
|
245
|
+
while (k < 64) {
|
|
246
|
+
const rs = decodeHuffman(component.huffmanTableAC);
|
|
247
|
+
const s = rs & 15,
|
|
248
|
+
r = rs >> 4;
|
|
249
|
+
if (s === 0) {
|
|
250
|
+
if (r < 15) {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
k += 16;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
k += r;
|
|
257
|
+
const z = dctZigZag[k];
|
|
258
|
+
component.blockData[blockOffset + z] = receiveAndExtend(s);
|
|
259
|
+
k++;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function decodeDCFirst(component, blockOffset) {
|
|
264
|
+
const t = decodeHuffman(component.huffmanTableDC);
|
|
265
|
+
const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
|
|
266
|
+
component.blockData[blockOffset] = component.pred += diff;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function decodeDCSuccessive(component, blockOffset) {
|
|
270
|
+
component.blockData[blockOffset] |= readBit() << successive;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
let eobrun = 0;
|
|
274
|
+
function decodeACFirst(component, blockOffset) {
|
|
275
|
+
if (eobrun > 0) {
|
|
276
|
+
eobrun--;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
let k = spectralStart;
|
|
280
|
+
const e = spectralEnd;
|
|
281
|
+
while (k <= e) {
|
|
282
|
+
const rs = decodeHuffman(component.huffmanTableAC);
|
|
283
|
+
const s = rs & 15,
|
|
284
|
+
r = rs >> 4;
|
|
285
|
+
if (s === 0) {
|
|
286
|
+
if (r < 15) {
|
|
287
|
+
eobrun = receive(r) + (1 << r) - 1;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
k += 16;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
k += r;
|
|
294
|
+
const z = dctZigZag[k];
|
|
295
|
+
component.blockData[blockOffset + z] =
|
|
296
|
+
receiveAndExtend(s) * (1 << successive);
|
|
297
|
+
k++;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
let successiveACState = 0,
|
|
302
|
+
successiveACNextValue;
|
|
303
|
+
function decodeACSuccessive(component, blockOffset) {
|
|
304
|
+
let k = spectralStart;
|
|
305
|
+
const e = spectralEnd;
|
|
306
|
+
let r = 0;
|
|
307
|
+
let s;
|
|
308
|
+
let rs;
|
|
309
|
+
while (k <= e) {
|
|
310
|
+
const offsetZ = blockOffset + dctZigZag[k];
|
|
311
|
+
const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
|
|
312
|
+
switch (successiveACState) {
|
|
313
|
+
case 0: // initial state
|
|
314
|
+
rs = decodeHuffman(component.huffmanTableAC);
|
|
315
|
+
s = rs & 15;
|
|
316
|
+
r = rs >> 4;
|
|
317
|
+
if (s === 0) {
|
|
318
|
+
if (r < 15) {
|
|
319
|
+
eobrun = receive(r) + (1 << r);
|
|
320
|
+
successiveACState = 4;
|
|
321
|
+
} else {
|
|
322
|
+
r = 16;
|
|
323
|
+
successiveACState = 1;
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
if (s !== 1) {
|
|
327
|
+
throw new JpegError("invalid ACn encoding");
|
|
328
|
+
}
|
|
329
|
+
successiveACNextValue = receiveAndExtend(s);
|
|
330
|
+
successiveACState = r ? 2 : 3;
|
|
331
|
+
}
|
|
332
|
+
continue;
|
|
333
|
+
case 1: // skipping r zero items
|
|
334
|
+
case 2:
|
|
335
|
+
if (component.blockData[offsetZ]) {
|
|
336
|
+
component.blockData[offsetZ] += sign * (readBit() << successive);
|
|
337
|
+
} else {
|
|
338
|
+
r--;
|
|
339
|
+
if (r === 0) {
|
|
340
|
+
successiveACState = successiveACState === 2 ? 3 : 0;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
break;
|
|
344
|
+
case 3: // set value for a zero item
|
|
345
|
+
if (component.blockData[offsetZ]) {
|
|
346
|
+
component.blockData[offsetZ] += sign * (readBit() << successive);
|
|
347
|
+
} else {
|
|
348
|
+
component.blockData[offsetZ] = successiveACNextValue << successive;
|
|
349
|
+
successiveACState = 0;
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
case 4: // eob
|
|
353
|
+
if (component.blockData[offsetZ]) {
|
|
354
|
+
component.blockData[offsetZ] += sign * (readBit() << successive);
|
|
355
|
+
}
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
k++;
|
|
359
|
+
}
|
|
360
|
+
if (successiveACState === 4) {
|
|
361
|
+
eobrun--;
|
|
362
|
+
if (eobrun === 0) {
|
|
363
|
+
successiveACState = 0;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
let blockRow = 0;
|
|
369
|
+
function decodeMcu(component, decode, mcu, row, col) {
|
|
370
|
+
const mcuRow = (mcu / mcusPerLine) | 0;
|
|
371
|
+
const mcuCol = mcu % mcusPerLine;
|
|
372
|
+
blockRow = mcuRow * component.v + row;
|
|
373
|
+
const blockCol = mcuCol * component.h + col;
|
|
374
|
+
const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
|
|
375
|
+
decode(component, blockOffset);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function decodeBlock(component, decode, mcu) {
|
|
379
|
+
blockRow = (mcu / component.blocksPerLine) | 0;
|
|
380
|
+
const blockCol = mcu % component.blocksPerLine;
|
|
381
|
+
const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
|
|
382
|
+
decode(component, blockOffset);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const componentsLength = components.length;
|
|
386
|
+
let component, i, j, k, n;
|
|
387
|
+
let decodeFn;
|
|
388
|
+
if (progressive) {
|
|
389
|
+
if (spectralStart === 0) {
|
|
390
|
+
decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
|
|
391
|
+
} else {
|
|
392
|
+
decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
decodeFn = decodeBaseline;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
let mcu = 0,
|
|
399
|
+
fileMarker;
|
|
400
|
+
const mcuExpected =
|
|
401
|
+
componentsLength === 1
|
|
402
|
+
? components[0].blocksPerLine * components[0].blocksPerColumn
|
|
403
|
+
: mcusPerLine * frame.mcusPerColumn;
|
|
404
|
+
|
|
405
|
+
let h, v;
|
|
406
|
+
while (mcu <= mcuExpected) {
|
|
407
|
+
// reset interval stuff
|
|
408
|
+
const mcuToRead = resetInterval
|
|
409
|
+
? Math.min(mcuExpected - mcu, resetInterval)
|
|
410
|
+
: mcuExpected;
|
|
411
|
+
|
|
412
|
+
// The `mcuToRead === 0` case should only occur when all of the expected
|
|
413
|
+
// MCU data has been already parsed, i.e. when `mcu === mcuExpected`, but
|
|
414
|
+
// some corrupt JPEG images contain more data than intended and we thus
|
|
415
|
+
// want to skip over any extra RSTx markers below (fixes issue11794.pdf).
|
|
416
|
+
if (mcuToRead > 0) {
|
|
417
|
+
for (i = 0; i < componentsLength; i++) {
|
|
418
|
+
components[i].pred = 0;
|
|
419
|
+
}
|
|
420
|
+
eobrun = 0;
|
|
421
|
+
|
|
422
|
+
if (componentsLength === 1) {
|
|
423
|
+
component = components[0];
|
|
424
|
+
for (n = 0; n < mcuToRead; n++) {
|
|
425
|
+
decodeBlock(component, decodeFn, mcu);
|
|
426
|
+
mcu++;
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
for (n = 0; n < mcuToRead; n++) {
|
|
430
|
+
for (i = 0; i < componentsLength; i++) {
|
|
431
|
+
component = components[i];
|
|
432
|
+
h = component.h;
|
|
433
|
+
v = component.v;
|
|
434
|
+
for (j = 0; j < v; j++) {
|
|
435
|
+
for (k = 0; k < h; k++) {
|
|
436
|
+
decodeMcu(component, decodeFn, mcu, j, k);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
mcu++;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// find marker
|
|
446
|
+
bitsCount = 0;
|
|
447
|
+
fileMarker = findNextFileMarker(data, offset);
|
|
448
|
+
if (!fileMarker) {
|
|
449
|
+
break; // Reached the end of the image data without finding any marker.
|
|
450
|
+
}
|
|
451
|
+
if (fileMarker.invalid) {
|
|
452
|
+
// Some bad images seem to pad Scan blocks with e.g. zero bytes, skip
|
|
453
|
+
// past those to attempt to find a valid marker (fixes issue4090.pdf).
|
|
454
|
+
const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
|
|
455
|
+
warn(
|
|
456
|
+
`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`
|
|
457
|
+
);
|
|
458
|
+
offset = fileMarker.offset;
|
|
459
|
+
}
|
|
460
|
+
if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
|
|
461
|
+
// RSTx
|
|
462
|
+
offset += 2;
|
|
463
|
+
} else {
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return offset - startOffset;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// A port of poppler's IDCT method which in turn is taken from:
|
|
472
|
+
// Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz,
|
|
473
|
+
// 'Practical Fast 1-D DCT Algorithms with 11 Multiplications',
|
|
474
|
+
// IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989,
|
|
475
|
+
// 988-991.
|
|
476
|
+
function quantizeAndInverse(component, blockBufferOffset, p) {
|
|
477
|
+
const qt = component.quantizationTable,
|
|
478
|
+
blockData = component.blockData;
|
|
479
|
+
let v0, v1, v2, v3, v4, v5, v6, v7;
|
|
480
|
+
let p0, p1, p2, p3, p4, p5, p6, p7;
|
|
481
|
+
let t;
|
|
482
|
+
|
|
483
|
+
if (!qt) {
|
|
484
|
+
throw new JpegError("missing required Quantization Table.");
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// inverse DCT on rows
|
|
488
|
+
for (let row = 0; row < 64; row += 8) {
|
|
489
|
+
// gather block data
|
|
490
|
+
p0 = blockData[blockBufferOffset + row];
|
|
491
|
+
p1 = blockData[blockBufferOffset + row + 1];
|
|
492
|
+
p2 = blockData[blockBufferOffset + row + 2];
|
|
493
|
+
p3 = blockData[blockBufferOffset + row + 3];
|
|
494
|
+
p4 = blockData[blockBufferOffset + row + 4];
|
|
495
|
+
p5 = blockData[blockBufferOffset + row + 5];
|
|
496
|
+
p6 = blockData[blockBufferOffset + row + 6];
|
|
497
|
+
p7 = blockData[blockBufferOffset + row + 7];
|
|
498
|
+
|
|
499
|
+
// dequant p0
|
|
500
|
+
p0 *= qt[row];
|
|
501
|
+
|
|
502
|
+
// check for all-zero AC coefficients
|
|
503
|
+
if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
|
|
504
|
+
t = (dctSqrt2 * p0 + 512) >> 10;
|
|
505
|
+
p[row] = t;
|
|
506
|
+
p[row + 1] = t;
|
|
507
|
+
p[row + 2] = t;
|
|
508
|
+
p[row + 3] = t;
|
|
509
|
+
p[row + 4] = t;
|
|
510
|
+
p[row + 5] = t;
|
|
511
|
+
p[row + 6] = t;
|
|
512
|
+
p[row + 7] = t;
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
// dequant p1 ... p7
|
|
516
|
+
p1 *= qt[row + 1];
|
|
517
|
+
p2 *= qt[row + 2];
|
|
518
|
+
p3 *= qt[row + 3];
|
|
519
|
+
p4 *= qt[row + 4];
|
|
520
|
+
p5 *= qt[row + 5];
|
|
521
|
+
p6 *= qt[row + 6];
|
|
522
|
+
p7 *= qt[row + 7];
|
|
523
|
+
|
|
524
|
+
// stage 4
|
|
525
|
+
v0 = (dctSqrt2 * p0 + 128) >> 8;
|
|
526
|
+
v1 = (dctSqrt2 * p4 + 128) >> 8;
|
|
527
|
+
v2 = p2;
|
|
528
|
+
v3 = p6;
|
|
529
|
+
v4 = (dctSqrt1d2 * (p1 - p7) + 128) >> 8;
|
|
530
|
+
v7 = (dctSqrt1d2 * (p1 + p7) + 128) >> 8;
|
|
531
|
+
v5 = p3 << 4;
|
|
532
|
+
v6 = p5 << 4;
|
|
533
|
+
|
|
534
|
+
// stage 3
|
|
535
|
+
v0 = (v0 + v1 + 1) >> 1;
|
|
536
|
+
v1 = v0 - v1;
|
|
537
|
+
t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8;
|
|
538
|
+
v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8;
|
|
539
|
+
v3 = t;
|
|
540
|
+
v4 = (v4 + v6 + 1) >> 1;
|
|
541
|
+
v6 = v4 - v6;
|
|
542
|
+
v7 = (v7 + v5 + 1) >> 1;
|
|
543
|
+
v5 = v7 - v5;
|
|
544
|
+
|
|
545
|
+
// stage 2
|
|
546
|
+
v0 = (v0 + v3 + 1) >> 1;
|
|
547
|
+
v3 = v0 - v3;
|
|
548
|
+
v1 = (v1 + v2 + 1) >> 1;
|
|
549
|
+
v2 = v1 - v2;
|
|
550
|
+
t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
|
|
551
|
+
v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
|
|
552
|
+
v7 = t;
|
|
553
|
+
t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
|
|
554
|
+
v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
|
|
555
|
+
v6 = t;
|
|
556
|
+
|
|
557
|
+
// stage 1
|
|
558
|
+
p[row] = v0 + v7;
|
|
559
|
+
p[row + 7] = v0 - v7;
|
|
560
|
+
p[row + 1] = v1 + v6;
|
|
561
|
+
p[row + 6] = v1 - v6;
|
|
562
|
+
p[row + 2] = v2 + v5;
|
|
563
|
+
p[row + 5] = v2 - v5;
|
|
564
|
+
p[row + 3] = v3 + v4;
|
|
565
|
+
p[row + 4] = v3 - v4;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// inverse DCT on columns
|
|
569
|
+
for (let col = 0; col < 8; ++col) {
|
|
570
|
+
p0 = p[col];
|
|
571
|
+
p1 = p[col + 8];
|
|
572
|
+
p2 = p[col + 16];
|
|
573
|
+
p3 = p[col + 24];
|
|
574
|
+
p4 = p[col + 32];
|
|
575
|
+
p5 = p[col + 40];
|
|
576
|
+
p6 = p[col + 48];
|
|
577
|
+
p7 = p[col + 56];
|
|
578
|
+
|
|
579
|
+
// check for all-zero AC coefficients
|
|
580
|
+
if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
|
|
581
|
+
t = (dctSqrt2 * p0 + 8192) >> 14;
|
|
582
|
+
// Convert to 8-bit.
|
|
583
|
+
if (t < -2040) {
|
|
584
|
+
t = 0;
|
|
585
|
+
} else if (t >= 2024) {
|
|
586
|
+
t = 255;
|
|
587
|
+
} else {
|
|
588
|
+
t = (t + 2056) >> 4;
|
|
589
|
+
}
|
|
590
|
+
blockData[blockBufferOffset + col] = t;
|
|
591
|
+
blockData[blockBufferOffset + col + 8] = t;
|
|
592
|
+
blockData[blockBufferOffset + col + 16] = t;
|
|
593
|
+
blockData[blockBufferOffset + col + 24] = t;
|
|
594
|
+
blockData[blockBufferOffset + col + 32] = t;
|
|
595
|
+
blockData[blockBufferOffset + col + 40] = t;
|
|
596
|
+
blockData[blockBufferOffset + col + 48] = t;
|
|
597
|
+
blockData[blockBufferOffset + col + 56] = t;
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// stage 4
|
|
602
|
+
v0 = (dctSqrt2 * p0 + 2048) >> 12;
|
|
603
|
+
v1 = (dctSqrt2 * p4 + 2048) >> 12;
|
|
604
|
+
v2 = p2;
|
|
605
|
+
v3 = p6;
|
|
606
|
+
v4 = (dctSqrt1d2 * (p1 - p7) + 2048) >> 12;
|
|
607
|
+
v7 = (dctSqrt1d2 * (p1 + p7) + 2048) >> 12;
|
|
608
|
+
v5 = p3;
|
|
609
|
+
v6 = p5;
|
|
610
|
+
|
|
611
|
+
// stage 3
|
|
612
|
+
// Shift v0 by 128.5 << 5 here, so we don't need to shift p0...p7 when
|
|
613
|
+
// converting to UInt8 range later.
|
|
614
|
+
v0 = ((v0 + v1 + 1) >> 1) + 4112;
|
|
615
|
+
v1 = v0 - v1;
|
|
616
|
+
t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;
|
|
617
|
+
v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12;
|
|
618
|
+
v3 = t;
|
|
619
|
+
v4 = (v4 + v6 + 1) >> 1;
|
|
620
|
+
v6 = v4 - v6;
|
|
621
|
+
v7 = (v7 + v5 + 1) >> 1;
|
|
622
|
+
v5 = v7 - v5;
|
|
623
|
+
|
|
624
|
+
// stage 2
|
|
625
|
+
v0 = (v0 + v3 + 1) >> 1;
|
|
626
|
+
v3 = v0 - v3;
|
|
627
|
+
v1 = (v1 + v2 + 1) >> 1;
|
|
628
|
+
v2 = v1 - v2;
|
|
629
|
+
t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
|
|
630
|
+
v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
|
|
631
|
+
v7 = t;
|
|
632
|
+
t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
|
|
633
|
+
v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
|
|
634
|
+
v6 = t;
|
|
635
|
+
|
|
636
|
+
// stage 1
|
|
637
|
+
p0 = v0 + v7;
|
|
638
|
+
p7 = v0 - v7;
|
|
639
|
+
p1 = v1 + v6;
|
|
640
|
+
p6 = v1 - v6;
|
|
641
|
+
p2 = v2 + v5;
|
|
642
|
+
p5 = v2 - v5;
|
|
643
|
+
p3 = v3 + v4;
|
|
644
|
+
p4 = v3 - v4;
|
|
645
|
+
|
|
646
|
+
// Convert to 8-bit integers.
|
|
647
|
+
if (p0 < 16) {
|
|
648
|
+
p0 = 0;
|
|
649
|
+
} else if (p0 >= 4080) {
|
|
650
|
+
p0 = 255;
|
|
651
|
+
} else {
|
|
652
|
+
p0 >>= 4;
|
|
653
|
+
}
|
|
654
|
+
if (p1 < 16) {
|
|
655
|
+
p1 = 0;
|
|
656
|
+
} else if (p1 >= 4080) {
|
|
657
|
+
p1 = 255;
|
|
658
|
+
} else {
|
|
659
|
+
p1 >>= 4;
|
|
660
|
+
}
|
|
661
|
+
if (p2 < 16) {
|
|
662
|
+
p2 = 0;
|
|
663
|
+
} else if (p2 >= 4080) {
|
|
664
|
+
p2 = 255;
|
|
665
|
+
} else {
|
|
666
|
+
p2 >>= 4;
|
|
667
|
+
}
|
|
668
|
+
if (p3 < 16) {
|
|
669
|
+
p3 = 0;
|
|
670
|
+
} else if (p3 >= 4080) {
|
|
671
|
+
p3 = 255;
|
|
672
|
+
} else {
|
|
673
|
+
p3 >>= 4;
|
|
674
|
+
}
|
|
675
|
+
if (p4 < 16) {
|
|
676
|
+
p4 = 0;
|
|
677
|
+
} else if (p4 >= 4080) {
|
|
678
|
+
p4 = 255;
|
|
679
|
+
} else {
|
|
680
|
+
p4 >>= 4;
|
|
681
|
+
}
|
|
682
|
+
if (p5 < 16) {
|
|
683
|
+
p5 = 0;
|
|
684
|
+
} else if (p5 >= 4080) {
|
|
685
|
+
p5 = 255;
|
|
686
|
+
} else {
|
|
687
|
+
p5 >>= 4;
|
|
688
|
+
}
|
|
689
|
+
if (p6 < 16) {
|
|
690
|
+
p6 = 0;
|
|
691
|
+
} else if (p6 >= 4080) {
|
|
692
|
+
p6 = 255;
|
|
693
|
+
} else {
|
|
694
|
+
p6 >>= 4;
|
|
695
|
+
}
|
|
696
|
+
if (p7 < 16) {
|
|
697
|
+
p7 = 0;
|
|
698
|
+
} else if (p7 >= 4080) {
|
|
699
|
+
p7 = 255;
|
|
700
|
+
} else {
|
|
701
|
+
p7 >>= 4;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// store block data
|
|
705
|
+
blockData[blockBufferOffset + col] = p0;
|
|
706
|
+
blockData[blockBufferOffset + col + 8] = p1;
|
|
707
|
+
blockData[blockBufferOffset + col + 16] = p2;
|
|
708
|
+
blockData[blockBufferOffset + col + 24] = p3;
|
|
709
|
+
blockData[blockBufferOffset + col + 32] = p4;
|
|
710
|
+
blockData[blockBufferOffset + col + 40] = p5;
|
|
711
|
+
blockData[blockBufferOffset + col + 48] = p6;
|
|
712
|
+
blockData[blockBufferOffset + col + 56] = p7;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function buildComponentData(frame, component) {
|
|
717
|
+
const blocksPerLine = component.blocksPerLine;
|
|
718
|
+
const blocksPerColumn = component.blocksPerColumn;
|
|
719
|
+
const computationBuffer = new Int16Array(64);
|
|
720
|
+
|
|
721
|
+
for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
|
|
722
|
+
for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
|
|
723
|
+
const offset = getBlockBufferOffset(component, blockRow, blockCol);
|
|
724
|
+
quantizeAndInverse(component, offset, computationBuffer);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return component.blockData;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function findNextFileMarker(data, currentPos, startPos = currentPos) {
|
|
731
|
+
const maxPos = data.length - 1;
|
|
732
|
+
let newPos = startPos < currentPos ? startPos : currentPos;
|
|
733
|
+
|
|
734
|
+
if (currentPos >= maxPos) {
|
|
735
|
+
return null; // Don't attempt to read non-existent data and just return.
|
|
736
|
+
}
|
|
737
|
+
const currentMarker = readUint16(data, currentPos);
|
|
738
|
+
if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
|
|
739
|
+
return {
|
|
740
|
+
invalid: null,
|
|
741
|
+
marker: currentMarker,
|
|
742
|
+
offset: currentPos,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
let newMarker = readUint16(data, newPos);
|
|
746
|
+
while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
|
|
747
|
+
if (++newPos >= maxPos) {
|
|
748
|
+
return null; // Don't attempt to read non-existent data and just return.
|
|
749
|
+
}
|
|
750
|
+
newMarker = readUint16(data, newPos);
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
invalid: currentMarker.toString(16),
|
|
754
|
+
marker: newMarker,
|
|
755
|
+
offset: newPos,
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
class JpegImage {
|
|
760
|
+
constructor({ decodeTransform = null, colorTransform = -1 } = {}) {
|
|
761
|
+
this._decodeTransform = decodeTransform;
|
|
762
|
+
this._colorTransform = colorTransform;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
parse(data, { dnlScanLines = null } = {}) {
|
|
766
|
+
function readDataBlock() {
|
|
767
|
+
const length = readUint16(data, offset);
|
|
768
|
+
offset += 2;
|
|
769
|
+
let endOffset = offset + length - 2;
|
|
770
|
+
|
|
771
|
+
const fileMarker = findNextFileMarker(data, endOffset, offset);
|
|
772
|
+
if (fileMarker?.invalid) {
|
|
773
|
+
warn(
|
|
774
|
+
"readDataBlock - incorrect length, current marker is: " +
|
|
775
|
+
fileMarker.invalid
|
|
776
|
+
);
|
|
777
|
+
endOffset = fileMarker.offset;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const array = data.subarray(offset, endOffset);
|
|
781
|
+
offset += array.length;
|
|
782
|
+
return array;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function prepareComponents(frame) {
|
|
786
|
+
const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
|
|
787
|
+
const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
|
|
788
|
+
for (const component of frame.components) {
|
|
789
|
+
const blocksPerLine = Math.ceil(
|
|
790
|
+
(Math.ceil(frame.samplesPerLine / 8) * component.h) / frame.maxH
|
|
791
|
+
);
|
|
792
|
+
const blocksPerColumn = Math.ceil(
|
|
793
|
+
(Math.ceil(frame.scanLines / 8) * component.v) / frame.maxV
|
|
794
|
+
);
|
|
795
|
+
const blocksPerLineForMcu = mcusPerLine * component.h;
|
|
796
|
+
const blocksPerColumnForMcu = mcusPerColumn * component.v;
|
|
797
|
+
|
|
798
|
+
const blocksBufferSize =
|
|
799
|
+
64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
|
|
800
|
+
component.blockData = new Int16Array(blocksBufferSize);
|
|
801
|
+
component.blocksPerLine = blocksPerLine;
|
|
802
|
+
component.blocksPerColumn = blocksPerColumn;
|
|
803
|
+
}
|
|
804
|
+
frame.mcusPerLine = mcusPerLine;
|
|
805
|
+
frame.mcusPerColumn = mcusPerColumn;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
let offset = 0;
|
|
809
|
+
let jfif = null;
|
|
810
|
+
let adobe = null;
|
|
811
|
+
let frame, resetInterval;
|
|
812
|
+
let numSOSMarkers = 0;
|
|
813
|
+
const quantizationTables = [];
|
|
814
|
+
const huffmanTablesAC = [],
|
|
815
|
+
huffmanTablesDC = [];
|
|
816
|
+
|
|
817
|
+
let fileMarker = readUint16(data, offset);
|
|
818
|
+
offset += 2;
|
|
819
|
+
if (fileMarker !== /* SOI (Start of Image) = */ 0xffd8) {
|
|
820
|
+
throw new JpegError("SOI not found");
|
|
821
|
+
}
|
|
822
|
+
fileMarker = readUint16(data, offset);
|
|
823
|
+
offset += 2;
|
|
824
|
+
|
|
825
|
+
markerLoop: while (fileMarker !== /* EOI (End of Image) = */ 0xffd9) {
|
|
826
|
+
let i, j, l;
|
|
827
|
+
switch (fileMarker) {
|
|
828
|
+
case 0xffe0: // APP0 (Application Specific)
|
|
829
|
+
case 0xffe1: // APP1
|
|
830
|
+
case 0xffe2: // APP2
|
|
831
|
+
case 0xffe3: // APP3
|
|
832
|
+
case 0xffe4: // APP4
|
|
833
|
+
case 0xffe5: // APP5
|
|
834
|
+
case 0xffe6: // APP6
|
|
835
|
+
case 0xffe7: // APP7
|
|
836
|
+
case 0xffe8: // APP8
|
|
837
|
+
case 0xffe9: // APP9
|
|
838
|
+
case 0xffea: // APP10
|
|
839
|
+
case 0xffeb: // APP11
|
|
840
|
+
case 0xffec: // APP12
|
|
841
|
+
case 0xffed: // APP13
|
|
842
|
+
case 0xffee: // APP14
|
|
843
|
+
case 0xffef: // APP15
|
|
844
|
+
case 0xfffe: // COM (Comment)
|
|
845
|
+
const appData = readDataBlock();
|
|
846
|
+
|
|
847
|
+
if (fileMarker === 0xffe0) {
|
|
848
|
+
// 'JFIF\x00'
|
|
849
|
+
if (
|
|
850
|
+
appData[0] === 0x4a &&
|
|
851
|
+
appData[1] === 0x46 &&
|
|
852
|
+
appData[2] === 0x49 &&
|
|
853
|
+
appData[3] === 0x46 &&
|
|
854
|
+
appData[4] === 0
|
|
855
|
+
) {
|
|
856
|
+
jfif = {
|
|
857
|
+
version: { major: appData[5], minor: appData[6] },
|
|
858
|
+
densityUnits: appData[7],
|
|
859
|
+
xDensity: (appData[8] << 8) | appData[9],
|
|
860
|
+
yDensity: (appData[10] << 8) | appData[11],
|
|
861
|
+
thumbWidth: appData[12],
|
|
862
|
+
thumbHeight: appData[13],
|
|
863
|
+
thumbData: appData.subarray(
|
|
864
|
+
14,
|
|
865
|
+
14 + 3 * appData[12] * appData[13]
|
|
866
|
+
),
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
// TODO APP1 - Exif
|
|
871
|
+
if (fileMarker === 0xffee) {
|
|
872
|
+
// 'Adobe'
|
|
873
|
+
if (
|
|
874
|
+
appData[0] === 0x41 &&
|
|
875
|
+
appData[1] === 0x64 &&
|
|
876
|
+
appData[2] === 0x6f &&
|
|
877
|
+
appData[3] === 0x62 &&
|
|
878
|
+
appData[4] === 0x65
|
|
879
|
+
) {
|
|
880
|
+
adobe = {
|
|
881
|
+
version: (appData[5] << 8) | appData[6],
|
|
882
|
+
flags0: (appData[7] << 8) | appData[8],
|
|
883
|
+
flags1: (appData[9] << 8) | appData[10],
|
|
884
|
+
transformCode: appData[11],
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
break;
|
|
889
|
+
|
|
890
|
+
case 0xffdb: // DQT (Define Quantization Tables)
|
|
891
|
+
const quantizationTablesLength = readUint16(data, offset);
|
|
892
|
+
offset += 2;
|
|
893
|
+
const quantizationTablesEnd = quantizationTablesLength + offset - 2;
|
|
894
|
+
let z;
|
|
895
|
+
while (offset < quantizationTablesEnd) {
|
|
896
|
+
const quantizationTableSpec = data[offset++];
|
|
897
|
+
const tableData = new Uint16Array(64);
|
|
898
|
+
if (quantizationTableSpec >> 4 === 0) {
|
|
899
|
+
// 8 bit values
|
|
900
|
+
for (j = 0; j < 64; j++) {
|
|
901
|
+
z = dctZigZag[j];
|
|
902
|
+
tableData[z] = data[offset++];
|
|
903
|
+
}
|
|
904
|
+
} else if (quantizationTableSpec >> 4 === 1) {
|
|
905
|
+
// 16 bit values
|
|
906
|
+
for (j = 0; j < 64; j++) {
|
|
907
|
+
z = dctZigZag[j];
|
|
908
|
+
tableData[z] = readUint16(data, offset);
|
|
909
|
+
offset += 2;
|
|
910
|
+
}
|
|
911
|
+
} else {
|
|
912
|
+
throw new JpegError("DQT - invalid table spec");
|
|
913
|
+
}
|
|
914
|
+
quantizationTables[quantizationTableSpec & 15] = tableData;
|
|
915
|
+
}
|
|
916
|
+
break;
|
|
917
|
+
|
|
918
|
+
case 0xffc0: // SOF0 (Start of Frame, Baseline DCT)
|
|
919
|
+
case 0xffc1: // SOF1 (Start of Frame, Extended DCT)
|
|
920
|
+
case 0xffc2: // SOF2 (Start of Frame, Progressive DCT)
|
|
921
|
+
if (frame) {
|
|
922
|
+
throw new JpegError("Only single frame JPEGs supported");
|
|
923
|
+
}
|
|
924
|
+
offset += 2; // Skip marker length.
|
|
925
|
+
|
|
926
|
+
frame = {};
|
|
927
|
+
frame.extended = fileMarker === 0xffc1;
|
|
928
|
+
frame.progressive = fileMarker === 0xffc2;
|
|
929
|
+
frame.precision = data[offset++];
|
|
930
|
+
const sofScanLines = readUint16(data, offset);
|
|
931
|
+
offset += 2;
|
|
932
|
+
frame.scanLines = dnlScanLines || sofScanLines;
|
|
933
|
+
frame.samplesPerLine = readUint16(data, offset);
|
|
934
|
+
offset += 2;
|
|
935
|
+
frame.components = [];
|
|
936
|
+
frame.componentIds = {};
|
|
937
|
+
const componentsCount = data[offset++];
|
|
938
|
+
let maxH = 0,
|
|
939
|
+
maxV = 0;
|
|
940
|
+
for (i = 0; i < componentsCount; i++) {
|
|
941
|
+
const componentId = data[offset];
|
|
942
|
+
const h = data[offset + 1] >> 4;
|
|
943
|
+
const v = data[offset + 1] & 15;
|
|
944
|
+
if (maxH < h) {
|
|
945
|
+
maxH = h;
|
|
946
|
+
}
|
|
947
|
+
if (maxV < v) {
|
|
948
|
+
maxV = v;
|
|
949
|
+
}
|
|
950
|
+
const qId = data[offset + 2];
|
|
951
|
+
l = frame.components.push({
|
|
952
|
+
h,
|
|
953
|
+
v,
|
|
954
|
+
quantizationId: qId,
|
|
955
|
+
quantizationTable: null, // See comment below.
|
|
956
|
+
});
|
|
957
|
+
frame.componentIds[componentId] = l - 1;
|
|
958
|
+
offset += 3;
|
|
959
|
+
}
|
|
960
|
+
frame.maxH = maxH;
|
|
961
|
+
frame.maxV = maxV;
|
|
962
|
+
prepareComponents(frame);
|
|
963
|
+
break;
|
|
964
|
+
|
|
965
|
+
case 0xffc4: // DHT (Define Huffman Tables)
|
|
966
|
+
const huffmanLength = readUint16(data, offset);
|
|
967
|
+
offset += 2;
|
|
968
|
+
for (i = 2; i < huffmanLength; ) {
|
|
969
|
+
const huffmanTableSpec = data[offset++];
|
|
970
|
+
const codeLengths = new Uint8Array(16);
|
|
971
|
+
let codeLengthSum = 0;
|
|
972
|
+
for (j = 0; j < 16; j++, offset++) {
|
|
973
|
+
codeLengthSum += codeLengths[j] = data[offset];
|
|
974
|
+
}
|
|
975
|
+
const huffmanValues = new Uint8Array(codeLengthSum);
|
|
976
|
+
for (j = 0; j < codeLengthSum; j++, offset++) {
|
|
977
|
+
huffmanValues[j] = data[offset];
|
|
978
|
+
}
|
|
979
|
+
i += 17 + codeLengthSum;
|
|
980
|
+
|
|
981
|
+
(huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[
|
|
982
|
+
huffmanTableSpec & 15
|
|
983
|
+
] = buildHuffmanTable(codeLengths, huffmanValues);
|
|
984
|
+
}
|
|
985
|
+
break;
|
|
986
|
+
|
|
987
|
+
case 0xffdd: // DRI (Define Restart Interval)
|
|
988
|
+
offset += 2; // Skip marker length.
|
|
989
|
+
|
|
990
|
+
resetInterval = readUint16(data, offset);
|
|
991
|
+
offset += 2;
|
|
992
|
+
break;
|
|
993
|
+
|
|
994
|
+
case 0xffda: // SOS (Start of Scan)
|
|
995
|
+
// A DNL marker (0xFFDC), if it exists, is only allowed at the end
|
|
996
|
+
// of the first scan segment and may only occur once in an image.
|
|
997
|
+
// Furthermore, to prevent an infinite loop, do *not* attempt to
|
|
998
|
+
// parse DNL markers during re-parsing of the JPEG scan data.
|
|
999
|
+
const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
|
|
1000
|
+
|
|
1001
|
+
offset += 2; // Skip marker length.
|
|
1002
|
+
|
|
1003
|
+
const selectorsCount = data[offset++],
|
|
1004
|
+
components = [];
|
|
1005
|
+
for (i = 0; i < selectorsCount; i++) {
|
|
1006
|
+
const index = data[offset++];
|
|
1007
|
+
const componentIndex = frame.componentIds[index];
|
|
1008
|
+
const component = frame.components[componentIndex];
|
|
1009
|
+
component.index = index;
|
|
1010
|
+
const tableSpec = data[offset++];
|
|
1011
|
+
component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
|
|
1012
|
+
component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
|
|
1013
|
+
components.push(component);
|
|
1014
|
+
}
|
|
1015
|
+
const spectralStart = data[offset++],
|
|
1016
|
+
spectralEnd = data[offset++],
|
|
1017
|
+
successiveApproximation = data[offset++];
|
|
1018
|
+
try {
|
|
1019
|
+
const processed = decodeScan(
|
|
1020
|
+
data,
|
|
1021
|
+
offset,
|
|
1022
|
+
frame,
|
|
1023
|
+
components,
|
|
1024
|
+
resetInterval,
|
|
1025
|
+
spectralStart,
|
|
1026
|
+
spectralEnd,
|
|
1027
|
+
successiveApproximation >> 4,
|
|
1028
|
+
successiveApproximation & 15,
|
|
1029
|
+
parseDNLMarker
|
|
1030
|
+
);
|
|
1031
|
+
offset += processed;
|
|
1032
|
+
} catch (ex) {
|
|
1033
|
+
if (ex instanceof DNLMarkerError) {
|
|
1034
|
+
warn(`${ex.message} -- attempting to re-parse the JPEG image.`);
|
|
1035
|
+
return this.parse(data, { dnlScanLines: ex.scanLines });
|
|
1036
|
+
} else if (ex instanceof EOIMarkerError) {
|
|
1037
|
+
warn(`${ex.message} -- ignoring the rest of the image data.`);
|
|
1038
|
+
break markerLoop;
|
|
1039
|
+
}
|
|
1040
|
+
throw ex;
|
|
1041
|
+
}
|
|
1042
|
+
break;
|
|
1043
|
+
|
|
1044
|
+
case 0xffdc: // DNL (Define Number of Lines)
|
|
1045
|
+
// Ignore the marker, since it's being handled in `decodeScan`.
|
|
1046
|
+
offset += 4;
|
|
1047
|
+
break;
|
|
1048
|
+
|
|
1049
|
+
case 0xffff: // Fill bytes
|
|
1050
|
+
if (data[offset] !== 0xff) {
|
|
1051
|
+
// Avoid skipping a valid marker.
|
|
1052
|
+
offset--;
|
|
1053
|
+
}
|
|
1054
|
+
break;
|
|
1055
|
+
|
|
1056
|
+
default:
|
|
1057
|
+
// Could be incorrect encoding -- the last 0xFF byte of the previous
|
|
1058
|
+
// block could have been eaten by the encoder, hence we fallback to
|
|
1059
|
+
// `startPos = offset - 3` when looking for the next valid marker.
|
|
1060
|
+
const nextFileMarker = findNextFileMarker(
|
|
1061
|
+
data,
|
|
1062
|
+
/* currentPos = */ offset - 2,
|
|
1063
|
+
/* startPos = */ offset - 3
|
|
1064
|
+
);
|
|
1065
|
+
if (nextFileMarker?.invalid) {
|
|
1066
|
+
warn(
|
|
1067
|
+
"JpegImage.parse - unexpected data, current marker is: " +
|
|
1068
|
+
nextFileMarker.invalid
|
|
1069
|
+
);
|
|
1070
|
+
offset = nextFileMarker.offset;
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
if (!nextFileMarker || offset >= data.length - 1) {
|
|
1074
|
+
warn(
|
|
1075
|
+
"JpegImage.parse - reached the end of the image data " +
|
|
1076
|
+
"without finding an EOI marker (0xFFD9)."
|
|
1077
|
+
);
|
|
1078
|
+
break markerLoop;
|
|
1079
|
+
}
|
|
1080
|
+
throw new JpegError(
|
|
1081
|
+
"JpegImage.parse - unknown marker: " + fileMarker.toString(16)
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
fileMarker = readUint16(data, offset);
|
|
1085
|
+
offset += 2;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
if (!frame) {
|
|
1089
|
+
throw new JpegError("JpegImage.parse - no frame data found.");
|
|
1090
|
+
}
|
|
1091
|
+
this.width = frame.samplesPerLine;
|
|
1092
|
+
this.height = frame.scanLines;
|
|
1093
|
+
this.jfif = jfif;
|
|
1094
|
+
this.adobe = adobe;
|
|
1095
|
+
this.components = [];
|
|
1096
|
+
for (const component of frame.components) {
|
|
1097
|
+
// Prevent errors when DQT markers are placed after SOF{n} markers,
|
|
1098
|
+
// by assigning the `quantizationTable` entry after the entire image
|
|
1099
|
+
// has been parsed (fixes issue7406.pdf).
|
|
1100
|
+
const quantizationTable = quantizationTables[component.quantizationId];
|
|
1101
|
+
if (quantizationTable) {
|
|
1102
|
+
component.quantizationTable = quantizationTable;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
this.components.push({
|
|
1106
|
+
index: component.index,
|
|
1107
|
+
output: buildComponentData(frame, component),
|
|
1108
|
+
scaleX: component.h / frame.maxH,
|
|
1109
|
+
scaleY: component.v / frame.maxV,
|
|
1110
|
+
blocksPerLine: component.blocksPerLine,
|
|
1111
|
+
blocksPerColumn: component.blocksPerColumn,
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
this.numComponents = this.components.length;
|
|
1115
|
+
return undefined;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
_getLinearizedBlockData(width, height, isSourcePDF = false) {
|
|
1119
|
+
const scaleX = this.width / width,
|
|
1120
|
+
scaleY = this.height / height;
|
|
1121
|
+
|
|
1122
|
+
let component, componentScaleX, componentScaleY, blocksPerScanline;
|
|
1123
|
+
let x, y, i, j, k;
|
|
1124
|
+
let index;
|
|
1125
|
+
let offset = 0;
|
|
1126
|
+
let output;
|
|
1127
|
+
const numComponents = this.components.length;
|
|
1128
|
+
const dataLength = width * height * numComponents;
|
|
1129
|
+
const data = new Uint8ClampedArray(dataLength);
|
|
1130
|
+
const xScaleBlockOffset = new Uint32Array(width);
|
|
1131
|
+
const mask3LSB = 0xfffffff8; // used to clear the 3 LSBs
|
|
1132
|
+
let lastComponentScaleX;
|
|
1133
|
+
|
|
1134
|
+
for (i = 0; i < numComponents; i++) {
|
|
1135
|
+
component = this.components[i];
|
|
1136
|
+
componentScaleX = component.scaleX * scaleX;
|
|
1137
|
+
componentScaleY = component.scaleY * scaleY;
|
|
1138
|
+
offset = i;
|
|
1139
|
+
output = component.output;
|
|
1140
|
+
blocksPerScanline = (component.blocksPerLine + 1) << 3;
|
|
1141
|
+
// Precalculate the `xScaleBlockOffset`. Since it doesn't depend on the
|
|
1142
|
+
// component data, that's only necessary when `componentScaleX` changes.
|
|
1143
|
+
if (componentScaleX !== lastComponentScaleX) {
|
|
1144
|
+
for (x = 0; x < width; x++) {
|
|
1145
|
+
j = 0 | (x * componentScaleX);
|
|
1146
|
+
xScaleBlockOffset[x] = ((j & mask3LSB) << 3) | (j & 7);
|
|
1147
|
+
}
|
|
1148
|
+
lastComponentScaleX = componentScaleX;
|
|
1149
|
+
}
|
|
1150
|
+
// linearize the blocks of the component
|
|
1151
|
+
for (y = 0; y < height; y++) {
|
|
1152
|
+
j = 0 | (y * componentScaleY);
|
|
1153
|
+
index = (blocksPerScanline * (j & mask3LSB)) | ((j & 7) << 3);
|
|
1154
|
+
for (x = 0; x < width; x++) {
|
|
1155
|
+
data[offset] = output[index + xScaleBlockOffset[x]];
|
|
1156
|
+
offset += numComponents;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// decodeTransform contains pairs of multiplier (-256..256) and additive
|
|
1162
|
+
let transform = this._decodeTransform;
|
|
1163
|
+
|
|
1164
|
+
// In PDF files, JPEG images with CMYK colour spaces are usually inverted
|
|
1165
|
+
// (this can be observed by extracting the raw image data).
|
|
1166
|
+
// Since the conversion algorithms (see below) were written primarily for
|
|
1167
|
+
// the PDF use-cases, attempting to use `JpegImage` to parse standalone
|
|
1168
|
+
// JPEG (CMYK) images may thus result in inverted images (see issue 9513).
|
|
1169
|
+
//
|
|
1170
|
+
// Unfortunately it's not (always) possible to tell, from the image data
|
|
1171
|
+
// alone, if it needs to be inverted. Thus in an attempt to provide better
|
|
1172
|
+
// out-of-box behaviour when `JpegImage` is used standalone, default to
|
|
1173
|
+
// inverting JPEG (CMYK) images if and only if the image data does *not*
|
|
1174
|
+
// come from a PDF file and no `decodeTransform` was passed by the user.
|
|
1175
|
+
if (!isSourcePDF && numComponents === 4 && !transform) {
|
|
1176
|
+
transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
if (transform) {
|
|
1180
|
+
for (i = 0; i < dataLength; ) {
|
|
1181
|
+
for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
|
|
1182
|
+
data[i] = ((data[i] * transform[k]) >> 8) + transform[k + 1];
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
return data;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
get _isColorConversionNeeded() {
|
|
1190
|
+
if (this.adobe) {
|
|
1191
|
+
// The adobe transform marker overrides any previous setting.
|
|
1192
|
+
return !!this.adobe.transformCode;
|
|
1193
|
+
}
|
|
1194
|
+
if (this.numComponents === 3) {
|
|
1195
|
+
if (this._colorTransform === 0) {
|
|
1196
|
+
// If the Adobe transform marker is not present and the image
|
|
1197
|
+
// dictionary has a 'ColorTransform' entry, explicitly set to `0`,
|
|
1198
|
+
// then the colours should *not* be transformed.
|
|
1199
|
+
return false;
|
|
1200
|
+
} else if (
|
|
1201
|
+
this.components[0].index === /* "R" = */ 0x52 &&
|
|
1202
|
+
this.components[1].index === /* "G" = */ 0x47 &&
|
|
1203
|
+
this.components[2].index === /* "B" = */ 0x42
|
|
1204
|
+
) {
|
|
1205
|
+
// If the three components are indexed as RGB in ASCII
|
|
1206
|
+
// then the colours should *not* be transformed.
|
|
1207
|
+
return false;
|
|
1208
|
+
}
|
|
1209
|
+
return true;
|
|
1210
|
+
}
|
|
1211
|
+
// `this.numComponents !== 3`
|
|
1212
|
+
if (this._colorTransform === 1) {
|
|
1213
|
+
// If the Adobe transform marker is not present and the image
|
|
1214
|
+
// dictionary has a 'ColorTransform' entry, explicitly set to `1`,
|
|
1215
|
+
// then the colours should be transformed.
|
|
1216
|
+
return true;
|
|
1217
|
+
}
|
|
1218
|
+
return false;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
_convertYccToRgb(data) {
|
|
1222
|
+
let Y, Cb, Cr;
|
|
1223
|
+
for (let i = 0, length = data.length; i < length; i += 3) {
|
|
1224
|
+
Y = data[i];
|
|
1225
|
+
Cb = data[i + 1];
|
|
1226
|
+
Cr = data[i + 2];
|
|
1227
|
+
data[i] = Y - 179.456 + 1.402 * Cr;
|
|
1228
|
+
data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
|
|
1229
|
+
data[i + 2] = Y - 226.816 + 1.772 * Cb;
|
|
1230
|
+
}
|
|
1231
|
+
return data;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
_convertYccToRgba(data, out) {
|
|
1235
|
+
for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) {
|
|
1236
|
+
const Y = data[i];
|
|
1237
|
+
const Cb = data[i + 1];
|
|
1238
|
+
const Cr = data[i + 2];
|
|
1239
|
+
out[j] = Y - 179.456 + 1.402 * Cr;
|
|
1240
|
+
out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
|
|
1241
|
+
out[j + 2] = Y - 226.816 + 1.772 * Cb;
|
|
1242
|
+
out[j + 3] = 255;
|
|
1243
|
+
}
|
|
1244
|
+
return out;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
_convertYcckToRgb(data) {
|
|
1248
|
+
let Y, Cb, Cr, k;
|
|
1249
|
+
let offset = 0;
|
|
1250
|
+
for (let i = 0, length = data.length; i < length; i += 4) {
|
|
1251
|
+
Y = data[i];
|
|
1252
|
+
Cb = data[i + 1];
|
|
1253
|
+
Cr = data[i + 2];
|
|
1254
|
+
k = data[i + 3];
|
|
1255
|
+
|
|
1256
|
+
data[offset++] =
|
|
1257
|
+
-122.67195406894 +
|
|
1258
|
+
Cb *
|
|
1259
|
+
(-6.60635669420364e-5 * Cb +
|
|
1260
|
+
0.000437130475926232 * Cr -
|
|
1261
|
+
5.4080610064599e-5 * Y +
|
|
1262
|
+
0.00048449797120281 * k -
|
|
1263
|
+
0.154362151871126) +
|
|
1264
|
+
Cr *
|
|
1265
|
+
(-0.000957964378445773 * Cr +
|
|
1266
|
+
0.000817076911346625 * Y -
|
|
1267
|
+
0.00477271405408747 * k +
|
|
1268
|
+
1.53380253221734) +
|
|
1269
|
+
Y *
|
|
1270
|
+
(0.000961250184130688 * Y -
|
|
1271
|
+
0.00266257332283933 * k +
|
|
1272
|
+
0.48357088451265) +
|
|
1273
|
+
k * (-0.000336197177618394 * k + 0.484791561490776);
|
|
1274
|
+
|
|
1275
|
+
data[offset++] =
|
|
1276
|
+
107.268039397724 +
|
|
1277
|
+
Cb *
|
|
1278
|
+
(2.19927104525741e-5 * Cb -
|
|
1279
|
+
0.000640992018297945 * Cr +
|
|
1280
|
+
0.000659397001245577 * Y +
|
|
1281
|
+
0.000426105652938837 * k -
|
|
1282
|
+
0.176491792462875) +
|
|
1283
|
+
Cr *
|
|
1284
|
+
(-0.000778269941513683 * Cr +
|
|
1285
|
+
0.00130872261408275 * Y +
|
|
1286
|
+
0.000770482631801132 * k -
|
|
1287
|
+
0.151051492775562) +
|
|
1288
|
+
Y *
|
|
1289
|
+
(0.00126935368114843 * Y -
|
|
1290
|
+
0.00265090189010898 * k +
|
|
1291
|
+
0.25802910206845) +
|
|
1292
|
+
k * (-0.000318913117588328 * k - 0.213742400323665);
|
|
1293
|
+
|
|
1294
|
+
data[offset++] =
|
|
1295
|
+
-20.810012546947 +
|
|
1296
|
+
Cb *
|
|
1297
|
+
(-0.000570115196973677 * Cb -
|
|
1298
|
+
2.63409051004589e-5 * Cr +
|
|
1299
|
+
0.0020741088115012 * Y -
|
|
1300
|
+
0.00288260236853442 * k +
|
|
1301
|
+
0.814272968359295) +
|
|
1302
|
+
Cr *
|
|
1303
|
+
(-1.53496057440975e-5 * Cr -
|
|
1304
|
+
0.000132689043961446 * Y +
|
|
1305
|
+
0.000560833691242812 * k -
|
|
1306
|
+
0.195152027534049) +
|
|
1307
|
+
Y *
|
|
1308
|
+
(0.00174418132927582 * Y -
|
|
1309
|
+
0.00255243321439347 * k +
|
|
1310
|
+
0.116935020465145) +
|
|
1311
|
+
k * (-0.000343531996510555 * k + 0.24165260232407);
|
|
1312
|
+
}
|
|
1313
|
+
// Ensure that only the converted RGB data is returned.
|
|
1314
|
+
return data.subarray(0, offset);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
_convertYcckToRgba(data) {
|
|
1318
|
+
for (let i = 0, length = data.length; i < length; i += 4) {
|
|
1319
|
+
const Y = data[i];
|
|
1320
|
+
const Cb = data[i + 1];
|
|
1321
|
+
const Cr = data[i + 2];
|
|
1322
|
+
const k = data[i + 3];
|
|
1323
|
+
|
|
1324
|
+
data[i] =
|
|
1325
|
+
-122.67195406894 +
|
|
1326
|
+
Cb *
|
|
1327
|
+
(-6.60635669420364e-5 * Cb +
|
|
1328
|
+
0.000437130475926232 * Cr -
|
|
1329
|
+
5.4080610064599e-5 * Y +
|
|
1330
|
+
0.00048449797120281 * k -
|
|
1331
|
+
0.154362151871126) +
|
|
1332
|
+
Cr *
|
|
1333
|
+
(-0.000957964378445773 * Cr +
|
|
1334
|
+
0.000817076911346625 * Y -
|
|
1335
|
+
0.00477271405408747 * k +
|
|
1336
|
+
1.53380253221734) +
|
|
1337
|
+
Y *
|
|
1338
|
+
(0.000961250184130688 * Y -
|
|
1339
|
+
0.00266257332283933 * k +
|
|
1340
|
+
0.48357088451265) +
|
|
1341
|
+
k * (-0.000336197177618394 * k + 0.484791561490776);
|
|
1342
|
+
|
|
1343
|
+
data[i + 1] =
|
|
1344
|
+
107.268039397724 +
|
|
1345
|
+
Cb *
|
|
1346
|
+
(2.19927104525741e-5 * Cb -
|
|
1347
|
+
0.000640992018297945 * Cr +
|
|
1348
|
+
0.000659397001245577 * Y +
|
|
1349
|
+
0.000426105652938837 * k -
|
|
1350
|
+
0.176491792462875) +
|
|
1351
|
+
Cr *
|
|
1352
|
+
(-0.000778269941513683 * Cr +
|
|
1353
|
+
0.00130872261408275 * Y +
|
|
1354
|
+
0.000770482631801132 * k -
|
|
1355
|
+
0.151051492775562) +
|
|
1356
|
+
Y *
|
|
1357
|
+
(0.00126935368114843 * Y -
|
|
1358
|
+
0.00265090189010898 * k +
|
|
1359
|
+
0.25802910206845) +
|
|
1360
|
+
k * (-0.000318913117588328 * k - 0.213742400323665);
|
|
1361
|
+
|
|
1362
|
+
data[i + 2] =
|
|
1363
|
+
-20.810012546947 +
|
|
1364
|
+
Cb *
|
|
1365
|
+
(-0.000570115196973677 * Cb -
|
|
1366
|
+
2.63409051004589e-5 * Cr +
|
|
1367
|
+
0.0020741088115012 * Y -
|
|
1368
|
+
0.00288260236853442 * k +
|
|
1369
|
+
0.814272968359295) +
|
|
1370
|
+
Cr *
|
|
1371
|
+
(-1.53496057440975e-5 * Cr -
|
|
1372
|
+
0.000132689043961446 * Y +
|
|
1373
|
+
0.000560833691242812 * k -
|
|
1374
|
+
0.195152027534049) +
|
|
1375
|
+
Y *
|
|
1376
|
+
(0.00174418132927582 * Y -
|
|
1377
|
+
0.00255243321439347 * k +
|
|
1378
|
+
0.116935020465145) +
|
|
1379
|
+
k * (-0.000343531996510555 * k + 0.24165260232407);
|
|
1380
|
+
data[i + 3] = 255;
|
|
1381
|
+
}
|
|
1382
|
+
return data;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
_convertYcckToCmyk(data) {
|
|
1386
|
+
let Y, Cb, Cr;
|
|
1387
|
+
for (let i = 0, length = data.length; i < length; i += 4) {
|
|
1388
|
+
Y = data[i];
|
|
1389
|
+
Cb = data[i + 1];
|
|
1390
|
+
Cr = data[i + 2];
|
|
1391
|
+
data[i] = 434.456 - Y - 1.402 * Cr;
|
|
1392
|
+
data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
|
|
1393
|
+
data[i + 2] = 481.816 - Y - 1.772 * Cb;
|
|
1394
|
+
// K in data[i + 3] is unchanged
|
|
1395
|
+
}
|
|
1396
|
+
return data;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
_convertCmykToRgb(data) {
|
|
1400
|
+
let c, m, y, k;
|
|
1401
|
+
let offset = 0;
|
|
1402
|
+
for (let i = 0, length = data.length; i < length; i += 4) {
|
|
1403
|
+
c = data[i];
|
|
1404
|
+
m = data[i + 1];
|
|
1405
|
+
y = data[i + 2];
|
|
1406
|
+
k = data[i + 3];
|
|
1407
|
+
|
|
1408
|
+
data[offset++] =
|
|
1409
|
+
255 +
|
|
1410
|
+
c *
|
|
1411
|
+
(-0.00006747147073602441 * c +
|
|
1412
|
+
0.0008379262121013727 * m +
|
|
1413
|
+
0.0002894718188643294 * y +
|
|
1414
|
+
0.003264231057537806 * k -
|
|
1415
|
+
1.1185611867203937) +
|
|
1416
|
+
m *
|
|
1417
|
+
(0.000026374107616089405 * m -
|
|
1418
|
+
0.00008626949158638572 * y -
|
|
1419
|
+
0.0002748769067499491 * k -
|
|
1420
|
+
0.02155688794978967) +
|
|
1421
|
+
y *
|
|
1422
|
+
(-0.00003878099212869363 * y -
|
|
1423
|
+
0.0003267808279485286 * k +
|
|
1424
|
+
0.0686742238595345) -
|
|
1425
|
+
k * (0.0003361971776183937 * k + 0.7430659151342254);
|
|
1426
|
+
|
|
1427
|
+
data[offset++] =
|
|
1428
|
+
255 +
|
|
1429
|
+
c *
|
|
1430
|
+
(0.00013596372813588848 * c +
|
|
1431
|
+
0.000924537132573585 * m +
|
|
1432
|
+
0.00010567359618683593 * y +
|
|
1433
|
+
0.0004791864687436512 * k -
|
|
1434
|
+
0.3109689587515875) +
|
|
1435
|
+
m *
|
|
1436
|
+
(-0.00023545346108370344 * m +
|
|
1437
|
+
0.0002702845253534714 * y +
|
|
1438
|
+
0.0020200308977307156 * k -
|
|
1439
|
+
0.7488052167015494) +
|
|
1440
|
+
y *
|
|
1441
|
+
(0.00006834815998235662 * y +
|
|
1442
|
+
0.00015168452363460973 * k -
|
|
1443
|
+
0.09751927774728933) -
|
|
1444
|
+
k * (0.0003189131175883281 * k + 0.7364883807733168);
|
|
1445
|
+
|
|
1446
|
+
data[offset++] =
|
|
1447
|
+
255 +
|
|
1448
|
+
c *
|
|
1449
|
+
(0.000013598650411385307 * c +
|
|
1450
|
+
0.00012423956175490851 * m +
|
|
1451
|
+
0.0004751985097583589 * y -
|
|
1452
|
+
0.0000036729317476630422 * k -
|
|
1453
|
+
0.05562186980264034) +
|
|
1454
|
+
m *
|
|
1455
|
+
(0.00016141380598724676 * m +
|
|
1456
|
+
0.0009692239130725186 * y +
|
|
1457
|
+
0.0007782692450036253 * k -
|
|
1458
|
+
0.44015232367526463) +
|
|
1459
|
+
y *
|
|
1460
|
+
(5.068882914068769e-7 * y +
|
|
1461
|
+
0.0017778369011375071 * k -
|
|
1462
|
+
0.7591454649749609) -
|
|
1463
|
+
k * (0.0003435319965105553 * k + 0.7063770186160144);
|
|
1464
|
+
}
|
|
1465
|
+
// Ensure that only the converted RGB data is returned.
|
|
1466
|
+
return data.subarray(0, offset);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
_convertCmykToRgba(data) {
|
|
1470
|
+
for (let i = 0, length = data.length; i < length; i += 4) {
|
|
1471
|
+
const c = data[i];
|
|
1472
|
+
const m = data[i + 1];
|
|
1473
|
+
const y = data[i + 2];
|
|
1474
|
+
const k = data[i + 3];
|
|
1475
|
+
|
|
1476
|
+
data[i] =
|
|
1477
|
+
255 +
|
|
1478
|
+
c *
|
|
1479
|
+
(-0.00006747147073602441 * c +
|
|
1480
|
+
0.0008379262121013727 * m +
|
|
1481
|
+
0.0002894718188643294 * y +
|
|
1482
|
+
0.003264231057537806 * k -
|
|
1483
|
+
1.1185611867203937) +
|
|
1484
|
+
m *
|
|
1485
|
+
(0.000026374107616089405 * m -
|
|
1486
|
+
0.00008626949158638572 * y -
|
|
1487
|
+
0.0002748769067499491 * k -
|
|
1488
|
+
0.02155688794978967) +
|
|
1489
|
+
y *
|
|
1490
|
+
(-0.00003878099212869363 * y -
|
|
1491
|
+
0.0003267808279485286 * k +
|
|
1492
|
+
0.0686742238595345) -
|
|
1493
|
+
k * (0.0003361971776183937 * k + 0.7430659151342254);
|
|
1494
|
+
|
|
1495
|
+
data[i + 1] =
|
|
1496
|
+
255 +
|
|
1497
|
+
c *
|
|
1498
|
+
(0.00013596372813588848 * c +
|
|
1499
|
+
0.000924537132573585 * m +
|
|
1500
|
+
0.00010567359618683593 * y +
|
|
1501
|
+
0.0004791864687436512 * k -
|
|
1502
|
+
0.3109689587515875) +
|
|
1503
|
+
m *
|
|
1504
|
+
(-0.00023545346108370344 * m +
|
|
1505
|
+
0.0002702845253534714 * y +
|
|
1506
|
+
0.0020200308977307156 * k -
|
|
1507
|
+
0.7488052167015494) +
|
|
1508
|
+
y *
|
|
1509
|
+
(0.00006834815998235662 * y +
|
|
1510
|
+
0.00015168452363460973 * k -
|
|
1511
|
+
0.09751927774728933) -
|
|
1512
|
+
k * (0.0003189131175883281 * k + 0.7364883807733168);
|
|
1513
|
+
|
|
1514
|
+
data[i + 2] =
|
|
1515
|
+
255 +
|
|
1516
|
+
c *
|
|
1517
|
+
(0.000013598650411385307 * c +
|
|
1518
|
+
0.00012423956175490851 * m +
|
|
1519
|
+
0.0004751985097583589 * y -
|
|
1520
|
+
0.0000036729317476630422 * k -
|
|
1521
|
+
0.05562186980264034) +
|
|
1522
|
+
m *
|
|
1523
|
+
(0.00016141380598724676 * m +
|
|
1524
|
+
0.0009692239130725186 * y +
|
|
1525
|
+
0.0007782692450036253 * k -
|
|
1526
|
+
0.44015232367526463) +
|
|
1527
|
+
y *
|
|
1528
|
+
(5.068882914068769e-7 * y +
|
|
1529
|
+
0.0017778369011375071 * k -
|
|
1530
|
+
0.7591454649749609) -
|
|
1531
|
+
k * (0.0003435319965105553 * k + 0.7063770186160144);
|
|
1532
|
+
data[i + 3] = 255;
|
|
1533
|
+
}
|
|
1534
|
+
return data;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
getData({
|
|
1538
|
+
width,
|
|
1539
|
+
height,
|
|
1540
|
+
forceRGBA = false,
|
|
1541
|
+
forceRGB = false,
|
|
1542
|
+
isSourcePDF = false,
|
|
1543
|
+
}) {
|
|
1544
|
+
|
|
1545
|
+
if (this.numComponents > 4) {
|
|
1546
|
+
throw new JpegError("Unsupported color mode");
|
|
1547
|
+
}
|
|
1548
|
+
// Type of data: Uint8ClampedArray(width * height * numComponents)
|
|
1549
|
+
const data = this._getLinearizedBlockData(width, height, isSourcePDF);
|
|
1550
|
+
|
|
1551
|
+
if (this.numComponents === 1 && (forceRGBA || forceRGB)) {
|
|
1552
|
+
const len = data.length * (forceRGBA ? 4 : 3);
|
|
1553
|
+
const rgbaData = new Uint8ClampedArray(len);
|
|
1554
|
+
let offset = 0;
|
|
1555
|
+
if (forceRGBA) {
|
|
1556
|
+
grayToRGBA(data, new Uint32Array(rgbaData.buffer));
|
|
1557
|
+
} else {
|
|
1558
|
+
for (const grayColor of data) {
|
|
1559
|
+
rgbaData[offset++] = grayColor;
|
|
1560
|
+
rgbaData[offset++] = grayColor;
|
|
1561
|
+
rgbaData[offset++] = grayColor;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
return rgbaData;
|
|
1565
|
+
} else if (this.numComponents === 3 && this._isColorConversionNeeded) {
|
|
1566
|
+
if (forceRGBA) {
|
|
1567
|
+
const rgbaData = new Uint8ClampedArray((data.length / 3) * 4);
|
|
1568
|
+
return this._convertYccToRgba(data, rgbaData);
|
|
1569
|
+
}
|
|
1570
|
+
return this._convertYccToRgb(data);
|
|
1571
|
+
} else if (this.numComponents === 4) {
|
|
1572
|
+
if (this._isColorConversionNeeded) {
|
|
1573
|
+
if (forceRGBA) {
|
|
1574
|
+
return this._convertYcckToRgba(data);
|
|
1575
|
+
}
|
|
1576
|
+
if (forceRGB) {
|
|
1577
|
+
return this._convertYcckToRgb(data);
|
|
1578
|
+
}
|
|
1579
|
+
return this._convertYcckToCmyk(data);
|
|
1580
|
+
} else if (forceRGBA) {
|
|
1581
|
+
return this._convertCmykToRgba(data);
|
|
1582
|
+
} else if (forceRGB) {
|
|
1583
|
+
return this._convertCmykToRgb(data);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
return data;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
export { JpegImage };
|