@barcode-bakery/barcode-react
Version:
Generates barcodes for React.
23 lines (22 loc) • 6.87 kB
JavaScript
;const b=require("react"),M=require("@barcode-bakery/barcode-common");var h={exports:{}},T={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var L;function te(){if(L)return T;L=1;var u=Symbol.for("react.transitional.element"),E=Symbol.for("react.fragment");function s(f,a,c){var v=null;if(c!==void 0&&(v=""+c),a.key!==void 0&&(v=""+a.key),"key"in a){c={};for(var d in a)d!=="key"&&(c[d]=a[d])}else c=a;return a=c.ref,{$$typeof:u,type:f,key:v,ref:a!==void 0?a:null,props:c}}return T.Fragment=E,T.jsx=s,T.jsxs=s,T}var p={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var W;function ne(){return W||(W=1,process.env.NODE_ENV!=="production"&&function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case z:return"Profiler";case G:return"StrictMode";case B:return"Suspense";case H:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case q:return"Portal";case J:return(e.displayName||"Context")+".Provider";case V:return(e._context.displayName||"Context")+".Consumer";case X:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case C:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function E(e){return""+e}function s(e){try{E(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),E(e)}}function f(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=g.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function v(e){if(N.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function d(e,r){function t(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function m(){var e=u(this.type);return D[e]||(D[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function i(e,r,t,n,R,l,S,x){return t=l.ref,e={$$typeof:y,type:e,key:r,props:l,_owner:R},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:m}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,r,t,n,R,l,S,x){var o=r.children;if(o!==void 0)if(n)if(ee(o)){for(n=0;n<o.length;n++)j(o[n]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(o);if(N.call(r,"key")){o=u(e);var _=Object.keys(r).filter(function(re){return re!=="key"});n=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",F[o+n]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,n,o,_,o),F[o+n]=!0)}if(o=null,t!==void 0&&(s(t),o=""+t),v(r)&&(s(r.key),o=""+r.key),"key"in r){t={};for(var A in r)A!=="key"&&(t[A]=r[A])}else t=r;return o&&d(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),i(e,o,l,R,a(),t,S,x)}function j(e){typeof e=="object"&&e!==null&&e.$$typeof===y&&e._store&&(e._store.validated=1)}var w=b,y=Symbol.for("react.transitional.element"),q=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),J=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),g=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,ee=Array.isArray,O=console.createTask?console.createTask:function(){return null};w={"react-stack-bottom-frame":function(e){return e()}};var Y,D={},I=w["react-stack-bottom-frame"].bind(w,c)(),$=O(f(c)),F={};p.Fragment=k,p.jsx=function(e,r,t,n,R){var l=1e4>g.recentlyCreatedOwnerStacks++;return P(e,r,t,!1,n,R,l?Error("react-stack-top-frame"):I,l?O(f(e)):$)},p.jsxs=function(e,r,t,n,R){var l=1e4>g.recentlyCreatedOwnerStacks++;return P(e,r,t,!0,n,R,l?Error("react-stack-top-frame"):I,l?O(f(e)):$)}}()),p}process.env.NODE_ENV==="production"?h.exports=te():h.exports=ne();var oe=h.exports;const U=(u,E)=>{const s=document.createElement("canvas");return s.width=u,s.height=E,{context:s.getContext("2d"),createSurface:U}},ae=(u,E,s)=>{const[f,a]=b.useState(),[c,v]=b.useState(),d=b.useRef(null),m=b.useMemo(()=>{const i=d.current;return i?{context:i.getContext("2d"),createSurface:U}:null},[d.current]);return b.useEffect(()=>{f&&m&&new M.BCGDrawing(m).draw(f)},[f,m]),b.useEffect(()=>{try{a(void 0),v(void 0);const i=new u;E(i),a(i)}catch(i){v(i)}},s==null?void 0:s.concat([a,m])),b.useEffect(()=>{c&&m&&new M.BCGDrawing(m).drawException(c)},[c,m]),{component:oe.jsx("canvas",{width:1,height:1,ref:d})}};exports.useCanvasDisplay=ae;