qrdx 0.0.49 → 0.0.51
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/README.md +123 -3
- package/dist/core.js +31 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +31 -0
- package/dist/core.mjs.map +1 -0
- package/dist/frames-index.js +1 -1
- package/dist/frames-index.js.map +1 -1
- package/dist/frames-index.mjs +1 -1
- package/dist/frames-index.mjs.map +1 -1
- package/dist/frames-official.js +1 -1
- package/dist/frames-official.js.map +1 -1
- package/dist/frames-official.mjs +1 -1
- package/dist/frames-official.mjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +3 -0
- package/dist/node.mjs.map +1 -0
- package/dist/qr-code-canvas.js +1 -1
- package/dist/qr-code-canvas.js.map +1 -1
- package/dist/qr-code-canvas.mjs +1 -1
- package/dist/qr-code-canvas.mjs.map +1 -1
- package/dist/src/api.d.ts +8 -2
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/art.d.ts +4 -3
- package/dist/src/art.d.ts.map +1 -1
- package/dist/src/body-patterns.d.ts +3 -2
- package/dist/src/body-patterns.d.ts.map +1 -1
- package/dist/src/core.d.ts +5 -0
- package/dist/src/core.d.ts.map +1 -0
- package/dist/src/corner-dot.d.ts +3 -2
- package/dist/src/corner-dot.d.ts.map +1 -1
- package/dist/src/engine.d.ts +44 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/export.d.ts +5 -0
- package/dist/src/export.d.ts.map +1 -0
- package/dist/src/frame.d.ts +6 -4
- package/dist/src/frame.d.ts.map +1 -1
- package/dist/src/frames/catalogue/all.d.ts.map +1 -1
- package/dist/src/frames/catalogue/automotive.d.ts +5 -0
- package/dist/src/frames/catalogue/automotive.d.ts.map +1 -0
- package/dist/src/frames/catalogue/beauty-wellness.d.ts +5 -0
- package/dist/src/frames/catalogue/beauty-wellness.d.ts.map +1 -0
- package/dist/src/frames/catalogue/business.d.ts.map +1 -1
- package/dist/src/frames/catalogue/call-to-action.d.ts.map +1 -1
- package/dist/src/frames/catalogue/counts.d.ts +12 -7
- package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
- package/dist/src/frames/catalogue/food-drink.d.ts.map +1 -1
- package/dist/src/frames/catalogue/health-learning.d.ts.map +1 -1
- package/dist/src/frames/catalogue/index.d.ts.map +1 -1
- package/dist/src/frames/catalogue/nonprofit.d.ts +5 -0
- package/dist/src/frames/catalogue/nonprofit.d.ts.map +1 -0
- package/dist/src/frames/catalogue/places.d.ts.map +1 -1
- package/dist/src/frames/catalogue/real-estate.d.ts +5 -0
- package/dist/src/frames/catalogue/real-estate.d.ts.map +1 -0
- package/dist/src/frames/catalogue/shopping.d.ts.map +1 -1
- package/dist/src/frames/catalogue/sports-fitness.d.ts +5 -0
- package/dist/src/frames/catalogue/sports-fitness.d.ts.map +1 -0
- package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
- package/dist/src/frames/collections.d.ts.map +1 -1
- package/dist/src/frames/official-types.d.ts +1 -1
- package/dist/src/frames/official-types.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -37
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/jsx/index.d.ts +2 -0
- package/dist/src/jsx/index.d.ts.map +1 -0
- package/dist/src/jsx/jsx-dev-runtime.d.ts +5 -0
- package/dist/src/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/src/jsx/jsx-runtime.d.ts +30 -0
- package/dist/src/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/src/jsx/runtime.d.ts +73 -0
- package/dist/src/jsx/runtime.d.ts.map +1 -0
- package/dist/src/logo.d.ts +3 -2
- package/dist/src/logo.d.ts.map +1 -1
- package/dist/src/node.d.ts +23 -0
- package/dist/src/node.d.ts.map +1 -0
- package/dist/src/part-markers.d.ts +15 -0
- package/dist/src/part-markers.d.ts.map +1 -0
- package/dist/src/plain.d.ts +31 -0
- package/dist/src/plain.d.ts.map +1 -0
- package/dist/src/qr-code-canvas.d.ts +1 -1
- package/dist/src/qr-code-canvas.d.ts.map +1 -1
- package/dist/src/qr-code-props.d.ts +22 -0
- package/dist/src/qr-code-props.d.ts.map +1 -0
- package/dist/src/qr-code-svg.d.ts +10 -0
- package/dist/src/qr-code-svg.d.ts.map +1 -0
- package/dist/src/qr-code.d.ts +2 -10
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/rasterize.d.ts +25 -0
- package/dist/src/rasterize.d.ts.map +1 -0
- package/dist/src/react-elements.d.ts +3 -0
- package/dist/src/react-elements.d.ts.map +1 -0
- package/dist/src/render/attributes.d.ts +33 -0
- package/dist/src/render/attributes.d.ts.map +1 -0
- package/dist/src/render/dom.d.ts +8 -0
- package/dist/src/render/dom.d.ts.map +1 -0
- package/dist/src/render/hyperscript.d.ts +10 -0
- package/dist/src/render/hyperscript.d.ts.map +1 -0
- package/dist/src/render/string.d.ts +8 -0
- package/dist/src/render/string.d.ts.map +1 -0
- package/dist/src/svg.d.ts +14 -0
- package/dist/src/svg.d.ts.map +1 -0
- package/dist/src/template/arrow.d.ts +1 -0
- package/dist/src/template/arrow.d.ts.map +1 -1
- package/dist/src/template/default.d.ts +1 -0
- package/dist/src/template/default.d.ts.map +1 -1
- package/dist/src/template/halloween.d.ts +1 -0
- package/dist/src/template/halloween.d.ts.map +1 -1
- package/dist/src/template/square-border.d.ts +1 -0
- package/dist/src/template/square-border.d.ts.map +1 -1
- package/dist/src/template/standard-box.d.ts +1 -0
- package/dist/src/template/standard-box.d.ts.map +1 -1
- package/dist/src/template/striked-box.d.ts +1 -0
- package/dist/src/template/striked-box.d.ts.map +1 -1
- package/dist/src/utils.d.ts +9 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/vanilla-api.d.ts +47 -0
- package/dist/src/vanilla-api.d.ts.map +1 -0
- package/dist/src/vanilla-browser.d.ts +4 -0
- package/dist/src/vanilla-browser.d.ts.map +1 -0
- package/dist/src/vanilla.d.ts +4 -0
- package/dist/src/vanilla.d.ts.map +1 -0
- package/dist/src/vue.d.ts +56 -0
- package/dist/src/vue.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.mjs +2 -2
- package/dist/types/public.d.ts +3 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/qr.d.ts +18 -4
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/react.d.ts +5 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/template.d.ts +7 -1
- package/dist/types/template.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +92 -0
- package/dist/vanilla.browser.mjs.map +1 -0
- package/dist/vanilla.js +2 -0
- package/dist/vanilla.js.map +1 -0
- package/dist/vanilla.mjs +2 -0
- package/dist/vanilla.mjs.map +1 -0
- package/dist/vue.js +2 -0
- package/dist/vue.js.map +1 -0
- package/dist/vue.mjs +2 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +71 -6
- package/src/api.tsx +16 -139
- package/src/art.tsx +18 -16
- package/src/body-patterns.tsx +5 -3
- package/src/core.ts +13 -0
- package/src/corner-dot.tsx +4 -2
- package/src/download.tsx +1 -1
- package/src/engine.ts +170 -0
- package/src/export.ts +212 -0
- package/src/frame.tsx +7 -6
- package/src/frames/catalogue/all.ts +606 -0
- package/src/frames/catalogue/automotive.ts +61 -0
- package/src/frames/catalogue/beauty-wellness.ts +61 -0
- package/src/frames/catalogue/business.ts +68 -0
- package/src/frames/catalogue/call-to-action.ts +60 -0
- package/src/frames/catalogue/counts.ts +12 -7
- package/src/frames/catalogue/food-drink.ts +78 -0
- package/src/frames/catalogue/health-learning.ts +62 -14
- package/src/frames/catalogue/index.ts +2440 -16
- package/src/frames/catalogue/nonprofit.ts +65 -0
- package/src/frames/catalogue/places.ts +0 -18
- package/src/frames/catalogue/real-estate.ts +79 -0
- package/src/frames/catalogue/shopping.ts +68 -0
- package/src/frames/catalogue/sports-fitness.ts +81 -0
- package/src/frames/catalogue/tags.ts +354 -0
- package/src/frames/collections.ts +5 -0
- package/src/frames/official/add-engraving.json +90 -0
- package/src/frames/official/add-to-calendar.json +98 -0
- package/src/frames/official/adopt-me.json +72 -0
- package/src/frames/official/aftercare-guide.json +98 -0
- package/src/frames/official/alterations.json +142 -0
- package/src/frames/official/annual-report.json +85 -0
- package/src/frames/official/archery-lesson.json +106 -0
- package/src/frames/official/arrival-guide.json +71 -0
- package/src/frames/official/art-class.json +137 -0
- package/src/frames/official/ask-a-stylist.json +112 -0
- package/src/frames/official/assembly-guide.json +93 -0
- package/src/frames/official/badminton-session.json +104 -0
- package/src/frames/official/bake-sale.json +158 -0
- package/src/frames/official/bakery-board.json +80 -0
- package/src/frames/official/barber-booking.json +64 -0
- package/src/frames/official/bath-ritual.json +70 -0
- package/src/frames/official/bathroom-showroom.json +113 -0
- package/src/frames/official/battery-check.json +95 -0
- package/src/frames/official/beauty-rewards.json +81 -0
- package/src/frames/official/become-a-member.json +79 -0
- package/src/frames/official/bike-service.json +113 -0
- package/src/frames/official/book-a-call.json +105 -0
- package/src/frames/official/book-a-cleaning.json +92 -0
- package/src/frames/official/book-a-consultation.json +101 -0
- package/src/frames/official/book-a-court.json +74 -0
- package/src/frames/official/book-a-facial.json +108 -0
- package/src/frames/official/book-a-massage.json +80 -0
- package/src/frames/official/book-a-vaccine.json +88 -0
- package/src/frames/official/book-this-room.json +80 -0
- package/src/frames/official/boxing-class.json +81 -0
- package/src/frames/official/brewery-tour.json +89 -0
- package/src/frames/official/bridal-beauty.json +80 -0
- package/src/frames/official/brunch-menu.json +79 -0
- package/src/frames/official/bubble-tea.json +81 -0
- package/src/frames/official/bulk-orders.json +108 -0
- package/src/frames/official/burger-order.json +80 -0
- package/src/frames/official/call-a-server.json +115 -0
- package/src/frames/official/car-detailing.json +102 -0
- package/src/frames/official/car-details.json +90 -0
- package/src/frames/official/car-for-sale.json +74 -0
- package/src/frames/official/car-service.json +92 -0
- package/src/frames/official/carpool.json +79 -0
- package/src/frames/official/catering-order.json +79 -0
- package/src/frames/official/charging-prices.json +105 -0
- package/src/frames/official/charity-shop.json +75 -0
- package/src/frames/official/check-symptoms.json +80 -0
- package/src/frames/official/cheese-pairing.json +91 -0
- package/src/frames/official/chess-club.json +64 -0
- package/src/frames/official/chess-lessons.json +83 -0
- package/src/frames/official/choose-your-plan.json +113 -0
- package/src/frames/official/choose-your-wash.json +86 -0
- package/src/frames/official/clean-beauty.json +94 -0
- package/src/frames/official/click-and-collect.json +85 -0
- package/src/frames/official/clock-in.json +101 -0
- package/src/frames/official/club-fees.json +94 -0
- package/src/frames/official/coach-sign-up.json +108 -0
- package/src/frames/official/community-notices.json +107 -0
- package/src/frames/official/compare-specs.json +112 -0
- package/src/frames/official/consultation-form.json +120 -0
- package/src/frames/official/continued-online.json +81 -0
- package/src/frames/official/cookie-box.json +88 -0
- package/src/frames/official/cooking-class.json +89 -0
- package/src/frames/official/coworking-pass.json +89 -0
- package/src/frames/official/cricket-club.json +158 -0
- package/src/frames/official/cupcake-order.json +108 -0
- package/src/frames/official/damage-report.json +114 -0
- package/src/frames/official/dashboard-lights.json +106 -0
- package/src/frames/official/delivery-instructions.json +98 -0
- package/src/frames/official/diy-how-to.json +87 -0
- package/src/frames/official/donate-coats.json +74 -0
- package/src/frames/official/donate-food.json +80 -0
- package/src/frames/official/donation-jar.json +101 -0
- package/src/frames/official/donut-shop.json +94 -0
- package/src/frames/official/dress-fitting.json +64 -0
- package/src/frames/official/driving-lessons.json +110 -0
- package/src/frames/official/dumpling-house.json +82 -0
- package/src/frames/official/eye-exam.json +70 -0
- package/src/frames/official/eyewear-try-on.json +99 -0
- package/src/frames/official/fan-club.json +152 -0
- package/src/frames/official/farm-stand.json +109 -0
- package/src/frames/official/farmers-market.json +74 -0
- package/src/frames/official/find-a-charger.json +107 -0
- package/src/frames/official/find-a-doctor.json +85 -0
- package/src/frames/official/find-it-in-store.json +101 -0
- package/src/frames/official/find-our-office.json +80 -0
- package/src/frames/official/first-aid-guide.json +109 -0
- package/src/frames/official/fish-market.json +113 -0
- package/src/frames/official/fitness-challenge.json +1 -1
- package/src/frames/official/fitness-equipment.json +1 -1
- package/src/frames/official/fitness-kettlebell.json +1 -1
- package/src/frames/official/fitness-schedule.json +1 -1
- package/src/frames/official/fitness-test.json +94 -0
- package/src/frames/official/fitness-timer.json +1 -1
- package/src/frames/official/fitness-trial.json +1 -1
- package/src/frames/official/fitness-yoga.json +1 -1
- package/src/frames/official/food-support.json +102 -0
- package/src/frames/official/food-truck-location.json +80 -0
- package/src/frames/official/furnished-rental.json +101 -0
- package/src/frames/official/game-night.json +79 -0
- package/src/frames/official/garden-design.json +70 -0
- package/src/frames/official/garden-plot.json +74 -0
- package/src/frames/official/get-a-quote.json +113 -0
- package/src/frames/official/get-it-delivered.json +82 -0
- package/src/frames/official/get-started-rocket.json +80 -0
- package/src/frames/official/get-the-brochure.json +116 -0
- package/src/frames/official/gift-ideas.json +86 -0
- package/src/frames/official/gift-message.json +85 -0
- package/src/frames/official/give-blood.json +88 -0
- package/src/frames/official/giving-jar.json +89 -0
- package/src/frames/official/golf-scorecard.json +120 -0
- package/src/frames/official/grand-opening.json +158 -0
- package/src/frames/official/grill-menu.json +92 -0
- package/src/frames/official/hand-washing.json +106 -0
- package/src/frames/official/handyman.json +130 -0
- package/src/frames/official/hear-it-spoken.json +86 -0
- package/src/frames/official/home-valuation.json +87 -0
- package/src/frames/official/homework-help.json +79 -0
- package/src/frames/official/hot-shave.json +121 -0
- package/src/frames/official/house-rules.json +121 -0
- package/src/frames/official/how-it-works.json +98 -0
- package/src/frames/official/how-to-apply.json +93 -0
- package/src/frames/official/impact-report.json +90 -0
- package/src/frames/official/intake-forms.json +114 -0
- package/src/frames/official/join-a-league.json +94 -0
- package/src/frames/official/join-the-cleanup.json +110 -0
- package/src/frames/official/join-the-waitlist.json +102 -0
- package/src/frames/official/join-the-webinar.json +108 -0
- package/src/frames/official/juice-bar.json +70 -0
- package/src/frames/official/kids-haircuts.json +75 -0
- package/src/frames/official/kids-menu.json +107 -0
- package/src/frames/official/large-print.json +80 -0
- package/src/frames/official/lash-bar.json +86 -0
- package/src/frames/official/last-chance.json +94 -0
- package/src/frames/official/late-night-menu.json +77 -0
- package/src/frames/official/learn-the-signs.json +107 -0
- package/src/frames/official/library-card.json +90 -0
- package/src/frames/official/live-scores.json +101 -0
- package/src/frames/official/lost-and-found.json +85 -0
- package/src/frames/official/lost-pet-tag.json +84 -0
- package/src/frames/official/make-a-claim.json +74 -0
- package/src/frames/official/makeup-artist.json +94 -0
- package/src/frames/official/math-practice.json +136 -0
- package/src/frames/official/meal-plan.json +121 -0
- package/src/frames/official/meet-the-maker.json +91 -0
- package/src/frames/official/meet-the-team.json +82 -0
- package/src/frames/official/membership-card.json +108 -0
- package/src/frames/official/mortgage-calculator.json +94 -0
- package/src/frames/official/moving-checklist.json +108 -0
- package/src/frames/official/music-lessons.json +64 -0
- package/src/frames/official/nail-studio.json +70 -0
- package/src/frames/official/neighborhood-guide.json +98 -0
- package/src/frames/official/nutrition-facts.json +98 -0
- package/src/frames/official/online-class.json +82 -0
- package/src/frames/official/open-an-account.json +88 -0
- package/src/frames/official/open-house-sign-in.json +104 -0
- package/src/frames/official/parcel-room.json +98 -0
- package/src/frames/official/parent-meeting.json +108 -0
- package/src/frames/official/parking-permit.json +74 -0
- package/src/frames/official/pay-at-the-pump.json +108 -0
- package/src/frames/official/pay-for-parking.json +89 -0
- package/src/frames/official/pay-it-forward.json +102 -0
- package/src/frames/official/pay-your-rent.json +105 -0
- package/src/frames/official/permission-form.json +120 -0
- package/src/frames/official/personal-trainer.json +76 -0
- package/src/frames/official/physio-exercises.json +86 -0
- package/src/frames/official/pick-your-own.json +158 -0
- package/src/frames/official/plant-a-tree.json +88 -0
- package/src/frames/official/plant-based-menu.json +103 -0
- package/src/frames/official/plant-care.json +84 -0
- package/src/frames/official/podcast.json +107 -0
- package/src/frames/official/polling-place.json +109 -0
- package/src/frames/official/pool-timetable.json +113 -0
- package/src/frames/official/portfolio-card.json +110 -0
- package/src/frames/official/pre-order-bread.json +110 -0
- package/src/frames/official/press-kit.json +136 -0
- package/src/frames/official/price-list.json +111 -0
- package/src/frames/official/privacy-notice.json +115 -0
- package/src/frames/official/property-floor-plan.json +1 -1
- package/src/frames/official/property-for-sale.json +1 -1
- package/src/frames/official/property-house-light.json +1 -1
- package/src/frames/official/property-house.json +1 -1
- package/src/frames/official/property-key.json +1 -1
- package/src/frames/official/property-open-house.json +1 -1
- package/src/frames/official/property-rent.json +1 -1
- package/src/frames/official/property-virtual-tour.json +1 -1
- package/src/frames/official/questions-cloud.json +65 -0
- package/src/frames/official/race-entry.json +90 -0
- package/src/frames/official/race-photos.json +93 -0
- package/src/frames/official/rate-your-ride.json +103 -0
- package/src/frames/official/read-a-sample.json +108 -0
- package/src/frames/official/read-the-ebook.json +116 -0
- package/src/frames/official/read-the-faq.json +88 -0
- package/src/frames/official/read-the-reviews.json +110 -0
- package/src/frames/official/read-the-story.json +90 -0
- package/src/frames/official/read-the-transcript.json +142 -0
- package/src/frames/official/reading-challenge.json +97 -0
- package/src/frames/official/rebook-visit.json +86 -0
- package/src/frames/official/recipe-card.json +120 -0
- package/src/frames/official/refill-reminder.json +104 -0
- package/src/frames/official/register-interest.json +82 -0
- package/src/frames/official/register-to-vote.json +80 -0
- package/src/frames/official/renovation-quote.json +80 -0
- package/src/frames/official/rent-a-bike.json +95 -0
- package/src/frames/official/rent-this-item.json +95 -0
- package/src/frames/official/rental-car-guide.json +115 -0
- package/src/frames/official/report-a-problem.json +114 -0
- package/src/frames/official/report-a-repair.json +79 -0
- package/src/frames/official/report-a-street-issue.json +113 -0
- package/src/frames/official/request-maintenance.json +74 -0
- package/src/frames/official/resident-portal.json +98 -0
- package/src/frames/official/restaurant-gift-card.json +94 -0
- package/src/frames/official/restock-alert.json +98 -0
- package/src/frames/official/restroom-feedback.json +86 -0
- package/src/frames/official/return-your-cup.json +130 -0
- package/src/frames/official/return-your-rental.json +113 -0
- package/src/frames/official/ring-size.json +107 -0
- package/src/frames/official/roadside-help.json +92 -0
- package/src/frames/official/run-club.json +79 -0
- package/src/frames/official/safety-information.json +92 -0
- package/src/frames/official/salon-prices.json +92 -0
- package/src/frames/official/save-for-later.json +79 -0
- package/src/frames/official/scan-for-the-answer.json +86 -0
- package/src/frames/official/scan-for-the-checklist.json +108 -0
- package/src/frames/official/scan-for-the-latest.json +74 -0
- package/src/frames/official/scan-for-translations.json +108 -0
- package/src/frames/official/scan-here-arrow.json +76 -0
- package/src/frames/official/scan-here-post.json +89 -0
- package/src/frames/official/scan-me-banner.json +147 -0
- package/src/frames/official/scan-me-cloud.json +73 -0
- package/src/frames/official/scan-me-folded.json +74 -0
- package/src/frames/official/scan-me-stack.json +93 -0
- package/src/frames/official/scan-to-unlock.json +107 -0
- package/src/frames/official/scent-finder.json +94 -0
- package/src/frames/official/scholarships.json +108 -0
- package/src/frames/official/school-supply-list.json +80 -0
- package/src/frames/official/science-fair.json +89 -0
- package/src/frames/official/season-schedule.json +66 -0
- package/src/frames/official/see-more-stack.json +91 -0
- package/src/frames/official/see-our-pitch.json +85 -0
- package/src/frames/official/see-the-full-list.json +107 -0
- package/src/frames/official/see-the-map.json +79 -0
- package/src/frames/official/send-flowers.json +93 -0
- package/src/frames/official/service-times.json +115 -0
- package/src/frames/official/shade-finder.json +113 -0
- package/src/frames/official/shoe-size-check.json +95 -0
- package/src/frames/official/sign-rider.json +1 -1
- package/src/frames/official/sign-the-agreement.json +120 -0
- package/src/frames/official/sign-the-petition.json +120 -0
- package/src/frames/official/site-hoarding.json +158 -0
- package/src/frames/official/site-induction.json +120 -0
- package/src/frames/official/size-guide.json +80 -0
- package/src/frames/official/skate-park-rules.json +109 -0
- package/src/frames/official/skincare-routine.json +85 -0
- package/src/frames/official/sofa-fabric.json +84 -0
- package/src/frames/official/spa-gift.json +90 -0
- package/src/frames/official/spa-menu.json +124 -0
- package/src/frames/official/split-the-bill.json +77 -0
- package/src/frames/official/sponsor-a-pet.json +102 -0
- package/src/frames/official/sponsor-my-run.json +136 -0
- package/src/frames/official/sports-camp.json +142 -0
- package/src/frames/official/staff-handbook.json +121 -0
- package/src/frames/official/staff-rota.json +112 -0
- package/src/frames/official/start-a-return.json +92 -0
- package/src/frames/official/start-charging.json +104 -0
- package/src/frames/official/start-here-arrow.json +79 -0
- package/src/frames/official/start-saving.json +74 -0
- package/src/frames/official/storage-units.json +79 -0
- package/src/frames/official/student-portal.json +80 -0
- package/src/frames/official/style-gallery.json +111 -0
- package/src/frames/official/sushi-menu.json +115 -0
- package/src/frames/official/swim-lessons.json +70 -0
- package/src/frames/official/table-tennis.json +116 -0
- package/src/frames/official/take-a-closer-look.json +94 -0
- package/src/frames/official/takeout-order.json +98 -0
- package/src/frames/official/talk-to-someone.json +115 -0
- package/src/frames/official/talk-to-the-agent.json +115 -0
- package/src/frames/official/tea-menu.json +70 -0
- package/src/frames/official/tea-time.json +124 -0
- package/src/frames/official/team-jersey.json +77 -0
- package/src/frames/official/team-kit.json +85 -0
- package/src/frames/official/tee-time.json +85 -0
- package/src/frames/official/tennis-court.json +94 -0
- package/src/frames/official/test-drive.json +88 -0
- package/src/frames/official/test-results.json +85 -0
- package/src/frames/official/tire-change.json +74 -0
- package/src/frames/official/town-hall.json +158 -0
- package/src/frames/official/toy-finder.json +81 -0
- package/src/frames/official/trace-your-coffee.json +87 -0
- package/src/frames/official/trade-it-in.json +97 -0
- package/src/frames/official/try-the-demo.json +106 -0
- package/src/frames/official/unlock-this-car.json +82 -0
- package/src/frames/official/upload-receipts.json +108 -0
- package/src/frames/official/validate-parking.json +91 -0
- package/src/frames/official/vehicle-history.json +106 -0
- package/src/frames/official/virtual-try-on.json +93 -0
- package/src/frames/official/visiting-hours.json +90 -0
- package/src/frames/official/visitor-map.json +92 -0
- package/src/frames/official/visitor-sign-in.json +98 -0
- package/src/frames/official/volunteer.json +74 -0
- package/src/frames/official/vote-for-us.json +103 -0
- package/src/frames/official/walk-in-queue.json +102 -0
- package/src/frames/official/wash-club.json +81 -0
- package/src/frames/official/watch-repair.json +115 -0
- package/src/frames/official/watch-the-experiment.json +93 -0
- package/src/frames/official/water-refill.json +95 -0
- package/src/frames/official/weekly-deals.json +107 -0
- package/src/frames/official/wellness-retreat.json +85 -0
- package/src/frames/official/whats-inside.json +91 -0
- package/src/frames/official/wholesale.json +85 -0
- package/src/frames/official/window-quote.json +121 -0
- package/src/frames/official/wine-pairings.json +142 -0
- package/src/frames/official/wine-staff-pick.json +100 -0
- package/src/frames/official/winery-tasting.json +94 -0
- package/src/frames/official/yard-sign-coming-soon.json +115 -0
- package/src/frames/official/yard-sign-for-sale.json +150 -0
- package/src/frames/official/yard-sign-sold.json +162 -0
- package/src/frames/official/yard-sign-viewing.json +121 -0
- package/src/frames/official/your-prescription.json +107 -0
- package/src/frames/official/youth-club.json +104 -0
- package/src/frames/official-types.ts +6 -1
- package/src/frames/official.ts +4 -4
- package/src/index.tsx +6 -352
- package/src/jsx/index.ts +3 -0
- package/src/jsx/jsx-dev-runtime.ts +14 -0
- package/src/jsx/jsx-runtime.ts +34 -0
- package/src/jsx/runtime.ts +209 -0
- package/src/logo.tsx +5 -3
- package/src/node.ts +61 -0
- package/src/part-markers.ts +40 -0
- package/src/plain.tsx +194 -0
- package/src/qr-code-canvas.tsx +2 -1
- package/src/qr-code-props.ts +115 -0
- package/src/qr-code-svg.tsx +17 -0
- package/src/qr-code.tsx +34 -112
- package/src/rasterize.ts +282 -0
- package/src/react-elements.ts +13 -0
- package/src/render/attributes.ts +404 -0
- package/src/render/dom.ts +90 -0
- package/src/render/hyperscript.ts +66 -0
- package/src/render/string.ts +70 -0
- package/src/scan-score.ts +1 -1
- package/src/svg.ts +27 -0
- package/src/template/arrow.tsx +1 -0
- package/src/template/default.tsx +1 -0
- package/src/template/halloween.tsx +1 -0
- package/src/template/square-border.tsx +1 -0
- package/src/template/standard-box.tsx +1 -0
- package/src/template/striked-box.tsx +1 -0
- package/src/utils/print-shared.ts +1 -1
- package/src/utils.tsx +82 -38
- package/src/vanilla-api.ts +146 -0
- package/src/vanilla-browser.ts +11 -0
- package/src/vanilla.ts +10 -0
- package/src/vue.ts +220 -0
- package/types/index.ts +4 -2
- package/types/public.ts +4 -0
- package/types/qr.ts +24 -5
- package/types/react.ts +8 -0
- package/types/template.ts +10 -3
package/dist/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use strict';var zod=require('zod');var Y;(R=>{class e{constructor(n,r,t,o){this.version=n;this.errorCorrectionLevel=r;if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=n*4+17;let a=[];for(let m=0;m<this.size;m++)a.push(false);for(let m=0;m<this.size;m++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(t);if(this.drawCodewords(p),o==-1){let m=1e9;for(let f=0;f<8;f++){this.applyMask(f),this.drawFormatBits(f);let h=this.getPenaltyScore();h<m&&(o=f,m=h),this.applyMask(f);}}l(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[];}version;errorCorrectionLevel;static encodeText(n,r){let t=R.QrSegment.makeSegments(n);return e.encodeSegments(t,r)}static encodeBinary(n,r){let t=R.QrSegment.makeBytes(n);return e.encodeSegments([t],r)}static encodeSegments(n,r,t=1,o=40,a=-1,p=true){if(!(e.MIN_VERSION<=t&&t<=o&&o<=e.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let m,f;for(m=t;;m++){let y=e.getNumDataCodewords(m,r)*8,A=u.getTotalBits(n,m);if(A<=y){f=A;break}if(m>=o)throw new RangeError("Data too long")}for(let y of [e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])p&&f<=e.getNumDataCodewords(m,y)*8&&(r=y);let h=[];for(let y of n){i(y.mode.modeBits,4,h),i(y.numChars,y.mode.numCharCountBits(m),h);for(let A of y.getData())h.push(A);}l(h.length==f);let S=e.getNumDataCodewords(m,r)*8;l(h.length<=S),i(0,Math.min(4,S-h.length),h),i(0,(8-h.length%8)%8,h),l(h.length%8==0);for(let y=236;h.length<S;y^=253)i(y,8,h);let c=[];for(;c.length*8<h.length;)c.push(0);return h.forEach((y,A)=>c[A>>>3]|=y<<7-(A&7)),new e(m,r,c,a)}size;mask;modules=[];isFunction=[];getModule(n,r){return 0<=n&&n<this.size&&0<=r&&r<this.size&&this.modules[r][n]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let n=this.getAlignmentPatternPositions(),r=n.length;for(let t=0;t<r;t++)for(let o=0;o<r;o++)t==0&&o==0||t==0&&o==r-1||t==r-1&&o==0||this.drawAlignmentPattern(n[t],n[o]);this.drawFormatBits(0),this.drawVersion();}drawFormatBits(n){let r=this.errorCorrectionLevel.formatBits<<3|n,t=r;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;let o=(r<<10|t)^21522;l(o>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,s(o,a));this.setFunctionModule(8,7,s(o,6)),this.setFunctionModule(8,8,s(o,7)),this.setFunctionModule(7,8,s(o,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,s(o,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,s(o,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,s(o,a));this.setFunctionModule(8,this.size-8,true);}drawVersion(){if(this.version<7)return;let n=this.version;for(let t=0;t<12;t++)n=n<<1^(n>>>11)*7973;let r=this.version<<12|n;l(r>>>18==0);for(let t=0;t<18;t++){let o=s(r,t),a=this.size-11+t%3,p=Math.floor(t/3);this.setFunctionModule(a,p,o),this.setFunctionModule(p,a,o);}}drawFinderPattern(n,r){for(let t=-4;t<=4;t++)for(let o=-4;o<=4;o++){let a=Math.max(Math.abs(o),Math.abs(t)),p=n+o,m=r+t;0<=p&&p<this.size&&0<=m&&m<this.size&&this.setFunctionModule(p,m,a!=2&&a!=4);}}drawAlignmentPattern(n,r){for(let t=-2;t<=2;t++)for(let o=-2;o<=2;o++)this.setFunctionModule(n+o,r+t,Math.max(Math.abs(o),Math.abs(t))!=1);}setFunctionModule(n,r,t){this.modules[r][n]=t,this.isFunction[r][n]=true;}addEccAndInterleave(n){let r=this.version,t=this.errorCorrectionLevel;if(n.length!=e.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");let o=e.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],a=e.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],p=Math.floor(e.getNumRawDataModules(r)/8),m=o-p%o,f=Math.floor(p/o),h=[],S=e.reedSolomonComputeDivisor(a);for(let y=0,A=0;y<o;y++){let T=n.slice(A,A+f-a+(y<m?0:1));A+=T.length;let M=e.reedSolomonComputeRemainder(T,S);y<m&&T.push(0),h.push(T.concat(M));}let c=[];for(let y=0;y<h[0].length;y++)h.forEach((A,T)=>{(y!=f-a||T>=m)&&c.push(A[y]);});return l(c.length==p),c}drawCodewords(n){if(n.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let o=0;o<this.size;o++)for(let a=0;a<2;a++){let p=t-a,f=(t+1&2)==0?this.size-1-o:o;!this.isFunction[f][p]&&r<n.length*8&&(this.modules[f][p]=s(n[r>>>3],7-(r&7)),r++);}}l(r==n.length*8);}applyMask(n){if(n<0||n>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let t=0;t<this.size;t++){let o;switch(n){case 0:o=(t+r)%2==0;break;case 1:o=r%2==0;break;case 2:o=t%3==0;break;case 3:o=(t+r)%3==0;break;case 4:o=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:o=t*r%2+t*r%3==0;break;case 6:o=(t*r%2+t*r%3)%2==0;break;case 7:o=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&o&&(this.modules[r][t]=!this.modules[r][t]);}}getPenaltyScore(){let n=0;for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[a][h]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[a][h],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][a]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[h][a],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size-1;a++)for(let p=0;p<this.size-1;p++){let m=this.modules[a][p];m==this.modules[a][p+1]&&m==this.modules[a+1][p]&&m==this.modules[a+1][p+1]&&(n+=e.PENALTY_N2);}let r=0;for(let a of this.modules)r=a.reduce((p,m)=>p+(m?1:0),r);let t=this.size*this.size,o=Math.ceil(Math.abs(r*20-t*10)/t)-1;return l(0<=o&&o<=9),n+=o*e.PENALTY_N4,l(0<=n&&n<=2568888),n}getAlignmentPatternPositions(){if(this.version==1)return [];{let n=Math.floor(this.version/7)+2,r=this.version==32?26:Math.ceil((this.version*4+4)/(n*2-2))*2,t=[6];for(let o=this.size-7;t.length<n;o-=r)t.splice(1,0,o);return t}}static getNumRawDataModules(n){if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*n+128)*n+64;if(n>=2){let t=Math.floor(n/7)+2;r-=(25*t-10)*t-55,n>=7&&(r-=36);}return l(208<=r&&r<=29648),r}static getNumDataCodewords(n,r){return Math.floor(e.getNumRawDataModules(n)/8)-e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n]*e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n]}static reedSolomonComputeDivisor(n){if(n<1||n>255)throw new RangeError("Degree out of range");let r=[];for(let o=0;o<n-1;o++)r.push(0);r.push(1);let t=1;for(let o=0;o<n;o++){for(let a=0;a<r.length;a++)r[a]=e.reedSolomonMultiply(r[a],t),a+1<r.length&&(r[a]^=r[a+1]);t=e.reedSolomonMultiply(t,2);}return r}static reedSolomonComputeRemainder(n,r){let t=r.map(o=>0);for(let o of n){let a=o^t.shift();t.push(0),r.forEach((p,m)=>t[m]^=e.reedSolomonMultiply(p,a));}return t}static reedSolomonMultiply(n,r){if(n>>>8||r>>>8)throw new RangeError("Byte out of range");let t=0;for(let o=7;o>=0;o--)t=t<<1^(t>>>7)*285,t^=(r>>>o&1)*n;return l(t>>>8==0),t}finderPenaltyCountPatterns(n){let r=n[1];l(r<=this.size*3);let t=r>0&&n[2]==r&&n[3]==r*3&&n[4]==r&&n[5]==r;return (t&&n[0]>=r*4&&n[6]>=r?1:0)+(t&&n[6]>=r*4&&n[0]>=r?1:0)}finderPenaltyTerminateAndCount(n,r,t){return n&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(n,r){r[0]==0&&(n+=this.size),r.pop(),r.unshift(n);}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}R.QrCode=e;function i(b,n,r){if(n<0||n>31||b>>>n)throw new RangeError("Value out of range");for(let t=n-1;t>=0;t--)r.push(b>>>t&1);}function s(b,n){return (b>>>n&1)!=0}function l(b){if(!b)throw new Error("Assertion error")}class u{constructor(n,r,t){this.mode=n;this.numChars=r;this.bitData=t;if(r<0)throw new RangeError("Invalid argument");this.bitData=t.slice();}mode;numChars;bitData;static makeBytes(n){let r=[];for(let t of n)i(t,8,r);return new u(u.Mode.BYTE,n.length,r)}static makeNumeric(n){if(!u.isNumeric(n))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<n.length;){let o=Math.min(n.length-t,3);i(parseInt(n.substr(t,o),10),o*3+1,r),t+=o;}return new u(u.Mode.NUMERIC,n.length,r)}static makeAlphanumeric(n){if(!u.isAlphanumeric(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],t;for(t=0;t+2<=n.length;t+=2){let o=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t))*45;o+=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t+1)),i(o,11,r);}return t<n.length&&i(u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t)),6,r),new u(u.Mode.ALPHANUMERIC,n.length,r)}static makeSegments(n){return n==""?[]:u.isNumeric(n)?[u.makeNumeric(n)]:u.isAlphanumeric(n)?[u.makeAlphanumeric(n)]:[u.makeBytes(u.toUtf8ByteArray(n))]}static makeEci(n){let r=[];if(n<0)throw new RangeError("ECI assignment value out of range");if(n<128)i(n,8,r);else if(n<16384)i(2,2,r),i(n,14,r);else if(n<1e6)i(6,3,r),i(n,21,r);else throw new RangeError("ECI assignment value out of range");return new u(u.Mode.ECI,0,r)}static isNumeric(n){return u.NUMERIC_REGEX.test(n)}static isAlphanumeric(n){return u.ALPHANUMERIC_REGEX.test(n)}getData(){return this.bitData.slice()}static getTotalBits(n,r){let t=0;for(let o of n){let a=o.mode.numCharCountBits(r);if(o.numChars>=1<<a)return 1/0;t+=4+a+o.bitData.length;}return t}static toUtf8ByteArray(n){n=encodeURI(n);let r=[];for(let t=0;t<n.length;t++)n.charAt(t)!="%"?r.push(n.charCodeAt(t)):(r.push(parseInt(n.substr(t+1,2),16)),t+=2);return r}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}R.QrSegment=u;})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.ordinal=R;this.formatBits=b;}ordinal;formatBits;static LOW=new s(0,1);static MEDIUM=new s(1,0);static QUARTILE=new s(2,3);static HIGH=new s(3,2)}l.Ecc=s;})(i.QrCode||={});})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.modeBits=R;this.numBitsCharCount=b;}modeBits;numBitsCharCount;static NUMERIC=new s(1,[10,12,14]);static ALPHANUMERIC=new s(2,[9,11,13]);static BYTE=new s(4,[8,16,16]);static KANJI=new s(8,[8,10,12]);static ECI=new s(7,[0,0,0]);numCharCountBits(R){return this.numBitsCharCount[Math.floor((R+7)/17)]}}l.Mode=s;})(i.QrSegment||={});})(Y||={});var $=Y;({L:$.QrCode.Ecc.LOW,M:$.QrCode.Ecc.MEDIUM,Q:$.QrCode.Ecc.QUARTILE,H:$.QrCode.Ecc.HIGH});var Nt=0;function _t(e,i="#000000"){return e?typeof e=="string"?e:e.type==="solid"?e.color:e.type==="image"?e.underlay||i:(e.type==="linear"||e.type==="radial"||e.type==="angular")&&e.stops[0]?.color||i:i}var Te=["logo","halftone"],Le=zod.z.enum(Te),se={logo:["blend","badge"],halftone:["color","mono"]},Ne=zod.z.enum([...se.logo,...se.halftone]),V=192,Pe=e=>Math.ceil(e/3)*4,_e=zod.z.object({width:zod.z.number().int().min(1).max(V),height:zod.z.number().int().min(1).max(V),data:zod.z.string().max(Pe(V*V*4))}).refine(e=>e.data.length===Pe(e.width*e.height*4),{message:"Art image data does not match its width and height"}),ce=zod.z.object({mode:Le,image:_e,intensity:zod.z.number().min(0).max(1).optional(),variant:Ne.optional(),matchEyes:zod.z.boolean().optional()});var It=zod.z.enum(["solid","linear","radial","angular","image"]),Ie=zod.z.object({type:zod.z.literal("solid"),color:zod.z.string()}),ee=zod.z.object({color:zod.z.string(),offset:zod.z.number().min(0).max(100)}),Oe=zod.z.object({type:zod.z.literal("linear"),stops:zod.z.array(ee).min(2),angle:zod.z.number().optional().default(0)}),Fe=zod.z.object({type:zod.z.literal("radial"),stops:zod.z.array(ee).min(2)}),ve=zod.z.object({type:zod.z.literal("angular"),stops:zod.z.array(ee).min(2),angle:zod.z.number().optional().default(0)}),we=zod.z.enum(["cover","contain","tile"]),ze=zod.z.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),De=zod.z.object({type:zod.z.literal("image"),src:zod.z.string().min(1),fit:we.optional().default("cover"),scale:zod.z.number().min(.1).max(4).optional().default(1),position:ze.optional().default("center"),opacity:zod.z.number().min(0).max(1).optional().default(1),underlay:zod.z.string().optional()}),B=zod.z.union([zod.z.string(),Ie,Oe,Fe,ve,De]);function le(e,i="#000000"){return e?typeof e=="string"?{type:"solid",color:e}:e:{type:"solid",color:i}}function Ot(e){return !e||typeof e=="string"?false:e.type==="linear"||e.type==="radial"||e.type==="angular"}function Ft(e){return typeof e=="object"&&e!==null&&e.type==="image"}function vt(e,i="#000000"){let s=le(e,i);return s.type==="solid"?s.color:s.type==="image"?s.underlay||i:s.stops[0]?.color||i}function Be(e="center"){let[i,s]=e.split("-");return e==="center"?"center":s?`${s} ${i}`:i==="top"||i==="bottom"?`center ${i}`:`${i} center`}function wt(e){if(!e)return "#000000";if(typeof e=="string")return e;let i=le(e);if(i.type==="solid")return i.color;if(i.type==="image"){let u=i.fit==="tile"?`${25*(i.scale??1)}% auto`:(i.scale??1)===1?i.fit==="contain"?"contain":"cover":`${100*(i.scale??1)}% auto`,R=i.fit==="tile"?"repeat":"no-repeat";return `${`url("${i.src.replace(/"/g,"%22")}")`} ${Be(i.position)} / ${u} ${R}, ${i.underlay??"transparent"}`}let l=[...i.stops].sort((u,R)=>u.offset-R.offset).map(u=>`${u.color} ${u.offset}%`).join(", ");return i.type==="linear"?`linear-gradient(${(i.angle??0)+90}deg, ${l})`:i.type==="angular"?`conic-gradient(from ${i.angle??0}deg, ${l})`:`radial-gradient(circle, ${l})`}var zt=zod.z.object({x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number()});var me=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Ue=["diamond","star","banner"],ue=zod.z.enum([...me,...Ue]),Dt=zod.z.enum(me);var pe=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ke=["curly"],de=zod.z.enum([...pe,...ke]),Bt=zod.z.enum(pe);var je=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],q=24,Gt="Scan me",Qe=.5,te=1.5,Ye=zod.z.enum(je),ne=zod.z.object({style:Ye,text:zod.z.string().max(q).optional(),color:zod.z.string().optional(),textColor:zod.z.string().optional(),secondaryText:zod.z.string().max(q).optional(),secondaryColor:zod.z.string().optional(),fontScale:zod.z.number().min(Qe).max(te).optional()});var Ut={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},qt=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,fe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function He(e,i=Number.POSITIVE_INFINITY){if(!qt.test(e))return null;let s=[],l=0,u=()=>{for(;l<e.length&&/[\s,]/.test(e[l]);)l++;},R=()=>{u(),fe.lastIndex=l;let r=fe.exec(e);if(!r)return null;let t=r[0],o=t.indexOf(".");if(o>=0&&t.length-o-1>i)return null;l=fe.lastIndex;let a=Number(t);return Number.isFinite(a)?a:null},b=()=>{u();let r=e[l];return r==="0"||r==="1"?(l++,r==="1"?1:0):null},n=()=>(u(),l<e.length&&/[0-9.+-]/.test(e[l]));for(u();l<e.length;){let r=e[l],t=r.toUpperCase(),o=Ut[t];if(o===void 0||s.length===0&&t!=="M")return null;if(l++,o===0){s.push({command:r,values:[]}),u();continue}let a=r,p=true;for(;p||n();){let m=[];for(let f=0;f<o;f++){let h=t==="A"&&(f===3||f===4)?b():R();if(h===null)return null;m.push(h);}s.push({command:a,values:m}),t==="M"&&(a=r==="M"?"L":"l"),p=false;}u();}return s}function $e(e){let i=0;for(let{command:s}of e)i+=s.toUpperCase()==="A"?4:1;return i}function Ve(e){let i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY,R=(b,n)=>{i=Math.min(i,b),s=Math.min(s,n),l=Math.max(l,b),u=Math.max(u,n);};for(let b of e)b.op==="C"?(R(b.x1,b.y1),R(b.x2,b.y2),R(b.x,b.y)):b.op!=="Z"&&R(b.x,b.y);return Number.isFinite(i)?{x0:i,y0:s,x1:l,y1:u}:null}var he=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function kt(e,i,s,l,u,R,b,n,r){if(e===n&&i===r)return [];let t=Math.abs(s),o=Math.abs(l);if(t===0||o===0)return [{op:"L",x:n,y:r}];let a=u*Math.PI/180,p=Math.cos(a),m=Math.sin(a),f=(e-n)/2,h=(i-r)/2,S=p*f+m*h,c=-m*f+p*h,y=S*S/(t*t)+c*c/(o*o);y>1&&(t*=Math.sqrt(y),o*=Math.sqrt(y));let A=t*t*o*o-t*t*c*c-o*o*S*S,T=t*t*c*c+o*o*S*S,M=(R===b?-1:1)*Math.sqrt(Math.max(0,A/T)),g=M*t*c/o,E=-M*o*S/t,_=p*g-m*E+(e+n)/2,L=m*g+p*E+(i+r)/2,k=(F,O,w,J)=>Math.atan2(F*J-O*w,F*w+O*J),K=k(1,0,(S-g)/t,(c-E)/o),D=k((S-g)/t,(c-E)/o,(-S-g)/t,(-c-E)/o);!b&&D>0?D-=2*Math.PI:b&&D<0&&(D+=2*Math.PI);let j=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2)-1e-9)),Q=D/j,W=4/3*Math.tan(Q/4),ae=(F,O)=>[_+t*p*F-o*m*O,L+t*m*F+o*p*O],Re=[];for(let F=0;F<j;F++){let O=K+F*Q,w=O+Q,[J,Ct]=ae(Math.cos(O)-W*Math.sin(O),Math.sin(O)+W*Math.cos(O)),[Rt,Pt]=ae(Math.cos(w)+W*Math.sin(w),Math.sin(w)-W*Math.cos(w)),[Tt,Lt]=F===j-1?[n,r]:ae(Math.cos(w),Math.sin(w));Re.push({op:"C",x1:J,y1:Ct,x2:Rt,y2:Pt,x:Tt,y:Lt});}return Re}function Xe(e){let i=[],s=0,l=0,u=0,R=0,b=0,n="",r=null,t=null,o=()=>{for(;s<e.length&&/[\s,]/.test(e[s]);)s++;},a=()=>{o(),he.lastIndex=s;let f=he.exec(e);return f?(s=he.lastIndex,Number(f[0])):null},p=()=>{o();let f=e[s];return f==="0"||f==="1"?(s++,f==="1"):null},m=f=>{let h=[];for(let S=0;S<f;S++){let c=a();if(c===null)return null;h.push(c);}return h};for(;o(),!(s>=e.length);){let f=e[s];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(f))n=f,s++;else if(!n||n==="Z"||n==="z")break;let h=n===n.toLowerCase(),S=h?l:0,c=h?u:0,y=n.toUpperCase();if(y==="Z"){i.push({op:"Z"}),l=R,u=b,r=null,t=null;continue}if(y==="A"){let g=m(3),E=p(),_=p(),L=m(2);if(!(g&&L)||E===null||_===null)break;let[k,K,D]=g,j=L[0]+S,Q=L[1]+c;i.push(...kt(l,u,k,K,D,E,_,j,Q)),l=j,u=Q,r=null,t=null;continue}let A={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[y]??0,T=m(A);if(!T)break;let M=T;switch(y){case "M":l=M[0]+S,u=M[1]+c,R=l,b=u,i.push({op:"M",x:l,y:u}),n=h?"l":"L",r=null,t=null;break;case "L":case "H":case "V":y!=="V"&&(l=M[0]+S),y==="V"?u=M[0]+c:y==="L"&&(u=M[1]+c),i.push({op:"L",x:l,y:u}),r=null,t=null;break;case "C":case "S":{let g,E;y==="C"?(g=[M[0]+S,M[1]+c],E=M.slice(2)):(g=r?[2*l-r[0],2*u-r[1]]:[l,u],E=M);let _=[E[0]+S,E[1]+c],L=[E[2]+S,E[3]+c];i.push({op:"C",x1:g[0],y1:g[1],x2:_[0],y2:_[1],x:L[0],y:L[1]}),[l,u]=L,r=_,t=null;break}case "Q":case "T":{let g,E;y==="Q"?(g=[M[0]+S,M[1]+c],E=[M[2]+S,M[3]+c]):(g=t?[2*l-t[0],2*u-t[1]]:[l,u],E=[M[0]+S,M[1]+c]),i.push({op:"C",x1:l+2/3*(g[0]-l),y1:u+2/3*(g[1]-u),x2:E[0]+2/3*(g[0]-E[0]),y2:E[1]+2/3*(g[1]-E[1]),x:E[0],y:E[1]}),[l,u]=E,t=g,r=null;break}}}return i}var Ke="qrdx.frame",We=1,Je="custom",N={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:q},et=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],tt=.95,nt=200,rt=["frame","text","accent","background"],jt=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Qt=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function ot(e,i=q){let s=e.slice(0,1e3).normalize("NFC").replace(jt," ").replace(Qt,"").replace(/\s+/g," ").trim();return Array.from(s).slice(0,Math.max(0,i)).join("").trim()}function Yt(e){for(let i of e)if((i.codePointAt(0)??0)>255)return false;return true}var xe=e=>Math.abs(e*1e3-Math.round(e*1e3))<1e-6,P=zod.z.number().min(-N.maxCoordinate).max(N.maxCoordinate).refine(xe,{message:`Numbers may have at most ${N.maxDecimals} decimals`}),I=P.refine(e=>e>0,{message:"Must be greater than 0"}),oe=P.refine(e=>e>=0,{message:"Must not be negative"}),re=zod.z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),ye=zod.z.union([zod.z.enum(rt),re]),H=zod.z.union([ye,zod.z.object({mix:zod.z.tuple([ye,ye]),amount:zod.z.number().min(0).max(1).refine(xe)}).strict()]),U=zod.z.union([H,zod.z.object({gradient:zod.z.object({from:H,to:H,direction:zod.z.enum(["horizontal","vertical"]).optional(),steps:zod.z.int().min(2).max(N.maxGradientSteps).optional()}).strict()}).strict()]),be={x:P,y:P,width:I,height:I},Ht=zod.z.object({type:zod.z.literal("rect"),...be,radius:oe.optional(),fill:U,hole:zod.z.object({...be,radius:oe.optional()}).strict().optional()}).strict(),$t=zod.z.object({type:zod.z.literal("circle"),cx:P,cy:P,r:I,hole:I.optional(),fill:U}).strict(),Vt=zod.z.object({type:zod.z.literal("ellipse"),cx:P,cy:P,rx:I,ry:I,fill:U}).strict(),Xt=zod.z.object({type:zod.z.literal("polygon"),points:zod.z.array(zod.z.tuple([P,P])).min(3).max(N.maxPolygonPoints),fill:U}).strict(),Zt=zod.z.object({type:zod.z.literal("path"),d:zod.z.string().min(2).max(N.maxPathLength),fill:U,fillRule:zod.z.enum(["nonzero","evenodd"]).optional()}).strict(),Kt=zod.z.object({type:zod.z.literal("line"),x1:P,y1:P,x2:P,y2:P,width:I,cap:zod.z.enum(["butt","round"]).optional(),dash:zod.z.tuple([I,I]).optional(),fill:U}).strict(),Wt=zod.z.object({type:zod.z.literal("icon"),icon:zod.z.enum(et),x:P,y:P,size:I,fill:U}).strict(),it=zod.z.discriminatedUnion("type",[Ht,$t,Vt,Xt,Zt,Kt,Wt]),at={id:zod.z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:zod.z.enum(["primary","secondary","fixed"]),text:zod.z.string().max(200),maxLength:zod.z.int().min(1).max(q).optional(),color:H,weight:zod.z.enum(["bold","regular"]).optional()},Jt=zod.z.object({type:zod.z.literal("text"),...at,box:zod.z.object(be).strict(),align:zod.z.enum(["start","middle","end"]).optional(),fontSize:I.optional()}).strict(),en=zod.z.object({type:zod.z.literal("curved"),...at,curve:zod.z.object({cx:P,cy:P,radius:I,side:zod.z.enum(["top","bottom"]),spread:zod.z.number().min(20).max(300).refine(xe).optional()}).strict(),fontSize:I}).strict(),st=zod.z.discriminatedUnion("type",[Jt,en]),Ze=P.refine(e=>e>=N.minArtboard&&e<=N.maxArtboard,{message:`Artboard sides must be ${N.minArtboard} to ${N.maxArtboard} units`}),tn=zod.z.object({kind:zod.z.literal(Ke),version:zod.z.literal(We),artboard:zod.z.object({width:Ze,height:Ze}).strict(),qr:zod.z.object({x:P,y:P,size:I,padding:oe.optional(),radius:oe.optional()}).strict(),colors:zod.z.object({frame:re,text:re.optional(),accent:re.optional()}).strict(),shapes:zod.z.array(it).max(N.maxShapes),labels:zod.z.array(st).max(N.maxLabels),bleed:zod.z.union([zod.z.literal("none"),H]).optional()}).strict();function ct(e){let i=ge(e);return {x0:e.qr.x-i,y0:e.qr.y-i,x1:e.qr.x+e.qr.size+i,y1:e.qr.y+e.qr.size+i}}function ge(e){return e.qr.padding??e.qr.size*N.defaultPadding}var nn=(e,i)=>Math.min(e.x1,i.x1)-Math.max(e.x0,i.x0)>1e-6&&Math.min(e.y1,i.y1)-Math.max(e.y0,i.y0)>1e-6;function rn(e){switch(e.type){case "rect":return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height},segments:e.hole?18:9};case "circle":return {bounds:{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r},segments:e.hole?10:5};case "ellipse":return {bounds:{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry},segments:5};case "polygon":{let i=e.points.map(([l])=>l),s=e.points.map(([,l])=>l);return {bounds:{x0:Math.min(...i),y0:Math.min(...s),x1:Math.max(...i),y1:Math.max(...s)},segments:e.points.length}}case "path":{let i=He(e.d,N.maxDecimals);return i?{bounds:Ve(Xe(e.d)),segments:$e(i)}:{bounds:null,segments:0}}case "line":{let i=e.width/2,s=Math.hypot(e.x2-e.x1,e.y2-e.y1),l=e.dash?Math.ceil(s/(e.dash[0]+e.dash[1])):1;return {bounds:{x0:Math.min(e.x1,e.x2)-i,y0:Math.min(e.y1,e.y2)-i,x1:Math.max(e.x1,e.x2)+i,y1:Math.max(e.y1,e.y2)+i},segments:l*(e.cap==="round"?4:5)}}default:return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.size,y1:e.y+e.size},segments:nt}}}function on(e,i){let s=(c,y=[])=>i.addIssue({code:"custom",message:c,path:y}),l=N,u=new TextEncoder().encode(JSON.stringify(e)).length;if(u>l.maxBytes){s(`The spec is ${u} bytes; the limit is ${l.maxBytes}`);return}let{width:R,height:b}=e.artboard,n=Math.max(R,b)*.005,r={x0:-n,y0:-n,x1:R+n,y1:b+n},t=c=>c.x0>=r.x0&&c.y0>=r.y0&&c.x1<=r.x1&&c.y1<=r.y1,{qr:o}=e,a=ge(e);a<o.size*l.minPadding-1e-9&&s(`qr.padding must be at least ${l.minPadding*100}% of qr.size`,["qr","padding"]),o.size<Math.min(R,b)*l.minQrShare-1e-9&&s(`qr.size must be at least ${l.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=ct(e);(p.x0<-1e-9||p.y0<-1e-9||p.x1>R+1e-9||p.y1>b+1e-9)&&s("The code and its padding must sit inside the artboard",["qr"]),(o.radius??0)>(o.size+2*a)/2&&s("qr.radius is larger than half the plate",["qr","radius"]);let m=0,f=0;e.shapes.forEach((c,y)=>{let A=["shapes",y],{bounds:T,segments:M}=rn(c);if(!T){s("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...A,"d"]);return}if(t(T)||s("The shape extends outside the artboard",A),c.type==="rect"&&c.hole){let{hole:g}=c;(g.x<c.x||g.y<c.y||g.x+g.width>c.x+c.width+1e-9||g.y+g.height>c.y+c.height+1e-9)&&s("The hole must sit inside its rect",[...A,"hole"]);}c.type==="circle"&&c.hole&&c.hole>=c.r&&s("The hole must be smaller than the circle",[...A,"hole"]),m+=M,typeof c.fill=="object"&&"gradient"in c.fill&&(f+=(c.fill.gradient.steps??32)*M);}),m>l.maxSegments&&s(`The shapes have ${m} segments; the limit is ${l.maxSegments}`,["shapes"]),f>l.maxGradientWork&&s("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=new Set,S=new Set;e.labels.forEach((c,y)=>{let A=["labels",y];h.has(c.id)&&s(`Label id "${c.id}" is used twice`,[...A,"id"]),h.add(c.id),c.slot!=="fixed"&&(S.has(c.slot)&&s(`Only one label may use the ${c.slot} slot`,[...A,"slot"]),S.add(c.slot));let T=c.maxLength??l.maxTextLength;c.text!==ot(c.text,T)&&s(`Label text must be at most ${T} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...A,"text"]);let M;if(c.type==="text")M={x0:c.box.x,y0:c.box.y,x1:c.box.x+c.box.width,y1:c.box.y+c.box.height},c.fontSize!==void 0&&c.fontSize>c.box.height*tt+1e-9&&s("fontSize may be at most 95% of the label's row height",[...A,"fontSize"]),nn(M,p)&&s("The label overlaps the code or its padding",[...A,"box"]);else {let{cx:g,cy:E,radius:_}=c.curve,L=c.fontSize*te*.6;M={x0:g-_-L,y0:E-_-L,x1:g+_+L,y1:E+_+L};let k=Math.hypot(Math.max(p.x0-g,0,g-p.x1),Math.max(p.y0-E,0,E-p.y1));Math.hypot(Math.max(Math.abs(p.x0-g),Math.abs(p.x1-g)),Math.max(Math.abs(p.y0-E),Math.abs(p.y1-E)))<=_-L||k>=_+L||s("The curved label crosses the code or its padding",[...A,"curve"]);}t(M)||s("The label extends outside the artboard",A);});}var Se=tn.superRefine(on);function an(e){let i=Se.safeParse(e);return i.success?[]:i.error.issues.map(s=>s.path.length>0?`${s.path.join(".")}: ${s.message}`:s.message)}var lt=ne.extend({style:zod.z.literal(Je),spec:Se}),Ee=zod.z.discriminatedUnion("style",[ne,lt]);var mt=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Ae=zod.z.enum(mt);var ut=["square","rounded","circle"],Ce=zod.z.enum(ut),pt=zod.z.object({src:zod.z.string(),height:zod.z.number(),width:zod.z.number(),excavate:zod.z.boolean(),x:zod.z.number().optional(),y:zod.z.number().optional(),padding:zod.z.number().min(0).optional(),shape:Ce.optional(),plate:zod.z.string().optional()}),dt=.1,ft=.3,cn=.25,ht=2,ln=zod.z.object({size:zod.z.number().min(dt).max(ft).optional(),padding:zod.z.number().min(0).max(ht).optional(),x:zod.z.number().min(0).max(1).optional(),y:zod.z.number().min(0).max(1).optional(),shape:Ce.optional(),plate:zod.z.string().optional()}),yt=zod.z.enum(["L","M","Q","H"]),bt=.5,xt=1,mn=.07,gt=["square","circle","heart"],St=zod.z.enum(gt),un=3,Z=64,Me=8,pn=.42,Et=zod.z.object({type:zod.z.literal("silhouette"),width:zod.z.number().int().min(Me).max(Z),height:zod.z.number().int().min(Me).max(Z),cells:zod.z.string().max(Z*Z).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(e=>e.cells.length===e.width*e.height,{message:"Silhouette cells do not match its width and height"}),At=zod.z.union([St,Et]),dn=["topLeft","topRight","bottomLeft"],ie=zod.z.object({outer:B.optional(),inner:B.optional()}),Mt=zod.z.object({topLeft:ie.optional(),topRight:ie.optional(),bottomLeft:ie.optional()}),fn=zod.z.object({value:zod.z.string(),size:zod.z.number().optional(),level:yt.optional(),bgColor:B.optional(),fgColor:B.optional(),eyeColor:B.optional(),dotColor:B.optional(),bodyPattern:Ae.optional(),cornerEyePattern:de.optional(),cornerEyeDotPattern:ue.optional(),margin:zod.z.number().optional(),imageSettings:pt.optional(),isOGContext:zod.z.boolean().optional(),templateId:zod.z.string().optional(),customProps:zod.z.record(zod.z.string(),zod.z.any()).optional(),frame:Ee.optional(),art:ce.optional(),eyeColors:Mt.optional(),moduleScale:zod.z.number().min(bt).max(xt).optional(),autoLevel:zod.z.boolean().optional(),shape:At.optional()});var hn=zod.z.object({fgColor:zod.z.string().optional(),bgColor:zod.z.string().optional()}),yn=zod.z.object({pixelSize:zod.z.number(),url:zod.z.string()}),bn=zod.z.object({id:zod.z.string(),name:zod.z.string(),description:zod.z.string().optional()});/**
|
|
1
|
+
'use strict';var zod=require('zod');var Y;(R=>{class e{constructor(n,r,t,o){this.version=n;this.errorCorrectionLevel=r;if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=n*4+17;let a=[];for(let m=0;m<this.size;m++)a.push(false);for(let m=0;m<this.size;m++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(t);if(this.drawCodewords(p),o==-1){let m=1e9;for(let f=0;f<8;f++){this.applyMask(f),this.drawFormatBits(f);let h=this.getPenaltyScore();h<m&&(o=f,m=h),this.applyMask(f);}}l(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[];}version;errorCorrectionLevel;static encodeText(n,r){let t=R.QrSegment.makeSegments(n);return e.encodeSegments(t,r)}static encodeBinary(n,r){let t=R.QrSegment.makeBytes(n);return e.encodeSegments([t],r)}static encodeSegments(n,r,t=1,o=40,a=-1,p=true){if(!(e.MIN_VERSION<=t&&t<=o&&o<=e.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let m,f;for(m=t;;m++){let y=e.getNumDataCodewords(m,r)*8,A=u.getTotalBits(n,m);if(A<=y){f=A;break}if(m>=o)throw new RangeError("Data too long")}for(let y of [e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])p&&f<=e.getNumDataCodewords(m,y)*8&&(r=y);let h=[];for(let y of n){i(y.mode.modeBits,4,h),i(y.numChars,y.mode.numCharCountBits(m),h);for(let A of y.getData())h.push(A);}l(h.length==f);let S=e.getNumDataCodewords(m,r)*8;l(h.length<=S),i(0,Math.min(4,S-h.length),h),i(0,(8-h.length%8)%8,h),l(h.length%8==0);for(let y=236;h.length<S;y^=253)i(y,8,h);let c=[];for(;c.length*8<h.length;)c.push(0);return h.forEach((y,A)=>c[A>>>3]|=y<<7-(A&7)),new e(m,r,c,a)}size;mask;modules=[];isFunction=[];getModule(n,r){return 0<=n&&n<this.size&&0<=r&&r<this.size&&this.modules[r][n]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let n=this.getAlignmentPatternPositions(),r=n.length;for(let t=0;t<r;t++)for(let o=0;o<r;o++)t==0&&o==0||t==0&&o==r-1||t==r-1&&o==0||this.drawAlignmentPattern(n[t],n[o]);this.drawFormatBits(0),this.drawVersion();}drawFormatBits(n){let r=this.errorCorrectionLevel.formatBits<<3|n,t=r;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;let o=(r<<10|t)^21522;l(o>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,s(o,a));this.setFunctionModule(8,7,s(o,6)),this.setFunctionModule(8,8,s(o,7)),this.setFunctionModule(7,8,s(o,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,s(o,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,s(o,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,s(o,a));this.setFunctionModule(8,this.size-8,true);}drawVersion(){if(this.version<7)return;let n=this.version;for(let t=0;t<12;t++)n=n<<1^(n>>>11)*7973;let r=this.version<<12|n;l(r>>>18==0);for(let t=0;t<18;t++){let o=s(r,t),a=this.size-11+t%3,p=Math.floor(t/3);this.setFunctionModule(a,p,o),this.setFunctionModule(p,a,o);}}drawFinderPattern(n,r){for(let t=-4;t<=4;t++)for(let o=-4;o<=4;o++){let a=Math.max(Math.abs(o),Math.abs(t)),p=n+o,m=r+t;0<=p&&p<this.size&&0<=m&&m<this.size&&this.setFunctionModule(p,m,a!=2&&a!=4);}}drawAlignmentPattern(n,r){for(let t=-2;t<=2;t++)for(let o=-2;o<=2;o++)this.setFunctionModule(n+o,r+t,Math.max(Math.abs(o),Math.abs(t))!=1);}setFunctionModule(n,r,t){this.modules[r][n]=t,this.isFunction[r][n]=true;}addEccAndInterleave(n){let r=this.version,t=this.errorCorrectionLevel;if(n.length!=e.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");let o=e.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],a=e.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],p=Math.floor(e.getNumRawDataModules(r)/8),m=o-p%o,f=Math.floor(p/o),h=[],S=e.reedSolomonComputeDivisor(a);for(let y=0,A=0;y<o;y++){let T=n.slice(A,A+f-a+(y<m?0:1));A+=T.length;let M=e.reedSolomonComputeRemainder(T,S);y<m&&T.push(0),h.push(T.concat(M));}let c=[];for(let y=0;y<h[0].length;y++)h.forEach((A,T)=>{(y!=f-a||T>=m)&&c.push(A[y]);});return l(c.length==p),c}drawCodewords(n){if(n.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let o=0;o<this.size;o++)for(let a=0;a<2;a++){let p=t-a,f=(t+1&2)==0?this.size-1-o:o;!this.isFunction[f][p]&&r<n.length*8&&(this.modules[f][p]=s(n[r>>>3],7-(r&7)),r++);}}l(r==n.length*8);}applyMask(n){if(n<0||n>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let t=0;t<this.size;t++){let o;switch(n){case 0:o=(t+r)%2==0;break;case 1:o=r%2==0;break;case 2:o=t%3==0;break;case 3:o=(t+r)%3==0;break;case 4:o=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:o=t*r%2+t*r%3==0;break;case 6:o=(t*r%2+t*r%3)%2==0;break;case 7:o=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&o&&(this.modules[r][t]=!this.modules[r][t]);}}getPenaltyScore(){let n=0;for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[a][h]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[a][h],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][a]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[h][a],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size-1;a++)for(let p=0;p<this.size-1;p++){let m=this.modules[a][p];m==this.modules[a][p+1]&&m==this.modules[a+1][p]&&m==this.modules[a+1][p+1]&&(n+=e.PENALTY_N2);}let r=0;for(let a of this.modules)r=a.reduce((p,m)=>p+(m?1:0),r);let t=this.size*this.size,o=Math.ceil(Math.abs(r*20-t*10)/t)-1;return l(0<=o&&o<=9),n+=o*e.PENALTY_N4,l(0<=n&&n<=2568888),n}getAlignmentPatternPositions(){if(this.version==1)return [];{let n=Math.floor(this.version/7)+2,r=this.version==32?26:Math.ceil((this.version*4+4)/(n*2-2))*2,t=[6];for(let o=this.size-7;t.length<n;o-=r)t.splice(1,0,o);return t}}static getNumRawDataModules(n){if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*n+128)*n+64;if(n>=2){let t=Math.floor(n/7)+2;r-=(25*t-10)*t-55,n>=7&&(r-=36);}return l(208<=r&&r<=29648),r}static getNumDataCodewords(n,r){return Math.floor(e.getNumRawDataModules(n)/8)-e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n]*e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n]}static reedSolomonComputeDivisor(n){if(n<1||n>255)throw new RangeError("Degree out of range");let r=[];for(let o=0;o<n-1;o++)r.push(0);r.push(1);let t=1;for(let o=0;o<n;o++){for(let a=0;a<r.length;a++)r[a]=e.reedSolomonMultiply(r[a],t),a+1<r.length&&(r[a]^=r[a+1]);t=e.reedSolomonMultiply(t,2);}return r}static reedSolomonComputeRemainder(n,r){let t=r.map(o=>0);for(let o of n){let a=o^t.shift();t.push(0),r.forEach((p,m)=>t[m]^=e.reedSolomonMultiply(p,a));}return t}static reedSolomonMultiply(n,r){if(n>>>8||r>>>8)throw new RangeError("Byte out of range");let t=0;for(let o=7;o>=0;o--)t=t<<1^(t>>>7)*285,t^=(r>>>o&1)*n;return l(t>>>8==0),t}finderPenaltyCountPatterns(n){let r=n[1];l(r<=this.size*3);let t=r>0&&n[2]==r&&n[3]==r*3&&n[4]==r&&n[5]==r;return (t&&n[0]>=r*4&&n[6]>=r?1:0)+(t&&n[6]>=r*4&&n[0]>=r?1:0)}finderPenaltyTerminateAndCount(n,r,t){return n&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(n,r){r[0]==0&&(n+=this.size),r.pop(),r.unshift(n);}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}R.QrCode=e;function i(b,n,r){if(n<0||n>31||b>>>n)throw new RangeError("Value out of range");for(let t=n-1;t>=0;t--)r.push(b>>>t&1);}function s(b,n){return (b>>>n&1)!=0}function l(b){if(!b)throw new Error("Assertion error")}class u{constructor(n,r,t){this.mode=n;this.numChars=r;this.bitData=t;if(r<0)throw new RangeError("Invalid argument");this.bitData=t.slice();}mode;numChars;bitData;static makeBytes(n){let r=[];for(let t of n)i(t,8,r);return new u(u.Mode.BYTE,n.length,r)}static makeNumeric(n){if(!u.isNumeric(n))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<n.length;){let o=Math.min(n.length-t,3);i(parseInt(n.substr(t,o),10),o*3+1,r),t+=o;}return new u(u.Mode.NUMERIC,n.length,r)}static makeAlphanumeric(n){if(!u.isAlphanumeric(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],t;for(t=0;t+2<=n.length;t+=2){let o=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t))*45;o+=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t+1)),i(o,11,r);}return t<n.length&&i(u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t)),6,r),new u(u.Mode.ALPHANUMERIC,n.length,r)}static makeSegments(n){return n==""?[]:u.isNumeric(n)?[u.makeNumeric(n)]:u.isAlphanumeric(n)?[u.makeAlphanumeric(n)]:[u.makeBytes(u.toUtf8ByteArray(n))]}static makeEci(n){let r=[];if(n<0)throw new RangeError("ECI assignment value out of range");if(n<128)i(n,8,r);else if(n<16384)i(2,2,r),i(n,14,r);else if(n<1e6)i(6,3,r),i(n,21,r);else throw new RangeError("ECI assignment value out of range");return new u(u.Mode.ECI,0,r)}static isNumeric(n){return u.NUMERIC_REGEX.test(n)}static isAlphanumeric(n){return u.ALPHANUMERIC_REGEX.test(n)}getData(){return this.bitData.slice()}static getTotalBits(n,r){let t=0;for(let o of n){let a=o.mode.numCharCountBits(r);if(o.numChars>=1<<a)return 1/0;t+=4+a+o.bitData.length;}return t}static toUtf8ByteArray(n){n=encodeURI(n);let r=[];for(let t=0;t<n.length;t++)n.charAt(t)!="%"?r.push(n.charCodeAt(t)):(r.push(parseInt(n.substr(t+1,2),16)),t+=2);return r}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}R.QrSegment=u;})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.ordinal=R;this.formatBits=b;}ordinal;formatBits;static LOW=new s(0,1);static MEDIUM=new s(1,0);static QUARTILE=new s(2,3);static HIGH=new s(3,2)}l.Ecc=s;})(i.QrCode||={});})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.modeBits=R;this.numBitsCharCount=b;}modeBits;numBitsCharCount;static NUMERIC=new s(1,[10,12,14]);static ALPHANUMERIC=new s(2,[9,11,13]);static BYTE=new s(4,[8,16,16]);static KANJI=new s(8,[8,10,12]);static ECI=new s(7,[0,0,0]);numCharCountBits(R){return this.numBitsCharCount[Math.floor((R+7)/17)]}}l.Mode=s;})(i.QrSegment||={});})(Y||={});var $=Y;({L:$.QrCode.Ecc.LOW,M:$.QrCode.Ecc.MEDIUM,Q:$.QrCode.Ecc.QUARTILE,H:$.QrCode.Ecc.HIGH});var Lt=0;function _t(e,i="#000000"){return e?typeof e=="string"?e:e.type==="solid"?e.color:e.type==="image"?e.underlay||i:(e.type==="linear"||e.type==="radial"||e.type==="angular")&&e.stops[0]?.color||i:i}var Te=["logo","halftone"],Ne=zod.z.enum(Te),se={logo:["blend","badge"],halftone:["color","mono"]},Le=zod.z.enum([...se.logo,...se.halftone]),V=192,Pe=e=>Math.ceil(e/3)*4,_e=zod.z.object({width:zod.z.number().int().min(1).max(V),height:zod.z.number().int().min(1).max(V),data:zod.z.string().max(Pe(V*V*4))}).refine(e=>e.data.length===Pe(e.width*e.height*4),{message:"Art image data does not match its width and height"}),ce=zod.z.object({mode:Ne,image:_e,intensity:zod.z.number().min(0).max(1).optional(),variant:Le.optional(),matchEyes:zod.z.boolean().optional()});var It=zod.z.enum(["solid","linear","radial","angular","image"]),Ie=zod.z.object({type:zod.z.literal("solid"),color:zod.z.string()}),ee=zod.z.object({color:zod.z.string(),offset:zod.z.number().min(0).max(100)}),Oe=zod.z.object({type:zod.z.literal("linear"),stops:zod.z.array(ee).min(2),angle:zod.z.number().optional().default(0)}),Fe=zod.z.object({type:zod.z.literal("radial"),stops:zod.z.array(ee).min(2)}),ve=zod.z.object({type:zod.z.literal("angular"),stops:zod.z.array(ee).min(2),angle:zod.z.number().optional().default(0)}),we=zod.z.enum(["cover","contain","tile"]),ze=zod.z.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),De=zod.z.object({type:zod.z.literal("image"),src:zod.z.string().min(1),fit:we.optional().default("cover"),scale:zod.z.number().min(.1).max(4).optional().default(1),position:ze.optional().default("center"),opacity:zod.z.number().min(0).max(1).optional().default(1),underlay:zod.z.string().optional()}),B=zod.z.union([zod.z.string(),Ie,Oe,Fe,ve,De]);function le(e,i="#000000"){return e?typeof e=="string"?{type:"solid",color:e}:e:{type:"solid",color:i}}function Ot(e){return !e||typeof e=="string"?false:e.type==="linear"||e.type==="radial"||e.type==="angular"}function Ft(e){return typeof e=="object"&&e!==null&&e.type==="image"}function vt(e,i="#000000"){let s=le(e,i);return s.type==="solid"?s.color:s.type==="image"?s.underlay||i:s.stops[0]?.color||i}function Be(e="center"){let[i,s]=e.split("-");return e==="center"?"center":s?`${s} ${i}`:i==="top"||i==="bottom"?`center ${i}`:`${i} center`}function wt(e){if(!e)return "#000000";if(typeof e=="string")return e;let i=le(e);if(i.type==="solid")return i.color;if(i.type==="image"){let u=i.fit==="tile"?`${25*(i.scale??1)}% auto`:(i.scale??1)===1?i.fit==="contain"?"contain":"cover":`${100*(i.scale??1)}% auto`,R=i.fit==="tile"?"repeat":"no-repeat";return `${`url("${i.src.replace(/"/g,"%22")}")`} ${Be(i.position)} / ${u} ${R}, ${i.underlay??"transparent"}`}let l=[...i.stops].sort((u,R)=>u.offset-R.offset).map(u=>`${u.color} ${u.offset}%`).join(", ");return i.type==="linear"?`linear-gradient(${(i.angle??0)+90}deg, ${l})`:i.type==="angular"?`conic-gradient(from ${i.angle??0}deg, ${l})`:`radial-gradient(circle, ${l})`}var zt=zod.z.object({x:zod.z.number(),y:zod.z.number(),w:zod.z.number(),h:zod.z.number()});var me=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Ue=["diamond","star","banner"],ue=zod.z.enum([...me,...Ue]),Dt=zod.z.enum(me);var pe=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ke=["curly"],de=zod.z.enum([...pe,...ke]),Bt=zod.z.enum(pe);var Qe=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],q=24,Gt="Scan me",je=.5,te=1.5,Ye=zod.z.enum(Qe),ne=zod.z.object({style:Ye,text:zod.z.string().max(q).optional(),color:zod.z.string().optional(),textColor:zod.z.string().optional(),secondaryText:zod.z.string().max(q).optional(),secondaryColor:zod.z.string().optional(),fontScale:zod.z.number().min(je).max(te).optional()});var Ut={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},qt=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,fe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function He(e,i=Number.POSITIVE_INFINITY){if(!qt.test(e))return null;let s=[],l=0,u=()=>{for(;l<e.length&&/[\s,]/.test(e[l]);)l++;},R=()=>{u(),fe.lastIndex=l;let r=fe.exec(e);if(!r)return null;let t=r[0],o=t.indexOf(".");if(o>=0&&t.length-o-1>i)return null;l=fe.lastIndex;let a=Number(t);return Number.isFinite(a)?a:null},b=()=>{u();let r=e[l];return r==="0"||r==="1"?(l++,r==="1"?1:0):null},n=()=>(u(),l<e.length&&/[0-9.+-]/.test(e[l]));for(u();l<e.length;){let r=e[l],t=r.toUpperCase(),o=Ut[t];if(o===void 0||s.length===0&&t!=="M")return null;if(l++,o===0){s.push({command:r,values:[]}),u();continue}let a=r,p=true;for(;p||n();){let m=[];for(let f=0;f<o;f++){let h=t==="A"&&(f===3||f===4)?b():R();if(h===null)return null;m.push(h);}s.push({command:a,values:m}),t==="M"&&(a=r==="M"?"L":"l"),p=false;}u();}return s}function $e(e){let i=0;for(let{command:s}of e)i+=s.toUpperCase()==="A"?4:1;return i}function Ve(e){let i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY,R=(b,n)=>{i=Math.min(i,b),s=Math.min(s,n),l=Math.max(l,b),u=Math.max(u,n);};for(let b of e)b.op==="C"?(R(b.x1,b.y1),R(b.x2,b.y2),R(b.x,b.y)):b.op!=="Z"&&R(b.x,b.y);return Number.isFinite(i)?{x0:i,y0:s,x1:l,y1:u}:null}var he=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function kt(e,i,s,l,u,R,b,n,r){if(e===n&&i===r)return [];let t=Math.abs(s),o=Math.abs(l);if(t===0||o===0)return [{op:"L",x:n,y:r}];let a=u*Math.PI/180,p=Math.cos(a),m=Math.sin(a),f=(e-n)/2,h=(i-r)/2,S=p*f+m*h,c=-m*f+p*h,y=S*S/(t*t)+c*c/(o*o);y>1&&(t*=Math.sqrt(y),o*=Math.sqrt(y));let A=t*t*o*o-t*t*c*c-o*o*S*S,T=t*t*c*c+o*o*S*S,M=(R===b?-1:1)*Math.sqrt(Math.max(0,A/T)),g=M*t*c/o,E=-M*o*S/t,_=p*g-m*E+(e+n)/2,N=m*g+p*E+(i+r)/2,k=(F,O,w,J)=>Math.atan2(F*J-O*w,F*w+O*J),K=k(1,0,(S-g)/t,(c-E)/o),D=k((S-g)/t,(c-E)/o,(-S-g)/t,(-c-E)/o);!b&&D>0?D-=2*Math.PI:b&&D<0&&(D+=2*Math.PI);let Q=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2)-1e-9)),j=D/Q,W=4/3*Math.tan(j/4),ae=(F,O)=>[_+t*p*F-o*m*O,N+t*m*F+o*p*O],Re=[];for(let F=0;F<Q;F++){let O=K+F*j,w=O+j,[J,Ct]=ae(Math.cos(O)-W*Math.sin(O),Math.sin(O)+W*Math.cos(O)),[Rt,Pt]=ae(Math.cos(w)+W*Math.sin(w),Math.sin(w)-W*Math.cos(w)),[Tt,Nt]=F===Q-1?[n,r]:ae(Math.cos(w),Math.sin(w));Re.push({op:"C",x1:J,y1:Ct,x2:Rt,y2:Pt,x:Tt,y:Nt});}return Re}function Xe(e){let i=[],s=0,l=0,u=0,R=0,b=0,n="",r=null,t=null,o=()=>{for(;s<e.length&&/[\s,]/.test(e[s]);)s++;},a=()=>{o(),he.lastIndex=s;let f=he.exec(e);return f?(s=he.lastIndex,Number(f[0])):null},p=()=>{o();let f=e[s];return f==="0"||f==="1"?(s++,f==="1"):null},m=f=>{let h=[];for(let S=0;S<f;S++){let c=a();if(c===null)return null;h.push(c);}return h};for(;o(),!(s>=e.length);){let f=e[s];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(f))n=f,s++;else if(!n||n==="Z"||n==="z")break;let h=n===n.toLowerCase(),S=h?l:0,c=h?u:0,y=n.toUpperCase();if(y==="Z"){i.push({op:"Z"}),l=R,u=b,r=null,t=null;continue}if(y==="A"){let g=m(3),E=p(),_=p(),N=m(2);if(!(g&&N)||E===null||_===null)break;let[k,K,D]=g,Q=N[0]+S,j=N[1]+c;i.push(...kt(l,u,k,K,D,E,_,Q,j)),l=Q,u=j,r=null,t=null;continue}let A={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[y]??0,T=m(A);if(!T)break;let M=T;switch(y){case "M":l=M[0]+S,u=M[1]+c,R=l,b=u,i.push({op:"M",x:l,y:u}),n=h?"l":"L",r=null,t=null;break;case "L":case "H":case "V":y!=="V"&&(l=M[0]+S),y==="V"?u=M[0]+c:y==="L"&&(u=M[1]+c),i.push({op:"L",x:l,y:u}),r=null,t=null;break;case "C":case "S":{let g,E;y==="C"?(g=[M[0]+S,M[1]+c],E=M.slice(2)):(g=r?[2*l-r[0],2*u-r[1]]:[l,u],E=M);let _=[E[0]+S,E[1]+c],N=[E[2]+S,E[3]+c];i.push({op:"C",x1:g[0],y1:g[1],x2:_[0],y2:_[1],x:N[0],y:N[1]}),[l,u]=N,r=_,t=null;break}case "Q":case "T":{let g,E;y==="Q"?(g=[M[0]+S,M[1]+c],E=[M[2]+S,M[3]+c]):(g=t?[2*l-t[0],2*u-t[1]]:[l,u],E=[M[0]+S,M[1]+c]),i.push({op:"C",x1:l+2/3*(g[0]-l),y1:u+2/3*(g[1]-u),x2:E[0]+2/3*(g[0]-E[0]),y2:E[1]+2/3*(g[1]-E[1]),x:E[0],y:E[1]}),[l,u]=E,t=g,r=null;break}}}return i}var Ke="qrdx.frame",We=1,Je="custom",L={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:q},et=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],tt=.95,nt=200,rt=["frame","text","accent","background"],Qt=/[\t\n\v\f\r\u0085\u2028\u2029]/g,jt=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function ot(e,i=q){let s=e.slice(0,1e3).normalize("NFC").replace(Qt," ").replace(jt,"").replace(/\s+/g," ").trim();return Array.from(s).slice(0,Math.max(0,i)).join("").trim()}function Yt(e){for(let i of e)if((i.codePointAt(0)??0)>255)return false;return true}var xe=e=>Math.abs(e*1e3-Math.round(e*1e3))<1e-6,P=zod.z.number().min(-L.maxCoordinate).max(L.maxCoordinate).refine(xe,{message:`Numbers may have at most ${L.maxDecimals} decimals`}),I=P.refine(e=>e>0,{message:"Must be greater than 0"}),oe=P.refine(e=>e>=0,{message:"Must not be negative"}),re=zod.z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),ye=zod.z.union([zod.z.enum(rt),re]),H=zod.z.union([ye,zod.z.object({mix:zod.z.tuple([ye,ye]),amount:zod.z.number().min(0).max(1).refine(xe)}).strict()]),U=zod.z.union([H,zod.z.object({gradient:zod.z.object({from:H,to:H,direction:zod.z.enum(["horizontal","vertical"]).optional(),steps:zod.z.int().min(2).max(L.maxGradientSteps).optional()}).strict()}).strict()]),be={x:P,y:P,width:I,height:I},Ht=zod.z.object({type:zod.z.literal("rect"),...be,radius:oe.optional(),fill:U,hole:zod.z.object({...be,radius:oe.optional()}).strict().optional()}).strict(),$t=zod.z.object({type:zod.z.literal("circle"),cx:P,cy:P,r:I,hole:I.optional(),fill:U}).strict(),Vt=zod.z.object({type:zod.z.literal("ellipse"),cx:P,cy:P,rx:I,ry:I,fill:U}).strict(),Xt=zod.z.object({type:zod.z.literal("polygon"),points:zod.z.array(zod.z.tuple([P,P])).min(3).max(L.maxPolygonPoints),fill:U}).strict(),Zt=zod.z.object({type:zod.z.literal("path"),d:zod.z.string().min(2).max(L.maxPathLength),fill:U,fillRule:zod.z.enum(["nonzero","evenodd"]).optional()}).strict(),Kt=zod.z.object({type:zod.z.literal("line"),x1:P,y1:P,x2:P,y2:P,width:I,cap:zod.z.enum(["butt","round"]).optional(),dash:zod.z.tuple([I,I]).optional(),fill:U}).strict(),Wt=zod.z.object({type:zod.z.literal("icon"),icon:zod.z.enum(et),x:P,y:P,size:I,fill:U}).strict(),it=zod.z.discriminatedUnion("type",[Ht,$t,Vt,Xt,Zt,Kt,Wt]),at={id:zod.z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:zod.z.enum(["primary","secondary","fixed"]),text:zod.z.string().max(200),maxLength:zod.z.int().min(1).max(q).optional(),color:H,weight:zod.z.enum(["bold","regular"]).optional()},Jt=zod.z.object({type:zod.z.literal("text"),...at,box:zod.z.object(be).strict(),align:zod.z.enum(["start","middle","end"]).optional(),fontSize:I.optional()}).strict(),en=zod.z.object({type:zod.z.literal("curved"),...at,curve:zod.z.object({cx:P,cy:P,radius:I,side:zod.z.enum(["top","bottom"]),spread:zod.z.number().min(20).max(300).refine(xe).optional()}).strict(),fontSize:I}).strict(),st=zod.z.discriminatedUnion("type",[Jt,en]),Ze=P.refine(e=>e>=L.minArtboard&&e<=L.maxArtboard,{message:`Artboard sides must be ${L.minArtboard} to ${L.maxArtboard} units`}),tn=zod.z.object({kind:zod.z.literal(Ke),version:zod.z.literal(We),artboard:zod.z.object({width:Ze,height:Ze}).strict(),qr:zod.z.object({x:P,y:P,size:I,padding:oe.optional(),radius:oe.optional()}).strict(),colors:zod.z.object({frame:re,text:re.optional(),accent:re.optional()}).strict(),shapes:zod.z.array(it).max(L.maxShapes),labels:zod.z.array(st).max(L.maxLabels),bleed:zod.z.union([zod.z.literal("none"),H]).optional()}).strict();function ct(e){let i=ge(e);return {x0:e.qr.x-i,y0:e.qr.y-i,x1:e.qr.x+e.qr.size+i,y1:e.qr.y+e.qr.size+i}}function ge(e){return e.qr.padding??e.qr.size*L.defaultPadding}var nn=(e,i)=>Math.min(e.x1,i.x1)-Math.max(e.x0,i.x0)>1e-6&&Math.min(e.y1,i.y1)-Math.max(e.y0,i.y0)>1e-6;function rn(e){switch(e.type){case "rect":return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height},segments:e.hole?18:9};case "circle":return {bounds:{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r},segments:e.hole?10:5};case "ellipse":return {bounds:{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry},segments:5};case "polygon":{let i=e.points.map(([l])=>l),s=e.points.map(([,l])=>l);return {bounds:{x0:Math.min(...i),y0:Math.min(...s),x1:Math.max(...i),y1:Math.max(...s)},segments:e.points.length}}case "path":{let i=He(e.d,L.maxDecimals);return i?{bounds:Ve(Xe(e.d)),segments:$e(i)}:{bounds:null,segments:0}}case "line":{let i=e.width/2,s=Math.hypot(e.x2-e.x1,e.y2-e.y1),l=e.dash?Math.ceil(s/(e.dash[0]+e.dash[1])):1;return {bounds:{x0:Math.min(e.x1,e.x2)-i,y0:Math.min(e.y1,e.y2)-i,x1:Math.max(e.x1,e.x2)+i,y1:Math.max(e.y1,e.y2)+i},segments:l*(e.cap==="round"?4:5)}}default:return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.size,y1:e.y+e.size},segments:nt}}}function on(e,i){let s=(c,y=[])=>i.addIssue({code:"custom",message:c,path:y}),l=L,u=new TextEncoder().encode(JSON.stringify(e)).length;if(u>l.maxBytes){s(`The spec is ${u} bytes; the limit is ${l.maxBytes}`);return}let{width:R,height:b}=e.artboard,n=Math.max(R,b)*.005,r={x0:-n,y0:-n,x1:R+n,y1:b+n},t=c=>c.x0>=r.x0&&c.y0>=r.y0&&c.x1<=r.x1&&c.y1<=r.y1,{qr:o}=e,a=ge(e);a<o.size*l.minPadding-1e-9&&s(`qr.padding must be at least ${l.minPadding*100}% of qr.size`,["qr","padding"]),o.size<Math.min(R,b)*l.minQrShare-1e-9&&s(`qr.size must be at least ${l.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=ct(e);(p.x0<-1e-9||p.y0<-1e-9||p.x1>R+1e-9||p.y1>b+1e-9)&&s("The code and its padding must sit inside the artboard",["qr"]),(o.radius??0)>(o.size+2*a)/2&&s("qr.radius is larger than half the plate",["qr","radius"]);let m=0,f=0;e.shapes.forEach((c,y)=>{let A=["shapes",y],{bounds:T,segments:M}=rn(c);if(!T){s("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...A,"d"]);return}if(t(T)||s("The shape extends outside the artboard",A),c.type==="rect"&&c.hole){let{hole:g}=c;(g.x<c.x||g.y<c.y||g.x+g.width>c.x+c.width+1e-9||g.y+g.height>c.y+c.height+1e-9)&&s("The hole must sit inside its rect",[...A,"hole"]);}c.type==="circle"&&c.hole&&c.hole>=c.r&&s("The hole must be smaller than the circle",[...A,"hole"]),m+=M,typeof c.fill=="object"&&"gradient"in c.fill&&(f+=(c.fill.gradient.steps??32)*M);}),m>l.maxSegments&&s(`The shapes have ${m} segments; the limit is ${l.maxSegments}`,["shapes"]),f>l.maxGradientWork&&s("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=new Set,S=new Set;e.labels.forEach((c,y)=>{let A=["labels",y];h.has(c.id)&&s(`Label id "${c.id}" is used twice`,[...A,"id"]),h.add(c.id),c.slot!=="fixed"&&(S.has(c.slot)&&s(`Only one label may use the ${c.slot} slot`,[...A,"slot"]),S.add(c.slot));let T=c.maxLength??l.maxTextLength;c.text!==ot(c.text,T)&&s(`Label text must be at most ${T} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...A,"text"]);let M;if(c.type==="text")M={x0:c.box.x,y0:c.box.y,x1:c.box.x+c.box.width,y1:c.box.y+c.box.height},c.fontSize!==void 0&&c.fontSize>c.box.height*tt+1e-9&&s("fontSize may be at most 95% of the label's row height",[...A,"fontSize"]),nn(M,p)&&s("The label overlaps the code or its padding",[...A,"box"]);else {let{cx:g,cy:E,radius:_}=c.curve,N=c.fontSize*te*.6;M={x0:g-_-N,y0:E-_-N,x1:g+_+N,y1:E+_+N};let k=Math.hypot(Math.max(p.x0-g,0,g-p.x1),Math.max(p.y0-E,0,E-p.y1));Math.hypot(Math.max(Math.abs(p.x0-g),Math.abs(p.x1-g)),Math.max(Math.abs(p.y0-E),Math.abs(p.y1-E)))<=_-N||k>=_+N||s("The curved label crosses the code or its padding",[...A,"curve"]);}t(M)||s("The label extends outside the artboard",A);});}var Se=tn.superRefine(on);function an(e){let i=Se.safeParse(e);return i.success?[]:i.error.issues.map(s=>s.path.length>0?`${s.path.join(".")}: ${s.message}`:s.message)}var lt=ne.extend({style:zod.z.literal(Je),spec:Se}),Ee=zod.z.discriminatedUnion("style",[ne,lt]);var mt=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Ae=zod.z.enum(mt);var ut=["square","rounded","circle"],Ce=zod.z.enum(ut),pt=zod.z.object({src:zod.z.string(),height:zod.z.number(),width:zod.z.number(),excavate:zod.z.boolean(),x:zod.z.number().optional(),y:zod.z.number().optional(),padding:zod.z.number().min(0).optional(),shape:Ce.optional(),plate:zod.z.string().optional()}),dt=.1,ft=.3,cn=.25,ht=2,ln=zod.z.object({size:zod.z.number().min(dt).max(ft).optional(),padding:zod.z.number().min(0).max(ht).optional(),x:zod.z.number().min(0).max(1).optional(),y:zod.z.number().min(0).max(1).optional(),shape:Ce.optional(),plate:zod.z.string().optional()}),yt=zod.z.enum(["L","M","Q","H"]),bt=.5,xt=1,mn=.07,gt=["square","circle","heart"],St=zod.z.enum(gt),un=3,Z=64,Me=8,pn=.42,Et=zod.z.object({type:zod.z.literal("silhouette"),width:zod.z.number().int().min(Me).max(Z),height:zod.z.number().int().min(Me).max(Z),cells:zod.z.string().max(Z*Z).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(e=>e.cells.length===e.width*e.height,{message:"Silhouette cells do not match its width and height"}),At=zod.z.union([St,Et]),dn=["topLeft","topRight","bottomLeft"],ie=zod.z.object({outer:B.optional(),inner:B.optional()}),Mt=zod.z.object({topLeft:ie.optional(),topRight:ie.optional(),bottomLeft:ie.optional()}),fn=zod.z.object({value:zod.z.string(),size:zod.z.number().optional(),level:yt.optional(),bgColor:B.optional(),fgColor:B.optional(),eyeColor:B.optional(),dotColor:B.optional(),bodyPattern:Ae.optional(),cornerEyePattern:de.optional(),cornerEyeDotPattern:ue.optional(),margin:zod.z.number().optional(),imageSettings:pt.optional(),isOGContext:zod.z.boolean().optional(),templateId:zod.z.string().optional(),customProps:zod.z.record(zod.z.string(),zod.z.any()).optional(),frame:Ee.optional(),art:ce.optional(),eyeColors:Mt.optional(),moduleScale:zod.z.number().min(bt).max(xt).optional(),autoLevel:zod.z.boolean().optional(),shape:At.optional()});var hn=zod.z.object({fgColor:zod.z.string().optional(),bgColor:zod.z.string().optional()}),yn=zod.z.object({pixelSize:zod.z.number(),url:zod.z.string()}),bn=zod.z.object({id:zod.z.string(),name:zod.z.string(),description:zod.z.string().optional()});/**
|
|
2
2
|
* @license QR Code generator library (TypeScript)
|
|
3
3
|
* Copyright (c) Project Nayuki.
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/exports.AUTO_LEVEL_LOGO_COVERAGE=mn;exports.BODY_PATTERN=mt;exports.CORNER_EYE_DOT_PATTERNS=me;exports.CORNER_EYE_PATTERNS=pe;exports.CUSTOM_FRAME_STYLE=Je;exports.DEFAULT_FRAME_TEXT=Gt;exports.DEFAULT_MARGIN=
|
|
5
|
+
*/exports.AUTO_LEVEL_LOGO_COVERAGE=mn;exports.BODY_PATTERN=mt;exports.CORNER_EYE_DOT_PATTERNS=me;exports.CORNER_EYE_PATTERNS=pe;exports.CUSTOM_FRAME_STYLE=Je;exports.DEFAULT_FRAME_TEXT=Gt;exports.DEFAULT_MARGIN=Lt;exports.EYE_POSITIONS=dn;exports.FRAME_COLOR_TOKENS=rt;exports.FRAME_FONT_SCALE_MAX=te;exports.FRAME_FONT_SCALE_MIN=je;exports.FRAME_ICONS=et;exports.FRAME_ICON_MAX_SEGMENTS=nt;exports.FRAME_SPEC_KIND=Ke;exports.FRAME_SPEC_LABEL_MAX_FONT=tt;exports.FRAME_SPEC_LIMITS=L;exports.FRAME_SPEC_VERSION=We;exports.FRAME_STYLES=Qe;exports.FRAME_TEXT_MAX_LENGTH=q;exports.LOGO_PADDING_MAX=ht;exports.LOGO_SHAPES=ut;exports.LOGO_SIZE_DEFAULT=cn;exports.LOGO_SIZE_MAX=ft;exports.LOGO_SIZE_MIN=dt;exports.MODULE_SCALE_MAX=xt;exports.MODULE_SCALE_MIN=bt;exports.QR_ART_MAX_SAMPLE_SIZE=V;exports.QR_ART_MODES=Te;exports.QR_ART_VARIANTS=se;exports.QR_CIRCLE_QUIET_MIN=un;exports.QR_SHAPES=gt;exports.QR_SILHOUETTE_MAX_CELLS=Z;exports.QR_SILHOUETTE_MIN_CELLS=Me;exports.QR_SILHOUETTE_MIN_SHARE=pn;exports.RETIRED_CORNER_EYE_DOT_PATTERNS=Ue;exports.RETIRED_CORNER_EYE_PATTERNS=ke;exports.angularGradientSchema=ve;exports.anyFrameSchema=Ee;exports.baseTemplatePropsSchema=hn;exports.bodyPatternSchema=Ae;exports.colorConfigSchema=B;exports.colorTypeSchema=It;exports.cornerEyeDotPatternSchema=ue;exports.cornerEyePatternSchema=de;exports.customFrameSchema=lt;exports.errorLevelSchema=yt;exports.excavationSchema=zt;exports.eyeColorOverrideSchema=ie;exports.eyeColorsSchema=Mt;exports.frameSchema=ne;exports.frameSpecColorSchema=H;exports.frameSpecLabelSchema=st;exports.frameSpecPadding=ge;exports.frameSpecPaintSchema=U;exports.frameSpecQrZone=ct;exports.frameSpecSchema=Se;exports.frameSpecShapeSchema=it;exports.frameStyleSchema=Ye;exports.getColorString=vt;exports.getFrameSpecIssues=an;exports.getNormalizedColor=wt;exports.getSolidColor=_t;exports.gradientStopSchema=ee;exports.imageFitSchema=we;exports.imagePaintSchema=De;exports.imagePositionCss=Be;exports.imagePositionSchema=ze;exports.imageSettingsSchema=pt;exports.isGradient=Ot;exports.isImagePaint=Ft;exports.isLatin1Text=Yt;exports.linearGradientSchema=Oe;exports.logoOptionsSchema=ln;exports.logoShapeSchema=Ce;exports.normalizeColorConfig=le;exports.pickableCornerEyeDotPatternSchema=Dt;exports.pickableCornerEyePatternSchema=Bt;exports.qrArtImageSchema=_e;exports.qrArtModeSchema=Ne;exports.qrArtSchema=ce;exports.qrArtVariantSchema=Le;exports.qrCodeShapeSchema=At;exports.qrPropsSchema=fn;exports.qrShapeSchema=St;exports.qrSilhouetteSchema=Et;exports.radialGradientSchema=Fe;exports.sanitizeFrameText=ot;exports.solidColorSchema=Ie;exports.templateConfigSchema=yn;exports.templateDefinitionBaseSchema=bn;//# sourceMappingURL=index.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {z}from'zod';var Y;(R=>{class e{constructor(n,r,t,o){this.version=n;this.errorCorrectionLevel=r;if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=n*4+17;let a=[];for(let m=0;m<this.size;m++)a.push(false);for(let m=0;m<this.size;m++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(t);if(this.drawCodewords(p),o==-1){let m=1e9;for(let f=0;f<8;f++){this.applyMask(f),this.drawFormatBits(f);let h=this.getPenaltyScore();h<m&&(o=f,m=h),this.applyMask(f);}}l(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[];}version;errorCorrectionLevel;static encodeText(n,r){let t=R.QrSegment.makeSegments(n);return e.encodeSegments(t,r)}static encodeBinary(n,r){let t=R.QrSegment.makeBytes(n);return e.encodeSegments([t],r)}static encodeSegments(n,r,t=1,o=40,a=-1,p=true){if(!(e.MIN_VERSION<=t&&t<=o&&o<=e.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let m,f;for(m=t;;m++){let y=e.getNumDataCodewords(m,r)*8,A=u.getTotalBits(n,m);if(A<=y){f=A;break}if(m>=o)throw new RangeError("Data too long")}for(let y of [e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])p&&f<=e.getNumDataCodewords(m,y)*8&&(r=y);let h=[];for(let y of n){i(y.mode.modeBits,4,h),i(y.numChars,y.mode.numCharCountBits(m),h);for(let A of y.getData())h.push(A);}l(h.length==f);let S=e.getNumDataCodewords(m,r)*8;l(h.length<=S),i(0,Math.min(4,S-h.length),h),i(0,(8-h.length%8)%8,h),l(h.length%8==0);for(let y=236;h.length<S;y^=253)i(y,8,h);let c=[];for(;c.length*8<h.length;)c.push(0);return h.forEach((y,A)=>c[A>>>3]|=y<<7-(A&7)),new e(m,r,c,a)}size;mask;modules=[];isFunction=[];getModule(n,r){return 0<=n&&n<this.size&&0<=r&&r<this.size&&this.modules[r][n]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let n=this.getAlignmentPatternPositions(),r=n.length;for(let t=0;t<r;t++)for(let o=0;o<r;o++)t==0&&o==0||t==0&&o==r-1||t==r-1&&o==0||this.drawAlignmentPattern(n[t],n[o]);this.drawFormatBits(0),this.drawVersion();}drawFormatBits(n){let r=this.errorCorrectionLevel.formatBits<<3|n,t=r;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;let o=(r<<10|t)^21522;l(o>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,s(o,a));this.setFunctionModule(8,7,s(o,6)),this.setFunctionModule(8,8,s(o,7)),this.setFunctionModule(7,8,s(o,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,s(o,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,s(o,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,s(o,a));this.setFunctionModule(8,this.size-8,true);}drawVersion(){if(this.version<7)return;let n=this.version;for(let t=0;t<12;t++)n=n<<1^(n>>>11)*7973;let r=this.version<<12|n;l(r>>>18==0);for(let t=0;t<18;t++){let o=s(r,t),a=this.size-11+t%3,p=Math.floor(t/3);this.setFunctionModule(a,p,o),this.setFunctionModule(p,a,o);}}drawFinderPattern(n,r){for(let t=-4;t<=4;t++)for(let o=-4;o<=4;o++){let a=Math.max(Math.abs(o),Math.abs(t)),p=n+o,m=r+t;0<=p&&p<this.size&&0<=m&&m<this.size&&this.setFunctionModule(p,m,a!=2&&a!=4);}}drawAlignmentPattern(n,r){for(let t=-2;t<=2;t++)for(let o=-2;o<=2;o++)this.setFunctionModule(n+o,r+t,Math.max(Math.abs(o),Math.abs(t))!=1);}setFunctionModule(n,r,t){this.modules[r][n]=t,this.isFunction[r][n]=true;}addEccAndInterleave(n){let r=this.version,t=this.errorCorrectionLevel;if(n.length!=e.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");let o=e.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],a=e.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],p=Math.floor(e.getNumRawDataModules(r)/8),m=o-p%o,f=Math.floor(p/o),h=[],S=e.reedSolomonComputeDivisor(a);for(let y=0,A=0;y<o;y++){let T=n.slice(A,A+f-a+(y<m?0:1));A+=T.length;let M=e.reedSolomonComputeRemainder(T,S);y<m&&T.push(0),h.push(T.concat(M));}let c=[];for(let y=0;y<h[0].length;y++)h.forEach((A,T)=>{(y!=f-a||T>=m)&&c.push(A[y]);});return l(c.length==p),c}drawCodewords(n){if(n.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let o=0;o<this.size;o++)for(let a=0;a<2;a++){let p=t-a,f=(t+1&2)==0?this.size-1-o:o;!this.isFunction[f][p]&&r<n.length*8&&(this.modules[f][p]=s(n[r>>>3],7-(r&7)),r++);}}l(r==n.length*8);}applyMask(n){if(n<0||n>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let t=0;t<this.size;t++){let o;switch(n){case 0:o=(t+r)%2==0;break;case 1:o=r%2==0;break;case 2:o=t%3==0;break;case 3:o=(t+r)%3==0;break;case 4:o=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:o=t*r%2+t*r%3==0;break;case 6:o=(t*r%2+t*r%3)%2==0;break;case 7:o=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&o&&(this.modules[r][t]=!this.modules[r][t]);}}getPenaltyScore(){let n=0;for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[a][h]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[a][h],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][a]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[h][a],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size-1;a++)for(let p=0;p<this.size-1;p++){let m=this.modules[a][p];m==this.modules[a][p+1]&&m==this.modules[a+1][p]&&m==this.modules[a+1][p+1]&&(n+=e.PENALTY_N2);}let r=0;for(let a of this.modules)r=a.reduce((p,m)=>p+(m?1:0),r);let t=this.size*this.size,o=Math.ceil(Math.abs(r*20-t*10)/t)-1;return l(0<=o&&o<=9),n+=o*e.PENALTY_N4,l(0<=n&&n<=2568888),n}getAlignmentPatternPositions(){if(this.version==1)return [];{let n=Math.floor(this.version/7)+2,r=this.version==32?26:Math.ceil((this.version*4+4)/(n*2-2))*2,t=[6];for(let o=this.size-7;t.length<n;o-=r)t.splice(1,0,o);return t}}static getNumRawDataModules(n){if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*n+128)*n+64;if(n>=2){let t=Math.floor(n/7)+2;r-=(25*t-10)*t-55,n>=7&&(r-=36);}return l(208<=r&&r<=29648),r}static getNumDataCodewords(n,r){return Math.floor(e.getNumRawDataModules(n)/8)-e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n]*e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n]}static reedSolomonComputeDivisor(n){if(n<1||n>255)throw new RangeError("Degree out of range");let r=[];for(let o=0;o<n-1;o++)r.push(0);r.push(1);let t=1;for(let o=0;o<n;o++){for(let a=0;a<r.length;a++)r[a]=e.reedSolomonMultiply(r[a],t),a+1<r.length&&(r[a]^=r[a+1]);t=e.reedSolomonMultiply(t,2);}return r}static reedSolomonComputeRemainder(n,r){let t=r.map(o=>0);for(let o of n){let a=o^t.shift();t.push(0),r.forEach((p,m)=>t[m]^=e.reedSolomonMultiply(p,a));}return t}static reedSolomonMultiply(n,r){if(n>>>8||r>>>8)throw new RangeError("Byte out of range");let t=0;for(let o=7;o>=0;o--)t=t<<1^(t>>>7)*285,t^=(r>>>o&1)*n;return l(t>>>8==0),t}finderPenaltyCountPatterns(n){let r=n[1];l(r<=this.size*3);let t=r>0&&n[2]==r&&n[3]==r*3&&n[4]==r&&n[5]==r;return (t&&n[0]>=r*4&&n[6]>=r?1:0)+(t&&n[6]>=r*4&&n[0]>=r?1:0)}finderPenaltyTerminateAndCount(n,r,t){return n&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(n,r){r[0]==0&&(n+=this.size),r.pop(),r.unshift(n);}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}R.QrCode=e;function i(b,n,r){if(n<0||n>31||b>>>n)throw new RangeError("Value out of range");for(let t=n-1;t>=0;t--)r.push(b>>>t&1);}function s(b,n){return (b>>>n&1)!=0}function l(b){if(!b)throw new Error("Assertion error")}class u{constructor(n,r,t){this.mode=n;this.numChars=r;this.bitData=t;if(r<0)throw new RangeError("Invalid argument");this.bitData=t.slice();}mode;numChars;bitData;static makeBytes(n){let r=[];for(let t of n)i(t,8,r);return new u(u.Mode.BYTE,n.length,r)}static makeNumeric(n){if(!u.isNumeric(n))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<n.length;){let o=Math.min(n.length-t,3);i(parseInt(n.substr(t,o),10),o*3+1,r),t+=o;}return new u(u.Mode.NUMERIC,n.length,r)}static makeAlphanumeric(n){if(!u.isAlphanumeric(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],t;for(t=0;t+2<=n.length;t+=2){let o=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t))*45;o+=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t+1)),i(o,11,r);}return t<n.length&&i(u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t)),6,r),new u(u.Mode.ALPHANUMERIC,n.length,r)}static makeSegments(n){return n==""?[]:u.isNumeric(n)?[u.makeNumeric(n)]:u.isAlphanumeric(n)?[u.makeAlphanumeric(n)]:[u.makeBytes(u.toUtf8ByteArray(n))]}static makeEci(n){let r=[];if(n<0)throw new RangeError("ECI assignment value out of range");if(n<128)i(n,8,r);else if(n<16384)i(2,2,r),i(n,14,r);else if(n<1e6)i(6,3,r),i(n,21,r);else throw new RangeError("ECI assignment value out of range");return new u(u.Mode.ECI,0,r)}static isNumeric(n){return u.NUMERIC_REGEX.test(n)}static isAlphanumeric(n){return u.ALPHANUMERIC_REGEX.test(n)}getData(){return this.bitData.slice()}static getTotalBits(n,r){let t=0;for(let o of n){let a=o.mode.numCharCountBits(r);if(o.numChars>=1<<a)return 1/0;t+=4+a+o.bitData.length;}return t}static toUtf8ByteArray(n){n=encodeURI(n);let r=[];for(let t=0;t<n.length;t++)n.charAt(t)!="%"?r.push(n.charCodeAt(t)):(r.push(parseInt(n.substr(t+1,2),16)),t+=2);return r}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}R.QrSegment=u;})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.ordinal=R;this.formatBits=b;}ordinal;formatBits;static LOW=new s(0,1);static MEDIUM=new s(1,0);static QUARTILE=new s(2,3);static HIGH=new s(3,2)}l.Ecc=s;})(i.QrCode||={});})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.modeBits=R;this.numBitsCharCount=b;}modeBits;numBitsCharCount;static NUMERIC=new s(1,[10,12,14]);static ALPHANUMERIC=new s(2,[9,11,13]);static BYTE=new s(4,[8,16,16]);static KANJI=new s(8,[8,10,12]);static ECI=new s(7,[0,0,0]);numCharCountBits(R){return this.numBitsCharCount[Math.floor((R+7)/17)]}}l.Mode=s;})(i.QrSegment||={});})(Y||={});var $=Y;({L:$.QrCode.Ecc.LOW,M:$.QrCode.Ecc.MEDIUM,Q:$.QrCode.Ecc.QUARTILE,H:$.QrCode.Ecc.HIGH});var Nt=0;function _t(e,i="#000000"){return e?typeof e=="string"?e:e.type==="solid"?e.color:e.type==="image"?e.underlay||i:(e.type==="linear"||e.type==="radial"||e.type==="angular")&&e.stops[0]?.color||i:i}var Te=["logo","halftone"],Le=z.enum(Te),se={logo:["blend","badge"],halftone:["color","mono"]},Ne=z.enum([...se.logo,...se.halftone]),V=192,Pe=e=>Math.ceil(e/3)*4,_e=z.object({width:z.number().int().min(1).max(V),height:z.number().int().min(1).max(V),data:z.string().max(Pe(V*V*4))}).refine(e=>e.data.length===Pe(e.width*e.height*4),{message:"Art image data does not match its width and height"}),ce=z.object({mode:Le,image:_e,intensity:z.number().min(0).max(1).optional(),variant:Ne.optional(),matchEyes:z.boolean().optional()});var It=z.enum(["solid","linear","radial","angular","image"]),Ie=z.object({type:z.literal("solid"),color:z.string()}),ee=z.object({color:z.string(),offset:z.number().min(0).max(100)}),Oe=z.object({type:z.literal("linear"),stops:z.array(ee).min(2),angle:z.number().optional().default(0)}),Fe=z.object({type:z.literal("radial"),stops:z.array(ee).min(2)}),ve=z.object({type:z.literal("angular"),stops:z.array(ee).min(2),angle:z.number().optional().default(0)}),we=z.enum(["cover","contain","tile"]),ze=z.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),De=z.object({type:z.literal("image"),src:z.string().min(1),fit:we.optional().default("cover"),scale:z.number().min(.1).max(4).optional().default(1),position:ze.optional().default("center"),opacity:z.number().min(0).max(1).optional().default(1),underlay:z.string().optional()}),B=z.union([z.string(),Ie,Oe,Fe,ve,De]);function le(e,i="#000000"){return e?typeof e=="string"?{type:"solid",color:e}:e:{type:"solid",color:i}}function Ot(e){return !e||typeof e=="string"?false:e.type==="linear"||e.type==="radial"||e.type==="angular"}function Ft(e){return typeof e=="object"&&e!==null&&e.type==="image"}function vt(e,i="#000000"){let s=le(e,i);return s.type==="solid"?s.color:s.type==="image"?s.underlay||i:s.stops[0]?.color||i}function Be(e="center"){let[i,s]=e.split("-");return e==="center"?"center":s?`${s} ${i}`:i==="top"||i==="bottom"?`center ${i}`:`${i} center`}function wt(e){if(!e)return "#000000";if(typeof e=="string")return e;let i=le(e);if(i.type==="solid")return i.color;if(i.type==="image"){let u=i.fit==="tile"?`${25*(i.scale??1)}% auto`:(i.scale??1)===1?i.fit==="contain"?"contain":"cover":`${100*(i.scale??1)}% auto`,R=i.fit==="tile"?"repeat":"no-repeat";return `${`url("${i.src.replace(/"/g,"%22")}")`} ${Be(i.position)} / ${u} ${R}, ${i.underlay??"transparent"}`}let l=[...i.stops].sort((u,R)=>u.offset-R.offset).map(u=>`${u.color} ${u.offset}%`).join(", ");return i.type==="linear"?`linear-gradient(${(i.angle??0)+90}deg, ${l})`:i.type==="angular"?`conic-gradient(from ${i.angle??0}deg, ${l})`:`radial-gradient(circle, ${l})`}var zt=z.object({x:z.number(),y:z.number(),w:z.number(),h:z.number()});var me=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Ue=["diamond","star","banner"],ue=z.enum([...me,...Ue]),Dt=z.enum(me);var pe=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ke=["curly"],de=z.enum([...pe,...ke]),Bt=z.enum(pe);var je=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],q=24,Gt="Scan me",Qe=.5,te=1.5,Ye=z.enum(je),ne=z.object({style:Ye,text:z.string().max(q).optional(),color:z.string().optional(),textColor:z.string().optional(),secondaryText:z.string().max(q).optional(),secondaryColor:z.string().optional(),fontScale:z.number().min(Qe).max(te).optional()});var Ut={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},qt=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,fe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function He(e,i=Number.POSITIVE_INFINITY){if(!qt.test(e))return null;let s=[],l=0,u=()=>{for(;l<e.length&&/[\s,]/.test(e[l]);)l++;},R=()=>{u(),fe.lastIndex=l;let r=fe.exec(e);if(!r)return null;let t=r[0],o=t.indexOf(".");if(o>=0&&t.length-o-1>i)return null;l=fe.lastIndex;let a=Number(t);return Number.isFinite(a)?a:null},b=()=>{u();let r=e[l];return r==="0"||r==="1"?(l++,r==="1"?1:0):null},n=()=>(u(),l<e.length&&/[0-9.+-]/.test(e[l]));for(u();l<e.length;){let r=e[l],t=r.toUpperCase(),o=Ut[t];if(o===void 0||s.length===0&&t!=="M")return null;if(l++,o===0){s.push({command:r,values:[]}),u();continue}let a=r,p=true;for(;p||n();){let m=[];for(let f=0;f<o;f++){let h=t==="A"&&(f===3||f===4)?b():R();if(h===null)return null;m.push(h);}s.push({command:a,values:m}),t==="M"&&(a=r==="M"?"L":"l"),p=false;}u();}return s}function $e(e){let i=0;for(let{command:s}of e)i+=s.toUpperCase()==="A"?4:1;return i}function Ve(e){let i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY,R=(b,n)=>{i=Math.min(i,b),s=Math.min(s,n),l=Math.max(l,b),u=Math.max(u,n);};for(let b of e)b.op==="C"?(R(b.x1,b.y1),R(b.x2,b.y2),R(b.x,b.y)):b.op!=="Z"&&R(b.x,b.y);return Number.isFinite(i)?{x0:i,y0:s,x1:l,y1:u}:null}var he=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function kt(e,i,s,l,u,R,b,n,r){if(e===n&&i===r)return [];let t=Math.abs(s),o=Math.abs(l);if(t===0||o===0)return [{op:"L",x:n,y:r}];let a=u*Math.PI/180,p=Math.cos(a),m=Math.sin(a),f=(e-n)/2,h=(i-r)/2,S=p*f+m*h,c=-m*f+p*h,y=S*S/(t*t)+c*c/(o*o);y>1&&(t*=Math.sqrt(y),o*=Math.sqrt(y));let A=t*t*o*o-t*t*c*c-o*o*S*S,T=t*t*c*c+o*o*S*S,M=(R===b?-1:1)*Math.sqrt(Math.max(0,A/T)),g=M*t*c/o,E=-M*o*S/t,_=p*g-m*E+(e+n)/2,L=m*g+p*E+(i+r)/2,k=(F,O,w,J)=>Math.atan2(F*J-O*w,F*w+O*J),K=k(1,0,(S-g)/t,(c-E)/o),D=k((S-g)/t,(c-E)/o,(-S-g)/t,(-c-E)/o);!b&&D>0?D-=2*Math.PI:b&&D<0&&(D+=2*Math.PI);let j=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2)-1e-9)),Q=D/j,W=4/3*Math.tan(Q/4),ae=(F,O)=>[_+t*p*F-o*m*O,L+t*m*F+o*p*O],Re=[];for(let F=0;F<j;F++){let O=K+F*Q,w=O+Q,[J,Ct]=ae(Math.cos(O)-W*Math.sin(O),Math.sin(O)+W*Math.cos(O)),[Rt,Pt]=ae(Math.cos(w)+W*Math.sin(w),Math.sin(w)-W*Math.cos(w)),[Tt,Lt]=F===j-1?[n,r]:ae(Math.cos(w),Math.sin(w));Re.push({op:"C",x1:J,y1:Ct,x2:Rt,y2:Pt,x:Tt,y:Lt});}return Re}function Xe(e){let i=[],s=0,l=0,u=0,R=0,b=0,n="",r=null,t=null,o=()=>{for(;s<e.length&&/[\s,]/.test(e[s]);)s++;},a=()=>{o(),he.lastIndex=s;let f=he.exec(e);return f?(s=he.lastIndex,Number(f[0])):null},p=()=>{o();let f=e[s];return f==="0"||f==="1"?(s++,f==="1"):null},m=f=>{let h=[];for(let S=0;S<f;S++){let c=a();if(c===null)return null;h.push(c);}return h};for(;o(),!(s>=e.length);){let f=e[s];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(f))n=f,s++;else if(!n||n==="Z"||n==="z")break;let h=n===n.toLowerCase(),S=h?l:0,c=h?u:0,y=n.toUpperCase();if(y==="Z"){i.push({op:"Z"}),l=R,u=b,r=null,t=null;continue}if(y==="A"){let g=m(3),E=p(),_=p(),L=m(2);if(!(g&&L)||E===null||_===null)break;let[k,K,D]=g,j=L[0]+S,Q=L[1]+c;i.push(...kt(l,u,k,K,D,E,_,j,Q)),l=j,u=Q,r=null,t=null;continue}let A={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[y]??0,T=m(A);if(!T)break;let M=T;switch(y){case "M":l=M[0]+S,u=M[1]+c,R=l,b=u,i.push({op:"M",x:l,y:u}),n=h?"l":"L",r=null,t=null;break;case "L":case "H":case "V":y!=="V"&&(l=M[0]+S),y==="V"?u=M[0]+c:y==="L"&&(u=M[1]+c),i.push({op:"L",x:l,y:u}),r=null,t=null;break;case "C":case "S":{let g,E;y==="C"?(g=[M[0]+S,M[1]+c],E=M.slice(2)):(g=r?[2*l-r[0],2*u-r[1]]:[l,u],E=M);let _=[E[0]+S,E[1]+c],L=[E[2]+S,E[3]+c];i.push({op:"C",x1:g[0],y1:g[1],x2:_[0],y2:_[1],x:L[0],y:L[1]}),[l,u]=L,r=_,t=null;break}case "Q":case "T":{let g,E;y==="Q"?(g=[M[0]+S,M[1]+c],E=[M[2]+S,M[3]+c]):(g=t?[2*l-t[0],2*u-t[1]]:[l,u],E=[M[0]+S,M[1]+c]),i.push({op:"C",x1:l+2/3*(g[0]-l),y1:u+2/3*(g[1]-u),x2:E[0]+2/3*(g[0]-E[0]),y2:E[1]+2/3*(g[1]-E[1]),x:E[0],y:E[1]}),[l,u]=E,t=g,r=null;break}}}return i}var Ke="qrdx.frame",We=1,Je="custom",N={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:q},et=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],tt=.95,nt=200,rt=["frame","text","accent","background"],jt=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Qt=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function ot(e,i=q){let s=e.slice(0,1e3).normalize("NFC").replace(jt," ").replace(Qt,"").replace(/\s+/g," ").trim();return Array.from(s).slice(0,Math.max(0,i)).join("").trim()}function Yt(e){for(let i of e)if((i.codePointAt(0)??0)>255)return false;return true}var xe=e=>Math.abs(e*1e3-Math.round(e*1e3))<1e-6,P=z.number().min(-N.maxCoordinate).max(N.maxCoordinate).refine(xe,{message:`Numbers may have at most ${N.maxDecimals} decimals`}),I=P.refine(e=>e>0,{message:"Must be greater than 0"}),oe=P.refine(e=>e>=0,{message:"Must not be negative"}),re=z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),ye=z.union([z.enum(rt),re]),H=z.union([ye,z.object({mix:z.tuple([ye,ye]),amount:z.number().min(0).max(1).refine(xe)}).strict()]),U=z.union([H,z.object({gradient:z.object({from:H,to:H,direction:z.enum(["horizontal","vertical"]).optional(),steps:z.int().min(2).max(N.maxGradientSteps).optional()}).strict()}).strict()]),be={x:P,y:P,width:I,height:I},Ht=z.object({type:z.literal("rect"),...be,radius:oe.optional(),fill:U,hole:z.object({...be,radius:oe.optional()}).strict().optional()}).strict(),$t=z.object({type:z.literal("circle"),cx:P,cy:P,r:I,hole:I.optional(),fill:U}).strict(),Vt=z.object({type:z.literal("ellipse"),cx:P,cy:P,rx:I,ry:I,fill:U}).strict(),Xt=z.object({type:z.literal("polygon"),points:z.array(z.tuple([P,P])).min(3).max(N.maxPolygonPoints),fill:U}).strict(),Zt=z.object({type:z.literal("path"),d:z.string().min(2).max(N.maxPathLength),fill:U,fillRule:z.enum(["nonzero","evenodd"]).optional()}).strict(),Kt=z.object({type:z.literal("line"),x1:P,y1:P,x2:P,y2:P,width:I,cap:z.enum(["butt","round"]).optional(),dash:z.tuple([I,I]).optional(),fill:U}).strict(),Wt=z.object({type:z.literal("icon"),icon:z.enum(et),x:P,y:P,size:I,fill:U}).strict(),it=z.discriminatedUnion("type",[Ht,$t,Vt,Xt,Zt,Kt,Wt]),at={id:z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:z.enum(["primary","secondary","fixed"]),text:z.string().max(200),maxLength:z.int().min(1).max(q).optional(),color:H,weight:z.enum(["bold","regular"]).optional()},Jt=z.object({type:z.literal("text"),...at,box:z.object(be).strict(),align:z.enum(["start","middle","end"]).optional(),fontSize:I.optional()}).strict(),en=z.object({type:z.literal("curved"),...at,curve:z.object({cx:P,cy:P,radius:I,side:z.enum(["top","bottom"]),spread:z.number().min(20).max(300).refine(xe).optional()}).strict(),fontSize:I}).strict(),st=z.discriminatedUnion("type",[Jt,en]),Ze=P.refine(e=>e>=N.minArtboard&&e<=N.maxArtboard,{message:`Artboard sides must be ${N.minArtboard} to ${N.maxArtboard} units`}),tn=z.object({kind:z.literal(Ke),version:z.literal(We),artboard:z.object({width:Ze,height:Ze}).strict(),qr:z.object({x:P,y:P,size:I,padding:oe.optional(),radius:oe.optional()}).strict(),colors:z.object({frame:re,text:re.optional(),accent:re.optional()}).strict(),shapes:z.array(it).max(N.maxShapes),labels:z.array(st).max(N.maxLabels),bleed:z.union([z.literal("none"),H]).optional()}).strict();function ct(e){let i=ge(e);return {x0:e.qr.x-i,y0:e.qr.y-i,x1:e.qr.x+e.qr.size+i,y1:e.qr.y+e.qr.size+i}}function ge(e){return e.qr.padding??e.qr.size*N.defaultPadding}var nn=(e,i)=>Math.min(e.x1,i.x1)-Math.max(e.x0,i.x0)>1e-6&&Math.min(e.y1,i.y1)-Math.max(e.y0,i.y0)>1e-6;function rn(e){switch(e.type){case "rect":return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height},segments:e.hole?18:9};case "circle":return {bounds:{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r},segments:e.hole?10:5};case "ellipse":return {bounds:{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry},segments:5};case "polygon":{let i=e.points.map(([l])=>l),s=e.points.map(([,l])=>l);return {bounds:{x0:Math.min(...i),y0:Math.min(...s),x1:Math.max(...i),y1:Math.max(...s)},segments:e.points.length}}case "path":{let i=He(e.d,N.maxDecimals);return i?{bounds:Ve(Xe(e.d)),segments:$e(i)}:{bounds:null,segments:0}}case "line":{let i=e.width/2,s=Math.hypot(e.x2-e.x1,e.y2-e.y1),l=e.dash?Math.ceil(s/(e.dash[0]+e.dash[1])):1;return {bounds:{x0:Math.min(e.x1,e.x2)-i,y0:Math.min(e.y1,e.y2)-i,x1:Math.max(e.x1,e.x2)+i,y1:Math.max(e.y1,e.y2)+i},segments:l*(e.cap==="round"?4:5)}}default:return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.size,y1:e.y+e.size},segments:nt}}}function on(e,i){let s=(c,y=[])=>i.addIssue({code:"custom",message:c,path:y}),l=N,u=new TextEncoder().encode(JSON.stringify(e)).length;if(u>l.maxBytes){s(`The spec is ${u} bytes; the limit is ${l.maxBytes}`);return}let{width:R,height:b}=e.artboard,n=Math.max(R,b)*.005,r={x0:-n,y0:-n,x1:R+n,y1:b+n},t=c=>c.x0>=r.x0&&c.y0>=r.y0&&c.x1<=r.x1&&c.y1<=r.y1,{qr:o}=e,a=ge(e);a<o.size*l.minPadding-1e-9&&s(`qr.padding must be at least ${l.minPadding*100}% of qr.size`,["qr","padding"]),o.size<Math.min(R,b)*l.minQrShare-1e-9&&s(`qr.size must be at least ${l.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=ct(e);(p.x0<-1e-9||p.y0<-1e-9||p.x1>R+1e-9||p.y1>b+1e-9)&&s("The code and its padding must sit inside the artboard",["qr"]),(o.radius??0)>(o.size+2*a)/2&&s("qr.radius is larger than half the plate",["qr","radius"]);let m=0,f=0;e.shapes.forEach((c,y)=>{let A=["shapes",y],{bounds:T,segments:M}=rn(c);if(!T){s("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...A,"d"]);return}if(t(T)||s("The shape extends outside the artboard",A),c.type==="rect"&&c.hole){let{hole:g}=c;(g.x<c.x||g.y<c.y||g.x+g.width>c.x+c.width+1e-9||g.y+g.height>c.y+c.height+1e-9)&&s("The hole must sit inside its rect",[...A,"hole"]);}c.type==="circle"&&c.hole&&c.hole>=c.r&&s("The hole must be smaller than the circle",[...A,"hole"]),m+=M,typeof c.fill=="object"&&"gradient"in c.fill&&(f+=(c.fill.gradient.steps??32)*M);}),m>l.maxSegments&&s(`The shapes have ${m} segments; the limit is ${l.maxSegments}`,["shapes"]),f>l.maxGradientWork&&s("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=new Set,S=new Set;e.labels.forEach((c,y)=>{let A=["labels",y];h.has(c.id)&&s(`Label id "${c.id}" is used twice`,[...A,"id"]),h.add(c.id),c.slot!=="fixed"&&(S.has(c.slot)&&s(`Only one label may use the ${c.slot} slot`,[...A,"slot"]),S.add(c.slot));let T=c.maxLength??l.maxTextLength;c.text!==ot(c.text,T)&&s(`Label text must be at most ${T} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...A,"text"]);let M;if(c.type==="text")M={x0:c.box.x,y0:c.box.y,x1:c.box.x+c.box.width,y1:c.box.y+c.box.height},c.fontSize!==void 0&&c.fontSize>c.box.height*tt+1e-9&&s("fontSize may be at most 95% of the label's row height",[...A,"fontSize"]),nn(M,p)&&s("The label overlaps the code or its padding",[...A,"box"]);else {let{cx:g,cy:E,radius:_}=c.curve,L=c.fontSize*te*.6;M={x0:g-_-L,y0:E-_-L,x1:g+_+L,y1:E+_+L};let k=Math.hypot(Math.max(p.x0-g,0,g-p.x1),Math.max(p.y0-E,0,E-p.y1));Math.hypot(Math.max(Math.abs(p.x0-g),Math.abs(p.x1-g)),Math.max(Math.abs(p.y0-E),Math.abs(p.y1-E)))<=_-L||k>=_+L||s("The curved label crosses the code or its padding",[...A,"curve"]);}t(M)||s("The label extends outside the artboard",A);});}var Se=tn.superRefine(on);function an(e){let i=Se.safeParse(e);return i.success?[]:i.error.issues.map(s=>s.path.length>0?`${s.path.join(".")}: ${s.message}`:s.message)}var lt=ne.extend({style:z.literal(Je),spec:Se}),Ee=z.discriminatedUnion("style",[ne,lt]);var mt=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Ae=z.enum(mt);var ut=["square","rounded","circle"],Ce=z.enum(ut),pt=z.object({src:z.string(),height:z.number(),width:z.number(),excavate:z.boolean(),x:z.number().optional(),y:z.number().optional(),padding:z.number().min(0).optional(),shape:Ce.optional(),plate:z.string().optional()}),dt=.1,ft=.3,cn=.25,ht=2,ln=z.object({size:z.number().min(dt).max(ft).optional(),padding:z.number().min(0).max(ht).optional(),x:z.number().min(0).max(1).optional(),y:z.number().min(0).max(1).optional(),shape:Ce.optional(),plate:z.string().optional()}),yt=z.enum(["L","M","Q","H"]),bt=.5,xt=1,mn=.07,gt=["square","circle","heart"],St=z.enum(gt),un=3,Z=64,Me=8,pn=.42,Et=z.object({type:z.literal("silhouette"),width:z.number().int().min(Me).max(Z),height:z.number().int().min(Me).max(Z),cells:z.string().max(Z*Z).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(e=>e.cells.length===e.width*e.height,{message:"Silhouette cells do not match its width and height"}),At=z.union([St,Et]),dn=["topLeft","topRight","bottomLeft"],ie=z.object({outer:B.optional(),inner:B.optional()}),Mt=z.object({topLeft:ie.optional(),topRight:ie.optional(),bottomLeft:ie.optional()}),fn=z.object({value:z.string(),size:z.number().optional(),level:yt.optional(),bgColor:B.optional(),fgColor:B.optional(),eyeColor:B.optional(),dotColor:B.optional(),bodyPattern:Ae.optional(),cornerEyePattern:de.optional(),cornerEyeDotPattern:ue.optional(),margin:z.number().optional(),imageSettings:pt.optional(),isOGContext:z.boolean().optional(),templateId:z.string().optional(),customProps:z.record(z.string(),z.any()).optional(),frame:Ee.optional(),art:ce.optional(),eyeColors:Mt.optional(),moduleScale:z.number().min(bt).max(xt).optional(),autoLevel:z.boolean().optional(),shape:At.optional()});var hn=z.object({fgColor:z.string().optional(),bgColor:z.string().optional()}),yn=z.object({pixelSize:z.number(),url:z.string()}),bn=z.object({id:z.string(),name:z.string(),description:z.string().optional()});/**
|
|
1
|
+
import {z}from'zod';var Y;(R=>{class e{constructor(n,r,t,o){this.version=n;this.errorCorrectionLevel=r;if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=n*4+17;let a=[];for(let m=0;m<this.size;m++)a.push(false);for(let m=0;m<this.size;m++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(t);if(this.drawCodewords(p),o==-1){let m=1e9;for(let f=0;f<8;f++){this.applyMask(f),this.drawFormatBits(f);let h=this.getPenaltyScore();h<m&&(o=f,m=h),this.applyMask(f);}}l(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[];}version;errorCorrectionLevel;static encodeText(n,r){let t=R.QrSegment.makeSegments(n);return e.encodeSegments(t,r)}static encodeBinary(n,r){let t=R.QrSegment.makeBytes(n);return e.encodeSegments([t],r)}static encodeSegments(n,r,t=1,o=40,a=-1,p=true){if(!(e.MIN_VERSION<=t&&t<=o&&o<=e.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let m,f;for(m=t;;m++){let y=e.getNumDataCodewords(m,r)*8,A=u.getTotalBits(n,m);if(A<=y){f=A;break}if(m>=o)throw new RangeError("Data too long")}for(let y of [e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])p&&f<=e.getNumDataCodewords(m,y)*8&&(r=y);let h=[];for(let y of n){i(y.mode.modeBits,4,h),i(y.numChars,y.mode.numCharCountBits(m),h);for(let A of y.getData())h.push(A);}l(h.length==f);let S=e.getNumDataCodewords(m,r)*8;l(h.length<=S),i(0,Math.min(4,S-h.length),h),i(0,(8-h.length%8)%8,h),l(h.length%8==0);for(let y=236;h.length<S;y^=253)i(y,8,h);let c=[];for(;c.length*8<h.length;)c.push(0);return h.forEach((y,A)=>c[A>>>3]|=y<<7-(A&7)),new e(m,r,c,a)}size;mask;modules=[];isFunction=[];getModule(n,r){return 0<=n&&n<this.size&&0<=r&&r<this.size&&this.modules[r][n]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let n=this.getAlignmentPatternPositions(),r=n.length;for(let t=0;t<r;t++)for(let o=0;o<r;o++)t==0&&o==0||t==0&&o==r-1||t==r-1&&o==0||this.drawAlignmentPattern(n[t],n[o]);this.drawFormatBits(0),this.drawVersion();}drawFormatBits(n){let r=this.errorCorrectionLevel.formatBits<<3|n,t=r;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;let o=(r<<10|t)^21522;l(o>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,s(o,a));this.setFunctionModule(8,7,s(o,6)),this.setFunctionModule(8,8,s(o,7)),this.setFunctionModule(7,8,s(o,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,s(o,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,s(o,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,s(o,a));this.setFunctionModule(8,this.size-8,true);}drawVersion(){if(this.version<7)return;let n=this.version;for(let t=0;t<12;t++)n=n<<1^(n>>>11)*7973;let r=this.version<<12|n;l(r>>>18==0);for(let t=0;t<18;t++){let o=s(r,t),a=this.size-11+t%3,p=Math.floor(t/3);this.setFunctionModule(a,p,o),this.setFunctionModule(p,a,o);}}drawFinderPattern(n,r){for(let t=-4;t<=4;t++)for(let o=-4;o<=4;o++){let a=Math.max(Math.abs(o),Math.abs(t)),p=n+o,m=r+t;0<=p&&p<this.size&&0<=m&&m<this.size&&this.setFunctionModule(p,m,a!=2&&a!=4);}}drawAlignmentPattern(n,r){for(let t=-2;t<=2;t++)for(let o=-2;o<=2;o++)this.setFunctionModule(n+o,r+t,Math.max(Math.abs(o),Math.abs(t))!=1);}setFunctionModule(n,r,t){this.modules[r][n]=t,this.isFunction[r][n]=true;}addEccAndInterleave(n){let r=this.version,t=this.errorCorrectionLevel;if(n.length!=e.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");let o=e.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],a=e.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],p=Math.floor(e.getNumRawDataModules(r)/8),m=o-p%o,f=Math.floor(p/o),h=[],S=e.reedSolomonComputeDivisor(a);for(let y=0,A=0;y<o;y++){let T=n.slice(A,A+f-a+(y<m?0:1));A+=T.length;let M=e.reedSolomonComputeRemainder(T,S);y<m&&T.push(0),h.push(T.concat(M));}let c=[];for(let y=0;y<h[0].length;y++)h.forEach((A,T)=>{(y!=f-a||T>=m)&&c.push(A[y]);});return l(c.length==p),c}drawCodewords(n){if(n.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let o=0;o<this.size;o++)for(let a=0;a<2;a++){let p=t-a,f=(t+1&2)==0?this.size-1-o:o;!this.isFunction[f][p]&&r<n.length*8&&(this.modules[f][p]=s(n[r>>>3],7-(r&7)),r++);}}l(r==n.length*8);}applyMask(n){if(n<0||n>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let t=0;t<this.size;t++){let o;switch(n){case 0:o=(t+r)%2==0;break;case 1:o=r%2==0;break;case 2:o=t%3==0;break;case 3:o=(t+r)%3==0;break;case 4:o=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:o=t*r%2+t*r%3==0;break;case 6:o=(t*r%2+t*r%3)%2==0;break;case 7:o=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&o&&(this.modules[r][t]=!this.modules[r][t]);}}getPenaltyScore(){let n=0;for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[a][h]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[a][h],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size;a++){let p=false,m=0,f=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][a]==p?(m++,m==5?n+=e.PENALTY_N1:m>5&&n++):(this.finderPenaltyAddHistory(m,f),p||(n+=this.finderPenaltyCountPatterns(f)*e.PENALTY_N3),p=this.modules[h][a],m=1);n+=this.finderPenaltyTerminateAndCount(p,m,f)*e.PENALTY_N3;}for(let a=0;a<this.size-1;a++)for(let p=0;p<this.size-1;p++){let m=this.modules[a][p];m==this.modules[a][p+1]&&m==this.modules[a+1][p]&&m==this.modules[a+1][p+1]&&(n+=e.PENALTY_N2);}let r=0;for(let a of this.modules)r=a.reduce((p,m)=>p+(m?1:0),r);let t=this.size*this.size,o=Math.ceil(Math.abs(r*20-t*10)/t)-1;return l(0<=o&&o<=9),n+=o*e.PENALTY_N4,l(0<=n&&n<=2568888),n}getAlignmentPatternPositions(){if(this.version==1)return [];{let n=Math.floor(this.version/7)+2,r=this.version==32?26:Math.ceil((this.version*4+4)/(n*2-2))*2,t=[6];for(let o=this.size-7;t.length<n;o-=r)t.splice(1,0,o);return t}}static getNumRawDataModules(n){if(n<e.MIN_VERSION||n>e.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*n+128)*n+64;if(n>=2){let t=Math.floor(n/7)+2;r-=(25*t-10)*t-55,n>=7&&(r-=36);}return l(208<=r&&r<=29648),r}static getNumDataCodewords(n,r){return Math.floor(e.getNumRawDataModules(n)/8)-e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n]*e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n]}static reedSolomonComputeDivisor(n){if(n<1||n>255)throw new RangeError("Degree out of range");let r=[];for(let o=0;o<n-1;o++)r.push(0);r.push(1);let t=1;for(let o=0;o<n;o++){for(let a=0;a<r.length;a++)r[a]=e.reedSolomonMultiply(r[a],t),a+1<r.length&&(r[a]^=r[a+1]);t=e.reedSolomonMultiply(t,2);}return r}static reedSolomonComputeRemainder(n,r){let t=r.map(o=>0);for(let o of n){let a=o^t.shift();t.push(0),r.forEach((p,m)=>t[m]^=e.reedSolomonMultiply(p,a));}return t}static reedSolomonMultiply(n,r){if(n>>>8||r>>>8)throw new RangeError("Byte out of range");let t=0;for(let o=7;o>=0;o--)t=t<<1^(t>>>7)*285,t^=(r>>>o&1)*n;return l(t>>>8==0),t}finderPenaltyCountPatterns(n){let r=n[1];l(r<=this.size*3);let t=r>0&&n[2]==r&&n[3]==r*3&&n[4]==r&&n[5]==r;return (t&&n[0]>=r*4&&n[6]>=r?1:0)+(t&&n[6]>=r*4&&n[0]>=r?1:0)}finderPenaltyTerminateAndCount(n,r,t){return n&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(n,r){r[0]==0&&(n+=this.size),r.pop(),r.unshift(n);}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}R.QrCode=e;function i(b,n,r){if(n<0||n>31||b>>>n)throw new RangeError("Value out of range");for(let t=n-1;t>=0;t--)r.push(b>>>t&1);}function s(b,n){return (b>>>n&1)!=0}function l(b){if(!b)throw new Error("Assertion error")}class u{constructor(n,r,t){this.mode=n;this.numChars=r;this.bitData=t;if(r<0)throw new RangeError("Invalid argument");this.bitData=t.slice();}mode;numChars;bitData;static makeBytes(n){let r=[];for(let t of n)i(t,8,r);return new u(u.Mode.BYTE,n.length,r)}static makeNumeric(n){if(!u.isNumeric(n))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<n.length;){let o=Math.min(n.length-t,3);i(parseInt(n.substr(t,o),10),o*3+1,r),t+=o;}return new u(u.Mode.NUMERIC,n.length,r)}static makeAlphanumeric(n){if(!u.isAlphanumeric(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],t;for(t=0;t+2<=n.length;t+=2){let o=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t))*45;o+=u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t+1)),i(o,11,r);}return t<n.length&&i(u.ALPHANUMERIC_CHARSET.indexOf(n.charAt(t)),6,r),new u(u.Mode.ALPHANUMERIC,n.length,r)}static makeSegments(n){return n==""?[]:u.isNumeric(n)?[u.makeNumeric(n)]:u.isAlphanumeric(n)?[u.makeAlphanumeric(n)]:[u.makeBytes(u.toUtf8ByteArray(n))]}static makeEci(n){let r=[];if(n<0)throw new RangeError("ECI assignment value out of range");if(n<128)i(n,8,r);else if(n<16384)i(2,2,r),i(n,14,r);else if(n<1e6)i(6,3,r),i(n,21,r);else throw new RangeError("ECI assignment value out of range");return new u(u.Mode.ECI,0,r)}static isNumeric(n){return u.NUMERIC_REGEX.test(n)}static isAlphanumeric(n){return u.ALPHANUMERIC_REGEX.test(n)}getData(){return this.bitData.slice()}static getTotalBits(n,r){let t=0;for(let o of n){let a=o.mode.numCharCountBits(r);if(o.numChars>=1<<a)return 1/0;t+=4+a+o.bitData.length;}return t}static toUtf8ByteArray(n){n=encodeURI(n);let r=[];for(let t=0;t<n.length;t++)n.charAt(t)!="%"?r.push(n.charCodeAt(t)):(r.push(parseInt(n.substr(t+1,2),16)),t+=2);return r}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}R.QrSegment=u;})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.ordinal=R;this.formatBits=b;}ordinal;formatBits;static LOW=new s(0,1);static MEDIUM=new s(1,0);static QUARTILE=new s(2,3);static HIGH=new s(3,2)}l.Ecc=s;})(i.QrCode||={});})(Y||={});(i=>{(l=>{class s{constructor(R,b){this.modeBits=R;this.numBitsCharCount=b;}modeBits;numBitsCharCount;static NUMERIC=new s(1,[10,12,14]);static ALPHANUMERIC=new s(2,[9,11,13]);static BYTE=new s(4,[8,16,16]);static KANJI=new s(8,[8,10,12]);static ECI=new s(7,[0,0,0]);numCharCountBits(R){return this.numBitsCharCount[Math.floor((R+7)/17)]}}l.Mode=s;})(i.QrSegment||={});})(Y||={});var $=Y;({L:$.QrCode.Ecc.LOW,M:$.QrCode.Ecc.MEDIUM,Q:$.QrCode.Ecc.QUARTILE,H:$.QrCode.Ecc.HIGH});var Lt=0;function _t(e,i="#000000"){return e?typeof e=="string"?e:e.type==="solid"?e.color:e.type==="image"?e.underlay||i:(e.type==="linear"||e.type==="radial"||e.type==="angular")&&e.stops[0]?.color||i:i}var Te=["logo","halftone"],Ne=z.enum(Te),se={logo:["blend","badge"],halftone:["color","mono"]},Le=z.enum([...se.logo,...se.halftone]),V=192,Pe=e=>Math.ceil(e/3)*4,_e=z.object({width:z.number().int().min(1).max(V),height:z.number().int().min(1).max(V),data:z.string().max(Pe(V*V*4))}).refine(e=>e.data.length===Pe(e.width*e.height*4),{message:"Art image data does not match its width and height"}),ce=z.object({mode:Ne,image:_e,intensity:z.number().min(0).max(1).optional(),variant:Le.optional(),matchEyes:z.boolean().optional()});var It=z.enum(["solid","linear","radial","angular","image"]),Ie=z.object({type:z.literal("solid"),color:z.string()}),ee=z.object({color:z.string(),offset:z.number().min(0).max(100)}),Oe=z.object({type:z.literal("linear"),stops:z.array(ee).min(2),angle:z.number().optional().default(0)}),Fe=z.object({type:z.literal("radial"),stops:z.array(ee).min(2)}),ve=z.object({type:z.literal("angular"),stops:z.array(ee).min(2),angle:z.number().optional().default(0)}),we=z.enum(["cover","contain","tile"]),ze=z.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),De=z.object({type:z.literal("image"),src:z.string().min(1),fit:we.optional().default("cover"),scale:z.number().min(.1).max(4).optional().default(1),position:ze.optional().default("center"),opacity:z.number().min(0).max(1).optional().default(1),underlay:z.string().optional()}),B=z.union([z.string(),Ie,Oe,Fe,ve,De]);function le(e,i="#000000"){return e?typeof e=="string"?{type:"solid",color:e}:e:{type:"solid",color:i}}function Ot(e){return !e||typeof e=="string"?false:e.type==="linear"||e.type==="radial"||e.type==="angular"}function Ft(e){return typeof e=="object"&&e!==null&&e.type==="image"}function vt(e,i="#000000"){let s=le(e,i);return s.type==="solid"?s.color:s.type==="image"?s.underlay||i:s.stops[0]?.color||i}function Be(e="center"){let[i,s]=e.split("-");return e==="center"?"center":s?`${s} ${i}`:i==="top"||i==="bottom"?`center ${i}`:`${i} center`}function wt(e){if(!e)return "#000000";if(typeof e=="string")return e;let i=le(e);if(i.type==="solid")return i.color;if(i.type==="image"){let u=i.fit==="tile"?`${25*(i.scale??1)}% auto`:(i.scale??1)===1?i.fit==="contain"?"contain":"cover":`${100*(i.scale??1)}% auto`,R=i.fit==="tile"?"repeat":"no-repeat";return `${`url("${i.src.replace(/"/g,"%22")}")`} ${Be(i.position)} / ${u} ${R}, ${i.underlay??"transparent"}`}let l=[...i.stops].sort((u,R)=>u.offset-R.offset).map(u=>`${u.color} ${u.offset}%`).join(", ");return i.type==="linear"?`linear-gradient(${(i.angle??0)+90}deg, ${l})`:i.type==="angular"?`conic-gradient(from ${i.angle??0}deg, ${l})`:`radial-gradient(circle, ${l})`}var zt=z.object({x:z.number(),y:z.number(),w:z.number(),h:z.number()});var me=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Ue=["diamond","star","banner"],ue=z.enum([...me,...Ue]),Dt=z.enum(me);var pe=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ke=["curly"],de=z.enum([...pe,...ke]),Bt=z.enum(pe);var Qe=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],q=24,Gt="Scan me",je=.5,te=1.5,Ye=z.enum(Qe),ne=z.object({style:Ye,text:z.string().max(q).optional(),color:z.string().optional(),textColor:z.string().optional(),secondaryText:z.string().max(q).optional(),secondaryColor:z.string().optional(),fontScale:z.number().min(je).max(te).optional()});var Ut={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},qt=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,fe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function He(e,i=Number.POSITIVE_INFINITY){if(!qt.test(e))return null;let s=[],l=0,u=()=>{for(;l<e.length&&/[\s,]/.test(e[l]);)l++;},R=()=>{u(),fe.lastIndex=l;let r=fe.exec(e);if(!r)return null;let t=r[0],o=t.indexOf(".");if(o>=0&&t.length-o-1>i)return null;l=fe.lastIndex;let a=Number(t);return Number.isFinite(a)?a:null},b=()=>{u();let r=e[l];return r==="0"||r==="1"?(l++,r==="1"?1:0):null},n=()=>(u(),l<e.length&&/[0-9.+-]/.test(e[l]));for(u();l<e.length;){let r=e[l],t=r.toUpperCase(),o=Ut[t];if(o===void 0||s.length===0&&t!=="M")return null;if(l++,o===0){s.push({command:r,values:[]}),u();continue}let a=r,p=true;for(;p||n();){let m=[];for(let f=0;f<o;f++){let h=t==="A"&&(f===3||f===4)?b():R();if(h===null)return null;m.push(h);}s.push({command:a,values:m}),t==="M"&&(a=r==="M"?"L":"l"),p=false;}u();}return s}function $e(e){let i=0;for(let{command:s}of e)i+=s.toUpperCase()==="A"?4:1;return i}function Ve(e){let i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY,R=(b,n)=>{i=Math.min(i,b),s=Math.min(s,n),l=Math.max(l,b),u=Math.max(u,n);};for(let b of e)b.op==="C"?(R(b.x1,b.y1),R(b.x2,b.y2),R(b.x,b.y)):b.op!=="Z"&&R(b.x,b.y);return Number.isFinite(i)?{x0:i,y0:s,x1:l,y1:u}:null}var he=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function kt(e,i,s,l,u,R,b,n,r){if(e===n&&i===r)return [];let t=Math.abs(s),o=Math.abs(l);if(t===0||o===0)return [{op:"L",x:n,y:r}];let a=u*Math.PI/180,p=Math.cos(a),m=Math.sin(a),f=(e-n)/2,h=(i-r)/2,S=p*f+m*h,c=-m*f+p*h,y=S*S/(t*t)+c*c/(o*o);y>1&&(t*=Math.sqrt(y),o*=Math.sqrt(y));let A=t*t*o*o-t*t*c*c-o*o*S*S,T=t*t*c*c+o*o*S*S,M=(R===b?-1:1)*Math.sqrt(Math.max(0,A/T)),g=M*t*c/o,E=-M*o*S/t,_=p*g-m*E+(e+n)/2,N=m*g+p*E+(i+r)/2,k=(F,O,w,J)=>Math.atan2(F*J-O*w,F*w+O*J),K=k(1,0,(S-g)/t,(c-E)/o),D=k((S-g)/t,(c-E)/o,(-S-g)/t,(-c-E)/o);!b&&D>0?D-=2*Math.PI:b&&D<0&&(D+=2*Math.PI);let Q=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2)-1e-9)),j=D/Q,W=4/3*Math.tan(j/4),ae=(F,O)=>[_+t*p*F-o*m*O,N+t*m*F+o*p*O],Re=[];for(let F=0;F<Q;F++){let O=K+F*j,w=O+j,[J,Ct]=ae(Math.cos(O)-W*Math.sin(O),Math.sin(O)+W*Math.cos(O)),[Rt,Pt]=ae(Math.cos(w)+W*Math.sin(w),Math.sin(w)-W*Math.cos(w)),[Tt,Nt]=F===Q-1?[n,r]:ae(Math.cos(w),Math.sin(w));Re.push({op:"C",x1:J,y1:Ct,x2:Rt,y2:Pt,x:Tt,y:Nt});}return Re}function Xe(e){let i=[],s=0,l=0,u=0,R=0,b=0,n="",r=null,t=null,o=()=>{for(;s<e.length&&/[\s,]/.test(e[s]);)s++;},a=()=>{o(),he.lastIndex=s;let f=he.exec(e);return f?(s=he.lastIndex,Number(f[0])):null},p=()=>{o();let f=e[s];return f==="0"||f==="1"?(s++,f==="1"):null},m=f=>{let h=[];for(let S=0;S<f;S++){let c=a();if(c===null)return null;h.push(c);}return h};for(;o(),!(s>=e.length);){let f=e[s];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(f))n=f,s++;else if(!n||n==="Z"||n==="z")break;let h=n===n.toLowerCase(),S=h?l:0,c=h?u:0,y=n.toUpperCase();if(y==="Z"){i.push({op:"Z"}),l=R,u=b,r=null,t=null;continue}if(y==="A"){let g=m(3),E=p(),_=p(),N=m(2);if(!(g&&N)||E===null||_===null)break;let[k,K,D]=g,Q=N[0]+S,j=N[1]+c;i.push(...kt(l,u,k,K,D,E,_,Q,j)),l=Q,u=j,r=null,t=null;continue}let A={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[y]??0,T=m(A);if(!T)break;let M=T;switch(y){case "M":l=M[0]+S,u=M[1]+c,R=l,b=u,i.push({op:"M",x:l,y:u}),n=h?"l":"L",r=null,t=null;break;case "L":case "H":case "V":y!=="V"&&(l=M[0]+S),y==="V"?u=M[0]+c:y==="L"&&(u=M[1]+c),i.push({op:"L",x:l,y:u}),r=null,t=null;break;case "C":case "S":{let g,E;y==="C"?(g=[M[0]+S,M[1]+c],E=M.slice(2)):(g=r?[2*l-r[0],2*u-r[1]]:[l,u],E=M);let _=[E[0]+S,E[1]+c],N=[E[2]+S,E[3]+c];i.push({op:"C",x1:g[0],y1:g[1],x2:_[0],y2:_[1],x:N[0],y:N[1]}),[l,u]=N,r=_,t=null;break}case "Q":case "T":{let g,E;y==="Q"?(g=[M[0]+S,M[1]+c],E=[M[2]+S,M[3]+c]):(g=t?[2*l-t[0],2*u-t[1]]:[l,u],E=[M[0]+S,M[1]+c]),i.push({op:"C",x1:l+2/3*(g[0]-l),y1:u+2/3*(g[1]-u),x2:E[0]+2/3*(g[0]-E[0]),y2:E[1]+2/3*(g[1]-E[1]),x:E[0],y:E[1]}),[l,u]=E,t=g,r=null;break}}}return i}var Ke="qrdx.frame",We=1,Je="custom",L={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:q},et=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],tt=.95,nt=200,rt=["frame","text","accent","background"],Qt=/[\t\n\v\f\r\u0085\u2028\u2029]/g,jt=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function ot(e,i=q){let s=e.slice(0,1e3).normalize("NFC").replace(Qt," ").replace(jt,"").replace(/\s+/g," ").trim();return Array.from(s).slice(0,Math.max(0,i)).join("").trim()}function Yt(e){for(let i of e)if((i.codePointAt(0)??0)>255)return false;return true}var xe=e=>Math.abs(e*1e3-Math.round(e*1e3))<1e-6,P=z.number().min(-L.maxCoordinate).max(L.maxCoordinate).refine(xe,{message:`Numbers may have at most ${L.maxDecimals} decimals`}),I=P.refine(e=>e>0,{message:"Must be greater than 0"}),oe=P.refine(e=>e>=0,{message:"Must not be negative"}),re=z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),ye=z.union([z.enum(rt),re]),H=z.union([ye,z.object({mix:z.tuple([ye,ye]),amount:z.number().min(0).max(1).refine(xe)}).strict()]),U=z.union([H,z.object({gradient:z.object({from:H,to:H,direction:z.enum(["horizontal","vertical"]).optional(),steps:z.int().min(2).max(L.maxGradientSteps).optional()}).strict()}).strict()]),be={x:P,y:P,width:I,height:I},Ht=z.object({type:z.literal("rect"),...be,radius:oe.optional(),fill:U,hole:z.object({...be,radius:oe.optional()}).strict().optional()}).strict(),$t=z.object({type:z.literal("circle"),cx:P,cy:P,r:I,hole:I.optional(),fill:U}).strict(),Vt=z.object({type:z.literal("ellipse"),cx:P,cy:P,rx:I,ry:I,fill:U}).strict(),Xt=z.object({type:z.literal("polygon"),points:z.array(z.tuple([P,P])).min(3).max(L.maxPolygonPoints),fill:U}).strict(),Zt=z.object({type:z.literal("path"),d:z.string().min(2).max(L.maxPathLength),fill:U,fillRule:z.enum(["nonzero","evenodd"]).optional()}).strict(),Kt=z.object({type:z.literal("line"),x1:P,y1:P,x2:P,y2:P,width:I,cap:z.enum(["butt","round"]).optional(),dash:z.tuple([I,I]).optional(),fill:U}).strict(),Wt=z.object({type:z.literal("icon"),icon:z.enum(et),x:P,y:P,size:I,fill:U}).strict(),it=z.discriminatedUnion("type",[Ht,$t,Vt,Xt,Zt,Kt,Wt]),at={id:z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:z.enum(["primary","secondary","fixed"]),text:z.string().max(200),maxLength:z.int().min(1).max(q).optional(),color:H,weight:z.enum(["bold","regular"]).optional()},Jt=z.object({type:z.literal("text"),...at,box:z.object(be).strict(),align:z.enum(["start","middle","end"]).optional(),fontSize:I.optional()}).strict(),en=z.object({type:z.literal("curved"),...at,curve:z.object({cx:P,cy:P,radius:I,side:z.enum(["top","bottom"]),spread:z.number().min(20).max(300).refine(xe).optional()}).strict(),fontSize:I}).strict(),st=z.discriminatedUnion("type",[Jt,en]),Ze=P.refine(e=>e>=L.minArtboard&&e<=L.maxArtboard,{message:`Artboard sides must be ${L.minArtboard} to ${L.maxArtboard} units`}),tn=z.object({kind:z.literal(Ke),version:z.literal(We),artboard:z.object({width:Ze,height:Ze}).strict(),qr:z.object({x:P,y:P,size:I,padding:oe.optional(),radius:oe.optional()}).strict(),colors:z.object({frame:re,text:re.optional(),accent:re.optional()}).strict(),shapes:z.array(it).max(L.maxShapes),labels:z.array(st).max(L.maxLabels),bleed:z.union([z.literal("none"),H]).optional()}).strict();function ct(e){let i=ge(e);return {x0:e.qr.x-i,y0:e.qr.y-i,x1:e.qr.x+e.qr.size+i,y1:e.qr.y+e.qr.size+i}}function ge(e){return e.qr.padding??e.qr.size*L.defaultPadding}var nn=(e,i)=>Math.min(e.x1,i.x1)-Math.max(e.x0,i.x0)>1e-6&&Math.min(e.y1,i.y1)-Math.max(e.y0,i.y0)>1e-6;function rn(e){switch(e.type){case "rect":return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height},segments:e.hole?18:9};case "circle":return {bounds:{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r},segments:e.hole?10:5};case "ellipse":return {bounds:{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry},segments:5};case "polygon":{let i=e.points.map(([l])=>l),s=e.points.map(([,l])=>l);return {bounds:{x0:Math.min(...i),y0:Math.min(...s),x1:Math.max(...i),y1:Math.max(...s)},segments:e.points.length}}case "path":{let i=He(e.d,L.maxDecimals);return i?{bounds:Ve(Xe(e.d)),segments:$e(i)}:{bounds:null,segments:0}}case "line":{let i=e.width/2,s=Math.hypot(e.x2-e.x1,e.y2-e.y1),l=e.dash?Math.ceil(s/(e.dash[0]+e.dash[1])):1;return {bounds:{x0:Math.min(e.x1,e.x2)-i,y0:Math.min(e.y1,e.y2)-i,x1:Math.max(e.x1,e.x2)+i,y1:Math.max(e.y1,e.y2)+i},segments:l*(e.cap==="round"?4:5)}}default:return {bounds:{x0:e.x,y0:e.y,x1:e.x+e.size,y1:e.y+e.size},segments:nt}}}function on(e,i){let s=(c,y=[])=>i.addIssue({code:"custom",message:c,path:y}),l=L,u=new TextEncoder().encode(JSON.stringify(e)).length;if(u>l.maxBytes){s(`The spec is ${u} bytes; the limit is ${l.maxBytes}`);return}let{width:R,height:b}=e.artboard,n=Math.max(R,b)*.005,r={x0:-n,y0:-n,x1:R+n,y1:b+n},t=c=>c.x0>=r.x0&&c.y0>=r.y0&&c.x1<=r.x1&&c.y1<=r.y1,{qr:o}=e,a=ge(e);a<o.size*l.minPadding-1e-9&&s(`qr.padding must be at least ${l.minPadding*100}% of qr.size`,["qr","padding"]),o.size<Math.min(R,b)*l.minQrShare-1e-9&&s(`qr.size must be at least ${l.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=ct(e);(p.x0<-1e-9||p.y0<-1e-9||p.x1>R+1e-9||p.y1>b+1e-9)&&s("The code and its padding must sit inside the artboard",["qr"]),(o.radius??0)>(o.size+2*a)/2&&s("qr.radius is larger than half the plate",["qr","radius"]);let m=0,f=0;e.shapes.forEach((c,y)=>{let A=["shapes",y],{bounds:T,segments:M}=rn(c);if(!T){s("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...A,"d"]);return}if(t(T)||s("The shape extends outside the artboard",A),c.type==="rect"&&c.hole){let{hole:g}=c;(g.x<c.x||g.y<c.y||g.x+g.width>c.x+c.width+1e-9||g.y+g.height>c.y+c.height+1e-9)&&s("The hole must sit inside its rect",[...A,"hole"]);}c.type==="circle"&&c.hole&&c.hole>=c.r&&s("The hole must be smaller than the circle",[...A,"hole"]),m+=M,typeof c.fill=="object"&&"gradient"in c.fill&&(f+=(c.fill.gradient.steps??32)*M);}),m>l.maxSegments&&s(`The shapes have ${m} segments; the limit is ${l.maxSegments}`,["shapes"]),f>l.maxGradientWork&&s("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=new Set,S=new Set;e.labels.forEach((c,y)=>{let A=["labels",y];h.has(c.id)&&s(`Label id "${c.id}" is used twice`,[...A,"id"]),h.add(c.id),c.slot!=="fixed"&&(S.has(c.slot)&&s(`Only one label may use the ${c.slot} slot`,[...A,"slot"]),S.add(c.slot));let T=c.maxLength??l.maxTextLength;c.text!==ot(c.text,T)&&s(`Label text must be at most ${T} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...A,"text"]);let M;if(c.type==="text")M={x0:c.box.x,y0:c.box.y,x1:c.box.x+c.box.width,y1:c.box.y+c.box.height},c.fontSize!==void 0&&c.fontSize>c.box.height*tt+1e-9&&s("fontSize may be at most 95% of the label's row height",[...A,"fontSize"]),nn(M,p)&&s("The label overlaps the code or its padding",[...A,"box"]);else {let{cx:g,cy:E,radius:_}=c.curve,N=c.fontSize*te*.6;M={x0:g-_-N,y0:E-_-N,x1:g+_+N,y1:E+_+N};let k=Math.hypot(Math.max(p.x0-g,0,g-p.x1),Math.max(p.y0-E,0,E-p.y1));Math.hypot(Math.max(Math.abs(p.x0-g),Math.abs(p.x1-g)),Math.max(Math.abs(p.y0-E),Math.abs(p.y1-E)))<=_-N||k>=_+N||s("The curved label crosses the code or its padding",[...A,"curve"]);}t(M)||s("The label extends outside the artboard",A);});}var Se=tn.superRefine(on);function an(e){let i=Se.safeParse(e);return i.success?[]:i.error.issues.map(s=>s.path.length>0?`${s.path.join(".")}: ${s.message}`:s.message)}var lt=ne.extend({style:z.literal(Je),spec:Se}),Ee=z.discriminatedUnion("style",[ne,lt]);var mt=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Ae=z.enum(mt);var ut=["square","rounded","circle"],Ce=z.enum(ut),pt=z.object({src:z.string(),height:z.number(),width:z.number(),excavate:z.boolean(),x:z.number().optional(),y:z.number().optional(),padding:z.number().min(0).optional(),shape:Ce.optional(),plate:z.string().optional()}),dt=.1,ft=.3,cn=.25,ht=2,ln=z.object({size:z.number().min(dt).max(ft).optional(),padding:z.number().min(0).max(ht).optional(),x:z.number().min(0).max(1).optional(),y:z.number().min(0).max(1).optional(),shape:Ce.optional(),plate:z.string().optional()}),yt=z.enum(["L","M","Q","H"]),bt=.5,xt=1,mn=.07,gt=["square","circle","heart"],St=z.enum(gt),un=3,Z=64,Me=8,pn=.42,Et=z.object({type:z.literal("silhouette"),width:z.number().int().min(Me).max(Z),height:z.number().int().min(Me).max(Z),cells:z.string().max(Z*Z).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(e=>e.cells.length===e.width*e.height,{message:"Silhouette cells do not match its width and height"}),At=z.union([St,Et]),dn=["topLeft","topRight","bottomLeft"],ie=z.object({outer:B.optional(),inner:B.optional()}),Mt=z.object({topLeft:ie.optional(),topRight:ie.optional(),bottomLeft:ie.optional()}),fn=z.object({value:z.string(),size:z.number().optional(),level:yt.optional(),bgColor:B.optional(),fgColor:B.optional(),eyeColor:B.optional(),dotColor:B.optional(),bodyPattern:Ae.optional(),cornerEyePattern:de.optional(),cornerEyeDotPattern:ue.optional(),margin:z.number().optional(),imageSettings:pt.optional(),isOGContext:z.boolean().optional(),templateId:z.string().optional(),customProps:z.record(z.string(),z.any()).optional(),frame:Ee.optional(),art:ce.optional(),eyeColors:Mt.optional(),moduleScale:z.number().min(bt).max(xt).optional(),autoLevel:z.boolean().optional(),shape:At.optional()});var hn=z.object({fgColor:z.string().optional(),bgColor:z.string().optional()}),yn=z.object({pixelSize:z.number(),url:z.string()}),bn=z.object({id:z.string(),name:z.string(),description:z.string().optional()});/**
|
|
2
2
|
* @license QR Code generator library (TypeScript)
|
|
3
3
|
* Copyright (c) Project Nayuki.
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/export{mn as AUTO_LEVEL_LOGO_COVERAGE,mt as BODY_PATTERN,me as CORNER_EYE_DOT_PATTERNS,pe as CORNER_EYE_PATTERNS,Je as CUSTOM_FRAME_STYLE,Gt as DEFAULT_FRAME_TEXT,
|
|
5
|
+
*/export{mn as AUTO_LEVEL_LOGO_COVERAGE,mt as BODY_PATTERN,me as CORNER_EYE_DOT_PATTERNS,pe as CORNER_EYE_PATTERNS,Je as CUSTOM_FRAME_STYLE,Gt as DEFAULT_FRAME_TEXT,Lt as DEFAULT_MARGIN,dn as EYE_POSITIONS,rt as FRAME_COLOR_TOKENS,te as FRAME_FONT_SCALE_MAX,je as FRAME_FONT_SCALE_MIN,et as FRAME_ICONS,nt as FRAME_ICON_MAX_SEGMENTS,Ke as FRAME_SPEC_KIND,tt as FRAME_SPEC_LABEL_MAX_FONT,L as FRAME_SPEC_LIMITS,We as FRAME_SPEC_VERSION,Qe as FRAME_STYLES,q as FRAME_TEXT_MAX_LENGTH,ht as LOGO_PADDING_MAX,ut as LOGO_SHAPES,cn as LOGO_SIZE_DEFAULT,ft as LOGO_SIZE_MAX,dt as LOGO_SIZE_MIN,xt as MODULE_SCALE_MAX,bt as MODULE_SCALE_MIN,V as QR_ART_MAX_SAMPLE_SIZE,Te as QR_ART_MODES,se as QR_ART_VARIANTS,un as QR_CIRCLE_QUIET_MIN,gt as QR_SHAPES,Z as QR_SILHOUETTE_MAX_CELLS,Me as QR_SILHOUETTE_MIN_CELLS,pn as QR_SILHOUETTE_MIN_SHARE,Ue as RETIRED_CORNER_EYE_DOT_PATTERNS,ke as RETIRED_CORNER_EYE_PATTERNS,ve as angularGradientSchema,Ee as anyFrameSchema,hn as baseTemplatePropsSchema,Ae as bodyPatternSchema,B as colorConfigSchema,It as colorTypeSchema,ue as cornerEyeDotPatternSchema,de as cornerEyePatternSchema,lt as customFrameSchema,yt as errorLevelSchema,zt as excavationSchema,ie as eyeColorOverrideSchema,Mt as eyeColorsSchema,ne as frameSchema,H as frameSpecColorSchema,st as frameSpecLabelSchema,ge as frameSpecPadding,U as frameSpecPaintSchema,ct as frameSpecQrZone,Se as frameSpecSchema,it as frameSpecShapeSchema,Ye as frameStyleSchema,vt as getColorString,an as getFrameSpecIssues,wt as getNormalizedColor,_t as getSolidColor,ee as gradientStopSchema,we as imageFitSchema,De as imagePaintSchema,Be as imagePositionCss,ze as imagePositionSchema,pt as imageSettingsSchema,Ot as isGradient,Ft as isImagePaint,Yt as isLatin1Text,Oe as linearGradientSchema,ln as logoOptionsSchema,Ce as logoShapeSchema,le as normalizeColorConfig,Dt as pickableCornerEyeDotPatternSchema,Bt as pickableCornerEyePatternSchema,_e as qrArtImageSchema,Ne as qrArtModeSchema,ce as qrArtSchema,Le as qrArtVariantSchema,At as qrCodeShapeSchema,fn as qrPropsSchema,St as qrShapeSchema,Et as qrSilhouetteSchema,Fe as radialGradientSchema,ot as sanitizeFrameText,Ie as solidColorSchema,yn as templateConfigSchema,bn as templateDefinitionBaseSchema};//# sourceMappingURL=index.mjs.map
|
|
6
6
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../types/public.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/types/qr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as CSS from "csstype";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { type QRArt } from "./art";
|
|
4
4
|
import { type ColorConfig } from "./color";
|
|
@@ -1831,7 +1831,7 @@ export interface QRProps {
|
|
|
1831
1831
|
cornerEyePattern?: CornerEyePattern;
|
|
1832
1832
|
cornerEyeDotPattern?: CornerEyeDotPattern;
|
|
1833
1833
|
margin?: number;
|
|
1834
|
-
style?:
|
|
1834
|
+
style?: QRStyle;
|
|
1835
1835
|
imageSettings?: ImageSettings;
|
|
1836
1836
|
isOGContext?: boolean;
|
|
1837
1837
|
templateId?: string;
|
|
@@ -1844,7 +1844,21 @@ export interface QRProps {
|
|
|
1844
1844
|
autoLevel?: boolean;
|
|
1845
1845
|
shape?: QRCodeShape;
|
|
1846
1846
|
frameLabelMarkers?: boolean;
|
|
1847
|
+
partMarkers?: boolean;
|
|
1847
1848
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1849
|
+
/**
|
|
1850
|
+
* Inline styles for the root element, as a style object (`{ maxWidth: 200 }`):
|
|
1851
|
+
* the same type as React's `CSSProperties`, without needing React.
|
|
1852
|
+
*/
|
|
1853
|
+
export type QRStyle = CSS.Properties<string | number>;
|
|
1854
|
+
/**
|
|
1855
|
+
* Attributes for the root `<svg>`, with React's names (`className`, `style`,
|
|
1856
|
+
* `aria-label`, `data-*`…). Event handlers and functions are left out of
|
|
1857
|
+
* markup, as React leaves them out.
|
|
1858
|
+
*/
|
|
1859
|
+
export interface QRSVGAttributes {
|
|
1860
|
+
[attribute: string]: any;
|
|
1861
|
+
}
|
|
1862
|
+
/** What the core draws (`createQRCodeTree`, `toSVGString`): `QRProps` plus root attributes. */
|
|
1863
|
+
export type QRSVGOptions = QRProps & QRSVGAttributes;
|
|
1850
1864
|
//# sourceMappingURL=qr.d.ts.map
|
package/dist/types/qr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../types/qr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../types/qr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,WAAW,0CAA2C,CAAC;AACpE,eAAO,MAAM,eAAe;;;;EAAsB,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAGxD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;iBAmB9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,kDAAkD;AAClD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;iBAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,gBAAgB;;;;;EAA+B,CAAC;AAE7D,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,wCAAyC,CAAC;AAChE,eAAO,MAAM,aAAa;;;;EAAoB,CAAC;AAC/C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,oDAAoD;AACpD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB;;;;;iBA2B5B,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB;;;;;;;;;mBAA+C,CAAC;AAC9E,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,YAAY,CAAC;AAEjD,qDAAqD;AACrD,eAAO,MAAM,aAAa,gDAAiD,CAAC;AAC5E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,sEAAsE;AACtE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGjC,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI1B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BxB,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,cAAc,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAGzC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAGlC,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,GAAG,CAAC,EAAE,KAAK,CAAC;IAEZ,SAAS,CAAC,EAAE,SAAS,CAAC;IAGtB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,SAAS,CAAC,EAAE,OAAO,CAAC;IAIpB,KAAK,CAAC,EAAE,WAAW,CAAC;IAKpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAK5B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC;CAC1B;AAED,+FAA+F;AAC/F,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CanvasHTMLAttributes, SVGProps } from "react";
|
|
2
|
+
import type { QRProps } from "./qr";
|
|
3
|
+
export type QRPropsCanvas = QRProps & CanvasHTMLAttributes<HTMLCanvasElement>;
|
|
4
|
+
export type QRPropsSVG = QRProps & SVGProps<SVGSVGElement>;
|
|
5
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../types/react.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAC9E,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC"}
|
package/dist/types/template.d.ts
CHANGED
|
@@ -33,10 +33,16 @@ export declare const templateDefinitionBaseSchema: z.ZodObject<{
|
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
export type BaseTemplateProps = z.infer<typeof baseTemplatePropsSchema>;
|
|
35
35
|
export type TemplateConfig = z.infer<typeof templateConfigSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* What a template wrapper receives and returns: React elements when a React
|
|
38
|
+
* component draws the code, the core's plain nodes (`QRNode`) otherwise. A
|
|
39
|
+
* wrapper written with JSX or `h` from "qrdx/core" works in both.
|
|
40
|
+
*/
|
|
41
|
+
export type TemplateNode = any;
|
|
36
42
|
export interface TemplateDefinition<TCustomProps = Record<string, never>> {
|
|
37
43
|
id: string;
|
|
38
44
|
name: string;
|
|
39
45
|
description?: string;
|
|
40
|
-
wrapper: (children:
|
|
46
|
+
wrapper: (children: TemplateNode, props?: BaseTemplateProps & TCustomProps, templateConfig?: TemplateConfig) => TemplateNode;
|
|
41
47
|
}
|
|
42
48
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../types/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../types/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAG/B,MAAM,WAAW,kBAAkB,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,CACP,QAAQ,EAAE,YAAY,EACtB,KAAK,CAAC,EAAE,iBAAiB,GAAG,YAAY,EACxC,cAAc,CAAC,EAAE,cAAc,KAC5B,YAAY,CAAC;CACnB"}
|