### Install QR Code Styling Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Use npm to add the library to your project dependencies. ```bash npm install qr-code-styling ``` -------------------------------- ### Publish to Local Maven Cache Source: https://github.com/willmortimer/qrforge4j/blob/master/documents/MAVEN_INSTALL.md Run these commands to install artifacts locally for testing before a release. ```bash ./gradlew publishAllToMavenLocal ./gradlew -p qrgen-gradle-plugin publishToMavenLocal ``` -------------------------------- ### Request QR Code via HTTP Source: https://github.com/willmortimer/qrforge4j/blob/master/documents/MAVEN_INSTALL.md Example request to generate a PNG QR code using the Ktor route. ```text GET /qr/generate?data=https://example.com&format=PNG ``` -------------------------------- ### GET /qr/generate Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Generates a QR code based on the provided data and format. ```APIDOC ## GET /qr/generate ### Description Generates a QR code image based on the provided query parameters. ### Method GET ### Endpoint /qr/generate ### Parameters #### Query Parameters - **data** (string) - Required - The content to encode in the QR code. - **format** (string) - Optional - The output format (SVG, PNG, JPEG, PDF). ``` -------------------------------- ### GET /qr/health Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Checks the health status of the QR generation service. ```APIDOC ## GET /qr/health ### Description Returns the health status of the service. ### Method GET ### Endpoint /qr/health ``` -------------------------------- ### Build project with Gradle Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Commands to build the project and the plugin using the Gradle wrapper. ```bash ./gradlew build ./gradlew -p qrgen-gradle-plugin build ``` -------------------------------- ### Configuration and Initialization Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Methods for initializing configuration data and managing the parent element for the watermark. ```javascript t.prototype.initConfigData=function(t,e){var i=this;void 0===e&&(e="overwrite"),"append"===e?Object.keys(t).forEach((function(e){i.props&&(i.props[e]=t[e])})):this.props=t,this.options=l(l({},w),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new b(this.props,this.options)},t.prototype.changeParentElement=function(t){if("string"==typeof t){var e=document.querySelector(t);e&&(this.parentElement=e)}else this.parentElement=t;this.parentElement||console.error("[WatermarkJsPlus]: please pass a valid parent element.")} ``` -------------------------------- ### Initialize and Render QR Code Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Create a new QR code instance with custom styling options and append it to a DOM element. ```html QR Code Styling
``` -------------------------------- ### Build project with mise Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Commands to build and verify the project using the mise toolchain manager. ```bash mise install mise run build mise run verify_integrations mise run docs mise run benchmarks mise run build_plugin mise run publish_local ``` -------------------------------- ### Configure QR Code Styling for Node.js Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Demonstrates initializing the library with jsdom and node-canvas for both canvas and SVG output types. ```js const { QRCodeStyling } = require("qr-code-styling/lib/qr-code-styling.common.js"); const nodeCanvas = require("canvas"); const { JSDOM } = require("jsdom"); const fs = require("fs"); const options = { width: 300, height: 300, data: "https://www.facebook.com/", image: "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg", dotsOptions: { color: "#4267b2", type: "rounded" }, backgroundOptions: { color: "#e9ebee", }, imageOptions: { crossOrigin: "anonymous", margin: 20 } } // For canvas type const qrCodeImage = new QRCodeStyling({ jsdom: JSDOM, // this is required nodeCanvas, // this is required, ...options, imageOptions: { saveAsBlob: true, crossOrigin: "anonymous", margin: 20 }, }); qrCodeImage.getRawData("png").then((buffer) => { fs.writeFileSync("test.png", buffer); }); // For svg type const qrCodeSvg = new QRCodeStyling({ jsdom: JSDOM, // this is required type: "svg", ...options }); qrCodeSvg.getRawData("svg").then((buffer) => { fs.writeFileSync("test.svg", buffer); }); // For svg type with the inner-image saved as a blob // (inner-image will render in more places but file will be larger) const qrCodeSvgWithBlobImage = new QRCodeStyling({ jsdom: JSDOM, // this is required nodeCanvas, // this is required type: "svg", ...options, imageOptions: { saveAsBlob: true, crossOrigin: "anonymous", margin: 20 } }); qrCodeSvgWithBlobImage.getRawData("svg").then((buffer) => { fs.writeFileSync("test_blob.svg", buffer); }); ``` -------------------------------- ### Define QR configuration templates Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Use YAML to define reusable QR style profiles. ```yaml profile: kiosk config: layout: width: 640 height: 640 margin: 24 modules: type: ROUNDED alignmentPatterns: enabled: true shape: STAR ``` -------------------------------- ### Initialize QR Code Styling Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Defines the configuration object for the QR code and instantiates the QRCodeStyling class. ```javascript const options = { "type": "svg", "data": "test", // any string "width": 500, // any number "height": 500, // any number "margin": 120, // any number dotsOptions: { type: "dots", }, cornersSquareOptions: { type: "square", }, cornersDotOptions: { type: "square", }, }; const qrCode = new QRCodeStyling(options); ``` -------------------------------- ### Verify API Documentation Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Command to verify the project's API documentation. ```bash ./gradlew verifyDocs ``` -------------------------------- ### Run QR generation via CLI Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Execute QR code generation directly from the command line using the Gradle task. ```bash echo "https://example.com" | ./gradlew qrgen-cli:run --args="--format pdf --dots rounded --round-size --corner-style classy --alignment-shape star --output qr.pdf" ``` -------------------------------- ### Initialize QRBorderPlugin Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html UMD wrapper to expose the QRBorderPlugin to the global scope or module system. ```javascript !function(t,e){ "object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.QRBorderPlugin=e():t.QRBorderPlugin=e()}(this,(()=>(()=>{var t={600:function(t){var e;e=()=>(()=>{var t={665:function(t){t.exports=(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{LICENSE_STATUS:()=>l,LICENSING_MODELS:()=>d,base64Decode:()=>n,base64Encode:()=>o,findScopeNode:()=>g,md5:()=>s,showExpiredSubscriptionGraceLicenseKeyError:()=>v,showExpiredSubscriptionLicenseKeyError:()=>m,showInvalidLicenseKeyError:()=>h,showLicenseKeyScopeError:()=>u,showMissingLicenseKeyError:()=>p});const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=t=>{let e,n,o,a,r,s,l,d="",c=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");c>4,n=(15&r)<<4|s>>2,o=(3&s)<<6|l,d+=String.fromCharCode(e),64!=s&&(d+=String.fromCharCode(n)),64!=l&&(d+=String.fromCharCode(o));return d},o=t=>{let e,n,o,a,r,s,l,d="",c=0;for(t=function(t){for(let e=0;e=128)throw new Error("ASCII only support");return t}(t);c>2,r=(3&e)<<4|n>>4,s=(15&n)<<2|o>>6,l=63&o,isNaN(n)?s=l=64:isNaN(o)&&(l=64),d=d+i.charAt(a)+i.charAt(r)+i.charAt(s)+i.charAt(l);return d},a=[];let r=0;for(;r<64;)a[r]=0|4294967296*Math.sin(++r%Math.PI);function s(t){const e=[];let i,n,o,s=unescape(encodeURI(t))+"€",l=s.length;const d=[i=1732584193,n=4023233417,~i,~n];for(t=--l/4+2|15,e[--t]=8*l;~l;)e[l>>2]|=s.charCodeAt(l)<<8*l--;for(r=s=0;r>4]+a[s]+~~e[r|15&[s,5*s+1,3*s+5,7*s][l]])<<(l=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*l+s++%4])|o>>>-l),i,n])i=0|l[1],n=l[2];for(s=4;s;)d[--s]+=l[s]}for(t="";s<32;)t+=(d[s>>3]>>4*(1^s++)&15).toString(16);return t}var l;!function(t){t.NotFound="NotFound",t.Invalid="Invalid",t.ExpiredSubscription="ExpiredSubscription",t.ExpiredSubscriptionGrace="ExpiredSubscriptionGrace",t.Valid="Valid",t.OutOfScope="OutOfScope",t.InvalidDomain="InvalidDomain"}(l||(l={}));const d=["perpetual","subscription"];function c(t){console.error(["************************************************************","",...t,"","************************************************************"].join("\n"))}function h({organization:t}){c([`${t}: Invalid license key.","","Your icense key isn't valid.","","To solve the issue, you need to double check that `setLicenseKey()` is called with the right argument"])}function u({organization:t,packageName:e}){c([`${t}: License key plan mismatch.","",`Your use of ${e} is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key.`])}function p({packageName:t,organization:e,scope:i}){c([`${e}: Missing license key.","",`The license key is missing. ``` -------------------------------- ### Add core and rendering dependencies Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Dependencies for core QR generation, rendering, and verification. ```kotlin dependencies { implementation("io.github.willmortimer:qrgen-render:2.0.0") // core, svg, png, pdf implementation("io.github.willmortimer:qrgen-verify:2.0.0") // optional decode checks } ``` -------------------------------- ### Add DSL and Ktor dependencies Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Dependencies for using the QRForge4J DSL and Ktor integration. ```kotlin dependencies { implementation("io.github.willmortimer:qrgen-dsl:2.0.0") implementation("io.github.willmortimer:qrgen-ktor:2.0.0") } ``` -------------------------------- ### Integrate QR generation with Ktor Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Expose QR generation endpoints in a Ktor application using the provided routing helper. ```kotlin import io.github.qrgen.ktor.qrGenRoutes import io.ktor.server.application.Application import io.ktor.server.routing.routing fun Application.module() { routing { qrGenRoutes("/qr") } } ``` -------------------------------- ### Define Gradle Properties Source: https://github.com/willmortimer/qrforge4j/blob/master/documents/MAVEN_INSTALL.md Set your GitHub credentials in the local gradle.properties file. ```properties gpr.user=YOUR_GITHUB_USERNAME gpr.key=YOUR_GITHUB_TOKEN ``` -------------------------------- ### Watermark Class Constructor Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Initializes the watermark instance, sets up the canvas context, and calculates layout parameters. ```javascript b=function(){function t(e,i){this.props=e,this.options=i,this.canvas=t.createCanvas(this.options.width,this.options.height),this.recommendOptions=function(t,e,i){var n=t.getContext("2d");if(null===n)throw new Error("get context error");n.font="".concat(e.fontStyle," ").concat(e.fontVariant," ").concat(e.fontWeight," ").concat(e.fontSize," ").concat(e.fontFamily),n.filter=e.filter,n.letterSpacing=e.letterSpacing,n.wordSpacing=e.wordSpacing,(null==e?void 0:e.rotate)&&(e.rotate=(360-e.rotate%360)*(Math.PI/180)),p(i.textRowMaxWidth)&&(e.textRowMaxWidth=e.width);var o={image:{rect:{width:e.imageWidth,height:e.imageHeight},position:{x:0,y:0}},textLine:{data:[],yOffsetValue:0},advancedStyleParams:{linear:{x0:0,x1:0},radial:{x0:0,y0:0,r0:0,x1:0,y1:0,r1:0},conic:{x:0,y:0,startAngle:0},pattern:{}}};switch(e.contentType){case"text":o.textLine.data=[e.content];break;case"multi-line-text":o.textLine.data=function(t,e,i){for(var n=[],o="",a="",r=0,s=e.length;ri&&(n.push(o.substring(0,o.length-1)),o="",r--)):(n.push(o),o="");return n.push(o),n}(n,e.content,e.textRowMaxWidth)}var a=e.width/2,r=e.height/2,s="middle",l="center";switch(p(null==i?void 0:i.translateX)||p(null==i?void 0:i.translateY)?(o.advancedStyleParams.linear.x0=-e.width/2,o.advancedStyleParams.linear.x1=e.width/2,o.advancedStyleParams.radial.r0=0,o.advancedStyleParams.radial.r1=e.width/2):(a=null==i?void 0:i.translateX,r=null==i?void ``` -------------------------------- ### Configure QR codes with Kotlin DSL Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Build complex QR code styles using the fluent Kotlin DSL for shapes, colors, and animations. ```kotlin import io.github.qrgen.dsl.QRCode import io.github.qrgen.core.LocatorFrameShape val svg = QRCode.ofRoundedSquares() .size(640) .withColor("#111827") .backgroundCorners(28.0) .cornerLocators { rounded() logo("https://example.com/corner-logo.png") topRight { outer(LocatorFrameShape.DIAMOND) } } .alignmentPattern { star() color = "#0f766e" } .dotStyle { dynamicSize(0.92) } .animation { pulse() durationSeconds = 2.0 } .buildSvg("https://example.com") ``` -------------------------------- ### QRCodeStyling Configuration Options Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md The QRCodeStyling instance accepts a configuration object to define the appearance and behavior of the generated QR code. ```APIDOC ## QRCodeStyling Configuration ### Description Configure the QRCodeStyling instance to define dimensions, rendering type, data, and visual styling for the QR code. ### Properties - **width** (number) - Size of canvas, default 300 - **height** (number) - Size of canvas, default 300 - **type** (string: 'canvas', 'svg') - The type of the element to render, default 'canvas' - **shape** (string: 'square', 'circle') - The shape of the QR code, default 'square' - **data** (string) - The data to be encoded - **image** (string) - Image to be placed in the center - **margin** (number) - Margin around canvas, default 0 - **qrOptions** (object) - Options passed to qrcode-generator - **imageOptions** (object) - Specific image styling options - **dotsOptions** (object) - Dots styling options - **cornersSquareOptions** (object) - Square in the corners styling options - **cornersDotOptions** (object) - Dots in the corners styling options - **backgroundOptions** (object) - QR background styling options - **nodeCanvas** (node-canvas) - Required for canvas type on node server - **jsDom** (jsdom) - Required for svg type on node server ``` -------------------------------- ### QRCodeStyling.download Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Triggers a download of the QR code image. ```APIDOC ## QRCodeStyling.download(downloadOptions) ### Description Downloads the QR code as an image file. ### Parameters - **downloadOptions** (object) - Optional - Configuration for the download, including 'name' (string) and 'extension' (string). ``` -------------------------------- ### Ktor Integration Source: https://github.com/willmortimer/qrforge4j/blob/master/documents/MAVEN_INSTALL.md Add the Ktor dependency and register the QR generation routes in your application module. ```kotlin dependencies { implementation("io.github.willmortimer:qrgen-ktor:2.0.0") } ``` ```kotlin import io.github.qrgen.ktor.qrGenRoutes import io.ktor.server.application.Application import io.ktor.server.routing.routing fun Application.module() { routing { qrGenRoutes("/qr") } } ``` -------------------------------- ### Render QR codes using QrRenderPipeline Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md The recommended approach for generating QR codes in various output formats like PNG and SVG. ```kotlin import io.github.qrgen.core.QrStyleConfig import io.github.qrgen.render.QrOutputFormat import io.github.qrgen.render.QrRenderPipeline val pipeline = QrRenderPipeline() val pngBytes = pipeline.render("https://example.com", QrStyleConfig(), QrOutputFormat.PNG) val output = pipeline.renderOutput("https://example.com", QrStyleConfig(), QrOutputFormat.SVG) // output.bytes, output.contentType, output.filename ``` -------------------------------- ### QR Code Rendering and Layout Methods Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Internal methods for handling text rendering, image positioning, and grid-based layout generation. ```javascript 0:o.image,(null===(l=null===(s=null===(r=null===(a=this.options)||void 0===a?void 0:a.advancedStyle)||void 0===r?void 0:r.params)||void 0===s?void 0:s.pattern)||void 0===l?void 0:l.repetition)||"")},t.prototype.setText=function(t,e){var i="fillText";"stroke"===this.options.textType&&(i="strokeText"),t[i]&&t[i](e.text,e.x,e.y,e.maxWidth)},t.prototype.drawText=function(t,e){this.setText(t,{text:this.options.content,x:0,y:0-this.recommendOptions.textLine.yOffsetValue,maxWidth:this.options.textRowMaxWidth||this.options.width}),e(t.canvas)},t.prototype.drawImage=function(t,e){var i=this;f(this.options.image).then((function(n){var o=i.getImageRect(n),a=o.width,r=o.height,s=i.getDrawImagePosition(a,r);t.drawImage(n,s.x,s.y,a,r),e(t.canvas)}))},t.prototype.drawMultiLineText=function(t,e){var i=this,n=this.recommendOptions.textLine.data,o=this.recommendOptions.textLine.yOffsetValue;n.forEach((function(e,n){i.setText(t,{text:e,x:0,y:i.options.lineHeight*n-o,maxWidth:i.options.textRowMaxWidth||i.options.width})})),e(t.canvas)},t.prototype.drawRichText=function(t,e){return d(this,void 0,void 0,(function(){var i,n=this;return c(this,(function(o){switch(o.label){case 0:return[4,m(t,this.options)];case 1:return i=o.sent(),f((a=i.element,r=a.outerHTML.replace(/<(img|br|input|hr|embed)(.*?)>/g,"<$1$2/>").replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23"),"data:image/svg+xml;charset=utf-8,".concat(r)),i.width,i.height).then((function(i){var o=n.getDrawImagePosition(i.width,i.height);t.drawImage(i,o.x,o.y,i.width,i.height),e(t.canvas)})),[2]}var a,r}))}))},t.prototype.getImageRect=function(t){var e={width:this.options.imageWidth||0,height:this.options.imageHeight||0};switch(!0){case 0!==e.width&&0===e.height:e.height=e.width*t.height/t.width;break;case 0===e.width&&0!==e.height:e.width=e.height*t.width/t.height;break;case 0===e.width&&0===e.height:e.width=t.width,e.height=t.height}return e},t.prototype.getDrawImagePosition=function(t,e){var i,n,o={x:-t/2,y:-e/2};switch(this.options.translatePlacement){case"top":o.x=-t/2,o.y=0;break;case"top-start":o.x=0,o.y=0;break;case"top-end":o.x=-t,o.y=0;break;case"bottom":o.x=-t/2,o.y=-e;break;case"bottom-start":o.x=0,o.y=-e;break;case"bottom-end":o.x=-t,o.y=-e;break;case"left":o.x=0,o.y=-e/2;break;case"right":o.x=-t,o.y=-e/2}return!p(null===(i=this.props)||void 0===i?void 0:i.translateX)&&(o.x=0),!p(null===(n=this.props)||void 0===n?void 0:n.translateY)&&(o.y=0),o},t}(),S=function(){function t(t,e){var i,n,o,a,r,s;this.options=t,this.partialWidth=this.options.width,this.partialHeight=this.options.height,this.rows=(null===(i=this.options.gridLayoutOptions)||void 0===i?void 0:i.rows)||1,this.cols=(null===(n=this.options.gridLayoutOptions)||void 0===n?void 0:n.cols)||1,this.matrix=(null===(o=this.options.gridLayoutOptions)||void 0===o?void 0:o.matrix)||(r=this.rows,s=this.cols,Array.from({length:r},(function(){return new Array(s).fill(1)}))),this.gap=(null===(a=this.options.gridLayoutOptions)||void 0===a?void 0:a.gap)||[0,0],this.partialCanvas=e}return t.prototype.draw=function(){var t,e,i,n,o,a,r,s,l=b.createCanvas((null===(t=this.options.gridLayoutOptions)||void 0===t?void 0:t.width)||this.partialWidth*this.cols+this.gap[0]*this.cols,(null===(e=this.options.gridLayoutOptions)||void 0===e?void 0:e.height)||this.partialHeight*this.rows+this.gap[1]*this.rows),d=l.getContext("2d");(null===(i=this.options.gridLayoutOptions)||void 0===i?void 0:i.backgroundImage)&&(null==d||d.drawImage(null===(n=this.options.gridLayoutOptions)||void 0===n?void 0:n.backgroundImage,0,0,null===(o=this.options.gridLayoutOptions)||void 0===o?void 0:o.width,null===(a=this.options.gridLayoutOptions)||void 0===a?void 0:a.height));for(var c=0;c void. ``` -------------------------------- ### Register QR style profiles Source: https://github.com/willmortimer/qrforge4j/blob/master/README.md Programmatically register named profiles for use in the application. ```kotlin registry.register("kiosk", patchJsonNode) registry.register("minimal", QrStyleConfig()) ``` -------------------------------- ### QRCodeStyling.append Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Appends the generated QR code to a specified DOM container. ```APIDOC ## QRCodeStyling.append(container) ### Description Appends the QR code instance to the provided DOM element. ### Parameters - **container** (DOM element) - Required - The container element where the QR code will be rendered. ``` -------------------------------- ### Canvas Drawing and Styling Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Methods for rendering QR code components and optional auxiliary lines on the canvas. ```javascript t.prototype.getCanvas=function(){return this.canvas},t.prototype.clear=function(){t.clearCanvas(this.canvas)},t.prototype.draw=function(){var t=this,e=this.canvas.getContext("2d");if(null===e)throw new Error("get context error");return this.options.auxiliaryLine&&(e.beginPath(),e.rect(0,0,this.options.width,this.options.height),e.lineWidth=1,e.strokeStyle="#000",e.stroke(),e.closePath(),e.beginPath(),e.rect(this.options.translateX,this.options.translateY,1,1),e.lineWidth=1,e.strokeStyle="#f00",e.stroke(),e.closePath()),this.setStyle(e),e.save(),e.translate(this.options.translateX,this.options.translateY),e.rotate(this.options.rotate),new ``` -------------------------------- ### Utility Functions for DOM and Async Operations Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Contains core helpers for element creation, image processing, and generator-based asynchronous flow control. ```javascript 0===e&&(e={});var i=e.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}("@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:0 0}75%{background-position:100% -100%}to{background-position:0 0}}");var s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)},l=function(){return l=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&o[o.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]"),document.body.appendChild(n),[4,g(n)];case 1:return c.sent(),o=null===(h=n.querySelector(".rich-text-content"))||void 0===h?void 0:h.getBoundingClientRect(),a=null==o?void 0:o.width,r=null==o?void 0:o.height,document.body.removeChild(n),s=e.richTextWidth||a||e.width,l=e.richTextHeight||r||e.height,i.setAttribute("width",s.toString()),i.setAttribute("height",l.toString()),(d=v("foreignObject",{width:s.toString(),height:l.toString()})).appendChild(n),i.appendChild(d),[2,{element:i,width:s,height:l}}]}))}))};function g(t){return d(this,void 0,void 0,(function(){var e,i,n,o,a;return c(this,(function(r){switch(r.label){case 0:e=t.querySelectorAll("img"),i=function(t){var e,i,n,o;return c(this,(function(a){switch(a.label){case 0:if(!(e=t.getAttribute("src")))return[3,6];a.label=1;case 1:return a.trys.push([1,5,,6]),[4,fetch(e)];case 2:return[4,a.sent().blob()];case 3:return i=a.sent(),[4,new Promise((function(t,e){var n=new FileReader;n.onloadend=function(){return t(n.result)},n.onerror=e,n.readAsDataURL(i)}))];case 4:return"string"==typeof(n=a.sent())&&t.setAttribute("src",n),[3,6];case 5:return o=a.sent(),console.error("Error converting ".concat(e," to base64:"),o),[3,6];case 6:return[2]}}))},n=0,o=Array.from(e),r.label=1;case 1:return n0?(this.remove(),[4,this.create()]):[3,2];case 1:t.sent(),t.label=2;case ``` -------------------------------- ### Define a custom extension for QRCodeStyling Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Use this function to programmatically modify the generated SVG element, such as adding custom borders or shapes. ```javascript const extension = (svg, options) => { const { width, height } = options; const size = Math.min(width, height); const border = document.createElementNS("http://www.w3.org/2000/svg", "rect"); const borderAttributes = { "fill": "none", "x": (width - size + 40) / 2, "y": (height - size + 40) / 2, "width": size - 40, "height": size - 40, "stroke": 'black', "stroke-width": 40, "rx": 100, }; Object.keys(borderAttributes).forEach(attribute => { border.setAttribute(attribute, borderAttributes[attribute]); }); svg.appendChild(border); }; ``` -------------------------------- ### QRCodeStyling.getRawData Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Retrieves the raw data of the QR code as a Blob or Buffer. ```APIDOC ## QRCodeStyling.getRawData(extension) ### Description Returns a Promise that resolves to the QR code data in the specified format. ### Parameters - **extension** (string) - Optional - The format of the data ('png', 'jpeg', 'webp', 'svg'). Defaults to 'png'. ``` -------------------------------- ### QRCodeStyling.deleteExtension Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/README.md Removes any applied extensions from the QR code. ```APIDOC ## QRCodeStyling.deleteExtension() ### Description Clears any extensions previously applied to the QR code instance. ``` -------------------------------- ### Environment Protection Utility Source: https://github.com/willmortimer/qrforge4j/blob/master/ported-library/qr-code-styling-master/src/index.html Locks critical browser APIs to prevent tampering with the watermark rendering environment. ```javascript x=function(t){ "undefined"!=typeof window&&t&&(Object.defineProperty(window,"MutationObserver",{writable:!1,configurable:!1}),Object.defineProperty(window,"requestAnimationFrame",{writable:!1,configurable:!1}))} ```