@learncard/react 2.5.17 → 2.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.css +1 -0
- package/dist/base.js +3 -0
- package/dist/cjs/AchievementCard-f0130caa.js +67 -0
- package/dist/cjs/AchievementCard-f0130caa.js.map +1 -0
- package/dist/cjs/ArrowArcLeft.svg +4 -0
- package/dist/cjs/ArrowArcRight.svg +4 -0
- package/dist/cjs/AwardRibbon-14ba45fb.js +33 -0
- package/dist/cjs/AwardRibbon-14ba45fb.js.map +1 -0
- package/dist/cjs/BoostGenericCard-b72993a3.js +78 -0
- package/dist/cjs/BoostGenericCard-b72993a3.js.map +1 -0
- package/dist/cjs/BoostSmallCard-30f75abb.js +117 -0
- package/dist/cjs/BoostSmallCard-30f75abb.js.map +1 -0
- package/dist/cjs/Button-a7af702b.js +18 -0
- package/dist/cjs/Button-a7af702b.js.map +1 -0
- package/dist/cjs/CaretRightFilled.svg +3 -0
- package/dist/cjs/Checkmark-f611aa4d.js +58 -0
- package/dist/cjs/Checkmark-f611aa4d.js.map +1 -0
- package/dist/cjs/CircleCheckButton-43c96841.js +30 -0
- package/dist/cjs/CircleCheckButton-43c96841.js.map +1 -0
- package/dist/cjs/CircleIcon-a45953f5.js +1083 -0
- package/dist/cjs/CircleIcon-a45953f5.js.map +1 -0
- package/dist/cjs/CircleSpinner-093cce04.js +49 -0
- package/dist/cjs/CircleSpinner-093cce04.js.map +1 -0
- package/dist/cjs/CourseCard-338a32ee.js +92 -0
- package/dist/cjs/CourseCard-338a32ee.js.map +1 -0
- package/dist/cjs/CourseVerticalCard-b76f5407.js +98 -0
- package/dist/cjs/CourseVerticalCard-b76f5407.js.map +1 -0
- package/dist/cjs/FlippyCard-209549c5.js +34 -0
- package/dist/cjs/FlippyCard-209549c5.js.map +1 -0
- package/dist/cjs/GenericArrow-8dfb261d.js +27 -0
- package/dist/cjs/GenericArrow-8dfb261d.js.map +1 -0
- package/dist/cjs/GenericCard-9674fcc0.js +61 -0
- package/dist/cjs/GenericCard-9674fcc0.js.map +1 -0
- package/dist/cjs/GreenCheckCircle.svg +4 -0
- package/dist/cjs/JobHistoryCard-05a3f98b.js +43 -0
- package/dist/cjs/JobHistoryCard-05a3f98b.js.map +1 -0
- package/dist/cjs/JobListCard-c662e649.js +127 -0
- package/dist/cjs/JobListCard-c662e649.js.map +1 -0
- package/dist/cjs/LearnCardCreditCardBackFace-87cc8b9f.js +72 -0
- package/dist/cjs/LearnCardCreditCardBackFace-87cc8b9f.js.map +1 -0
- package/dist/cjs/LearnCardCreditCardFrontFace-4452fd7a.js +78 -0
- package/dist/cjs/LearnCardCreditCardFrontFace-4452fd7a.js.map +1 -0
- package/dist/cjs/LearnPill-5c9bf172.js +40 -0
- package/dist/cjs/LearnPill-5c9bf172.js.map +1 -0
- package/dist/cjs/Lightbulb-1c28af02.js +22 -0
- package/dist/cjs/Lightbulb-1c28af02.js.map +1 -0
- package/dist/cjs/MiniVCThumbnail-a78e44f2.js +69 -0
- package/dist/cjs/MiniVCThumbnail-a78e44f2.js.map +1 -0
- package/dist/cjs/Notification-9d230f1b.js +94 -0
- package/dist/cjs/Notification-9d230f1b.js.map +1 -0
- package/dist/cjs/NotificationBoostCard-3b3bd47d.js +121 -0
- package/dist/cjs/NotificationBoostCard-3b3bd47d.js.map +1 -0
- package/dist/cjs/NotificationUserAcceptedBoostCard-423b9320.js +74 -0
- package/dist/cjs/NotificationUserAcceptedBoostCard-423b9320.js.map +1 -0
- package/dist/cjs/NotificationUserCard-d4dab06c.js +94 -0
- package/dist/cjs/NotificationUserCard-d4dab06c.js.map +1 -0
- package/dist/cjs/QRCodeCard-efaa58e1.js +42 -0
- package/dist/cjs/QRCodeCard-efaa58e1.js.map +1 -0
- package/dist/cjs/RedXCircle.svg +5 -0
- package/dist/cjs/RoundedPill-85e7ed68.js +106 -0
- package/dist/cjs/RoundedPill-85e7ed68.js.map +1 -0
- package/dist/cjs/SchoolIDCard-1baf77e8.js +4728 -0
- package/dist/cjs/SchoolIDCard-1baf77e8.js.map +1 -0
- package/dist/cjs/SkillTabCard-14ba0618.js +42 -0
- package/dist/cjs/SkillTabCard-14ba0618.js.map +1 -0
- package/dist/cjs/SkillVerticalCard-3eb3a8e9.js +35 -0
- package/dist/cjs/SkillVerticalCard-3eb3a8e9.js.map +1 -0
- package/dist/cjs/SkillsCard-4b6dbb4f.js +66 -0
- package/dist/cjs/SkillsCard-4b6dbb4f.js.map +1 -0
- package/dist/cjs/SkillsStatsCard-97a35a88.js +77 -0
- package/dist/cjs/SkillsStatsCard-97a35a88.js.map +1 -0
- package/dist/cjs/SmallAchievementCard-c76701ce.js +43 -0
- package/dist/cjs/SmallAchievementCard-c76701ce.js.map +1 -0
- package/dist/cjs/Trophy-9ede7f2b.js +25 -0
- package/dist/cjs/Trophy-9ede7f2b.js.map +1 -0
- package/dist/cjs/User-92f9cf40.js +91 -0
- package/dist/cjs/User-92f9cf40.js.map +1 -0
- package/dist/cjs/VCCard-58d1f7ac.js +79 -0
- package/dist/cjs/VCCard-58d1f7ac.js.map +1 -0
- package/dist/cjs/VCDisplayBackFace-8baacc99.js +87 -0
- package/dist/cjs/VCDisplayBackFace-8baacc99.js.map +1 -0
- package/dist/cjs/VCDisplayCard-9ee844a6.js +191 -0
- package/dist/cjs/VCDisplayCard-9ee844a6.js.map +1 -0
- package/dist/cjs/VCDisplayCard2-0a9e30d7.js +1015 -0
- package/dist/cjs/VCDisplayCard2-0a9e30d7.js.map +1 -0
- package/dist/cjs/VCThumbnail-6bf86bb2.js +143 -0
- package/dist/cjs/VCThumbnail-6bf86bb2.js.map +1 -0
- package/dist/cjs/VCVerificationCheck-46fa75d3.js +81 -0
- package/dist/cjs/VCVerificationCheck-46fa75d3.js.map +1 -0
- package/dist/cjs/VCVerificationPill-c6cd574c.js +75 -0
- package/dist/cjs/VCVerificationPill-c6cd574c.js.map +1 -0
- package/dist/cjs/X.svg +4 -0
- package/dist/cjs/YellowWarningCircle.svg +4 -0
- package/dist/cjs/addawardlight.svg +8 -0
- package/dist/cjs/award.svg +3 -0
- package/dist/cjs/badge.png +0 -0
- package/dist/cjs/briefcase.svg +6 -0
- package/dist/cjs/card-chip.svg +26 -0
- package/dist/cjs/coins.svg +3 -0
- package/dist/cjs/constants-35d9ebc6.js +109 -0
- package/dist/cjs/constants-35d9ebc6.js.map +1 -0
- package/dist/cjs/contactless-symbol.svg +3 -0
- package/dist/cjs/credential.helpers-80920a77.js +2188 -0
- package/dist/cjs/credential.helpers-80920a77.js.map +1 -0
- package/dist/cjs/default-face.jpeg +0 -0
- package/dist/cjs/gradcaplight.svg +3 -0
- package/dist/cjs/graduation.svg +3 -0
- package/dist/cjs/icon.green.fat-arrow.png +0 -0
- package/dist/cjs/icons-ac6eb6ec.js +48 -0
- package/dist/cjs/icons-ac6eb6ec.js.map +1 -0
- package/dist/cjs/index-82de573c.js +774 -0
- package/dist/cjs/index-82de573c.js.map +1 -0
- package/dist/cjs/index-83152f8d.js +74 -0
- package/dist/cjs/index-83152f8d.js.map +1 -0
- package/dist/cjs/index-a961acab.js +3538 -0
- package/dist/cjs/index-a961acab.js.map +1 -0
- package/dist/cjs/index-d836b84d.js +51 -0
- package/dist/cjs/index-d836b84d.js.map +1 -0
- package/dist/cjs/index.js +161 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/index10.js +11 -0
- package/dist/cjs/index10.js.map +1 -0
- package/dist/cjs/index11.js +36 -0
- package/dist/cjs/index11.js.map +1 -0
- package/dist/cjs/index12.js +161 -0
- package/dist/cjs/index12.js.map +1 -0
- package/dist/cjs/index13.js +12 -0
- package/dist/cjs/index13.js.map +1 -0
- package/dist/cjs/index14.js +24 -0
- package/dist/cjs/index14.js.map +1 -0
- package/dist/cjs/index15.js +12 -0
- package/dist/cjs/index15.js.map +1 -0
- package/dist/cjs/index16.js +14 -0
- package/dist/cjs/index16.js.map +1 -0
- package/dist/cjs/index17.js +23 -0
- package/dist/cjs/index17.js.map +1 -0
- package/dist/cjs/index18.js +11 -0
- package/dist/cjs/index18.js.map +1 -0
- package/dist/cjs/index19.js +12 -0
- package/dist/cjs/index19.js.map +1 -0
- package/dist/cjs/index2.js +37 -0
- package/dist/cjs/index2.js.map +1 -0
- package/dist/cjs/index20.js +17 -0
- package/dist/cjs/index20.js.map +1 -0
- package/dist/cjs/index21.js +19 -0
- package/dist/cjs/index21.js.map +1 -0
- package/dist/cjs/index22.js +15 -0
- package/dist/cjs/index22.js.map +1 -0
- package/dist/cjs/index23.js +17 -0
- package/dist/cjs/index23.js.map +1 -0
- package/dist/cjs/index24.js +12 -0
- package/dist/cjs/index24.js.map +1 -0
- package/dist/cjs/index25.js +24 -0
- package/dist/cjs/index25.js.map +1 -0
- package/dist/cjs/index26.js +40 -0
- package/dist/cjs/index26.js.map +1 -0
- package/dist/cjs/index27.js +11 -0
- package/dist/cjs/index27.js.map +1 -0
- package/dist/cjs/index28.js +12 -0
- package/dist/cjs/index28.js.map +1 -0
- package/dist/cjs/index29.js +12 -0
- package/dist/cjs/index29.js.map +1 -0
- package/dist/cjs/index3.js +36 -0
- package/dist/cjs/index3.js.map +1 -0
- package/dist/cjs/index30.js +25 -0
- package/dist/cjs/index30.js.map +1 -0
- package/dist/cjs/index31.js +12 -0
- package/dist/cjs/index31.js.map +1 -0
- package/dist/cjs/index32.js +12 -0
- package/dist/cjs/index32.js.map +1 -0
- package/dist/cjs/index33.js +24 -0
- package/dist/cjs/index33.js.map +1 -0
- package/dist/cjs/index34.js +31 -0
- package/dist/cjs/index34.js.map +1 -0
- package/dist/cjs/index35.js +22 -0
- package/dist/cjs/index35.js.map +1 -0
- package/dist/cjs/index36.js +26 -0
- package/dist/cjs/index36.js.map +1 -0
- package/dist/cjs/index37.js +20 -0
- package/dist/cjs/index37.js.map +1 -0
- package/dist/cjs/index38.js +10 -0
- package/dist/cjs/index38.js.map +1 -0
- package/dist/cjs/index39.js +13 -0
- package/dist/cjs/index39.js.map +1 -0
- package/dist/cjs/index4.js +39 -0
- package/dist/cjs/index4.js.map +1 -0
- package/dist/cjs/index40.js +15 -0
- package/dist/cjs/index40.js.map +1 -0
- package/dist/cjs/index41.js +15 -0
- package/dist/cjs/index41.js.map +1 -0
- package/dist/cjs/index5.js +11 -0
- package/dist/cjs/index5.js.map +1 -0
- package/dist/cjs/index6.js +24 -0
- package/dist/cjs/index6.js.map +1 -0
- package/dist/cjs/index7.js +24 -0
- package/dist/cjs/index7.js.map +1 -0
- package/dist/cjs/index8.js +15 -0
- package/dist/cjs/index8.js.map +1 -0
- package/dist/cjs/index9.js +27 -0
- package/dist/cjs/index9.js.map +1 -0
- package/dist/cjs/lhplaceholder.png +0 -0
- package/dist/cjs/lightbulb.svg +3 -0
- package/dist/cjs/master-card-logo.svg +20 -0
- package/dist/cjs/minigradcapcolored.svg +3 -0
- package/dist/cjs/minijob.svg +5 -0
- package/dist/cjs/minipuzzle.svg +3 -0
- package/dist/cjs/minipuzzlecolored.svg +3 -0
- package/dist/cjs/minitrophy.svg +3 -0
- package/dist/cjs/minitrophycolored.svg +3 -0
- package/dist/cjs/notifications-56c6fc94.js +21 -0
- package/dist/cjs/notifications-56c6fc94.js.map +1 -0
- package/dist/cjs/skillgraph.svg +29 -0
- package/dist/cjs/skillplaceholder.png +0 -0
- package/dist/cjs/social-badge.png +0 -0
- package/dist/cjs/trophy.svg +3 -0
- package/dist/cjs/types-c83b33ec.js +115 -0
- package/dist/cjs/types-c83b33ec.js.map +1 -0
- package/dist/cjs/types-e4d9a257.js +25 -0
- package/dist/cjs/types-e4d9a257.js.map +1 -0
- package/dist/cjs/types.esm-b81dff62.js +4080 -0
- package/dist/cjs/types.esm-b81dff62.js.map +1 -0
- package/dist/cjs/user.svg +4 -0
- package/dist/cjs/vc.check.svg +10 -0
- package/dist/cjs/verified-check.png +0 -0
- package/dist/cjs/walletTrophy.webp +0 -0
- package/dist/cjs/walletcurrency.webp +0 -0
- package/dist/cjs/walletids.webp +0 -0
- package/dist/cjs/walletjobhistory.webp +0 -0
- package/dist/cjs/walletlearninghistory.webp +0 -0
- package/dist/cjs/walletskills.webp +0 -0
- package/dist/esm/AchievementCard-b9eb551c.js +61 -0
- package/dist/esm/AchievementCard-b9eb551c.js.map +1 -0
- package/dist/esm/ArrowArcLeft.svg +4 -0
- package/dist/esm/ArrowArcRight.svg +4 -0
- package/dist/esm/AwardRibbon-3e682281.js +27 -0
- package/dist/esm/AwardRibbon-3e682281.js.map +1 -0
- package/dist/esm/BoostGenericCard-4c74a0a9.js +72 -0
- package/dist/esm/BoostGenericCard-4c74a0a9.js.map +1 -0
- package/dist/esm/BoostSmallCard-e42ec5ed.js +108 -0
- package/dist/esm/BoostSmallCard-e42ec5ed.js.map +1 -0
- package/dist/esm/Button-5f805204.js +12 -0
- package/dist/esm/Button-5f805204.js.map +1 -0
- package/dist/esm/CaretRightFilled.svg +3 -0
- package/dist/esm/Checkmark-d8b8f43d.js +52 -0
- package/dist/esm/Checkmark-d8b8f43d.js.map +1 -0
- package/dist/esm/CircleCheckButton-551054f6.js +24 -0
- package/dist/esm/CircleCheckButton-551054f6.js.map +1 -0
- package/dist/esm/CircleIcon-38b874e2.js +1076 -0
- package/dist/esm/CircleIcon-38b874e2.js.map +1 -0
- package/dist/esm/CircleSpinner-9b8b1a6b.js +42 -0
- package/dist/esm/CircleSpinner-9b8b1a6b.js.map +1 -0
- package/dist/esm/CourseCard-663ff174.js +82 -0
- package/dist/esm/CourseCard-663ff174.js.map +1 -0
- package/dist/esm/CourseVerticalCard-922a0860.js +88 -0
- package/dist/esm/CourseVerticalCard-922a0860.js.map +1 -0
- package/dist/esm/FlippyCard-a2de5cf1.js +28 -0
- package/dist/esm/FlippyCard-a2de5cf1.js.map +1 -0
- package/dist/esm/GenericArrow-0dba1707.js +21 -0
- package/dist/esm/GenericArrow-0dba1707.js.map +1 -0
- package/dist/esm/GenericCard-eaab7759.js +55 -0
- package/dist/esm/GenericCard-eaab7759.js.map +1 -0
- package/dist/esm/GreenCheckCircle.svg +4 -0
- package/dist/esm/JobHistoryCard-80d4ef27.js +37 -0
- package/dist/esm/JobHistoryCard-80d4ef27.js.map +1 -0
- package/dist/esm/JobListCard-5e3879ea.js +120 -0
- package/dist/esm/JobListCard-5e3879ea.js.map +1 -0
- package/dist/esm/LearnCardCreditCardBackFace-9baa9e6b.js +65 -0
- package/dist/esm/LearnCardCreditCardBackFace-9baa9e6b.js.map +1 -0
- package/dist/esm/LearnCardCreditCardFrontFace-cf793917.js +70 -0
- package/dist/esm/LearnCardCreditCardFrontFace-cf793917.js.map +1 -0
- package/dist/esm/LearnPill-3d9564d4.js +34 -0
- package/dist/esm/LearnPill-3d9564d4.js.map +1 -0
- package/dist/esm/Lightbulb-a3c1679f.js +16 -0
- package/dist/esm/Lightbulb-a3c1679f.js.map +1 -0
- package/dist/esm/MiniVCThumbnail-6a07e810.js +62 -0
- package/dist/esm/MiniVCThumbnail-6a07e810.js.map +1 -0
- package/dist/esm/Notification-0f58ef6a.js +88 -0
- package/dist/esm/Notification-0f58ef6a.js.map +1 -0
- package/dist/esm/NotificationBoostCard-134edf94.js +112 -0
- package/dist/esm/NotificationBoostCard-134edf94.js.map +1 -0
- package/dist/esm/NotificationUserAcceptedBoostCard-8c13bd3f.js +66 -0
- package/dist/esm/NotificationUserAcceptedBoostCard-8c13bd3f.js.map +1 -0
- package/dist/esm/NotificationUserCard-dbcc80f9.js +86 -0
- package/dist/esm/NotificationUserCard-dbcc80f9.js.map +1 -0
- package/dist/esm/QRCodeCard-c57e2067.js +36 -0
- package/dist/esm/QRCodeCard-c57e2067.js.map +1 -0
- package/dist/esm/RedXCircle.svg +5 -0
- package/dist/esm/RoundedPill-731211b3.js +99 -0
- package/dist/esm/RoundedPill-731211b3.js.map +1 -0
- package/dist/esm/SchoolIDCard-3b746226.js +4722 -0
- package/dist/esm/SchoolIDCard-3b746226.js.map +1 -0
- package/dist/esm/SkillTabCard-d86c6452.js +36 -0
- package/dist/esm/SkillTabCard-d86c6452.js.map +1 -0
- package/dist/esm/SkillVerticalCard-108f49bb.js +28 -0
- package/dist/esm/SkillVerticalCard-108f49bb.js.map +1 -0
- package/dist/esm/SkillsCard-92a51db2.js +59 -0
- package/dist/esm/SkillsCard-92a51db2.js.map +1 -0
- package/dist/esm/SkillsStatsCard-1628fe9c.js +70 -0
- package/dist/esm/SkillsStatsCard-1628fe9c.js.map +1 -0
- package/dist/esm/SmallAchievementCard-2d87ac82.js +37 -0
- package/dist/esm/SmallAchievementCard-2d87ac82.js.map +1 -0
- package/dist/esm/Trophy-702610b8.js +19 -0
- package/dist/esm/Trophy-702610b8.js.map +1 -0
- package/dist/esm/User-fd276ad5.js +82 -0
- package/dist/esm/User-fd276ad5.js.map +1 -0
- package/dist/esm/VCCard-d75ca97f.js +73 -0
- package/dist/esm/VCCard-d75ca97f.js.map +1 -0
- package/dist/esm/VCDisplayBackFace-52e1bef4.js +80 -0
- package/dist/esm/VCDisplayBackFace-52e1bef4.js.map +1 -0
- package/dist/esm/VCDisplayCard-140873eb.js +183 -0
- package/dist/esm/VCDisplayCard-140873eb.js.map +1 -0
- package/dist/esm/VCDisplayCard2-cde92b6d.js +1008 -0
- package/dist/esm/VCDisplayCard2-cde92b6d.js.map +1 -0
- package/dist/esm/VCThumbnail-3c254bda.js +135 -0
- package/dist/esm/VCThumbnail-3c254bda.js.map +1 -0
- package/dist/esm/VCVerificationCheck-80249524.js +72 -0
- package/dist/esm/VCVerificationCheck-80249524.js.map +1 -0
- package/dist/esm/VCVerificationPill-3433630e.js +65 -0
- package/dist/esm/VCVerificationPill-3433630e.js.map +1 -0
- package/dist/esm/X.svg +4 -0
- package/dist/esm/YellowWarningCircle.svg +4 -0
- package/dist/esm/addawardlight.svg +8 -0
- package/dist/esm/award.svg +3 -0
- package/dist/esm/badge.png +0 -0
- package/dist/esm/briefcase.svg +6 -0
- package/dist/esm/card-chip.svg +26 -0
- package/dist/esm/coins.svg +3 -0
- package/dist/esm/constants-db0e356b.js +89 -0
- package/dist/esm/constants-db0e356b.js.map +1 -0
- package/dist/esm/contactless-symbol.svg +3 -0
- package/dist/esm/credential.helpers-8ab3479c.js +2182 -0
- package/dist/esm/credential.helpers-8ab3479c.js.map +1 -0
- package/dist/esm/default-face.jpeg +0 -0
- package/dist/esm/gradcaplight.svg +3 -0
- package/dist/esm/graduation.svg +3 -0
- package/dist/esm/icon.green.fat-arrow.png +0 -0
- package/dist/esm/icons-9d160530.js +32 -0
- package/dist/esm/icons-9d160530.js.map +1 -0
- package/dist/esm/index-7103ad3c.js +46 -0
- package/dist/esm/index-7103ad3c.js.map +1 -0
- package/dist/esm/index-7dcfe90e.js +56 -0
- package/dist/esm/index-7dcfe90e.js.map +1 -0
- package/dist/esm/index-aa1098e1.js +768 -0
- package/dist/esm/index-aa1098e1.js.map +1 -0
- package/dist/esm/index-e1f279c6.js +3529 -0
- package/dist/esm/index-e1f279c6.js.map +1 -0
- package/dist/esm/index.js +96 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index10.js +3 -0
- package/dist/esm/index10.js.map +1 -0
- package/dist/esm/index11.js +28 -0
- package/dist/esm/index11.js.map +1 -0
- package/dist/esm/index12.js +96 -0
- package/dist/esm/index12.js.map +1 -0
- package/dist/esm/index13.js +4 -0
- package/dist/esm/index13.js.map +1 -0
- package/dist/esm/index14.js +15 -0
- package/dist/esm/index14.js.map +1 -0
- package/dist/esm/index15.js +4 -0
- package/dist/esm/index15.js.map +1 -0
- package/dist/esm/index16.js +6 -0
- package/dist/esm/index16.js.map +1 -0
- package/dist/esm/index17.js +15 -0
- package/dist/esm/index17.js.map +1 -0
- package/dist/esm/index18.js +3 -0
- package/dist/esm/index18.js.map +1 -0
- package/dist/esm/index19.js +4 -0
- package/dist/esm/index19.js.map +1 -0
- package/dist/esm/index2.js +29 -0
- package/dist/esm/index2.js.map +1 -0
- package/dist/esm/index20.js +8 -0
- package/dist/esm/index20.js.map +1 -0
- package/dist/esm/index21.js +11 -0
- package/dist/esm/index21.js.map +1 -0
- package/dist/esm/index22.js +7 -0
- package/dist/esm/index22.js.map +1 -0
- package/dist/esm/index23.js +8 -0
- package/dist/esm/index23.js.map +1 -0
- package/dist/esm/index24.js +4 -0
- package/dist/esm/index24.js.map +1 -0
- package/dist/esm/index25.js +15 -0
- package/dist/esm/index25.js.map +1 -0
- package/dist/esm/index26.js +28 -0
- package/dist/esm/index26.js.map +1 -0
- package/dist/esm/index27.js +3 -0
- package/dist/esm/index27.js.map +1 -0
- package/dist/esm/index28.js +3 -0
- package/dist/esm/index28.js.map +1 -0
- package/dist/esm/index29.js +4 -0
- package/dist/esm/index29.js.map +1 -0
- package/dist/esm/index3.js +28 -0
- package/dist/esm/index3.js.map +1 -0
- package/dist/esm/index30.js +17 -0
- package/dist/esm/index30.js.map +1 -0
- package/dist/esm/index31.js +4 -0
- package/dist/esm/index31.js.map +1 -0
- package/dist/esm/index32.js +4 -0
- package/dist/esm/index32.js.map +1 -0
- package/dist/esm/index33.js +8 -0
- package/dist/esm/index33.js.map +1 -0
- package/dist/esm/index34.js +23 -0
- package/dist/esm/index34.js.map +1 -0
- package/dist/esm/index35.js +14 -0
- package/dist/esm/index35.js.map +1 -0
- package/dist/esm/index36.js +18 -0
- package/dist/esm/index36.js.map +1 -0
- package/dist/esm/index37.js +12 -0
- package/dist/esm/index37.js.map +1 -0
- package/dist/esm/index38.js +7 -0
- package/dist/esm/index38.js.map +1 -0
- package/dist/esm/index39.js +5 -0
- package/dist/esm/index39.js.map +1 -0
- package/dist/esm/index4.js +31 -0
- package/dist/esm/index4.js.map +1 -0
- package/dist/esm/index40.js +5 -0
- package/dist/esm/index40.js.map +1 -0
- package/dist/esm/index41.js +7 -0
- package/dist/esm/index41.js.map +1 -0
- package/dist/esm/index5.js +3 -0
- package/dist/esm/index5.js.map +1 -0
- package/dist/esm/index6.js +16 -0
- package/dist/esm/index6.js.map +1 -0
- package/dist/esm/index7.js +15 -0
- package/dist/esm/index7.js.map +1 -0
- package/dist/esm/index8.js +7 -0
- package/dist/esm/index8.js.map +1 -0
- package/dist/esm/index9.js +19 -0
- package/dist/esm/index9.js.map +1 -0
- package/dist/esm/lhplaceholder.png +0 -0
- package/dist/esm/lightbulb.svg +3 -0
- package/dist/esm/master-card-logo.svg +20 -0
- package/dist/esm/minigradcapcolored.svg +3 -0
- package/dist/esm/minijob.svg +5 -0
- package/dist/esm/minipuzzle.svg +3 -0
- package/dist/esm/minipuzzlecolored.svg +3 -0
- package/dist/esm/minitrophy.svg +3 -0
- package/dist/esm/minitrophycolored.svg +3 -0
- package/dist/esm/notifications-009bbd80.js +18 -0
- package/dist/esm/notifications-009bbd80.js.map +1 -0
- package/dist/esm/skillgraph.svg +29 -0
- package/dist/esm/skillplaceholder.png +0 -0
- package/dist/esm/social-badge.png +0 -0
- package/dist/esm/trophy.svg +3 -0
- package/dist/esm/types-7081a9e5.js +109 -0
- package/dist/esm/types-7081a9e5.js.map +1 -0
- package/dist/esm/types-b32d28d5.js +23 -0
- package/dist/esm/types-b32d28d5.js.map +1 -0
- package/dist/esm/types.esm-c5fc78aa.js +4078 -0
- package/dist/esm/types.esm-c5fc78aa.js.map +1 -0
- package/dist/esm/user.svg +4 -0
- package/dist/esm/vc.check.svg +10 -0
- package/dist/esm/verified-check.png +0 -0
- package/dist/esm/walletTrophy.webp +0 -0
- package/dist/esm/walletcurrency.webp +0 -0
- package/dist/esm/walletids.webp +0 -0
- package/dist/esm/walletjobhistory.webp +0 -0
- package/dist/esm/walletlearninghistory.webp +0 -0
- package/dist/esm/walletskills.webp +0 -0
- package/dist/index.d.ts +857 -0
- package/dist/main.css +1 -0
- package/dist/main.js +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1,4728 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
8
|
+
|
|
9
|
+
var barcodes = {};
|
|
10
|
+
|
|
11
|
+
var CODE39$1 = {};
|
|
12
|
+
|
|
13
|
+
var Barcode$2 = {};
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(Barcode$2, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function _classCallCheck$t(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
+
|
|
21
|
+
var Barcode$1 = function Barcode(data, options) {
|
|
22
|
+
_classCallCheck$t(this, Barcode);
|
|
23
|
+
|
|
24
|
+
this.data = data;
|
|
25
|
+
this.text = options.text || data;
|
|
26
|
+
this.options = options;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
Barcode$2.default = Barcode$1;
|
|
30
|
+
|
|
31
|
+
Object.defineProperty(CODE39$1, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
});
|
|
34
|
+
CODE39$1.CODE39 = undefined;
|
|
35
|
+
|
|
36
|
+
var _createClass$m = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
37
|
+
|
|
38
|
+
var _Barcode2$b = Barcode$2;
|
|
39
|
+
|
|
40
|
+
var _Barcode3$b = _interopRequireDefault$y(_Barcode2$b);
|
|
41
|
+
|
|
42
|
+
function _interopRequireDefault$y(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
|
+
|
|
44
|
+
function _classCallCheck$s(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
45
|
+
|
|
46
|
+
function _possibleConstructorReturn$o(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
47
|
+
|
|
48
|
+
function _inherits$o(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
49
|
+
// https://en.wikipedia.org/wiki/Code_39#Encoding
|
|
50
|
+
|
|
51
|
+
var CODE39 = function (_Barcode) {
|
|
52
|
+
_inherits$o(CODE39, _Barcode);
|
|
53
|
+
|
|
54
|
+
function CODE39(data, options) {
|
|
55
|
+
_classCallCheck$s(this, CODE39);
|
|
56
|
+
|
|
57
|
+
data = data.toUpperCase();
|
|
58
|
+
|
|
59
|
+
// Calculate mod43 checksum if enabled
|
|
60
|
+
if (options.mod43) {
|
|
61
|
+
data += getCharacter(mod43checksum(data));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return _possibleConstructorReturn$o(this, (CODE39.__proto__ || Object.getPrototypeOf(CODE39)).call(this, data, options));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_createClass$m(CODE39, [{
|
|
68
|
+
key: "encode",
|
|
69
|
+
value: function encode() {
|
|
70
|
+
// First character is always a *
|
|
71
|
+
var result = getEncoding("*");
|
|
72
|
+
|
|
73
|
+
// Take every character and add the binary representation to the result
|
|
74
|
+
for (var i = 0; i < this.data.length; i++) {
|
|
75
|
+
result += getEncoding(this.data[i]) + "0";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Last character is always a *
|
|
79
|
+
result += getEncoding("*");
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
data: result,
|
|
83
|
+
text: this.text
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "valid",
|
|
88
|
+
value: function valid() {
|
|
89
|
+
return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1;
|
|
90
|
+
}
|
|
91
|
+
}]);
|
|
92
|
+
|
|
93
|
+
return CODE39;
|
|
94
|
+
}(_Barcode3$b.default);
|
|
95
|
+
|
|
96
|
+
// All characters. The position in the array is the (checksum) value
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"];
|
|
100
|
+
|
|
101
|
+
// The decimal representation of the characters, is converted to the
|
|
102
|
+
// corresponding binary with the getEncoding function
|
|
103
|
+
var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770];
|
|
104
|
+
|
|
105
|
+
// Get the binary representation of a character by converting the encodings
|
|
106
|
+
// from decimal to binary
|
|
107
|
+
function getEncoding(character) {
|
|
108
|
+
return getBinary(characterValue(character));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getBinary(characterValue) {
|
|
112
|
+
return encodings[characterValue].toString(2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function getCharacter(characterValue) {
|
|
116
|
+
return characters[characterValue];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function characterValue(character) {
|
|
120
|
+
return characters.indexOf(character);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function mod43checksum(data) {
|
|
124
|
+
var checksum = 0;
|
|
125
|
+
for (var i = 0; i < data.length; i++) {
|
|
126
|
+
checksum += characterValue(data[i]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
checksum = checksum % 43;
|
|
130
|
+
return checksum;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
CODE39$1.CODE39 = CODE39;
|
|
134
|
+
|
|
135
|
+
var CODE128$2 = {};
|
|
136
|
+
|
|
137
|
+
var CODE128_AUTO = {};
|
|
138
|
+
|
|
139
|
+
var CODE128$1 = {};
|
|
140
|
+
|
|
141
|
+
var constants$2 = {};
|
|
142
|
+
|
|
143
|
+
Object.defineProperty(constants$2, "__esModule", {
|
|
144
|
+
value: true
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
var _SET_BY_CODE;
|
|
148
|
+
|
|
149
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
150
|
+
|
|
151
|
+
// constants for internal usage
|
|
152
|
+
var SET_A = constants$2.SET_A = 0;
|
|
153
|
+
var SET_B = constants$2.SET_B = 1;
|
|
154
|
+
var SET_C = constants$2.SET_C = 2;
|
|
155
|
+
|
|
156
|
+
// Special characters
|
|
157
|
+
constants$2.SHIFT = 98;
|
|
158
|
+
var START_A = constants$2.START_A = 103;
|
|
159
|
+
var START_B = constants$2.START_B = 104;
|
|
160
|
+
var START_C = constants$2.START_C = 105;
|
|
161
|
+
constants$2.MODULO = 103;
|
|
162
|
+
constants$2.STOP = 106;
|
|
163
|
+
constants$2.FNC1 = 207;
|
|
164
|
+
|
|
165
|
+
// Get set by start code
|
|
166
|
+
constants$2.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE);
|
|
167
|
+
|
|
168
|
+
// Get next set by code
|
|
169
|
+
constants$2.SWAP = {
|
|
170
|
+
101: SET_A,
|
|
171
|
+
100: SET_B,
|
|
172
|
+
99: SET_C
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
constants$2.A_START_CHAR = String.fromCharCode(208); // START_A + 105
|
|
176
|
+
constants$2.B_START_CHAR = String.fromCharCode(209); // START_B + 105
|
|
177
|
+
constants$2.C_START_CHAR = String.fromCharCode(210); // START_C + 105
|
|
178
|
+
|
|
179
|
+
// 128A (Code Set A)
|
|
180
|
+
// ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4
|
|
181
|
+
constants$2.A_CHARS = "[\x00-\x5F\xC8-\xCF]";
|
|
182
|
+
|
|
183
|
+
// 128B (Code Set B)
|
|
184
|
+
// ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4
|
|
185
|
+
constants$2.B_CHARS = "[\x20-\x7F\xC8-\xCF]";
|
|
186
|
+
|
|
187
|
+
// 128C (Code Set C)
|
|
188
|
+
// 00–99 (encodes two digits with a single code point) and FNC1
|
|
189
|
+
constants$2.C_CHARS = "(\xCF*[0-9]{2}\xCF*)";
|
|
190
|
+
|
|
191
|
+
// CODE128 includes 107 symbols:
|
|
192
|
+
// 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one)
|
|
193
|
+
// Each symbol consist of three black bars (1) and three white spaces (0).
|
|
194
|
+
constants$2.BARS = [11011001100, 11001101100, 11001100110, 10010011000, 10010001100, 10001001100, 10011001000, 10011000100, 10001100100, 11001001000, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011000, 11011000110, 11000110110, 10100011000, 10001011000, 10001000110, 10110001000, 10001101000, 10001100010, 11010001000, 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, 10111011000, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 10100110000, 10100001100, 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, 10110000100, 10011010000, 10011000010, 10000110100, 10000110010, 11000010010, 11001010000, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 11010010000, 11010011100, 1100011101011];
|
|
195
|
+
|
|
196
|
+
Object.defineProperty(CODE128$1, "__esModule", {
|
|
197
|
+
value: true
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
var _createClass$l = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
201
|
+
|
|
202
|
+
var _Barcode2$a = Barcode$2;
|
|
203
|
+
|
|
204
|
+
var _Barcode3$a = _interopRequireDefault$x(_Barcode2$a);
|
|
205
|
+
|
|
206
|
+
var _constants$a = constants$2;
|
|
207
|
+
|
|
208
|
+
function _interopRequireDefault$x(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
209
|
+
|
|
210
|
+
function _classCallCheck$r(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
211
|
+
|
|
212
|
+
function _possibleConstructorReturn$n(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
213
|
+
|
|
214
|
+
function _inherits$n(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
215
|
+
|
|
216
|
+
// This is the master class,
|
|
217
|
+
// it does require the start code to be included in the string
|
|
218
|
+
var CODE128 = function (_Barcode) {
|
|
219
|
+
_inherits$n(CODE128, _Barcode);
|
|
220
|
+
|
|
221
|
+
function CODE128(data, options) {
|
|
222
|
+
_classCallCheck$r(this, CODE128);
|
|
223
|
+
|
|
224
|
+
// Get array of ascii codes from data
|
|
225
|
+
var _this = _possibleConstructorReturn$n(this, (CODE128.__proto__ || Object.getPrototypeOf(CODE128)).call(this, data.substring(1), options));
|
|
226
|
+
|
|
227
|
+
_this.bytes = data.split('').map(function (char) {
|
|
228
|
+
return char.charCodeAt(0);
|
|
229
|
+
});
|
|
230
|
+
return _this;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_createClass$l(CODE128, [{
|
|
234
|
+
key: 'valid',
|
|
235
|
+
value: function valid() {
|
|
236
|
+
// ASCII value ranges 0-127, 200-211
|
|
237
|
+
return (/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// The public encoding function
|
|
242
|
+
|
|
243
|
+
}, {
|
|
244
|
+
key: 'encode',
|
|
245
|
+
value: function encode() {
|
|
246
|
+
var bytes = this.bytes;
|
|
247
|
+
// Remove the start code from the bytes and set its index
|
|
248
|
+
var startIndex = bytes.shift() - 105;
|
|
249
|
+
// Get start set by index
|
|
250
|
+
var startSet = _constants$a.SET_BY_CODE[startIndex];
|
|
251
|
+
|
|
252
|
+
if (startSet === undefined) {
|
|
253
|
+
throw new RangeError('The encoding does not start with a start character.');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (this.shouldEncodeAsEan128() === true) {
|
|
257
|
+
bytes.unshift(_constants$a.FNC1);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Start encode with the right type
|
|
261
|
+
var encodingResult = CODE128.next(bytes, 1, startSet);
|
|
262
|
+
|
|
263
|
+
return {
|
|
264
|
+
text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, '') : this.text,
|
|
265
|
+
data:
|
|
266
|
+
// Add the start bits
|
|
267
|
+
CODE128.getBar(startIndex) +
|
|
268
|
+
// Add the encoded bits
|
|
269
|
+
encodingResult.result +
|
|
270
|
+
// Add the checksum
|
|
271
|
+
CODE128.getBar((encodingResult.checksum + startIndex) % _constants$a.MODULO) +
|
|
272
|
+
// Add the end bits
|
|
273
|
+
CODE128.getBar(_constants$a.STOP)
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// GS1-128/EAN-128
|
|
278
|
+
|
|
279
|
+
}, {
|
|
280
|
+
key: 'shouldEncodeAsEan128',
|
|
281
|
+
value: function shouldEncodeAsEan128() {
|
|
282
|
+
var isEAN128 = this.options.ean128 || false;
|
|
283
|
+
if (typeof isEAN128 === 'string') {
|
|
284
|
+
isEAN128 = isEAN128.toLowerCase() === 'true';
|
|
285
|
+
}
|
|
286
|
+
return isEAN128;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Get a bar symbol by index
|
|
290
|
+
|
|
291
|
+
}], [{
|
|
292
|
+
key: 'getBar',
|
|
293
|
+
value: function getBar(index) {
|
|
294
|
+
return _constants$a.BARS[index] ? _constants$a.BARS[index].toString() : '';
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Correct an index by a set and shift it from the bytes array
|
|
298
|
+
|
|
299
|
+
}, {
|
|
300
|
+
key: 'correctIndex',
|
|
301
|
+
value: function correctIndex(bytes, set) {
|
|
302
|
+
if (set === _constants$a.SET_A) {
|
|
303
|
+
var charCode = bytes.shift();
|
|
304
|
+
return charCode < 32 ? charCode + 64 : charCode - 32;
|
|
305
|
+
} else if (set === _constants$a.SET_B) {
|
|
306
|
+
return bytes.shift() - 32;
|
|
307
|
+
} else {
|
|
308
|
+
return (bytes.shift() - 48) * 10 + bytes.shift() - 48;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}, {
|
|
312
|
+
key: 'next',
|
|
313
|
+
value: function next(bytes, pos, set) {
|
|
314
|
+
if (!bytes.length) {
|
|
315
|
+
return { result: '', checksum: 0 };
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
var nextCode = void 0,
|
|
319
|
+
index = void 0;
|
|
320
|
+
|
|
321
|
+
// Special characters
|
|
322
|
+
if (bytes[0] >= 200) {
|
|
323
|
+
index = bytes.shift() - 105;
|
|
324
|
+
var nextSet = _constants$a.SWAP[index];
|
|
325
|
+
|
|
326
|
+
// Swap to other set
|
|
327
|
+
if (nextSet !== undefined) {
|
|
328
|
+
nextCode = CODE128.next(bytes, pos + 1, nextSet);
|
|
329
|
+
}
|
|
330
|
+
// Continue on current set but encode a special character
|
|
331
|
+
else {
|
|
332
|
+
// Shift
|
|
333
|
+
if ((set === _constants$a.SET_A || set === _constants$a.SET_B) && index === _constants$a.SHIFT) {
|
|
334
|
+
// Convert the next character so that is encoded correctly
|
|
335
|
+
bytes[0] = set === _constants$a.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0];
|
|
336
|
+
}
|
|
337
|
+
nextCode = CODE128.next(bytes, pos + 1, set);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// Continue encoding
|
|
341
|
+
else {
|
|
342
|
+
index = CODE128.correctIndex(bytes, set);
|
|
343
|
+
nextCode = CODE128.next(bytes, pos + 1, set);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Get the correct binary encoding and calculate the weight
|
|
347
|
+
var enc = CODE128.getBar(index);
|
|
348
|
+
var weight = index * pos;
|
|
349
|
+
|
|
350
|
+
return {
|
|
351
|
+
result: enc + nextCode.result,
|
|
352
|
+
checksum: weight + nextCode.checksum
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}]);
|
|
356
|
+
|
|
357
|
+
return CODE128;
|
|
358
|
+
}(_Barcode3$a.default);
|
|
359
|
+
|
|
360
|
+
CODE128$1.default = CODE128;
|
|
361
|
+
|
|
362
|
+
var auto = {};
|
|
363
|
+
|
|
364
|
+
Object.defineProperty(auto, "__esModule", {
|
|
365
|
+
value: true
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
var _constants$9 = constants$2;
|
|
369
|
+
|
|
370
|
+
// Match Set functions
|
|
371
|
+
var matchSetALength = function matchSetALength(string) {
|
|
372
|
+
return string.match(new RegExp('^' + _constants$9.A_CHARS + '*'))[0].length;
|
|
373
|
+
};
|
|
374
|
+
var matchSetBLength = function matchSetBLength(string) {
|
|
375
|
+
return string.match(new RegExp('^' + _constants$9.B_CHARS + '*'))[0].length;
|
|
376
|
+
};
|
|
377
|
+
var matchSetC = function matchSetC(string) {
|
|
378
|
+
return string.match(new RegExp('^' + _constants$9.C_CHARS + '*'))[0];
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// CODE128A or CODE128B
|
|
382
|
+
function autoSelectFromAB(string, isA) {
|
|
383
|
+
var ranges = isA ? _constants$9.A_CHARS : _constants$9.B_CHARS;
|
|
384
|
+
var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)'));
|
|
385
|
+
|
|
386
|
+
if (untilC) {
|
|
387
|
+
return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
var chars = string.match(new RegExp('^' + ranges + '+'))[0];
|
|
391
|
+
|
|
392
|
+
if (chars.length === string.length) {
|
|
393
|
+
return string;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// CODE128C
|
|
400
|
+
function autoSelectFromC(string) {
|
|
401
|
+
var cMatch = matchSetC(string);
|
|
402
|
+
var length = cMatch.length;
|
|
403
|
+
|
|
404
|
+
if (length === string.length) {
|
|
405
|
+
return string;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
string = string.substring(length);
|
|
409
|
+
|
|
410
|
+
// Select A/B depending on the longest match
|
|
411
|
+
var isA = matchSetALength(string) >= matchSetBLength(string);
|
|
412
|
+
return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// Detect Code Set (A, B or C) and format the string
|
|
416
|
+
|
|
417
|
+
auto.default = function (string) {
|
|
418
|
+
var newString = void 0;
|
|
419
|
+
var cLength = matchSetC(string).length;
|
|
420
|
+
|
|
421
|
+
// Select 128C if the string start with enough digits
|
|
422
|
+
if (cLength >= 2) {
|
|
423
|
+
newString = _constants$9.C_START_CHAR + autoSelectFromC(string);
|
|
424
|
+
} else {
|
|
425
|
+
// Select A/B depending on the longest match
|
|
426
|
+
var isA = matchSetALength(string) > matchSetBLength(string);
|
|
427
|
+
newString = (isA ? _constants$9.A_START_CHAR : _constants$9.B_START_CHAR) + autoSelectFromAB(string, isA);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return newString.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, // Any sequence between 205 and 206 characters
|
|
431
|
+
function (match, char) {
|
|
432
|
+
return String.fromCharCode(203) + char;
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
Object.defineProperty(CODE128_AUTO, "__esModule", {
|
|
437
|
+
value: true
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
var _CODE2$4 = CODE128$1;
|
|
441
|
+
|
|
442
|
+
var _CODE3$3 = _interopRequireDefault$w(_CODE2$4);
|
|
443
|
+
|
|
444
|
+
var _auto = auto;
|
|
445
|
+
|
|
446
|
+
var _auto2 = _interopRequireDefault$w(_auto);
|
|
447
|
+
|
|
448
|
+
function _interopRequireDefault$w(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
449
|
+
|
|
450
|
+
function _classCallCheck$q(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
451
|
+
|
|
452
|
+
function _possibleConstructorReturn$m(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
453
|
+
|
|
454
|
+
function _inherits$m(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
455
|
+
|
|
456
|
+
var CODE128AUTO = function (_CODE) {
|
|
457
|
+
_inherits$m(CODE128AUTO, _CODE);
|
|
458
|
+
|
|
459
|
+
function CODE128AUTO(data, options) {
|
|
460
|
+
_classCallCheck$q(this, CODE128AUTO);
|
|
461
|
+
|
|
462
|
+
// ASCII value ranges 0-127, 200-211
|
|
463
|
+
if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) {
|
|
464
|
+
var _this = _possibleConstructorReturn$m(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, (0, _auto2.default)(data), options));
|
|
465
|
+
} else {
|
|
466
|
+
var _this = _possibleConstructorReturn$m(this, (CODE128AUTO.__proto__ || Object.getPrototypeOf(CODE128AUTO)).call(this, data, options));
|
|
467
|
+
}
|
|
468
|
+
return _possibleConstructorReturn$m(_this);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return CODE128AUTO;
|
|
472
|
+
}(_CODE3$3.default);
|
|
473
|
+
|
|
474
|
+
CODE128_AUTO.default = CODE128AUTO;
|
|
475
|
+
|
|
476
|
+
var CODE128A$1 = {};
|
|
477
|
+
|
|
478
|
+
Object.defineProperty(CODE128A$1, "__esModule", {
|
|
479
|
+
value: true
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
var _createClass$k = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
483
|
+
|
|
484
|
+
var _CODE2$3 = CODE128$1;
|
|
485
|
+
|
|
486
|
+
var _CODE3$2 = _interopRequireDefault$v(_CODE2$3);
|
|
487
|
+
|
|
488
|
+
var _constants$8 = constants$2;
|
|
489
|
+
|
|
490
|
+
function _interopRequireDefault$v(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
491
|
+
|
|
492
|
+
function _classCallCheck$p(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
493
|
+
|
|
494
|
+
function _possibleConstructorReturn$l(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
495
|
+
|
|
496
|
+
function _inherits$l(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
497
|
+
|
|
498
|
+
var CODE128A = function (_CODE) {
|
|
499
|
+
_inherits$l(CODE128A, _CODE);
|
|
500
|
+
|
|
501
|
+
function CODE128A(string, options) {
|
|
502
|
+
_classCallCheck$p(this, CODE128A);
|
|
503
|
+
|
|
504
|
+
return _possibleConstructorReturn$l(this, (CODE128A.__proto__ || Object.getPrototypeOf(CODE128A)).call(this, _constants$8.A_START_CHAR + string, options));
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
_createClass$k(CODE128A, [{
|
|
508
|
+
key: 'valid',
|
|
509
|
+
value: function valid() {
|
|
510
|
+
return new RegExp('^' + _constants$8.A_CHARS + '+$').test(this.data);
|
|
511
|
+
}
|
|
512
|
+
}]);
|
|
513
|
+
|
|
514
|
+
return CODE128A;
|
|
515
|
+
}(_CODE3$2.default);
|
|
516
|
+
|
|
517
|
+
CODE128A$1.default = CODE128A;
|
|
518
|
+
|
|
519
|
+
var CODE128B$1 = {};
|
|
520
|
+
|
|
521
|
+
Object.defineProperty(CODE128B$1, "__esModule", {
|
|
522
|
+
value: true
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
var _createClass$j = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
526
|
+
|
|
527
|
+
var _CODE2$2 = CODE128$1;
|
|
528
|
+
|
|
529
|
+
var _CODE3$1 = _interopRequireDefault$u(_CODE2$2);
|
|
530
|
+
|
|
531
|
+
var _constants$7 = constants$2;
|
|
532
|
+
|
|
533
|
+
function _interopRequireDefault$u(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
534
|
+
|
|
535
|
+
function _classCallCheck$o(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
536
|
+
|
|
537
|
+
function _possibleConstructorReturn$k(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
538
|
+
|
|
539
|
+
function _inherits$k(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
540
|
+
|
|
541
|
+
var CODE128B = function (_CODE) {
|
|
542
|
+
_inherits$k(CODE128B, _CODE);
|
|
543
|
+
|
|
544
|
+
function CODE128B(string, options) {
|
|
545
|
+
_classCallCheck$o(this, CODE128B);
|
|
546
|
+
|
|
547
|
+
return _possibleConstructorReturn$k(this, (CODE128B.__proto__ || Object.getPrototypeOf(CODE128B)).call(this, _constants$7.B_START_CHAR + string, options));
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
_createClass$j(CODE128B, [{
|
|
551
|
+
key: 'valid',
|
|
552
|
+
value: function valid() {
|
|
553
|
+
return new RegExp('^' + _constants$7.B_CHARS + '+$').test(this.data);
|
|
554
|
+
}
|
|
555
|
+
}]);
|
|
556
|
+
|
|
557
|
+
return CODE128B;
|
|
558
|
+
}(_CODE3$1.default);
|
|
559
|
+
|
|
560
|
+
CODE128B$1.default = CODE128B;
|
|
561
|
+
|
|
562
|
+
var CODE128C$1 = {};
|
|
563
|
+
|
|
564
|
+
Object.defineProperty(CODE128C$1, "__esModule", {
|
|
565
|
+
value: true
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
var _createClass$i = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
569
|
+
|
|
570
|
+
var _CODE2$1 = CODE128$1;
|
|
571
|
+
|
|
572
|
+
var _CODE3 = _interopRequireDefault$t(_CODE2$1);
|
|
573
|
+
|
|
574
|
+
var _constants$6 = constants$2;
|
|
575
|
+
|
|
576
|
+
function _interopRequireDefault$t(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
577
|
+
|
|
578
|
+
function _classCallCheck$n(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
579
|
+
|
|
580
|
+
function _possibleConstructorReturn$j(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
581
|
+
|
|
582
|
+
function _inherits$j(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
583
|
+
|
|
584
|
+
var CODE128C = function (_CODE) {
|
|
585
|
+
_inherits$j(CODE128C, _CODE);
|
|
586
|
+
|
|
587
|
+
function CODE128C(string, options) {
|
|
588
|
+
_classCallCheck$n(this, CODE128C);
|
|
589
|
+
|
|
590
|
+
return _possibleConstructorReturn$j(this, (CODE128C.__proto__ || Object.getPrototypeOf(CODE128C)).call(this, _constants$6.C_START_CHAR + string, options));
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
_createClass$i(CODE128C, [{
|
|
594
|
+
key: 'valid',
|
|
595
|
+
value: function valid() {
|
|
596
|
+
return new RegExp('^' + _constants$6.C_CHARS + '+$').test(this.data);
|
|
597
|
+
}
|
|
598
|
+
}]);
|
|
599
|
+
|
|
600
|
+
return CODE128C;
|
|
601
|
+
}(_CODE3.default);
|
|
602
|
+
|
|
603
|
+
CODE128C$1.default = CODE128C;
|
|
604
|
+
|
|
605
|
+
Object.defineProperty(CODE128$2, "__esModule", {
|
|
606
|
+
value: true
|
|
607
|
+
});
|
|
608
|
+
CODE128$2.CODE128C = CODE128$2.CODE128B = CODE128$2.CODE128A = CODE128$2.CODE128 = undefined;
|
|
609
|
+
|
|
610
|
+
var _CODE128_AUTO = CODE128_AUTO;
|
|
611
|
+
|
|
612
|
+
var _CODE128_AUTO2 = _interopRequireDefault$s(_CODE128_AUTO);
|
|
613
|
+
|
|
614
|
+
var _CODE128A = CODE128A$1;
|
|
615
|
+
|
|
616
|
+
var _CODE128A2 = _interopRequireDefault$s(_CODE128A);
|
|
617
|
+
|
|
618
|
+
var _CODE128B = CODE128B$1;
|
|
619
|
+
|
|
620
|
+
var _CODE128B2 = _interopRequireDefault$s(_CODE128B);
|
|
621
|
+
|
|
622
|
+
var _CODE128C = CODE128C$1;
|
|
623
|
+
|
|
624
|
+
var _CODE128C2 = _interopRequireDefault$s(_CODE128C);
|
|
625
|
+
|
|
626
|
+
function _interopRequireDefault$s(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
627
|
+
|
|
628
|
+
CODE128$2.CODE128 = _CODE128_AUTO2.default;
|
|
629
|
+
CODE128$2.CODE128A = _CODE128A2.default;
|
|
630
|
+
CODE128$2.CODE128B = _CODE128B2.default;
|
|
631
|
+
CODE128$2.CODE128C = _CODE128C2.default;
|
|
632
|
+
|
|
633
|
+
var EAN_UPC = {};
|
|
634
|
+
|
|
635
|
+
var EAN13$1 = {};
|
|
636
|
+
|
|
637
|
+
var constants$1 = {};
|
|
638
|
+
|
|
639
|
+
Object.defineProperty(constants$1, "__esModule", {
|
|
640
|
+
value: true
|
|
641
|
+
});
|
|
642
|
+
// Standard start end and middle bits
|
|
643
|
+
constants$1.SIDE_BIN = '101';
|
|
644
|
+
constants$1.MIDDLE_BIN = '01010';
|
|
645
|
+
|
|
646
|
+
constants$1.BINARIES = {
|
|
647
|
+
'L': [// The L (left) type of encoding
|
|
648
|
+
'0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'],
|
|
649
|
+
'G': [// The G type of encoding
|
|
650
|
+
'0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111'],
|
|
651
|
+
'R': [// The R (right) type of encoding
|
|
652
|
+
'1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', '1110100'],
|
|
653
|
+
'O': [// The O (odd) encoding for UPC-E
|
|
654
|
+
'0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011'],
|
|
655
|
+
'E': [// The E (even) encoding for UPC-E
|
|
656
|
+
'0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111']
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
// Define the EAN-2 structure
|
|
660
|
+
constants$1.EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG'];
|
|
661
|
+
|
|
662
|
+
// Define the EAN-5 structure
|
|
663
|
+
constants$1.EAN5_STRUCTURE = ['GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG'];
|
|
664
|
+
|
|
665
|
+
// Define the EAN-13 structure
|
|
666
|
+
constants$1.EAN13_STRUCTURE = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL'];
|
|
667
|
+
|
|
668
|
+
var EAN$1 = {};
|
|
669
|
+
|
|
670
|
+
var encoder = {};
|
|
671
|
+
|
|
672
|
+
Object.defineProperty(encoder, "__esModule", {
|
|
673
|
+
value: true
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
var _constants$5 = constants$1;
|
|
677
|
+
|
|
678
|
+
// Encode data string
|
|
679
|
+
var encode$1 = function encode(data, structure, separator) {
|
|
680
|
+
var encoded = data.split('').map(function (val, idx) {
|
|
681
|
+
return _constants$5.BINARIES[structure[idx]];
|
|
682
|
+
}).map(function (val, idx) {
|
|
683
|
+
return val ? val[data[idx]] : '';
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
if (separator) {
|
|
687
|
+
var last = data.length - 1;
|
|
688
|
+
encoded = encoded.map(function (val, idx) {
|
|
689
|
+
return idx < last ? val + separator : val;
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return encoded.join('');
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
encoder.default = encode$1;
|
|
697
|
+
|
|
698
|
+
Object.defineProperty(EAN$1, "__esModule", {
|
|
699
|
+
value: true
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
var _createClass$h = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
703
|
+
|
|
704
|
+
var _constants$4 = constants$1;
|
|
705
|
+
|
|
706
|
+
var _encoder$4 = encoder;
|
|
707
|
+
|
|
708
|
+
var _encoder2$4 = _interopRequireDefault$r(_encoder$4);
|
|
709
|
+
|
|
710
|
+
var _Barcode2$9 = Barcode$2;
|
|
711
|
+
|
|
712
|
+
var _Barcode3$9 = _interopRequireDefault$r(_Barcode2$9);
|
|
713
|
+
|
|
714
|
+
function _interopRequireDefault$r(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
715
|
+
|
|
716
|
+
function _classCallCheck$m(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
717
|
+
|
|
718
|
+
function _possibleConstructorReturn$i(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
719
|
+
|
|
720
|
+
function _inherits$i(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
721
|
+
|
|
722
|
+
// Base class for EAN8 & EAN13
|
|
723
|
+
var EAN = function (_Barcode) {
|
|
724
|
+
_inherits$i(EAN, _Barcode);
|
|
725
|
+
|
|
726
|
+
function EAN(data, options) {
|
|
727
|
+
_classCallCheck$m(this, EAN);
|
|
728
|
+
|
|
729
|
+
// Make sure the font is not bigger than the space between the guard bars
|
|
730
|
+
var _this = _possibleConstructorReturn$i(this, (EAN.__proto__ || Object.getPrototypeOf(EAN)).call(this, data, options));
|
|
731
|
+
|
|
732
|
+
_this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options.fontSize;
|
|
733
|
+
|
|
734
|
+
// Make the guard bars go down half the way of the text
|
|
735
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
736
|
+
return _this;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
_createClass$h(EAN, [{
|
|
740
|
+
key: 'encode',
|
|
741
|
+
value: function encode() {
|
|
742
|
+
return this.options.flat ? this.encodeFlat() : this.encodeGuarded();
|
|
743
|
+
}
|
|
744
|
+
}, {
|
|
745
|
+
key: 'leftText',
|
|
746
|
+
value: function leftText(from, to) {
|
|
747
|
+
return this.text.substr(from, to);
|
|
748
|
+
}
|
|
749
|
+
}, {
|
|
750
|
+
key: 'leftEncode',
|
|
751
|
+
value: function leftEncode(data, structure) {
|
|
752
|
+
return (0, _encoder2$4.default)(data, structure);
|
|
753
|
+
}
|
|
754
|
+
}, {
|
|
755
|
+
key: 'rightText',
|
|
756
|
+
value: function rightText(from, to) {
|
|
757
|
+
return this.text.substr(from, to);
|
|
758
|
+
}
|
|
759
|
+
}, {
|
|
760
|
+
key: 'rightEncode',
|
|
761
|
+
value: function rightEncode(data, structure) {
|
|
762
|
+
return (0, _encoder2$4.default)(data, structure);
|
|
763
|
+
}
|
|
764
|
+
}, {
|
|
765
|
+
key: 'encodeGuarded',
|
|
766
|
+
value: function encodeGuarded() {
|
|
767
|
+
var textOptions = { fontSize: this.fontSize };
|
|
768
|
+
var guardOptions = { height: this.guardHeight };
|
|
769
|
+
|
|
770
|
+
return [{ data: _constants$4.SIDE_BIN, options: guardOptions }, { data: this.leftEncode(), text: this.leftText(), options: textOptions }, { data: _constants$4.MIDDLE_BIN, options: guardOptions }, { data: this.rightEncode(), text: this.rightText(), options: textOptions }, { data: _constants$4.SIDE_BIN, options: guardOptions }];
|
|
771
|
+
}
|
|
772
|
+
}, {
|
|
773
|
+
key: 'encodeFlat',
|
|
774
|
+
value: function encodeFlat() {
|
|
775
|
+
var data = [_constants$4.SIDE_BIN, this.leftEncode(), _constants$4.MIDDLE_BIN, this.rightEncode(), _constants$4.SIDE_BIN];
|
|
776
|
+
|
|
777
|
+
return {
|
|
778
|
+
data: data.join(''),
|
|
779
|
+
text: this.text
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
}]);
|
|
783
|
+
|
|
784
|
+
return EAN;
|
|
785
|
+
}(_Barcode3$9.default);
|
|
786
|
+
|
|
787
|
+
EAN$1.default = EAN;
|
|
788
|
+
|
|
789
|
+
Object.defineProperty(EAN13$1, "__esModule", {
|
|
790
|
+
value: true
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
var _createClass$g = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
794
|
+
|
|
795
|
+
var _get$1 = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
|
796
|
+
|
|
797
|
+
var _constants$3 = constants$1;
|
|
798
|
+
|
|
799
|
+
var _EAN2$2 = EAN$1;
|
|
800
|
+
|
|
801
|
+
var _EAN3$2 = _interopRequireDefault$q(_EAN2$2);
|
|
802
|
+
|
|
803
|
+
function _interopRequireDefault$q(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
804
|
+
|
|
805
|
+
function _classCallCheck$l(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
806
|
+
|
|
807
|
+
function _possibleConstructorReturn$h(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
808
|
+
|
|
809
|
+
function _inherits$h(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
810
|
+
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode
|
|
811
|
+
|
|
812
|
+
// Calculate the checksum digit
|
|
813
|
+
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
|
|
814
|
+
var checksum$4 = function checksum(number) {
|
|
815
|
+
var res = number.substr(0, 12).split('').map(function (n) {
|
|
816
|
+
return +n;
|
|
817
|
+
}).reduce(function (sum, a, idx) {
|
|
818
|
+
return idx % 2 ? sum + a * 3 : sum + a;
|
|
819
|
+
}, 0);
|
|
820
|
+
|
|
821
|
+
return (10 - res % 10) % 10;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
var EAN13 = function (_EAN) {
|
|
825
|
+
_inherits$h(EAN13, _EAN);
|
|
826
|
+
|
|
827
|
+
function EAN13(data, options) {
|
|
828
|
+
_classCallCheck$l(this, EAN13);
|
|
829
|
+
|
|
830
|
+
// Add checksum if it does not exist
|
|
831
|
+
if (data.search(/^[0-9]{12}$/) !== -1) {
|
|
832
|
+
data += checksum$4(data);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// Adds a last character to the end of the barcode
|
|
836
|
+
var _this = _possibleConstructorReturn$h(this, (EAN13.__proto__ || Object.getPrototypeOf(EAN13)).call(this, data, options));
|
|
837
|
+
|
|
838
|
+
_this.lastChar = options.lastChar;
|
|
839
|
+
return _this;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
_createClass$g(EAN13, [{
|
|
843
|
+
key: 'valid',
|
|
844
|
+
value: function valid() {
|
|
845
|
+
return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum$4(this.data);
|
|
846
|
+
}
|
|
847
|
+
}, {
|
|
848
|
+
key: 'leftText',
|
|
849
|
+
value: function leftText() {
|
|
850
|
+
return _get$1(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftText', this).call(this, 1, 6);
|
|
851
|
+
}
|
|
852
|
+
}, {
|
|
853
|
+
key: 'leftEncode',
|
|
854
|
+
value: function leftEncode() {
|
|
855
|
+
var data = this.data.substr(1, 6);
|
|
856
|
+
var structure = _constants$3.EAN13_STRUCTURE[this.data[0]];
|
|
857
|
+
return _get$1(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'leftEncode', this).call(this, data, structure);
|
|
858
|
+
}
|
|
859
|
+
}, {
|
|
860
|
+
key: 'rightText',
|
|
861
|
+
value: function rightText() {
|
|
862
|
+
return _get$1(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightText', this).call(this, 7, 6);
|
|
863
|
+
}
|
|
864
|
+
}, {
|
|
865
|
+
key: 'rightEncode',
|
|
866
|
+
value: function rightEncode() {
|
|
867
|
+
var data = this.data.substr(7, 6);
|
|
868
|
+
return _get$1(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'rightEncode', this).call(this, data, 'RRRRRR');
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// The "standard" way of printing EAN13 barcodes with guard bars
|
|
872
|
+
|
|
873
|
+
}, {
|
|
874
|
+
key: 'encodeGuarded',
|
|
875
|
+
value: function encodeGuarded() {
|
|
876
|
+
var data = _get$1(EAN13.prototype.__proto__ || Object.getPrototypeOf(EAN13.prototype), 'encodeGuarded', this).call(this);
|
|
877
|
+
|
|
878
|
+
// Extend data with left digit & last character
|
|
879
|
+
if (this.options.displayValue) {
|
|
880
|
+
data.unshift({
|
|
881
|
+
data: '000000000000',
|
|
882
|
+
text: this.text.substr(0, 1),
|
|
883
|
+
options: { textAlign: 'left', fontSize: this.fontSize }
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
if (this.options.lastChar) {
|
|
887
|
+
data.push({
|
|
888
|
+
data: '00'
|
|
889
|
+
});
|
|
890
|
+
data.push({
|
|
891
|
+
data: '00000',
|
|
892
|
+
text: this.options.lastChar,
|
|
893
|
+
options: { fontSize: this.fontSize }
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
return data;
|
|
899
|
+
}
|
|
900
|
+
}]);
|
|
901
|
+
|
|
902
|
+
return EAN13;
|
|
903
|
+
}(_EAN3$2.default);
|
|
904
|
+
|
|
905
|
+
EAN13$1.default = EAN13;
|
|
906
|
+
|
|
907
|
+
var EAN8$1 = {};
|
|
908
|
+
|
|
909
|
+
Object.defineProperty(EAN8$1, "__esModule", {
|
|
910
|
+
value: true
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
var _createClass$f = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
914
|
+
|
|
915
|
+
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
|
916
|
+
|
|
917
|
+
var _EAN2$1 = EAN$1;
|
|
918
|
+
|
|
919
|
+
var _EAN3$1 = _interopRequireDefault$p(_EAN2$1);
|
|
920
|
+
|
|
921
|
+
function _interopRequireDefault$p(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
922
|
+
|
|
923
|
+
function _classCallCheck$k(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
924
|
+
|
|
925
|
+
function _possibleConstructorReturn$g(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
926
|
+
|
|
927
|
+
function _inherits$g(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
928
|
+
// http://www.barcodeisland.com/ean8.phtml
|
|
929
|
+
|
|
930
|
+
// Calculate the checksum digit
|
|
931
|
+
var checksum$3 = function checksum(number) {
|
|
932
|
+
var res = number.substr(0, 7).split('').map(function (n) {
|
|
933
|
+
return +n;
|
|
934
|
+
}).reduce(function (sum, a, idx) {
|
|
935
|
+
return idx % 2 ? sum + a : sum + a * 3;
|
|
936
|
+
}, 0);
|
|
937
|
+
|
|
938
|
+
return (10 - res % 10) % 10;
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
var EAN8 = function (_EAN) {
|
|
942
|
+
_inherits$g(EAN8, _EAN);
|
|
943
|
+
|
|
944
|
+
function EAN8(data, options) {
|
|
945
|
+
_classCallCheck$k(this, EAN8);
|
|
946
|
+
|
|
947
|
+
// Add checksum if it does not exist
|
|
948
|
+
if (data.search(/^[0-9]{7}$/) !== -1) {
|
|
949
|
+
data += checksum$3(data);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
return _possibleConstructorReturn$g(this, (EAN8.__proto__ || Object.getPrototypeOf(EAN8)).call(this, data, options));
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
_createClass$f(EAN8, [{
|
|
956
|
+
key: 'valid',
|
|
957
|
+
value: function valid() {
|
|
958
|
+
return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum$3(this.data);
|
|
959
|
+
}
|
|
960
|
+
}, {
|
|
961
|
+
key: 'leftText',
|
|
962
|
+
value: function leftText() {
|
|
963
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftText', this).call(this, 0, 4);
|
|
964
|
+
}
|
|
965
|
+
}, {
|
|
966
|
+
key: 'leftEncode',
|
|
967
|
+
value: function leftEncode() {
|
|
968
|
+
var data = this.data.substr(0, 4);
|
|
969
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'leftEncode', this).call(this, data, 'LLLL');
|
|
970
|
+
}
|
|
971
|
+
}, {
|
|
972
|
+
key: 'rightText',
|
|
973
|
+
value: function rightText() {
|
|
974
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightText', this).call(this, 4, 4);
|
|
975
|
+
}
|
|
976
|
+
}, {
|
|
977
|
+
key: 'rightEncode',
|
|
978
|
+
value: function rightEncode() {
|
|
979
|
+
var data = this.data.substr(4, 4);
|
|
980
|
+
return _get(EAN8.prototype.__proto__ || Object.getPrototypeOf(EAN8.prototype), 'rightEncode', this).call(this, data, 'RRRR');
|
|
981
|
+
}
|
|
982
|
+
}]);
|
|
983
|
+
|
|
984
|
+
return EAN8;
|
|
985
|
+
}(_EAN3$1.default);
|
|
986
|
+
|
|
987
|
+
EAN8$1.default = EAN8;
|
|
988
|
+
|
|
989
|
+
var EAN5$1 = {};
|
|
990
|
+
|
|
991
|
+
Object.defineProperty(EAN5$1, "__esModule", {
|
|
992
|
+
value: true
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
var _createClass$e = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
996
|
+
|
|
997
|
+
var _constants$2 = constants$1;
|
|
998
|
+
|
|
999
|
+
var _encoder$3 = encoder;
|
|
1000
|
+
|
|
1001
|
+
var _encoder2$3 = _interopRequireDefault$o(_encoder$3);
|
|
1002
|
+
|
|
1003
|
+
var _Barcode2$8 = Barcode$2;
|
|
1004
|
+
|
|
1005
|
+
var _Barcode3$8 = _interopRequireDefault$o(_Barcode2$8);
|
|
1006
|
+
|
|
1007
|
+
function _interopRequireDefault$o(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1008
|
+
|
|
1009
|
+
function _classCallCheck$j(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1010
|
+
|
|
1011
|
+
function _possibleConstructorReturn$f(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1012
|
+
|
|
1013
|
+
function _inherits$f(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
1014
|
+
// https://en.wikipedia.org/wiki/EAN_5#Encoding
|
|
1015
|
+
|
|
1016
|
+
var checksum$2 = function checksum(data) {
|
|
1017
|
+
var result = data.split('').map(function (n) {
|
|
1018
|
+
return +n;
|
|
1019
|
+
}).reduce(function (sum, a, idx) {
|
|
1020
|
+
return idx % 2 ? sum + a * 9 : sum + a * 3;
|
|
1021
|
+
}, 0);
|
|
1022
|
+
return result % 10;
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
var EAN5 = function (_Barcode) {
|
|
1026
|
+
_inherits$f(EAN5, _Barcode);
|
|
1027
|
+
|
|
1028
|
+
function EAN5(data, options) {
|
|
1029
|
+
_classCallCheck$j(this, EAN5);
|
|
1030
|
+
|
|
1031
|
+
return _possibleConstructorReturn$f(this, (EAN5.__proto__ || Object.getPrototypeOf(EAN5)).call(this, data, options));
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
_createClass$e(EAN5, [{
|
|
1035
|
+
key: 'valid',
|
|
1036
|
+
value: function valid() {
|
|
1037
|
+
return this.data.search(/^[0-9]{5}$/) !== -1;
|
|
1038
|
+
}
|
|
1039
|
+
}, {
|
|
1040
|
+
key: 'encode',
|
|
1041
|
+
value: function encode() {
|
|
1042
|
+
var structure = _constants$2.EAN5_STRUCTURE[checksum$2(this.data)];
|
|
1043
|
+
return {
|
|
1044
|
+
data: '1011' + (0, _encoder2$3.default)(this.data, structure, '01'),
|
|
1045
|
+
text: this.text
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
}]);
|
|
1049
|
+
|
|
1050
|
+
return EAN5;
|
|
1051
|
+
}(_Barcode3$8.default);
|
|
1052
|
+
|
|
1053
|
+
EAN5$1.default = EAN5;
|
|
1054
|
+
|
|
1055
|
+
var EAN2$1 = {};
|
|
1056
|
+
|
|
1057
|
+
Object.defineProperty(EAN2$1, "__esModule", {
|
|
1058
|
+
value: true
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
var _createClass$d = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1062
|
+
|
|
1063
|
+
var _constants$1 = constants$1;
|
|
1064
|
+
|
|
1065
|
+
var _encoder$2 = encoder;
|
|
1066
|
+
|
|
1067
|
+
var _encoder2$2 = _interopRequireDefault$n(_encoder$2);
|
|
1068
|
+
|
|
1069
|
+
var _Barcode2$7 = Barcode$2;
|
|
1070
|
+
|
|
1071
|
+
var _Barcode3$7 = _interopRequireDefault$n(_Barcode2$7);
|
|
1072
|
+
|
|
1073
|
+
function _interopRequireDefault$n(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1074
|
+
|
|
1075
|
+
function _classCallCheck$i(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1076
|
+
|
|
1077
|
+
function _possibleConstructorReturn$e(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1078
|
+
|
|
1079
|
+
function _inherits$e(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
1080
|
+
// https://en.wikipedia.org/wiki/EAN_2#Encoding
|
|
1081
|
+
|
|
1082
|
+
var EAN2 = function (_Barcode) {
|
|
1083
|
+
_inherits$e(EAN2, _Barcode);
|
|
1084
|
+
|
|
1085
|
+
function EAN2(data, options) {
|
|
1086
|
+
_classCallCheck$i(this, EAN2);
|
|
1087
|
+
|
|
1088
|
+
return _possibleConstructorReturn$e(this, (EAN2.__proto__ || Object.getPrototypeOf(EAN2)).call(this, data, options));
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
_createClass$d(EAN2, [{
|
|
1092
|
+
key: 'valid',
|
|
1093
|
+
value: function valid() {
|
|
1094
|
+
return this.data.search(/^[0-9]{2}$/) !== -1;
|
|
1095
|
+
}
|
|
1096
|
+
}, {
|
|
1097
|
+
key: 'encode',
|
|
1098
|
+
value: function encode() {
|
|
1099
|
+
// Choose the structure based on the number mod 4
|
|
1100
|
+
var structure = _constants$1.EAN2_STRUCTURE[parseInt(this.data) % 4];
|
|
1101
|
+
return {
|
|
1102
|
+
// Start bits + Encode the two digits with 01 in between
|
|
1103
|
+
data: '1011' + (0, _encoder2$2.default)(this.data, structure, '01'),
|
|
1104
|
+
text: this.text
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
}]);
|
|
1108
|
+
|
|
1109
|
+
return EAN2;
|
|
1110
|
+
}(_Barcode3$7.default);
|
|
1111
|
+
|
|
1112
|
+
EAN2$1.default = EAN2;
|
|
1113
|
+
|
|
1114
|
+
var UPC$1 = {};
|
|
1115
|
+
|
|
1116
|
+
Object.defineProperty(UPC$1, "__esModule", {
|
|
1117
|
+
value: true
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
var _createClass$c = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1121
|
+
|
|
1122
|
+
UPC$1.checksum = checksum$1;
|
|
1123
|
+
|
|
1124
|
+
var _encoder$1 = encoder;
|
|
1125
|
+
|
|
1126
|
+
var _encoder2$1 = _interopRequireDefault$m(_encoder$1);
|
|
1127
|
+
|
|
1128
|
+
var _Barcode2$6 = Barcode$2;
|
|
1129
|
+
|
|
1130
|
+
var _Barcode3$6 = _interopRequireDefault$m(_Barcode2$6);
|
|
1131
|
+
|
|
1132
|
+
function _interopRequireDefault$m(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1133
|
+
|
|
1134
|
+
function _classCallCheck$h(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1135
|
+
|
|
1136
|
+
function _possibleConstructorReturn$d(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1137
|
+
|
|
1138
|
+
function _inherits$d(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
1139
|
+
// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding
|
|
1140
|
+
|
|
1141
|
+
var UPC = function (_Barcode) {
|
|
1142
|
+
_inherits$d(UPC, _Barcode);
|
|
1143
|
+
|
|
1144
|
+
function UPC(data, options) {
|
|
1145
|
+
_classCallCheck$h(this, UPC);
|
|
1146
|
+
|
|
1147
|
+
// Add checksum if it does not exist
|
|
1148
|
+
if (data.search(/^[0-9]{11}$/) !== -1) {
|
|
1149
|
+
data += checksum$1(data);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
var _this = _possibleConstructorReturn$d(this, (UPC.__proto__ || Object.getPrototypeOf(UPC)).call(this, data, options));
|
|
1153
|
+
|
|
1154
|
+
_this.displayValue = options.displayValue;
|
|
1155
|
+
|
|
1156
|
+
// Make sure the font is not bigger than the space between the guard bars
|
|
1157
|
+
if (options.fontSize > options.width * 10) {
|
|
1158
|
+
_this.fontSize = options.width * 10;
|
|
1159
|
+
} else {
|
|
1160
|
+
_this.fontSize = options.fontSize;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// Make the guard bars go down half the way of the text
|
|
1164
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
1165
|
+
return _this;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
_createClass$c(UPC, [{
|
|
1169
|
+
key: "valid",
|
|
1170
|
+
value: function valid() {
|
|
1171
|
+
return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum$1(this.data);
|
|
1172
|
+
}
|
|
1173
|
+
}, {
|
|
1174
|
+
key: "encode",
|
|
1175
|
+
value: function encode() {
|
|
1176
|
+
if (this.options.flat) {
|
|
1177
|
+
return this.flatEncoding();
|
|
1178
|
+
} else {
|
|
1179
|
+
return this.guardedEncoding();
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}, {
|
|
1183
|
+
key: "flatEncoding",
|
|
1184
|
+
value: function flatEncoding() {
|
|
1185
|
+
var result = "";
|
|
1186
|
+
|
|
1187
|
+
result += "101";
|
|
1188
|
+
result += (0, _encoder2$1.default)(this.data.substr(0, 6), "LLLLLL");
|
|
1189
|
+
result += "01010";
|
|
1190
|
+
result += (0, _encoder2$1.default)(this.data.substr(6, 6), "RRRRRR");
|
|
1191
|
+
result += "101";
|
|
1192
|
+
|
|
1193
|
+
return {
|
|
1194
|
+
data: result,
|
|
1195
|
+
text: this.text
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
}, {
|
|
1199
|
+
key: "guardedEncoding",
|
|
1200
|
+
value: function guardedEncoding() {
|
|
1201
|
+
var result = [];
|
|
1202
|
+
|
|
1203
|
+
// Add the first digit
|
|
1204
|
+
if (this.displayValue) {
|
|
1205
|
+
result.push({
|
|
1206
|
+
data: "00000000",
|
|
1207
|
+
text: this.text.substr(0, 1),
|
|
1208
|
+
options: { textAlign: "left", fontSize: this.fontSize }
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
// Add the guard bars
|
|
1213
|
+
result.push({
|
|
1214
|
+
data: "101" + (0, _encoder2$1.default)(this.data[0], "L"),
|
|
1215
|
+
options: { height: this.guardHeight }
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
// Add the left side
|
|
1219
|
+
result.push({
|
|
1220
|
+
data: (0, _encoder2$1.default)(this.data.substr(1, 5), "LLLLL"),
|
|
1221
|
+
text: this.text.substr(1, 5),
|
|
1222
|
+
options: { fontSize: this.fontSize }
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1225
|
+
// Add the middle bits
|
|
1226
|
+
result.push({
|
|
1227
|
+
data: "01010",
|
|
1228
|
+
options: { height: this.guardHeight }
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1231
|
+
// Add the right side
|
|
1232
|
+
result.push({
|
|
1233
|
+
data: (0, _encoder2$1.default)(this.data.substr(6, 5), "RRRRR"),
|
|
1234
|
+
text: this.text.substr(6, 5),
|
|
1235
|
+
options: { fontSize: this.fontSize }
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
// Add the end bits
|
|
1239
|
+
result.push({
|
|
1240
|
+
data: (0, _encoder2$1.default)(this.data[11], "R") + "101",
|
|
1241
|
+
options: { height: this.guardHeight }
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
// Add the last digit
|
|
1245
|
+
if (this.displayValue) {
|
|
1246
|
+
result.push({
|
|
1247
|
+
data: "00000000",
|
|
1248
|
+
text: this.text.substr(11, 1),
|
|
1249
|
+
options: { textAlign: "right", fontSize: this.fontSize }
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
return result;
|
|
1254
|
+
}
|
|
1255
|
+
}]);
|
|
1256
|
+
|
|
1257
|
+
return UPC;
|
|
1258
|
+
}(_Barcode3$6.default);
|
|
1259
|
+
|
|
1260
|
+
// Calulate the checksum digit
|
|
1261
|
+
// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
function checksum$1(number) {
|
|
1265
|
+
var result = 0;
|
|
1266
|
+
|
|
1267
|
+
var i;
|
|
1268
|
+
for (i = 1; i < 11; i += 2) {
|
|
1269
|
+
result += parseInt(number[i]);
|
|
1270
|
+
}
|
|
1271
|
+
for (i = 0; i < 11; i += 2) {
|
|
1272
|
+
result += parseInt(number[i]) * 3;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
return (10 - result % 10) % 10;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
UPC$1.default = UPC;
|
|
1279
|
+
|
|
1280
|
+
var UPCE$1 = {};
|
|
1281
|
+
|
|
1282
|
+
Object.defineProperty(UPCE$1, "__esModule", {
|
|
1283
|
+
value: true
|
|
1284
|
+
});
|
|
1285
|
+
|
|
1286
|
+
var _createClass$b = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1287
|
+
|
|
1288
|
+
var _encoder = encoder;
|
|
1289
|
+
|
|
1290
|
+
var _encoder2 = _interopRequireDefault$l(_encoder);
|
|
1291
|
+
|
|
1292
|
+
var _Barcode2$5 = Barcode$2;
|
|
1293
|
+
|
|
1294
|
+
var _Barcode3$5 = _interopRequireDefault$l(_Barcode2$5);
|
|
1295
|
+
|
|
1296
|
+
var _UPC$1 = UPC$1;
|
|
1297
|
+
|
|
1298
|
+
function _interopRequireDefault$l(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1299
|
+
|
|
1300
|
+
function _classCallCheck$g(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1301
|
+
|
|
1302
|
+
function _possibleConstructorReturn$c(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1303
|
+
|
|
1304
|
+
function _inherits$c(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
|
|
1305
|
+
// https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding
|
|
1306
|
+
//
|
|
1307
|
+
// UPC-E documentation:
|
|
1308
|
+
// https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E
|
|
1309
|
+
|
|
1310
|
+
var EXPANSIONS = ["XX00000XXX", "XX10000XXX", "XX20000XXX", "XXX00000XX", "XXXX00000X", "XXXXX00005", "XXXXX00006", "XXXXX00007", "XXXXX00008", "XXXXX00009"];
|
|
1311
|
+
|
|
1312
|
+
var PARITIES = [["EEEOOO", "OOOEEE"], ["EEOEOO", "OOEOEE"], ["EEOOEO", "OOEEOE"], ["EEOOOE", "OOEEEO"], ["EOEEOO", "OEOOEE"], ["EOOEEO", "OEEOOE"], ["EOOOEE", "OEEEOO"], ["EOEOEO", "OEOEOE"], ["EOEOOE", "OEOEEO"], ["EOOEOE", "OEEOEO"]];
|
|
1313
|
+
|
|
1314
|
+
var UPCE = function (_Barcode) {
|
|
1315
|
+
_inherits$c(UPCE, _Barcode);
|
|
1316
|
+
|
|
1317
|
+
function UPCE(data, options) {
|
|
1318
|
+
_classCallCheck$g(this, UPCE);
|
|
1319
|
+
|
|
1320
|
+
var _this = _possibleConstructorReturn$c(this, (UPCE.__proto__ || Object.getPrototypeOf(UPCE)).call(this, data, options));
|
|
1321
|
+
// Code may be 6 or 8 digits;
|
|
1322
|
+
// A 7 digit code is ambiguous as to whether the extra digit
|
|
1323
|
+
// is a UPC-A check or number system digit.
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
_this.isValid = false;
|
|
1327
|
+
if (data.search(/^[0-9]{6}$/) !== -1) {
|
|
1328
|
+
_this.middleDigits = data;
|
|
1329
|
+
_this.upcA = expandToUPCA(data, "0");
|
|
1330
|
+
_this.text = options.text || '' + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1];
|
|
1331
|
+
_this.isValid = true;
|
|
1332
|
+
} else if (data.search(/^[01][0-9]{7}$/) !== -1) {
|
|
1333
|
+
_this.middleDigits = data.substring(1, data.length - 1);
|
|
1334
|
+
_this.upcA = expandToUPCA(_this.middleDigits, data[0]);
|
|
1335
|
+
|
|
1336
|
+
if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) {
|
|
1337
|
+
_this.isValid = true;
|
|
1338
|
+
} else {
|
|
1339
|
+
// checksum mismatch
|
|
1340
|
+
return _possibleConstructorReturn$c(_this);
|
|
1341
|
+
}
|
|
1342
|
+
} else {
|
|
1343
|
+
return _possibleConstructorReturn$c(_this);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
_this.displayValue = options.displayValue;
|
|
1347
|
+
|
|
1348
|
+
// Make sure the font is not bigger than the space between the guard bars
|
|
1349
|
+
if (options.fontSize > options.width * 10) {
|
|
1350
|
+
_this.fontSize = options.width * 10;
|
|
1351
|
+
} else {
|
|
1352
|
+
_this.fontSize = options.fontSize;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
// Make the guard bars go down half the way of the text
|
|
1356
|
+
_this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
|
|
1357
|
+
return _this;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
_createClass$b(UPCE, [{
|
|
1361
|
+
key: 'valid',
|
|
1362
|
+
value: function valid() {
|
|
1363
|
+
return this.isValid;
|
|
1364
|
+
}
|
|
1365
|
+
}, {
|
|
1366
|
+
key: 'encode',
|
|
1367
|
+
value: function encode() {
|
|
1368
|
+
if (this.options.flat) {
|
|
1369
|
+
return this.flatEncoding();
|
|
1370
|
+
} else {
|
|
1371
|
+
return this.guardedEncoding();
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}, {
|
|
1375
|
+
key: 'flatEncoding',
|
|
1376
|
+
value: function flatEncoding() {
|
|
1377
|
+
var result = "";
|
|
1378
|
+
|
|
1379
|
+
result += "101";
|
|
1380
|
+
result += this.encodeMiddleDigits();
|
|
1381
|
+
result += "010101";
|
|
1382
|
+
|
|
1383
|
+
return {
|
|
1384
|
+
data: result,
|
|
1385
|
+
text: this.text
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
}, {
|
|
1389
|
+
key: 'guardedEncoding',
|
|
1390
|
+
value: function guardedEncoding() {
|
|
1391
|
+
var result = [];
|
|
1392
|
+
|
|
1393
|
+
// Add the UPC-A number system digit beneath the quiet zone
|
|
1394
|
+
if (this.displayValue) {
|
|
1395
|
+
result.push({
|
|
1396
|
+
data: "00000000",
|
|
1397
|
+
text: this.text[0],
|
|
1398
|
+
options: { textAlign: "left", fontSize: this.fontSize }
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
// Add the guard bars
|
|
1403
|
+
result.push({
|
|
1404
|
+
data: "101",
|
|
1405
|
+
options: { height: this.guardHeight }
|
|
1406
|
+
});
|
|
1407
|
+
|
|
1408
|
+
// Add the 6 UPC-E digits
|
|
1409
|
+
result.push({
|
|
1410
|
+
data: this.encodeMiddleDigits(),
|
|
1411
|
+
text: this.text.substring(1, 7),
|
|
1412
|
+
options: { fontSize: this.fontSize }
|
|
1413
|
+
});
|
|
1414
|
+
|
|
1415
|
+
// Add the end bits
|
|
1416
|
+
result.push({
|
|
1417
|
+
data: "010101",
|
|
1418
|
+
options: { height: this.guardHeight }
|
|
1419
|
+
});
|
|
1420
|
+
|
|
1421
|
+
// Add the UPC-A check digit beneath the quiet zone
|
|
1422
|
+
if (this.displayValue) {
|
|
1423
|
+
result.push({
|
|
1424
|
+
data: "00000000",
|
|
1425
|
+
text: this.text[7],
|
|
1426
|
+
options: { textAlign: "right", fontSize: this.fontSize }
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
return result;
|
|
1431
|
+
}
|
|
1432
|
+
}, {
|
|
1433
|
+
key: 'encodeMiddleDigits',
|
|
1434
|
+
value: function encodeMiddleDigits() {
|
|
1435
|
+
var numberSystem = this.upcA[0];
|
|
1436
|
+
var checkDigit = this.upcA[this.upcA.length - 1];
|
|
1437
|
+
var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)];
|
|
1438
|
+
return (0, _encoder2.default)(this.middleDigits, parity);
|
|
1439
|
+
}
|
|
1440
|
+
}]);
|
|
1441
|
+
|
|
1442
|
+
return UPCE;
|
|
1443
|
+
}(_Barcode3$5.default);
|
|
1444
|
+
|
|
1445
|
+
function expandToUPCA(middleDigits, numberSystem) {
|
|
1446
|
+
var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]);
|
|
1447
|
+
var expansion = EXPANSIONS[lastUpcE];
|
|
1448
|
+
|
|
1449
|
+
var result = "";
|
|
1450
|
+
var digitIndex = 0;
|
|
1451
|
+
for (var i = 0; i < expansion.length; i++) {
|
|
1452
|
+
var c = expansion[i];
|
|
1453
|
+
if (c === 'X') {
|
|
1454
|
+
result += middleDigits[digitIndex++];
|
|
1455
|
+
} else {
|
|
1456
|
+
result += c;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
result = '' + numberSystem + result;
|
|
1461
|
+
return '' + result + (0, _UPC$1.checksum)(result);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
UPCE$1.default = UPCE;
|
|
1465
|
+
|
|
1466
|
+
Object.defineProperty(EAN_UPC, "__esModule", {
|
|
1467
|
+
value: true
|
|
1468
|
+
});
|
|
1469
|
+
EAN_UPC.UPCE = EAN_UPC.UPC = EAN_UPC.EAN2 = EAN_UPC.EAN5 = EAN_UPC.EAN8 = EAN_UPC.EAN13 = undefined;
|
|
1470
|
+
|
|
1471
|
+
var _EAN = EAN13$1;
|
|
1472
|
+
|
|
1473
|
+
var _EAN2 = _interopRequireDefault$k(_EAN);
|
|
1474
|
+
|
|
1475
|
+
var _EAN3 = EAN8$1;
|
|
1476
|
+
|
|
1477
|
+
var _EAN4 = _interopRequireDefault$k(_EAN3);
|
|
1478
|
+
|
|
1479
|
+
var _EAN5 = EAN5$1;
|
|
1480
|
+
|
|
1481
|
+
var _EAN6 = _interopRequireDefault$k(_EAN5);
|
|
1482
|
+
|
|
1483
|
+
var _EAN7 = EAN2$1;
|
|
1484
|
+
|
|
1485
|
+
var _EAN8 = _interopRequireDefault$k(_EAN7);
|
|
1486
|
+
|
|
1487
|
+
var _UPC = UPC$1;
|
|
1488
|
+
|
|
1489
|
+
var _UPC2 = _interopRequireDefault$k(_UPC);
|
|
1490
|
+
|
|
1491
|
+
var _UPCE = UPCE$1;
|
|
1492
|
+
|
|
1493
|
+
var _UPCE2 = _interopRequireDefault$k(_UPCE);
|
|
1494
|
+
|
|
1495
|
+
function _interopRequireDefault$k(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1496
|
+
|
|
1497
|
+
EAN_UPC.EAN13 = _EAN2.default;
|
|
1498
|
+
EAN_UPC.EAN8 = _EAN4.default;
|
|
1499
|
+
EAN_UPC.EAN5 = _EAN6.default;
|
|
1500
|
+
EAN_UPC.EAN2 = _EAN8.default;
|
|
1501
|
+
EAN_UPC.UPC = _UPC2.default;
|
|
1502
|
+
EAN_UPC.UPCE = _UPCE2.default;
|
|
1503
|
+
|
|
1504
|
+
var ITF$2 = {};
|
|
1505
|
+
|
|
1506
|
+
var ITF$1 = {};
|
|
1507
|
+
|
|
1508
|
+
var constants = {};
|
|
1509
|
+
|
|
1510
|
+
Object.defineProperty(constants, "__esModule", {
|
|
1511
|
+
value: true
|
|
1512
|
+
});
|
|
1513
|
+
constants.START_BIN = '1010';
|
|
1514
|
+
constants.END_BIN = '11101';
|
|
1515
|
+
|
|
1516
|
+
constants.BINARIES = ['00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010'];
|
|
1517
|
+
|
|
1518
|
+
Object.defineProperty(ITF$1, "__esModule", {
|
|
1519
|
+
value: true
|
|
1520
|
+
});
|
|
1521
|
+
|
|
1522
|
+
var _createClass$a = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1523
|
+
|
|
1524
|
+
var _constants = constants;
|
|
1525
|
+
|
|
1526
|
+
var _Barcode2$4 = Barcode$2;
|
|
1527
|
+
|
|
1528
|
+
var _Barcode3$4 = _interopRequireDefault$j(_Barcode2$4);
|
|
1529
|
+
|
|
1530
|
+
function _interopRequireDefault$j(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1531
|
+
|
|
1532
|
+
function _classCallCheck$f(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1533
|
+
|
|
1534
|
+
function _possibleConstructorReturn$b(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1535
|
+
|
|
1536
|
+
function _inherits$b(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1537
|
+
|
|
1538
|
+
var ITF = function (_Barcode) {
|
|
1539
|
+
_inherits$b(ITF, _Barcode);
|
|
1540
|
+
|
|
1541
|
+
function ITF() {
|
|
1542
|
+
_classCallCheck$f(this, ITF);
|
|
1543
|
+
|
|
1544
|
+
return _possibleConstructorReturn$b(this, (ITF.__proto__ || Object.getPrototypeOf(ITF)).apply(this, arguments));
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
_createClass$a(ITF, [{
|
|
1548
|
+
key: 'valid',
|
|
1549
|
+
value: function valid() {
|
|
1550
|
+
return this.data.search(/^([0-9]{2})+$/) !== -1;
|
|
1551
|
+
}
|
|
1552
|
+
}, {
|
|
1553
|
+
key: 'encode',
|
|
1554
|
+
value: function encode() {
|
|
1555
|
+
var _this2 = this;
|
|
1556
|
+
|
|
1557
|
+
// Calculate all the digit pairs
|
|
1558
|
+
var encoded = this.data.match(/.{2}/g).map(function (pair) {
|
|
1559
|
+
return _this2.encodePair(pair);
|
|
1560
|
+
}).join('');
|
|
1561
|
+
|
|
1562
|
+
return {
|
|
1563
|
+
data: _constants.START_BIN + encoded + _constants.END_BIN,
|
|
1564
|
+
text: this.text
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
// Calculate the data of a number pair
|
|
1569
|
+
|
|
1570
|
+
}, {
|
|
1571
|
+
key: 'encodePair',
|
|
1572
|
+
value: function encodePair(pair) {
|
|
1573
|
+
var second = _constants.BINARIES[pair[1]];
|
|
1574
|
+
|
|
1575
|
+
return _constants.BINARIES[pair[0]].split('').map(function (first, idx) {
|
|
1576
|
+
return (first === '1' ? '111' : '1') + (second[idx] === '1' ? '000' : '0');
|
|
1577
|
+
}).join('');
|
|
1578
|
+
}
|
|
1579
|
+
}]);
|
|
1580
|
+
|
|
1581
|
+
return ITF;
|
|
1582
|
+
}(_Barcode3$4.default);
|
|
1583
|
+
|
|
1584
|
+
ITF$1.default = ITF;
|
|
1585
|
+
|
|
1586
|
+
var ITF14$1 = {};
|
|
1587
|
+
|
|
1588
|
+
Object.defineProperty(ITF14$1, "__esModule", {
|
|
1589
|
+
value: true
|
|
1590
|
+
});
|
|
1591
|
+
|
|
1592
|
+
var _createClass$9 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1593
|
+
|
|
1594
|
+
var _ITF2$1 = ITF$1;
|
|
1595
|
+
|
|
1596
|
+
var _ITF3$1 = _interopRequireDefault$i(_ITF2$1);
|
|
1597
|
+
|
|
1598
|
+
function _interopRequireDefault$i(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1599
|
+
|
|
1600
|
+
function _classCallCheck$e(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1601
|
+
|
|
1602
|
+
function _possibleConstructorReturn$a(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1603
|
+
|
|
1604
|
+
function _inherits$a(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1605
|
+
|
|
1606
|
+
// Calculate the checksum digit
|
|
1607
|
+
var checksum = function checksum(data) {
|
|
1608
|
+
var res = data.substr(0, 13).split('').map(function (num) {
|
|
1609
|
+
return parseInt(num, 10);
|
|
1610
|
+
}).reduce(function (sum, n, idx) {
|
|
1611
|
+
return sum + n * (3 - idx % 2 * 2);
|
|
1612
|
+
}, 0);
|
|
1613
|
+
|
|
1614
|
+
return Math.ceil(res / 10) * 10 - res;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
var ITF14 = function (_ITF) {
|
|
1618
|
+
_inherits$a(ITF14, _ITF);
|
|
1619
|
+
|
|
1620
|
+
function ITF14(data, options) {
|
|
1621
|
+
_classCallCheck$e(this, ITF14);
|
|
1622
|
+
|
|
1623
|
+
// Add checksum if it does not exist
|
|
1624
|
+
if (data.search(/^[0-9]{13}$/) !== -1) {
|
|
1625
|
+
data += checksum(data);
|
|
1626
|
+
}
|
|
1627
|
+
return _possibleConstructorReturn$a(this, (ITF14.__proto__ || Object.getPrototypeOf(ITF14)).call(this, data, options));
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
_createClass$9(ITF14, [{
|
|
1631
|
+
key: 'valid',
|
|
1632
|
+
value: function valid() {
|
|
1633
|
+
return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data);
|
|
1634
|
+
}
|
|
1635
|
+
}]);
|
|
1636
|
+
|
|
1637
|
+
return ITF14;
|
|
1638
|
+
}(_ITF3$1.default);
|
|
1639
|
+
|
|
1640
|
+
ITF14$1.default = ITF14;
|
|
1641
|
+
|
|
1642
|
+
Object.defineProperty(ITF$2, "__esModule", {
|
|
1643
|
+
value: true
|
|
1644
|
+
});
|
|
1645
|
+
ITF$2.ITF14 = ITF$2.ITF = undefined;
|
|
1646
|
+
|
|
1647
|
+
var _ITF$1 = ITF$1;
|
|
1648
|
+
|
|
1649
|
+
var _ITF2 = _interopRequireDefault$h(_ITF$1);
|
|
1650
|
+
|
|
1651
|
+
var _ITF3 = ITF14$1;
|
|
1652
|
+
|
|
1653
|
+
var _ITF4 = _interopRequireDefault$h(_ITF3);
|
|
1654
|
+
|
|
1655
|
+
function _interopRequireDefault$h(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1656
|
+
|
|
1657
|
+
ITF$2.ITF = _ITF2.default;
|
|
1658
|
+
ITF$2.ITF14 = _ITF4.default;
|
|
1659
|
+
|
|
1660
|
+
var MSI$2 = {};
|
|
1661
|
+
|
|
1662
|
+
var MSI$1 = {};
|
|
1663
|
+
|
|
1664
|
+
Object.defineProperty(MSI$1, "__esModule", {
|
|
1665
|
+
value: true
|
|
1666
|
+
});
|
|
1667
|
+
|
|
1668
|
+
var _createClass$8 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1669
|
+
|
|
1670
|
+
var _Barcode2$3 = Barcode$2;
|
|
1671
|
+
|
|
1672
|
+
var _Barcode3$3 = _interopRequireDefault$g(_Barcode2$3);
|
|
1673
|
+
|
|
1674
|
+
function _interopRequireDefault$g(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1675
|
+
|
|
1676
|
+
function _classCallCheck$d(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1677
|
+
|
|
1678
|
+
function _possibleConstructorReturn$9(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1679
|
+
|
|
1680
|
+
function _inherits$9(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation
|
|
1681
|
+
// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup
|
|
1682
|
+
|
|
1683
|
+
var MSI = function (_Barcode) {
|
|
1684
|
+
_inherits$9(MSI, _Barcode);
|
|
1685
|
+
|
|
1686
|
+
function MSI(data, options) {
|
|
1687
|
+
_classCallCheck$d(this, MSI);
|
|
1688
|
+
|
|
1689
|
+
return _possibleConstructorReturn$9(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, options));
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
_createClass$8(MSI, [{
|
|
1693
|
+
key: "encode",
|
|
1694
|
+
value: function encode() {
|
|
1695
|
+
// Start bits
|
|
1696
|
+
var ret = "110";
|
|
1697
|
+
|
|
1698
|
+
for (var i = 0; i < this.data.length; i++) {
|
|
1699
|
+
// Convert the character to binary (always 4 binary digits)
|
|
1700
|
+
var digit = parseInt(this.data[i]);
|
|
1701
|
+
var bin = digit.toString(2);
|
|
1702
|
+
bin = addZeroes(bin, 4 - bin.length);
|
|
1703
|
+
|
|
1704
|
+
// Add 100 for every zero and 110 for every 1
|
|
1705
|
+
for (var b = 0; b < bin.length; b++) {
|
|
1706
|
+
ret += bin[b] == "0" ? "100" : "110";
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
// End bits
|
|
1711
|
+
ret += "1001";
|
|
1712
|
+
|
|
1713
|
+
return {
|
|
1714
|
+
data: ret,
|
|
1715
|
+
text: this.text
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
}, {
|
|
1719
|
+
key: "valid",
|
|
1720
|
+
value: function valid() {
|
|
1721
|
+
return this.data.search(/^[0-9]+$/) !== -1;
|
|
1722
|
+
}
|
|
1723
|
+
}]);
|
|
1724
|
+
|
|
1725
|
+
return MSI;
|
|
1726
|
+
}(_Barcode3$3.default);
|
|
1727
|
+
|
|
1728
|
+
function addZeroes(number, n) {
|
|
1729
|
+
for (var i = 0; i < n; i++) {
|
|
1730
|
+
number = "0" + number;
|
|
1731
|
+
}
|
|
1732
|
+
return number;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
MSI$1.default = MSI;
|
|
1736
|
+
|
|
1737
|
+
var MSI10$1 = {};
|
|
1738
|
+
|
|
1739
|
+
var checksums = {};
|
|
1740
|
+
|
|
1741
|
+
Object.defineProperty(checksums, "__esModule", {
|
|
1742
|
+
value: true
|
|
1743
|
+
});
|
|
1744
|
+
checksums.mod10 = mod10;
|
|
1745
|
+
checksums.mod11 = mod11;
|
|
1746
|
+
function mod10(number) {
|
|
1747
|
+
var sum = 0;
|
|
1748
|
+
for (var i = 0; i < number.length; i++) {
|
|
1749
|
+
var n = parseInt(number[i]);
|
|
1750
|
+
if ((i + number.length) % 2 === 0) {
|
|
1751
|
+
sum += n;
|
|
1752
|
+
} else {
|
|
1753
|
+
sum += n * 2 % 10 + Math.floor(n * 2 / 10);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return (10 - sum % 10) % 10;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
function mod11(number) {
|
|
1760
|
+
var sum = 0;
|
|
1761
|
+
var weights = [2, 3, 4, 5, 6, 7];
|
|
1762
|
+
for (var i = 0; i < number.length; i++) {
|
|
1763
|
+
var n = parseInt(number[number.length - 1 - i]);
|
|
1764
|
+
sum += weights[i % weights.length] * n;
|
|
1765
|
+
}
|
|
1766
|
+
return (11 - sum % 11) % 11;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
Object.defineProperty(MSI10$1, "__esModule", {
|
|
1770
|
+
value: true
|
|
1771
|
+
});
|
|
1772
|
+
|
|
1773
|
+
var _MSI2$4 = MSI$1;
|
|
1774
|
+
|
|
1775
|
+
var _MSI3$4 = _interopRequireDefault$f(_MSI2$4);
|
|
1776
|
+
|
|
1777
|
+
var _checksums$3 = checksums;
|
|
1778
|
+
|
|
1779
|
+
function _interopRequireDefault$f(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1780
|
+
|
|
1781
|
+
function _classCallCheck$c(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1782
|
+
|
|
1783
|
+
function _possibleConstructorReturn$8(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1784
|
+
|
|
1785
|
+
function _inherits$8(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1786
|
+
|
|
1787
|
+
var MSI10 = function (_MSI) {
|
|
1788
|
+
_inherits$8(MSI10, _MSI);
|
|
1789
|
+
|
|
1790
|
+
function MSI10(data, options) {
|
|
1791
|
+
_classCallCheck$c(this, MSI10);
|
|
1792
|
+
|
|
1793
|
+
return _possibleConstructorReturn$8(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + (0, _checksums$3.mod10)(data), options));
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
return MSI10;
|
|
1797
|
+
}(_MSI3$4.default);
|
|
1798
|
+
|
|
1799
|
+
MSI10$1.default = MSI10;
|
|
1800
|
+
|
|
1801
|
+
var MSI11$1 = {};
|
|
1802
|
+
|
|
1803
|
+
Object.defineProperty(MSI11$1, "__esModule", {
|
|
1804
|
+
value: true
|
|
1805
|
+
});
|
|
1806
|
+
|
|
1807
|
+
var _MSI2$3 = MSI$1;
|
|
1808
|
+
|
|
1809
|
+
var _MSI3$3 = _interopRequireDefault$e(_MSI2$3);
|
|
1810
|
+
|
|
1811
|
+
var _checksums$2 = checksums;
|
|
1812
|
+
|
|
1813
|
+
function _interopRequireDefault$e(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1814
|
+
|
|
1815
|
+
function _classCallCheck$b(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1816
|
+
|
|
1817
|
+
function _possibleConstructorReturn$7(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1818
|
+
|
|
1819
|
+
function _inherits$7(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1820
|
+
|
|
1821
|
+
var MSI11 = function (_MSI) {
|
|
1822
|
+
_inherits$7(MSI11, _MSI);
|
|
1823
|
+
|
|
1824
|
+
function MSI11(data, options) {
|
|
1825
|
+
_classCallCheck$b(this, MSI11);
|
|
1826
|
+
|
|
1827
|
+
return _possibleConstructorReturn$7(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + (0, _checksums$2.mod11)(data), options));
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
return MSI11;
|
|
1831
|
+
}(_MSI3$3.default);
|
|
1832
|
+
|
|
1833
|
+
MSI11$1.default = MSI11;
|
|
1834
|
+
|
|
1835
|
+
var MSI1010$1 = {};
|
|
1836
|
+
|
|
1837
|
+
Object.defineProperty(MSI1010$1, "__esModule", {
|
|
1838
|
+
value: true
|
|
1839
|
+
});
|
|
1840
|
+
|
|
1841
|
+
var _MSI2$2 = MSI$1;
|
|
1842
|
+
|
|
1843
|
+
var _MSI3$2 = _interopRequireDefault$d(_MSI2$2);
|
|
1844
|
+
|
|
1845
|
+
var _checksums$1 = checksums;
|
|
1846
|
+
|
|
1847
|
+
function _interopRequireDefault$d(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1848
|
+
|
|
1849
|
+
function _classCallCheck$a(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1850
|
+
|
|
1851
|
+
function _possibleConstructorReturn$6(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1852
|
+
|
|
1853
|
+
function _inherits$6(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1854
|
+
|
|
1855
|
+
var MSI1010 = function (_MSI) {
|
|
1856
|
+
_inherits$6(MSI1010, _MSI);
|
|
1857
|
+
|
|
1858
|
+
function MSI1010(data, options) {
|
|
1859
|
+
_classCallCheck$a(this, MSI1010);
|
|
1860
|
+
|
|
1861
|
+
data += (0, _checksums$1.mod10)(data);
|
|
1862
|
+
data += (0, _checksums$1.mod10)(data);
|
|
1863
|
+
return _possibleConstructorReturn$6(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, data, options));
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
return MSI1010;
|
|
1867
|
+
}(_MSI3$2.default);
|
|
1868
|
+
|
|
1869
|
+
MSI1010$1.default = MSI1010;
|
|
1870
|
+
|
|
1871
|
+
var MSI1110$1 = {};
|
|
1872
|
+
|
|
1873
|
+
Object.defineProperty(MSI1110$1, "__esModule", {
|
|
1874
|
+
value: true
|
|
1875
|
+
});
|
|
1876
|
+
|
|
1877
|
+
var _MSI2$1 = MSI$1;
|
|
1878
|
+
|
|
1879
|
+
var _MSI3$1 = _interopRequireDefault$c(_MSI2$1);
|
|
1880
|
+
|
|
1881
|
+
var _checksums = checksums;
|
|
1882
|
+
|
|
1883
|
+
function _interopRequireDefault$c(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1884
|
+
|
|
1885
|
+
function _classCallCheck$9(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1886
|
+
|
|
1887
|
+
function _possibleConstructorReturn$5(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1888
|
+
|
|
1889
|
+
function _inherits$5(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1890
|
+
|
|
1891
|
+
var MSI1110 = function (_MSI) {
|
|
1892
|
+
_inherits$5(MSI1110, _MSI);
|
|
1893
|
+
|
|
1894
|
+
function MSI1110(data, options) {
|
|
1895
|
+
_classCallCheck$9(this, MSI1110);
|
|
1896
|
+
|
|
1897
|
+
data += (0, _checksums.mod11)(data);
|
|
1898
|
+
data += (0, _checksums.mod10)(data);
|
|
1899
|
+
return _possibleConstructorReturn$5(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, data, options));
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
return MSI1110;
|
|
1903
|
+
}(_MSI3$1.default);
|
|
1904
|
+
|
|
1905
|
+
MSI1110$1.default = MSI1110;
|
|
1906
|
+
|
|
1907
|
+
Object.defineProperty(MSI$2, "__esModule", {
|
|
1908
|
+
value: true
|
|
1909
|
+
});
|
|
1910
|
+
MSI$2.MSI1110 = MSI$2.MSI1010 = MSI$2.MSI11 = MSI$2.MSI10 = MSI$2.MSI = undefined;
|
|
1911
|
+
|
|
1912
|
+
var _MSI$1 = MSI$1;
|
|
1913
|
+
|
|
1914
|
+
var _MSI2 = _interopRequireDefault$b(_MSI$1);
|
|
1915
|
+
|
|
1916
|
+
var _MSI3 = MSI10$1;
|
|
1917
|
+
|
|
1918
|
+
var _MSI4 = _interopRequireDefault$b(_MSI3);
|
|
1919
|
+
|
|
1920
|
+
var _MSI5 = MSI11$1;
|
|
1921
|
+
|
|
1922
|
+
var _MSI6 = _interopRequireDefault$b(_MSI5);
|
|
1923
|
+
|
|
1924
|
+
var _MSI7 = MSI1010$1;
|
|
1925
|
+
|
|
1926
|
+
var _MSI8 = _interopRequireDefault$b(_MSI7);
|
|
1927
|
+
|
|
1928
|
+
var _MSI9 = MSI1110$1;
|
|
1929
|
+
|
|
1930
|
+
var _MSI10 = _interopRequireDefault$b(_MSI9);
|
|
1931
|
+
|
|
1932
|
+
function _interopRequireDefault$b(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1933
|
+
|
|
1934
|
+
MSI$2.MSI = _MSI2.default;
|
|
1935
|
+
MSI$2.MSI10 = _MSI4.default;
|
|
1936
|
+
MSI$2.MSI11 = _MSI6.default;
|
|
1937
|
+
MSI$2.MSI1010 = _MSI8.default;
|
|
1938
|
+
MSI$2.MSI1110 = _MSI10.default;
|
|
1939
|
+
|
|
1940
|
+
var pharmacode$1 = {};
|
|
1941
|
+
|
|
1942
|
+
Object.defineProperty(pharmacode$1, "__esModule", {
|
|
1943
|
+
value: true
|
|
1944
|
+
});
|
|
1945
|
+
pharmacode$1.pharmacode = undefined;
|
|
1946
|
+
|
|
1947
|
+
var _createClass$7 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1948
|
+
|
|
1949
|
+
var _Barcode2$2 = Barcode$2;
|
|
1950
|
+
|
|
1951
|
+
var _Barcode3$2 = _interopRequireDefault$a(_Barcode2$2);
|
|
1952
|
+
|
|
1953
|
+
function _interopRequireDefault$a(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1954
|
+
|
|
1955
|
+
function _classCallCheck$8(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1956
|
+
|
|
1957
|
+
function _possibleConstructorReturn$4(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1958
|
+
|
|
1959
|
+
function _inherits$4(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation
|
|
1960
|
+
// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf
|
|
1961
|
+
|
|
1962
|
+
var pharmacode = function (_Barcode) {
|
|
1963
|
+
_inherits$4(pharmacode, _Barcode);
|
|
1964
|
+
|
|
1965
|
+
function pharmacode(data, options) {
|
|
1966
|
+
_classCallCheck$8(this, pharmacode);
|
|
1967
|
+
|
|
1968
|
+
var _this = _possibleConstructorReturn$4(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)).call(this, data, options));
|
|
1969
|
+
|
|
1970
|
+
_this.number = parseInt(data, 10);
|
|
1971
|
+
return _this;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
_createClass$7(pharmacode, [{
|
|
1975
|
+
key: "encode",
|
|
1976
|
+
value: function encode() {
|
|
1977
|
+
var z = this.number;
|
|
1978
|
+
var result = "";
|
|
1979
|
+
|
|
1980
|
+
// http://i.imgur.com/RMm4UDJ.png
|
|
1981
|
+
// (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34)
|
|
1982
|
+
while (!isNaN(z) && z != 0) {
|
|
1983
|
+
if (z % 2 === 0) {
|
|
1984
|
+
// Even
|
|
1985
|
+
result = "11100" + result;
|
|
1986
|
+
z = (z - 2) / 2;
|
|
1987
|
+
} else {
|
|
1988
|
+
// Odd
|
|
1989
|
+
result = "100" + result;
|
|
1990
|
+
z = (z - 1) / 2;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// Remove the two last zeroes
|
|
1995
|
+
result = result.slice(0, -2);
|
|
1996
|
+
|
|
1997
|
+
return {
|
|
1998
|
+
data: result,
|
|
1999
|
+
text: this.text
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
}, {
|
|
2003
|
+
key: "valid",
|
|
2004
|
+
value: function valid() {
|
|
2005
|
+
return this.number >= 3 && this.number <= 131070;
|
|
2006
|
+
}
|
|
2007
|
+
}]);
|
|
2008
|
+
|
|
2009
|
+
return pharmacode;
|
|
2010
|
+
}(_Barcode3$2.default);
|
|
2011
|
+
|
|
2012
|
+
pharmacode$1.pharmacode = pharmacode;
|
|
2013
|
+
|
|
2014
|
+
var codabar$1 = {};
|
|
2015
|
+
|
|
2016
|
+
Object.defineProperty(codabar$1, "__esModule", {
|
|
2017
|
+
value: true
|
|
2018
|
+
});
|
|
2019
|
+
codabar$1.codabar = undefined;
|
|
2020
|
+
|
|
2021
|
+
var _createClass$6 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2022
|
+
|
|
2023
|
+
var _Barcode2$1 = Barcode$2;
|
|
2024
|
+
|
|
2025
|
+
var _Barcode3$1 = _interopRequireDefault$9(_Barcode2$1);
|
|
2026
|
+
|
|
2027
|
+
function _interopRequireDefault$9(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2028
|
+
|
|
2029
|
+
function _classCallCheck$7(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2030
|
+
|
|
2031
|
+
function _possibleConstructorReturn$3(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
2032
|
+
|
|
2033
|
+
function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding specification:
|
|
2034
|
+
// http://www.barcodeisland.com/codabar.phtml
|
|
2035
|
+
|
|
2036
|
+
var codabar = function (_Barcode) {
|
|
2037
|
+
_inherits$3(codabar, _Barcode);
|
|
2038
|
+
|
|
2039
|
+
function codabar(data, options) {
|
|
2040
|
+
_classCallCheck$7(this, codabar);
|
|
2041
|
+
|
|
2042
|
+
if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) {
|
|
2043
|
+
data = "A" + data + "A";
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
var _this = _possibleConstructorReturn$3(this, (codabar.__proto__ || Object.getPrototypeOf(codabar)).call(this, data.toUpperCase(), options));
|
|
2047
|
+
|
|
2048
|
+
_this.text = _this.options.text || _this.text.replace(/[A-D]/g, '');
|
|
2049
|
+
return _this;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
_createClass$6(codabar, [{
|
|
2053
|
+
key: "valid",
|
|
2054
|
+
value: function valid() {
|
|
2055
|
+
return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1;
|
|
2056
|
+
}
|
|
2057
|
+
}, {
|
|
2058
|
+
key: "encode",
|
|
2059
|
+
value: function encode() {
|
|
2060
|
+
var result = [];
|
|
2061
|
+
var encodings = this.getEncodings();
|
|
2062
|
+
for (var i = 0; i < this.data.length; i++) {
|
|
2063
|
+
result.push(encodings[this.data.charAt(i)]);
|
|
2064
|
+
// for all characters except the last, append a narrow-space ("0")
|
|
2065
|
+
if (i !== this.data.length - 1) {
|
|
2066
|
+
result.push("0");
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
return {
|
|
2070
|
+
text: this.text,
|
|
2071
|
+
data: result.join('')
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
}, {
|
|
2075
|
+
key: "getEncodings",
|
|
2076
|
+
value: function getEncodings() {
|
|
2077
|
+
return {
|
|
2078
|
+
"0": "101010011",
|
|
2079
|
+
"1": "101011001",
|
|
2080
|
+
"2": "101001011",
|
|
2081
|
+
"3": "110010101",
|
|
2082
|
+
"4": "101101001",
|
|
2083
|
+
"5": "110101001",
|
|
2084
|
+
"6": "100101011",
|
|
2085
|
+
"7": "100101101",
|
|
2086
|
+
"8": "100110101",
|
|
2087
|
+
"9": "110100101",
|
|
2088
|
+
"-": "101001101",
|
|
2089
|
+
"$": "101100101",
|
|
2090
|
+
":": "1101011011",
|
|
2091
|
+
"/": "1101101011",
|
|
2092
|
+
".": "1101101101",
|
|
2093
|
+
"+": "1011011011",
|
|
2094
|
+
"A": "1011001001",
|
|
2095
|
+
"B": "1001001011",
|
|
2096
|
+
"C": "1010010011",
|
|
2097
|
+
"D": "1010011001"
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
}]);
|
|
2101
|
+
|
|
2102
|
+
return codabar;
|
|
2103
|
+
}(_Barcode3$1.default);
|
|
2104
|
+
|
|
2105
|
+
codabar$1.codabar = codabar;
|
|
2106
|
+
|
|
2107
|
+
var GenericBarcode$1 = {};
|
|
2108
|
+
|
|
2109
|
+
Object.defineProperty(GenericBarcode$1, "__esModule", {
|
|
2110
|
+
value: true
|
|
2111
|
+
});
|
|
2112
|
+
GenericBarcode$1.GenericBarcode = undefined;
|
|
2113
|
+
|
|
2114
|
+
var _createClass$5 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2115
|
+
|
|
2116
|
+
var _Barcode2 = Barcode$2;
|
|
2117
|
+
|
|
2118
|
+
var _Barcode3 = _interopRequireDefault$8(_Barcode2);
|
|
2119
|
+
|
|
2120
|
+
function _interopRequireDefault$8(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2121
|
+
|
|
2122
|
+
function _classCallCheck$6(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2123
|
+
|
|
2124
|
+
function _possibleConstructorReturn$2(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
2125
|
+
|
|
2126
|
+
function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
2127
|
+
|
|
2128
|
+
var GenericBarcode = function (_Barcode) {
|
|
2129
|
+
_inherits$2(GenericBarcode, _Barcode);
|
|
2130
|
+
|
|
2131
|
+
function GenericBarcode(data, options) {
|
|
2132
|
+
_classCallCheck$6(this, GenericBarcode);
|
|
2133
|
+
|
|
2134
|
+
return _possibleConstructorReturn$2(this, (GenericBarcode.__proto__ || Object.getPrototypeOf(GenericBarcode)).call(this, data, options)); // Sets this.data and this.text
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
// Return the corresponding binary numbers for the data provided
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
_createClass$5(GenericBarcode, [{
|
|
2141
|
+
key: "encode",
|
|
2142
|
+
value: function encode() {
|
|
2143
|
+
return {
|
|
2144
|
+
data: "10101010101010101010101010101010101010101",
|
|
2145
|
+
text: this.text
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
// Resturn true/false if the string provided is valid for this encoder
|
|
2150
|
+
|
|
2151
|
+
}, {
|
|
2152
|
+
key: "valid",
|
|
2153
|
+
value: function valid() {
|
|
2154
|
+
return true;
|
|
2155
|
+
}
|
|
2156
|
+
}]);
|
|
2157
|
+
|
|
2158
|
+
return GenericBarcode;
|
|
2159
|
+
}(_Barcode3.default);
|
|
2160
|
+
|
|
2161
|
+
GenericBarcode$1.GenericBarcode = GenericBarcode;
|
|
2162
|
+
|
|
2163
|
+
Object.defineProperty(barcodes, "__esModule", {
|
|
2164
|
+
value: true
|
|
2165
|
+
});
|
|
2166
|
+
|
|
2167
|
+
var _CODE = CODE39$1;
|
|
2168
|
+
|
|
2169
|
+
var _CODE2 = CODE128$2;
|
|
2170
|
+
|
|
2171
|
+
var _EAN_UPC = EAN_UPC;
|
|
2172
|
+
|
|
2173
|
+
var _ITF = ITF$2;
|
|
2174
|
+
|
|
2175
|
+
var _MSI = MSI$2;
|
|
2176
|
+
|
|
2177
|
+
var _pharmacode = pharmacode$1;
|
|
2178
|
+
|
|
2179
|
+
var _codabar = codabar$1;
|
|
2180
|
+
|
|
2181
|
+
var _GenericBarcode = GenericBarcode$1;
|
|
2182
|
+
|
|
2183
|
+
barcodes.default = {
|
|
2184
|
+
CODE39: _CODE.CODE39,
|
|
2185
|
+
CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
|
|
2186
|
+
EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE,
|
|
2187
|
+
ITF14: _ITF.ITF14,
|
|
2188
|
+
ITF: _ITF.ITF,
|
|
2189
|
+
MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
|
|
2190
|
+
pharmacode: _pharmacode.pharmacode,
|
|
2191
|
+
codabar: _codabar.codabar,
|
|
2192
|
+
GenericBarcode: _GenericBarcode.GenericBarcode
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
var merge = {};
|
|
2196
|
+
|
|
2197
|
+
Object.defineProperty(merge, "__esModule", {
|
|
2198
|
+
value: true
|
|
2199
|
+
});
|
|
2200
|
+
|
|
2201
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2202
|
+
|
|
2203
|
+
merge.default = function (old, replaceObj) {
|
|
2204
|
+
return _extends({}, old, replaceObj);
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
var linearizeEncodings$1 = {};
|
|
2208
|
+
|
|
2209
|
+
Object.defineProperty(linearizeEncodings$1, "__esModule", {
|
|
2210
|
+
value: true
|
|
2211
|
+
});
|
|
2212
|
+
linearizeEncodings$1.default = linearizeEncodings;
|
|
2213
|
+
|
|
2214
|
+
// Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2]
|
|
2215
|
+
// Convert to [1-1, 1-2, 2, 3-1, 3-2]
|
|
2216
|
+
|
|
2217
|
+
function linearizeEncodings(encodings) {
|
|
2218
|
+
var linearEncodings = [];
|
|
2219
|
+
function nextLevel(encoded) {
|
|
2220
|
+
if (Array.isArray(encoded)) {
|
|
2221
|
+
for (var i = 0; i < encoded.length; i++) {
|
|
2222
|
+
nextLevel(encoded[i]);
|
|
2223
|
+
}
|
|
2224
|
+
} else {
|
|
2225
|
+
encoded.text = encoded.text || "";
|
|
2226
|
+
encoded.data = encoded.data || "";
|
|
2227
|
+
linearEncodings.push(encoded);
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
nextLevel(encodings);
|
|
2231
|
+
|
|
2232
|
+
return linearEncodings;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
var fixOptions$1 = {};
|
|
2236
|
+
|
|
2237
|
+
Object.defineProperty(fixOptions$1, "__esModule", {
|
|
2238
|
+
value: true
|
|
2239
|
+
});
|
|
2240
|
+
fixOptions$1.default = fixOptions;
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
function fixOptions(options) {
|
|
2244
|
+
// Fix the margins
|
|
2245
|
+
options.marginTop = options.marginTop || options.margin;
|
|
2246
|
+
options.marginBottom = options.marginBottom || options.margin;
|
|
2247
|
+
options.marginRight = options.marginRight || options.margin;
|
|
2248
|
+
options.marginLeft = options.marginLeft || options.margin;
|
|
2249
|
+
|
|
2250
|
+
return options;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
var getRenderProperties$1 = {};
|
|
2254
|
+
|
|
2255
|
+
var getOptionsFromElement$1 = {};
|
|
2256
|
+
|
|
2257
|
+
var optionsFromStrings$1 = {};
|
|
2258
|
+
|
|
2259
|
+
Object.defineProperty(optionsFromStrings$1, "__esModule", {
|
|
2260
|
+
value: true
|
|
2261
|
+
});
|
|
2262
|
+
optionsFromStrings$1.default = optionsFromStrings;
|
|
2263
|
+
|
|
2264
|
+
// Convert string to integers/booleans where it should be
|
|
2265
|
+
|
|
2266
|
+
function optionsFromStrings(options) {
|
|
2267
|
+
var intOptions = ["width", "height", "textMargin", "fontSize", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight"];
|
|
2268
|
+
|
|
2269
|
+
for (var intOption in intOptions) {
|
|
2270
|
+
if (intOptions.hasOwnProperty(intOption)) {
|
|
2271
|
+
intOption = intOptions[intOption];
|
|
2272
|
+
if (typeof options[intOption] === "string") {
|
|
2273
|
+
options[intOption] = parseInt(options[intOption], 10);
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
if (typeof options["displayValue"] === "string") {
|
|
2279
|
+
options["displayValue"] = options["displayValue"] != "false";
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
return options;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
var defaults$1 = {};
|
|
2286
|
+
|
|
2287
|
+
Object.defineProperty(defaults$1, "__esModule", {
|
|
2288
|
+
value: true
|
|
2289
|
+
});
|
|
2290
|
+
var defaults = {
|
|
2291
|
+
width: 2,
|
|
2292
|
+
height: 100,
|
|
2293
|
+
format: "auto",
|
|
2294
|
+
displayValue: true,
|
|
2295
|
+
fontOptions: "",
|
|
2296
|
+
font: "monospace",
|
|
2297
|
+
text: undefined,
|
|
2298
|
+
textAlign: "center",
|
|
2299
|
+
textPosition: "bottom",
|
|
2300
|
+
textMargin: 2,
|
|
2301
|
+
fontSize: 20,
|
|
2302
|
+
background: "#ffffff",
|
|
2303
|
+
lineColor: "#000000",
|
|
2304
|
+
margin: 10,
|
|
2305
|
+
marginTop: undefined,
|
|
2306
|
+
marginBottom: undefined,
|
|
2307
|
+
marginLeft: undefined,
|
|
2308
|
+
marginRight: undefined,
|
|
2309
|
+
valid: function valid() {}
|
|
2310
|
+
};
|
|
2311
|
+
|
|
2312
|
+
defaults$1.default = defaults;
|
|
2313
|
+
|
|
2314
|
+
Object.defineProperty(getOptionsFromElement$1, "__esModule", {
|
|
2315
|
+
value: true
|
|
2316
|
+
});
|
|
2317
|
+
|
|
2318
|
+
var _optionsFromStrings$1 = optionsFromStrings$1;
|
|
2319
|
+
|
|
2320
|
+
var _optionsFromStrings2$1 = _interopRequireDefault$7(_optionsFromStrings$1);
|
|
2321
|
+
|
|
2322
|
+
var _defaults$1 = defaults$1;
|
|
2323
|
+
|
|
2324
|
+
var _defaults2$1 = _interopRequireDefault$7(_defaults$1);
|
|
2325
|
+
|
|
2326
|
+
function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2327
|
+
|
|
2328
|
+
function getOptionsFromElement(element) {
|
|
2329
|
+
var options = {};
|
|
2330
|
+
for (var property in _defaults2$1.default) {
|
|
2331
|
+
if (_defaults2$1.default.hasOwnProperty(property)) {
|
|
2332
|
+
// jsbarcode-*
|
|
2333
|
+
if (element.hasAttribute("jsbarcode-" + property.toLowerCase())) {
|
|
2334
|
+
options[property] = element.getAttribute("jsbarcode-" + property.toLowerCase());
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
// data-*
|
|
2338
|
+
if (element.hasAttribute("data-" + property.toLowerCase())) {
|
|
2339
|
+
options[property] = element.getAttribute("data-" + property.toLowerCase());
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
options["value"] = element.getAttribute("jsbarcode-value") || element.getAttribute("data-value");
|
|
2345
|
+
|
|
2346
|
+
// Since all atributes are string they need to be converted to integers
|
|
2347
|
+
options = (0, _optionsFromStrings2$1.default)(options);
|
|
2348
|
+
|
|
2349
|
+
return options;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
getOptionsFromElement$1.default = getOptionsFromElement;
|
|
2353
|
+
|
|
2354
|
+
var renderers = {};
|
|
2355
|
+
|
|
2356
|
+
var canvas = {};
|
|
2357
|
+
|
|
2358
|
+
var shared = {};
|
|
2359
|
+
|
|
2360
|
+
Object.defineProperty(shared, "__esModule", {
|
|
2361
|
+
value: true
|
|
2362
|
+
});
|
|
2363
|
+
shared.getTotalWidthOfEncodings = shared.calculateEncodingAttributes = shared.getBarcodePadding = shared.getEncodingHeight = shared.getMaximumHeightOfEncodings = undefined;
|
|
2364
|
+
|
|
2365
|
+
var _merge$3 = merge;
|
|
2366
|
+
|
|
2367
|
+
var _merge2$3 = _interopRequireDefault$6(_merge$3);
|
|
2368
|
+
|
|
2369
|
+
function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2370
|
+
|
|
2371
|
+
function getEncodingHeight(encoding, options) {
|
|
2372
|
+
return options.height + (options.displayValue && encoding.text.length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
function getBarcodePadding(textWidth, barcodeWidth, options) {
|
|
2376
|
+
if (options.displayValue && barcodeWidth < textWidth) {
|
|
2377
|
+
if (options.textAlign == "center") {
|
|
2378
|
+
return Math.floor((textWidth - barcodeWidth) / 2);
|
|
2379
|
+
} else if (options.textAlign == "left") {
|
|
2380
|
+
return 0;
|
|
2381
|
+
} else if (options.textAlign == "right") {
|
|
2382
|
+
return Math.floor(textWidth - barcodeWidth);
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
return 0;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
function calculateEncodingAttributes(encodings, barcodeOptions, context) {
|
|
2389
|
+
for (var i = 0; i < encodings.length; i++) {
|
|
2390
|
+
var encoding = encodings[i];
|
|
2391
|
+
var options = (0, _merge2$3.default)(barcodeOptions, encoding.options);
|
|
2392
|
+
|
|
2393
|
+
// Calculate the width of the encoding
|
|
2394
|
+
var textWidth;
|
|
2395
|
+
if (options.displayValue) {
|
|
2396
|
+
textWidth = messureText(encoding.text, options, context);
|
|
2397
|
+
} else {
|
|
2398
|
+
textWidth = 0;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
var barcodeWidth = encoding.data.length * options.width;
|
|
2402
|
+
encoding.width = Math.ceil(Math.max(textWidth, barcodeWidth));
|
|
2403
|
+
|
|
2404
|
+
encoding.height = getEncodingHeight(encoding, options);
|
|
2405
|
+
|
|
2406
|
+
encoding.barcodePadding = getBarcodePadding(textWidth, barcodeWidth, options);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
function getTotalWidthOfEncodings(encodings) {
|
|
2411
|
+
var totalWidth = 0;
|
|
2412
|
+
for (var i = 0; i < encodings.length; i++) {
|
|
2413
|
+
totalWidth += encodings[i].width;
|
|
2414
|
+
}
|
|
2415
|
+
return totalWidth;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
function getMaximumHeightOfEncodings(encodings) {
|
|
2419
|
+
var maxHeight = 0;
|
|
2420
|
+
for (var i = 0; i < encodings.length; i++) {
|
|
2421
|
+
if (encodings[i].height > maxHeight) {
|
|
2422
|
+
maxHeight = encodings[i].height;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
return maxHeight;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
function messureText(string, options, context) {
|
|
2429
|
+
var ctx;
|
|
2430
|
+
|
|
2431
|
+
if (context) {
|
|
2432
|
+
ctx = context;
|
|
2433
|
+
} else if (typeof document !== "undefined") {
|
|
2434
|
+
ctx = document.createElement("canvas").getContext("2d");
|
|
2435
|
+
} else {
|
|
2436
|
+
// If the text cannot be messured we will return 0.
|
|
2437
|
+
// This will make some barcode with big text render incorrectly
|
|
2438
|
+
return 0;
|
|
2439
|
+
}
|
|
2440
|
+
ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font;
|
|
2441
|
+
|
|
2442
|
+
// Calculate the width of the encoding
|
|
2443
|
+
var measureTextResult = ctx.measureText(string);
|
|
2444
|
+
if (!measureTextResult) {
|
|
2445
|
+
// Some implementations don't implement measureText and return undefined.
|
|
2446
|
+
// If the text cannot be measured we will return 0.
|
|
2447
|
+
// This will make some barcode with big text render incorrectly
|
|
2448
|
+
return 0;
|
|
2449
|
+
}
|
|
2450
|
+
var size = measureTextResult.width;
|
|
2451
|
+
return size;
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
shared.getMaximumHeightOfEncodings = getMaximumHeightOfEncodings;
|
|
2455
|
+
shared.getEncodingHeight = getEncodingHeight;
|
|
2456
|
+
shared.getBarcodePadding = getBarcodePadding;
|
|
2457
|
+
shared.calculateEncodingAttributes = calculateEncodingAttributes;
|
|
2458
|
+
shared.getTotalWidthOfEncodings = getTotalWidthOfEncodings;
|
|
2459
|
+
|
|
2460
|
+
Object.defineProperty(canvas, "__esModule", {
|
|
2461
|
+
value: true
|
|
2462
|
+
});
|
|
2463
|
+
|
|
2464
|
+
var _createClass$4 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2465
|
+
|
|
2466
|
+
var _merge$2 = merge;
|
|
2467
|
+
|
|
2468
|
+
var _merge2$2 = _interopRequireDefault$5(_merge$2);
|
|
2469
|
+
|
|
2470
|
+
var _shared$1 = shared;
|
|
2471
|
+
|
|
2472
|
+
function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2473
|
+
|
|
2474
|
+
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2475
|
+
|
|
2476
|
+
var CanvasRenderer = function () {
|
|
2477
|
+
function CanvasRenderer(canvas, encodings, options) {
|
|
2478
|
+
_classCallCheck$5(this, CanvasRenderer);
|
|
2479
|
+
|
|
2480
|
+
this.canvas = canvas;
|
|
2481
|
+
this.encodings = encodings;
|
|
2482
|
+
this.options = options;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
_createClass$4(CanvasRenderer, [{
|
|
2486
|
+
key: "render",
|
|
2487
|
+
value: function render() {
|
|
2488
|
+
// Abort if the browser does not support HTML5 canvas
|
|
2489
|
+
if (!this.canvas.getContext) {
|
|
2490
|
+
throw new Error('The browser does not support canvas.');
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
this.prepareCanvas();
|
|
2494
|
+
for (var i = 0; i < this.encodings.length; i++) {
|
|
2495
|
+
var encodingOptions = (0, _merge2$2.default)(this.options, this.encodings[i].options);
|
|
2496
|
+
|
|
2497
|
+
this.drawCanvasBarcode(encodingOptions, this.encodings[i]);
|
|
2498
|
+
this.drawCanvasText(encodingOptions, this.encodings[i]);
|
|
2499
|
+
|
|
2500
|
+
this.moveCanvasDrawing(this.encodings[i]);
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
this.restoreCanvas();
|
|
2504
|
+
}
|
|
2505
|
+
}, {
|
|
2506
|
+
key: "prepareCanvas",
|
|
2507
|
+
value: function prepareCanvas() {
|
|
2508
|
+
// Get the canvas context
|
|
2509
|
+
var ctx = this.canvas.getContext("2d");
|
|
2510
|
+
|
|
2511
|
+
ctx.save();
|
|
2512
|
+
|
|
2513
|
+
(0, _shared$1.calculateEncodingAttributes)(this.encodings, this.options, ctx);
|
|
2514
|
+
var totalWidth = (0, _shared$1.getTotalWidthOfEncodings)(this.encodings);
|
|
2515
|
+
var maxHeight = (0, _shared$1.getMaximumHeightOfEncodings)(this.encodings);
|
|
2516
|
+
|
|
2517
|
+
this.canvas.width = totalWidth + this.options.marginLeft + this.options.marginRight;
|
|
2518
|
+
|
|
2519
|
+
this.canvas.height = maxHeight;
|
|
2520
|
+
|
|
2521
|
+
// Paint the canvas
|
|
2522
|
+
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2523
|
+
if (this.options.background) {
|
|
2524
|
+
ctx.fillStyle = this.options.background;
|
|
2525
|
+
ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
ctx.translate(this.options.marginLeft, 0);
|
|
2529
|
+
}
|
|
2530
|
+
}, {
|
|
2531
|
+
key: "drawCanvasBarcode",
|
|
2532
|
+
value: function drawCanvasBarcode(options, encoding) {
|
|
2533
|
+
// Get the canvas context
|
|
2534
|
+
var ctx = this.canvas.getContext("2d");
|
|
2535
|
+
|
|
2536
|
+
var binary = encoding.data;
|
|
2537
|
+
|
|
2538
|
+
// Creates the barcode out of the encoded binary
|
|
2539
|
+
var yFrom;
|
|
2540
|
+
if (options.textPosition == "top") {
|
|
2541
|
+
yFrom = options.marginTop + options.fontSize + options.textMargin;
|
|
2542
|
+
} else {
|
|
2543
|
+
yFrom = options.marginTop;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
ctx.fillStyle = options.lineColor;
|
|
2547
|
+
|
|
2548
|
+
for (var b = 0; b < binary.length; b++) {
|
|
2549
|
+
var x = b * options.width + encoding.barcodePadding;
|
|
2550
|
+
|
|
2551
|
+
if (binary[b] === "1") {
|
|
2552
|
+
ctx.fillRect(x, yFrom, options.width, options.height);
|
|
2553
|
+
} else if (binary[b]) {
|
|
2554
|
+
ctx.fillRect(x, yFrom, options.width, options.height * binary[b]);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
}, {
|
|
2559
|
+
key: "drawCanvasText",
|
|
2560
|
+
value: function drawCanvasText(options, encoding) {
|
|
2561
|
+
// Get the canvas context
|
|
2562
|
+
var ctx = this.canvas.getContext("2d");
|
|
2563
|
+
|
|
2564
|
+
var font = options.fontOptions + " " + options.fontSize + "px " + options.font;
|
|
2565
|
+
|
|
2566
|
+
// Draw the text if displayValue is set
|
|
2567
|
+
if (options.displayValue) {
|
|
2568
|
+
var x, y;
|
|
2569
|
+
|
|
2570
|
+
if (options.textPosition == "top") {
|
|
2571
|
+
y = options.marginTop + options.fontSize - options.textMargin;
|
|
2572
|
+
} else {
|
|
2573
|
+
y = options.height + options.textMargin + options.marginTop + options.fontSize;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
ctx.font = font;
|
|
2577
|
+
|
|
2578
|
+
// Draw the text in the correct X depending on the textAlign option
|
|
2579
|
+
if (options.textAlign == "left" || encoding.barcodePadding > 0) {
|
|
2580
|
+
x = 0;
|
|
2581
|
+
ctx.textAlign = 'left';
|
|
2582
|
+
} else if (options.textAlign == "right") {
|
|
2583
|
+
x = encoding.width - 1;
|
|
2584
|
+
ctx.textAlign = 'right';
|
|
2585
|
+
}
|
|
2586
|
+
// In all other cases, center the text
|
|
2587
|
+
else {
|
|
2588
|
+
x = encoding.width / 2;
|
|
2589
|
+
ctx.textAlign = 'center';
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
ctx.fillText(encoding.text, x, y);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
}, {
|
|
2596
|
+
key: "moveCanvasDrawing",
|
|
2597
|
+
value: function moveCanvasDrawing(encoding) {
|
|
2598
|
+
var ctx = this.canvas.getContext("2d");
|
|
2599
|
+
|
|
2600
|
+
ctx.translate(encoding.width, 0);
|
|
2601
|
+
}
|
|
2602
|
+
}, {
|
|
2603
|
+
key: "restoreCanvas",
|
|
2604
|
+
value: function restoreCanvas() {
|
|
2605
|
+
// Get the canvas context
|
|
2606
|
+
var ctx = this.canvas.getContext("2d");
|
|
2607
|
+
|
|
2608
|
+
ctx.restore();
|
|
2609
|
+
}
|
|
2610
|
+
}]);
|
|
2611
|
+
|
|
2612
|
+
return CanvasRenderer;
|
|
2613
|
+
}();
|
|
2614
|
+
|
|
2615
|
+
canvas.default = CanvasRenderer;
|
|
2616
|
+
|
|
2617
|
+
var svg = {};
|
|
2618
|
+
|
|
2619
|
+
Object.defineProperty(svg, "__esModule", {
|
|
2620
|
+
value: true
|
|
2621
|
+
});
|
|
2622
|
+
|
|
2623
|
+
var _createClass$3 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2624
|
+
|
|
2625
|
+
var _merge$1 = merge;
|
|
2626
|
+
|
|
2627
|
+
var _merge2$1 = _interopRequireDefault$4(_merge$1);
|
|
2628
|
+
|
|
2629
|
+
var _shared = shared;
|
|
2630
|
+
|
|
2631
|
+
function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2632
|
+
|
|
2633
|
+
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2634
|
+
|
|
2635
|
+
var svgns = "http://www.w3.org/2000/svg";
|
|
2636
|
+
|
|
2637
|
+
var SVGRenderer = function () {
|
|
2638
|
+
function SVGRenderer(svg, encodings, options) {
|
|
2639
|
+
_classCallCheck$4(this, SVGRenderer);
|
|
2640
|
+
|
|
2641
|
+
this.svg = svg;
|
|
2642
|
+
this.encodings = encodings;
|
|
2643
|
+
this.options = options;
|
|
2644
|
+
this.document = options.xmlDocument || document;
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
_createClass$3(SVGRenderer, [{
|
|
2648
|
+
key: "render",
|
|
2649
|
+
value: function render() {
|
|
2650
|
+
var currentX = this.options.marginLeft;
|
|
2651
|
+
|
|
2652
|
+
this.prepareSVG();
|
|
2653
|
+
for (var i = 0; i < this.encodings.length; i++) {
|
|
2654
|
+
var encoding = this.encodings[i];
|
|
2655
|
+
var encodingOptions = (0, _merge2$1.default)(this.options, encoding.options);
|
|
2656
|
+
|
|
2657
|
+
var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg);
|
|
2658
|
+
|
|
2659
|
+
this.setGroupOptions(group, encodingOptions);
|
|
2660
|
+
|
|
2661
|
+
this.drawSvgBarcode(group, encodingOptions, encoding);
|
|
2662
|
+
this.drawSVGText(group, encodingOptions, encoding);
|
|
2663
|
+
|
|
2664
|
+
currentX += encoding.width;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}, {
|
|
2668
|
+
key: "prepareSVG",
|
|
2669
|
+
value: function prepareSVG() {
|
|
2670
|
+
// Clear the SVG
|
|
2671
|
+
while (this.svg.firstChild) {
|
|
2672
|
+
this.svg.removeChild(this.svg.firstChild);
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
(0, _shared.calculateEncodingAttributes)(this.encodings, this.options);
|
|
2676
|
+
var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings);
|
|
2677
|
+
var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings);
|
|
2678
|
+
|
|
2679
|
+
var width = totalWidth + this.options.marginLeft + this.options.marginRight;
|
|
2680
|
+
this.setSvgAttributes(width, maxHeight);
|
|
2681
|
+
|
|
2682
|
+
if (this.options.background) {
|
|
2683
|
+
this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute("style", "fill:" + this.options.background + ";");
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
}, {
|
|
2687
|
+
key: "drawSvgBarcode",
|
|
2688
|
+
value: function drawSvgBarcode(parent, options, encoding) {
|
|
2689
|
+
var binary = encoding.data;
|
|
2690
|
+
|
|
2691
|
+
// Creates the barcode out of the encoded binary
|
|
2692
|
+
var yFrom;
|
|
2693
|
+
if (options.textPosition == "top") {
|
|
2694
|
+
yFrom = options.fontSize + options.textMargin;
|
|
2695
|
+
} else {
|
|
2696
|
+
yFrom = 0;
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
var barWidth = 0;
|
|
2700
|
+
var x = 0;
|
|
2701
|
+
for (var b = 0; b < binary.length; b++) {
|
|
2702
|
+
x = b * options.width + encoding.barcodePadding;
|
|
2703
|
+
|
|
2704
|
+
if (binary[b] === "1") {
|
|
2705
|
+
barWidth++;
|
|
2706
|
+
} else if (barWidth > 0) {
|
|
2707
|
+
this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent);
|
|
2708
|
+
barWidth = 0;
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
// Last draw is needed since the barcode ends with 1
|
|
2713
|
+
if (barWidth > 0) {
|
|
2714
|
+
this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent);
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
}, {
|
|
2718
|
+
key: "drawSVGText",
|
|
2719
|
+
value: function drawSVGText(parent, options, encoding) {
|
|
2720
|
+
var textElem = this.document.createElementNS(svgns, 'text');
|
|
2721
|
+
|
|
2722
|
+
// Draw the text if displayValue is set
|
|
2723
|
+
if (options.displayValue) {
|
|
2724
|
+
var x, y;
|
|
2725
|
+
|
|
2726
|
+
textElem.setAttribute("style", "font:" + options.fontOptions + " " + options.fontSize + "px " + options.font);
|
|
2727
|
+
|
|
2728
|
+
if (options.textPosition == "top") {
|
|
2729
|
+
y = options.fontSize - options.textMargin;
|
|
2730
|
+
} else {
|
|
2731
|
+
y = options.height + options.textMargin + options.fontSize;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
// Draw the text in the correct X depending on the textAlign option
|
|
2735
|
+
if (options.textAlign == "left" || encoding.barcodePadding > 0) {
|
|
2736
|
+
x = 0;
|
|
2737
|
+
textElem.setAttribute("text-anchor", "start");
|
|
2738
|
+
} else if (options.textAlign == "right") {
|
|
2739
|
+
x = encoding.width - 1;
|
|
2740
|
+
textElem.setAttribute("text-anchor", "end");
|
|
2741
|
+
}
|
|
2742
|
+
// In all other cases, center the text
|
|
2743
|
+
else {
|
|
2744
|
+
x = encoding.width / 2;
|
|
2745
|
+
textElem.setAttribute("text-anchor", "middle");
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
textElem.setAttribute("x", x);
|
|
2749
|
+
textElem.setAttribute("y", y);
|
|
2750
|
+
|
|
2751
|
+
textElem.appendChild(this.document.createTextNode(encoding.text));
|
|
2752
|
+
|
|
2753
|
+
parent.appendChild(textElem);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
}, {
|
|
2757
|
+
key: "setSvgAttributes",
|
|
2758
|
+
value: function setSvgAttributes(width, height) {
|
|
2759
|
+
var svg = this.svg;
|
|
2760
|
+
svg.setAttribute("width", width + "px");
|
|
2761
|
+
svg.setAttribute("height", height + "px");
|
|
2762
|
+
svg.setAttribute("x", "0px");
|
|
2763
|
+
svg.setAttribute("y", "0px");
|
|
2764
|
+
svg.setAttribute("viewBox", "0 0 " + width + " " + height);
|
|
2765
|
+
|
|
2766
|
+
svg.setAttribute("xmlns", svgns);
|
|
2767
|
+
svg.setAttribute("version", "1.1");
|
|
2768
|
+
|
|
2769
|
+
svg.setAttribute("style", "transform: translate(0,0)");
|
|
2770
|
+
}
|
|
2771
|
+
}, {
|
|
2772
|
+
key: "createGroup",
|
|
2773
|
+
value: function createGroup(x, y, parent) {
|
|
2774
|
+
var group = this.document.createElementNS(svgns, 'g');
|
|
2775
|
+
group.setAttribute("transform", "translate(" + x + ", " + y + ")");
|
|
2776
|
+
|
|
2777
|
+
parent.appendChild(group);
|
|
2778
|
+
|
|
2779
|
+
return group;
|
|
2780
|
+
}
|
|
2781
|
+
}, {
|
|
2782
|
+
key: "setGroupOptions",
|
|
2783
|
+
value: function setGroupOptions(group, options) {
|
|
2784
|
+
group.setAttribute("style", "fill:" + options.lineColor + ";");
|
|
2785
|
+
}
|
|
2786
|
+
}, {
|
|
2787
|
+
key: "drawRect",
|
|
2788
|
+
value: function drawRect(x, y, width, height, parent) {
|
|
2789
|
+
var rect = this.document.createElementNS(svgns, 'rect');
|
|
2790
|
+
|
|
2791
|
+
rect.setAttribute("x", x);
|
|
2792
|
+
rect.setAttribute("y", y);
|
|
2793
|
+
rect.setAttribute("width", width);
|
|
2794
|
+
rect.setAttribute("height", height);
|
|
2795
|
+
|
|
2796
|
+
parent.appendChild(rect);
|
|
2797
|
+
|
|
2798
|
+
return rect;
|
|
2799
|
+
}
|
|
2800
|
+
}]);
|
|
2801
|
+
|
|
2802
|
+
return SVGRenderer;
|
|
2803
|
+
}();
|
|
2804
|
+
|
|
2805
|
+
svg.default = SVGRenderer;
|
|
2806
|
+
|
|
2807
|
+
var object = {};
|
|
2808
|
+
|
|
2809
|
+
Object.defineProperty(object, "__esModule", {
|
|
2810
|
+
value: true
|
|
2811
|
+
});
|
|
2812
|
+
|
|
2813
|
+
var _createClass$2 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2814
|
+
|
|
2815
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2816
|
+
|
|
2817
|
+
var ObjectRenderer = function () {
|
|
2818
|
+
function ObjectRenderer(object, encodings, options) {
|
|
2819
|
+
_classCallCheck$3(this, ObjectRenderer);
|
|
2820
|
+
|
|
2821
|
+
this.object = object;
|
|
2822
|
+
this.encodings = encodings;
|
|
2823
|
+
this.options = options;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
_createClass$2(ObjectRenderer, [{
|
|
2827
|
+
key: "render",
|
|
2828
|
+
value: function render() {
|
|
2829
|
+
this.object.encodings = this.encodings;
|
|
2830
|
+
}
|
|
2831
|
+
}]);
|
|
2832
|
+
|
|
2833
|
+
return ObjectRenderer;
|
|
2834
|
+
}();
|
|
2835
|
+
|
|
2836
|
+
object.default = ObjectRenderer;
|
|
2837
|
+
|
|
2838
|
+
Object.defineProperty(renderers, "__esModule", {
|
|
2839
|
+
value: true
|
|
2840
|
+
});
|
|
2841
|
+
|
|
2842
|
+
var _canvas = canvas;
|
|
2843
|
+
|
|
2844
|
+
var _canvas2 = _interopRequireDefault$3(_canvas);
|
|
2845
|
+
|
|
2846
|
+
var _svg = svg;
|
|
2847
|
+
|
|
2848
|
+
var _svg2 = _interopRequireDefault$3(_svg);
|
|
2849
|
+
|
|
2850
|
+
var _object = object;
|
|
2851
|
+
|
|
2852
|
+
var _object2 = _interopRequireDefault$3(_object);
|
|
2853
|
+
|
|
2854
|
+
function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2855
|
+
|
|
2856
|
+
renderers.default = { CanvasRenderer: _canvas2.default, SVGRenderer: _svg2.default, ObjectRenderer: _object2.default };
|
|
2857
|
+
|
|
2858
|
+
var exceptions = {};
|
|
2859
|
+
|
|
2860
|
+
Object.defineProperty(exceptions, "__esModule", {
|
|
2861
|
+
value: true
|
|
2862
|
+
});
|
|
2863
|
+
|
|
2864
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2865
|
+
|
|
2866
|
+
function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
2867
|
+
|
|
2868
|
+
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
2869
|
+
|
|
2870
|
+
var InvalidInputException = function (_Error) {
|
|
2871
|
+
_inherits$1(InvalidInputException, _Error);
|
|
2872
|
+
|
|
2873
|
+
function InvalidInputException(symbology, input) {
|
|
2874
|
+
_classCallCheck$2(this, InvalidInputException);
|
|
2875
|
+
|
|
2876
|
+
var _this = _possibleConstructorReturn$1(this, (InvalidInputException.__proto__ || Object.getPrototypeOf(InvalidInputException)).call(this));
|
|
2877
|
+
|
|
2878
|
+
_this.name = "InvalidInputException";
|
|
2879
|
+
|
|
2880
|
+
_this.symbology = symbology;
|
|
2881
|
+
_this.input = input;
|
|
2882
|
+
|
|
2883
|
+
_this.message = '"' + _this.input + '" is not a valid input for ' + _this.symbology;
|
|
2884
|
+
return _this;
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
return InvalidInputException;
|
|
2888
|
+
}(Error);
|
|
2889
|
+
|
|
2890
|
+
var InvalidElementException = function (_Error2) {
|
|
2891
|
+
_inherits$1(InvalidElementException, _Error2);
|
|
2892
|
+
|
|
2893
|
+
function InvalidElementException() {
|
|
2894
|
+
_classCallCheck$2(this, InvalidElementException);
|
|
2895
|
+
|
|
2896
|
+
var _this2 = _possibleConstructorReturn$1(this, (InvalidElementException.__proto__ || Object.getPrototypeOf(InvalidElementException)).call(this));
|
|
2897
|
+
|
|
2898
|
+
_this2.name = "InvalidElementException";
|
|
2899
|
+
_this2.message = "Not supported type to render on";
|
|
2900
|
+
return _this2;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
return InvalidElementException;
|
|
2904
|
+
}(Error);
|
|
2905
|
+
|
|
2906
|
+
var NoElementException = function (_Error3) {
|
|
2907
|
+
_inherits$1(NoElementException, _Error3);
|
|
2908
|
+
|
|
2909
|
+
function NoElementException() {
|
|
2910
|
+
_classCallCheck$2(this, NoElementException);
|
|
2911
|
+
|
|
2912
|
+
var _this3 = _possibleConstructorReturn$1(this, (NoElementException.__proto__ || Object.getPrototypeOf(NoElementException)).call(this));
|
|
2913
|
+
|
|
2914
|
+
_this3.name = "NoElementException";
|
|
2915
|
+
_this3.message = "No element to render on.";
|
|
2916
|
+
return _this3;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
return NoElementException;
|
|
2920
|
+
}(Error);
|
|
2921
|
+
|
|
2922
|
+
exceptions.InvalidInputException = InvalidInputException;
|
|
2923
|
+
exceptions.InvalidElementException = InvalidElementException;
|
|
2924
|
+
exceptions.NoElementException = NoElementException;
|
|
2925
|
+
|
|
2926
|
+
Object.defineProperty(getRenderProperties$1, "__esModule", {
|
|
2927
|
+
value: true
|
|
2928
|
+
});
|
|
2929
|
+
|
|
2930
|
+
var _typeof$1 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* global HTMLImageElement */
|
|
2931
|
+
/* global HTMLCanvasElement */
|
|
2932
|
+
/* global SVGElement */
|
|
2933
|
+
|
|
2934
|
+
var _getOptionsFromElement = getOptionsFromElement$1;
|
|
2935
|
+
|
|
2936
|
+
var _getOptionsFromElement2 = _interopRequireDefault$2(_getOptionsFromElement);
|
|
2937
|
+
|
|
2938
|
+
var _renderers = renderers;
|
|
2939
|
+
|
|
2940
|
+
var _renderers2 = _interopRequireDefault$2(_renderers);
|
|
2941
|
+
|
|
2942
|
+
var _exceptions$1 = exceptions;
|
|
2943
|
+
|
|
2944
|
+
function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2945
|
+
|
|
2946
|
+
// Takes an element and returns an object with information about how
|
|
2947
|
+
// it should be rendered
|
|
2948
|
+
// This could also return an array with these objects
|
|
2949
|
+
// {
|
|
2950
|
+
// element: The element that the renderer should draw on
|
|
2951
|
+
// renderer: The name of the renderer
|
|
2952
|
+
// afterRender (optional): If something has to done after the renderer
|
|
2953
|
+
// completed, calls afterRender (function)
|
|
2954
|
+
// options (optional): Options that can be defined in the element
|
|
2955
|
+
// }
|
|
2956
|
+
|
|
2957
|
+
function getRenderProperties(element) {
|
|
2958
|
+
// If the element is a string, query select call again
|
|
2959
|
+
if (typeof element === "string") {
|
|
2960
|
+
return querySelectedRenderProperties(element);
|
|
2961
|
+
}
|
|
2962
|
+
// If element is array. Recursivly call with every object in the array
|
|
2963
|
+
else if (Array.isArray(element)) {
|
|
2964
|
+
var returnArray = [];
|
|
2965
|
+
for (var i = 0; i < element.length; i++) {
|
|
2966
|
+
returnArray.push(getRenderProperties(element[i]));
|
|
2967
|
+
}
|
|
2968
|
+
return returnArray;
|
|
2969
|
+
}
|
|
2970
|
+
// If element, render on canvas and set the uri as src
|
|
2971
|
+
else if (typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLImageElement) {
|
|
2972
|
+
return newCanvasRenderProperties(element);
|
|
2973
|
+
}
|
|
2974
|
+
// If SVG
|
|
2975
|
+
else if (element && element.nodeName && element.nodeName.toLowerCase() === 'svg' || typeof SVGElement !== 'undefined' && element instanceof SVGElement) {
|
|
2976
|
+
return {
|
|
2977
|
+
element: element,
|
|
2978
|
+
options: (0, _getOptionsFromElement2.default)(element),
|
|
2979
|
+
renderer: _renderers2.default.SVGRenderer
|
|
2980
|
+
};
|
|
2981
|
+
}
|
|
2982
|
+
// If canvas (in browser)
|
|
2983
|
+
else if (typeof HTMLCanvasElement !== 'undefined' && element instanceof HTMLCanvasElement) {
|
|
2984
|
+
return {
|
|
2985
|
+
element: element,
|
|
2986
|
+
options: (0, _getOptionsFromElement2.default)(element),
|
|
2987
|
+
renderer: _renderers2.default.CanvasRenderer
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
// If canvas (in node)
|
|
2991
|
+
else if (element && element.getContext) {
|
|
2992
|
+
return {
|
|
2993
|
+
element: element,
|
|
2994
|
+
renderer: _renderers2.default.CanvasRenderer
|
|
2995
|
+
};
|
|
2996
|
+
} else if (element && (typeof element === "undefined" ? "undefined" : _typeof$1(element)) === 'object' && !element.nodeName) {
|
|
2997
|
+
return {
|
|
2998
|
+
element: element,
|
|
2999
|
+
renderer: _renderers2.default.ObjectRenderer
|
|
3000
|
+
};
|
|
3001
|
+
} else {
|
|
3002
|
+
throw new _exceptions$1.InvalidElementException();
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
function querySelectedRenderProperties(string) {
|
|
3007
|
+
var selector = document.querySelectorAll(string);
|
|
3008
|
+
if (selector.length === 0) {
|
|
3009
|
+
return undefined;
|
|
3010
|
+
} else {
|
|
3011
|
+
var returnArray = [];
|
|
3012
|
+
for (var i = 0; i < selector.length; i++) {
|
|
3013
|
+
returnArray.push(getRenderProperties(selector[i]));
|
|
3014
|
+
}
|
|
3015
|
+
return returnArray;
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
function newCanvasRenderProperties(imgElement) {
|
|
3020
|
+
var canvas = document.createElement('canvas');
|
|
3021
|
+
return {
|
|
3022
|
+
element: canvas,
|
|
3023
|
+
options: (0, _getOptionsFromElement2.default)(imgElement),
|
|
3024
|
+
renderer: _renderers2.default.CanvasRenderer,
|
|
3025
|
+
afterRender: function afterRender() {
|
|
3026
|
+
imgElement.setAttribute("src", canvas.toDataURL());
|
|
3027
|
+
}
|
|
3028
|
+
};
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
getRenderProperties$1.default = getRenderProperties;
|
|
3032
|
+
|
|
3033
|
+
var ErrorHandler$1 = {};
|
|
3034
|
+
|
|
3035
|
+
Object.defineProperty(ErrorHandler$1, "__esModule", {
|
|
3036
|
+
value: true
|
|
3037
|
+
});
|
|
3038
|
+
|
|
3039
|
+
var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
3040
|
+
|
|
3041
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3042
|
+
|
|
3043
|
+
/*eslint no-console: 0 */
|
|
3044
|
+
|
|
3045
|
+
var ErrorHandler = function () {
|
|
3046
|
+
function ErrorHandler(api) {
|
|
3047
|
+
_classCallCheck$1(this, ErrorHandler);
|
|
3048
|
+
|
|
3049
|
+
this.api = api;
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
_createClass$1(ErrorHandler, [{
|
|
3053
|
+
key: "handleCatch",
|
|
3054
|
+
value: function handleCatch(e) {
|
|
3055
|
+
// If babel supported extending of Error in a correct way instanceof would be used here
|
|
3056
|
+
if (e.name === "InvalidInputException") {
|
|
3057
|
+
if (this.api._options.valid !== this.api._defaults.valid) {
|
|
3058
|
+
this.api._options.valid(false);
|
|
3059
|
+
} else {
|
|
3060
|
+
throw e.message;
|
|
3061
|
+
}
|
|
3062
|
+
} else {
|
|
3063
|
+
throw e;
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
this.api.render = function () {};
|
|
3067
|
+
}
|
|
3068
|
+
}, {
|
|
3069
|
+
key: "wrapBarcodeCall",
|
|
3070
|
+
value: function wrapBarcodeCall(func) {
|
|
3071
|
+
try {
|
|
3072
|
+
var result = func.apply(undefined, arguments);
|
|
3073
|
+
this.api._options.valid(true);
|
|
3074
|
+
return result;
|
|
3075
|
+
} catch (e) {
|
|
3076
|
+
this.handleCatch(e);
|
|
3077
|
+
|
|
3078
|
+
return this.api;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
}]);
|
|
3082
|
+
|
|
3083
|
+
return ErrorHandler;
|
|
3084
|
+
}();
|
|
3085
|
+
|
|
3086
|
+
ErrorHandler$1.default = ErrorHandler;
|
|
3087
|
+
|
|
3088
|
+
var _barcodes = barcodes;
|
|
3089
|
+
|
|
3090
|
+
var _barcodes2 = _interopRequireDefault$1(_barcodes);
|
|
3091
|
+
|
|
3092
|
+
var _merge = merge;
|
|
3093
|
+
|
|
3094
|
+
var _merge2 = _interopRequireDefault$1(_merge);
|
|
3095
|
+
|
|
3096
|
+
var _linearizeEncodings = linearizeEncodings$1;
|
|
3097
|
+
|
|
3098
|
+
var _linearizeEncodings2 = _interopRequireDefault$1(_linearizeEncodings);
|
|
3099
|
+
|
|
3100
|
+
var _fixOptions = fixOptions$1;
|
|
3101
|
+
|
|
3102
|
+
var _fixOptions2 = _interopRequireDefault$1(_fixOptions);
|
|
3103
|
+
|
|
3104
|
+
var _getRenderProperties = getRenderProperties$1;
|
|
3105
|
+
|
|
3106
|
+
var _getRenderProperties2 = _interopRequireDefault$1(_getRenderProperties);
|
|
3107
|
+
|
|
3108
|
+
var _optionsFromStrings = optionsFromStrings$1;
|
|
3109
|
+
|
|
3110
|
+
var _optionsFromStrings2 = _interopRequireDefault$1(_optionsFromStrings);
|
|
3111
|
+
|
|
3112
|
+
var _ErrorHandler = ErrorHandler$1;
|
|
3113
|
+
|
|
3114
|
+
var _ErrorHandler2 = _interopRequireDefault$1(_ErrorHandler);
|
|
3115
|
+
|
|
3116
|
+
var _exceptions = exceptions;
|
|
3117
|
+
|
|
3118
|
+
var _defaults = defaults$1;
|
|
3119
|
+
|
|
3120
|
+
var _defaults2 = _interopRequireDefault$1(_defaults);
|
|
3121
|
+
|
|
3122
|
+
function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3123
|
+
|
|
3124
|
+
// The protype of the object returned from the JsBarcode() call
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
// Help functions
|
|
3128
|
+
var API = function API() {};
|
|
3129
|
+
|
|
3130
|
+
// The first call of the library API
|
|
3131
|
+
// Will return an object with all barcodes calls and the data that is used
|
|
3132
|
+
// by the renderers
|
|
3133
|
+
|
|
3134
|
+
|
|
3135
|
+
// Default values
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
// Exceptions
|
|
3139
|
+
// Import all the barcodes
|
|
3140
|
+
var JsBarcode = function JsBarcode(element, text, options) {
|
|
3141
|
+
var api = new API();
|
|
3142
|
+
|
|
3143
|
+
if (typeof element === "undefined") {
|
|
3144
|
+
throw Error("No element to render on was provided.");
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
// Variables that will be pased through the API calls
|
|
3148
|
+
api._renderProperties = (0, _getRenderProperties2.default)(element);
|
|
3149
|
+
api._encodings = [];
|
|
3150
|
+
api._options = _defaults2.default;
|
|
3151
|
+
api._errorHandler = new _ErrorHandler2.default(api);
|
|
3152
|
+
|
|
3153
|
+
// If text is set, use the simple syntax (render the barcode directly)
|
|
3154
|
+
if (typeof text !== "undefined") {
|
|
3155
|
+
options = options || {};
|
|
3156
|
+
|
|
3157
|
+
if (!options.format) {
|
|
3158
|
+
options.format = autoSelectBarcode();
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
api.options(options)[options.format](text, options).render();
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
return api;
|
|
3165
|
+
};
|
|
3166
|
+
|
|
3167
|
+
// To make tests work TODO: remove
|
|
3168
|
+
JsBarcode.getModule = function (name) {
|
|
3169
|
+
return _barcodes2.default[name];
|
|
3170
|
+
};
|
|
3171
|
+
|
|
3172
|
+
// Register all barcodes
|
|
3173
|
+
for (var name in _barcodes2.default) {
|
|
3174
|
+
if (_barcodes2.default.hasOwnProperty(name)) {
|
|
3175
|
+
// Security check if the propery is a prototype property
|
|
3176
|
+
registerBarcode(_barcodes2.default, name);
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
function registerBarcode(barcodes, name) {
|
|
3180
|
+
API.prototype[name] = API.prototype[name.toUpperCase()] = API.prototype[name.toLowerCase()] = function (text, options) {
|
|
3181
|
+
var api = this;
|
|
3182
|
+
return api._errorHandler.wrapBarcodeCall(function () {
|
|
3183
|
+
// Ensure text is options.text
|
|
3184
|
+
options.text = typeof options.text === 'undefined' ? undefined : '' + options.text;
|
|
3185
|
+
|
|
3186
|
+
var newOptions = (0, _merge2.default)(api._options, options);
|
|
3187
|
+
newOptions = (0, _optionsFromStrings2.default)(newOptions);
|
|
3188
|
+
var Encoder = barcodes[name];
|
|
3189
|
+
var encoded = encode(text, Encoder, newOptions);
|
|
3190
|
+
api._encodings.push(encoded);
|
|
3191
|
+
|
|
3192
|
+
return api;
|
|
3193
|
+
});
|
|
3194
|
+
};
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
// encode() handles the Encoder call and builds the binary string to be rendered
|
|
3198
|
+
function encode(text, Encoder, options) {
|
|
3199
|
+
// Ensure that text is a string
|
|
3200
|
+
text = "" + text;
|
|
3201
|
+
|
|
3202
|
+
var encoder = new Encoder(text, options);
|
|
3203
|
+
|
|
3204
|
+
// If the input is not valid for the encoder, throw error.
|
|
3205
|
+
// If the valid callback option is set, call it instead of throwing error
|
|
3206
|
+
if (!encoder.valid()) {
|
|
3207
|
+
throw new _exceptions.InvalidInputException(encoder.constructor.name, text);
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
// Make a request for the binary data (and other infromation) that should be rendered
|
|
3211
|
+
var encoded = encoder.encode();
|
|
3212
|
+
|
|
3213
|
+
// Encodings can be nestled like [[1-1, 1-2], 2, [3-1, 3-2]
|
|
3214
|
+
// Convert to [1-1, 1-2, 2, 3-1, 3-2]
|
|
3215
|
+
encoded = (0, _linearizeEncodings2.default)(encoded);
|
|
3216
|
+
|
|
3217
|
+
// Merge
|
|
3218
|
+
for (var i = 0; i < encoded.length; i++) {
|
|
3219
|
+
encoded[i].options = (0, _merge2.default)(options, encoded[i].options);
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
return encoded;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
function autoSelectBarcode() {
|
|
3226
|
+
// If CODE128 exists. Use it
|
|
3227
|
+
if (_barcodes2.default["CODE128"]) {
|
|
3228
|
+
return "CODE128";
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
// Else, take the first (probably only) barcode
|
|
3232
|
+
return Object.keys(_barcodes2.default)[0];
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
// Sets global encoder options
|
|
3236
|
+
// Added to the api by the JsBarcode function
|
|
3237
|
+
API.prototype.options = function (options) {
|
|
3238
|
+
this._options = (0, _merge2.default)(this._options, options);
|
|
3239
|
+
return this;
|
|
3240
|
+
};
|
|
3241
|
+
|
|
3242
|
+
// Will create a blank space (usually in between barcodes)
|
|
3243
|
+
API.prototype.blank = function (size) {
|
|
3244
|
+
var zeroes = new Array(size + 1).join("0");
|
|
3245
|
+
this._encodings.push({ data: zeroes });
|
|
3246
|
+
return this;
|
|
3247
|
+
};
|
|
3248
|
+
|
|
3249
|
+
// Initialize JsBarcode on all HTML elements defined.
|
|
3250
|
+
API.prototype.init = function () {
|
|
3251
|
+
// Should do nothing if no elements where found
|
|
3252
|
+
if (!this._renderProperties) {
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
// Make sure renderProperies is an array
|
|
3257
|
+
if (!Array.isArray(this._renderProperties)) {
|
|
3258
|
+
this._renderProperties = [this._renderProperties];
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
var renderProperty;
|
|
3262
|
+
for (var i in this._renderProperties) {
|
|
3263
|
+
renderProperty = this._renderProperties[i];
|
|
3264
|
+
var options = (0, _merge2.default)(this._options, renderProperty.options);
|
|
3265
|
+
|
|
3266
|
+
if (options.format == "auto") {
|
|
3267
|
+
options.format = autoSelectBarcode();
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
this._errorHandler.wrapBarcodeCall(function () {
|
|
3271
|
+
var text = options.value;
|
|
3272
|
+
var Encoder = _barcodes2.default[options.format.toUpperCase()];
|
|
3273
|
+
var encoded = encode(text, Encoder, options);
|
|
3274
|
+
|
|
3275
|
+
render(renderProperty, encoded, options);
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
};
|
|
3279
|
+
|
|
3280
|
+
// The render API call. Calls the real render function.
|
|
3281
|
+
API.prototype.render = function () {
|
|
3282
|
+
if (!this._renderProperties) {
|
|
3283
|
+
throw new _exceptions.NoElementException();
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3286
|
+
if (Array.isArray(this._renderProperties)) {
|
|
3287
|
+
for (var i = 0; i < this._renderProperties.length; i++) {
|
|
3288
|
+
render(this._renderProperties[i], this._encodings, this._options);
|
|
3289
|
+
}
|
|
3290
|
+
} else {
|
|
3291
|
+
render(this._renderProperties, this._encodings, this._options);
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3294
|
+
return this;
|
|
3295
|
+
};
|
|
3296
|
+
|
|
3297
|
+
API.prototype._defaults = _defaults2.default;
|
|
3298
|
+
|
|
3299
|
+
// Prepares the encodings and calls the renderer
|
|
3300
|
+
function render(renderProperties, encodings, options) {
|
|
3301
|
+
encodings = (0, _linearizeEncodings2.default)(encodings);
|
|
3302
|
+
|
|
3303
|
+
for (var i = 0; i < encodings.length; i++) {
|
|
3304
|
+
encodings[i].options = (0, _merge2.default)(options, encodings[i].options);
|
|
3305
|
+
(0, _fixOptions2.default)(encodings[i].options);
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
(0, _fixOptions2.default)(options);
|
|
3309
|
+
|
|
3310
|
+
var Renderer = renderProperties.renderer;
|
|
3311
|
+
var renderer = new Renderer(renderProperties.element, encodings, options);
|
|
3312
|
+
renderer.render();
|
|
3313
|
+
|
|
3314
|
+
if (renderProperties.afterRender) {
|
|
3315
|
+
renderProperties.afterRender();
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
// Export to browser
|
|
3320
|
+
if (typeof window !== "undefined") {
|
|
3321
|
+
window.JsBarcode = JsBarcode;
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
// Export to jQuery
|
|
3325
|
+
/*global jQuery */
|
|
3326
|
+
if (typeof jQuery !== 'undefined') {
|
|
3327
|
+
jQuery.fn.JsBarcode = function (content, options) {
|
|
3328
|
+
var elementArray = [];
|
|
3329
|
+
jQuery(this).each(function () {
|
|
3330
|
+
elementArray.push(this);
|
|
3331
|
+
});
|
|
3332
|
+
return JsBarcode(elementArray, content, options);
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
// Export to commonJS
|
|
3337
|
+
var JsBarcode_1 = JsBarcode;
|
|
3338
|
+
|
|
3339
|
+
var propTypes = {exports: {}};
|
|
3340
|
+
|
|
3341
|
+
var reactIs = {exports: {}};
|
|
3342
|
+
|
|
3343
|
+
var reactIs_production_min = {};
|
|
3344
|
+
|
|
3345
|
+
/** @license React v16.13.1
|
|
3346
|
+
* react-is.production.min.js
|
|
3347
|
+
*
|
|
3348
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3349
|
+
*
|
|
3350
|
+
* This source code is licensed under the MIT license found in the
|
|
3351
|
+
* LICENSE file in the root directory of this source tree.
|
|
3352
|
+
*/
|
|
3353
|
+
|
|
3354
|
+
var hasRequiredReactIs_production_min;
|
|
3355
|
+
|
|
3356
|
+
function requireReactIs_production_min () {
|
|
3357
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
3358
|
+
hasRequiredReactIs_production_min = 1;
|
|
3359
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
3360
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
3361
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
3362
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
3363
|
+
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
3364
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
3365
|
+
return reactIs_production_min;
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
var reactIs_development = {};
|
|
3369
|
+
|
|
3370
|
+
/** @license React v16.13.1
|
|
3371
|
+
* react-is.development.js
|
|
3372
|
+
*
|
|
3373
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3374
|
+
*
|
|
3375
|
+
* This source code is licensed under the MIT license found in the
|
|
3376
|
+
* LICENSE file in the root directory of this source tree.
|
|
3377
|
+
*/
|
|
3378
|
+
|
|
3379
|
+
var hasRequiredReactIs_development;
|
|
3380
|
+
|
|
3381
|
+
function requireReactIs_development () {
|
|
3382
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
3383
|
+
hasRequiredReactIs_development = 1;
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
|
|
3387
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3388
|
+
(function() {
|
|
3389
|
+
|
|
3390
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
3391
|
+
// nor polyfill, then a plain number is used for performance.
|
|
3392
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
3393
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
3394
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
3395
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
3396
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
3397
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
3398
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
3399
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
3400
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
3401
|
+
|
|
3402
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
3403
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
3404
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
3405
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
3406
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
3407
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
3408
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
3409
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
3410
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
3411
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
3412
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
3413
|
+
|
|
3414
|
+
function isValidElementType(type) {
|
|
3415
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
3416
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
function typeOf(object) {
|
|
3420
|
+
if (typeof object === 'object' && object !== null) {
|
|
3421
|
+
var $$typeof = object.$$typeof;
|
|
3422
|
+
|
|
3423
|
+
switch ($$typeof) {
|
|
3424
|
+
case REACT_ELEMENT_TYPE:
|
|
3425
|
+
var type = object.type;
|
|
3426
|
+
|
|
3427
|
+
switch (type) {
|
|
3428
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
3429
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
3430
|
+
case REACT_FRAGMENT_TYPE:
|
|
3431
|
+
case REACT_PROFILER_TYPE:
|
|
3432
|
+
case REACT_STRICT_MODE_TYPE:
|
|
3433
|
+
case REACT_SUSPENSE_TYPE:
|
|
3434
|
+
return type;
|
|
3435
|
+
|
|
3436
|
+
default:
|
|
3437
|
+
var $$typeofType = type && type.$$typeof;
|
|
3438
|
+
|
|
3439
|
+
switch ($$typeofType) {
|
|
3440
|
+
case REACT_CONTEXT_TYPE:
|
|
3441
|
+
case REACT_FORWARD_REF_TYPE:
|
|
3442
|
+
case REACT_LAZY_TYPE:
|
|
3443
|
+
case REACT_MEMO_TYPE:
|
|
3444
|
+
case REACT_PROVIDER_TYPE:
|
|
3445
|
+
return $$typeofType;
|
|
3446
|
+
|
|
3447
|
+
default:
|
|
3448
|
+
return $$typeof;
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3453
|
+
case REACT_PORTAL_TYPE:
|
|
3454
|
+
return $$typeof;
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3458
|
+
return undefined;
|
|
3459
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
3460
|
+
|
|
3461
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
3462
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
3463
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
3464
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
3465
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
3466
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
3467
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
3468
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
3469
|
+
var Memo = REACT_MEMO_TYPE;
|
|
3470
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
3471
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
3472
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
3473
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
3474
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
3475
|
+
|
|
3476
|
+
function isAsyncMode(object) {
|
|
3477
|
+
{
|
|
3478
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
3479
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
3480
|
+
|
|
3481
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
3486
|
+
}
|
|
3487
|
+
function isConcurrentMode(object) {
|
|
3488
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
3489
|
+
}
|
|
3490
|
+
function isContextConsumer(object) {
|
|
3491
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
3492
|
+
}
|
|
3493
|
+
function isContextProvider(object) {
|
|
3494
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
3495
|
+
}
|
|
3496
|
+
function isElement(object) {
|
|
3497
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
3498
|
+
}
|
|
3499
|
+
function isForwardRef(object) {
|
|
3500
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
3501
|
+
}
|
|
3502
|
+
function isFragment(object) {
|
|
3503
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
3504
|
+
}
|
|
3505
|
+
function isLazy(object) {
|
|
3506
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
3507
|
+
}
|
|
3508
|
+
function isMemo(object) {
|
|
3509
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
3510
|
+
}
|
|
3511
|
+
function isPortal(object) {
|
|
3512
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
3513
|
+
}
|
|
3514
|
+
function isProfiler(object) {
|
|
3515
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
3516
|
+
}
|
|
3517
|
+
function isStrictMode(object) {
|
|
3518
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
3519
|
+
}
|
|
3520
|
+
function isSuspense(object) {
|
|
3521
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
reactIs_development.AsyncMode = AsyncMode;
|
|
3525
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
3526
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
3527
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
3528
|
+
reactIs_development.Element = Element;
|
|
3529
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
3530
|
+
reactIs_development.Fragment = Fragment;
|
|
3531
|
+
reactIs_development.Lazy = Lazy;
|
|
3532
|
+
reactIs_development.Memo = Memo;
|
|
3533
|
+
reactIs_development.Portal = Portal;
|
|
3534
|
+
reactIs_development.Profiler = Profiler;
|
|
3535
|
+
reactIs_development.StrictMode = StrictMode;
|
|
3536
|
+
reactIs_development.Suspense = Suspense;
|
|
3537
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
3538
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
3539
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
3540
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
3541
|
+
reactIs_development.isElement = isElement;
|
|
3542
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
3543
|
+
reactIs_development.isFragment = isFragment;
|
|
3544
|
+
reactIs_development.isLazy = isLazy;
|
|
3545
|
+
reactIs_development.isMemo = isMemo;
|
|
3546
|
+
reactIs_development.isPortal = isPortal;
|
|
3547
|
+
reactIs_development.isProfiler = isProfiler;
|
|
3548
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
3549
|
+
reactIs_development.isSuspense = isSuspense;
|
|
3550
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
3551
|
+
reactIs_development.typeOf = typeOf;
|
|
3552
|
+
})();
|
|
3553
|
+
}
|
|
3554
|
+
return reactIs_development;
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
var hasRequiredReactIs;
|
|
3558
|
+
|
|
3559
|
+
function requireReactIs () {
|
|
3560
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
3561
|
+
hasRequiredReactIs = 1;
|
|
3562
|
+
(function (module) {
|
|
3563
|
+
|
|
3564
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3565
|
+
module.exports = requireReactIs_production_min();
|
|
3566
|
+
} else {
|
|
3567
|
+
module.exports = requireReactIs_development();
|
|
3568
|
+
}
|
|
3569
|
+
} (reactIs));
|
|
3570
|
+
return reactIs.exports;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
/*
|
|
3574
|
+
object-assign
|
|
3575
|
+
(c) Sindre Sorhus
|
|
3576
|
+
@license MIT
|
|
3577
|
+
*/
|
|
3578
|
+
|
|
3579
|
+
var objectAssign;
|
|
3580
|
+
var hasRequiredObjectAssign;
|
|
3581
|
+
|
|
3582
|
+
function requireObjectAssign () {
|
|
3583
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
3584
|
+
hasRequiredObjectAssign = 1;
|
|
3585
|
+
/* eslint-disable no-unused-vars */
|
|
3586
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
3587
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3588
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
3589
|
+
|
|
3590
|
+
function toObject(val) {
|
|
3591
|
+
if (val === null || val === undefined) {
|
|
3592
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
return Object(val);
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
function shouldUseNative() {
|
|
3599
|
+
try {
|
|
3600
|
+
if (!Object.assign) {
|
|
3601
|
+
return false;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3604
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
3605
|
+
|
|
3606
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
3607
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
3608
|
+
test1[5] = 'de';
|
|
3609
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
3610
|
+
return false;
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
3614
|
+
var test2 = {};
|
|
3615
|
+
for (var i = 0; i < 10; i++) {
|
|
3616
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
3617
|
+
}
|
|
3618
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
3619
|
+
return test2[n];
|
|
3620
|
+
});
|
|
3621
|
+
if (order2.join('') !== '0123456789') {
|
|
3622
|
+
return false;
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
3626
|
+
var test3 = {};
|
|
3627
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
3628
|
+
test3[letter] = letter;
|
|
3629
|
+
});
|
|
3630
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
3631
|
+
'abcdefghijklmnopqrst') {
|
|
3632
|
+
return false;
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
return true;
|
|
3636
|
+
} catch (err) {
|
|
3637
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
3638
|
+
return false;
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
3643
|
+
var from;
|
|
3644
|
+
var to = toObject(target);
|
|
3645
|
+
var symbols;
|
|
3646
|
+
|
|
3647
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
3648
|
+
from = Object(arguments[s]);
|
|
3649
|
+
|
|
3650
|
+
for (var key in from) {
|
|
3651
|
+
if (hasOwnProperty.call(from, key)) {
|
|
3652
|
+
to[key] = from[key];
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
if (getOwnPropertySymbols) {
|
|
3657
|
+
symbols = getOwnPropertySymbols(from);
|
|
3658
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
3659
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
3660
|
+
to[symbols[i]] = from[symbols[i]];
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
return to;
|
|
3667
|
+
};
|
|
3668
|
+
return objectAssign;
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
/**
|
|
3672
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3673
|
+
*
|
|
3674
|
+
* This source code is licensed under the MIT license found in the
|
|
3675
|
+
* LICENSE file in the root directory of this source tree.
|
|
3676
|
+
*/
|
|
3677
|
+
|
|
3678
|
+
var ReactPropTypesSecret_1;
|
|
3679
|
+
var hasRequiredReactPropTypesSecret;
|
|
3680
|
+
|
|
3681
|
+
function requireReactPropTypesSecret () {
|
|
3682
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
3683
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
3684
|
+
|
|
3685
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
3686
|
+
|
|
3687
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
3688
|
+
return ReactPropTypesSecret_1;
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
var has;
|
|
3692
|
+
var hasRequiredHas;
|
|
3693
|
+
|
|
3694
|
+
function requireHas () {
|
|
3695
|
+
if (hasRequiredHas) return has;
|
|
3696
|
+
hasRequiredHas = 1;
|
|
3697
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
3698
|
+
return has;
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
/**
|
|
3702
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3703
|
+
*
|
|
3704
|
+
* This source code is licensed under the MIT license found in the
|
|
3705
|
+
* LICENSE file in the root directory of this source tree.
|
|
3706
|
+
*/
|
|
3707
|
+
|
|
3708
|
+
var checkPropTypes_1;
|
|
3709
|
+
var hasRequiredCheckPropTypes;
|
|
3710
|
+
|
|
3711
|
+
function requireCheckPropTypes () {
|
|
3712
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
3713
|
+
hasRequiredCheckPropTypes = 1;
|
|
3714
|
+
|
|
3715
|
+
var printWarning = function() {};
|
|
3716
|
+
|
|
3717
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3718
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
3719
|
+
var loggedTypeFailures = {};
|
|
3720
|
+
var has = requireHas();
|
|
3721
|
+
|
|
3722
|
+
printWarning = function(text) {
|
|
3723
|
+
var message = 'Warning: ' + text;
|
|
3724
|
+
if (typeof console !== 'undefined') {
|
|
3725
|
+
console.error(message);
|
|
3726
|
+
}
|
|
3727
|
+
try {
|
|
3728
|
+
// --- Welcome to debugging React ---
|
|
3729
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
3730
|
+
// to find the callsite that caused this warning to fire.
|
|
3731
|
+
throw new Error(message);
|
|
3732
|
+
} catch (x) { /**/ }
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
/**
|
|
3737
|
+
* Assert that the values match with the type specs.
|
|
3738
|
+
* Error messages are memorized and will only be shown once.
|
|
3739
|
+
*
|
|
3740
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
3741
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
3742
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
3743
|
+
* @param {string} componentName Name of the component for error messages.
|
|
3744
|
+
* @param {?Function} getStack Returns the component stack.
|
|
3745
|
+
* @private
|
|
3746
|
+
*/
|
|
3747
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
3748
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3749
|
+
for (var typeSpecName in typeSpecs) {
|
|
3750
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
3751
|
+
var error;
|
|
3752
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
3753
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
3754
|
+
// After these have been cleaned up, we'll let them throw.
|
|
3755
|
+
try {
|
|
3756
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
3757
|
+
// behavior as without this statement except with a better message.
|
|
3758
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
3759
|
+
var err = Error(
|
|
3760
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
3761
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
3762
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
3763
|
+
);
|
|
3764
|
+
err.name = 'Invariant Violation';
|
|
3765
|
+
throw err;
|
|
3766
|
+
}
|
|
3767
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
3768
|
+
} catch (ex) {
|
|
3769
|
+
error = ex;
|
|
3770
|
+
}
|
|
3771
|
+
if (error && !(error instanceof Error)) {
|
|
3772
|
+
printWarning(
|
|
3773
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
3774
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
3775
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
3776
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
3777
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
3778
|
+
'shape all require an argument).'
|
|
3779
|
+
);
|
|
3780
|
+
}
|
|
3781
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
3782
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
3783
|
+
// same error.
|
|
3784
|
+
loggedTypeFailures[error.message] = true;
|
|
3785
|
+
|
|
3786
|
+
var stack = getStack ? getStack() : '';
|
|
3787
|
+
|
|
3788
|
+
printWarning(
|
|
3789
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
3790
|
+
);
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
/**
|
|
3798
|
+
* Resets warning cache when testing.
|
|
3799
|
+
*
|
|
3800
|
+
* @private
|
|
3801
|
+
*/
|
|
3802
|
+
checkPropTypes.resetWarningCache = function() {
|
|
3803
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3804
|
+
loggedTypeFailures = {};
|
|
3805
|
+
}
|
|
3806
|
+
};
|
|
3807
|
+
|
|
3808
|
+
checkPropTypes_1 = checkPropTypes;
|
|
3809
|
+
return checkPropTypes_1;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
/**
|
|
3813
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3814
|
+
*
|
|
3815
|
+
* This source code is licensed under the MIT license found in the
|
|
3816
|
+
* LICENSE file in the root directory of this source tree.
|
|
3817
|
+
*/
|
|
3818
|
+
|
|
3819
|
+
var factoryWithTypeCheckers;
|
|
3820
|
+
var hasRequiredFactoryWithTypeCheckers;
|
|
3821
|
+
|
|
3822
|
+
function requireFactoryWithTypeCheckers () {
|
|
3823
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
3824
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
|
3825
|
+
|
|
3826
|
+
var ReactIs = requireReactIs();
|
|
3827
|
+
var assign = requireObjectAssign();
|
|
3828
|
+
|
|
3829
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
3830
|
+
var has = requireHas();
|
|
3831
|
+
var checkPropTypes = requireCheckPropTypes();
|
|
3832
|
+
|
|
3833
|
+
var printWarning = function() {};
|
|
3834
|
+
|
|
3835
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3836
|
+
printWarning = function(text) {
|
|
3837
|
+
var message = 'Warning: ' + text;
|
|
3838
|
+
if (typeof console !== 'undefined') {
|
|
3839
|
+
console.error(message);
|
|
3840
|
+
}
|
|
3841
|
+
try {
|
|
3842
|
+
// --- Welcome to debugging React ---
|
|
3843
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
3844
|
+
// to find the callsite that caused this warning to fire.
|
|
3845
|
+
throw new Error(message);
|
|
3846
|
+
} catch (x) {}
|
|
3847
|
+
};
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
function emptyFunctionThatReturnsNull() {
|
|
3851
|
+
return null;
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3854
|
+
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
3855
|
+
/* global Symbol */
|
|
3856
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
3857
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
3858
|
+
|
|
3859
|
+
/**
|
|
3860
|
+
* Returns the iterator method function contained on the iterable object.
|
|
3861
|
+
*
|
|
3862
|
+
* Be sure to invoke the function with the iterable as context:
|
|
3863
|
+
*
|
|
3864
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
3865
|
+
* if (iteratorFn) {
|
|
3866
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
3867
|
+
* ...
|
|
3868
|
+
* }
|
|
3869
|
+
*
|
|
3870
|
+
* @param {?object} maybeIterable
|
|
3871
|
+
* @return {?function}
|
|
3872
|
+
*/
|
|
3873
|
+
function getIteratorFn(maybeIterable) {
|
|
3874
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
3875
|
+
if (typeof iteratorFn === 'function') {
|
|
3876
|
+
return iteratorFn;
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
/**
|
|
3881
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
3882
|
+
* supplied to React components. Example usage:
|
|
3883
|
+
*
|
|
3884
|
+
* var Props = require('ReactPropTypes');
|
|
3885
|
+
* var MyArticle = React.createClass({
|
|
3886
|
+
* propTypes: {
|
|
3887
|
+
* // An optional string prop named "description".
|
|
3888
|
+
* description: Props.string,
|
|
3889
|
+
*
|
|
3890
|
+
* // A required enum prop named "category".
|
|
3891
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
3892
|
+
*
|
|
3893
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
3894
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
3895
|
+
* },
|
|
3896
|
+
* render: function() { ... }
|
|
3897
|
+
* });
|
|
3898
|
+
*
|
|
3899
|
+
* A more formal specification of how these methods are used:
|
|
3900
|
+
*
|
|
3901
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
3902
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
3903
|
+
*
|
|
3904
|
+
* Each and every declaration produces a function with the same signature. This
|
|
3905
|
+
* allows the creation of custom validation functions. For example:
|
|
3906
|
+
*
|
|
3907
|
+
* var MyLink = React.createClass({
|
|
3908
|
+
* propTypes: {
|
|
3909
|
+
* // An optional string or URI prop named "href".
|
|
3910
|
+
* href: function(props, propName, componentName) {
|
|
3911
|
+
* var propValue = props[propName];
|
|
3912
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
3913
|
+
* !(propValue instanceof URI)) {
|
|
3914
|
+
* return new Error(
|
|
3915
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
3916
|
+
* componentName
|
|
3917
|
+
* );
|
|
3918
|
+
* }
|
|
3919
|
+
* }
|
|
3920
|
+
* },
|
|
3921
|
+
* render: function() {...}
|
|
3922
|
+
* });
|
|
3923
|
+
*
|
|
3924
|
+
* @internal
|
|
3925
|
+
*/
|
|
3926
|
+
|
|
3927
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
3928
|
+
|
|
3929
|
+
// Important!
|
|
3930
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
3931
|
+
var ReactPropTypes = {
|
|
3932
|
+
array: createPrimitiveTypeChecker('array'),
|
|
3933
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
3934
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
3935
|
+
func: createPrimitiveTypeChecker('function'),
|
|
3936
|
+
number: createPrimitiveTypeChecker('number'),
|
|
3937
|
+
object: createPrimitiveTypeChecker('object'),
|
|
3938
|
+
string: createPrimitiveTypeChecker('string'),
|
|
3939
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
3940
|
+
|
|
3941
|
+
any: createAnyTypeChecker(),
|
|
3942
|
+
arrayOf: createArrayOfTypeChecker,
|
|
3943
|
+
element: createElementTypeChecker(),
|
|
3944
|
+
elementType: createElementTypeTypeChecker(),
|
|
3945
|
+
instanceOf: createInstanceTypeChecker,
|
|
3946
|
+
node: createNodeChecker(),
|
|
3947
|
+
objectOf: createObjectOfTypeChecker,
|
|
3948
|
+
oneOf: createEnumTypeChecker,
|
|
3949
|
+
oneOfType: createUnionTypeChecker,
|
|
3950
|
+
shape: createShapeTypeChecker,
|
|
3951
|
+
exact: createStrictShapeTypeChecker,
|
|
3952
|
+
};
|
|
3953
|
+
|
|
3954
|
+
/**
|
|
3955
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
3956
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
3957
|
+
*/
|
|
3958
|
+
/*eslint-disable no-self-compare*/
|
|
3959
|
+
function is(x, y) {
|
|
3960
|
+
// SameValue algorithm
|
|
3961
|
+
if (x === y) {
|
|
3962
|
+
// Steps 1-5, 7-10
|
|
3963
|
+
// Steps 6.b-6.e: +0 != -0
|
|
3964
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
3965
|
+
} else {
|
|
3966
|
+
// Step 6.a: NaN == NaN
|
|
3967
|
+
return x !== x && y !== y;
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
/*eslint-enable no-self-compare*/
|
|
3971
|
+
|
|
3972
|
+
/**
|
|
3973
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
3974
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
3975
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
3976
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
3977
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
3978
|
+
*/
|
|
3979
|
+
function PropTypeError(message, data) {
|
|
3980
|
+
this.message = message;
|
|
3981
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
3982
|
+
this.stack = '';
|
|
3983
|
+
}
|
|
3984
|
+
// Make `instanceof Error` still work for returned errors.
|
|
3985
|
+
PropTypeError.prototype = Error.prototype;
|
|
3986
|
+
|
|
3987
|
+
function createChainableTypeChecker(validate) {
|
|
3988
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3989
|
+
var manualPropTypeCallCache = {};
|
|
3990
|
+
var manualPropTypeWarningCount = 0;
|
|
3991
|
+
}
|
|
3992
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
3993
|
+
componentName = componentName || ANONYMOUS;
|
|
3994
|
+
propFullName = propFullName || propName;
|
|
3995
|
+
|
|
3996
|
+
if (secret !== ReactPropTypesSecret) {
|
|
3997
|
+
if (throwOnDirectAccess) {
|
|
3998
|
+
// New behavior only for users of `prop-types` package
|
|
3999
|
+
var err = new Error(
|
|
4000
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
4001
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
4002
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
4003
|
+
);
|
|
4004
|
+
err.name = 'Invariant Violation';
|
|
4005
|
+
throw err;
|
|
4006
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
4007
|
+
// Old behavior for people using React.PropTypes
|
|
4008
|
+
var cacheKey = componentName + ':' + propName;
|
|
4009
|
+
if (
|
|
4010
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
4011
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
4012
|
+
manualPropTypeWarningCount < 3
|
|
4013
|
+
) {
|
|
4014
|
+
printWarning(
|
|
4015
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
4016
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
4017
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
4018
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
4019
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
4020
|
+
);
|
|
4021
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
4022
|
+
manualPropTypeWarningCount++;
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
if (props[propName] == null) {
|
|
4027
|
+
if (isRequired) {
|
|
4028
|
+
if (props[propName] === null) {
|
|
4029
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
4030
|
+
}
|
|
4031
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
4032
|
+
}
|
|
4033
|
+
return null;
|
|
4034
|
+
} else {
|
|
4035
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
|
|
4039
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
4040
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
4041
|
+
|
|
4042
|
+
return chainedCheckType;
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
4046
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
4047
|
+
var propValue = props[propName];
|
|
4048
|
+
var propType = getPropType(propValue);
|
|
4049
|
+
if (propType !== expectedType) {
|
|
4050
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
4051
|
+
// check, but we can offer a more precise error message here rather than
|
|
4052
|
+
// 'of type `object`'.
|
|
4053
|
+
var preciseType = getPreciseType(propValue);
|
|
4054
|
+
|
|
4055
|
+
return new PropTypeError(
|
|
4056
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
4057
|
+
{expectedType: expectedType}
|
|
4058
|
+
);
|
|
4059
|
+
}
|
|
4060
|
+
return null;
|
|
4061
|
+
}
|
|
4062
|
+
return createChainableTypeChecker(validate);
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
function createAnyTypeChecker() {
|
|
4066
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4069
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
4070
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4071
|
+
if (typeof typeChecker !== 'function') {
|
|
4072
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
4073
|
+
}
|
|
4074
|
+
var propValue = props[propName];
|
|
4075
|
+
if (!Array.isArray(propValue)) {
|
|
4076
|
+
var propType = getPropType(propValue);
|
|
4077
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
4078
|
+
}
|
|
4079
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
4080
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
4081
|
+
if (error instanceof Error) {
|
|
4082
|
+
return error;
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
return null;
|
|
4086
|
+
}
|
|
4087
|
+
return createChainableTypeChecker(validate);
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
function createElementTypeChecker() {
|
|
4091
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4092
|
+
var propValue = props[propName];
|
|
4093
|
+
if (!isValidElement(propValue)) {
|
|
4094
|
+
var propType = getPropType(propValue);
|
|
4095
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
4096
|
+
}
|
|
4097
|
+
return null;
|
|
4098
|
+
}
|
|
4099
|
+
return createChainableTypeChecker(validate);
|
|
4100
|
+
}
|
|
4101
|
+
|
|
4102
|
+
function createElementTypeTypeChecker() {
|
|
4103
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4104
|
+
var propValue = props[propName];
|
|
4105
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
4106
|
+
var propType = getPropType(propValue);
|
|
4107
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
4108
|
+
}
|
|
4109
|
+
return null;
|
|
4110
|
+
}
|
|
4111
|
+
return createChainableTypeChecker(validate);
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
4115
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4116
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
4117
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
4118
|
+
var actualClassName = getClassName(props[propName]);
|
|
4119
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
4120
|
+
}
|
|
4121
|
+
return null;
|
|
4122
|
+
}
|
|
4123
|
+
return createChainableTypeChecker(validate);
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
function createEnumTypeChecker(expectedValues) {
|
|
4127
|
+
if (!Array.isArray(expectedValues)) {
|
|
4128
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4129
|
+
if (arguments.length > 1) {
|
|
4130
|
+
printWarning(
|
|
4131
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
4132
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
4133
|
+
);
|
|
4134
|
+
} else {
|
|
4135
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
return emptyFunctionThatReturnsNull;
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4142
|
+
var propValue = props[propName];
|
|
4143
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
4144
|
+
if (is(propValue, expectedValues[i])) {
|
|
4145
|
+
return null;
|
|
4146
|
+
}
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
4150
|
+
var type = getPreciseType(value);
|
|
4151
|
+
if (type === 'symbol') {
|
|
4152
|
+
return String(value);
|
|
4153
|
+
}
|
|
4154
|
+
return value;
|
|
4155
|
+
});
|
|
4156
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
4157
|
+
}
|
|
4158
|
+
return createChainableTypeChecker(validate);
|
|
4159
|
+
}
|
|
4160
|
+
|
|
4161
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
4162
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4163
|
+
if (typeof typeChecker !== 'function') {
|
|
4164
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
4165
|
+
}
|
|
4166
|
+
var propValue = props[propName];
|
|
4167
|
+
var propType = getPropType(propValue);
|
|
4168
|
+
if (propType !== 'object') {
|
|
4169
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
4170
|
+
}
|
|
4171
|
+
for (var key in propValue) {
|
|
4172
|
+
if (has(propValue, key)) {
|
|
4173
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
4174
|
+
if (error instanceof Error) {
|
|
4175
|
+
return error;
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4178
|
+
}
|
|
4179
|
+
return null;
|
|
4180
|
+
}
|
|
4181
|
+
return createChainableTypeChecker(validate);
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
4185
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
4186
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
4187
|
+
return emptyFunctionThatReturnsNull;
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
4191
|
+
var checker = arrayOfTypeCheckers[i];
|
|
4192
|
+
if (typeof checker !== 'function') {
|
|
4193
|
+
printWarning(
|
|
4194
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
4195
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
4196
|
+
);
|
|
4197
|
+
return emptyFunctionThatReturnsNull;
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4201
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4202
|
+
var expectedTypes = [];
|
|
4203
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
4204
|
+
var checker = arrayOfTypeCheckers[i];
|
|
4205
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
4206
|
+
if (checkerResult == null) {
|
|
4207
|
+
return null;
|
|
4208
|
+
}
|
|
4209
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
4210
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
4213
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
4214
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
4215
|
+
}
|
|
4216
|
+
return createChainableTypeChecker(validate);
|
|
4217
|
+
}
|
|
4218
|
+
|
|
4219
|
+
function createNodeChecker() {
|
|
4220
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4221
|
+
if (!isNode(props[propName])) {
|
|
4222
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
4223
|
+
}
|
|
4224
|
+
return null;
|
|
4225
|
+
}
|
|
4226
|
+
return createChainableTypeChecker(validate);
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
4230
|
+
return new PropTypeError(
|
|
4231
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
4232
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
4233
|
+
);
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
4237
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4238
|
+
var propValue = props[propName];
|
|
4239
|
+
var propType = getPropType(propValue);
|
|
4240
|
+
if (propType !== 'object') {
|
|
4241
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
4242
|
+
}
|
|
4243
|
+
for (var key in shapeTypes) {
|
|
4244
|
+
var checker = shapeTypes[key];
|
|
4245
|
+
if (typeof checker !== 'function') {
|
|
4246
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
4247
|
+
}
|
|
4248
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
4249
|
+
if (error) {
|
|
4250
|
+
return error;
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
return null;
|
|
4254
|
+
}
|
|
4255
|
+
return createChainableTypeChecker(validate);
|
|
4256
|
+
}
|
|
4257
|
+
|
|
4258
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
4259
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
4260
|
+
var propValue = props[propName];
|
|
4261
|
+
var propType = getPropType(propValue);
|
|
4262
|
+
if (propType !== 'object') {
|
|
4263
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
4264
|
+
}
|
|
4265
|
+
// We need to check all keys in case some are required but missing from props.
|
|
4266
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
4267
|
+
for (var key in allKeys) {
|
|
4268
|
+
var checker = shapeTypes[key];
|
|
4269
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
4270
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
4271
|
+
}
|
|
4272
|
+
if (!checker) {
|
|
4273
|
+
return new PropTypeError(
|
|
4274
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
4275
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
4276
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
4277
|
+
);
|
|
4278
|
+
}
|
|
4279
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
4280
|
+
if (error) {
|
|
4281
|
+
return error;
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
return null;
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4287
|
+
return createChainableTypeChecker(validate);
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
function isNode(propValue) {
|
|
4291
|
+
switch (typeof propValue) {
|
|
4292
|
+
case 'number':
|
|
4293
|
+
case 'string':
|
|
4294
|
+
case 'undefined':
|
|
4295
|
+
return true;
|
|
4296
|
+
case 'boolean':
|
|
4297
|
+
return !propValue;
|
|
4298
|
+
case 'object':
|
|
4299
|
+
if (Array.isArray(propValue)) {
|
|
4300
|
+
return propValue.every(isNode);
|
|
4301
|
+
}
|
|
4302
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
4303
|
+
return true;
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
4307
|
+
if (iteratorFn) {
|
|
4308
|
+
var iterator = iteratorFn.call(propValue);
|
|
4309
|
+
var step;
|
|
4310
|
+
if (iteratorFn !== propValue.entries) {
|
|
4311
|
+
while (!(step = iterator.next()).done) {
|
|
4312
|
+
if (!isNode(step.value)) {
|
|
4313
|
+
return false;
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
} else {
|
|
4317
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
4318
|
+
while (!(step = iterator.next()).done) {
|
|
4319
|
+
var entry = step.value;
|
|
4320
|
+
if (entry) {
|
|
4321
|
+
if (!isNode(entry[1])) {
|
|
4322
|
+
return false;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
} else {
|
|
4328
|
+
return false;
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4331
|
+
return true;
|
|
4332
|
+
default:
|
|
4333
|
+
return false;
|
|
4334
|
+
}
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4337
|
+
function isSymbol(propType, propValue) {
|
|
4338
|
+
// Native Symbol.
|
|
4339
|
+
if (propType === 'symbol') {
|
|
4340
|
+
return true;
|
|
4341
|
+
}
|
|
4342
|
+
|
|
4343
|
+
// falsy value can't be a Symbol
|
|
4344
|
+
if (!propValue) {
|
|
4345
|
+
return false;
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
4349
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
4350
|
+
return true;
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4353
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
4354
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
4355
|
+
return true;
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
return false;
|
|
4359
|
+
}
|
|
4360
|
+
|
|
4361
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
4362
|
+
function getPropType(propValue) {
|
|
4363
|
+
var propType = typeof propValue;
|
|
4364
|
+
if (Array.isArray(propValue)) {
|
|
4365
|
+
return 'array';
|
|
4366
|
+
}
|
|
4367
|
+
if (propValue instanceof RegExp) {
|
|
4368
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
4369
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
4370
|
+
// passes PropTypes.object.
|
|
4371
|
+
return 'object';
|
|
4372
|
+
}
|
|
4373
|
+
if (isSymbol(propType, propValue)) {
|
|
4374
|
+
return 'symbol';
|
|
4375
|
+
}
|
|
4376
|
+
return propType;
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
4380
|
+
// See `createPrimitiveTypeChecker`.
|
|
4381
|
+
function getPreciseType(propValue) {
|
|
4382
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
4383
|
+
return '' + propValue;
|
|
4384
|
+
}
|
|
4385
|
+
var propType = getPropType(propValue);
|
|
4386
|
+
if (propType === 'object') {
|
|
4387
|
+
if (propValue instanceof Date) {
|
|
4388
|
+
return 'date';
|
|
4389
|
+
} else if (propValue instanceof RegExp) {
|
|
4390
|
+
return 'regexp';
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
4393
|
+
return propType;
|
|
4394
|
+
}
|
|
4395
|
+
|
|
4396
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
4397
|
+
// For example, "undefined" or "of type array"
|
|
4398
|
+
function getPostfixForTypeWarning(value) {
|
|
4399
|
+
var type = getPreciseType(value);
|
|
4400
|
+
switch (type) {
|
|
4401
|
+
case 'array':
|
|
4402
|
+
case 'object':
|
|
4403
|
+
return 'an ' + type;
|
|
4404
|
+
case 'boolean':
|
|
4405
|
+
case 'date':
|
|
4406
|
+
case 'regexp':
|
|
4407
|
+
return 'a ' + type;
|
|
4408
|
+
default:
|
|
4409
|
+
return type;
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4413
|
+
// Returns class name of the object, if any.
|
|
4414
|
+
function getClassName(propValue) {
|
|
4415
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
4416
|
+
return ANONYMOUS;
|
|
4417
|
+
}
|
|
4418
|
+
return propValue.constructor.name;
|
|
4419
|
+
}
|
|
4420
|
+
|
|
4421
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
4422
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
4423
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
4424
|
+
|
|
4425
|
+
return ReactPropTypes;
|
|
4426
|
+
};
|
|
4427
|
+
return factoryWithTypeCheckers;
|
|
4428
|
+
}
|
|
4429
|
+
|
|
4430
|
+
/**
|
|
4431
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
4432
|
+
*
|
|
4433
|
+
* This source code is licensed under the MIT license found in the
|
|
4434
|
+
* LICENSE file in the root directory of this source tree.
|
|
4435
|
+
*/
|
|
4436
|
+
|
|
4437
|
+
var factoryWithThrowingShims;
|
|
4438
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
4439
|
+
|
|
4440
|
+
function requireFactoryWithThrowingShims () {
|
|
4441
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
4442
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
4443
|
+
|
|
4444
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
4445
|
+
|
|
4446
|
+
function emptyFunction() {}
|
|
4447
|
+
function emptyFunctionWithReset() {}
|
|
4448
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
4449
|
+
|
|
4450
|
+
factoryWithThrowingShims = function() {
|
|
4451
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
4452
|
+
if (secret === ReactPropTypesSecret) {
|
|
4453
|
+
// It is still safe when called from React.
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
var err = new Error(
|
|
4457
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
4458
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
4459
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
4460
|
+
);
|
|
4461
|
+
err.name = 'Invariant Violation';
|
|
4462
|
+
throw err;
|
|
4463
|
+
} shim.isRequired = shim;
|
|
4464
|
+
function getShim() {
|
|
4465
|
+
return shim;
|
|
4466
|
+
} // Important!
|
|
4467
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
4468
|
+
var ReactPropTypes = {
|
|
4469
|
+
array: shim,
|
|
4470
|
+
bigint: shim,
|
|
4471
|
+
bool: shim,
|
|
4472
|
+
func: shim,
|
|
4473
|
+
number: shim,
|
|
4474
|
+
object: shim,
|
|
4475
|
+
string: shim,
|
|
4476
|
+
symbol: shim,
|
|
4477
|
+
|
|
4478
|
+
any: shim,
|
|
4479
|
+
arrayOf: getShim,
|
|
4480
|
+
element: shim,
|
|
4481
|
+
elementType: shim,
|
|
4482
|
+
instanceOf: getShim,
|
|
4483
|
+
node: shim,
|
|
4484
|
+
objectOf: getShim,
|
|
4485
|
+
oneOf: getShim,
|
|
4486
|
+
oneOfType: getShim,
|
|
4487
|
+
shape: getShim,
|
|
4488
|
+
exact: getShim,
|
|
4489
|
+
|
|
4490
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
4491
|
+
resetWarningCache: emptyFunction
|
|
4492
|
+
};
|
|
4493
|
+
|
|
4494
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
4495
|
+
|
|
4496
|
+
return ReactPropTypes;
|
|
4497
|
+
};
|
|
4498
|
+
return factoryWithThrowingShims;
|
|
4499
|
+
}
|
|
4500
|
+
|
|
4501
|
+
/**
|
|
4502
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
4503
|
+
*
|
|
4504
|
+
* This source code is licensed under the MIT license found in the
|
|
4505
|
+
* LICENSE file in the root directory of this source tree.
|
|
4506
|
+
*/
|
|
4507
|
+
|
|
4508
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4509
|
+
var ReactIs = requireReactIs();
|
|
4510
|
+
|
|
4511
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
4512
|
+
// http://fb.me/prop-types-in-prod
|
|
4513
|
+
var throwOnDirectAccess = true;
|
|
4514
|
+
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
4515
|
+
} else {
|
|
4516
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
4517
|
+
// http://fb.me/prop-types-in-prod
|
|
4518
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4521
|
+
var _react = _interopRequireDefault(React__default["default"]);
|
|
4522
|
+
|
|
4523
|
+
var _jsbarcode = _interopRequireDefault(JsBarcode_1);
|
|
4524
|
+
|
|
4525
|
+
var _propTypes = _interopRequireDefault(propTypes.exports);
|
|
4526
|
+
|
|
4527
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
4528
|
+
|
|
4529
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4530
|
+
|
|
4531
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4532
|
+
|
|
4533
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4534
|
+
|
|
4535
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4536
|
+
|
|
4537
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4538
|
+
|
|
4539
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4540
|
+
|
|
4541
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4542
|
+
|
|
4543
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4544
|
+
|
|
4545
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4546
|
+
|
|
4547
|
+
var getDOMNode; // Super naive semver detection but it's good enough. We support 0.12, 0.13
|
|
4548
|
+
// which both have getDOMNode on the ref. 0.14 and 15 make the DOM node the ref.
|
|
4549
|
+
|
|
4550
|
+
var version = _react["default"].version.split(/[.-]/);
|
|
4551
|
+
|
|
4552
|
+
if (version[0] === '0' && (version[1] === '13' || version[1] === '12')) {
|
|
4553
|
+
getDOMNode = function getDOMNode(ref) {
|
|
4554
|
+
return ref.getDOMNode();
|
|
4555
|
+
};
|
|
4556
|
+
} else {
|
|
4557
|
+
getDOMNode = function getDOMNode(ref) {
|
|
4558
|
+
return ref;
|
|
4559
|
+
};
|
|
4560
|
+
}
|
|
4561
|
+
|
|
4562
|
+
var Barcode =
|
|
4563
|
+
/*#__PURE__*/
|
|
4564
|
+
function (_React$Component) {
|
|
4565
|
+
_inherits(Barcode, _React$Component);
|
|
4566
|
+
|
|
4567
|
+
function Barcode(props) {
|
|
4568
|
+
var _this;
|
|
4569
|
+
|
|
4570
|
+
_classCallCheck(this, Barcode);
|
|
4571
|
+
|
|
4572
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(Barcode).call(this, props));
|
|
4573
|
+
_this.renderElementRef = _react["default"].createRef();
|
|
4574
|
+
_this.update = _this.update.bind(_assertThisInitialized(_this));
|
|
4575
|
+
return _this;
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
_createClass(Barcode, [{
|
|
4579
|
+
key: "shouldComponentUpdate",
|
|
4580
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
4581
|
+
var _this2 = this;
|
|
4582
|
+
|
|
4583
|
+
return Object.keys(Barcode.propTypes).some(function (k) {
|
|
4584
|
+
return _this2.props[k] !== nextProps[k];
|
|
4585
|
+
});
|
|
4586
|
+
}
|
|
4587
|
+
}, {
|
|
4588
|
+
key: "componentDidMount",
|
|
4589
|
+
value: function componentDidMount() {
|
|
4590
|
+
this.update();
|
|
4591
|
+
}
|
|
4592
|
+
}, {
|
|
4593
|
+
key: "componentDidUpdate",
|
|
4594
|
+
value: function componentDidUpdate() {
|
|
4595
|
+
this.update();
|
|
4596
|
+
}
|
|
4597
|
+
}, {
|
|
4598
|
+
key: "update",
|
|
4599
|
+
value: function update() {
|
|
4600
|
+
var renderElement = getDOMNode(this.renderElementRef.current);
|
|
4601
|
+
|
|
4602
|
+
try {
|
|
4603
|
+
new _jsbarcode["default"](renderElement, this.props.value, Object.assign({}, this.props));
|
|
4604
|
+
} catch (e) {
|
|
4605
|
+
// prevent stop the parent process
|
|
4606
|
+
window.console.error(e);
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}, {
|
|
4610
|
+
key: "render",
|
|
4611
|
+
value: function render() {
|
|
4612
|
+
if (this.props.renderer === 'svg') {
|
|
4613
|
+
return _react["default"].createElement("svg", {
|
|
4614
|
+
ref: this.renderElementRef
|
|
4615
|
+
});
|
|
4616
|
+
} else if (this.props.renderer === 'canvas') {
|
|
4617
|
+
return _react["default"].createElement("canvas", {
|
|
4618
|
+
ref: this.renderElementRef
|
|
4619
|
+
});
|
|
4620
|
+
} else if (this.props.renderer === 'img') {
|
|
4621
|
+
return _react["default"].createElement("img", {
|
|
4622
|
+
ref: this.renderElementRef
|
|
4623
|
+
});
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
}]);
|
|
4627
|
+
|
|
4628
|
+
return Barcode;
|
|
4629
|
+
}(_react["default"].Component);
|
|
4630
|
+
|
|
4631
|
+
Barcode.propTypes = {
|
|
4632
|
+
value: _propTypes["default"].string.isRequired,
|
|
4633
|
+
renderer: _propTypes["default"].string,
|
|
4634
|
+
format: _propTypes["default"].string,
|
|
4635
|
+
width: _propTypes["default"].number,
|
|
4636
|
+
height: _propTypes["default"].number,
|
|
4637
|
+
displayValue: _propTypes["default"].bool,
|
|
4638
|
+
fontOptions: _propTypes["default"].string,
|
|
4639
|
+
font: _propTypes["default"].string,
|
|
4640
|
+
textAlign: _propTypes["default"].string,
|
|
4641
|
+
textPosition: _propTypes["default"].string,
|
|
4642
|
+
textMargin: _propTypes["default"].number,
|
|
4643
|
+
fontSize: _propTypes["default"].number,
|
|
4644
|
+
background: _propTypes["default"].string,
|
|
4645
|
+
lineColor: _propTypes["default"].string,
|
|
4646
|
+
margin: _propTypes["default"].number,
|
|
4647
|
+
marginTop: _propTypes["default"].number,
|
|
4648
|
+
marginBottom: _propTypes["default"].number,
|
|
4649
|
+
marginLeft: _propTypes["default"].number,
|
|
4650
|
+
marginRight: _propTypes["default"].number
|
|
4651
|
+
};
|
|
4652
|
+
Barcode.defaultProps = {
|
|
4653
|
+
format: 'CODE128',
|
|
4654
|
+
renderer: 'svg',
|
|
4655
|
+
width: 2,
|
|
4656
|
+
height: 100,
|
|
4657
|
+
displayValue: true,
|
|
4658
|
+
fontOptions: '',
|
|
4659
|
+
font: 'monospace',
|
|
4660
|
+
textAlign: 'center',
|
|
4661
|
+
textPosition: 'bottom',
|
|
4662
|
+
textMargin: 2,
|
|
4663
|
+
fontSize: 20,
|
|
4664
|
+
background: '#ffffff',
|
|
4665
|
+
lineColor: '#000000',
|
|
4666
|
+
margin: 10
|
|
4667
|
+
};
|
|
4668
|
+
var reactBarcode = Barcode;
|
|
4669
|
+
|
|
4670
|
+
const SchoolIDCard = ({
|
|
4671
|
+
userImage,
|
|
4672
|
+
userName,
|
|
4673
|
+
text = null,
|
|
4674
|
+
extraText,
|
|
4675
|
+
subjectInitials,
|
|
4676
|
+
subjectInitialsClass,
|
|
4677
|
+
showBarcode = true,
|
|
4678
|
+
backgroundImage,
|
|
4679
|
+
className,
|
|
4680
|
+
containerClassName
|
|
4681
|
+
}) => {
|
|
4682
|
+
let textEl = null;
|
|
4683
|
+
if (typeof text === "string") {
|
|
4684
|
+
textEl = /* @__PURE__ */ React__default["default"].createElement("h3", {
|
|
4685
|
+
className: "text-xs font-bold uppercase text-black"
|
|
4686
|
+
}, text);
|
|
4687
|
+
} else {
|
|
4688
|
+
textEl = text;
|
|
4689
|
+
}
|
|
4690
|
+
let issueeImageEl = null;
|
|
4691
|
+
const initialsClass = `subject-initials h-[70px] w-[70px] rounded-full mr-[10px] flex flex-row items-center justify-center h-full w-full overflow-hidden bg-emerald-700 text-white font-medium text-3xl ${subjectInitialsClass}`;
|
|
4692
|
+
if (userImage && (userImage == null ? void 0 : userImage.trim()) !== "") {
|
|
4693
|
+
issueeImageEl = /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4694
|
+
className: "h-[80px] w-[80px] rounded-full overflow-hidden bg-no-repeat bg-cover bg-center border-solid border-[2px] border-white mr-2",
|
|
4695
|
+
style: { backgroundImage: `url(${userImage})` }
|
|
4696
|
+
});
|
|
4697
|
+
} else if (subjectInitials && (!userImage || (userImage == null ? void 0 : userImage.trim()) === "")) {
|
|
4698
|
+
issueeImageEl = /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4699
|
+
className: initialsClass
|
|
4700
|
+
}, subjectInitials);
|
|
4701
|
+
}
|
|
4702
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4703
|
+
style: { backgroundImage: `url(${backgroundImage})` },
|
|
4704
|
+
className: `h-[200px] w-[320px] rounded-[20px] overflow-hidden ${className}`
|
|
4705
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4706
|
+
className: `h-full w-full flex items-center justify-start relative ${containerClassName}`
|
|
4707
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4708
|
+
className: "w-full flex justify-start items-center pl-3 mt-10"
|
|
4709
|
+
}, issueeImageEl, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4710
|
+
className: "h-full flex items-start justify-center flex-col mt-7"
|
|
4711
|
+
}, userName && /* @__PURE__ */ React__default["default"].createElement("p", {
|
|
4712
|
+
className: "text-sm text-black font-light"
|
|
4713
|
+
}, userName), textEl && textEl)), showBarcode && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4714
|
+
className: "barcode-container"
|
|
4715
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4716
|
+
className: "barcode-wrap"
|
|
4717
|
+
}, /* @__PURE__ */ React__default["default"].createElement(reactBarcode, {
|
|
4718
|
+
value: "barcode-example",
|
|
4719
|
+
height: "22px",
|
|
4720
|
+
width: "1px",
|
|
4721
|
+
fontSize: 0
|
|
4722
|
+
}))), extraText && /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement("p", {
|
|
4723
|
+
className: "absolute bottom-3 left-0 w-full flex items-center justify-center text-white text-xs font-semibold"
|
|
4724
|
+
}, extraText))));
|
|
4725
|
+
};
|
|
4726
|
+
|
|
4727
|
+
exports.SchoolIDCard = SchoolIDCard;
|
|
4728
|
+
//# sourceMappingURL=SchoolIDCard-1baf77e8.js.map
|