barkoder-wasm-ocr 1.7.0 → 1.7.1
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/barkoder-umd.d.ts +74 -5
- package/barkoder-umd.js +103 -105
- package/barkoder.wasm +0 -0
- package/package.json +1 -1
package/barkoder-umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(async function(name,context,definition){if(typeof window!=='undefined'&&typeof define=='function'&&define.amd){define(definition)}
|
|
2
|
-
else if(typeof module!=='undefined'&&module.exports){module.exports=definition()}else{context[name]=await definition()}})('BarkoderSDK',this,function(){class DOM_elements{static container=document.getElementById('barkoder-container');static cameraPreview=document.createElement('div');static preview=document.createElement('video');static overlay=document.createElement('canvas');static AR_overlay=document.createElement('canvas');static readyToUse_RO=false;static resizeObserver=new ResizeObserver(()=>{if(DOM_elements.readyToUse_RO)
|
|
3
|
-
{Bridge.resizeHandler();}});static flash=document.createElement('div');static zoom=document.createElement('div');static close=document.createElement('div');static cameraPicker=document.createElement('div');static cameraPickerUI=document.createElement('div');static cameraPickerUI_style=document.createElement('style');static buttonsProperties={flash_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWZsYXNoLW9mZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4Ig0KCSB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDggNDg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOm5vbmU7c3Ryb2tlOiNGRjMzNDc7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qxe2ZpbGw6I0ZGRkZGRjt9DQo8L3N0eWxlPg0KPGcgaWQ9ImJ0bl9iZyI+DQoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTgsMWgzMmMzLjksMCw3LDMuMSw3LDd2MzJjMCwzLjktMy4xLDctNyw3SDhjLTMuOSwwLTctMy4xLTctN1Y4QzEsNC4xLDQuMSwxLDgsMXoiLz4NCjwvZz4NCjxwYXRoIGlkPSJQYXRoXzMxIiBjbGFzcz0ic3QxIiBkPSJNMTgsMTFoMTNsLTQuNSw5SDMxbC05LjEsMTYuOFYyNi41SDE4VjExeiBNMjAuNiwxMy41djEwLjRoMy45djMuNWwyLjYtNC43aC00LjlsNC42LTkuMQ0KCUwyMC42LDEzLjV6Ii8+DQo8L3N2Zz4NCg==','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWZsYXNoLW9uIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiDQoJIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGMzM0Qzt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDBoMzJjNC40LDAsOCwzLjYsOCw4djMyYzAsNC40LTMuNiw4LTgsOEg4Yy00LjQsMC04LTMuNi04LThWOEMwLDMuNiwzLjYsMCw4LDB6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iUGF0aF8zNCIgY2xhc3M9InN0MSIgZD0iTTE4LDExdjE0LjJoMy45djExLjZMMzEsMjEuM2gtNS4yTDMxLDExSDE4eiIvPg0KPC9zdmc+DQo='],zoom_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLXpvb20tb24iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCINCgkgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojRkYzMzQ3O3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lam9pbjpyb3VuZDt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDFoMzJjMy45LDAsNywzLjEsNyw3djMyYzAsMy45LTMuMSw3LTcsN0g4Yy0zLjksMC03LTMuMS03LTdWOEMxLDQuMSw0LjEsMSw4LDF6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iQ29sb3JfT3ZlcmxheSIgY2xhc3M9InN0MSIgZD0iTTMzLjYsMzUuNmwtNC41LTQuNWMtNC43LDMuNi0xMS4zLDIuNy0xNC45LTJzLTIuNy0xMS4zLDItMTQuOXMxMS4zLTIuNywxNC45LDINCgljMi45LDMuOCwyLjksOS4xLDAsMTIuOWw0LjUsNC41YzAuNSwwLjYsMC41LDEuNS0wLjEsMlMzNC4xLDM2LjEsMzMuNiwzNS42TDMzLjYsMzUuNnogTTE0LjgsMjIuNmMwLDQuMywzLjUsNy44LDcuOCw3LjgNCglzNy44LTMuNSw3LjgtNy44cy0zLjUtNy44LTcuOC03LjhDMTguMywxNC44LDE0LjgsMTguMywxNC44LDIyLjZ6IE0yMS42LDI3LjRjLTAuMy0wLjMtMC40LTAuNi0wLjQtMVYyNGgtMi40DQoJYy0wLjgsMC0xLjQtMC42LTEuNC0xLjRzMC42LTEuNCwxLjQtMS40bDAsMGgyLjR2LTIuNGMwLTAuOCwwLjYtMS40LDEuNC0xLjVTMjQsMTgsMjQsMTguOHYwLjF2Mi40aDIuNGMwLjgsMCwxLjQsMC42LDEuNCwxLjQNCglzLTAuNiwxLjQtMS40LDEuNGwwLDBIMjR2Mi40YzAsMC44LTAuNiwxLjQtMS40LDEuNEMyMi4yLDI3LjgsMjEuOSwyNy43LDIxLjYsMjcuNEwyMS42LDI3LjR6Ii8+DQo8L3N2Zz4NCg==','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLXpvb20tb2ZmIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiDQoJIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGMzM0Nzt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDBoMzJjNC40LDAsOCwzLjYsOCw4djMyYzAsNC40LTMuNiw4LTgsOEg4Yy00LjQsMC04LTMuNi04LThWOEMwLDMuNiwzLjYsMCw4LDB6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iQ29sb3JfT3ZlcmxheSIgY2xhc3M9InN0MSIgZD0iTTMzLjYsMzUuNmwtNC41LTQuNWMtNC43LDMuNi0xMS4zLDIuNy0xNC45LTJzLTIuNy0xMS4zLDItMTQuOXMxMS4zLTIuNywxNC45LDINCgljMi45LDMuOCwyLjksOS4xLDAsMTIuOWw0LjUsNC41YzAuNiwwLjUsMC42LDEuNCwwLjEsMmMtMC41LDAuNi0xLjQsMC42LTIsMC4xQzMzLjYsMzUuNywzMy42LDM1LjYsMzMuNiwzNS42TDMzLjYsMzUuNnoNCgkgTTE0LjgsMjIuNmMwLDQuMywzLjUsNy44LDcuOCw3LjhzNy44LTMuNSw3LjgtNy44cy0zLjUtNy44LTcuOC03LjhDMTguMywxNC44LDE0LjgsMTguMywxNC44LDIyLjZ6IE0xOC44LDI0DQoJYy0wLjgsMC0xLjQtMC42LTEuNC0xLjRjMC0wLjgsMC42LTEuNCwxLjQtMS40YzAsMCwwLDAsMCwwaDcuNmMwLjgsMCwxLjQsMC42LDEuNCwxLjRjMCwwLjgtMC42LDEuNC0xLjQsMS40YzAsMCwwLDAsMCwwSDE4Ljh6Ii8+DQo8L3N2Zz4NCg=='],close_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWNsb3NlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9DQoJLnN0MXtmaWxsOm5vbmU7fQ0KPC9zdHlsZT4NCjxwYXRoIGlkPSJQYXRoXzMwIiBjbGFzcz0ic3QwIiBkPSJNMjIsNGwtMi0ybC04LDhMNCwyTDIsNGw4LDhsLTgsOGwyLDJsOC04bDgsOGwyLTJsLTgtOEwyMiw0eiIvPg0KPHJlY3QgaWQ9IlJlY3RhbmdsZV8zOCIgeT0iMCIgY2xhc3M9InN0MSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ii8+DQo8L3N2Zz4NCg=='],cameraPicker_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSwgLmNscy0yIHsKICAgICAgICBmaWxsOiAjRkZGRkZGOwogICAgICAgIHN0cm9rZS13aWR0aDogMHB4OwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGwtcnVsZTogZXZlbm9kZDsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM+CiAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJtMTUsMjIuNzVoLTZjLTUuNDMsMC03Ljc1LTIuMzItNy43NS03Ljc1di02QzEuMjUsMy41NywzLjU3LDEuMjUsOSwxLjI1aDZjNS40MywwLDcuNzUsMi4zMiw3Ljc1LDcuNzV2NmMwLDUuNDMtMi4zMiw3Ljc1LTcuNzUsNy43NVpNOSwyLjc1Yy00LjYxLDAtNi4yNSwxLjY0LTYuMjUsNi4yNXY2YzAsNC42MSwxLjY0LDYuMjUsNi4yNSw2LjI1aDZjNC42MSwwLDYuMjUtMS42NCw2LjI1LTYuMjV2LTZjMC00LjYxLTEuNjQtNi4yNS02LjI1LTYuMjVoLTZaIi8+CiAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJtMTgsNi41Yy0uMTMsMC0uMjYtLjAzLS4zOC0uMDgtLjEyLS4wNS0uMjMtLjEyLS4zMy0uMjEtLjA5LS4xLS4xNy0uMjEtLjIyLS4zMy0uMDUtLjEyLS4wNy0uMjUtLjA3LS4zOHMuMDItLjI2LjA3LS4zOGMuMDYtLjEzLjEzLS4yMy4yMi0uMzMuMDUtLjA0LjEtLjA5LjE1LS4xMi4wNi0uMDQuMTItLjA3LjE4LS4wOS4wNi0uMDMuMTItLjA1LjE5LS4wNi4zMi0uMDcuNjYuMDQuOS4yNy4wOS4xLjE2LjIuMjEuMzMuMDUuMTIuMDguMjUuMDguMzhzLS4wMy4yNi0uMDguMzgtLjEyLjIzLS4yMS4zM2MtLjEuMDktLjIxLjE2LS4zMy4yMS0uMTIuMDUtLjI1LjA4LS4zOC4wOFoiLz4KICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Im0xNS4wNSwxMC4yN2MtLjc1LTEtMS43NC0xLjc0LTMuMy0xLjc4LTEuODEsMC0zLjI1LDEuNDUtMy4yNSwzLjI1LDAsLjQxLS4zNC43NS0uNzUuNzVzLS43NS0uMzQtLjc1LS43NWMwLTQuMjQsNC45Ny02LjEsOC0zLjY1LS4xMi0xLjA2LDEuNDYtMS4yLDEuNS0uMTN2MmMuMDIuNy0uOTEsMS0xLjMyLjQ5bC0uMTMtLjE4Wm0tNi4xOSwzLjljMS44MSwyLjk0LDUuOTQsMi4xNSw2LjE0LTEuNDMsMC0uNDEuMzQtLjc1Ljc1LS43NXMuNzUuMzQuNzUuNzVjLjA4LDMuODYtNC42OSw2LjIyLTcuNTYsMy43LjA3LDEuMDMtMS40NywxLjExLTEuNS4wN3YtMmMtLjAyLS43Mi45OC0xLjAyLDEuMzYtLjQzbC4wNS4wOGgwWiIvPgo8L3N2Zz4='],showFlash:true,showZoom:true,showClose:true,showCameraPicker:true};static previewProperties={x:0,y:0,width:100,height:100,orientation:0};static initialized=false;static initialized_dom=false;static cameraPreview_init(){this.cameraPreview.id="cameraPreview";this.cameraPreview.className="cameraPreview-div";this.cameraPreview.style.position="relative";this.cameraPreview.style.margin="0";this.cameraPreview.style.padding="0";this.cameraPreview.style.outline="0";this.cameraPreview.style.fontSize="100%";this.cameraPreview.style.verticalAlign="baseline";this.cameraPreview.style.background="0 0 black";this.cameraPreview.style.left=""+this.previewProperties.x+"%";this.cameraPreview.style.top=""+this.previewProperties.y+"%";this.cameraPreview.style.width=""+this.previewProperties.width+"%";this.cameraPreview.style.height=""+this.previewProperties.height+"%";this.cameraPreview.style.overflow="hidden";this.cameraPreview.style.zIndex="9999999";this.preview.id="preview";this.preview.className="cameraPreview-video";this.preview.playsInline=true;this.overlay.id="overlay";this.overlay.className="cameraPreview-canvas";this.overlay.style.position="relative";this.overlay.style.top="0%";this.overlay.style.left="0px";this.overlay.style.backgroundColor="transparent";this.overlay.style.zIndex="99999999";this.AR_overlay.id="AR_overlay";this.AR_overlay.className="cameraPreview-canvas";this.AR_overlay.style.position="absolute";this.AR_overlay.style.top="0%";this.AR_overlay.style.left="0px";this.AR_overlay.style.backgroundColor="transparent";this.AR_overlay.style.zIndex="99999999";};static flash_init(handler){this.flash.id="flash-button";if(!this.buttonsProperties.showFlash)this.flash.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.flash_icons[0];this.flash.appendChild(img);this.flash.style.position="absolute";this.flash.style.cssFloat="none";this.flash.style.top="2px";this.flash.style.left="2px";this.flash.style.width="48px";this.flash.style.height="48px";this.flash.style.zIndex="999999999";this.flash.addEventListener('click',handler,false);};static zoom_init(handler){this.zoom.id="zoom-button";if(!this.buttonsProperties.showZoom)this.zoom.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.zoom_icons[0];this.zoom.appendChild(img);this.zoom.style.position="absolute";this.zoom.style.cssFloat="none";this.zoom.style.top="2px";this.zoom.style.right="2px";this.zoom.style.width="48px";this.zoom.style.height="48px";this.zoom.style.zIndex="999999999";this.zoom.addEventListener('click',handler,false);};static close_init(handler){this.close.id="close-button";if(!this.buttonsProperties.showClose)this.close.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.close_icons[0];this.close.appendChild(img);this.close.style.position="absolute";this.close.style.cssFloat="none";this.close.style.right="2px";this.close.style.width="24px";this.close.style.height="24px";this.close.style.zIndex="999999999";this.close.addEventListener('click',handler,false);};static cameraPicker_init(handler){this.cameraPicker.id="cameraPicker-button";if(!this.buttonsProperties.showCameraPicker)this.cameraPicker.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.cameraPicker_icons[0];this.cameraPicker.appendChild(img);this.cameraPicker.style.position="absolute";this.cameraPicker.style.cssFloat="none";this.cameraPicker.style.left="2px";this.cameraPicker.style.width="48px";this.cameraPicker.style.height="48px";this.cameraPicker.style.zIndex="999999999";this.cameraPicker.addEventListener('click',handler,false);};static cameraPickerUI_init(handler){this.cameraPickerUI.id="cameraPickerUI";this.cameraPickerUI_style.id="cameraPickerUI_style";this.cameraPickerUI.style.position="absolute";this.cameraPickerUI.style.cssFloat="none";this.cameraPickerUI.style.top="20%";this.cameraPickerUI.style.left="20%";this.cameraPickerUI.style.width="60%";this.cameraPickerUI.style.maxWidth="90%";this.cameraPickerUI.style.background="transparent";this.cameraPickerUI.style.borderRadius="5px";this.cameraPickerUI.style.zIndex="999999999";};static cameraPickerUI_update(cameras,currentCameraID){let camerasCount=cameras.length;let input_elements=[];let label_elements=[];let elements_IDs=[];let desiredCameraLabels=["back","0","triple"];let tripleCameraPicked=false;for(let i=0;i<camerasCount;i++)
|
|
2
|
+
else if(typeof module!=='undefined'&&module.exports){module.exports=definition()}else{context[name]=await definition()}})('BarkoderSDK',this,function(){class DOM_elements{static container=document.getElementById('barkoder-container');static cameraPreview=document.createElement('div');static preview=document.createElement('video');static overlay=document.createElement('canvas');static AR_overlay=document.createElement('canvas');static previewCanvas=document.createElement('canvas');static previewCanvasFrame=null;static readyToUse_RO=false;static resizeObserver=new ResizeObserver(()=>{if(DOM_elements.readyToUse_RO)
|
|
3
|
+
{Bridge.resizeHandler();}});static flash=document.createElement('div');static zoom=document.createElement('div');static close=document.createElement('div');static cameraPicker=document.createElement('div');static cameraPickerUI=document.createElement('div');static cameraPickerUI_style=document.createElement('style');static buttonsProperties={flash_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWZsYXNoLW9mZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4Ig0KCSB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDggNDg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOm5vbmU7c3Ryb2tlOiNGRjMzNDc7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qxe2ZpbGw6I0ZGRkZGRjt9DQo8L3N0eWxlPg0KPGcgaWQ9ImJ0bl9iZyI+DQoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTgsMWgzMmMzLjksMCw3LDMuMSw3LDd2MzJjMCwzLjktMy4xLDctNyw3SDhjLTMuOSwwLTctMy4xLTctN1Y4QzEsNC4xLDQuMSwxLDgsMXoiLz4NCjwvZz4NCjxwYXRoIGlkPSJQYXRoXzMxIiBjbGFzcz0ic3QxIiBkPSJNMTgsMTFoMTNsLTQuNSw5SDMxbC05LjEsMTYuOFYyNi41SDE4VjExeiBNMjAuNiwxMy41djEwLjRoMy45djMuNWwyLjYtNC43aC00LjlsNC42LTkuMQ0KCUwyMC42LDEzLjV6Ii8+DQo8L3N2Zz4NCg==','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWZsYXNoLW9uIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiDQoJIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGMzM0Qzt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDBoMzJjNC40LDAsOCwzLjYsOCw4djMyYzAsNC40LTMuNiw4LTgsOEg4Yy00LjQsMC04LTMuNi04LThWOEMwLDMuNiwzLjYsMCw4LDB6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iUGF0aF8zNCIgY2xhc3M9InN0MSIgZD0iTTE4LDExdjE0LjJoMy45djExLjZMMzEsMjEuM2gtNS4yTDMxLDExSDE4eiIvPg0KPC9zdmc+DQo='],zoom_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLXpvb20tb24iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCINCgkgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojRkYzMzQ3O3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lam9pbjpyb3VuZDt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDFoMzJjMy45LDAsNywzLjEsNyw3djMyYzAsMy45LTMuMSw3LTcsN0g4Yy0zLjksMC03LTMuMS03LTdWOEMxLDQuMSw0LjEsMSw4LDF6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iQ29sb3JfT3ZlcmxheSIgY2xhc3M9InN0MSIgZD0iTTMzLjYsMzUuNmwtNC41LTQuNWMtNC43LDMuNi0xMS4zLDIuNy0xNC45LTJzLTIuNy0xMS4zLDItMTQuOXMxMS4zLTIuNywxNC45LDINCgljMi45LDMuOCwyLjksOS4xLDAsMTIuOWw0LjUsNC41YzAuNSwwLjYsMC41LDEuNS0wLjEsMlMzNC4xLDM2LjEsMzMuNiwzNS42TDMzLjYsMzUuNnogTTE0LjgsMjIuNmMwLDQuMywzLjUsNy44LDcuOCw3LjgNCglzNy44LTMuNSw3LjgtNy44cy0zLjUtNy44LTcuOC03LjhDMTguMywxNC44LDE0LjgsMTguMywxNC44LDIyLjZ6IE0yMS42LDI3LjRjLTAuMy0wLjMtMC40LTAuNi0wLjQtMVYyNGgtMi40DQoJYy0wLjgsMC0xLjQtMC42LTEuNC0xLjRzMC42LTEuNCwxLjQtMS40bDAsMGgyLjR2LTIuNGMwLTAuOCwwLjYtMS40LDEuNC0xLjVTMjQsMTgsMjQsMTguOHYwLjF2Mi40aDIuNGMwLjgsMCwxLjQsMC42LDEuNCwxLjQNCglzLTAuNiwxLjQtMS40LDEuNGwwLDBIMjR2Mi40YzAsMC44LTAuNiwxLjQtMS40LDEuNEMyMi4yLDI3LjgsMjEuOSwyNy43LDIxLjYsMjcuNEwyMS42LDI3LjR6Ii8+DQo8L3N2Zz4NCg==','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLXpvb20tb2ZmIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiDQoJIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGMzM0Nzt9DQoJLnN0MXtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnIGlkPSJidG5fYmciPg0KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDBoMzJjNC40LDAsOCwzLjYsOCw4djMyYzAsNC40LTMuNiw4LTgsOEg4Yy00LjQsMC04LTMuNi04LThWOEMwLDMuNiwzLjYsMCw4LDB6Ii8+DQo8L2c+DQo8cGF0aCBpZD0iQ29sb3JfT3ZlcmxheSIgY2xhc3M9InN0MSIgZD0iTTMzLjYsMzUuNmwtNC41LTQuNWMtNC43LDMuNi0xMS4zLDIuNy0xNC45LTJzLTIuNy0xMS4zLDItMTQuOXMxMS4zLTIuNywxNC45LDINCgljMi45LDMuOCwyLjksOS4xLDAsMTIuOWw0LjUsNC41YzAuNiwwLjUsMC42LDEuNCwwLjEsMmMtMC41LDAuNi0xLjQsMC42LTIsMC4xQzMzLjYsMzUuNywzMy42LDM1LjYsMzMuNiwzNS42TDMzLjYsMzUuNnoNCgkgTTE0LjgsMjIuNmMwLDQuMywzLjUsNy44LDcuOCw3LjhzNy44LTMuNSw3LjgtNy44cy0zLjUtNy44LTcuOC03LjhDMTguMywxNC44LDE0LjgsMTguMywxNC44LDIyLjZ6IE0xOC44LDI0DQoJYy0wLjgsMC0xLjQtMC42LTEuNC0xLjRjMC0wLjgsMC42LTEuNCwxLjQtMS40YzAsMCwwLDAsMCwwaDcuNmMwLjgsMCwxLjQsMC42LDEuNCwxLjRjMCwwLjgtMC42LDEuNC0xLjQsMS40YzAsMCwwLDAsMCwwSDE4Ljh6Ii8+DQo8L3N2Zz4NCg=='],close_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNy45LjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iYnRuLWNsb3NlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9DQoJLnN0MXtmaWxsOm5vbmU7fQ0KPC9zdHlsZT4NCjxwYXRoIGlkPSJQYXRoXzMwIiBjbGFzcz0ic3QwIiBkPSJNMjIsNGwtMi0ybC04LDhMNCwyTDIsNGw4LDhsLTgsOGwyLDJsOC04bDgsOGwyLTJsLTgtOEwyMiw0eiIvPg0KPHJlY3QgaWQ9IlJlY3RhbmdsZV8zOCIgeT0iMCIgY2xhc3M9InN0MSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ii8+DQo8L3N2Zz4NCg=='],cameraPicker_icons:['data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSwgLmNscy0yIHsKICAgICAgICBmaWxsOiAjRkZGRkZGOwogICAgICAgIHN0cm9rZS13aWR0aDogMHB4OwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGwtcnVsZTogZXZlbm9kZDsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM+CiAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJtMTUsMjIuNzVoLTZjLTUuNDMsMC03Ljc1LTIuMzItNy43NS03Ljc1di02QzEuMjUsMy41NywzLjU3LDEuMjUsOSwxLjI1aDZjNS40MywwLDcuNzUsMi4zMiw3Ljc1LDcuNzV2NmMwLDUuNDMtMi4zMiw3Ljc1LTcuNzUsNy43NVpNOSwyLjc1Yy00LjYxLDAtNi4yNSwxLjY0LTYuMjUsNi4yNXY2YzAsNC42MSwxLjY0LDYuMjUsNi4yNSw2LjI1aDZjNC42MSwwLDYuMjUtMS42NCw2LjI1LTYuMjV2LTZjMC00LjYxLTEuNjQtNi4yNS02LjI1LTYuMjVoLTZaIi8+CiAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJtMTgsNi41Yy0uMTMsMC0uMjYtLjAzLS4zOC0uMDgtLjEyLS4wNS0uMjMtLjEyLS4zMy0uMjEtLjA5LS4xLS4xNy0uMjEtLjIyLS4zMy0uMDUtLjEyLS4wNy0uMjUtLjA3LS4zOHMuMDItLjI2LjA3LS4zOGMuMDYtLjEzLjEzLS4yMy4yMi0uMzMuMDUtLjA0LjEtLjA5LjE1LS4xMi4wNi0uMDQuMTItLjA3LjE4LS4wOS4wNi0uMDMuMTItLjA1LjE5LS4wNi4zMi0uMDcuNjYuMDQuOS4yNy4wOS4xLjE2LjIuMjEuMzMuMDUuMTIuMDguMjUuMDguMzhzLS4wMy4yNi0uMDguMzgtLjEyLjIzLS4yMS4zM2MtLjEuMDktLjIxLjE2LS4zMy4yMS0uMTIuMDUtLjI1LjA4LS4zOC4wOFoiLz4KICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Im0xNS4wNSwxMC4yN2MtLjc1LTEtMS43NC0xLjc0LTMuMy0xLjc4LTEuODEsMC0zLjI1LDEuNDUtMy4yNSwzLjI1LDAsLjQxLS4zNC43NS0uNzUuNzVzLS43NS0uMzQtLjc1LS43NWMwLTQuMjQsNC45Ny02LjEsOC0zLjY1LS4xMi0xLjA2LDEuNDYtMS4yLDEuNS0uMTN2MmMuMDIuNy0uOTEsMS0xLjMyLjQ5bC0uMTMtLjE4Wm0tNi4xOSwzLjljMS44MSwyLjk0LDUuOTQsMi4xNSw2LjE0LTEuNDMsMC0uNDEuMzQtLjc1Ljc1LS43NXMuNzUuMzQuNzUuNzVjLjA4LDMuODYtNC42OSw2LjIyLTcuNTYsMy43LjA3LDEuMDMtMS40NywxLjExLTEuNS4wN3YtMmMtLjAyLS43Mi45OC0xLjAyLDEuMzYtLjQzbC4wNS4wOGgwWiIvPgo8L3N2Zz4='],showFlash:true,showZoom:true,showClose:true,showCameraPicker:true};static previewProperties={x:0,y:0,width:100,height:100,orientation:0};static initialized=false;static initialized_dom=false;static cameraPreview_init(){this.cameraPreview.id="cameraPreview";this.cameraPreview.className="cameraPreview-div";this.cameraPreview.style.position="relative";this.cameraPreview.style.margin="0";this.cameraPreview.style.padding="0";this.cameraPreview.style.outline="0";this.cameraPreview.style.fontSize="100%";this.cameraPreview.style.verticalAlign="baseline";this.cameraPreview.style.background="0 0 black";this.cameraPreview.style.left=""+this.previewProperties.x+"%";this.cameraPreview.style.top=""+this.previewProperties.y+"%";this.cameraPreview.style.width=""+this.previewProperties.width+"%";this.cameraPreview.style.height=""+this.previewProperties.height+"%";this.cameraPreview.style.overflow="hidden";this.cameraPreview.style.zIndex="9999999";this.preview.id="preview";this.preview.className="cameraPreview-video";this.preview.playsInline=true;this.previewCanvas.id="previewCanvas";this.previewCanvas.className="cameraPreview-video-canvas";this.previewCanvas.style.cssText="position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; display: none;";this.overlay.id="overlay";this.overlay.className="cameraPreview-canvas";this.overlay.style.position="relative";this.overlay.style.top="0%";this.overlay.style.left="0px";this.overlay.style.backgroundColor="transparent";this.overlay.style.zIndex="99999999";this.AR_overlay.id="AR_overlay";this.AR_overlay.className="cameraPreview-canvas";this.AR_overlay.style.position="absolute";this.AR_overlay.style.top="0%";this.AR_overlay.style.left="0px";this.AR_overlay.style.backgroundColor="transparent";this.AR_overlay.style.zIndex="99999999";};static flash_init(handler){this.flash.id="flash-button";if(!this.buttonsProperties.showFlash)this.flash.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.flash_icons[0];this.flash.appendChild(img);this.flash.style.position="absolute";this.flash.style.cssFloat="none";this.flash.style.top="2px";this.flash.style.left="2px";this.flash.style.width="48px";this.flash.style.height="48px";this.flash.style.zIndex="999999999";this.flash.addEventListener('click',handler,false);};static zoom_init(handler){this.zoom.id="zoom-button";if(!this.buttonsProperties.showZoom)this.zoom.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.zoom_icons[0];this.zoom.appendChild(img);this.zoom.style.position="absolute";this.zoom.style.cssFloat="none";this.zoom.style.top="2px";this.zoom.style.right="2px";this.zoom.style.width="48px";this.zoom.style.height="48px";this.zoom.style.zIndex="999999999";this.zoom.addEventListener('click',handler,false);};static close_init(handler){this.close.id="close-button";if(!this.buttonsProperties.showClose)this.close.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.close_icons[0];this.close.appendChild(img);this.close.style.position="absolute";this.close.style.cssFloat="none";this.close.style.right="2px";this.close.style.width="24px";this.close.style.height="24px";this.close.style.zIndex="999999999";this.close.addEventListener('click',handler,false);};static cameraPicker_init(handler){this.cameraPicker.id="cameraPicker-button";if(!this.buttonsProperties.showCameraPicker)this.cameraPicker.style.display="none";var img=document.createElement('img');img.src=this.buttonsProperties.cameraPicker_icons[0];this.cameraPicker.appendChild(img);this.cameraPicker.style.position="absolute";this.cameraPicker.style.cssFloat="none";this.cameraPicker.style.left="2px";this.cameraPicker.style.width="48px";this.cameraPicker.style.height="48px";this.cameraPicker.style.zIndex="999999999";this.cameraPicker.addEventListener('click',handler,false);};static cameraPickerUI_init(handler){this.cameraPickerUI.id="cameraPickerUI";this.cameraPickerUI_style.id="cameraPickerUI_style";this.cameraPickerUI.style.position="absolute";this.cameraPickerUI.style.cssFloat="none";this.cameraPickerUI.style.top="20%";this.cameraPickerUI.style.left="20%";this.cameraPickerUI.style.width="60%";this.cameraPickerUI.style.maxWidth="90%";this.cameraPickerUI.style.background="transparent";this.cameraPickerUI.style.borderRadius="5px";this.cameraPickerUI.style.zIndex="999999999";};static cameraPickerUI_update(cameras,currentCameraID){let camerasCount=cameras.length;let input_elements=[];let label_elements=[];let elements_IDs=[];let desiredCameraLabels=["back","0","triple"];let tripleCameraPicked=false;for(let i=0;i<camerasCount;i++)
|
|
4
4
|
{let id=`c${i}`;elements_IDs.push(id);let input=document.createElement('input');input.id=id;input.name="rd";input.type="radio";input.style.display="none";input.dataset.value=cameras[i].id;input.dataset.label=cameras[i].label;input.onclick=JS_media.changeCamera;if(currentCameraID!=""){if(JS_media.hasTripleCamera){if((Decoder.startCounter==2)&&JS_media.highFocusDistance){let cameraLabel=cameras[i].label;if(cameraLabel.toLowerCase().includes(desiredCameraLabels[2].toLowerCase()))
|
|
5
5
|
{input.checked=true;JS_media.cameraId=cameras[i].id;tripleCameraPicked=true;JS_media.correct_zoom_on_ios=true;}}
|
|
6
6
|
if(!JS_media.highFocusDistance){if(cameras[i].id==currentCameraID){input.checked=true;}}}else{if(cameras[i].id==currentCameraID){input.checked=true;}}}
|
|
@@ -13,11 +13,20 @@ input_elements.push(input);let label=document.createElement('label');label.setAt
|
|
|
13
13
|
this.cameraPickerUI_css(elements_IDs);};static cameraPickerUI_css(elements_IDs){let elementsCount=elements_IDs.length;if(elementsCount==0)return;let checked_labels="";let checked_circles="";for(let i=0;i<elementsCount;i++)
|
|
14
14
|
{let id=elements_IDs[i];checked_labels+=`#cameraPickerUI #${id}:checked ~ label.${id}, `;checked_circles+=`#cameraPickerUI #${id}:checked ~ label.${id} .circle, `;}
|
|
15
15
|
checked_labels=checked_labels.slice(0,-2);checked_circles=checked_circles.slice(0,-2);checked_labels+=(" "+"{ border-color:Red !important; background:#D5D5D5 !important; }");checked_circles+=(" "+"{ border:2px solid !important; border-color:#333 !important; background:Red !important; }");let hovered_labels="#cameraPickerUI label.box:hover { background:#E5E5E5 !important; }";let complete_css=`${checked_labels} ${hovered_labels} ${checked_circles}`;if(this.cameraPickerUI_style.styleSheet){this.cameraPickerUI_style.styleSheet.cssText=complete_css;}else{this.cameraPickerUI_style.textContent=complete_css;}
|
|
16
|
-
document.head.appendChild(this.cameraPickerUI_style);};static hideElements(){this.cameraPreview.style.visibility="hidden";this.AR_overlay.style.display="none";this.overlay.style.display="none";this.flash.style.display="none";this.zoom.style.display="none";this.close.style.display="none";this.cameraPicker.style.display="none";this.cameraPickerUI.style.display="none";};static showElements(){this.cameraPreview.style.visibility="visible";this.AR_overlay.style.display=(Bridge.AR_Mode_ON)?"initial":"none";this.overlay.style.display="initial";this.flash.style.display=(JS_media.flash.supported)?((this.buttonsProperties.showFlash)?"initial":"none"):"none";this.zoom.style.display=(JS_media.zoom.supported)?((this.buttonsProperties.showZoom)?"initial":"none"):"none";this.close.style.display=(this.buttonsProperties.showClose)?"initial":"none";this.cameraPicker.style.display=(this.buttonsProperties.showCameraPicker)?"initial":"none";};static addPreview(){var container_exists=(this.container!=undefined&&this.container!=null&&typeof this.container==='object'&&this.container.tagName==='DIV');if(!container_exists)this.container=document.body;this.container.appendChild(this.cameraPreview);if(this.initialized_dom)return;this.cameraPreview.appendChild(this.preview);this.cameraPreview.appendChild(this.overlay);this.cameraPreview.appendChild(this.AR_overlay);this.cameraPreview.appendChild(this.flash);this.cameraPreview.appendChild(this.zoom);this.cameraPreview.appendChild(this.close);this.cameraPreview.appendChild(this.cameraPicker);this.cameraPreview.appendChild(this.cameraPickerUI);this.initialized_dom=true;};static
|
|
16
|
+
document.head.appendChild(this.cameraPickerUI_style);};static hideElements(){this.cameraPreview.style.visibility="hidden";this.AR_overlay.style.display="none";this.overlay.style.display="none";this.flash.style.display="none";this.zoom.style.display="none";this.close.style.display="none";this.cameraPicker.style.display="none";this.cameraPickerUI.style.display="none";};static showElements(){this.cameraPreview.style.visibility="visible";this.AR_overlay.style.display=(Bridge.AR_Mode_ON)?"initial":"none";this.overlay.style.display="initial";this.flash.style.display=(JS_media.flash.supported)?((this.buttonsProperties.showFlash)?"initial":"none"):"none";this.zoom.style.display=(JS_media.zoom.supported)?((this.buttonsProperties.showZoom)?"initial":"none"):"none";this.close.style.display=(this.buttonsProperties.showClose)?"initial":"none";this.cameraPicker.style.display=(this.buttonsProperties.showCameraPicker)?"initial":"none";};static addPreview(){var container_exists=(this.container!=undefined&&this.container!=null&&typeof this.container==='object'&&this.container.tagName==='DIV');if(!container_exists)this.container=document.body;this.container.appendChild(this.cameraPreview);if(this.initialized_dom)return;this.cameraPreview.appendChild(this.preview);this.cameraPreview.appendChild(this.previewCanvas);this.cameraPreview.appendChild(this.overlay);this.cameraPreview.appendChild(this.AR_overlay);this.cameraPreview.appendChild(this.flash);this.cameraPreview.appendChild(this.zoom);this.cameraPreview.appendChild(this.close);this.cameraPreview.appendChild(this.cameraPicker);this.cameraPreview.appendChild(this.cameraPickerUI);this.initialized_dom=true;};static useCanvasPreview(){if(typeof CanvasPreviewGlobal.value=="boolean")return CanvasPreviewGlobal.value;return Common.isIOS();};static previewVideoExtraCss(){return this.previewCanvas.style.display=="block"?" opacity: 0;":"";};static startPreviewCanvas(){this.stopPreviewCanvas();if(!this.useCanvasPreview()){this.previewCanvas.style.display="none";return;}
|
|
17
|
+
const video=this.preview;const canvas=this.previewCanvas;const ctx=canvas.getContext("2d");video.style.opacity="0";canvas.style.display="block";const usesVideoFrameCallback=typeof video.requestVideoFrameCallback=="function";let framesDrawn=0;const scheduleDraw=()=>{const handle=usesVideoFrameCallback?video.requestVideoFrameCallback(draw):requestAnimationFrame(draw);this.previewCanvasFrame={video,handle,usesVideoFrameCallback};};const draw=()=>{this.previewCanvasFrame=null;if(!Decoder.cameraScanner.runningState.active||video!==this.preview)return;const videoWidth=video.videoWidth;const videoHeight=video.videoHeight;const frameWidth=this.cameraPreview.clientWidth;const frameHeight=this.cameraPreview.clientHeight;if(videoWidth>0&&videoHeight>0&&frameWidth>0&&frameHeight>0){const coverScale=Math.max(frameWidth/videoWidth,frameHeight/videoHeight);const pixelsPerCssPixel=Math.min(window.devicePixelRatio||1,1/coverScale);const width=Math.round(frameWidth*pixelsPerCssPixel);const height=Math.round(frameHeight*pixelsPerCssPixel);if(canvas.width!=width||canvas.height!=height){canvas.width=width;canvas.height=height;}
|
|
18
|
+
const scale=Math.max(width/videoWidth,height/videoHeight);const drawWidth=videoWidth*scale;const drawHeight=videoHeight*scale;ctx.drawImage(video,(width-drawWidth)/2,(height-drawHeight)/2,drawWidth,drawHeight);if(++framesDrawn==3)canvas.style.visibility="visible";}
|
|
19
|
+
scheduleDraw();};scheduleDraw();};static stopPreviewCanvas(){const pending=this.previewCanvasFrame;if(pending!=null){if(pending.usesVideoFrameCallback)pending.video.cancelVideoFrameCallback(pending.handle);else cancelAnimationFrame(pending.handle);this.previewCanvasFrame=null;}
|
|
20
|
+
this.previewCanvas.style.visibility="hidden";this.previewCanvas.width=0;this.previewCanvas.height=0;};static stopPreview(){let initial_s=JS_media.initial;let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;if(!active)return 1;Decoder.cameraScanner.runningState.active=false;Decoder.cancelFrameRequest();let scanner_timeout=JS_media.scanner_timeout;if(scanner_timeout!=null){clearTimeout(scanner_timeout);scanner_timeout=null;}
|
|
17
21
|
if(Bridge.blinkInterval!=null){clearInterval(Bridge.blinkInterval);Bridge.blinkInterval=null;Bridge.blinkVisible=false;}
|
|
18
|
-
|
|
22
|
+
Bridge.AR_stopDrawing();if(Bridge.cameraScanner.emitResultsAtSessionEndOnly)
|
|
23
|
+
{let use_all_results=((Bridge.cameraScanner.AR_Mode==4)&&(!Bridge.cameraScanner.returnOnlyMatchedResultsAR))?true:false;if(!use_all_results)
|
|
24
|
+
{let barcodesInPreview_selected=([...Bridge.textsMap.values()].filter(obj=>obj.selected)).length;if(barcodesInPreview_selected>0)Bridge.resultCallback_ofSelectedArResults(true);}
|
|
25
|
+
else
|
|
26
|
+
{let barcodesInPreview_all=Bridge.textsMap.size+Bridge.textsMap_notDisplayed.size;if(barcodesInPreview_all>0)Bridge.resultCallback_ofArResults(true);}}
|
|
27
|
+
Bridge.lastOutsideClickTimestamp=0;Bridge.runningState_paused=false;Bridge.textsMap.clear();Bridge.textsMap_notDisplayed.clear();this.hideElements();DOM_elements.AR_overlay.width-=1;DOM_elements.AR_overlay.height-=1;document.head.removeChild(this.cameraPickerUI_style);this.cameraPickerUI.replaceChildren();if(Common.flashProxy.state)JS_media.applyFlash(true);if(Common.zoomProxy.level==1){JS_media.zoom.level=2;Common.zoomProxy.level=JS_media.zoom.level;JS_media.applyZoom();}
|
|
19
28
|
if(Common.zoomProxy.level==2){JS_media.applyZoom();}
|
|
20
|
-
if(this.preview.srcObject!=null)this.preview.play();if(JS_media.videoTrack!=null)JS_media.videoTrack.stop();let canvasOverlay=DOM_elements.AR_overlay;canvasOverlay.removeEventListener('click',Bridge.overlayClickHandler);canvasOverlay.removeEventListener('touchstart',Bridge.overlayTouchHandler);DOM_elements.readyToUse_RO=false;DOM_elements.resizeObserver.disconnect();window.removeEventListener('visibilitychange',Bridge.visibilityChangeHandler,false);window.removeEventListener('resize',Bridge.resizeHandler,false);if(Bridge.screenOrientation=='undefined')window.removeEventListener('resize',Bridge.orientationChangeHandler,false);else screen.orientation.removeEventListener('change',Bridge.orientationChangeHandler);this.preview.removeEventListener('loadeddata',JS_media.videoStreamData_handler_wrapper);JS_media.videoTrack.removeEventListener('ended',JS_media.videoTrackEnded_handler_wrapper);JS_media.videoTrack=null;JS_media.mediaStream=null;if(!UseMainThreadOnlyGlobal.value)
|
|
29
|
+
if(this.preview.srcObject!=null)this.preview.play();if(JS_media.videoTrack!=null)JS_media.videoTrack.stop();this.stopPreviewCanvas();let canvasOverlay=DOM_elements.AR_overlay;canvasOverlay.removeEventListener('click',Bridge.overlayClickHandler);canvasOverlay.removeEventListener('touchstart',Bridge.overlayTouchHandler);DOM_elements.readyToUse_RO=false;DOM_elements.resizeObserver.disconnect();window.removeEventListener('visibilitychange',Bridge.visibilityChangeHandler,false);window.removeEventListener('resize',Bridge.resizeHandler,false);if(Bridge.screenOrientation=='undefined')window.removeEventListener('resize',Bridge.orientationChangeHandler,false);else screen.orientation.removeEventListener('change',Bridge.orientationChangeHandler);this.preview.removeEventListener('loadeddata',JS_media.videoStreamData_handler_wrapper);JS_media.videoTrack.removeEventListener('ended',JS_media.videoTrackEnded_handler_wrapper);JS_media.videoTrack=null;JS_media.mediaStream=null;this.preview.srcObject=null;this.preview.removeAttribute('style');this.preview.load();if(!UseMainThreadOnlyGlobal.value)
|
|
21
30
|
{let sc_key=Connector.getCachedProp(3);let sc_value=localStorage[sc_key];let sc_new_value_int=(typeof sc_value=='string'&&sc_value.length>0)?(Number(sc_value)+Decoder.decodeCount):Decoder.decodeCount;localStorage[sc_key]=sc_new_value_int;}
|
|
22
31
|
Decoder.decodeCount=0;this.container.removeChild(this.cameraPreview);let startingROI=Connector.cache.ROI;let x=startingROI.x;let y=startingROI.y;let width=startingROI.width;let height=startingROI.height;Connector.setRegionOfInterest(x,y,width,height);if(!initial_s||Decoder.startCounter>1){JS_media.zoom.useTarget=false;Barkoder.events.dispatchStopEvent();}
|
|
23
32
|
else if(Decoder.startCounter==1&&(JS_media.has_userSetCameraId||JS_media.using_cachedCameraId)){JS_media.zoom.useTarget=false;Barkoder.events.dispatchStopEvent();}};static createPreview(){if(!this.initialized){this.cameraPreview_init();this.flash_init(JS_media.applyFlash);this.zoom_init(JS_media.applyZoom);this.close_init(JS_media.closeHandler);this.cameraPicker_init(JS_media.cameraPickerHandler);this.cameraPickerUI_init();this.initialized=true;Common.debugMessage("DOM","in createPreview in initialized after everything",true);}
|
|
@@ -50,8 +59,12 @@ else{if(internalUsage)JS_media.handleError({name:e.name,message:e.name});else re
|
|
|
50
59
|
{const devices=await navigator.mediaDevices.enumerateDevices();const videoDevices=devices.filter(device=>device.kind=='videoinput');JS_media.cameras=videoDevices.map(videoDevice=>{return{id:videoDevice.deviceId,label:videoDevice.label};});resolve(JS_media.cameras);};return new Promise(async function(resolve,reject){if(!JS_media.supported)
|
|
51
60
|
{if(location.protocol!="https:"){if(internalUsage)JS_media.handleError({name:"SecurityError",message:"Not using HTTPS."});else return reject("CameraAccessNotSupportedOverHttp");}}
|
|
52
61
|
try{const{state}=await navigator.permissions.query({name:"camera"});if(state=="denied"){if(internalUsage)JS_media.handleError({name:"NotAllowedError",message:"Camera permission denied."});else return reject("CameraAccessNotAllowed");}
|
|
53
|
-
if(state=="prompt"){await requestPermission();}
|
|
54
|
-
|
|
62
|
+
if(state=="prompt"){await requestPermission();}
|
|
63
|
+
if(state=="granted"){let devices=await navigator.mediaDevices.enumerateDevices();let labelsAreMasked=devices.some(device=>(device.kind==='videoinput'||device.kind==='audioinput')&&!device.label);if(labelsAreMasked)await requestPermission();}}
|
|
64
|
+
catch(error){if(error instanceof TypeError)
|
|
65
|
+
{try{await requestPermission();}catch(err){return reject(err);}}
|
|
66
|
+
else
|
|
67
|
+
{return reject(error);}}
|
|
55
68
|
getCameraSelection(resolve);});};static async populateCameraPicker(currentCameraID)
|
|
56
69
|
{let cameraCount=JS_media.cameras?.length??0;if(cameraCount==0){try{await Barkoder.getCameras();}catch(e){if(e=="CameraAccessNotAllowed"){JS_media.handleError({name:"NotAllowedError",message:"Camera permission denied."});}
|
|
57
70
|
else if(e=="CameraAccessNotSupportedOverHttp"){JS_media.handleError({name:"SecurityError",message:"Not using HTTPS."});}
|
|
@@ -79,9 +92,9 @@ class Bridge{static initialized=false;static initialized_ctx=false;static hideDu
|
|
|
79
92
|
{let roi;for(let i=0;i<this.numberOfSupportedDecoders;i++){roi=this.rotate(this.untouchedROIArray[i],this.viewfinder.orientation);roi=this.scale(roi,viewfinderAreaScale,heightIndex);Connector.setRegionOfInterest(roi.x,roi.y,roi.width,roi.height);}}
|
|
80
93
|
else
|
|
81
94
|
{let roi;for(let i=0;i<this.numberOfSupportedDecoders;i++){roi=this.rotate(this.untouchedROIArray[i],this.viewfinder.orientation);roi=this.scale(roi,viewfinderAreaScale,widthIndex);Connector.setRegionOfInterest(roi.x,roi.y,roi.width,roi.height);}}};static calculatePreview(hardwareCameraResolution){let previewFrame=DOM_elements.cameraPreview;let preview=DOM_elements.preview;let windowWidth=window.innerWidth;let windowHeight=window.innerHeight;let window_AR=windowWidth/windowHeight;let cameraPreviewWidth=previewFrame.offsetWidth;let cameraPreviewHeigth=previewFrame.offsetHeight;let cameraPreview_AR=cameraPreviewWidth/cameraPreviewHeigth;let cameraWidth=preview.videoWidth;;let cameraHeight=preview.videoHeight;let camera_AR=cameraWidth/cameraHeight;if(cameraPreview_AR==camera_AR)return;else if(cameraPreview_AR>camera_AR)
|
|
82
|
-
{let scalingFactor=cameraPreviewWidth/cameraWidth;let new_cameraHeight=cameraHeight*scalingFactor;let croppedCameraArea=new_cameraHeight-cameraPreviewHeigth;let croppedCameraAreaScale=croppedCameraArea/new_cameraHeight;let translatedCameraTopPercent=-(croppedCameraAreaScale/2)*100;preview.style.cssText="position: absolute; margin: auto; top: 0; bottom: 0; width: 100%; height: auto;";this.calculateROI(true,croppedCameraAreaScale);}
|
|
95
|
+
{let scalingFactor=cameraPreviewWidth/cameraWidth;let new_cameraHeight=cameraHeight*scalingFactor;let croppedCameraArea=new_cameraHeight-cameraPreviewHeigth;let croppedCameraAreaScale=croppedCameraArea/new_cameraHeight;let translatedCameraTopPercent=-(croppedCameraAreaScale/2)*100;preview.style.cssText="position: absolute; margin: auto; top: 0; bottom: 0; width: 100%; height: auto;"+DOM_elements.previewVideoExtraCss();this.calculateROI(true,croppedCameraAreaScale);}
|
|
83
96
|
else if(cameraPreview_AR<camera_AR)
|
|
84
|
-
{let scalingFactor=cameraPreviewHeigth/cameraHeight;let new_cameraWidth=cameraWidth*scalingFactor;let croppedCameraArea=new_cameraWidth-cameraPreviewWidth;let croppedCameraAreaScale=croppedCameraArea/new_cameraWidth;let translateCameraLeftPercent=-(croppedCameraAreaScale/2)*100;let croppedinDivAreaScale=croppedCameraArea/cameraPreviewWidth;translateCameraLeftPercent=-(croppedinDivAreaScale/2)*100;preview.style.cssText="position: absolute; margin-left: "+translateCameraLeftPercent+"%; width: auto; height: 100%;";this.calculateROI(false,croppedCameraAreaScale);}};static ctx=null;static AR_ctx=null;static blinkInterval=null;static blinkVisible=false;static handleOverlay(){let canvasOverlay=DOM_elements.overlay;let viewfinder=this.viewfinder;let mode=1;if(!Bridge.initialized_ctx){Bridge.ctx=canvasOverlay.getContext("2d"
|
|
97
|
+
{let scalingFactor=cameraPreviewHeigth/cameraHeight;let new_cameraWidth=cameraWidth*scalingFactor;let croppedCameraArea=new_cameraWidth-cameraPreviewWidth;let croppedCameraAreaScale=croppedCameraArea/new_cameraWidth;let translateCameraLeftPercent=-(croppedCameraAreaScale/2)*100;let croppedinDivAreaScale=croppedCameraArea/cameraPreviewWidth;translateCameraLeftPercent=-(croppedinDivAreaScale/2)*100;preview.style.cssText="position: absolute; margin-left: "+translateCameraLeftPercent+"%; width: auto; height: 100%;"+DOM_elements.previewVideoExtraCss();this.calculateROI(false,croppedCameraAreaScale);}};static ctx=null;static AR_ctx=null;static blinkInterval=null;static blinkVisible=false;static handleOverlay(){let canvasOverlay=DOM_elements.overlay;let viewfinder=this.viewfinder;let mode=1;if(!Bridge.initialized_ctx){Bridge.ctx=canvasOverlay.getContext("2d");Bridge.initialized_ctx=true;Bridge.AR_ctx=DOM_elements.AR_overlay.getContext("2d");}
|
|
85
98
|
var ctx=Bridge.ctx;if(mode==0){ctx.clearRect(0,0,canvasOverlay.width,canvasOverlay.height);}
|
|
86
99
|
else if(mode==1)
|
|
87
100
|
{if(!this.viewfinderAppearance.overlay.roiVisible){ctx.clearRect(0,0,canvasOverlay.width,canvasOverlay.height);return;}
|
|
@@ -110,7 +123,7 @@ else if(Bridge.viewfinderAppearance.overlay.centerMarkType==1)
|
|
|
110
123
|
{let centerX=viewfinder.x+viewfinder.width/2;let centerY=viewfinder.y+viewfinder.height/2
|
|
111
124
|
let size=4;ctx.strokeStyle=this.viewfinderAppearance.overlay.lineColor;ctx.lineWidth=this.viewfinderAppearance.overlay.lineWidth;ctx.beginPath();ctx.moveTo(centerX,centerY-size);ctx.lineTo(centerX,centerY+size);ctx.stroke();ctx.beginPath();ctx.moveTo(centerX-size,centerY);ctx.lineTo(centerX+size,centerY);ctx.stroke();}
|
|
112
125
|
if(Bridge.enabledDecoders==0)
|
|
113
|
-
{let middleWidth=canvasOverlay.width/2;let middleHeight=canvasOverlay.height/2;let fontSize=20;ctx.font=`${fontSize}px Arial`;ctx.fillStyle="red";ctx.textAlign="center";ctx.fillText("There are no enabled symbologies.",middleWidth,middleHeight-fontSize);ctx.fillText("The scanner is not scanning for any barcodes.",middleWidth,middleHeight+fontSize);}};static resizeOverlay(){let viewfinderUnionROI=this.untouchedROIUnion;let cameraPreview=DOM_elements.cameraPreview;let canvasOverlay=DOM_elements.overlay;let AR_canvasOverlay=DOM_elements.AR_overlay;let cameraPickerUI=DOM_elements.cameraPickerUI;let flash=DOM_elements.flash;let zoom=DOM_elements.zoom;let close=DOM_elements.close;let cameraPicker=DOM_elements.cameraPicker;let viewfinder=this.viewfinder;canvasOverlay.style.top=cameraPreview.style.top;canvasOverlay.style.left=cameraPreview.style.left;canvasOverlay.width=cameraPreview.offsetWidth;canvasOverlay.height=cameraPreview.offsetHeight;AR_canvasOverlay.style.top=cameraPreview.style.top;AR_canvasOverlay.style.left=cameraPreview.style.left;if(AR_canvasOverlay.width!=
|
|
126
|
+
{let middleWidth=canvasOverlay.width/2;let middleHeight=canvasOverlay.height/2;let fontSize=20;ctx.font=`${fontSize}px Arial`;ctx.fillStyle="red";ctx.textAlign="center";ctx.fillText("There are no enabled symbologies.",middleWidth,middleHeight-fontSize);ctx.fillText("The scanner is not scanning for any barcodes.",middleWidth,middleHeight+fontSize);}};static resizeOverlay(){let viewfinderUnionROI=this.untouchedROIUnion;let cameraPreview=DOM_elements.cameraPreview;let canvasOverlay=DOM_elements.overlay;let AR_canvasOverlay=DOM_elements.AR_overlay;let cameraPickerUI=DOM_elements.cameraPickerUI;let flash=DOM_elements.flash;let zoom=DOM_elements.zoom;let close=DOM_elements.close;let cameraPicker=DOM_elements.cameraPicker;let viewfinder=this.viewfinder;canvasOverlay.style.top=cameraPreview.style.top;canvasOverlay.style.left=cameraPreview.style.left;canvasOverlay.width=cameraPreview.offsetWidth;canvasOverlay.height=cameraPreview.offsetHeight;AR_canvasOverlay.style.top=cameraPreview.style.top;AR_canvasOverlay.style.left=cameraPreview.style.left;const AR_pixelRatio=Math.min(window.devicePixelRatio||1,2);const AR_width=Math.round(cameraPreview.offsetWidth*AR_pixelRatio);const AR_height=Math.round(cameraPreview.offsetHeight*AR_pixelRatio);if(AR_canvasOverlay.width!=AR_width)AR_canvasOverlay.width=AR_width;if(AR_canvasOverlay.height!=AR_height)AR_canvasOverlay.height=AR_height;AR_canvasOverlay.style.width=cameraPreview.offsetWidth+"px";AR_canvasOverlay.style.height=cameraPreview.offsetHeight+"px";Bridge.AR_pixelRatio=AR_pixelRatio;Common.debugMessage("Bridge","in resizeOverlay after overlay TLWH is set",true);flash.style.top=(canvasOverlay.offsetTop+2)+"px";flash.style.left=canvasOverlay.offsetLeft+"px";zoom.style.top=(canvasOverlay.offsetTop+2)+"px";zoom.style.left=((canvasOverlay.offsetWidth+canvasOverlay.offsetLeft)-zoom.offsetWidth)+"px";close.style.top=((canvasOverlay.offsetTop+canvasOverlay.height)-((close.offsetHeight*1.5)+2))+"px";close.style.left=((canvasOverlay.offsetWidth+canvasOverlay.offsetLeft)-(close.offsetWidth*1.5))+"px";cameraPicker.style.top=((canvasOverlay.offsetTop+canvasOverlay.height)-((cameraPicker.offsetHeight*1)+2))+"px";cameraPicker.style.left=canvasOverlay.offsetLeft+"px";let cameraPickerUI_height_percent=cameraPickerUI.offsetHeight/cameraPreview.offsetHeight;let cameraPickerUI_top_percent=Number(((1.0-cameraPickerUI_height_percent)/2.0).toFixed(2));let cameraPickerUI_height_half=Number((cameraPickerUI_height_percent/2.0).toFixed(2));Common.debugMessage("resizeOverlay in handler",`${cameraPickerUI_height_percent} ${cameraPickerUI_top_percent} ${cameraPickerUI_height_half}`,false);cameraPickerUI.style.top=(cameraPickerUI_top_percent*100)+"%";viewfinder.x=canvasOverlay.width*(viewfinderUnionROI.x/100);viewfinder.y=canvasOverlay.height*(viewfinderUnionROI.y/100);viewfinder.width=canvasOverlay.width*(viewfinderUnionROI.width/100);viewfinder.height=canvasOverlay.height*(viewfinderUnionROI.height/100);this.handleOverlay();};static resizePreview(){let hideDuringResize=this.hideDuringResize;let cameraPreview=DOM_elements.cameraPreview;let hardwareCameraResolution=JS_media.hardwareCameraResolution;if(hideDuringResize){cameraPreview.style.visibility="hidden";}
|
|
114
127
|
Common.debugMessage("Bridge","in resizePreview, before calling calculatePreview()",true);Common.debugMessage("",this,false);this.calculatePreview(hardwareCameraResolution);this.resizeOverlay();if(hideDuringResize){setTimeout(function(){cameraPreview.style.visibility="visible";},1500);}};static init_ROIs(){let numberOfSupportedDecoders=this.numberOfSupportedDecoders;let untouchedROIArray=this.untouchedROIArray;let untouchedROIUnion=this.untouchedROIUnion;if(!this.initialized)
|
|
115
128
|
{for(let i=0;i<numberOfSupportedDecoders;i++)
|
|
116
129
|
{let rect=Connector.getRegionOfInterest();untouchedROIArray.push(rect);}
|
|
@@ -123,63 +136,59 @@ let ROIUnion=Connector.getRegionOfInterest();untouchedROIUnion.x=ROIUnion.x;unto
|
|
|
123
136
|
{larger=videoHeight;smaller=videoWidth;}
|
|
124
137
|
JS_media.hardwareCameraResolution.width=larger;JS_media.hardwareCameraResolution.height=smaller;};static visibilityChangeHandler(){if(document.hidden){Barkoder.stopScanner();}};static AR_Mode_ON=false;static getCanvasCoordinates(event){const rect=DOM_elements.AR_overlay.getBoundingClientRect();let x,y;if(event.touches){x=event.touches[0].clientX-rect.left;y=event.touches[0].clientY-rect.top;}else{x=event.clientX-rect.left;y=event.clientY-rect.top;}
|
|
125
138
|
return{x,y};};static isPointInLocationPoints(point,locationPoints){const[x,y]=point;let inside=false;for(let i=0,j=locationPoints.length-1;i<locationPoints.length;j=i++){const xi=locationPoints[i][0],yi=locationPoints[i][1];const xj=locationPoints[j][0],yj=locationPoints[j][1];const intersect=((yi>y)!==(yj>y))&&(x<(xj-xi)*(y-yi)/(yj-yi+0.00000001)+xi);if(intersect)inside=!inside;}
|
|
126
|
-
return inside;};static lastOutsideClickTimestamp=0;static doubleClick_timeSpan=350;static runningState_paused=false;static
|
|
127
|
-
|
|
128
|
-
{if(Bridge.cameraScanner.
|
|
129
|
-
{Bridge.
|
|
130
|
-
Bridge.lastOutsideClickTimestamp
|
|
131
|
-
else
|
|
132
|
-
{let
|
|
133
|
-
{const
|
|
134
|
-
if(
|
|
135
|
-
{let timestamp=Date.now();
|
|
136
|
-
{
|
|
137
|
-
|
|
138
|
-
Bridge.
|
|
139
|
+
return inside;};static lastOutsideClickTimestamp=0;static doubleClick_timeSpan=350;static runningState_paused=false;static frozenFrameResultsHandler(){for(const item of Bridge.textsMap.values())
|
|
140
|
+
if(item.visibility)Bridge.textsMap_addText(item.original,item.selected,item.locationPointsOnOverlay,item.result);}
|
|
141
|
+
static overlayClickHandler(event){Bridge.overlayTapHandler(event);};static overlayTouchHandler(event){event.preventDefault();Bridge.overlayTapHandler(event);};static overlayTapHandler(event){if(Bridge.cameraScanner.AR_Mode==3)return;if(Bridge.cameraScanner.AR_Mode==4)return;const{x,y}=Bridge.getCanvasCoordinates(event);const point=[x,y];for(const item of Bridge.textsMap.values())
|
|
142
|
+
{if(item.visibility&&Bridge.isPointInLocationPoints(point,item.locationPointsOnOverlay)){item.selected=!item.selected;if(item.selected)AudioHandler.playBeep();Bridge.perform_resultCallback_ofSelectedArResults_with_config_logic(false);Bridge.AR_startDrawing();return;}}
|
|
143
|
+
let timestamp=Date.now();let time_diff=timestamp-Bridge.lastOutsideClickTimestamp;if(time_diff<Bridge.doubleClick_timeSpan&&Bridge.cameraScanner.doubleTapToFreezeEnabled)
|
|
144
|
+
{Bridge.runningState_paused=!Bridge.runningState_paused;if(Bridge.runningState_paused)DOM_elements.preview.pause();else DOM_elements.preview.play();}
|
|
145
|
+
Bridge.lastOutsideClickTimestamp=timestamp;};static fnv1aHash(str){let hash=0x811c9dc5;for(let i=0;i<str.length;i++){hash^=str.charCodeAt(i);hash+=(hash<<1)+(hash<<4)+(hash<<7)+(hash<<8)+(hash<<24);}
|
|
146
|
+
return(hash>>>0).toString(16).padStart(8,'0');};static makeHashKey(text){if(text.length<=8){return text;}else{const prefix=text.slice(0,8);const remainder=text.slice(8);const suffixHash=Bridge.fnv1aHash(remainder);return`${prefix}_${suffixHash}`;}};static barcodeTypeMap=Object.freeze({"Aztec":0,"Aztec Compact":1,"QR":2,"QR Micro":3,"Code 128":4,"Code 93":5,"Code 39":6,"Codabar":7,"Code 11":8,"MSI":9,"Upc-A":10,"Upc-E":11,"Upc-E1":12,"Ean-13":13,"Ean-8":14,"PDF 417":15,"PDF 417 Micro":16,"Data Matrix":17,"Code 25":18,"Interleaved 2 of 5":19,"ITF 14":20,"IATA 25":21,"Matrix 25":22,"Datalogic 25":23,"COOP 25":24,"Code 32":25,"Telepen":26,"Dotcode":27,"ID Document":28,"Databar 14":29,"Databar Limited":30,"Databar Expanded":31,"Intelligent Mail":32,"Postnet":33,"Planet":34,"Australian Post":35,"Royal Mail":36,"KIX":37,"Japanese Post":38,"MaxiCode":39});static textsMap=new Map();static textsMap_notDisplayed=new Map();static AR_frameRequest=null;static AR_pixelRatio=1;static lerp(a,b,t){return a+(b-a)*t;};static AR_startDrawing(){if(Bridge.AR_frameRequest==null)Bridge.AR_frameRequest=requestAnimationFrame(Bridge.AR_drawFrame);};static AR_stopDrawing(){if(Bridge.AR_frameRequest!=null)cancelAnimationFrame(Bridge.AR_frameRequest);Bridge.AR_frameRequest=null;};static AR_resetSession(){Bridge.AR_stopDrawing();Bridge.textsMap.clear();Bridge.textsMap_notDisplayed.clear();if(Bridge.AR_ctx!=null)Bridge.AR_locationOverlay_new([]);};static AR_itemPoints(item,now){const transition=item.transition;const points=item.locationPointsOnOverlay;if(transition==null)return points;const t=(now-transition.startTime)/transition.duration;if(t>=1){item.transition=null;return points;}
|
|
147
|
+
return transition.from.map((from,i)=>[Bridge.lerp(from[0],points[i][0],t),Bridge.lerp(from[1],points[i][1],t)]);};static textsMap_addText(text,selected,locationPointsOnOverlay,result,stale=false){let timestamp=Date.now();const hashKey=Bridge.makeHashKey(text);const barcodeType=Bridge.barcodeTypeMap[result.barcodeTypeName];const key=`${hashKey}${barcodeType}`;const item=Bridge.textsMap.get(key);if(item==null){Bridge.textsMap.set(key,{original:text,selected:selected,locationPointsOnOverlay:locationPointsOnOverlay,result:result,lastTimestamp:timestamp,visibility:true,transition:null});}else if(!stale){let overlayProperties=Bridge.cameraScanner.overlay;let time_diff=timestamp-item.lastTimestamp;const duration=Math.min(overlayProperties.locationTransitionSpeed,time_diff);item.transition=(time_diff<overlayProperties.resultDisappearanceDelayMs&&duration>0)?{from:Bridge.AR_itemPoints(item,timestamp),startTime:timestamp,duration:duration}:null;item.locationPointsOnOverlay=locationPointsOnOverlay;item.lastTimestamp=timestamp;item.visibility=true;}
|
|
148
|
+
Bridge.AR_startDrawing();};static AR_drawFrame(){Bridge.AR_frameRequest=null;if(!Decoder.cameraScanner.runningState.active)return;if(Bridge.runningState_paused)Bridge.frozenFrameResultsHandler();let overlayProperties=Bridge.cameraScanner.overlay;let timestamp=Date.now();const disappearanceDelay=overlayProperties.resultDisappearanceDelayMs;const locationPointsToDraw=[];if(overlayProperties.locationType!=Constants.BarkoderARLocationType.NONE)
|
|
149
|
+
{for(const item of Bridge.textsMap.values()){if(!item.visibility)continue;const age=timestamp-item.lastTimestamp;if(age>=disappearanceDelay*2){item.visibility=false;continue;}
|
|
150
|
+
locationPointsToDraw.push({item:item,locationPoints:Bridge.AR_itemPoints(item,timestamp),alpha:(age<disappearanceDelay)?1:2-age/disappearanceDelay});}}
|
|
151
|
+
Bridge.AR_locationOverlay_new(locationPointsToDraw);if(locationPointsToDraw.length>0)Bridge.AR_startDrawing();};static textsMap_addText_notDisplayed(text,selected,result){let timestamp=Date.now();const hashKey=Bridge.makeHashKey(text);const barcodeType=Bridge.barcodeTypeMap[result.barcodeTypeName];const key=`${hashKey}${barcodeType}`;if(!Bridge.textsMap_notDisplayed.has(key)){Bridge.textsMap_notDisplayed.set(key,{original:text,selected:selected,result:result,lastTimestamp:timestamp});}}
|
|
152
|
+
static perform_resultCallback_ofSelectedArResults_with_config_logic(shouldBeep)
|
|
153
|
+
{let use_all_results=((Bridge.cameraScanner.AR_Mode==4)&&(!Bridge.cameraScanner.returnOnlyMatchedResultsAR))?true:false;if(!use_all_results)
|
|
154
|
+
{if(!Bridge.cameraScanner.emitResultsAtSessionEndOnly)
|
|
155
|
+
{Bridge.resultCallback_ofSelectedArResults(shouldBeep);}
|
|
156
|
+
else
|
|
157
|
+
{let barcodesInPreview_new=([...Bridge.textsMap.values()].filter(obj=>obj.selected)).length;if((Bridge.cameraScanner.resultLimit>0)&&(Bridge.cameraScanner.resultLimit<=barcodesInPreview_new))
|
|
158
|
+
{if(Bridge.cameraScanner.continueScanningOnLimit)
|
|
159
|
+
{Bridge.resultCallback_ofSelectedArResults(shouldBeep);Bridge.textsMap.clear();}
|
|
160
|
+
else
|
|
161
|
+
{DOM_elements.stopPreview();}}}}
|
|
162
|
+
else
|
|
163
|
+
{if(!Bridge.cameraScanner.emitResultsAtSessionEndOnly)
|
|
164
|
+
{Bridge.resultCallback_ofArResults(shouldBeep);}
|
|
139
165
|
else
|
|
140
|
-
{let
|
|
141
|
-
{if(Bridge.cameraScanner.
|
|
142
|
-
{Bridge.
|
|
143
|
-
Bridge.lastOutsideClickTimestamp=timestamp;}};static overlayTouchHandler(event){event.preventDefault();if(Bridge.cameraScanner.AR_Mode==3)return;const{x,y}=Bridge.getCanvasCoordinates(event);var ctx=Bridge.ctx;const point=[x,y];let barcodesOnPreview=Bridge.textsMap.size;const textsMap_entriesArray=Array.from(Bridge.textsMap.entries());if(barcodesOnPreview==1)
|
|
144
|
-
{const[key,value]=textsMap_entriesArray[0];let isPointInside=Bridge.isPointInLocationPoints(point,value.locationPointsOnOverlay);if(isPointInside&&value.visibility){const item=Bridge.textsMap.get(key);item.selected=!item.selected;if(item.selected)AudioHandler.playBeep();const results_selected=[...Bridge.textsMap.values()].filter(obj=>obj.selected).map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});const resultsCount_selected=results_selected.length;Decoder.cameraScanner.config.result_callback({resultsCount:resultsCount_selected,results:results_selected});}else{let timestamp=Date.now();let time_diff=timestamp-Bridge.lastOutsideClickTimestamp;if(time_diff<Bridge.doubleClick_timeSpan)
|
|
145
|
-
{if(Bridge.cameraScanner.doubleTapToFreezeEnabled)
|
|
146
|
-
{Bridge.runningState_paused=!Bridge.runningState_paused;if(Bridge.runningState_paused)DOM_elements.preview.pause();else DOM_elements.preview.play();}}
|
|
147
|
-
Bridge.lastOutsideClickTimestamp=timestamp;}}
|
|
148
|
-
else if(barcodesOnPreview>1)
|
|
149
|
-
{let isOutsidePoint=true;for(let i=0;i<barcodesOnPreview;i++)
|
|
150
|
-
{const[key,value]=textsMap_entriesArray[i];let isPointInside=Bridge.isPointInLocationPoints(point,value.locationPointsOnOverlay);if(isPointInside&&value.visibility){const item=Bridge.textsMap.get(key);item.selected=!item.selected;if(item.selected)AudioHandler.playBeep();const results_selected=[...Bridge.textsMap.values()].filter(obj=>obj.selected).map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});const resultsCount_selected=results_selected.length;Decoder.cameraScanner.config.result_callback({resultsCount:resultsCount_selected,results:results_selected});isOutsidePoint=false;break;}else{}}
|
|
151
|
-
if(isOutsidePoint)
|
|
152
|
-
{let timestamp=Date.now();let time_diff=timestamp-Bridge.lastOutsideClickTimestamp;if(time_diff<Bridge.doubleClick_timeSpan)
|
|
153
|
-
{if(Bridge.cameraScanner.doubleTapToFreezeEnabled)
|
|
154
|
-
{Bridge.runningState_paused=!Bridge.runningState_paused;if(Bridge.runningState_paused)DOM_elements.preview.pause();else DOM_elements.preview.play();}}
|
|
155
|
-
Bridge.lastOutsideClickTimestamp=timestamp;}}
|
|
166
|
+
{let barcodesInPreview_new=Bridge.textsMap.size+Bridge.textsMap_notDisplayed.size;if((Bridge.cameraScanner.resultLimit>0)&&(Bridge.cameraScanner.resultLimit<=barcodesInPreview_new))
|
|
167
|
+
{if(Bridge.cameraScanner.continueScanningOnLimit)
|
|
168
|
+
{Bridge.resultCallback_ofArResults(shouldBeep);Bridge.textsMap.clear();Bridge.textsMap_notDisplayed.clear();}
|
|
156
169
|
else
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
{Bridge.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if(
|
|
165
|
-
if(
|
|
166
|
-
{Bridge.
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
if(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Bridge.drawHeader_new(ctx,locations,ctx.strokeStyle,headerTextColor,headerHeight,textualData);}}};static calculateLocationPointsToPreview(frameWidth,frameHeight)
|
|
180
|
-
{let preview=DOM_elements.preview;let canvasOverlay=DOM_elements.overlay;let window_actualWidth=preview.offsetWidth;let window_actualHeight=preview.offsetHeight;let translate_x=(preview.offsetWidth-canvasOverlay.width)/2;let translate_y=(preview.offsetHeight-canvasOverlay.height)/2;let scale_x=window_actualWidth/frameWidth;let scale_y=window_actualHeight/frameHeight;return{scale_x:scale_x,scale_y:scale_y,translate_x:translate_x,translate_y:translate_y};};static transformLocationPoints(locations,conversionValues)
|
|
181
|
-
{let scale_x=conversionValues.scale_x;let scale_y=conversionValues.scale_y;let translate_x=conversionValues.translate_x;let translate_y=conversionValues.translate_y;let multidraw=false;if(typeof locations[0]=='object')multidraw=true;if(!multidraw){let x_points=[locations.p1.x,locations.p2.x,locations.p3.x,locations.p4.x].map(x=>(x*scale_x)-translate_x);let y_points=[locations.p1.y,locations.p2.y,locations.p3.y,locations.p4.y].map(y=>(y*scale_y)-translate_y);let x1=x_points[0];let y1=y_points[0];let x2=x_points[1];let y2=y_points[1];let x3=x_points[2];let y3=y_points[2];let x4=x_points[3];let y4=y_points[3];return[[x1,y1],[x2,y2],[x3,y3],[x4,y4]];}else{let drawCount=locations.length;let returnArray=[];for(let i=0;i<drawCount;i++)
|
|
182
|
-
{let location_i=locations[i];let x_points=[location_i.p1.x,location_i.p2.x,location_i.p3.x,location_i.p4.x].map(x=>(x*scale_x)-translate_x);let y_points=[location_i.p1.y,location_i.p2.y,location_i.p3.y,location_i.p4.y].map(y=>(y*scale_y)-translate_y);let x1=x_points[0];let y1=y_points[0];let x2=x_points[1];let y2=y_points[1];let x3=x_points[2];let y3=y_points[2];let x4=x_points[3];let y4=y_points[3];returnArray.push([[x1,y1],[x2,y2],[x3,y3],[x4,y4]]);}}};static reorderLocationPoints(points)
|
|
170
|
+
{DOM_elements.stopPreview();}}}}}
|
|
171
|
+
static resultCallback_ofSelectedArResults(shouldBeep)
|
|
172
|
+
{const results_selected=[...Bridge.textsMap.values()].filter(obj=>obj.selected).map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});const resultsCount_selected=results_selected.length;let resultLimit=(Bridge.cameraScanner.emitResultsAtSessionEndOnly)?Bridge.cameraScanner.resultLimit:0;let results_selected_and_limited=(resultLimit>0)?results_selected.slice(0,resultLimit):results_selected;let resultsCount_selected_and_limited=(resultLimit>0)?resultLimit:resultsCount_selected;if(Decoder.cameraScanner.config.result_beep&&shouldBeep)AudioHandler.playBeep();Decoder.cameraScanner.config.result_callback({resultsCount:resultsCount_selected_and_limited,results:results_selected_and_limited});}
|
|
173
|
+
static resultCallback_ofArResults(shouldBeep)
|
|
174
|
+
{let resultLimit=(Bridge.cameraScanner.emitResultsAtSessionEndOnly)?Bridge.cameraScanner.resultLimit:0;if(resultLimit==0)
|
|
175
|
+
{let results_all=[...Bridge.textsMap.values()].map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});if(Bridge.textsMap_notDisplayed.size>0)
|
|
176
|
+
{let results_all_notDisplayed=[...Bridge.textsMap_notDisplayed.values()].map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});results_all=[...results_all,...results_all_notDisplayed];}
|
|
177
|
+
let resultsCount_all=results_all.length;if(Decoder.cameraScanner.config.result_beep&&shouldBeep)AudioHandler.playBeep();Decoder.cameraScanner.config.result_callback({resultsCount:resultsCount_all,results:results_all});}
|
|
178
|
+
else if(resultLimit>0)
|
|
179
|
+
{const results_selected=[...Bridge.textsMap.values()].filter(obj=>obj.selected).map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});const resultsCount_selected=results_selected.length;const results_deselected=[...Bridge.textsMap.values()].filter(obj=>!obj.selected).map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});const resultsCount_deselected=results_deselected.length;const results_notDisplayed=[...Bridge.textsMap_notDisplayed.values()].map(obj=>{const{resultsCount,...restResult}=obj.result;return restResult;});const resultsCount_notDisplayed=results_notDisplayed.length;let results_selected_and_limited=results_selected.slice(0,resultLimit);let resultsCount_selected_and_limited=results_selected_and_limited.length;let remainingCount=resultLimit-resultsCount_selected_and_limited;if(remainingCount>0)
|
|
180
|
+
{results_selected_and_limited=[...results_selected_and_limited,...results_deselected.slice(0,remainingCount)];resultsCount_selected_and_limited=results_selected_and_limited.length;remainingCount=resultLimit-resultsCount_selected_and_limited;if(remainingCount>0)
|
|
181
|
+
{results_selected_and_limited=[...results_selected_and_limited,...results_notDisplayed.slice(0,remainingCount)];resultsCount_selected_and_limited=results_selected_and_limited.length;}}
|
|
182
|
+
if(Decoder.cameraScanner.config.result_beep&&shouldBeep)AudioHandler.playBeep();Decoder.cameraScanner.config.result_callback({resultsCount:resultsCount_selected_and_limited,results:results_selected_and_limited});}}
|
|
183
|
+
static cameraScanner={AR_Mode:0,doubleTapToFreezeEnabled:true,overlay:{locationShow:true,locationContinuousPauseTime:5,nonSelectedLocationLineWidth:2,nonSelectedLocationLineColor:"#ff3347",selectedLocationLineWidth:2,selectedLocationColor:"#50c878",locationTransitionSpeed:300,resultDisappearanceDelayMs:800,headerShowMode:1,headerHeight:20,headerTextColorSelected:"white",headerTextColorNonSelected:"white",locationType:1,displayOnlyMatchedResults:false},returnOnlyMatchedResultsAR:true,cache:{returnOnlyMatchedResults:{value:true,set:false}},resultLimit:0,continueScanningOnLimit:false,emitResultsAtSessionEndOnly:false};static drawHeader_new(ctx,item,locations,color,textColor,headerHeight){const[x1,y1]=locations[0];const[x2,y2]=locations[1];const dx=x2-x1,dy=y2-y1;const length=Math.hypot(dx,dy);const nx=dy/length;const ny=-dx/length;const offset=0.5,margin=(ctx.lineWidth/2);const hx1=(x1-margin)+nx*offset,hy1=y1+ny*offset;const hx2=(x2+margin)+nx*offset,hy2=y2+ny*offset;const hx3=(x2+margin)+nx*(offset+headerHeight),hy3=y2+ny*(offset+headerHeight);const hx4=(x1-margin)+nx*(offset+headerHeight),hy4=y1+ny*(offset+headerHeight);ctx.save();ctx.fillStyle=color;ctx.beginPath();ctx.moveTo(hx1,hy1);ctx.lineTo(hx2,hy2);ctx.lineTo(hx3,hy3);ctx.lineTo(hx4,hy4);ctx.closePath();ctx.fill();const midX=(hx1+hx2)/2;const midY=(hy1+hy2)/2;const angle=Math.atan2(dy,dx);ctx.translate(midX,midY);ctx.rotate(angle);ctx.font="12px Arial";ctx.fillStyle=textColor;ctx.textAlign="center";ctx.textBaseline="middle";if(length<=20){ctx.restore();return;}
|
|
184
|
+
const available=length-10;if(item.headerLabel==null||Math.abs(available-item.headerAvailable)>=4){item.headerLabel=Bridge.fitHeaderText(ctx,item.original,available);item.headerAvailable=available;}
|
|
185
|
+
if(item.headerLabel.length>0)ctx.fillText(item.headerLabel,0,-headerHeight/2);ctx.restore();};static fitHeaderText(ctx,text,available){const textWidth=ctx.measureText(text).width;if(textWidth<available)return text;let initialCharsToCut=Math.max(1,Math.ceil(text.length*(1.0-(available/textWidth))));let newText=text.slice(0,-initialCharsToCut);let loopCount=0;const MAX_LOOPS=100;while(newText.length>0&&ctx.measureText(newText+"...").width>=available&&loopCount<MAX_LOOPS)
|
|
186
|
+
{loopCount++;newText=newText.slice(0,-1);}
|
|
187
|
+
return(newText.length>0)?newText+"...":"";};static AR_locationOverlay_new(locationsArray){let overlayProperties=Bridge.cameraScanner.overlay;let ctx=Bridge.AR_ctx;ctx.setTransform(1,0,0,1,0,0);ctx.clearRect(0,0,DOM_elements.AR_overlay.width,DOM_elements.AR_overlay.height);if(!overlayProperties.locationShow)return;const pixelRatio=Bridge.AR_pixelRatio;ctx.setTransform(pixelRatio,0,0,pixelRatio,0,0);for(const{item,locationPoints,alpha}of locationsArray){const selected=item.selected;ctx.globalAlpha=alpha;ctx.lineWidth=selected?overlayProperties.selectedLocationLineWidth:overlayProperties.nonSelectedLocationLineWidth;ctx.strokeStyle=selected?overlayProperties.selectedLocationColor:overlayProperties.nonSelectedLocationLineColor;ctx.beginPath();ctx.moveTo(locationPoints[0][0],locationPoints[0][1]);ctx.lineTo(locationPoints[1][0],locationPoints[1][1]);ctx.lineTo(locationPoints[2][0],locationPoints[2][1]);ctx.lineTo(locationPoints[3][0],locationPoints[3][1]);ctx.closePath();ctx.stroke();if((overlayProperties.headerShowMode==1)||((overlayProperties.headerShowMode==2)&&selected))
|
|
188
|
+
Bridge.drawHeader_new(ctx,item,locationPoints,ctx.strokeStyle,selected?overlayProperties.headerTextColorSelected:overlayProperties.headerTextColorNonSelected,overlayProperties.headerHeight);}
|
|
189
|
+
ctx.globalAlpha=1;};static calculateLocationPointsToPreview(frameWidth,frameHeight)
|
|
190
|
+
{let preview=DOM_elements.preview;let canvasOverlay=DOM_elements.overlay;let window_actualWidth=preview.offsetWidth;let window_actualHeight=preview.offsetHeight;let translate_x=(preview.offsetWidth-canvasOverlay.width)/2;let translate_y=(preview.offsetHeight-canvasOverlay.height)/2;let scale_x=window_actualWidth/frameWidth;let scale_y=window_actualHeight/frameHeight;return{scale_x:scale_x,scale_y:scale_y,translate_x:translate_x,translate_y:translate_y};};static transformLocationPoints(location,conversionValues)
|
|
191
|
+
{const{scale_x,scale_y,translate_x,translate_y}=conversionValues;return[location.p1,location.p2,location.p3,location.p4].map(p=>[(p.x*scale_x)-translate_x,(p.y*scale_y)-translate_y]);};static reorderLocationPoints(points)
|
|
183
192
|
{let topLeftIndex=0;let minSum=points[0][0]+points[0][1];for(let i=1;i<points.length;i++){const sum=points[i][0]+points[i][1];if(sum<minSum){minSum=sum;topLeftIndex=i;}}
|
|
184
193
|
return points.slice(topLeftIndex).concat(points.slice(0,topLeftIndex));};static distance([x1,y1],[x2,y2]){return Math.hypot(x2-x1,y2-y1);};static getSideLengths(points){return points.map((point,i)=>Bridge.distance(point,points[(i+1)%points.length]));};static classifyQuadrilateral(points,threshold=0.5){if(points.length!==4){throw new Error("Expected 4 points");}
|
|
185
194
|
const sides=Bridge.getSideLengths(points);const pairA=(sides[0]+sides[2])/2;const pairB=(sides[1]+sides[3])/2;const longer=Math.max(pairA,pairB);const shorter=Math.min(pairA,pairB);const ratio=longer/shorter;return{type:ratio>1+threshold?"rectangle":"square-like",ratio,sides};};static createBoundingBox(points){const xValues=points.map(p=>p[0]);const yValues=points.map(p=>p[1]);const minX=Math.min(...xValues);const maxX=Math.max(...xValues);const minY=Math.min(...yValues);const maxY=Math.max(...yValues);const boundingBox=[[minX,minY],[maxX,minY],[maxX,maxY],[minX,maxY]];return boundingBox;};static base64ToUint8ClampedArray(base64){const binaryString=atob(base64);const len=binaryString.length;const array=new Uint8ClampedArray(len);for(let i=0;i<len;i++){array[i]=binaryString.charCodeAt(i);}
|
|
@@ -193,25 +202,29 @@ var current_valuesForResize=RefreshPreview.getValuesForResize();if(RefreshPrevie
|
|
|
193
202
|
class AudioHandler{static webAudio_supported=('AudioContext'in window||'webkitAudioContext'in window);static webAudio_initialized=false;static AudioContext=null;static context=null;static gainNode=null;static beepBuffer=undefined;static async webAudio_audio_init(){window.fetch(AudioHandler.Beep.dataURI).then(response=>response.arrayBuffer()).then(arrayBuffer=>AudioHandler.context.decodeAudioData(arrayBuffer,audioBuffer=>{AudioHandler.beepBuffer=audioBuffer;},error=>console.error(error)));};static webAudio_audio_play(audioBuffer){var source=AudioHandler.context.createBufferSource();source.buffer=audioBuffer;source.connect(AudioHandler.context.destination);source.start();};static webAudio_unlock(){Common.debugMessage("AudioHandler","Try to unlock the audio context.",true);var buffer=AudioHandler.context.createBuffer(1,1,22050);var source=AudioHandler.context.createBufferSource();source.buffer=buffer;source.connect(AudioHandler.context.destination);source.start?source.start(0):source.noteOn(0);};static async webAudio_init(){if(AudioHandler.webAudio_supported&&!AudioHandler.webAudio_initialized){AudioHandler.AudioContext=window.AudioContext||window.webkitAudioContext;AudioHandler.context=new AudioHandler.AudioContext();AudioHandler.gainNode=AudioHandler.context.createGain();AudioHandler.gainNode.gain.value=1;await AudioHandler.webAudio_audio_init();AudioHandler.webAudio_unlock();AudioHandler.webAudio_initialized=true;}};static Beep={dataURI:"data:audio/mpeg;base64,SUQzBAAAAAACelRYWFgAAAAYAAADY29tbWVudABTeW5jIFRvbmUgMWtIegBURFJDAAAADAAAAzIwMjEtMDMtMDgAVElUMgAAABAAAANTeW5jIHRvbmUgMWtIegBUWFhYAAAAGgAAA3RpbWVfcmVmZXJlbmNlADE3MjcwNzg0MABUWFhYAAAASQAAA3VtaWQAMHg2RTk1MDRENDQxQkU0NTI3QTU1RTBBMEY5NTVEMTBCNzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAFRQRTEAAAALAAADSGVhZHBoYXplAFRDT1AAAAALAAADSGVhZHBoYXplAFRYWFgAAAAQAAADSUVORwBIZWFkcGhhemUAVENPTgAAAAkAAAN1dGlsaXR5AFRYWFgAAAAuAAADSUtFWQBzeW5jLCB0b25lLCAxaw0KSHosIGJlZXAsIGJsaXAsIGxlYWQgaW4AVFNTRQAAAA4AAANMYXZmNjEuNy4xMDAAAAAAAAAAAAAAAP/7VMAAAAAAAAAAAAAAAAAAAAAAAFhpbmcAAAAPAAAAAwAABaAAmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////////////////////////////////////////AAAAAExhdmM2MS4xOQAAAAAAAAAAAAAAACQDxgAAAAAAAAWgRR0hsgAAAAAAAAAAAAAAAAAAAP/7xMQAAAvQMUR08YAp8xkoPz0wgAq0k71er0PQ9Rq+PAiMZfxJwc4KsJGQs62cQiAAAgA7MPH/8AR+Hz/Z//+Dv/Qf/+kM//P/MPDAAz5A//zDAAAEaD///8AAAAPDw8PSAAAZ78w8PDAAAABAeHh4ekABTQAAAFcCgBgFgwKBgMAAC8xgAgDLRBgF/CwB6YCYDAqGKNBLDrr75lgNMwQQHDARACJjU5grAb8DFsDtEBcAgHhaCLOFBA3hDkRgcXMTJFRCws4e+MqTRFiLGJMmJ4vJfIqRUyJ4mjH/8ipFTIixeMS7//l0yLxsJQl/h1WXAAAACJ/AAAAcBBMxJkzIUVTBUAXME4GUDA+mAcD2YjAwZimQdmUeNgYjYNBAAGYAACIcBCqYDoFjZW8V4nmdq9oZabrhwAAAARt9ogAAgAhBks2YCYGr3EoDJhJAJmB8EIYOgHBgxhqmLqLmYWm3ZhrFYGOQD4RAVAwBMHAfoBDjCPnmtj4AdAVAQQwwAIAGATh4J9zYHo9YAoCMJQ/xviHlzZ47yJrUNPmmhbYaaF2eRIafVakFvOtzgPHlMQH7+9HjBEpl5T33ilMvIgDPkBIGFh/lw+Iz4YWOB/8QODGGBIcTgh+Xg/y59STQDQDEfCijgJg6FAEAQABoEslDHeEwAgL6V2jB1AGMuppMwFAKQsAy2FlJlnClGHYB0YGwGoKAYlk2BoM6gpAwbNAGAUmTQJBEBgcgYABgFgKKGBuJ8MdAwGDROgWjBkELDeBhkDgPAgDQVDVwAQODIpDhCwgsMb8L4hjgm4LIw+ANsFyitSHDnDLGP4ywfQPxE/CkxPoegXS6k6qX8pkHKpEyaJ0vECSRRMVJJI/5RJhIg5cIgUiWJUrIoqdL//k2Tv/7hMTXgAioPx/95gAimRcivrzwBJFC+VzxXLxMl4pIkU9aKNSX//uT6BIFIqlkvE2iXC+bFo2KxZMigiRRMrsWjI1KJwzM2J/2qt+wqkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7ZMT/AB91vTf56qIAAAA0g4AABKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg==",audio:null,audio_initialized:false,audio_init:()=>{AudioHandler.Beep.audio=new Audio(AudioHandler.Beep.dataURI);AudioHandler.Beep.audio.volume=0;AudioHandler.Beep.audio.muted=true;AudioHandler.Beep.audio.play();AudioHandler.Beep.audio_initialized=true;}};static mainInit(){if(AudioHandler.webAudio_supported){Common.debugMessage("AudioHandler","AudioContext is supported.",true);AudioHandler.webAudio_init();}
|
|
194
203
|
else{Common.debugMessage("AudioHandler","AudioContext is not supported, using Audio as fallback.",true);AudioHandler.Beep.audio_init();}};static playBeep(){if(AudioHandler.webAudio_supported&&AudioHandler.webAudio_initialized){AudioHandler.webAudio_audio_play(AudioHandler.beepBuffer);}
|
|
195
204
|
else{AudioHandler.Beep.audio.volume=1;AudioHandler.Beep.audio.muted=false;AudioHandler.Beep.audio.pause();AudioHandler.Beep.audio.currentTime=0;AudioHandler.Beep.audio.play();}};}
|
|
196
|
-
class Decoder{static cameraScanner={config:{timeout:60,dps_limit:28,stop_after_initial_camera_start:false,container_width:0,container_height:0,override_container_size:false,container_use_fallback_size:true,continuous:false,result_beep:true,result_image:true,result_image_with_location:false,result_image_barcode:true,result_callback:(r)=>console.log(r)},overlay:{locationShow:true,locationShowTime:400,locationContinuousPauseTime:5,locationLineWidth:1.5,locationLineColor:"#ff3347"},runningState:{active:false,paused:false}};static locationClear=null;static frameInterval=0;static frameCounter=0;static decodeCount=0;static frame_canvasFrame=document.createElement('canvas');static initialized_ctx=false;static ctx=null;static async decoder(video,locationHandler){const dps_limit=this.cameraScanner.config.dps_limit;Decoder.frameInterval=1000/dps_limit;Decoder.decodeCount=0;let lastProcessedTime=0;const JITTER_MARGIN=10;Decoder.initialized_ctx=false;const
|
|
205
|
+
class Decoder{static cameraScanner={config:{timeout:60,dps_limit:28,stop_after_initial_camera_start:false,container_width:0,container_height:0,override_container_size:false,container_use_fallback_size:true,continuous:false,result_beep:true,result_image:true,result_image_with_location:false,result_image_barcode:true,result_callback:(r)=>console.log(r)},overlay:{locationShow:true,locationShowTime:400,locationContinuousPauseTime:5,locationLineWidth:1.5,locationLineColor:"#ff3347"},runningState:{active:false,paused:false}};static locationClear=null;static frameInterval=0;static frameCounter=0;static decodeCount=0;static frame_canvasFrame=document.createElement('canvas');static initialized_ctx=false;static ctx=null;static frameRequest=null;static decoderSession=0;static cancelFrameRequest(){const pending=Decoder.frameRequest;if(pending==null)return;if(pending.usesVideoFrameCallback)pending.video.cancelVideoFrameCallback(pending.handle);else clearTimeout(pending.handle);Decoder.frameRequest=null;};static async decoder(video,locationHandler){const dps_limit=this.cameraScanner.config.dps_limit;Decoder.frameInterval=1000/dps_limit;Decoder.decodeCount=0;let lastProcessedTime=0;const decoderStartTime=performance.now();const JITTER_MARGIN=10;Decoder.initialized_ctx=false;Decoder.cancelFrameRequest();const session=++Decoder.decoderSession;const usesVideoFrameCallback=typeof video.requestVideoFrameCallback=='function';const scheduleNext=()=>{const handle=usesVideoFrameCallback?video.requestVideoFrameCallback(onFrame):setTimeout(()=>onFrame(performance.now()),Decoder.frameInterval);Decoder.frameRequest={video,handle,usesVideoFrameCallback};};const onFrame=async()=>{if(session!=Decoder.decoderSession)return;Decoder.frameRequest=null;let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;const paused=cameraScannerProperties.runningState.paused;if(!active)return;if(paused){scheduleNext();return;}
|
|
197
206
|
const now=performance.now();if(now-lastProcessedTime<(Decoder.frameInterval-JITTER_MARGIN)){scheduleNext();return;}
|
|
198
207
|
lastProcessedTime=Math.max(lastProcessedTime+Decoder.frameInterval,now-Decoder.frameInterval);const videoWidth=video.videoWidth;const videoHeight=video.videoHeight;if(videoWidth==0||videoHeight==0){scheduleNext();return;}
|
|
199
208
|
let canvasFrame=Decoder.frame_canvasFrame;canvasFrame.width=videoWidth;canvasFrame.height=videoHeight;if(!Decoder.initialized_ctx){Decoder.ctx=canvasFrame.getContext("2d",{willReadFrequently:true});Decoder.initialized_ctx=true;}
|
|
200
209
|
let ctx=Decoder.ctx;ctx.drawImage(video,0,0,videoWidth,videoHeight);let imgData=ctx.getImageData(0,0,canvasFrame.width,canvasFrame.height);if(false)
|
|
201
210
|
{Common.debugMessage("Decoder","Debug frame",true);let url=canvasFrame.toDataURL();let windowTitle="Debug frame";Common.debugMessage("",url,true);}
|
|
202
211
|
Decoder.frameCounter++;if(UseMainThreadOnlyGlobal.value)
|
|
203
|
-
{const startTime_sync=performance.now();let BKResult=Connector.scanFrame_native(imgData,null,
|
|
212
|
+
{const startTime_sync=performance.now();const frameId=Decoder.frameCounter;let BKResult=Connector.scanFrame_native(imgData,null,frameId);const totalTime_sync=performance.now()-startTime_sync;if(typeof window._tmp_BK_test_data=='object'&&typeof window._tmp_BK_test_data.use=='boolean'&&window._tmp_BK_test_data.use)
|
|
204
213
|
{let has_result=(BKResult.resultsCount>0);if(typeof window._tmp_BK_test_data.dps_array=='undefined')window._tmp_BK_test_data.dps_array=[];window._tmp_BK_test_data.dps_array.push({exec_t:totalTime_sync,has_res:has_result,time:performance.now()});}
|
|
205
|
-
Decoder.handlePostScanTasks(BKResult);}
|
|
214
|
+
Decoder.handlePostScanTasks(BKResult,imgData,frameId);}
|
|
206
215
|
else
|
|
207
|
-
{scanFrame_native_async(imgData,
|
|
208
|
-
scheduleNext();};scheduleNext();};static
|
|
216
|
+
{const frameId=Decoder.frameCounter;scanFrame_native_async(imgData,frameId,true).then(scanResult=>Decoder.handlePostScanTasks(scanResult,imgData,frameId));}
|
|
217
|
+
scheduleNext();};scheduleNext();};static barcodeTypeNames_2D=Object.freeze(["Aztec","Aztec Compact","MaxiCode","QR","QR Micro","Dotcode","Data Matrix"]);static lastArFrameId=-1;static handleArResults(result,frameWidth,frameHeight,frameId){const stale=frameId<Decoder.lastArFrameId;if(!stale)Decoder.lastArFrameId=frameId;const AR_Mode=Bridge.cameraScanner.AR_Mode;const locationType=Bridge.cameraScanner.overlay.locationType;const matchFiltering_ON=(AR_Mode==4);const use_all_results=matchFiltering_ON&&!Bridge.cameraScanner.returnOnlyMatchedResultsAR;const barcodesInPreview=()=>use_all_results?(Bridge.textsMap.size+Bridge.textsMap_notDisplayed.size):([...Bridge.textsMap.values()].filter(obj=>obj.selected)).length;const barcodesInPreview_old=barcodesInPreview();const conversionValues=Bridge.calculateLocationPointsToPreview(frameWidth,frameHeight);const results=(result.resultsCount==1&&result.location!=null)?[result]:(result.results||[]);for(const result_i of results){if(result_i.location==null)continue;let points=Bridge.transformLocationPoints(result_i.location,conversionValues);if(locationType==Constants.BarkoderARLocationType.TIGHT&&Decoder.barcodeTypeNames_2D.includes(result_i.barcodeTypeName)){const rectangular=(result_i.barcodeTypeName=="Data Matrix"||result_i.barcodeTypeName=="Dotcode")&&Bridge.classifyQuadrilateral(points,0.5).type!="square-like";if(!rectangular)points=Bridge.reorderLocationPoints(points);}
|
|
218
|
+
if(locationType==Constants.BarkoderARLocationType.BOUNDINGBOX)points=Bridge.createBoundingBox(points);const selectedState=matchFiltering_ON?result_i.isMatched:(AR_Mode==2||AR_Mode==3);if(!matchFiltering_ON||!Bridge.cameraScanner.overlay.displayOnlyMatchedResults||result_i.isMatched)
|
|
219
|
+
Bridge.textsMap_addText(result_i.textualData,selectedState,points,result_i,stale);else
|
|
220
|
+
Bridge.textsMap_addText_notDisplayed(result_i.textualData,selectedState,result_i);}
|
|
221
|
+
if(barcodesInPreview()>barcodesInPreview_old)Bridge.perform_resultCallback_ofSelectedArResults_with_config_logic(true);};static async handlePostScanTasks(BKResult,imgData,frameId)
|
|
209
222
|
{let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;const paused=cameraScannerProperties.runningState.paused;if((!active)||paused)return;const continuous=cameraScannerProperties.config.continuous;const result_callback=cameraScannerProperties.config.result_callback;let video=DOM_elements.preview;let canvasFrame=Decoder.frame_canvasFrame;let ctx=Decoder.ctx;if(BKResult.resultsCount==-1)
|
|
210
223
|
{return;}
|
|
211
224
|
if(BKResult.resultsCount==0)
|
|
212
225
|
{}
|
|
213
226
|
else
|
|
214
|
-
{window.BarkoderSDK_frameDecoding=false;cameraScannerProperties.runningState.paused=true;if(typeof Constants.Decoders.IDDocument=='number')
|
|
227
|
+
{window.BarkoderSDK_frameDecoding=false;if(!Bridge.AR_Mode_ON)cameraScannerProperties.runningState.paused=true;if(typeof Constants.Decoders.IDDocument=='number')
|
|
215
228
|
{if(Barkoder.isBarcodeTypeEnabled(Constants.Decoders.IDDocument))
|
|
216
229
|
{if(BKResult.barcodeTypeName=="ID Document"&&BKResult.textualData=="ID Document decoder type is not licensed!")
|
|
217
230
|
{BKResult["error"]={name:"NoMRZLicense",message:BKResult.textualData};BKResult.location=null;}}}
|
|
@@ -236,28 +249,7 @@ if(result!=null&&result.location!=null)
|
|
|
236
249
|
result.capturedFrame=imgData_with_loc;}}
|
|
237
250
|
if(result!=null&&result.resultsCount>=1&&cameraScannerProperties.config.result_beep&&(!Bridge.AR_Mode_ON))
|
|
238
251
|
AudioHandler.playBeep();if(Bridge.AR_Mode_ON)
|
|
239
|
-
{
|
|
240
|
-
{let selectedState=false;if((Bridge.cameraScanner.AR_Mode==2)||(Bridge.cameraScanner.AR_Mode==3))selectedState=true;const barcodeTypeNames_2D=Object.freeze(["Aztec","Aztec Compact","MaxiCode","QR","QR Micro","Dotcode","Data Matrix"]);let conversionValues=Bridge.calculateLocationPointsToPreview(canvasFrame.width,canvasFrame.height);if(result.resultsCount==1&&result.location!=null){let transformedLocationPoints=Bridge.transformLocationPoints(result.location,conversionValues);let corrected_p1_is_TL_points=transformedLocationPoints;if(Bridge.cameraScanner.overlay.locationType==Constants.BarkoderARLocationType.TIGHT)
|
|
241
|
-
if(barcodeTypeNames_2D.includes(result.barcodeTypeName)){if((result.barcodeTypeName=="Data Matrix")||(result.barcodeTypeName=="Dotcode"))
|
|
242
|
-
{const shape=Bridge.classifyQuadrilateral(transformedLocationPoints,0.5);if(shape.type=="square-like")
|
|
243
|
-
{corrected_p1_is_TL_points=Bridge.reorderLocationPoints(transformedLocationPoints);}}
|
|
244
|
-
else
|
|
245
|
-
{corrected_p1_is_TL_points=Bridge.reorderLocationPoints(transformedLocationPoints);}}
|
|
246
|
-
if(Bridge.cameraScanner.overlay.locationType==Constants.BarkoderARLocationType.BOUNDINGBOX)
|
|
247
|
-
{corrected_p1_is_TL_points=Bridge.createBoundingBox(transformedLocationPoints);}
|
|
248
|
-
Bridge.textsMap_addText(result.textualData,selectedState,corrected_p1_is_TL_points,result);}
|
|
249
|
-
else
|
|
250
|
-
{let resultsCount=result.resultsCount;for(let i=0;i<resultsCount;i++)
|
|
251
|
-
{let location=result.results[i].location;if(location!=null){let transformedLocationPoints=Bridge.transformLocationPoints(location,conversionValues);let corrected_p1_is_TL_points=transformedLocationPoints;if(Bridge.cameraScanner.overlay.locationType==Constants.BarkoderARLocationType.TIGHT)
|
|
252
|
-
if(barcodeTypeNames_2D.includes(result.barcodeTypeName)){if((result.barcodeTypeName=="Data Matrix")||(result.barcodeTypeName=="Dotcode"))
|
|
253
|
-
{const shape=Bridge.classifyQuadrilateral(transformedLocationPoints,0.5);if(shape.type=="square-like")
|
|
254
|
-
{corrected_p1_is_TL_points=Bridge.reorderLocationPoints(transformedLocationPoints);}}
|
|
255
|
-
else
|
|
256
|
-
{corrected_p1_is_TL_points=Bridge.reorderLocationPoints(transformedLocationPoints);}}
|
|
257
|
-
if(Bridge.cameraScanner.overlay.locationType==Constants.BarkoderARLocationType.BOUNDINGBOX)
|
|
258
|
-
{corrected_p1_is_TL_points=Bridge.createBoundingBox(transformedLocationPoints);}
|
|
259
|
-
Bridge.textsMap_addText(result.results[i].textualData,selectedState,corrected_p1_is_TL_points,result.results[i]);}}}}
|
|
260
|
-
await Common.wait(overlayProperties.locationContinuousPauseTime);cameraScannerProperties.runningState.paused=false;}
|
|
252
|
+
{if(result!=null&&result.resultsCount>0)Decoder.handleArResults(result,canvasFrame.width,canvasFrame.height,frameId);}
|
|
261
253
|
else
|
|
262
254
|
{if(continuous)
|
|
263
255
|
{cameraScannerProperties.runningState.paused=true;let overlayProperties=Decoder.cameraScanner.overlay;if(overlayProperties.locationShow&&(!Bridge.AR_Mode_ON))
|
|
@@ -268,7 +260,9 @@ else
|
|
|
268
260
|
{await Common.wait(overlayProperties.locationShowTime+100);}
|
|
269
261
|
DOM_elements.stopPreview();cameraScannerProperties.runningState.paused=false;if(typeof result_callback=='function')result_callback(BKResult);else Common.debugMessage("Decoder","result: "+BKResult.textualData,true);}}}};static async locationOverlay(locations,frameWidth,frameHeight,frameInterval){let preview=DOM_elements.preview;let canvasOverlay=DOM_elements.overlay;let viewfinder=Bridge.viewfinder;Common.debugMessage("context","locationOverlay",false);Common.debugMessage("",this,false);let multidraw=false;if(typeof locations[0]=='object')multidraw=true;let overlayProperties=this.cameraScanner.overlay;if((!overlayProperties.locationShow)||Bridge.AR_Mode_ON)return;let ctx=Bridge.ctx;if(this.locationClear!=null)clearTimeout(this.locationClear);Bridge.resizeOverlay();await Common.wait(10);Common.debugMessage("Decoder->Location","result.locationPoints:",true);Common.debugMessage("",locations,true);ctx.lineWidth=overlayProperties.locationLineWidth;ctx.strokeStyle=overlayProperties.locationLineColor;let window_actualWidth=preview.offsetWidth;let window_actualHeight=preview.offsetHeight;let translate_x=(preview.offsetWidth-canvasOverlay.width)/2;let translate_y=(preview.offsetHeight-canvasOverlay.height)/2;let scale_x=window_actualWidth/frameWidth;let scale_y=window_actualHeight/frameHeight;if(!multidraw){let x_points=[locations.p1.x,locations.p2.x,locations.p3.x,locations.p4.x].map(x=>(x*scale_x)-translate_x);let y_points=[locations.p1.y,locations.p2.y,locations.p3.y,locations.p4.y].map(y=>(y*scale_y)-translate_y);let x1=x_points[0];let y1=y_points[0];let x2=x_points[1];let y2=y_points[1];let x3=x_points[2];let y3=y_points[2];let x4=x_points[3];let y4=y_points[3];ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.lineTo(x1,y1);ctx.stroke();}else{let drawCount=locations.length;for(let i=0;i<drawCount;i++)
|
|
270
262
|
{let location_i=locations[i];let x_points=[location_i.p1.x,location_i.p2.x,location_i.p3.x,location_i.p4.x].map(x=>(x*scale_x)-translate_x);let y_points=[location_i.p1.y,location_i.p2.y,location_i.p3.y,location_i.p4.y].map(y=>(y*scale_y)-translate_y);let x1=x_points[0];let y1=y_points[0];let x2=x_points[1];let y2=y_points[1];let x3=x_points[2];let y3=y_points[2];let x4=x_points[3];let y4=y_points[3];ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.lineTo(x1,y1);ctx.stroke();}}
|
|
271
|
-
let continuous=Decoder.cameraScanner.config.continuous;let locationBorderTime=(frameInterval>overlayProperties.locationShowTime)?overlayProperties.locationShowTime:frameInterval;if(!continuous)locationBorderTime=overlayProperties.locationShowTime;this.locationClear=setTimeout(async function(){Bridge.resizeOverlay();await Common.wait(10);},locationBorderTime);};static async videoStreamData_handler(initial_s){if(!initial_s||Decoder.startCounter>1)Barkoder.events.dispatchStartEvent();else if(Decoder.startCounter==1&&(JS_media.has_userSetCameraId||JS_media.using_cachedCameraId))Barkoder.events.dispatchStartEvent();Common.debugMessage("Decoder","start of videoStreamData_handler",true);Bridge.init_ROIs();Common.debugMessage("Decoder","after init_ROIs()",true);await Common.wait(1);DOM_elements.showElements();Bridge.orientationChangeHandler();window.addEventListener('visibilitychange',Bridge.visibilityChangeHandler,false);if(Bridge.screenOrientation=='undefined')window.addEventListener('resize',Bridge.orientationChangeHandler,false);else screen.orientation.addEventListener('change',Bridge.orientationChangeHandler);window.addEventListener('resize',Bridge.resizeHandler,false);if(DOM_elements.container!=null)DOM_elements.resizeObserver.observe(DOM_elements.container);if(RefreshPreview.useRecursiveRefresh)RefreshPreview.clearProperties();if(RefreshPreview.useRecursiveRefresh)var currentValues=RefreshPreview.getValuesForResize();Bridge.resizePreview();if(RefreshPreview.useRecursiveRefresh)RefreshPreview.properties.previousValues=JSON.parse(JSON.stringify(currentValues));DOM_elements.readyToUse_RO=true;let canvasOverlay=DOM_elements.AR_overlay;canvasOverlay.addEventListener('click',Bridge.overlayClickHandler);canvasOverlay.addEventListener('touchstart',Bridge.overlayTouchHandler);canvasOverlay.style.touchAction='none';
|
|
263
|
+
let continuous=Decoder.cameraScanner.config.continuous;let locationBorderTime=(frameInterval>overlayProperties.locationShowTime)?overlayProperties.locationShowTime:frameInterval;if(!continuous)locationBorderTime=overlayProperties.locationShowTime;this.locationClear=setTimeout(async function(){Bridge.resizeOverlay();await Common.wait(10);},locationBorderTime);};static async videoStreamData_handler(initial_s){if(!initial_s||Decoder.startCounter>1)Barkoder.events.dispatchStartEvent();else if(Decoder.startCounter==1&&(JS_media.has_userSetCameraId||JS_media.using_cachedCameraId))Barkoder.events.dispatchStartEvent();Common.debugMessage("Decoder","start of videoStreamData_handler",true);Bridge.init_ROIs();Common.debugMessage("Decoder","after init_ROIs()",true);await Common.wait(1);DOM_elements.startPreviewCanvas();DOM_elements.showElements();Bridge.orientationChangeHandler();window.addEventListener('visibilitychange',Bridge.visibilityChangeHandler,false);if(Bridge.screenOrientation=='undefined')window.addEventListener('resize',Bridge.orientationChangeHandler,false);else screen.orientation.addEventListener('change',Bridge.orientationChangeHandler);window.addEventListener('resize',Bridge.resizeHandler,false);if(DOM_elements.container!=null)DOM_elements.resizeObserver.observe(DOM_elements.container);if(RefreshPreview.useRecursiveRefresh)RefreshPreview.clearProperties();if(RefreshPreview.useRecursiveRefresh)var currentValues=RefreshPreview.getValuesForResize();Bridge.resizePreview();if(RefreshPreview.useRecursiveRefresh)RefreshPreview.properties.previousValues=JSON.parse(JSON.stringify(currentValues));DOM_elements.readyToUse_RO=true;let canvasOverlay=DOM_elements.AR_overlay;canvasOverlay.addEventListener('click',Bridge.overlayClickHandler);canvasOverlay.addEventListener('touchstart',Bridge.overlayTouchHandler);canvasOverlay.style.touchAction='none';DOM_elements.preview.style.objectFit='cover';const retry_in_ms=20;const stop_after_ms=100;for(let i=retry_in_ms;i<=stop_after_ms;i+=retry_in_ms)
|
|
264
|
+
{await Common.wait(retry_in_ms);DOM_elements.preview.style.objectFit='cover';}
|
|
265
|
+
Decoder.decoder(DOM_elements.preview);Common.debugMessage("Decoder->start->startCamera","Scanner start completed.",true);};static startCounter=0;static async start(callback){let cameraScannerProperties=Decoder.cameraScanner;const active=cameraScannerProperties.runningState.active;if(active)return 1;cameraScannerProperties.runningState.active=true;Decoder.startCounter++;cameraScannerProperties.config.result_callback=(typeof callback=='function')?callback:(r)=>console.log(r);Common.debugMessage("start","at start() 1",true);let context=DOM_elements;context.container=document.getElementById('barkoder-container');var container_exists=(context.container!=undefined&&context.container!=null&&typeof context.container==='object'&&context.container.tagName==='DIV');if(!container_exists){Common.debugMessage("start",`Container does not exist, aborting start.`,1);return-1;}
|
|
272
266
|
let container_use_fallback_size=Decoder.cameraScanner.config.container_use_fallback_size;if(container_use_fallback_size&&((context.container.offsetWidth==0)||(context.container.offsetHeight==0)))
|
|
273
267
|
{Common.debugMessage("start",`Container width or height is 0, setting half the window size (${window.innerWidth / 2}x${window.innerHeight / 2}px) as fallback size.`,1);context.container.style.cssText=`width: ${window.innerWidth / 2}px; height: ${window.innerHeight / 2}px;`;}
|
|
274
268
|
let container_width=Decoder.cameraScanner.config.container_width;let container_height=Decoder.cameraScanner.config.container_height;let override_container_size=Decoder.cameraScanner.config.override_container_size;if(override_container_size&&(container_width>0)&&(container_height>0))
|
|
@@ -279,14 +273,14 @@ else localStorage.setItem(JS_media.CACHED_CAMERA_ID_KEY,"");if(typeof JS_media.c
|
|
|
279
273
|
{JS_media.cameraId=JS_media.cachedCameraId;Common.debugMessage("start","Using cachedCameraId",true);}}
|
|
280
274
|
await JS_media.populateCameraPicker("");JS_media.startCamera(DOM_elements.preview,this.videoStreamData_handler,null);Common.debugMessage("start","after startCamera()",true);}catch(error){Common.debugMessage("start","error in start-try",true);Common.debugMessage("",error,true);}
|
|
281
275
|
return 0;};}
|
|
282
|
-
class Common{static wait=ms=>new Promise(resolve=>setTimeout(resolve,ms));static flashProxy=new Proxy(JS_media.flash,{set:function(target,key,value){Common.debugMessage("flashProxy",`flash.${key} set to ${value}`,true);target[key]=value;if(key=='state'&&typeof value=='boolean'){DOM_elements.flash.getElementsByTagName('img')[0].src=DOM_elements.buttonsProperties.flash_icons[Number(value)];}
|
|
276
|
+
class Common{static wait=ms=>new Promise(resolve=>setTimeout(resolve,ms));static isIOS(){const ua=navigator.userAgent||"";return/iPhone|iPad|iPod/.test(ua)||(/Macintosh/.test(ua)&&navigator.maxTouchPoints>1);};static flashProxy=new Proxy(JS_media.flash,{set:function(target,key,value){Common.debugMessage("flashProxy",`flash.${key} set to ${value}`,true);target[key]=value;if(key=='state'&&typeof value=='boolean'){DOM_elements.flash.getElementsByTagName('img')[0].src=DOM_elements.buttonsProperties.flash_icons[Number(value)];}
|
|
283
277
|
else if(key=='supported'&&typeof value=='boolean')DOM_elements.flash.style.display=(value)?"initial":"none";return true;}});static zoomProxy=new Proxy(JS_media.zoom,{set:function(target,key,value){Common.debugMessage("flashProxy",`zoom.${key} set to ${value}`,true);target[key]=value;if(key=='level'&&typeof value=='number'){let icon_i=(value==0||value==1)?0:1;DOM_elements.zoom.getElementsByTagName('img')[0].src=DOM_elements.buttonsProperties.zoom_icons[icon_i];}
|
|
284
278
|
else if(key=='supported'&&typeof value=='boolean')DOM_elements.zoom.style.display=(value)?"initial":"none";return true;}});static enableChecker(value){return((typeof value=='number'&&(value==0||value==1))||(typeof value=='boolean'));};static callHandler(method,args){let Res=method(...args);if(Res==-1)
|
|
285
279
|
{return{returnValue:Res,error:{name:"JSONValueError",message:`Argument for ${method.name}() is not correct.`}}}
|
|
286
280
|
else
|
|
287
281
|
{return{returnValue:Res};}};static debugMessage(tag,message,log){if(typeof log=='boolean'&&log){return;if(tag=='')console.log(message);else console.log('['+tag+'] '+message);}
|
|
288
282
|
else if(typeof log=='number'&&log==1){if(tag=='')console.log(message);else console.log('['+tag+'] '+message);}};}
|
|
289
|
-
const ToggleTemplate=Object.freeze({Disable:0,Enable:1});const copyObject=(object)=>JSON.parse(JSON.stringify(object));class Constants{static DecodingSpeed=Object.freeze({Fast:0,Normal:1,Slow:2,Rigorous:3});static Decoders=Object.freeze({Aztec:0,AztecCompact:1,QR:2,QRMicro:3,Code128:4,Code93:5,Code39:6,Codabar:7,Code11:8,Msi:9,UpcA:10,UpcE:11,UpcE1:12,Ean13:13,Ean8:14,PDF417:15,PDF417Micro:16,Datamatrix:17,Code25:18,Interleaved25:19,ITF14:20,IATA25:21,Matrix25:22,Datalogic25:23,COOP25:24,Code32:25,Telepen:26,Dotcode:27});static Code11ChecksumType=Object.freeze({disabled:0,single:1,double:2});static Code39ChecksumType=Object.freeze({disabled:0,enabled:1});static MsiChecksumType=Object.freeze({disabled:0,mod10:1,mod11:2,mod1010:3,mod1110:4,mod11IBM:5,mod1110IBM:6});static UpcEanDeblur=Object.freeze(copyObject(ToggleTemplate));static MulticodeCachingEnabled=Object.freeze(copyObject(ToggleTemplate));static EnableMisshaped1D=Object.freeze(copyObject(ToggleTemplate));static EnableVINRestrictions=Object.freeze(copyObject(ToggleTemplate));static EnableComposite=Object.freeze(copyObject(ToggleTemplate));static Formatting=Object.freeze({Disabled:0,Automatic:1,GS1:2,AAMVA:3,SADL:4,BCBP:5});static EncodingCharacterSet=Object.freeze({None:0,ISO_8859_2:1,ISO_8859_5:2,Shift_JIS:3,US_ASCII:4,UTF_8:5,UTF_16:6,windows_1251:7,windows_1256:8,BINARY:9});static CameraResolution=Object.freeze({HD:0,FHD:1});static CenterMark=Object.freeze({None:0,Crosshair:1});static LineScanAnimationMode=Object.freeze({None:0,NormalBlinking:1,FastBlinking:2});static BarkoderARMode=Object.freeze({OFF:0,InteractiveDisabled:1,InteractiveEnabled:2,NonInteractive:3});static BarkoderARHeaderShowMode=Object.freeze({NEVER:0,ALWAYS:1,ONSELECTED:2});static BarkoderARLocationType=Object.freeze({NONE:0,TIGHT:1,BOUNDINGBOX:2});}
|
|
283
|
+
const ToggleTemplate=Object.freeze({Disable:0,Enable:1});const copyObject=(object)=>JSON.parse(JSON.stringify(object));class Constants{static DecodingSpeed=Object.freeze({Fast:0,Normal:1,Slow:2,Rigorous:3});static Decoders=Object.freeze({Aztec:0,AztecCompact:1,QR:2,QRMicro:3,Code128:4,Code93:5,Code39:6,Codabar:7,Code11:8,Msi:9,UpcA:10,UpcE:11,UpcE1:12,Ean13:13,Ean8:14,PDF417:15,PDF417Micro:16,Datamatrix:17,Code25:18,Interleaved25:19,ITF14:20,IATA25:21,Matrix25:22,Datalogic25:23,COOP25:24,Code32:25,Telepen:26,Dotcode:27});static Code11ChecksumType=Object.freeze({disabled:0,single:1,double:2});static Code39ChecksumType=Object.freeze({disabled:0,enabled:1});static MsiChecksumType=Object.freeze({disabled:0,mod10:1,mod11:2,mod1010:3,mod1110:4,mod11IBM:5,mod1110IBM:6});static UpcEanDeblur=Object.freeze(copyObject(ToggleTemplate));static MulticodeCachingEnabled=Object.freeze(copyObject(ToggleTemplate));static EnableMisshaped1D=Object.freeze(copyObject(ToggleTemplate));static EnableVINRestrictions=Object.freeze(copyObject(ToggleTemplate));static EnableComposite=Object.freeze(copyObject(ToggleTemplate));static Formatting=Object.freeze({Disabled:0,Automatic:1,GS1:2,AAMVA:3,SADL:4,BCBP:5});static EncodingCharacterSet=Object.freeze({None:0,ISO_8859_2:1,ISO_8859_5:2,Shift_JIS:3,US_ASCII:4,UTF_8:5,UTF_16:6,windows_1251:7,windows_1256:8,BINARY:9});static CameraResolution=Object.freeze({HD:0,FHD:1});static CenterMark=Object.freeze({None:0,Crosshair:1});static LineScanAnimationMode=Object.freeze({None:0,NormalBlinking:1,FastBlinking:2});static BarkoderARMode=Object.freeze({OFF:0,InteractiveDisabled:1,InteractiveEnabled:2,NonInteractive:3,MatchFilter:4});static BarkoderARHeaderShowMode=Object.freeze({NEVER:0,ALWAYS:1,ONSELECTED:2});static BarkoderARLocationType=Object.freeze({NONE:0,TIGHT:1,BOUNDINGBOX:2});}
|
|
290
284
|
let ConfigTypes={};{ConfigTypes.BarkoderConfig=class BarkoderConfig{closeSessionOnResultEnabled;barkoderResolution;decoder;constructor(config){Object.assign(this,config);}
|
|
291
285
|
toJsonString(){let configAsJson={"closeSessionOnResultEnabled":this.closeSessionOnResultEnabled,"barkoderResolution":this.barkoderResolution,"decoder":this.decoder?.toMap()};return JSON.stringify(configAsJson);}}
|
|
292
286
|
ConfigTypes.DekoderConfig=class DekoderConfig{aztec;aztecCompact;qr;qrMicro;code128;code93;code39;codabar;code11;msi;upcA;upcE;upcE1;ean13;ean8;pdf417;pdf417Micro;datamatrix;code25;interleaved25;itf14;iata25;matrix25;datalogic25;coop25;code32;telepen;dotcode;databar14;databarLimited;databarExpanded;postalIMB;postnet;planet;australianPost;royalMail;kix;japanesePost;maxiCode;general;constructor(config){Object.assign(this,config);}
|
|
@@ -325,11 +319,11 @@ class Connector{static isWorker=typeof WorkerGlobalScope!='undefined'&&self inst
|
|
|
325
319
|
let Module;let receivedWasmModule;function callNativeMethod(method,argumentData){if(method==="scanFrame_native"){const payload=argumentData||{};return Connector.scanFrame_native(payload.imageData,payload.caller_id||0);}
|
|
326
320
|
const fn=Connector[method];if(typeof fn!="function"){throw new Error("Unknown native method: "+method);}
|
|
327
321
|
if(Array.isArray(argumentData))return fn(...argumentData);if(typeof argumentData=="undefined")return fn();return fn(argumentData);}}
|
|
328
|
-
function initializeModule(){Module={preRun:[],postRun:[()=>Common.debugMessage("Module","The main() function is done.",true),async()=>{if(Connector.moduleLoaded)return;if(typeof Module._free=="undefined")Module._free=Module.cwrap("aux_freeMemory",null,["number"]);if(typeof Module._malloc=="undefined")Module._malloc=Module.cwrap("aux_allocMemory",null,["number"]);Connector.setCustomOptionGlobal=Module.cwrap("cfg_BKSetCustomOptionGlobal","number",["number","number"]);Connector.initialize=Module.cwrap("initialize","number",["number"]);Connector.getVersion=Module.cwrap("inf_BKgetVersion","string",[]);Connector.getRegionOfInterest=Module.cwrap("cfg_BKGetRegionOfInterest","string",[]);Connector.setRegionOfInterest=Module.cwrap("cfg_BKSetRegionOfInterest",undefined,["number","number","number","number"]);Connector.setDecodingSpeed=Module.cwrap("cfg_BKSetDecodingSpeed","number",["number"]);Connector.setEnabledDecoders=Module.cwrap("cfg_BKSetEnabledDecoders","number",["number","number"]);Connector.setEnabledDecodersPro=Module.cwrap("cfg_BKSetEnabledDecodersPro","number",["number"]);Connector.setUpcEanDeblur=Module.cwrap("cfg_BKSetUpcEanDeblur","number",["number"]);Connector.setSpecificConfig=Module.cwrap("cfg_BKSetSpecificConfig","number",["number","number","number"]);Connector.setLengthRange=Module.cwrap("cfg_BKSetLengthRange","number",["number","number","number"]);Connector.setCustomOption=Module.cwrap("cfg_BKSetCustomOption","number",["number","number"]);Connector.setFormatting=Module.cwrap("cfg_BKSetFormatting","number",["number"]);Connector.setDuplicatesDelayMs=Module.cwrap("cfg_BKSetDuplicatesDelayMs","number",["number"]);Connector.setEncodingCharacterSet=Module.cwrap("cfg_BKSetEncodingCharacterSet","number",["number"]);Connector.setMulticodeCachingEnabled=Module.cwrap("cfg_BKSetMulticodeCachingEnabled","number",["number"]);Connector.setMulticodeCachingDuration=Module.cwrap("cfg_BKSetMulticodeCachingDuration","number",["number"]);Connector.setMaximumResultsCount=Module.cwrap("cfg_BKSetMaximumResultsCount","number",["number"]);Connector.setEnableMisshaped1D=Module.cwrap("cfg_BKSetEnableMisshaped1D","number",["number"]);Connector.setEnableVINRestrictions=Module.cwrap("cfg_BKSetEnableVINRestrictions","number",["number"]);Connector.setEnableComposite=Module.cwrap("cfg_BKSetEnableComposite","number",["number"]);Connector.getDecodingSpeed=Module.cwrap("cfg_BKReturnDecodingSpeed","number",[]);Connector.getUpcEanDeblur=Module.cwrap("cfg_BKReturnUpcEanDeblur","number",[]);Connector.getFormatting=Module.cwrap("cfg_BKReturnFormatting","number",[]);Connector.getDuplicatesDelayMs=Module.cwrap("cfg_BKReturnDuplicatesDelayMs","number",[]);Connector.getMaximumResultsCount=Module.cwrap("cfg_BKGetMaximumResultsCount","number",[]);Connector.getEnableMisshaped1D=Module.cwrap("cfg_BKReturnEnableMisshaped1D","number",[]);Connector.getEnableVINRestrictions=Module.cwrap("cfg_BKReturnEnableVINRestrictions","number",[]);Connector.getEnableComposite=Module.cwrap("cfg_BKReturnEnableComposite","number",[]);Connector.getEncodingCharacterSet=Module.cwrap("cfg_BKReturnEncodingCharacterSet","number",[]);Connector.getSpecificConfig=Module.cwrap("cfg_BKReturnSpecificConfig","number",["number"]);Connector.getBarcodeTypeEnabled=Module.cwrap("cfg_BKReturnBarcodeTypeEnabled","number",["number"]);Connector.setBarcodeTypeEnabled=Module.cwrap("cfg_BKSetBarcodeTypeEnabled","number",["number","number"]);Connector.getLengthRange=Module.cwrap("cfg_BKReturnLengthRange","number",["number"]);Connector.getMulticodeCachingEnabled=Module.cwrap("cfg_BKReturnMulticodeCachingEnabled","number",[]);Connector.getMulticodeCachingDuration=Module.cwrap("cfg_BKReturnMulticodeCachingDuration","number",[]);Connector.igetBkClb1=Module.cwrap("iinf_BKReturnBkClb1","number",[]);Connector.igetBkClb2=Module.cwrap("iinf_BKReturnBkClb2","number",[]);Connector.igetBkClb3=Module.cwrap("iinf_BKReturnBkClb3","number",[]);if(Connector.isWorker)
|
|
322
|
+
function initializeModule(){Module={preRun:[],postRun:[()=>Common.debugMessage("Module","The main() function is done.",true),async()=>{if(Connector.moduleLoaded)return;if(typeof Module._free=="undefined")Module._free=Module.cwrap("aux_freeMemory",null,["number"]);if(typeof Module._malloc=="undefined")Module._malloc=Module.cwrap("aux_allocMemory",null,["number"]);Connector.setCustomOptionGlobal=Module.cwrap("cfg_BKSetCustomOptionGlobal","number",["number","number"]);Connector.initialize=Module.cwrap("initialize","number",["number"]);Connector.getVersion=Module.cwrap("inf_BKgetVersion","string",[]);Connector.getRegionOfInterest=Module.cwrap("cfg_BKGetRegionOfInterest","string",[]);Connector.setRegionOfInterest=Module.cwrap("cfg_BKSetRegionOfInterest",undefined,["number","number","number","number"]);Connector.setDecodingSpeed=Module.cwrap("cfg_BKSetDecodingSpeed","number",["number"]);Connector.setEnabledDecoders=Module.cwrap("cfg_BKSetEnabledDecoders","number",["number","number"]);Connector.setEnabledDecodersPro=Module.cwrap("cfg_BKSetEnabledDecodersPro","number",["number"]);Connector.setUpcEanDeblur=Module.cwrap("cfg_BKSetUpcEanDeblur","number",["number"]);Connector.setSpecificConfig=Module.cwrap("cfg_BKSetSpecificConfig","number",["number","number","number"]);Connector.setLengthRange=Module.cwrap("cfg_BKSetLengthRange","number",["number","number","number"]);Connector.setCustomOption=Module.cwrap("cfg_BKSetCustomOption","number",["number","number"]);Connector.setFormatting=Module.cwrap("cfg_BKSetFormatting","number",["number"]);Connector.setDuplicatesDelayMs=Module.cwrap("cfg_BKSetDuplicatesDelayMs","number",["number"]);Connector.setEncodingCharacterSet=Module.cwrap("cfg_BKSetEncodingCharacterSet","number",["number"]);Connector.setMulticodeCachingEnabled=Module.cwrap("cfg_BKSetMulticodeCachingEnabled","number",["number"]);Connector.setMulticodeCachingDuration=Module.cwrap("cfg_BKSetMulticodeCachingDuration","number",["number"]);Connector.setMaximumResultsCount=Module.cwrap("cfg_BKSetMaximumResultsCount","number",["number"]);Connector.setEnableMisshaped1D=Module.cwrap("cfg_BKSetEnableMisshaped1D","number",["number"]);Connector.setEnableVINRestrictions=Module.cwrap("cfg_BKSetEnableVINRestrictions","number",["number"]);Connector.setEnableComposite=Module.cwrap("cfg_BKSetEnableComposite","number",["number"]);Connector.setReturnOnlyMatchedResults=Module.cwrap("cfg_BKSetReturnOnlyMatchedResults","number",["number"]);Connector.setMatchFilter=Module.cwrap("cfg_BKSetMatchFilter","number",["number"]);Connector.getDecodingSpeed=Module.cwrap("cfg_BKReturnDecodingSpeed","number",[]);Connector.getUpcEanDeblur=Module.cwrap("cfg_BKReturnUpcEanDeblur","number",[]);Connector.getFormatting=Module.cwrap("cfg_BKReturnFormatting","number",[]);Connector.getDuplicatesDelayMs=Module.cwrap("cfg_BKReturnDuplicatesDelayMs","number",[]);Connector.getMaximumResultsCount=Module.cwrap("cfg_BKGetMaximumResultsCount","number",[]);Connector.getEnableMisshaped1D=Module.cwrap("cfg_BKReturnEnableMisshaped1D","number",[]);Connector.getEnableVINRestrictions=Module.cwrap("cfg_BKReturnEnableVINRestrictions","number",[]);Connector.getEnableComposite=Module.cwrap("cfg_BKReturnEnableComposite","number",[]);Connector.getReturnOnlyMatchedResults=Module.cwrap("cfg_BKReturnReturnOnlyMatchedResults","number",[]);Connector.getEncodingCharacterSet=Module.cwrap("cfg_BKReturnEncodingCharacterSet","number",[]);Connector.getSpecificConfig=Module.cwrap("cfg_BKReturnSpecificConfig","number",["number"]);Connector.getBarcodeTypeEnabled=Module.cwrap("cfg_BKReturnBarcodeTypeEnabled","number",["number"]);Connector.setBarcodeTypeEnabled=Module.cwrap("cfg_BKSetBarcodeTypeEnabled","number",["number","number"]);Connector.getLengthRange=Module.cwrap("cfg_BKReturnLengthRange","number",["number"]);Connector.getMulticodeCachingEnabled=Module.cwrap("cfg_BKReturnMulticodeCachingEnabled","number",[]);Connector.getMulticodeCachingDuration=Module.cwrap("cfg_BKReturnMulticodeCachingDuration","number",[]);Connector.igetBkClb1=Module.cwrap("iinf_BKReturnBkClb1","number",[]);Connector.igetBkClb2=Module.cwrap("iinf_BKReturnBkClb2","number",[]);Connector.igetBkClb3=Module.cwrap("iinf_BKReturnBkClb3","number",[]);if(Connector.isWorker)
|
|
329
323
|
Connector.setCachedProp=Module.cwrap("iinf_setCachedProp","number",["number","number"]);else
|
|
330
324
|
Connector.getCachedProp=Module.cwrap("iinf_getCachedProp","string",["number"]);Connector.getVersion=(()=>{const old=Connector.getVersion;return function(...args){return JSON.parse(old.call(this,...args));};})();Connector.getRegionOfInterest=(()=>{const old=Connector.getRegionOfInterest;return function(...args){return JSON.parse(old.call(this,...args));};})();Connector.setCustomOptionGlobal=(()=>{const setCustomOptionGlobal_old=Connector.setCustomOptionGlobal;return function(customOption,value){let customOption_len=customOption.length;const uintc8=new Uint8ClampedArray(customOption_len+1);for(let i=0;i<customOption_len;i++)uintc8[i]=customOption.charCodeAt(i);uintc8[customOption_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let returnValue=setCustomOptionGlobal_old.call(this,dataPtr,value);Module._free(dataPtr);dataPtr=null;return returnValue;};})();Connector.initialize=(()=>{const initialize_old=Connector.initialize;return async function(key){let key_len=key.length;const uintc8=new Uint8ClampedArray(key_len+1);for(let i=0;i<key_len;i++)uintc8[i]=key.charCodeAt(i);uintc8[key_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let response=initialize_old.call(this,dataPtr);if(!Connector.getBkClb3()){var timeCounter=0;var timeout=false;while(!Connector.getBkClb2()){await Common.wait(20);timeCounter+=20;if(timeCounter>=1000){Common.debugMessage("Init","Stage 2 timeout.",true);timeout=true;break;}}
|
|
331
325
|
Common.debugMessage("Init",`Stage 2/3 took ${timeCounter}ms`,true);if(!timeout)response=initialize_old.call(this,dataPtr);}
|
|
332
|
-
Module._free(dataPtr);dataPtr=null;return response;};})();Connector.setCustomOption=(()=>{const setCustomOption_old=Connector.setCustomOption;return function(customOption,value){let customOption_len=customOption.length;const uintc8=new Uint8ClampedArray(customOption_len+1);for(let i=0;i<customOption_len;i++)uintc8[i]=customOption.charCodeAt(i);uintc8[customOption_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let response=setCustomOption_old.call(this,dataPtr,value);Module._free(dataPtr);dataPtr=null;return response;};})();if(Connector.isWorker)
|
|
326
|
+
Module._free(dataPtr);dataPtr=null;return response;};})();Connector.setCustomOption=(()=>{const setCustomOption_old=Connector.setCustomOption;return function(customOption,value){let customOption_len=customOption.length;const uintc8=new Uint8ClampedArray(customOption_len+1);for(let i=0;i<customOption_len;i++)uintc8[i]=customOption.charCodeAt(i);uintc8[customOption_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let response=setCustomOption_old.call(this,dataPtr,value);Module._free(dataPtr);dataPtr=null;return response;};})();Connector.setMatchFilter=(()=>{const setMatchFilter_old=Connector.setMatchFilter;return function(matchFilter){let matchFilter_len=matchFilter.length;const uintc8=new Uint8ClampedArray(matchFilter_len+1);for(let i=0;i<matchFilter_len;i++)uintc8[i]=matchFilter.charCodeAt(i);uintc8[matchFilter_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let response=setMatchFilter_old.call(this,dataPtr);Module._free(dataPtr);dataPtr=null;return response;};})();if(Connector.isWorker)
|
|
333
327
|
Connector.setCachedProp=(()=>{const setCachedProp_old=Connector.setCachedProp;return function(prop,value){let value_len=value.length;const uintc8=new Uint8ClampedArray(value_len+1);for(let i=0;i<value_len;i++)uintc8[i]=value.charCodeAt(i);uintc8[value_len]=0;let data=uintc8;let nDataBytes=data.length*data.BYTES_PER_ELEMENT;let dataPtr=Module._malloc(nDataBytes);Module.HEAPU8.set(data,dataPtr);let response=setCachedProp_old.call(this,prop,dataPtr);Module._free(dataPtr);dataPtr=null;return response;};})();if((Connector.isWorker==false)&&(!UseMainThreadOnlyGlobal.value))
|
|
334
328
|
for(const key of Object.getOwnPropertyNames(Connector)){const old=Connector[key];Common.debugMessage("postRun","Connector."+key+" accessed",false);Common.debugMessage("postRun",typeof old+" type",false);if(typeof old=='function'&&key.startsWith('set')){let key2='g'+key.slice(1);let key2_exists=(typeof Connector[key2]=='function');const get_methods_with_one_arg=['getSpecificConfig','getBarcodeTypeEnabled','getLengthRange'];const set_methods_to_skip=['setCustomOptionGlobal'];let key2_has_arg=(key2_exists&&get_methods_with_one_arg.includes(key2));let key_skip=set_methods_to_skip.includes(key);if(key_skip)continue;Common.debugMessage("postRun","Connector."+key+" is about to be overridden",false);Connector[key]=function(...args){let original_set_result=old.call(this,...args);let worker_set_result=[];let worker_get_result=[];for(let i=0;i<Connector.w.length;i++)
|
|
335
329
|
{worker_set_result[i]=sendRequestToWorker(Connector.w[i],key,args,false);}
|
|
@@ -342,8 +336,8 @@ return new URL(path,"__BASE_PATH__").href;}
|
|
|
342
336
|
else
|
|
343
337
|
{const userPath=WasmBinaryPathGlobal.value;const userVersionedWasm=ObtainVersionedBinaryGlobal.value;if(typeof userPath=='string'&&userPath.length>=6&&userPath.includes(".wasm")){path=userPath;}
|
|
344
338
|
if(typeof userVersionedWasm=='boolean'&&userVersionedWasm&&path.endsWith(".wasm")){path=path+"?v="+Module.version;}
|
|
345
|
-
const basePath=new URL("./",window.location.href).href;return new URL(path,basePath).href;}},instantiateWasm:function(imports,successCallback){WebAssembly.instantiate(receivedWasmModule,imports).then((instance)=>{successCallback(instance,receivedWasmModule);}).catch((err)=>console.error("Wasm Instantiation Error:",err));return{};},version:"1.7.
|
|
346
|
-
function runGlue(incomingModule){(function(Module){let has_SIMD=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));if(has_SIMD){var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){if(typeof process=="undefined"||!process.release||process.release.name!=="node")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var nodeVersion=process.versions.node;var numericVersion=nodeVersion.split(".").slice(0,3);numericVersion=numericVersion[0]*1e4+numericVersion[1]*100+numericVersion[2].split("-")[0]*1;if(numericVersion<16e4){throw new Error("This emscripten-generated code requires node v16.0.0 (detected v"+nodeVersion+")")}var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);assert(Buffer.isBuffer(ret));return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");assert(binary?Buffer.isBuffer(ret):typeof ret=="string");return ret};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_SHELL){if(typeof process=="object"&&typeof require==="function"||typeof window=="object"||typeof WorkerGlobalScope!="undefined")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}if(!(typeof window=="object"||typeof WorkerGlobalScope!="undefined"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{throw new Error("environment detection error")}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;checkIncomingModuleAPI();if(Module["arguments"])arguments_=Module["arguments"];legacyModuleProp("arguments","arguments_");if(Module["thisProgram"])thisProgram=Module["thisProgram"];legacyModuleProp("thisProgram","thisProgram");assert(typeof Module["memoryInitializerPrefixURL"]=="undefined","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["pthreadMainPrefixURL"]=="undefined","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["cdInitializerPrefixURL"]=="undefined","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["filePackagePrefixURL"]=="undefined","Module.filePackagePrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["read"]=="undefined","Module.read option was removed");assert(typeof Module["readAsync"]=="undefined","Module.readAsync option was removed (modify readAsync in JS)");assert(typeof Module["readBinary"]=="undefined","Module.readBinary option was removed (modify readBinary in JS)");assert(typeof Module["setWindowTitle"]=="undefined","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)");assert(typeof Module["TOTAL_MEMORY"]=="undefined","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");legacyModuleProp("asm","wasmExports");legacyModuleProp("readAsync","readAsync");legacyModuleProp("readBinary","readBinary");legacyModuleProp("setWindowTitle","setWindowTitle");assert(!ENVIRONMENT_IS_SHELL,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var wasmBinary=Module["wasmBinary"];legacyModuleProp("wasmBinary","wasmBinary");if(typeof WebAssembly!="object"){err("no native wasm support detected")}function intArrayFromBase64(s){if(typeof ENVIRONMENT_IS_NODE!="undefined"&&ENVIRONMENT_IS_NODE){var buf=Buffer.from(s,"base64");return new Uint8Array(buf.buffer,buf.byteOffset,buf.length)}var decoded=atob(s);var bytes=new Uint8Array(decoded.length);for(var i=0;i<decoded.length;++i){bytes[i]=decoded.charCodeAt(i)}return bytes}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort("Assertion failed"+(text?": "+text:""))}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}assert(!Module["STACK_SIZE"],"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time");assert(typeof Int32Array!="undefined"&&typeof Float64Array!=="undefined"&&Int32Array.prototype.subarray!=undefined&&Int32Array.prototype.set!=undefined,"JS engine does not provide full typed array support");assert(!Module["wasmMemory"],"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally");assert(!Module["INITIAL_MEMORY"],"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");function writeStackCookie(){var max=_emscripten_stack_get_end();assert((max&3)==0);if(max==0){max+=4}HEAPU32[max>>2]=34821223;HEAPU32[max+4>>2]=2310721022;HEAPU32[0>>2]=1668509029}function checkStackCookie(){if(ABORT)return;var max=_emscripten_stack_get_end();if(max==0){max+=4}var cookie1=HEAPU32[max>>2];var cookie2=HEAPU32[max+4>>2];if(cookie1!=34821223||cookie2!=2310721022){abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`)}if(HEAPU32[0>>2]!=1668509029){abort("Runtime error: The application has corrupted its heap memory area (address zero)!")}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){assert(!runtimeInitialized);runtimeInitialized=true;checkStackCookie();if(!Module["noFSInit"]&&!FS.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}assert(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var runDependencies=0;var dependenciesFulfilled=null;var runDependencyTracking={};var runDependencyWatcher=null;function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies);if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!="undefined"){runDependencyWatcher=setInterval(()=>{if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;err("still waiting on run dependencies:")}err(`dependency: ${dep}`)}if(shown){err("(end of list)")}},1e4)}}else{err("warning: run dependency added without ID")}}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{err("warning: run dependency removed without ID")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function createExportWrapper(name,nargs){return(...args)=>{assert(runtimeInitialized,`native function \`${name}\` called before runtime initialization`);var f=wasmExports[name];assert(f,`exported native function \`${name}\` not found`);assert(args.length<=nargs,`native function \`${name}\` called with ${args.length} args but expects ${nargs}`);return f(...args)}}class EmscriptenEH extends Error{}class EmscriptenSjLj extends EmscriptenEH{}class CppException extends EmscriptenEH{constructor(excPtr){super(excPtr);this.excPtr=excPtr;const excInfo=getExceptionMessage(excPtr);this.name=excInfo[0];this.message=excInfo[1]}}function findWasmBinary(){var f="barkoder.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);if(isFileURI(wasmBinaryFile)){err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`)}abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["memory"];assert(wasmMemory,"memory not found in wasm exports");updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];assert(wasmTable,"table not found in wasm exports");addOnInit(wasmExports["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");var trueModule=Module;function receiveInstantiationResult(result){assert(Module===trueModule,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");trueModule=null;receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false}}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);receiveInstantiationResult(result);return result}(()=>{var h16=new Int16Array(1);var h8=new Int8Array(h16.buffer);h16[0]=25459;if(h8[0]!==115||h8[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();if(Module["ENVIRONMENT"]){throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)")}function legacyModuleProp(prop,newName,incoming=true){if(!Object.getOwnPropertyDescriptor(Module,prop)){Object.defineProperty(Module,prop,{configurable:true,get(){let extra=incoming?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":"";abort(`\`Module.${prop}\` has been replaced by \`${newName}\``+extra)}})}}function ignoredModuleProp(prop){if(Object.getOwnPropertyDescriptor(Module,prop)){abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`)}}function isExportedByForceFilesystem(name){return name==="FS_createPath"||name==="FS_createDataFile"||name==="FS_createPreloadedFile"||name==="FS_unlink"||name==="addRunDependency"||name==="FS_createLazyFile"||name==="FS_createDevice"||name==="removeRunDependency"}function hookGlobalSymbolAccess(sym,func){if(typeof globalThis!="undefined"&&!Object.getOwnPropertyDescriptor(globalThis,sym)){Object.defineProperty(globalThis,sym,{configurable:true,get(){func();return undefined}})}}function missingGlobal(sym,msg){hookGlobalSymbolAccess(sym,()=>{warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`)})}missingGlobal("buffer","Please use HEAP8.buffer or wasmMemory.buffer");missingGlobal("asm","Please use wasmExports instead");function missingLibrarySymbol(sym){hookGlobalSymbolAccess(sym,()=>{var msg=`\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;var librarySymbol=sym;if(!librarySymbol.startsWith("_")){librarySymbol="$"+sym}msg+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;if(isExportedByForceFilesystem(sym)){msg+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"}warnOnce(msg)});unexportedRuntimeSymbol(sym)}function unexportedRuntimeSymbol(sym){if(!Object.getOwnPropertyDescriptor(Module,sym)){Object.defineProperty(Module,sym,{configurable:true,get(){var msg=`'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;if(isExportedByForceFilesystem(sym)){msg+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"}abort(msg)}})}}var ASM_CONSTS={4295952:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},4296007:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},4296062:()=>ENVIRONMENT_IS_WORKER?1:0,4296104:($0,$1,$2,$3,$4)=>{if(typeof Module=="undefined"||!Module.MountedFiles){return 1}let fileName=UTF8ToString(Number($0>>>0));if(fileName.startsWith("./")){fileName=fileName.substring(2)}const fileData=Module.MountedFiles.get(fileName);if(!fileData){return 2}const offset=Number($1>>>0);const length=Number($2>>>0);const dataIdOrBuffer=Number($3>>>0);const loadType=$4;if(offset+length>fileData.byteLength){return 3}try{const data=fileData.subarray(offset,offset+length);switch(loadType){case 0:HEAPU8.set(data,dataIdOrBuffer);break;case 1:Module.jsepUploadExternalBuffer(dataIdOrBuffer,data);break;default:return 4}return 0}catch{return 4}}};class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var ptrToString=ptr=>{assert(typeof ptr==="number");ptr>>>=0;return"0x"+ptr.toString(16).padStart(8,"0")};var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var warnOnce=text=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{if((u0&248)!=240)warnOnce("Invalid UTF-8 leading byte "+ptrToString(u0)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!");u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>{assert(typeof ptr=="number",`UTF8ToString expects a number (got ${typeof ptr})`);return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""};var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=new CppException(ptr);uncaughtExceptionCount++;throw exceptionLast};var ___cxa_uncaught_exceptions=()=>uncaughtExceptionCount;var syscallGetVarargI=()=>{assert(SYSCALLS.varargs!=undefined);var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{assert(typeof str==="string",`stringToUTF8Array expects a string (got ${typeof str})`);if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>1114111)warnOnce("Invalid Unicode code point "+ptrToString(u)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var zeroMemory=(address,size)=>{HEAPU8.fill(0,address,address+size)};var alignMemory=(size,alignment)=>{assert(alignment,"alignment argument is required");return Math.ceil(size/alignment)*alignment};var mmapAlloc=size=>{size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(ptr)zeroMemory(ptr,size);return ptr};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw new FS.ErrnoError(44)},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write(stream,buffer,offset,length,position,canOwn){assert(!(buffer instanceof ArrayBuffer));if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){assert(position===0,"canOwn must imply no weird position inside the file");node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},allocate(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url).then(processData,onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var strError=errno=>UTF8ToString(_strerror(errno));var ERRNO_CODES={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class extends Error{name="ErrnoError";constructor(errno){super(runtimeInitialized?strError(errno):"");this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break}}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}},lookupPath(path,opts={}){if(!path)return{path:"",node:null};opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p&&p!==".");var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}if(parts[i]===".."){current_path=PATH.dirname(current_path);current=current.parent;continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){assert(typeof parent=="object");var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){assert(fd>=-1);stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){if(typeof type=="string"){throw type}var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};var parent=FS.lookupPath(path,{follow:true}).node;if(parent?.node_ops.statfs){Object.assign(rtn,parent.node_ops.statfs(parent.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return link.node_ops.readlink(link)},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat(path){return FS.stat(path,true)},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,ctime:Date.now()})},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.chmod(stream.node,mode)},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.chown(stream.node,uid,gid)},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{atime,mtime})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){assert(offset>=0);if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){assert(offset>=0);if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate(stream,offset,length){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){assert(offset>=0);if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error(`Invalid encoding type "${opts.encoding}"`)}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1);assert(stdin.fd===0,`invalid handle for stdin (${stdin.fd})`);assert(stdout.fd===1,`invalid handle for stdout (${stdout.fd})`);assert(stderr.fd===2,`invalid handle for stderr (${stderr.fd})`)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){assert(!FS.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;_fflush(0);for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node},absolutePath(){abort("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){abort("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){abort("FS.createLink has been removed; use FS.symlink instead")},joinPath(){abort("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){abort("FS.standardizePath has been removed; use PATH.normalize instead")}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},doStat(func,path,buf){var stat=func(path);HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>{assert(typeof maxBytesToWrite=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)};function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_getdents64(fd,dirp,count){try{var stream=SYSCALLS.getStreamFromFD(fd);stream.getdents||=FS.readdir(stream.path);var struct_size=280;var pos=0;var off=FS.llseek(stream,0,1);var startIdx=Math.floor(off/struct_size);var endIdx=Math.min(stream.getdents.length,startIdx+Math.floor(count/struct_size));for(var idx=startIdx;idx<endIdx;idx++){var id;var type;var name=stream.getdents[idx];if(name==="."){id=stream.node.id;type=4}else if(name===".."){var lookup=FS.lookupPath(stream.path,{parent:true});id=lookup.node.id;type=4}else{var child;try{child=FS.lookupNode(stream.node,name)}catch(e){if(e?.errno===28){continue}throw e}id=child.id;type=FS.isChrdev(child.mode)?2:FS.isDir(child.mode)?4:FS.isLink(child.mode)?10:8}assert(id);HEAP64[dirp+pos>>3]=BigInt(id);HEAP64[dirp+pos+8>>3]=BigInt((idx+1)*struct_size);HEAP16[dirp+pos+16>>1]=280;HEAP8[dirp+pos+18]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size}FS.llseek(stream,idx*struct_size,0);return pos}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;assert(!flags,`unknown flags in __syscall_newfstatat: ${flags}`);path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_readlinkat(dirfd,path,buf,bufsize){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(bufsize<=0)return-28;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>abort("native code called abort()");var embindRepr=v=>{if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes};var embind_charCodes;var readLatin1String=ptr=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError;var throwBindingError=message=>{throw new BindingError(message)};var InternalError;var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((dt,i)=>{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){if(registeredInstance.argPackAdvance===undefined){throw new TypeError("registerType registeredInstance requires argPackAdvance")}return sharedRegisterType(rawType,registeredInstance,options)}var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];case 8:return signed?pointer=>HEAP64[pointer>>3]:pointer=>HEAPU64[pointer>>3];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);var isUnsignedType=name.indexOf("u")!=-1;if(isUnsignedType){maxRange=(1n<<64n)-1n}registerType(primitiveType,{name,fromWireType:value=>value,toWireType:function(destructors,value){if(typeof value!="bigint"&&typeof value!="number"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${this.name}`)}if(typeof value=="number"){value=BigInt(value)}if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`)}return value},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null})};var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function(pointer){return this["fromWireType"](HEAPU8[pointer])},destructorFunction:null})};var emval_freelist=[];var emval_handles=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){assert(emval_handles[handle]!==undefined,`Decref for unallocated handle.`);emval_handles[handle]=undefined;emval_freelist.push(handle)}};var count_emval_handles=()=>emval_handles.length/2-5-emval_freelist.length;var init_emval=()=>{emval_handles.push(0,1,undefined,1,null,1,true,1,false,1);assert(emval_handles.length===5*2);Module["count_emval_handles"]=count_emval_handles};var Emval={toValue:handle=>{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}assert(handle===2||emval_handles[handle]!==undefined&&handle%2===0,`invalid handle: ${handle}`);return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var EmValType={name:"emscripten::val",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert ${embindRepr(value)} to ${this.name}`)}return value},argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var createNamedFunction=(name,body)=>Object.defineProperty(body,"name",{value:name});var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true}}return false}function newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(`new_ called with constructor type ${typeof constructor} which is not a function`)}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function checkArgCount(numArgs,minArgs,maxArgs,humanName,throwBindingError){if(numArgs<minArgs||numArgs>maxArgs){var argCountMessage=minArgs==maxArgs?minArgs:`${minArgs} to ${maxArgs}`;throwBindingError(`function ${humanName} called with ${numArgs} arguments, expected ${argCountMessage}`)}}function createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired")}for(var i=0;i<argCount;++i){argsList.push(`arg${i}`);argsListWired.push(`arg${i}Wired`)}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody=`return function (${argsList}) {\n`;invokerFnBody+="checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);\n";if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+=`var thisWired = classParam['toWireType'](${dtorStack}, this);\n`}for(var i=0;i<argCount;++i){invokerFnBody+=`var arg${i}Wired = argType${i}['toWireType'](${dtorStack}, arg${i});\n`;args1.push(`argType${i}`)}invokerFnBody+=(returns||isAsync?"var rv = ":"")+`invoker(${argsListWired});\n`;if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=`${paramName}_dtor(${paramName});\n`;args1.push(`${paramName}_dtor`)}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\n"+"return ret;\n"}else{}invokerFnBody+="}\n";args1.push("checkArgCount","minArgs","maxArgs");invokerFnBody=`if (arguments.length !== ${args1.length}){ throw new Error(humanName + "Expected ${args1.length} closure arguments " + arguments.length + " given."); }\n${invokerFnBody}`;return[args1,invokerFnBody]}function getRequiredArgCount(argTypes){var requiredArgCount=argTypes.length-2;for(var i=argTypes.length-1;i>=2;--i){if(!argTypes[i].optional){break}requiredArgCount--}return requiredArgCount}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}assert(!isAsync,"Async bindings are only supported with JSPI.");var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var expectedArgCount=argCount-2;var minArgs=getRequiredArgCount(argTypes);var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2])}if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction)}}}closureArgs.push(checkArgCount,minArgs,expectedArgCount);let[args,invokerFnBody]=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync);args.push(invokerFnBody);var invokerFn=newFunc(Function,args)(...closureArgs);return createNamedFunction(humanName,invokerFn)}var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2])}return array};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var wasmTableMirror=[];var wasmTable;var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}assert(wasmTable.get(funcPtr)==func,"JavaScript-side Wasm function table mirror is out of date!");return func};var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return`${this.name}: ${this.message}`}};return errorClass};var UnboundTypeError;var getTypeName=type=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex!==-1){assert(signature[signature.length-1]==")","Parentheses for argument names should match.");return signature.substr(0,argsIndex)}else{return signature}};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<<bitshift>>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${toTypeName}`)}if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`)}};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name,fromWireType,toWireType,argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=true;registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[payload+i])}str=a.join("")}_free(value);return str},toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value)}else{length=value.length}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i]}}}if(destructors!==null){destructors.push(_free,base)}return base},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead)=>{assert(ptr%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!");assert(typeof maxBytesToWrite=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");maxBytesToWrite??=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{assert(ptr%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!");assert(typeof maxBytesToWrite=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");maxBytesToWrite??=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=pointer=>HEAPU16[pointer>>1]}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=pointer=>HEAPU32[pointer>>2]}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name,argPackAdvance:0,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var __emscripten_fs_load_embedded_files=ptr=>{do{var name_addr=HEAPU32[ptr>>2];ptr+=4;var len=HEAPU32[ptr>>2];ptr+=4;var content=HEAPU32[ptr>>2];ptr+=4;var name=UTF8ToString(name_addr);FS.createPath("/",PATH.dirname(name),true,true);FS.createDataFile(name,null,HEAP8.subarray(content,content+len),true,true,true)}while(HEAPU32[ptr>>2])};var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`)}return impl};var emval_returnValue=(returnType,destructorsRef,handle)=>{var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors)}return result};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle)};var emval_methodCallers=[];var __emval_call=(caller,handle,destructorsRef,args)=>{caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args)};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol};var __emval_call_method=(caller,objHandle,methodName,destructorsRef,args)=>{caller=emval_methodCallers[caller];objHandle=Emval.toValue(objHandle);methodName=getStringOrSymbol(methodName);return caller(objHandle,objHandle[methodName],destructorsRef,args)};var emval_get_global=()=>{if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()};var __emval_get_global=name=>{if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}};var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter "+i)}return a};var reflectConstruct=Reflect.construct;var __emval_get_method_caller=(argCount,argTypes,kind)=>{var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody=`return function (obj, func, destructorsRef, args) {\n`;var offset=0;var argsList=[];if(kind===0){argsList.push("obj")}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg"+i);params.push("argType"+i);args.push(types[i]);functionBody+=` var arg${i} = argType${i}.readValueFromPointer(args${offset?"+"+offset:""});\n`;offset+=types[i].argPackAdvance}var invoker=kind===1?"new func":"func.call";functionBody+=` var rv = ${invoker}(${argsList.join(", ")});\n`;if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n"}functionBody+="};\n";params.push(functionBody);var invokerFunction=newFunc(Function,params)(...args);var functionName=`methodCaller<(${types.map(t=>t.name).join(", ")}) => ${retType.name}>`;return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction))};var __emval_get_module_property=name=>{name=getStringOrSymbol(name);return Emval.toHandle(Module[name])};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>9){emval_handles[handle+1]+=1}};var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value};var __emval_take_value=(type,arg)=>{type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)};var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function __gmtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};function __localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1}return timeMs/1e3})();return BigInt(ret)};function __mmap_js(len,prot,flags,fd,offset,allocated,addr){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);var res=FS.mmap(stream,len,offset,prot,flags);var ptr=res.ptr;HEAP32[allocated>>2]=res.allocated;HEAPU32[addr>>2]=ptr;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function __munmap_js(addr,len,prot,flags,fd,offset){offset=bigintToI53Checked(offset);try{var stream=SYSCALLS.getStreamFromFD(fd);if(prot&2){SYSCALLS.doMsync(addr,stream,len,flags,offset)}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}checkStackCookie();if(e instanceof WebAssembly.RuntimeError){if(_emscripten_stack_get_current()<=0){err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 5242880)")}}quit_(1,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;checkUnflushedContent();if(keepRuntimeAlive()&&!implicit){var msg=`program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;err(msg)}_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){err("user callback triggered after runtime exited or application aborted. Ignoring.");return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{assert(which in timers);delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var __timegm_js=function(tmPtr){var ret=(()=>{var time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var date=new Date(time);HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3})();return BigInt(ret)};var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);assert(winterName);assert(summerName);assert(lengthBytesUTF8(winterName)<=16,`timezone name truncated to fit in TZNAME_MAX (${winterName})`);assert(lengthBytesUTF8(summerName)<=16,`timezone name truncated to fit in TZNAME_MAX (${summerName})`);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{assert(Array.isArray(readEmAsmArgsArray));assert(buf%16==0);readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var chr=String.fromCharCode(ch);var validChars=["d","f","i","p"];validChars.push("j");assert(validChars.includes(chr),`Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);assert(ASM_CONSTS.hasOwnProperty(code),`No EM_ASM constant found at address ${code}. The loaded WebAssembly file is likely out of sync with the generated JavaScript.`);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`)}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;assert(requestedSize>oldSize);var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);return false};var _emscripten_run_script=ptr=>{eval(UTF8ToString(ptr))};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){assert(str.charCodeAt(i)===(str.charCodeAt(i)&255));HEAP8[buffer++]=str.charCodeAt(i)}HEAP8[buffer]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum};var MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];var addDays=(date,days)=>{var newDate=new Date(date.getTime());while(days>0){var leap=isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var jstoi_q=str=>parseInt(str);var _strptime=(buf,format,tm)=>{var pattern=UTF8ToString(format);var SPECIAL_CHARS="\\!@#$^&*()+=-[]/{}|:<>?,.";for(var i=0,ii=SPECIAL_CHARS.length;i<ii;++i){pattern=pattern.replace(new RegExp("\\"+SPECIAL_CHARS[i],"g"),"\\"+SPECIAL_CHARS[i])}var EQUIVALENT_MATCHERS={A:"%a",B:"%b",c:"%a %b %d %H:%M:%S %Y",D:"%m\\/%d\\/%y",e:"%d",F:"%Y-%m-%d",h:"%b",R:"%H\\:%M",r:"%I\\:%M\\:%S\\s%p",T:"%H\\:%M\\:%S",x:"%m\\/%d\\/(?:%y|%Y)",X:"%H\\:%M\\:%S"};var DATE_PATTERNS={a:"(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)",b:"(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)",C:"\\d\\d",d:"0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31",H:"\\d(?!\\d)|[0,1]\\d|20|21|22|23",I:"\\d(?!\\d)|0\\d|10|11|12",j:"00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d",m:"0[1-9]|[1-9](?!\\d)|10|11|12",M:"0\\d|\\d(?!\\d)|[1-5]\\d",n:" ",p:"AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.",S:"0\\d|\\d(?!\\d)|[1-5]\\d|60",U:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",W:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",w:"[0-6]",y:"\\d\\d",Y:"\\d\\d\\d\\d",t:" ",z:"Z|(?:[\\+\\-]\\d\\d:?(?:\\d\\d)?)"};var MONTH_NUMBERS={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11};var DAY_NUMBERS_SUN_FIRST={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};var DAY_NUMBERS_MON_FIRST={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6};var capture=[];var pattern_out=pattern.replace(/%(.)/g,(m,c)=>EQUIVALENT_MATCHERS[c]||m).replace(/%(.)/g,(_,c)=>{let pat=DATE_PATTERNS[c];if(pat){capture.push(c);return`(${pat})`}else{return c}}).replace(/\s+/g,"\\s*");var matches=new RegExp("^"+pattern_out,"i").exec(UTF8ToString(buf));function initDate(){function fixup(value,min,max){return typeof value!="number"||isNaN(value)?min:value>=min?value<=max?value:max:min}return{year:fixup(HEAP32[tm+20>>2]+1900,1970,9999),month:fixup(HEAP32[tm+16>>2],0,11),day:fixup(HEAP32[tm+12>>2],1,31),hour:fixup(HEAP32[tm+8>>2],0,23),min:fixup(HEAP32[tm+4>>2],0,59),sec:fixup(HEAP32[tm>>2],0,59),gmtoff:0}}if(matches){var date=initDate();var value;var getMatch=symbol=>{var pos=capture.indexOf(symbol);if(pos>=0){return matches[pos+1]}return};if(value=getMatch("S")){date.sec=jstoi_q(value)}if(value=getMatch("M")){date.min=jstoi_q(value)}if(value=getMatch("H")){date.hour=jstoi_q(value)}else if(value=getMatch("I")){var hour=jstoi_q(value);if(value=getMatch("p")){hour+=value.toUpperCase()[0]==="P"?12:0}date.hour=hour}if(value=getMatch("Y")){date.year=jstoi_q(value)}else if(value=getMatch("y")){var year=jstoi_q(value);if(value=getMatch("C")){year+=jstoi_q(value)*100}else{year+=year<69?2e3:1900}date.year=year}if(value=getMatch("m")){date.month=jstoi_q(value)-1}else if(value=getMatch("b")){date.month=MONTH_NUMBERS[value.substring(0,3).toUpperCase()]||0}if(value=getMatch("d")){date.day=jstoi_q(value)}else if(value=getMatch("j")){var day=jstoi_q(value);var leapYear=isLeapYear(date.year);for(var month=0;month<12;++month){var daysUntilMonth=arraySum(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,month-1);if(day<=daysUntilMonth+(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[month]){date.day=day-daysUntilMonth}}}else if(value=getMatch("a")){var weekDay=value.substring(0,3).toUpperCase();if(value=getMatch("U")){var weekDayNumber=DAY_NUMBERS_SUN_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===0){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}else if(value=getMatch("W")){var weekDayNumber=DAY_NUMBERS_MON_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===1){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+1+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}}if(value=getMatch("z")){if(value.toLowerCase()==="z"){date.gmtoff=0}else{var match=value.match(/^((?:\-|\+)\d\d):?(\d\d)?/);date.gmtoff=match[1]*3600;if(match[2]){date.gmtoff+=date.gmtoff>0?match[2]*60:-match[2]*60}}}var fullDate=new Date(date.year,date.month,date.day,date.hour,date.min,date.sec,0);HEAP32[tm>>2]=fullDate.getSeconds();HEAP32[tm+4>>2]=fullDate.getMinutes();HEAP32[tm+8>>2]=fullDate.getHours();HEAP32[tm+12>>2]=fullDate.getDate();HEAP32[tm+16>>2]=fullDate.getMonth();HEAP32[tm+20>>2]=fullDate.getFullYear()-1900;HEAP32[tm+24>>2]=fullDate.getDay();HEAP32[tm+28>>2]=arraySum(isLeapYear(fullDate.getFullYear())?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,fullDate.getMonth()-1)+fullDate.getDate()-1;HEAP32[tm+32>>2]=0;HEAP32[tm+36>>2]=date.gmtoff;return buf+intArrayFromString(matches[0]).length-1}return 0};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func};var writeArrayToMemory=(array,buffer)=>{assert(array.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)");HEAP8.set(array,buffer)};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!=="array",'Return type should not be "array".');if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>(...args)=>ccall(ident,returnType,argTypes,args,opts);var FS_createPath=FS.createPath;var FS_unlink=path=>FS.unlink(path);var FS_createLazyFile=FS.createLazyFile;var FS_createDevice=FS.createDevice;var incrementExceptionRefcount=ptr=>___cxa_increment_exception_refcount(ptr);Module["incrementExceptionRefcount"]=incrementExceptionRefcount;var decrementExceptionRefcount=ptr=>___cxa_decrement_exception_refcount(ptr);Module["decrementExceptionRefcount"]=decrementExceptionRefcount;var getExceptionMessageCommon=ptr=>{var sp=stackSave();var type_addr_addr=stackAlloc(4);var message_addr_addr=stackAlloc(4);___get_exception_message(ptr,type_addr_addr,message_addr_addr);var type_addr=HEAPU32[type_addr_addr>>2];var message_addr=HEAPU32[message_addr_addr>>2];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr)}stackRestore(sp);return[type,message]};var getExceptionMessage=ptr=>getExceptionMessageCommon(ptr);Module["getExceptionMessage"]=getExceptionMessage;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;embind_init_charCodes();BindingError=Module["BindingError"]=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};InternalError=Module["InternalError"]=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");function checkIncomingModuleAPI(){ignoredModuleProp("fetchSettings")}var wasmImports={__assert_fail:___assert_fail,__cxa_throw:___cxa_throw,__cxa_uncaught_exceptions:___cxa_uncaught_exceptions,__syscall_fcntl64:___syscall_fcntl64,__syscall_fstat64:___syscall_fstat64,__syscall_getcwd:___syscall_getcwd,__syscall_getdents64:___syscall_getdents64,__syscall_ioctl:___syscall_ioctl,__syscall_lstat64:___syscall_lstat64,__syscall_mkdirat:___syscall_mkdirat,__syscall_newfstatat:___syscall_newfstatat,__syscall_openat:___syscall_openat,__syscall_readlinkat:___syscall_readlinkat,__syscall_rmdir:___syscall_rmdir,__syscall_stat64:___syscall_stat64,__syscall_unlinkat:___syscall_unlinkat,_abort_js:__abort_js,_embind_register_bigint:__embind_register_bigint,_embind_register_bool:__embind_register_bool,_embind_register_emval:__embind_register_emval,_embind_register_float:__embind_register_float,_embind_register_function:__embind_register_function,_embind_register_integer:__embind_register_integer,_embind_register_memory_view:__embind_register_memory_view,_embind_register_std_string:__embind_register_std_string,_embind_register_std_wstring:__embind_register_std_wstring,_embind_register_void:__embind_register_void,_emscripten_fs_load_embedded_files:__emscripten_fs_load_embedded_files,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_emval_as:__emval_as,_emval_call:__emval_call,_emval_call_method:__emval_call_method,_emval_decref:__emval_decref,_emval_get_global:__emval_get_global,_emval_get_method_caller:__emval_get_method_caller,_emval_get_module_property:__emval_get_module_property,_emval_get_property:__emval_get_property,_emval_incref:__emval_incref,_emval_new_cstring:__emval_new_cstring,_emval_run_destructors:__emval_run_destructors,_emval_set_property:__emval_set_property,_emval_take_value:__emval_take_value,_gmtime_js:__gmtime_js,_localtime_js:__localtime_js,_mktime_js:__mktime_js,_mmap_js:__mmap_js,_munmap_js:__munmap_js,_setitimer_js:__setitimer_js,_timegm_js:__timegm_js,_tzset_js:__tzset_js,clock_time_get:_clock_time_get,emscripten_asm_const_int:_emscripten_asm_const_int,emscripten_date_now:_emscripten_date_now,emscripten_get_heap_max:_emscripten_get_heap_max,emscripten_get_now:_emscripten_get_now,emscripten_resize_heap:_emscripten_resize_heap,emscripten_run_script:_emscripten_run_script,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,exit:_exit,fd_close:_fd_close,fd_read:_fd_read,fd_seek:_fd_seek,fd_write:_fd_write,proc_exit:_proc_exit,strptime:_strptime};var wasmExports;createWasm();var ___wasm_call_ctors=createExportWrapper("__wasm_call_ctors",0);var _malloc=createExportWrapper("malloc",1);var ___cxa_free_exception=createExportWrapper("__cxa_free_exception",1);var _main=Module["_main"]=createExportWrapper("__main_argc_argv",2);var _aux_freeMemory=Module["_aux_freeMemory"]=createExportWrapper("aux_freeMemory",1);var _free=createExportWrapper("free",1);var _aux_allocMemory=Module["_aux_allocMemory"]=createExportWrapper("aux_allocMemory",1);var _setCode1DChecksum=Module["_setCode1DChecksum"]=createExportWrapper("setCode1DChecksum",3);var _iinf_BKReturnBkClb1=Module["_iinf_BKReturnBkClb1"]=createExportWrapper("iinf_BKReturnBkClb1",0);var _iinf_BKReturnBkClb2=Module["_iinf_BKReturnBkClb2"]=createExportWrapper("iinf_BKReturnBkClb2",0);var _iinf_BKReturnBkClb3=Module["_iinf_BKReturnBkClb3"]=createExportWrapper("iinf_BKReturnBkClb3",0);var _iinf_setCachedProp=Module["_iinf_setCachedProp"]=createExportWrapper("iinf_setCachedProp",2);var _iinf_getCachedProp=Module["_iinf_getCachedProp"]=createExportWrapper("iinf_getCachedProp",1);var _initialize=Module["_initialize"]=createExportWrapper("initialize",1);var _cfg_BKSetCustomOptionGlobal=Module["_cfg_BKSetCustomOptionGlobal"]=createExportWrapper("cfg_BKSetCustomOptionGlobal",2);var _inf_BKgetVersion=Module["_inf_BKgetVersion"]=createExportWrapper("inf_BKgetVersion",0);var _cfg_BKSetRegionOfInterest=Module["_cfg_BKSetRegionOfInterest"]=createExportWrapper("cfg_BKSetRegionOfInterest",4);var _cfg_BKGetRegionOfInterest=Module["_cfg_BKGetRegionOfInterest"]=createExportWrapper("cfg_BKGetRegionOfInterest",0);var _cfg_BKSetDecodingSpeed=Module["_cfg_BKSetDecodingSpeed"]=createExportWrapper("cfg_BKSetDecodingSpeed",1);var _cfg_BKSetEnabledDecoders=Module["_cfg_BKSetEnabledDecoders"]=createExportWrapper("cfg_BKSetEnabledDecoders",2);var _cfg_BKSetEnabledDecodersPro=Module["_cfg_BKSetEnabledDecodersPro"]=createExportWrapper("cfg_BKSetEnabledDecodersPro",1);var _cfg_BKSetUpcEanDeblur=Module["_cfg_BKSetUpcEanDeblur"]=createExportWrapper("cfg_BKSetUpcEanDeblur",1);var _cfg_BKSetLengthRange=Module["_cfg_BKSetLengthRange"]=createExportWrapper("cfg_BKSetLengthRange",3);var _cfg_BKSetCustomOption=Module["_cfg_BKSetCustomOption"]=createExportWrapper("cfg_BKSetCustomOption",2);var _cfg_BKSetSpecificConfig=Module["_cfg_BKSetSpecificConfig"]=createExportWrapper("cfg_BKSetSpecificConfig",3);var _cfg_BKSetFormatting=Module["_cfg_BKSetFormatting"]=createExportWrapper("cfg_BKSetFormatting",1);var _cfg_BKSetDuplicatesDelayMs=Module["_cfg_BKSetDuplicatesDelayMs"]=createExportWrapper("cfg_BKSetDuplicatesDelayMs",1);var _cfg_BKSetEncodingCharacterSet=Module["_cfg_BKSetEncodingCharacterSet"]=createExportWrapper("cfg_BKSetEncodingCharacterSet",1);var _cfg_BKSetMulticodeCachingEnabled=Module["_cfg_BKSetMulticodeCachingEnabled"]=createExportWrapper("cfg_BKSetMulticodeCachingEnabled",1);var _cfg_BKSetMulticodeCachingDuration=Module["_cfg_BKSetMulticodeCachingDuration"]=createExportWrapper("cfg_BKSetMulticodeCachingDuration",1);var _cfg_BKSetMaximumResultsCount=Module["_cfg_BKSetMaximumResultsCount"]=createExportWrapper("cfg_BKSetMaximumResultsCount",1);var _cfg_BKSetEnableMisshaped1D=Module["_cfg_BKSetEnableMisshaped1D"]=createExportWrapper("cfg_BKSetEnableMisshaped1D",1);var _cfg_BKSetEnableVINRestrictions=Module["_cfg_BKSetEnableVINRestrictions"]=createExportWrapper("cfg_BKSetEnableVINRestrictions",1);var _cfg_BKSetEnableComposite=Module["_cfg_BKSetEnableComposite"]=createExportWrapper("cfg_BKSetEnableComposite",1);var _cfg_BKReturnDecodingSpeed=Module["_cfg_BKReturnDecodingSpeed"]=createExportWrapper("cfg_BKReturnDecodingSpeed",0);var _cfg_BKReturnUpcEanDeblur=Module["_cfg_BKReturnUpcEanDeblur"]=createExportWrapper("cfg_BKReturnUpcEanDeblur",0);var _cfg_BKReturnFormatting=Module["_cfg_BKReturnFormatting"]=createExportWrapper("cfg_BKReturnFormatting",0);var _cfg_BKReturnDuplicatesDelayMs=Module["_cfg_BKReturnDuplicatesDelayMs"]=createExportWrapper("cfg_BKReturnDuplicatesDelayMs",0);var _cfg_BKReturnEncodingCharacterSet=Module["_cfg_BKReturnEncodingCharacterSet"]=createExportWrapper("cfg_BKReturnEncodingCharacterSet",0);var _cfg_BKReturnSpecificConfig=Module["_cfg_BKReturnSpecificConfig"]=createExportWrapper("cfg_BKReturnSpecificConfig",2);var _cfg_BKReturnBarcodeTypeEnabled=Module["_cfg_BKReturnBarcodeTypeEnabled"]=createExportWrapper("cfg_BKReturnBarcodeTypeEnabled",1);var _cfg_BKSetBarcodeTypeEnabled=Module["_cfg_BKSetBarcodeTypeEnabled"]=createExportWrapper("cfg_BKSetBarcodeTypeEnabled",2);var _cfg_BKReturnLengthRange=Module["_cfg_BKReturnLengthRange"]=createExportWrapper("cfg_BKReturnLengthRange",1);var _cfg_BKReturnMulticodeCachingEnabled=Module["_cfg_BKReturnMulticodeCachingEnabled"]=createExportWrapper("cfg_BKReturnMulticodeCachingEnabled",0);var _cfg_BKReturnMulticodeCachingDuration=Module["_cfg_BKReturnMulticodeCachingDuration"]=createExportWrapper("cfg_BKReturnMulticodeCachingDuration",0);var _cfg_BKGetMaximumResultsCount=Module["_cfg_BKGetMaximumResultsCount"]=createExportWrapper("cfg_BKGetMaximumResultsCount",0);var _cfg_BKReturnEnableMisshaped1D=Module["_cfg_BKReturnEnableMisshaped1D"]=createExportWrapper("cfg_BKReturnEnableMisshaped1D",0);var _cfg_BKReturnEnableVINRestrictions=Module["_cfg_BKReturnEnableVINRestrictions"]=createExportWrapper("cfg_BKReturnEnableVINRestrictions",0);var _cfg_BKReturnEnableComposite=Module["_cfg_BKReturnEnableComposite"]=createExportWrapper("cfg_BKReturnEnableComposite",0);var _api_BKDecodeImageMemory=Module["_api_BKDecodeImageMemory"]=createExportWrapper("api_BKDecodeImageMemory",4);var _fflush=createExportWrapper("fflush",1);var _strerror=createExportWrapper("strerror",1);var ___getTypeName=createExportWrapper("__getTypeName",1);var _emscripten_builtin_memalign=createExportWrapper("emscripten_builtin_memalign",2);var __emscripten_timeout=createExportWrapper("_emscripten_timeout",2);var _setThrew=createExportWrapper("setThrew",2);var _emscripten_stack_init=()=>(_emscripten_stack_init=wasmExports["emscripten_stack_init"])();var _emscripten_stack_get_free=()=>(_emscripten_stack_get_free=wasmExports["emscripten_stack_get_free"])();var _emscripten_stack_get_base=()=>(_emscripten_stack_get_base=wasmExports["emscripten_stack_get_base"])();var _emscripten_stack_get_end=()=>(_emscripten_stack_get_end=wasmExports["emscripten_stack_get_end"])();var __emscripten_stack_restore=a0=>(__emscripten_stack_restore=wasmExports["_emscripten_stack_restore"])(a0);var __emscripten_stack_alloc=a0=>(__emscripten_stack_alloc=wasmExports["_emscripten_stack_alloc"])(a0);var _emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports["emscripten_stack_get_current"])();var ___cxa_decrement_exception_refcount=createExportWrapper("__cxa_decrement_exception_refcount",1);var ___cxa_increment_exception_refcount=createExportWrapper("__cxa_increment_exception_refcount",1);var ___get_exception_message=createExportWrapper("__get_exception_message",3);var ___cxa_can_catch=createExportWrapper("__cxa_can_catch",3);var ___cxa_get_exception_ptr=createExportWrapper("__cxa_get_exception_ptr",1);var ___emscripten_embedded_file_data=Module["___emscripten_embedded_file_data"]=3634424;Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["FS_createPreloadedFile"]=FS_createPreloadedFile;Module["FS_unlink"]=FS_unlink;Module["FS_createPath"]=FS_createPath;Module["FS_createDevice"]=FS_createDevice;Module["FS_createDataFile"]=FS_createDataFile;Module["FS_createLazyFile"]=FS_createLazyFile;var missingLibrarySymbols=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","setTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","runMainThreadEmAsm","listenOnce","autoResumeAudioContext","getDynCaller","dynCall","runtimeKeepalivePush","runtimeKeepalivePop","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","findMatchingCatch","Browser_asyncPrepareDataCounter","getSocketFromFD","getSocketAddress","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace","getFunctionArgsName","createJsInvokerSignature","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","enumReadValueFromPointer","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","throwInstanceAlreadyDeleted","flushPendingDeletes","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName"];missingLibrarySymbols.forEach(missingLibrarySymbol);var unexportedSymbols=["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","out","err","callMain","abort","wasmMemory","wasmExports","writeStackCookie","checkStackCookie","INT53_MAX","INT53_MIN","bigintToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","readEmAsmArgs","runEmAsmFunction","jstoi_q","jstoi_s","getExecutableName","handleException","keepRuntimeAlive","callUserCallback","maybeExit","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","checkWasiClock","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","getExceptionMessageCommon","incrementExceptionRefcount","decrementExceptionRefcount","getExceptionMessage","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","arraySum","addDays","SYSCALLS","preloadPlugins","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_readFile","FS","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr","InternalError","BindingError","throwInternalError","throwBindingError","registeredTypes","awaitingDependencies","typeDependencies","tupleRegistrations","structRegistrations","sharedRegisterType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","getFunctionName","heap32VectorToArray","requireRegisteredType","usesDestructorStack","checkArgCount","getRequiredArgCount","createJsInvoker","UnboundTypeError","PureVirtualError","GenericWireTypeSize","EmValType","EmValOptionalType","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","registeredPointers","registerType","integerReadValueFromPointer","floatReadValueFromPointer","readPointer","runDestructors","newFunc","craftInvokerFunction","embind__requireFunction","finalizationRegistry","detachFinalizer_deps","deletionQueue","delayFunction","emval_freelist","emval_handles","emval_symbols","init_emval","count_emval_handles","getStringOrSymbol","Emval","emval_get_global","emval_returnValue","emval_lookupTypes","emval_methodCallers","emval_addMethodCaller","reflectConstruct"];unexportedSymbols.forEach(unexportedRuntimeSymbol);var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args=[]){assert(runDependencies==0,'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(arg=>{HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function stackCheckInit(){_emscripten_stack_init();writeStackCookie()}function run(args=arguments_){if(runDependencies>0){return}stackCheckInit();preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();Module["onRuntimeInitialized"]?.();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}checkStackCookie()}function checkUnflushedContent(){var oldOut=out;var oldErr=err;var has=false;out=err=x=>{has=true};try{_fflush(0);["stdout","stderr"].forEach(name=>{var info=FS.analyzePath("/dev/"+name);if(!info)return;var stream=info.object;var rdev=stream.rdev;var tty=TTY.ttys[rdev];if(tty?.output?.length){has=true}})}catch(e){}out=oldOut;err=oldErr;if(has){warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run();}else{}})(incomingModule);}
|
|
339
|
+
const basePath=new URL("./",window.location.href).href;return new URL(path,basePath).href;}},instantiateWasm:function(imports,successCallback){WebAssembly.instantiate(receivedWasmModule,imports).then((instance)=>{successCallback(instance,receivedWasmModule);}).catch((err)=>console.error("Wasm Instantiation Error:",err));return{};},version:"1.7.1",print:function(text){Common.debugMessage("Module",text,1);}};}
|
|
340
|
+
function runGlue(incomingModule){(function(Module){let has_SIMD=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));if(has_SIMD){var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){if(typeof process=="undefined"||!process.release||process.release.name!=="node")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var nodeVersion=process.versions.node;var numericVersion=nodeVersion.split(".").slice(0,3);numericVersion=numericVersion[0]*1e4+numericVersion[1]*100+numericVersion[2].split("-")[0]*1;if(numericVersion<16e4){throw new Error("This emscripten-generated code requires node v16.0.0 (detected v"+nodeVersion+")")}var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);assert(Buffer.isBuffer(ret));return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");assert(binary?Buffer.isBuffer(ret):typeof ret=="string");return ret};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_SHELL){if(typeof process=="object"&&typeof require==="function"||typeof window=="object"||typeof WorkerGlobalScope!="undefined")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}if(!(typeof window=="object"||typeof WorkerGlobalScope!="undefined"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{throw new Error("environment detection error")}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;checkIncomingModuleAPI();if(Module["arguments"])arguments_=Module["arguments"];legacyModuleProp("arguments","arguments_");if(Module["thisProgram"])thisProgram=Module["thisProgram"];legacyModuleProp("thisProgram","thisProgram");assert(typeof Module["memoryInitializerPrefixURL"]=="undefined","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["pthreadMainPrefixURL"]=="undefined","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["cdInitializerPrefixURL"]=="undefined","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["filePackagePrefixURL"]=="undefined","Module.filePackagePrefixURL option was removed, use Module.locateFile instead");assert(typeof Module["read"]=="undefined","Module.read option was removed");assert(typeof Module["readAsync"]=="undefined","Module.readAsync option was removed (modify readAsync in JS)");assert(typeof Module["readBinary"]=="undefined","Module.readBinary option was removed (modify readBinary in JS)");assert(typeof Module["setWindowTitle"]=="undefined","Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)");assert(typeof Module["TOTAL_MEMORY"]=="undefined","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");legacyModuleProp("asm","wasmExports");legacyModuleProp("readAsync","readAsync");legacyModuleProp("readBinary","readBinary");legacyModuleProp("setWindowTitle","setWindowTitle");assert(!ENVIRONMENT_IS_SHELL,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var wasmBinary=Module["wasmBinary"];legacyModuleProp("wasmBinary","wasmBinary");if(typeof WebAssembly!="object"){err("no native wasm support detected")}function intArrayFromBase64(s){if(typeof ENVIRONMENT_IS_NODE!="undefined"&&ENVIRONMENT_IS_NODE){var buf=Buffer.from(s,"base64");return new Uint8Array(buf.buffer,buf.byteOffset,buf.length)}var decoded=atob(s);var bytes=new Uint8Array(decoded.length);for(var i=0;i<decoded.length;++i){bytes[i]=decoded.charCodeAt(i)}return bytes}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort("Assertion failed"+(text?": "+text:""))}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}assert(!Module["STACK_SIZE"],"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time");assert(typeof Int32Array!="undefined"&&typeof Float64Array!=="undefined"&&Int32Array.prototype.subarray!=undefined&&Int32Array.prototype.set!=undefined,"JS engine does not provide full typed array support");assert(!Module["wasmMemory"],"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally");assert(!Module["INITIAL_MEMORY"],"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");function writeStackCookie(){var max=_emscripten_stack_get_end();assert((max&3)==0);if(max==0){max+=4}HEAPU32[max>>2]=34821223;HEAPU32[max+4>>2]=2310721022;HEAPU32[0>>2]=1668509029}function checkStackCookie(){if(ABORT)return;var max=_emscripten_stack_get_end();if(max==0){max+=4}var cookie1=HEAPU32[max>>2];var cookie2=HEAPU32[max+4>>2];if(cookie1!=34821223||cookie2!=2310721022){abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`)}if(HEAPU32[0>>2]!=1668509029){abort("Runtime error: The application has corrupted its heap memory area (address zero)!")}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){assert(!runtimeInitialized);runtimeInitialized=true;checkStackCookie();if(!Module["noFSInit"]&&!FS.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}assert(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");assert(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var runDependencies=0;var dependenciesFulfilled=null;var runDependencyTracking={};var runDependencyWatcher=null;function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies);if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!="undefined"){runDependencyWatcher=setInterval(()=>{if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;err("still waiting on run dependencies:")}err(`dependency: ${dep}`)}if(shown){err("(end of list)")}},1e4)}}else{err("warning: run dependency added without ID")}}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{err("warning: run dependency removed without ID")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function createExportWrapper(name,nargs){return(...args)=>{assert(runtimeInitialized,`native function \`${name}\` called before runtime initialization`);var f=wasmExports[name];assert(f,`exported native function \`${name}\` not found`);assert(args.length<=nargs,`native function \`${name}\` called with ${args.length} args but expects ${nargs}`);return f(...args)}}class EmscriptenEH extends Error{}class EmscriptenSjLj extends EmscriptenEH{}class CppException extends EmscriptenEH{constructor(excPtr){super(excPtr);this.excPtr=excPtr;const excInfo=getExceptionMessage(excPtr);this.name=excInfo[0];this.message=excInfo[1]}}function findWasmBinary(){var f="barkoder.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);if(isFileURI(wasmBinaryFile)){err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`)}abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["memory"];assert(wasmMemory,"memory not found in wasm exports");updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];assert(wasmTable,"table not found in wasm exports");addOnInit(wasmExports["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");var trueModule=Module;function receiveInstantiationResult(result){assert(Module===trueModule,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");trueModule=null;receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false}}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);receiveInstantiationResult(result);return result}(()=>{var h16=new Int16Array(1);var h8=new Int8Array(h16.buffer);h16[0]=25459;if(h8[0]!==115||h8[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();if(Module["ENVIRONMENT"]){throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)")}function legacyModuleProp(prop,newName,incoming=true){if(!Object.getOwnPropertyDescriptor(Module,prop)){Object.defineProperty(Module,prop,{configurable:true,get(){let extra=incoming?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":"";abort(`\`Module.${prop}\` has been replaced by \`${newName}\``+extra)}})}}function ignoredModuleProp(prop){if(Object.getOwnPropertyDescriptor(Module,prop)){abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`)}}function isExportedByForceFilesystem(name){return name==="FS_createPath"||name==="FS_createDataFile"||name==="FS_createPreloadedFile"||name==="FS_unlink"||name==="addRunDependency"||name==="FS_createLazyFile"||name==="FS_createDevice"||name==="removeRunDependency"}function hookGlobalSymbolAccess(sym,func){if(typeof globalThis!="undefined"&&!Object.getOwnPropertyDescriptor(globalThis,sym)){Object.defineProperty(globalThis,sym,{configurable:true,get(){func();return undefined}})}}function missingGlobal(sym,msg){hookGlobalSymbolAccess(sym,()=>{warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`)})}missingGlobal("buffer","Please use HEAP8.buffer or wasmMemory.buffer");missingGlobal("asm","Please use wasmExports instead");function missingLibrarySymbol(sym){hookGlobalSymbolAccess(sym,()=>{var msg=`\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;var librarySymbol=sym;if(!librarySymbol.startsWith("_")){librarySymbol="$"+sym}msg+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;if(isExportedByForceFilesystem(sym)){msg+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"}warnOnce(msg)});unexportedRuntimeSymbol(sym)}function unexportedRuntimeSymbol(sym){if(!Object.getOwnPropertyDescriptor(Module,sym)){Object.defineProperty(Module,sym,{configurable:true,get(){var msg=`'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;if(isExportedByForceFilesystem(sym)){msg+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"}abort(msg)}})}}var ASM_CONSTS={4295952:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},4296007:($0,$1)=>{localStorage[UTF8ToString($0)]=UTF8ToString($1)},4296062:()=>ENVIRONMENT_IS_WORKER?1:0,4296104:($0,$1,$2,$3,$4)=>{if(typeof Module=="undefined"||!Module.MountedFiles){return 1}let fileName=UTF8ToString(Number($0>>>0));if(fileName.startsWith("./")){fileName=fileName.substring(2)}const fileData=Module.MountedFiles.get(fileName);if(!fileData){return 2}const offset=Number($1>>>0);const length=Number($2>>>0);const dataIdOrBuffer=Number($3>>>0);const loadType=$4;if(offset+length>fileData.byteLength){return 3}try{const data=fileData.subarray(offset,offset+length);switch(loadType){case 0:HEAPU8.set(data,dataIdOrBuffer);break;case 1:Module.jsepUploadExternalBuffer(dataIdOrBuffer,data);break;default:return 4}return 0}catch{return 4}}};class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var ptrToString=ptr=>{assert(typeof ptr==="number");ptr>>>=0;return"0x"+ptr.toString(16).padStart(8,"0")};var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var warnOnce=text=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{if((u0&248)!=240)warnOnce("Invalid UTF-8 leading byte "+ptrToString(u0)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!");u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>{assert(typeof ptr=="number",`UTF8ToString expects a number (got ${typeof ptr})`);return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""};var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=new CppException(ptr);uncaughtExceptionCount++;throw exceptionLast};var ___cxa_uncaught_exceptions=()=>uncaughtExceptionCount;var syscallGetVarargI=()=>{assert(SYSCALLS.varargs!=undefined);var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{assert(typeof str==="string",`stringToUTF8Array expects a string (got ${typeof str})`);if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>1114111)warnOnce("Invalid Unicode code point "+ptrToString(u)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var zeroMemory=(address,size)=>{HEAPU8.fill(0,address,address+size)};var alignMemory=(size,alignment)=>{assert(alignment,"alignment argument is required");return Math.ceil(size/alignment)*alignment};var mmapAlloc=size=>{size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(ptr)zeroMemory(ptr,size);return ptr};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw new FS.ErrnoError(44)},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write(stream,buffer,offset,length,position,canOwn){assert(!(buffer instanceof ArrayBuffer));if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){assert(position===0,"canOwn must imply no weird position inside the file");node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},allocate(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url).then(processData,onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var strError=errno=>UTF8ToString(_strerror(errno));var ERRNO_CODES={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class extends Error{name="ErrnoError";constructor(errno){super(runtimeInitialized?strError(errno):"");this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break}}}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}},lookupPath(path,opts={}){if(!path)return{path:"",node:null};opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p&&p!==".");var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}if(parts[i]===".."){current_path=PATH.dirname(current_path);current=current.parent;continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){assert(typeof parent=="object");var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){assert(fd>=-1);stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){if(typeof type=="string"){throw type}var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};var parent=FS.lookupPath(path,{follow:true}).node;if(parent?.node_ops.statfs){Object.assign(rtn,parent.node_ops.statfs(parent.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return link.node_ops.readlink(link)},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat(path){return FS.stat(path,true)},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,ctime:Date.now()})},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.chmod(stream.node,mode)},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.chown(stream.node,uid,gid)},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{atime,mtime})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){assert(offset>=0);if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){assert(offset>=0);if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate(stream,offset,length){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){assert(offset>=0);if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error(`Invalid encoding type "${opts.encoding}"`)}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1);assert(stdin.fd===0,`invalid handle for stdin (${stdin.fd})`);assert(stdout.fd===1,`invalid handle for stdout (${stdout.fd})`);assert(stderr.fd===2,`invalid handle for stderr (${stderr.fd})`)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){assert(!FS.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;_fflush(0);for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node},absolutePath(){abort("FS.absolutePath has been removed; use PATH_FS.resolve instead")},createFolder(){abort("FS.createFolder has been removed; use FS.mkdir instead")},createLink(){abort("FS.createLink has been removed; use FS.symlink instead")},joinPath(){abort("FS.joinPath has been removed; use PATH.join instead")},mmapAlloc(){abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc")},standardizePath(){abort("FS.standardizePath has been removed; use PATH.normalize instead")}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},doStat(func,path,buf){var stat=func(path);HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>{assert(typeof maxBytesToWrite=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)};function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_getdents64(fd,dirp,count){try{var stream=SYSCALLS.getStreamFromFD(fd);stream.getdents||=FS.readdir(stream.path);var struct_size=280;var pos=0;var off=FS.llseek(stream,0,1);var startIdx=Math.floor(off/struct_size);var endIdx=Math.min(stream.getdents.length,startIdx+Math.floor(count/struct_size));for(var idx=startIdx;idx<endIdx;idx++){var id;var type;var name=stream.getdents[idx];if(name==="."){id=stream.node.id;type=4}else if(name===".."){var lookup=FS.lookupPath(stream.path,{parent:true});id=lookup.node.id;type=4}else{var child;try{child=FS.lookupNode(stream.node,name)}catch(e){if(e?.errno===28){continue}throw e}id=child.id;type=FS.isChrdev(child.mode)?2:FS.isDir(child.mode)?4:FS.isLink(child.mode)?10:8}assert(id);HEAP64[dirp+pos>>3]=BigInt(id);HEAP64[dirp+pos+8>>3]=BigInt((idx+1)*struct_size);HEAP16[dirp+pos+16>>1]=280;HEAP8[dirp+pos+18]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size}FS.llseek(stream,idx*struct_size,0);return pos}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;assert(!flags,`unknown flags in __syscall_newfstatat: ${flags}`);path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_readlinkat(dirfd,path,buf,bufsize){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(bufsize<=0)return-28;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>abort("native code called abort()");var embindRepr=v=>{if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes};var embind_charCodes;var readLatin1String=ptr=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError;var throwBindingError=message=>{throw new BindingError(message)};var InternalError;var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach((dt,i)=>{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){if(registeredInstance.argPackAdvance===undefined){throw new TypeError("registerType registeredInstance requires argPackAdvance")}return sharedRegisterType(rawType,registeredInstance,options)}var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];case 8:return signed?pointer=>HEAP64[pointer>>3]:pointer=>HEAPU64[pointer>>3];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);var isUnsignedType=name.indexOf("u")!=-1;if(isUnsignedType){maxRange=(1n<<64n)-1n}registerType(primitiveType,{name,fromWireType:value=>value,toWireType:function(destructors,value){if(typeof value!="bigint"&&typeof value!="number"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${this.name}`)}if(typeof value=="number"){value=BigInt(value)}if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`)}return value},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null})};var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function(pointer){return this["fromWireType"](HEAPU8[pointer])},destructorFunction:null})};var emval_freelist=[];var emval_handles=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){assert(emval_handles[handle]!==undefined,`Decref for unallocated handle.`);emval_handles[handle]=undefined;emval_freelist.push(handle)}};var count_emval_handles=()=>emval_handles.length/2-5-emval_freelist.length;var init_emval=()=>{emval_handles.push(0,1,undefined,1,null,1,true,1,false,1);assert(emval_handles.length===5*2);Module["count_emval_handles"]=count_emval_handles};var Emval={toValue:handle=>{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}assert(handle===2||emval_handles[handle]!==undefined&&handle%2===0,`invalid handle: ${handle}`);return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var EmValType={name:"emscripten::val",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert ${embindRepr(value)} to ${this.name}`)}return value},argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var createNamedFunction=(name,body)=>Object.defineProperty(body,"name",{value:name});var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true}}return false}function newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(`new_ called with constructor type ${typeof constructor} which is not a function`)}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function checkArgCount(numArgs,minArgs,maxArgs,humanName,throwBindingError){if(numArgs<minArgs||numArgs>maxArgs){var argCountMessage=minArgs==maxArgs?minArgs:`${minArgs} to ${maxArgs}`;throwBindingError(`function ${humanName} called with ${numArgs} arguments, expected ${argCountMessage}`)}}function createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired")}for(var i=0;i<argCount;++i){argsList.push(`arg${i}`);argsListWired.push(`arg${i}Wired`)}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody=`return function (${argsList}) {\n`;invokerFnBody+="checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);\n";if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+=`var thisWired = classParam['toWireType'](${dtorStack}, this);\n`}for(var i=0;i<argCount;++i){invokerFnBody+=`var arg${i}Wired = argType${i}['toWireType'](${dtorStack}, arg${i});\n`;args1.push(`argType${i}`)}invokerFnBody+=(returns||isAsync?"var rv = ":"")+`invoker(${argsListWired});\n`;if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=`${paramName}_dtor(${paramName});\n`;args1.push(`${paramName}_dtor`)}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\n"+"return ret;\n"}else{}invokerFnBody+="}\n";args1.push("checkArgCount","minArgs","maxArgs");invokerFnBody=`if (arguments.length !== ${args1.length}){ throw new Error(humanName + "Expected ${args1.length} closure arguments " + arguments.length + " given."); }\n${invokerFnBody}`;return[args1,invokerFnBody]}function getRequiredArgCount(argTypes){var requiredArgCount=argTypes.length-2;for(var i=argTypes.length-1;i>=2;--i){if(!argTypes[i].optional){break}requiredArgCount--}return requiredArgCount}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}assert(!isAsync,"Async bindings are only supported with JSPI.");var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var expectedArgCount=argCount-2;var minArgs=getRequiredArgCount(argTypes);var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2])}if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction)}}}closureArgs.push(checkArgCount,minArgs,expectedArgCount);let[args,invokerFnBody]=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync);args.push(invokerFnBody);var invokerFn=newFunc(Function,args)(...closureArgs);return createNamedFunction(humanName,invokerFn)}var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2])}return array};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var wasmTableMirror=[];var wasmTable;var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}assert(wasmTable.get(funcPtr)==func,"JavaScript-side Wasm function table mirror is out of date!");return func};var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return`${this.name}: ${this.message}`}};return errorClass};var UnboundTypeError;var getTypeName=type=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex!==-1){assert(signature[signature.length-1]==")","Parentheses for argument names should match.");return signature.substr(0,argsIndex)}else{return signature}};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<<bitshift>>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{if(typeof value!="number"&&typeof value!="boolean"){throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${toTypeName}`)}if(value<minRange||value>maxRange){throw new TypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`)}};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name,fromWireType,toWireType,argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=true;registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[payload+i])}str=a.join("")}_free(value);return str},toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value)}else{length=value.length}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i]}}}if(destructors!==null){destructors.push(_free,base)}return base},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead)=>{assert(ptr%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!");assert(typeof maxBytesToWrite=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");maxBytesToWrite??=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{assert(ptr%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{assert(outPtr%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!");assert(typeof maxBytesToWrite=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");maxBytesToWrite??=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=pointer=>HEAPU16[pointer>>1]}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=pointer=>HEAPU32[pointer>>2]}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name,argPackAdvance:0,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var __emscripten_fs_load_embedded_files=ptr=>{do{var name_addr=HEAPU32[ptr>>2];ptr+=4;var len=HEAPU32[ptr>>2];ptr+=4;var content=HEAPU32[ptr>>2];ptr+=4;var name=UTF8ToString(name_addr);FS.createPath("/",PATH.dirname(name),true,true);FS.createDataFile(name,null,HEAP8.subarray(content,content+len),true,true,true)}while(HEAPU32[ptr>>2])};var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`)}return impl};var emval_returnValue=(returnType,destructorsRef,handle)=>{var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors)}return result};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle)};var emval_methodCallers=[];var __emval_call=(caller,handle,destructorsRef,args)=>{caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args)};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol};var __emval_call_method=(caller,objHandle,methodName,destructorsRef,args)=>{caller=emval_methodCallers[caller];objHandle=Emval.toValue(objHandle);methodName=getStringOrSymbol(methodName);return caller(objHandle,objHandle[methodName],destructorsRef,args)};var emval_get_global=()=>{if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()};var __emval_get_global=name=>{if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}};var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter "+i)}return a};var reflectConstruct=Reflect.construct;var __emval_get_method_caller=(argCount,argTypes,kind)=>{var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody=`return function (obj, func, destructorsRef, args) {\n`;var offset=0;var argsList=[];if(kind===0){argsList.push("obj")}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg"+i);params.push("argType"+i);args.push(types[i]);functionBody+=` var arg${i} = argType${i}.readValueFromPointer(args${offset?"+"+offset:""});\n`;offset+=types[i].argPackAdvance}var invoker=kind===1?"new func":"func.call";functionBody+=` var rv = ${invoker}(${argsList.join(", ")});\n`;if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n"}functionBody+="};\n";params.push(functionBody);var invokerFunction=newFunc(Function,params)(...args);var functionName=`methodCaller<(${types.map(t=>t.name).join(", ")}) => ${retType.name}>`;return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction))};var __emval_get_module_property=name=>{name=getStringOrSymbol(name);return Emval.toHandle(Module[name])};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>9){emval_handles[handle+1]+=1}};var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value};var __emval_take_value=(type,arg)=>{type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)};var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function __gmtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};function __localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1}return timeMs/1e3})();return BigInt(ret)};function __mmap_js(len,prot,flags,fd,offset,allocated,addr){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);var res=FS.mmap(stream,len,offset,prot,flags);var ptr=res.ptr;HEAP32[allocated>>2]=res.allocated;HEAPU32[addr>>2]=ptr;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function __munmap_js(addr,len,prot,flags,fd,offset){offset=bigintToI53Checked(offset);try{var stream=SYSCALLS.getStreamFromFD(fd);if(prot&2){SYSCALLS.doMsync(addr,stream,len,flags,offset)}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}checkStackCookie();if(e instanceof WebAssembly.RuntimeError){if(_emscripten_stack_get_current()<=0){err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 5242880)")}}quit_(1,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;checkUnflushedContent();if(keepRuntimeAlive()&&!implicit){var msg=`program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;err(msg)}_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){err("user callback triggered after runtime exited or application aborted. Ignoring.");return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{assert(which in timers);delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var __timegm_js=function(tmPtr){var ret=(()=>{var time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var date=new Date(time);HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3})();return BigInt(ret)};var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);assert(winterName);assert(summerName);assert(lengthBytesUTF8(winterName)<=16,`timezone name truncated to fit in TZNAME_MAX (${winterName})`);assert(lengthBytesUTF8(summerName)<=16,`timezone name truncated to fit in TZNAME_MAX (${summerName})`);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{assert(Array.isArray(readEmAsmArgsArray));assert(buf%16==0);readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var chr=String.fromCharCode(ch);var validChars=["d","f","i","p"];validChars.push("j");assert(validChars.includes(chr),`Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);assert(ASM_CONSTS.hasOwnProperty(code),`No EM_ASM constant found at address ${code}. The loaded WebAssembly file is likely out of sync with the generated JavaScript.`);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`)}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;assert(requestedSize>oldSize);var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);return false};var _emscripten_run_script=ptr=>{eval(UTF8ToString(ptr))};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){assert(str.charCodeAt(i)===(str.charCodeAt(i)&255));HEAP8[buffer++]=str.charCodeAt(i)}HEAP8[buffer]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum};var MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];var addDays=(date,days)=>{var newDate=new Date(date.getTime());while(days>0){var leap=isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var jstoi_q=str=>parseInt(str);var _strptime=(buf,format,tm)=>{var pattern=UTF8ToString(format);var SPECIAL_CHARS="\\!@#$^&*()+=-[]/{}|:<>?,.";for(var i=0,ii=SPECIAL_CHARS.length;i<ii;++i){pattern=pattern.replace(new RegExp("\\"+SPECIAL_CHARS[i],"g"),"\\"+SPECIAL_CHARS[i])}var EQUIVALENT_MATCHERS={A:"%a",B:"%b",c:"%a %b %d %H:%M:%S %Y",D:"%m\\/%d\\/%y",e:"%d",F:"%Y-%m-%d",h:"%b",R:"%H\\:%M",r:"%I\\:%M\\:%S\\s%p",T:"%H\\:%M\\:%S",x:"%m\\/%d\\/(?:%y|%Y)",X:"%H\\:%M\\:%S"};var DATE_PATTERNS={a:"(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)",b:"(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)",C:"\\d\\d",d:"0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31",H:"\\d(?!\\d)|[0,1]\\d|20|21|22|23",I:"\\d(?!\\d)|0\\d|10|11|12",j:"00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d",m:"0[1-9]|[1-9](?!\\d)|10|11|12",M:"0\\d|\\d(?!\\d)|[1-5]\\d",n:" ",p:"AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.",S:"0\\d|\\d(?!\\d)|[1-5]\\d|60",U:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",W:"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53",w:"[0-6]",y:"\\d\\d",Y:"\\d\\d\\d\\d",t:" ",z:"Z|(?:[\\+\\-]\\d\\d:?(?:\\d\\d)?)"};var MONTH_NUMBERS={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11};var DAY_NUMBERS_SUN_FIRST={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};var DAY_NUMBERS_MON_FIRST={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6};var capture=[];var pattern_out=pattern.replace(/%(.)/g,(m,c)=>EQUIVALENT_MATCHERS[c]||m).replace(/%(.)/g,(_,c)=>{let pat=DATE_PATTERNS[c];if(pat){capture.push(c);return`(${pat})`}else{return c}}).replace(/\s+/g,"\\s*");var matches=new RegExp("^"+pattern_out,"i").exec(UTF8ToString(buf));function initDate(){function fixup(value,min,max){return typeof value!="number"||isNaN(value)?min:value>=min?value<=max?value:max:min}return{year:fixup(HEAP32[tm+20>>2]+1900,1970,9999),month:fixup(HEAP32[tm+16>>2],0,11),day:fixup(HEAP32[tm+12>>2],1,31),hour:fixup(HEAP32[tm+8>>2],0,23),min:fixup(HEAP32[tm+4>>2],0,59),sec:fixup(HEAP32[tm>>2],0,59),gmtoff:0}}if(matches){var date=initDate();var value;var getMatch=symbol=>{var pos=capture.indexOf(symbol);if(pos>=0){return matches[pos+1]}return};if(value=getMatch("S")){date.sec=jstoi_q(value)}if(value=getMatch("M")){date.min=jstoi_q(value)}if(value=getMatch("H")){date.hour=jstoi_q(value)}else if(value=getMatch("I")){var hour=jstoi_q(value);if(value=getMatch("p")){hour+=value.toUpperCase()[0]==="P"?12:0}date.hour=hour}if(value=getMatch("Y")){date.year=jstoi_q(value)}else if(value=getMatch("y")){var year=jstoi_q(value);if(value=getMatch("C")){year+=jstoi_q(value)*100}else{year+=year<69?2e3:1900}date.year=year}if(value=getMatch("m")){date.month=jstoi_q(value)-1}else if(value=getMatch("b")){date.month=MONTH_NUMBERS[value.substring(0,3).toUpperCase()]||0}if(value=getMatch("d")){date.day=jstoi_q(value)}else if(value=getMatch("j")){var day=jstoi_q(value);var leapYear=isLeapYear(date.year);for(var month=0;month<12;++month){var daysUntilMonth=arraySum(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,month-1);if(day<=daysUntilMonth+(leapYear?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[month]){date.day=day-daysUntilMonth}}}else if(value=getMatch("a")){var weekDay=value.substring(0,3).toUpperCase();if(value=getMatch("U")){var weekDayNumber=DAY_NUMBERS_SUN_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===0){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}else if(value=getMatch("W")){var weekDayNumber=DAY_NUMBERS_MON_FIRST[weekDay];var weekNumber=jstoi_q(value);var janFirst=new Date(date.year,0,1);var endDate;if(janFirst.getDay()===1){endDate=addDays(janFirst,weekDayNumber+7*(weekNumber-1))}else{endDate=addDays(janFirst,7-janFirst.getDay()+1+weekDayNumber+7*(weekNumber-1))}date.day=endDate.getDate();date.month=endDate.getMonth()}}if(value=getMatch("z")){if(value.toLowerCase()==="z"){date.gmtoff=0}else{var match=value.match(/^((?:\-|\+)\d\d):?(\d\d)?/);date.gmtoff=match[1]*3600;if(match[2]){date.gmtoff+=date.gmtoff>0?match[2]*60:-match[2]*60}}}var fullDate=new Date(date.year,date.month,date.day,date.hour,date.min,date.sec,0);HEAP32[tm>>2]=fullDate.getSeconds();HEAP32[tm+4>>2]=fullDate.getMinutes();HEAP32[tm+8>>2]=fullDate.getHours();HEAP32[tm+12>>2]=fullDate.getDate();HEAP32[tm+16>>2]=fullDate.getMonth();HEAP32[tm+20>>2]=fullDate.getFullYear()-1900;HEAP32[tm+24>>2]=fullDate.getDay();HEAP32[tm+28>>2]=arraySum(isLeapYear(fullDate.getFullYear())?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,fullDate.getMonth()-1)+fullDate.getDate()-1;HEAP32[tm+32>>2]=0;HEAP32[tm+36>>2]=date.gmtoff;return buf+intArrayFromString(matches[0]).length-1}return 0};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func};var writeArrayToMemory=(array,buffer)=>{assert(array.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)");HEAP8.set(array,buffer)};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!=="array",'Return type should not be "array".');if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>(...args)=>ccall(ident,returnType,argTypes,args,opts);var FS_createPath=FS.createPath;var FS_unlink=path=>FS.unlink(path);var FS_createLazyFile=FS.createLazyFile;var FS_createDevice=FS.createDevice;var incrementExceptionRefcount=ptr=>___cxa_increment_exception_refcount(ptr);Module["incrementExceptionRefcount"]=incrementExceptionRefcount;var decrementExceptionRefcount=ptr=>___cxa_decrement_exception_refcount(ptr);Module["decrementExceptionRefcount"]=decrementExceptionRefcount;var getExceptionMessageCommon=ptr=>{var sp=stackSave();var type_addr_addr=stackAlloc(4);var message_addr_addr=stackAlloc(4);___get_exception_message(ptr,type_addr_addr,message_addr_addr);var type_addr=HEAPU32[type_addr_addr>>2];var message_addr=HEAPU32[message_addr_addr>>2];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr)}stackRestore(sp);return[type,message]};var getExceptionMessage=ptr=>getExceptionMessageCommon(ptr);Module["getExceptionMessage"]=getExceptionMessage;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;embind_init_charCodes();BindingError=Module["BindingError"]=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};InternalError=Module["InternalError"]=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");function checkIncomingModuleAPI(){ignoredModuleProp("fetchSettings")}var wasmImports={__assert_fail:___assert_fail,__cxa_throw:___cxa_throw,__cxa_uncaught_exceptions:___cxa_uncaught_exceptions,__syscall_fcntl64:___syscall_fcntl64,__syscall_fstat64:___syscall_fstat64,__syscall_getcwd:___syscall_getcwd,__syscall_getdents64:___syscall_getdents64,__syscall_ioctl:___syscall_ioctl,__syscall_lstat64:___syscall_lstat64,__syscall_mkdirat:___syscall_mkdirat,__syscall_newfstatat:___syscall_newfstatat,__syscall_openat:___syscall_openat,__syscall_readlinkat:___syscall_readlinkat,__syscall_rmdir:___syscall_rmdir,__syscall_stat64:___syscall_stat64,__syscall_unlinkat:___syscall_unlinkat,_abort_js:__abort_js,_embind_register_bigint:__embind_register_bigint,_embind_register_bool:__embind_register_bool,_embind_register_emval:__embind_register_emval,_embind_register_float:__embind_register_float,_embind_register_function:__embind_register_function,_embind_register_integer:__embind_register_integer,_embind_register_memory_view:__embind_register_memory_view,_embind_register_std_string:__embind_register_std_string,_embind_register_std_wstring:__embind_register_std_wstring,_embind_register_void:__embind_register_void,_emscripten_fs_load_embedded_files:__emscripten_fs_load_embedded_files,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_emval_as:__emval_as,_emval_call:__emval_call,_emval_call_method:__emval_call_method,_emval_decref:__emval_decref,_emval_get_global:__emval_get_global,_emval_get_method_caller:__emval_get_method_caller,_emval_get_module_property:__emval_get_module_property,_emval_get_property:__emval_get_property,_emval_incref:__emval_incref,_emval_new_cstring:__emval_new_cstring,_emval_run_destructors:__emval_run_destructors,_emval_set_property:__emval_set_property,_emval_take_value:__emval_take_value,_gmtime_js:__gmtime_js,_localtime_js:__localtime_js,_mktime_js:__mktime_js,_mmap_js:__mmap_js,_munmap_js:__munmap_js,_setitimer_js:__setitimer_js,_timegm_js:__timegm_js,_tzset_js:__tzset_js,clock_time_get:_clock_time_get,emscripten_asm_const_int:_emscripten_asm_const_int,emscripten_date_now:_emscripten_date_now,emscripten_get_heap_max:_emscripten_get_heap_max,emscripten_get_now:_emscripten_get_now,emscripten_resize_heap:_emscripten_resize_heap,emscripten_run_script:_emscripten_run_script,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,exit:_exit,fd_close:_fd_close,fd_read:_fd_read,fd_seek:_fd_seek,fd_write:_fd_write,proc_exit:_proc_exit,strptime:_strptime};var wasmExports;createWasm();var ___wasm_call_ctors=createExportWrapper("__wasm_call_ctors",0);var _malloc=createExportWrapper("malloc",1);var ___cxa_free_exception=createExportWrapper("__cxa_free_exception",1);var _main=Module["_main"]=createExportWrapper("__main_argc_argv",2);var _aux_freeMemory=Module["_aux_freeMemory"]=createExportWrapper("aux_freeMemory",1);var _free=createExportWrapper("free",1);var _aux_allocMemory=Module["_aux_allocMemory"]=createExportWrapper("aux_allocMemory",1);var _setCode1DChecksum=Module["_setCode1DChecksum"]=createExportWrapper("setCode1DChecksum",3);var _iinf_BKReturnBkClb1=Module["_iinf_BKReturnBkClb1"]=createExportWrapper("iinf_BKReturnBkClb1",0);var _iinf_BKReturnBkClb2=Module["_iinf_BKReturnBkClb2"]=createExportWrapper("iinf_BKReturnBkClb2",0);var _iinf_BKReturnBkClb3=Module["_iinf_BKReturnBkClb3"]=createExportWrapper("iinf_BKReturnBkClb3",0);var _iinf_setCachedProp=Module["_iinf_setCachedProp"]=createExportWrapper("iinf_setCachedProp",2);var _iinf_getCachedProp=Module["_iinf_getCachedProp"]=createExportWrapper("iinf_getCachedProp",1);var _initialize=Module["_initialize"]=createExportWrapper("initialize",1);var _cfg_BKSetCustomOptionGlobal=Module["_cfg_BKSetCustomOptionGlobal"]=createExportWrapper("cfg_BKSetCustomOptionGlobal",2);var _inf_BKgetVersion=Module["_inf_BKgetVersion"]=createExportWrapper("inf_BKgetVersion",0);var _cfg_BKSetRegionOfInterest=Module["_cfg_BKSetRegionOfInterest"]=createExportWrapper("cfg_BKSetRegionOfInterest",4);var _cfg_BKGetRegionOfInterest=Module["_cfg_BKGetRegionOfInterest"]=createExportWrapper("cfg_BKGetRegionOfInterest",0);var _cfg_BKSetDecodingSpeed=Module["_cfg_BKSetDecodingSpeed"]=createExportWrapper("cfg_BKSetDecodingSpeed",1);var _cfg_BKSetEnabledDecoders=Module["_cfg_BKSetEnabledDecoders"]=createExportWrapper("cfg_BKSetEnabledDecoders",2);var _cfg_BKSetEnabledDecodersPro=Module["_cfg_BKSetEnabledDecodersPro"]=createExportWrapper("cfg_BKSetEnabledDecodersPro",1);var _cfg_BKSetUpcEanDeblur=Module["_cfg_BKSetUpcEanDeblur"]=createExportWrapper("cfg_BKSetUpcEanDeblur",1);var _cfg_BKSetLengthRange=Module["_cfg_BKSetLengthRange"]=createExportWrapper("cfg_BKSetLengthRange",3);var _cfg_BKSetCustomOption=Module["_cfg_BKSetCustomOption"]=createExportWrapper("cfg_BKSetCustomOption",2);var _cfg_BKSetSpecificConfig=Module["_cfg_BKSetSpecificConfig"]=createExportWrapper("cfg_BKSetSpecificConfig",3);var _cfg_BKSetFormatting=Module["_cfg_BKSetFormatting"]=createExportWrapper("cfg_BKSetFormatting",1);var _cfg_BKSetDuplicatesDelayMs=Module["_cfg_BKSetDuplicatesDelayMs"]=createExportWrapper("cfg_BKSetDuplicatesDelayMs",1);var _cfg_BKSetEncodingCharacterSet=Module["_cfg_BKSetEncodingCharacterSet"]=createExportWrapper("cfg_BKSetEncodingCharacterSet",1);var _cfg_BKSetMulticodeCachingEnabled=Module["_cfg_BKSetMulticodeCachingEnabled"]=createExportWrapper("cfg_BKSetMulticodeCachingEnabled",1);var _cfg_BKSetMulticodeCachingDuration=Module["_cfg_BKSetMulticodeCachingDuration"]=createExportWrapper("cfg_BKSetMulticodeCachingDuration",1);var _cfg_BKSetMaximumResultsCount=Module["_cfg_BKSetMaximumResultsCount"]=createExportWrapper("cfg_BKSetMaximumResultsCount",1);var _cfg_BKSetEnableMisshaped1D=Module["_cfg_BKSetEnableMisshaped1D"]=createExportWrapper("cfg_BKSetEnableMisshaped1D",1);var _cfg_BKSetEnableVINRestrictions=Module["_cfg_BKSetEnableVINRestrictions"]=createExportWrapper("cfg_BKSetEnableVINRestrictions",1);var _cfg_BKSetEnableComposite=Module["_cfg_BKSetEnableComposite"]=createExportWrapper("cfg_BKSetEnableComposite",1);var _cfg_BKSetReturnOnlyMatchedResults=Module["_cfg_BKSetReturnOnlyMatchedResults"]=createExportWrapper("cfg_BKSetReturnOnlyMatchedResults",1);var _cfg_BKSetMatchFilter=Module["_cfg_BKSetMatchFilter"]=createExportWrapper("cfg_BKSetMatchFilter",1);var _cfg_BKReturnDecodingSpeed=Module["_cfg_BKReturnDecodingSpeed"]=createExportWrapper("cfg_BKReturnDecodingSpeed",0);var _cfg_BKReturnUpcEanDeblur=Module["_cfg_BKReturnUpcEanDeblur"]=createExportWrapper("cfg_BKReturnUpcEanDeblur",0);var _cfg_BKReturnFormatting=Module["_cfg_BKReturnFormatting"]=createExportWrapper("cfg_BKReturnFormatting",0);var _cfg_BKReturnDuplicatesDelayMs=Module["_cfg_BKReturnDuplicatesDelayMs"]=createExportWrapper("cfg_BKReturnDuplicatesDelayMs",0);var _cfg_BKReturnEncodingCharacterSet=Module["_cfg_BKReturnEncodingCharacterSet"]=createExportWrapper("cfg_BKReturnEncodingCharacterSet",0);var _cfg_BKReturnSpecificConfig=Module["_cfg_BKReturnSpecificConfig"]=createExportWrapper("cfg_BKReturnSpecificConfig",2);var _cfg_BKReturnBarcodeTypeEnabled=Module["_cfg_BKReturnBarcodeTypeEnabled"]=createExportWrapper("cfg_BKReturnBarcodeTypeEnabled",1);var _cfg_BKSetBarcodeTypeEnabled=Module["_cfg_BKSetBarcodeTypeEnabled"]=createExportWrapper("cfg_BKSetBarcodeTypeEnabled",2);var _cfg_BKReturnLengthRange=Module["_cfg_BKReturnLengthRange"]=createExportWrapper("cfg_BKReturnLengthRange",1);var _cfg_BKReturnMulticodeCachingEnabled=Module["_cfg_BKReturnMulticodeCachingEnabled"]=createExportWrapper("cfg_BKReturnMulticodeCachingEnabled",0);var _cfg_BKReturnMulticodeCachingDuration=Module["_cfg_BKReturnMulticodeCachingDuration"]=createExportWrapper("cfg_BKReturnMulticodeCachingDuration",0);var _cfg_BKGetMaximumResultsCount=Module["_cfg_BKGetMaximumResultsCount"]=createExportWrapper("cfg_BKGetMaximumResultsCount",0);var _cfg_BKReturnEnableMisshaped1D=Module["_cfg_BKReturnEnableMisshaped1D"]=createExportWrapper("cfg_BKReturnEnableMisshaped1D",0);var _cfg_BKReturnEnableVINRestrictions=Module["_cfg_BKReturnEnableVINRestrictions"]=createExportWrapper("cfg_BKReturnEnableVINRestrictions",0);var _cfg_BKReturnEnableComposite=Module["_cfg_BKReturnEnableComposite"]=createExportWrapper("cfg_BKReturnEnableComposite",0);var _cfg_BKReturnReturnOnlyMatchedResults=Module["_cfg_BKReturnReturnOnlyMatchedResults"]=createExportWrapper("cfg_BKReturnReturnOnlyMatchedResults",0);var _api_BKDecodeImageMemory=Module["_api_BKDecodeImageMemory"]=createExportWrapper("api_BKDecodeImageMemory",4);var _fflush=createExportWrapper("fflush",1);var _strerror=createExportWrapper("strerror",1);var ___getTypeName=createExportWrapper("__getTypeName",1);var _emscripten_builtin_memalign=createExportWrapper("emscripten_builtin_memalign",2);var __emscripten_timeout=createExportWrapper("_emscripten_timeout",2);var _setThrew=createExportWrapper("setThrew",2);var _emscripten_stack_init=()=>(_emscripten_stack_init=wasmExports["emscripten_stack_init"])();var _emscripten_stack_get_free=()=>(_emscripten_stack_get_free=wasmExports["emscripten_stack_get_free"])();var _emscripten_stack_get_base=()=>(_emscripten_stack_get_base=wasmExports["emscripten_stack_get_base"])();var _emscripten_stack_get_end=()=>(_emscripten_stack_get_end=wasmExports["emscripten_stack_get_end"])();var __emscripten_stack_restore=a0=>(__emscripten_stack_restore=wasmExports["_emscripten_stack_restore"])(a0);var __emscripten_stack_alloc=a0=>(__emscripten_stack_alloc=wasmExports["_emscripten_stack_alloc"])(a0);var _emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports["emscripten_stack_get_current"])();var ___cxa_decrement_exception_refcount=createExportWrapper("__cxa_decrement_exception_refcount",1);var ___cxa_increment_exception_refcount=createExportWrapper("__cxa_increment_exception_refcount",1);var ___get_exception_message=createExportWrapper("__get_exception_message",3);var ___cxa_can_catch=createExportWrapper("__cxa_can_catch",3);var ___cxa_get_exception_ptr=createExportWrapper("__cxa_get_exception_ptr",1);var ___emscripten_embedded_file_data=Module["___emscripten_embedded_file_data"]=3634424;Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["ccall"]=ccall;Module["cwrap"]=cwrap;Module["FS_createPreloadedFile"]=FS_createPreloadedFile;Module["FS_unlink"]=FS_unlink;Module["FS_createPath"]=FS_createPath;Module["FS_createDevice"]=FS_createDevice;Module["FS_createDataFile"]=FS_createDataFile;Module["FS_createLazyFile"]=FS_createLazyFile;var missingLibrarySymbols=["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getTempRet0","setTempRet0","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","emscriptenLog","runMainThreadEmAsm","listenOnce","autoResumeAudioContext","getDynCaller","dynCall","runtimeKeepalivePush","runtimeKeepalivePop","asmjsMangle","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","intArrayToString","AsciiToString","stringToNewUTF8","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","safeSetTimeout","setImmediateWrapped","safeRequestAnimationFrame","clearImmediateWrapped","polyfillSetImmediate","registerPostMainLoop","registerPreMainLoop","getPromise","makePromise","idsToPromises","makePromiseCallback","findMatchingCatch","Browser_asyncPrepareDataCounter","getSocketFromFD","getSocketAddress","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","webgl_enable_EXT_polygon_offset_clamp","webgl_enable_EXT_clip_control","webgl_enable_WEBGL_polygon_mode","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace","getFunctionArgsName","createJsInvokerSignature","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","enumReadValueFromPointer","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","throwInstanceAlreadyDeleted","flushPendingDeletes","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName"];missingLibrarySymbols.forEach(missingLibrarySymbol);var unexportedSymbols=["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","out","err","callMain","abort","wasmMemory","wasmExports","writeStackCookie","checkStackCookie","INT53_MAX","INT53_MIN","bigintToI53Checked","stackSave","stackRestore","stackAlloc","ptrToString","zeroMemory","exitJS","getHeapMax","growMemory","ENV","ERRNO_CODES","strError","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","readEmAsmArgs","runEmAsmFunction","jstoi_q","jstoi_s","getExecutableName","handleException","keepRuntimeAlive","callUserCallback","maybeExit","asyncLoad","alignMemory","mmapAlloc","wasmTable","noExitRuntime","getCFunc","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","intArrayFromString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","stringToUTF8OnStack","writeArrayToMemory","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","getEnvStrings","checkWasiClock","doReadv","doWritev","initRandomFill","randomFill","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","getExceptionMessageCommon","incrementExceptionRefcount","decrementExceptionRefcount","getExceptionMessage","Browser","getPreloadedImageData__data","wget","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","isLeapYear","ydayFromDate","arraySum","addDays","SYSCALLS","preloadPlugins","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar_buffer","FS_stdin_getChar","FS_readFile","FS","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr","InternalError","BindingError","throwInternalError","throwBindingError","registeredTypes","awaitingDependencies","typeDependencies","tupleRegistrations","structRegistrations","sharedRegisterType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","getFunctionName","heap32VectorToArray","requireRegisteredType","usesDestructorStack","checkArgCount","getRequiredArgCount","createJsInvoker","UnboundTypeError","PureVirtualError","GenericWireTypeSize","EmValType","EmValOptionalType","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","registeredPointers","registerType","integerReadValueFromPointer","floatReadValueFromPointer","readPointer","runDestructors","newFunc","craftInvokerFunction","embind__requireFunction","finalizationRegistry","detachFinalizer_deps","deletionQueue","delayFunction","emval_freelist","emval_handles","emval_symbols","init_emval","count_emval_handles","getStringOrSymbol","Emval","emval_get_global","emval_returnValue","emval_lookupTypes","emval_methodCallers","emval_addMethodCaller","reflectConstruct"];unexportedSymbols.forEach(unexportedRuntimeSymbol);var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args=[]){assert(runDependencies==0,'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(arg=>{HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function stackCheckInit(){_emscripten_stack_init();writeStackCookie()}function run(args=arguments_){if(runDependencies>0){return}stackCheckInit();preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();Module["onRuntimeInitialized"]?.();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}checkStackCookie()}function checkUnflushedContent(){var oldOut=out;var oldErr=err;var has=false;out=err=x=>{has=true};try{_fflush(0);["stdout","stderr"].forEach(name=>{var info=FS.analyzePath("/dev/"+name);if(!info)return;var stream=info.object;var rdev=stream.rdev;var tty=TTY.ttys[rdev];if(tty?.output?.length){has=true}})}catch(e){}out=oldOut;err=oldErr;if(has){warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.")}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run();}else{}})(incomingModule);}
|
|
347
341
|
function workerExecutionPartB(){initializeModule();var workerId=-1;self.onmessage=async function(e){const{id,workerId,method,argumentData}=e.data;const startTime=performance.now();try{let result=0;if(method==='preinit'){receivedWasmModule=argumentData;runGlue(Module);}
|
|
348
342
|
if(method==='initialize'){let key=argumentData;result=await Connector.initialize(key);}
|
|
349
343
|
else
|
|
@@ -437,8 +431,8 @@ else
|
|
|
437
431
|
{BKResult["error"]={name:"NoEnabledSymbologies",message:"There are no enabled symbologies. The scanner is not scanning for any barcodes."};}
|
|
438
432
|
if(use_callback){result_callback(BKResult);resolve(true);}
|
|
439
433
|
else resolve(BKResult);};imageFrame.onerror=(e)=>{Common.debugMessage("scanFrame",e.type,true);resolve(false);};imageFrame.src=image_data;}});};static scannerEvent=new CustomEvent("scannerReady",{detail:"Scanner is ready."});}
|
|
440
|
-
let Module;let receivedWasmModule;let Barkoder=null;let CustomOptionGlobal={customOption:"",value:0,set:false,returnValue:0};let MaxThreadsGlobal={value:2,set:false,returnValue:0};let WasmBinaryPathGlobal={value:"",set:false,returnValue:0};let ObtainVersionedBinaryGlobal={value:false,set:false,returnValue:0};let UseMainThreadOnlyGlobal={value:false,set:false,returnValue:0};let GlobalMethods={setCustomOptionGlobal:(customOption,value)=>{if(typeof customOption!='string')return-1;if(typeof value!='number')return-1;CustomOptionGlobal.customOption=customOption;CustomOptionGlobal.value=value;CustomOptionGlobal.set=true;return 0;},setMaxThreads:(value)=>{if(typeof value!='number')return-1;if(value<1&&value>Math.min(navigator.hardwareConcurrency,4))return-1;MaxThreadsGlobal.value=value;MaxThreadsGlobal.set=true;return 0;},setWasmPath:(value)=>{if(typeof value!='string')return-1;WasmBinaryPathGlobal.value=value;WasmBinaryPathGlobal.set=true;return 0;},setObtainVersionedBinary:(value)=>{if(typeof value!='boolean')return-1;ObtainVersionedBinaryGlobal.value=value;ObtainVersionedBinaryGlobal.set=true;return 0;},setThreadingMode:(useMainThreadOnly)=>{if(typeof useMainThreadOnly!='boolean')return-1;if(UseMainThreadOnlyGlobal.set)return-1;UseMainThreadOnlyGlobal.value=useMainThreadOnly;UseMainThreadOnlyGlobal.set=true;return 0;}};return{setCustomOptionGlobal:GlobalMethods.setCustomOptionGlobal,initialize:async(key,options)=>{if(typeof options=='object')
|
|
441
|
-
{if(typeof options.maxThreads=='number')GlobalMethods.setMaxThreads(options.maxThreads);if(typeof options.wasmPath=='string')GlobalMethods.setWasmPath(options.wasmPath);if(typeof options.obtainVersionedBinary=='boolean')GlobalMethods.setObtainVersionedBinary(options.obtainVersionedBinary);if(typeof options.useMainThreadOnly=='boolean')GlobalMethods.setThreadingMode(options.useMainThreadOnly);}
|
|
434
|
+
let Module;let receivedWasmModule;let Barkoder=null;let CustomOptionGlobal={customOption:"",value:0,set:false,returnValue:0};let MaxThreadsGlobal={value:2,set:false,returnValue:0};let WasmBinaryPathGlobal={value:"",set:false,returnValue:0};let ObtainVersionedBinaryGlobal={value:false,set:false,returnValue:0};let UseMainThreadOnlyGlobal={value:false,set:false,returnValue:0};let CanvasPreviewGlobal={value:null,set:false,returnValue:0};let GlobalMethods={setCustomOptionGlobal:(customOption,value)=>{if(typeof customOption!='string')return-1;if(typeof value!='number')return-1;CustomOptionGlobal.customOption=customOption;CustomOptionGlobal.value=value;CustomOptionGlobal.set=true;return 0;},setMaxThreads:(value)=>{if(typeof value!='number')return-1;if(value<1&&value>Math.min(navigator.hardwareConcurrency,4))return-1;MaxThreadsGlobal.value=value;MaxThreadsGlobal.set=true;return 0;},setWasmPath:(value)=>{if(typeof value!='string')return-1;WasmBinaryPathGlobal.value=value;WasmBinaryPathGlobal.set=true;return 0;},setObtainVersionedBinary:(value)=>{if(typeof value!='boolean')return-1;ObtainVersionedBinaryGlobal.value=value;ObtainVersionedBinaryGlobal.set=true;return 0;},setThreadingMode:(useMainThreadOnly)=>{if(typeof useMainThreadOnly!='boolean')return-1;if(UseMainThreadOnlyGlobal.set)return-1;UseMainThreadOnlyGlobal.value=useMainThreadOnly;UseMainThreadOnlyGlobal.set=true;return 0;},setCanvasPreview:(value)=>{if(typeof value!='boolean'&&value!==null)return-1;CanvasPreviewGlobal.value=value;CanvasPreviewGlobal.set=value!==null;return 0;}};return{setCustomOptionGlobal:GlobalMethods.setCustomOptionGlobal,initialize:async(key,options)=>{if(typeof options=='object')
|
|
435
|
+
{if(typeof options.maxThreads=='number')GlobalMethods.setMaxThreads(options.maxThreads);if(typeof options.wasmPath=='string')GlobalMethods.setWasmPath(options.wasmPath);if(typeof options.obtainVersionedBinary=='boolean')GlobalMethods.setObtainVersionedBinary(options.obtainVersionedBinary);if(typeof options.useMainThreadOnly=='boolean')GlobalMethods.setThreadingMode(options.useMainThreadOnly);if(typeof options.canvasPreview=='boolean')GlobalMethods.setCanvasPreview(options.canvasPreview);}
|
|
442
436
|
initializeModule();receivedWasmModule=await getCompiledWasm();runGlue(Module);UseMainThreadOnlyGlobal.set=true;while(!Connector.moduleLoaded){await Common.wait(20);Common.debugMessage("while await",Connector.moduleLoaded,true);}
|
|
443
437
|
Common.debugMessage("UMD","return point",true);if(CustomOptionGlobal.set){let customOption=CustomOptionGlobal.customOption;let value=CustomOptionGlobal.value;let returnValue=Connector.setCustomOptionGlobal(customOption,value);CustomOptionGlobal.returnValue=returnValue;}
|
|
444
438
|
if(typeof key!='string')
|
|
@@ -464,13 +458,13 @@ Connector.setEnabledDecodersPro(decodersToEnable);Bridge.enabledDecoders=decoder
|
|
|
464
458
|
break;}}}
|
|
465
459
|
return true;},scanImage:Connector.scanImage,scanFrame:(frameData,callback)=>{let frame_type="";if(typeof frameData=='object')frame_type="ImageData";if(typeof frameData=='string')frame_type="dataURL";if(frame_type=="")return Promise.resolve(false);return Connector.scanFrame(frameData,frame_type,callback);},setDecodingSpeed:(decodingSpeed)=>{if(typeof decodingSpeed=='number'){return Connector.setDecodingSpeed(decodingSpeed);}return-1;},setEnabledDecoders:function(){let totalDecoders=arguments.length;let decodersToEnable=0n;Common.debugMessage("API","totalDecoders: "+totalDecoders,true);for(let i=0;i<totalDecoders;i++)
|
|
466
460
|
{let decoder_i=arguments[i];if(typeof decoder_i=='number')decodersToEnable+=(2n**BigInt(decoder_i));else throw new Error(`Parameter enabledDecoders(${i}) is not a number!`);}
|
|
467
|
-
Common.debugMessage("API","decodersToEnable: "+decodersToEnable,true);let Res=Connector.setEnabledDecodersPro(decodersToEnable);if(Res==-1)throw new Error(`Parameter enabledDecoders is not valid!`);Bridge.enabledDecoders=decodersToEnable;},getEnabledDecoders:()=>{const availableBarcodes=Object.values(Barkoder.constants.Decoders);const enabledBarcodes=[];availableBarcodes.forEach((i)=>{if(Barkoder.isBarcodeTypeEnabled(i)===true){enabledBarcodes.push(i);}});return enabledBarcodes;},setUpcEanDeblur:(upcEanDeblur)=>{if(typeof upcEanDeblur=='number'){return Connector.setUpcEanDeblur(upcEanDeblur);}return-1;},getRegionOfInterest:Connector.getRegionOfInterest,setRegionOfInterest:(...args)=>{Connector.setRegionOfInterest(...args);Connector.storeROI(args[0],args[1],args[2],args[3]);Bridge.init_ROIs();if(Decoder.cameraScanner.runningState.active&&DOM_elements.readyToUse_RO)Bridge.resizePreview();},setLengthRange:Connector.setLengthRange,setCustomOption:(customOption,value)=>{if(typeof customOption!='string')return-1;if(typeof value!='number')return-1;let
|
|
461
|
+
Common.debugMessage("API","decodersToEnable: "+decodersToEnable,true);let Res=Connector.setEnabledDecodersPro(decodersToEnable);if(Res==-1)throw new Error(`Parameter enabledDecoders is not valid!`);Bridge.enabledDecoders=decodersToEnable;},getEnabledDecoders:()=>{const availableBarcodes=Object.values(Barkoder.constants.Decoders);const enabledBarcodes=[];availableBarcodes.forEach((i)=>{if(Barkoder.isBarcodeTypeEnabled(i)===true){enabledBarcodes.push(i);}});return enabledBarcodes;},setUpcEanDeblur:(upcEanDeblur)=>{if(typeof upcEanDeblur=='number'){return Connector.setUpcEanDeblur(upcEanDeblur);}return-1;},getRegionOfInterest:Connector.getRegionOfInterest,setRegionOfInterest:(...args)=>{Connector.setRegionOfInterest(...args);Connector.storeROI(args[0],args[1],args[2],args[3]);Bridge.init_ROIs();if(Decoder.cameraScanner.runningState.active&&DOM_elements.readyToUse_RO)Bridge.resizePreview();},setLengthRange:Connector.setLengthRange,setCustomOption:(customOption,value)=>{if(typeof customOption!='string')return-1;if(typeof value!='number')return-1;let response=Connector.setCustomOption(customOption,value);if(response==0)
|
|
468
462
|
{if(customOption=='single_line_scan'&&(value>=0&&value<=2))Bridge.viewfinderAppearance.overlay.lineScanType=value;}
|
|
469
463
|
return response;},getSADLImage:(jsonString)=>{return new Promise((resolve,reject)=>{try{const sadlObject=JSON.parse(jsonString);const fields=sadlObject.Fields;const width=parseInt(fields[15]?.Value);const height=parseInt(fields[16]?.Value);if(isNaN(width)||isNaN(height)||width!==200||height!==250){return reject(new Error(`Invalid dimensions: Expected 200x250, got ${width}x${height}`));}
|
|
470
464
|
const field17=fields[17];if(field17?.Field!=="ImageRawBase64"||typeof field17?.Value!=="string"){return reject(new Error("Field 17 is missing or is not 'ImageRawBase64'"));}
|
|
471
465
|
const base64Data=field17.Value;if(base64Data.length<=50000){return reject(new Error("Base64 data length is insufficient (must be > 50K)"));}
|
|
472
466
|
const grayscale=Bridge.base64ToUint8ClampedArray(base64Data);const rgba=new Uint8ClampedArray(width*height*4);for(let i=0;i<grayscale.length;i++){const val=grayscale[i];const target=i*4;rgba[target]=val;rgba[target+1]=val;rgba[target+2]=val;rgba[target+3]=255;}
|
|
473
|
-
resolve(new ImageData(rgba,width,height));}catch(err){reject(new Error("Failed to process JSON: "+err.message));}});},setFormatting:(formatting)=>{if(typeof formatting=='number'){return Connector.setFormatting(formatting);}return-1;},setDuplicatesDelayMs:(duplicatesDelayMs)=>{if(typeof duplicatesDelayMs=='number'){{if(duplicatesDelayMs==-1)return Connector.setDuplicatesDelayMs(2147483647);}return Connector.setDuplicatesDelayMs(duplicatesDelayMs);}return-1;},setEncodingCharacterSet:(encodingCharacterSet)=>{if(typeof encodingCharacterSet=='number'){return Connector.setEncodingCharacterSet(encodingCharacterSet);}return-1;},setMulticodeCachingEnabled:(multicodeCachingEnabled)=>{if(typeof multicodeCachingEnabled=='number'){return Connector.setMulticodeCachingEnabled(multicodeCachingEnabled);}return-1;},setMulticodeCachingDuration:(multicodeCachingDuration)=>{if(typeof multicodeCachingDuration=='number'){return Connector.setMulticodeCachingDuration(multicodeCachingDuration);}return-1;},setMaximumResultsCount:(maximumResultsCount)=>{if((typeof maximumResultsCount=='number')&&(Bridge.cameraScanner.AR_Mode==0)){return Connector.setMaximumResultsCount(maximumResultsCount);}return-1;},setEnableMisshaped1D:(enableMisshaped1D)=>{if(typeof enableMisshaped1D=='number'){return Connector.setEnableMisshaped1D(enableMisshaped1D);}return-1;},setEnableVINRestrictions:(enableVINRestrictions)=>{if(typeof enableVINRestrictions=='number'){return Connector.setEnableVINRestrictions(enableVINRestrictions);}return-1;},setEnableComposite:(enableComposite)=>{if(typeof enableComposite=='number'){return Connector.setEnableComposite(enableComposite);}return-1;},getDecodingSpeed:Connector.getDecodingSpeed,getUpcEanDeblur:Connector.getUpcEanDeblur,getFormatting:Connector.getFormatting,getDuplicatesDelayMs:()=>{let duplicatesDelayMs=Connector.getDuplicatesDelayMs();if(duplicatesDelayMs==2147483647)return-1;else return duplicatesDelayMs;},getMaximumResultsCount:Connector.getMaximumResultsCount,getEnableMisshaped1D:Connector.getEnableMisshaped1D,getEnableVINRestrictions:Connector.getEnableVINRestrictions,getEnableComposite:Connector.getEnableComposite,getEncodingCharacterSet:Connector.getEncodingCharacterSet,getMsiChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Msi,Connector.settingGroup.checksumType);},getCode39ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code39,Connector.settingGroup.checksumType);},getCode11ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code11,Connector.settingGroup.checksumType);},getDatamatrixDpmModeEnabled:()=>{return Boolean(Connector.getSpecificConfig(Constants.Decoders.Datamatrix,Connector.settingGroup.dpmMode));},isBarcodeTypeEnabled:(decoder)=>{if(typeof decoder=='number'){let barcodeTypeEnabled=Connector.getBarcodeTypeEnabled(decoder);if(barcodeTypeEnabled==1)return true;if(barcodeTypeEnabled==0)return false;return barcodeTypeEnabled;}return-1;},setBarcodeTypeEnabled:(decoder,enable)=>{if(typeof decoder=='number'&&typeof enable=='boolean'){return Connector.setBarcodeTypeEnabled(decoder,enable);}return-1;},getBarcodeTypeLengthRange:(decoder)=>{if(typeof decoder=='number'){let lengthRange=Connector.getLengthRange(decoder);if(lengthRange!=-1)
|
|
467
|
+
resolve(new ImageData(rgba,width,height));}catch(err){reject(new Error("Failed to process JSON: "+err.message));}});},setFormatting:(formatting)=>{if(typeof formatting=='number'){return Connector.setFormatting(formatting);}return-1;},setDuplicatesDelayMs:(duplicatesDelayMs)=>{if(typeof duplicatesDelayMs=='number'){{if(duplicatesDelayMs==-1)return Connector.setDuplicatesDelayMs(2147483647);}return Connector.setDuplicatesDelayMs(duplicatesDelayMs);}return-1;},setEncodingCharacterSet:(encodingCharacterSet)=>{if(typeof encodingCharacterSet=='number'){return Connector.setEncodingCharacterSet(encodingCharacterSet);}return-1;},setMulticodeCachingEnabled:(multicodeCachingEnabled)=>{if(typeof multicodeCachingEnabled=='number'){return Connector.setMulticodeCachingEnabled(multicodeCachingEnabled);}return-1;},setMulticodeCachingDuration:(multicodeCachingDuration)=>{if(typeof multicodeCachingDuration=='number'){return Connector.setMulticodeCachingDuration(multicodeCachingDuration);}return-1;},setMaximumResultsCount:(maximumResultsCount)=>{if((typeof maximumResultsCount=='number')&&(Bridge.cameraScanner.AR_Mode==0)){return Connector.setMaximumResultsCount(maximumResultsCount);}return-1;},setEnableMisshaped1D:(enableMisshaped1D)=>{if(typeof enableMisshaped1D=='number'){return Connector.setEnableMisshaped1D(enableMisshaped1D);}return-1;},setEnableVINRestrictions:(enableVINRestrictions)=>{if(typeof enableVINRestrictions=='number'){return Connector.setEnableVINRestrictions(enableVINRestrictions);}return-1;},setEnableComposite:(enableComposite)=>{if(typeof enableComposite=='number'){return Connector.setEnableComposite(enableComposite);}return-1;},setReturnOnlyMatchedResults:(returnOnlyMatchedResults)=>{if((typeof returnOnlyMatchedResults=='boolean')&&(Bridge.cameraScanner.AR_Mode!=4)){return Connector.setReturnOnlyMatchedResults(returnOnlyMatchedResults);}return-1;},setMatchFilter:(matchFilter)=>{if(typeof matchFilter!='string')return-1;Connector.setMatchFilter(matchFilter);return 0;},setReturnOnlyMatchedResultsAR:(returnOnlyMatchedResultsAR)=>{if(typeof returnOnlyMatchedResultsAR=='boolean')Bridge.cameraScanner.returnOnlyMatchedResultsAR=returnOnlyMatchedResultsAR;},setDisplayOnlyMatchedResults:(displayOnlyMatchedResults)=>{if(typeof displayOnlyMatchedResults=='boolean')Bridge.cameraScanner.overlay.displayOnlyMatchedResults=displayOnlyMatchedResults;},setResultLimit:(resultLimit)=>{if(typeof resultLimit=='number')Bridge.cameraScanner.resultLimit=resultLimit;},setContinueScanningOnLimit:(continueScanningOnLimit)=>{if(typeof continueScanningOnLimit=='boolean')Bridge.cameraScanner.continueScanningOnLimit=continueScanningOnLimit;},setEmitResultsAtSessionEndOnly:(emitResultsAtSessionEndOnly)=>{if(typeof emitResultsAtSessionEndOnly=='boolean')Bridge.cameraScanner.emitResultsAtSessionEndOnly=emitResultsAtSessionEndOnly;},getDecodingSpeed:Connector.getDecodingSpeed,getUpcEanDeblur:Connector.getUpcEanDeblur,getFormatting:Connector.getFormatting,getDuplicatesDelayMs:()=>{let duplicatesDelayMs=Connector.getDuplicatesDelayMs();if(duplicatesDelayMs==2147483647)return-1;else return duplicatesDelayMs;},getMaximumResultsCount:Connector.getMaximumResultsCount,getEnableMisshaped1D:Connector.getEnableMisshaped1D,getEnableVINRestrictions:Connector.getEnableVINRestrictions,getEnableComposite:Connector.getEnableComposite,getReturnOnlyMatchedResults:()=>{return Boolean(Connector.getReturnOnlyMatchedResults());},getReturnOnlyMatchedResultsAR:()=>{return Bridge.cameraScanner.returnOnlyMatchedResultsAR;},getDisplayOnlyMatchedResults:()=>{return Bridge.cameraScanner.overlay.displayOnlyMatchedResults;},getResultLimit:()=>{return Bridge.cameraScanner.resultLimit;},getContinueScanningOnLimit:()=>{return Bridge.cameraScanner.continueScanningOnLimit;},getEmitResultsAtSessionEndOnly:()=>{return Bridge.cameraScanner.emitResultsAtSessionEndOnly;},getEncodingCharacterSet:Connector.getEncodingCharacterSet,getMsiChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Msi,Connector.settingGroup.checksumType);},getCode39ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code39,Connector.settingGroup.checksumType);},getCode11ChecksumType:()=>{return Connector.getSpecificConfig(Constants.Decoders.Code11,Connector.settingGroup.checksumType);},getDatamatrixDpmModeEnabled:()=>{return Boolean(Connector.getSpecificConfig(Constants.Decoders.Datamatrix,Connector.settingGroup.dpmMode));},isBarcodeTypeEnabled:(decoder)=>{if(typeof decoder=='number'){let barcodeTypeEnabled=Connector.getBarcodeTypeEnabled(decoder);if(barcodeTypeEnabled==1)return true;if(barcodeTypeEnabled==0)return false;return barcodeTypeEnabled;}return-1;},setBarcodeTypeEnabled:(decoder,enable)=>{if(typeof decoder=='number'&&typeof enable=='boolean'){return Connector.setBarcodeTypeEnabled(decoder,enable);}return-1;},getBarcodeTypeLengthRange:(decoder)=>{if(typeof decoder=='number'){let lengthRange=Connector.getLengthRange(decoder);if(lengthRange!=-1)
|
|
474
468
|
{let max=(lengthRange>>(8*1))&0xFF;let min=lengthRange&0xFF;return[min,max];}
|
|
475
469
|
else return-1;}return-1;},getMulticodeCachingEnabled:Connector.getMulticodeCachingEnabled,getMulticodeCachingDuration:Connector.getMulticodeCachingDuration,setCode11ChecksumType:(code11ChecksumType)=>{if(typeof code11ChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Code11,code11ChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setCode39ChecksumType:(code39ChecksumType)=>{if(typeof code39ChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Code39,code39ChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setMsiChecksumType:(msiChecksumType)=>{if(typeof msiChecksumType=='number'){Connector.setSpecificConfig(Constants.Decoders.Msi,msiChecksumType,Connector.settingGroup.checksumType);return 0;}return-1;},setDatamatrixDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.Datamatrix,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setQRDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.QR,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setQRMicroDpmModeEnabled:(dpmModeEnabled)=>{if(typeof dpmModeEnabled=='boolean'){Connector.setSpecificConfig(Constants.Decoders.QRMicro,dpmModeEnabled,Connector.settingGroup.dpmMode);return 0;}return-1;},setFlashEnabled:(flashEnabled)=>{if(typeof flashEnabled=='boolean'){DOM_elements.buttonsProperties.showFlash=flashEnabled;return 0;}return-1;},setZoomEnabled:(zoomEnabled)=>{if(typeof zoomEnabled=='boolean'){DOM_elements.buttonsProperties.showZoom=zoomEnabled;return 0;}return-1;},setCloseEnabled:(closeEnabled)=>{if(typeof closeEnabled=='boolean'){DOM_elements.buttonsProperties.showClose=closeEnabled;return 0;}return-1;},setCameraPickerEnabled:(cameraPickerEnabled)=>{if(typeof cameraPickerEnabled=='boolean'){DOM_elements.buttonsProperties.showCameraPicker=cameraPickerEnabled;return 0;}return-1;},changeFlashState:()=>{JS_media.applyFlash(true);},changeZoomState:()=>{JS_media.applyZoom();},setTargetZoom:(targetZoom)=>{if(typeof targetZoom=='number')
|
|
476
470
|
{JS_media.zoom.targetValue=targetZoom;JS_media.zoom.useTarget=true;}},getTargetZoom:()=>{return JS_media.zoom.targetValue;},getMaxZoomFactor:()=>{return(JS_media.zoom.supported)?((JS_media.zoom.ready)?JS_media.zoom.levels[2]:4):1;},isFlashAvailable:()=>{return(JS_media.flash.supported&&JS_media.flash.ready);},setCameraResolution:(camRes)=>{if(typeof camRes=='number'){if(camRes==0){JS_media.frameWidth.ideal=1280;JS_media.frameHeight.ideal=720;return 0;}
|
|
@@ -483,5 +477,9 @@ return-1;}return-1;},getCameraResolution:()=>{if((JS_media.frameWidth.ideal==128
|
|
|
483
477
|
{if(typeof JS_media.runtime_settings_videoTrack=="object")
|
|
484
478
|
{const activeCameraId=JS_media.runtime_settings_videoTrack.deviceId;let activeCamera=JS_media.cameras.filter((camera)=>camera.id==activeCameraId);return activeCamera[0];}
|
|
485
479
|
return null;}
|
|
486
|
-
return null;},getCameras:JS_media.getCameras,setPauseDecoding:(pause)=>{if(typeof pause=='boolean')Decoder.cameraScanner.runningState.paused=pause;},setLocationLineColor:(color)=>{if(typeof color=='string')Decoder.cameraScanner.overlay.locationLineColor=color;},setLocationLineWidth:(width)=>{if(typeof width=='number')Decoder.cameraScanner.overlay.locationLineWidth=width;},setSelectedLocationColor:(color)=>{if(typeof color=='string')Bridge.cameraScanner.overlay.selectedLocationColor=color;},setNonSelectedLocationLineColor:(color)=>{if(typeof color=='string')Bridge.cameraScanner.overlay.nonSelectedLocationLineColor=color;},setSelectedLocationLineWidth:(width)=>{if(typeof width=='number')Bridge.cameraScanner.overlay.selectedLocationLineWidth=width;},setNonSelectedLocationLineWidth:(width)=>{if(typeof width=='number')Bridge.cameraScanner.overlay.nonSelectedLocationLineWidth=width;},setHeaderHeight:(height)=>{if(typeof height=='number')Bridge.cameraScanner.overlay.headerHeight=height;},setLocationTransitionSpeed:(transitionSpeed)=>{if(typeof transitionSpeed=='number')Bridge.cameraScanner.overlay.locationTransitionSpeed=transitionSpeed*1000;},setResultDisappearanceDelayMs:(disappearanceDelayMs)=>{if(typeof disappearanceDelayMs=='number')Bridge.cameraScanner.overlay.resultDisappearanceDelayMs=disappearanceDelayMs;},setDoubleTapToFreezeEnabled:(enabled)=>{if(typeof enabled=='boolean')Bridge.cameraScanner.doubleTapToFreezeEnabled=enabled;},setARMode:(ARMode)=>{if(typeof ARMode=='number'){
|
|
480
|
+
return null;},getCameras:JS_media.getCameras,setPauseDecoding:(pause)=>{if(typeof pause=='boolean')Decoder.cameraScanner.runningState.paused=pause;},setLocationLineColor:(color)=>{if(typeof color=='string')Decoder.cameraScanner.overlay.locationLineColor=color;},setLocationLineWidth:(width)=>{if(typeof width=='number')Decoder.cameraScanner.overlay.locationLineWidth=width;},setSelectedLocationColor:(color)=>{if(typeof color=='string')Bridge.cameraScanner.overlay.selectedLocationColor=color;},setNonSelectedLocationLineColor:(color)=>{if(typeof color=='string')Bridge.cameraScanner.overlay.nonSelectedLocationLineColor=color;},setSelectedLocationLineWidth:(width)=>{if(typeof width=='number')Bridge.cameraScanner.overlay.selectedLocationLineWidth=width;},setNonSelectedLocationLineWidth:(width)=>{if(typeof width=='number')Bridge.cameraScanner.overlay.nonSelectedLocationLineWidth=width;},setHeaderHeight:(height)=>{if(typeof height=='number')Bridge.cameraScanner.overlay.headerHeight=height;},setLocationTransitionSpeed:(transitionSpeed)=>{if(typeof transitionSpeed=='number')Bridge.cameraScanner.overlay.locationTransitionSpeed=transitionSpeed*1000;},setResultDisappearanceDelayMs:(disappearanceDelayMs)=>{if(typeof disappearanceDelayMs=='number')Bridge.cameraScanner.overlay.resultDisappearanceDelayMs=disappearanceDelayMs;},setDoubleTapToFreezeEnabled:(enabled)=>{if(typeof enabled=='boolean')Bridge.cameraScanner.doubleTapToFreezeEnabled=enabled;},setARMode:(ARMode)=>{if(typeof ARMode=='number'){if(ARMode!=Bridge.cameraScanner.AR_Mode)Bridge.AR_resetSession();Bridge.cameraScanner.AR_Mode=ARMode;Bridge.AR_Mode_ON=!!ARMode;if(Decoder.cameraScanner.runningState.active)DOM_elements.AR_overlay.style.display=Bridge.AR_Mode_ON?"initial":"none";Connector.setMaximumResultsCount(200);if(Bridge.cameraScanner.AR_Mode==4)
|
|
481
|
+
{let currentSetting_ReturnOnlyMatchedResults=Connector.getReturnOnlyMatchedResults();Bridge.cameraScanner.cache.returnOnlyMatchedResults.value=currentSetting_ReturnOnlyMatchedResults;Bridge.cameraScanner.cache.returnOnlyMatchedResults.set=true;Connector.setReturnOnlyMatchedResults(false);}
|
|
482
|
+
else
|
|
483
|
+
{if(Bridge.cameraScanner.cache.returnOnlyMatchedResults.set)
|
|
484
|
+
{Connector.setReturnOnlyMatchedResults(Bridge.cameraScanner.cache.returnOnlyMatchedResults.value);Bridge.cameraScanner.cache.returnOnlyMatchedResults.set=false;}}}},setHeaderShowMode:(headerShowMode)=>{if(typeof headerShowMode=='number')Bridge.cameraScanner.overlay.headerShowMode=headerShowMode;},setLocationType:(locationType)=>{if(typeof locationType=='number')Bridge.cameraScanner.overlay.locationType=locationType;},setHeaderTextColorSelected:(color)=>{if(typeof color=='string')Bridge.cameraScanner.overlay.headerTextColorSelected=color;},setHeaderTextColorNonSelected:(color)=>{if(typeof color=='string')Bridge.cameraScanner.overlay.headerTextColorNonSelected=color;},setRoiCenterMark:(centerMark)=>{if(typeof centerMark=='number')Bridge.viewfinderAppearance.overlay.centerMarkType=centerMark;},setLineScanAnimationMode:(animationMode)=>{if(typeof animationMode=='number')Bridge.viewfinderAppearance.overlay.lineScanAnimationMode=animationMode;},setLineScanColor:(color)=>{if(typeof color=='string')Bridge.viewfinderAppearance.overlay.lineScanColor=color;},setLineScanWidth:(width)=>{if(typeof width=='number')Bridge.viewfinderAppearance.overlay.lineScanWidth=width;},setRoiLineColor:(color)=>{if(typeof color=='string')Bridge.viewfinderAppearance.overlay.lineColor=color;},setRoiOverlayBackgroundColor:(color)=>{if(typeof color=='string')Bridge.viewfinderAppearance.overlay.backgroundFillColor=color;},setRoiLineWidth:(width)=>{if(typeof width=='number')Bridge.viewfinderAppearance.overlay.lineWidth=width;},setRegionOfInterestVisible:(visible)=>{if(typeof visible=='boolean')Bridge.viewfinderAppearance.overlay.roiVisible=visible;},setImageResultEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.config.result_image=enabled;},setLocationInImageResultEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.config.result_image_with_location=enabled;},setBarcodeThumbnailOnResultEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.config.result_image_barcode=enabled;},setLocationInPreviewEnabled:(enabled)=>{if(typeof enabled=='boolean')Decoder.cameraScanner.overlay.locationShow=enabled;},getLocationLineColor:()=>{return Decoder.cameraScanner.overlay.locationLineColor;},getLocationLineWidth:()=>{return Decoder.cameraScanner.overlay.locationLineWidth;},getRoiCenterMark:()=>{return Bridge.viewfinderAppearance.overlay.centerMarkType;},getLineScanAnimationMode:()=>{return Bridge.viewfinderAppearance.overlay.lineScanAnimationMode;},getLineScanColor:()=>{return Bridge.viewfinderAppearance.overlay.lineScanColor;},getLineScanWidth:()=>{return Bridge.viewfinderAppearance.overlay.lineScanWidth;},getRoiLineColor:()=>{return Bridge.viewfinderAppearance.overlay.lineColor;},getRoiOverlayBackgroundColor:()=>{return Bridge.viewfinderAppearance.overlay.backgroundFillColor;},getRoiLineWidth:()=>{return Bridge.viewfinderAppearance.overlay.lineWidth;},isRegionOfInterestVisible:()=>{return Bridge.viewfinderAppearance.overlay.roiVisible;},isImageResultEnabled:()=>{return Decoder.cameraScanner.config.result_image;},isLocationInImageResultEnabled:()=>{return Decoder.cameraScanner.config.result_image_with_location;},isBarcodeThumbnailOnResultEnabled:()=>{return Decoder.cameraScanner.config.result_image_barcode;},isLocationInPreviewEnabled:()=>{return Decoder.cameraScanner.overlay.locationShow;},getSelectedLocationColor:()=>{return Bridge.cameraScanner.overlay.selectedLocationColor;},getNonSelectedLocationLineColor:()=>{return Bridge.cameraScanner.overlay.nonSelectedLocationLineColor;},getSelectedLocationLineWidth:()=>{return Bridge.cameraScanner.overlay.selectedLocationLineWidth;},getNonSelectedLocationLineWidth:()=>{return Bridge.cameraScanner.overlay.nonSelectedLocationLineWidth;},getHeaderHeight:()=>{return Bridge.cameraScanner.overlay.headerHeight;},getLocationTransitionSpeed:()=>{return Bridge.cameraScanner.overlay.locationTransitionSpeed;},getResultDisappearanceDelayMs:()=>{return Bridge.cameraScanner.overlay.resultDisappearanceDelayMs;},isDoubleTapToFreezeEnabled:()=>{return Bridge.cameraScanner.doubleTapToFreezeEnabled;},getARMode:()=>{return Bridge.cameraScanner.AR_Mode;},getHeaderShowMode:()=>{return Bridge.cameraScanner.overlay.headerShowMode;},getLocationType:()=>{return Bridge.cameraScanner.overlay.locationType;},getHeaderTextColorSelected:()=>{return Bridge.cameraScanner.overlay.headerTextColorSelected;},getHeaderTextColorNonSelected:()=>{return Bridge.cameraScanner.overlay.headerTextColorNonSelected;},scanFromLocalFileSystem:function(input,result_callback){let file=input.files[0];let reader=new FileReader();if(file?.type.match(/image/i)){reader.readAsDataURL(file);reader.onload=async function(){let currentSetting_MaximumResultsCount=Barkoder.getMaximumResultsCount();let currentSetting_DecodingSpeed=Barkoder.getDecodingSpeed();let currentSetting_UpcEanDeblur=Barkoder.getUpcEanDeblur();let currentSetting_DatamatrixDpmModeEnabled=Barkoder.getDatamatrixDpmModeEnabled();Barkoder.setMaximumResultsCount(100);Barkoder.setDecodingSpeed(Barkoder.constants.DecodingSpeed.Rigorous);Barkoder.setUpcEanDeblur(Barkoder.constants.UpcEanDeblur.Enable);Barkoder.setDatamatrixDpmModeEnabled(true);let BKresult=await Barkoder.scanImage(reader.result);Barkoder.setMaximumResultsCount(currentSetting_MaximumResultsCount);Barkoder.setDecodingSpeed(currentSetting_DecodingSpeed);Barkoder.setUpcEanDeblur(currentSetting_UpcEanDeblur);Barkoder.setDatamatrixDpmModeEnabled(currentSetting_DatamatrixDpmModeEnabled);result_callback(BKresult);};reader.onerror=function(){console.log(reader.error);};}else{if(typeof file=='object')
|
|
487
485
|
console.log('File is not an image.');else console.log('No file is selected.');}},getVersion:Connector.getVersion};let bkEvents=new BarkoderEvents();Barkoder=Object.assign(bkEvents,Barkoder);resolve(Barkoder);});}catch(e){Common.debugMessage("initialize","error: "+e,true);return new window.Promise(function(resolve,reject){return reject("LicenseKeyError");});}}};})
|