! function(e) { function t(r) { if (n[r]) return n[r].exports; var i = n[r] = { i: r, l: !1, exports: {} }; return e[r].call(i.exports, i, i.exports, t), i.l = !0, i.exports } var n = {}; t.m = e, t.c = n, t.d = function(e, n, r) { t.o(e, n) || Object.defineProperty(e, n, { configurable: !1, enumerable: !0, get: r }) }, t.n = function(e) { var n = e && e.__esModule ? function() { return e.default } : function() { return e }; return t.d(n, "a", n), n }, t.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, t.p = "", t(t.s = 0) }([function(e, t) { ! function(e, t) { function n(e) { var t = String(e) .trim(); if (isNaN(t)) return !1; var n = Math.floor(Number(t)); return n !== 1 / 0 && String(n) === t } function r(e) { var t = String(e) .trim(); return "yes" === t || "1" === t || "true" === t ? "yes" : "no" } function i(e, t) { y[e] = t, S[e] = t } function o(e) { var n = S[e]; return n !== t ? n : "" } function s(r, i, o) { if (!("WebSocket" in e)) return void console.error("%c浏览器不支持WebSocket,请更换浏览器", "color:red"); b = (1 == o || 0 == o) && o, m = r !== t && null !== r && "" !== String(r) && n(r) ? b ? "ws://localhost:" + String(r + 1) : "ws://localhost:" + String(r) : b ? "wss://localhost:23166" : "ws://localhost:23165", d = (1 == i || 0 == i) && i, null === h ? (h = new WebSocket(m), h.onopen = function() { d && console.log("连接已打开") }, h.onmessage = function(e) { console.log(e.data); var t = String(e.data), n = JSON.parse(t), r = n.Cmd, i = n.Code, o = n.Msg; if (0 !== i && i < 2001 && (y = {}, x("Code:" + i + ";Msg:" + o)), "HOME" === r) j(n.Data); else if ("SDEV" === r) { var s = JSON.parse(e.data); if ("2005" === String(s.Code)) { var c = atob(s.Data), a = decodeURI(c), u = JSON.parse(a); P(u.Devs) } else P([]) } else if ("SDEVPLUG" === r) { var s = JSON.parse(e.data); if ("2005" === String(s.Code)) { var c = atob(s.Data), a = decodeURI(c), u = JSON.parse(a); v(u.Devs) } else v([]) } else if ("SOPT" === r) { S = {}, O = {}, y = {}; var s = JSON.parse(e.data), f = s.Data.split("|"); if (2 === f.length) { var c = atob(f[0]), a = decodeURI(c), p = JSON.parse(a); S = p, O = p, c = atob(f[1]), a = decodeURI(c); JSON.parse(a); D(a) } } else if ("SSCANONE" === r) { var l = JSON.parse(e.data), ld = l.liveDetect, f = l.Data.split("|"); if (2 === f.length) { var d = f[0], b = f[1]; if (0 === g) w(l.DataType,ld, d, b, ""); else { var m = atob(b), h = decodeURI(m), E = JSON.parse(h); w(l.DataType, ld, d, E.ImagePath, E.Base64Data) } } } else if ("SSCANALL" === r) k(e.data), y = {}; else if ("SSCANMUL" === r) { var J = "", M = "", l = JSON.parse(e.data), f = l.Data.split("|"); 2 === f.length && (J = f[0], M = f[1]), N(J, M), y = {} } else if ("SBASE64" === r) { var l = JSON.parse(e.data); C(l.Data) } else y = {}, console.log(n.Code, n.Msg) }, h.onclose = function(e) { h = null, console.error("%c连接已关闭,请检查进程pslapisvr是否存在,并重新刷新页面进行连接。\r\n 详细信息:", "color:red", e) }, h.onerror = function(e) { h = null, console.error("%c连接出现错误,请检查进程pslapisvr是否存在。\r\n 详细信息:", "color:red", e) }) : h = null } function c(e, t) { "function" == typeof t && ("OnGetHomePath" === e ? j = t : "OnGetDevices" === e ? P = t : "OnDetectDevices" === e ? v = t : "OnScanOneFileDone" === e ? w = t : "OnScanAllFilesDone" === e ? k = t : "OnScanMultiPagesFileDone" === e ? N = t : "OnGetSettingInfo" === e ? D = t : "OnGetBase64" === e ? C = t : "OnErrorMessage" === e && (x = t)) } function a() { if (null === h) return void x("GetDevices:未连接服务"); h.send("CDEV") } function u(e) { return null === h ? void x("GetSettingInfo:未连接服务") : e && "" !== e ? void h.send("COPT|" + String(e)) : void x("GetSettingInfo:未选择扫描仪") } function f(e) { if (null === h) return void x("Scan:未连接服务"); if (!e || "" === e) return void x("Scan:未选择扫描仪"); var t = JSON.stringify(y); h.send("CSCAN|" + String(e) + "|" + t) } function p(e) { if (null === h) return void x("ConvertToBase64:未连接服务"); h.send("CBASE64|" + e) } function l() { y = {}, S = O, g = 0 } e.psl = { sane: {} }, Object.defineProperty(psl.sane, "filepath", { get: function() { return o("filepath") }, set: function(e) { i("filepath", String(e) .trim()) } }), Object.defineProperty(psl.sane, "filetype", { get: function() { return o("filetype") }, set: function(e) { var t = String(e) .trim(); if ("1" !== t && "2" !== t && "3" !== t && "4" !== t && "5" !== t && "6" !== t && "7" !== t) throw new Error("filetype 值范围:1-7,且为整数,当前值:" + t); i("filetype", t) } }), Object.defineProperty(psl.sane, "fileprefix", { get: function() { return o("fileprefix") }, set: function(e) { i("fileprefix", String(e) .trim()) } }), Object.defineProperty(psl.sane, "scancount", { get: function() { return o("scancount") }, set: function(e) { var t = String(e) .trim(), r = Math.floor(Number(t)); if (!n(t) && r < 1 && r > 2e9) throw new Error("scancount 值范围:1-2000000000,且为整数,当前值:" + t); i("scancount", t) } }), Object.defineProperty(psl.sane, "scanmincountsize", { get: function() { return o("scanmincountsize") }, set: function(e) { var t = String(e) .trim(), r = Math.floor(Number(t)); if (!n(t) && r < 1 && r > 9) throw new Error("scanmincountsize 值范围:1-9,且为整数,当前值:" + t); i("scanmincountsize", t) } }), Object.defineProperty(psl.sane, "deletefilesbeforescan", { get: function() { return o("deletefilesbeforescan") }, set: function(e) { var t = String(e) .trim(); if ("0" !== t && "1" !== t) throw new Error("deletefilesbeforescan 值范围:0-1,且为整数,当前值:" + t); i("deletefilesbeforescan", t) } }); var g = 0; Object.defineProperty(psl.sane, "showbase64", { get: function() { return o("showbase64") }, set: function(e) { var t = String(e) .trim(); if ("0" !== t && "1" !== t) throw new Error("showbase64 值范围:0-1,且为整数,当前值:" + t); g = Math.floor(Number(t)), i("showbase64", t) } }), Object.defineProperty(psl.sane, "source", { get: function() { return o("source") }, set: function(e) { i("source", String(e) .trim()) } }), Object.defineProperty(psl.sane, "mode", { get: function() { return o("mode") }, set: function(e) { i("mode", String(e) .trim()) } }), Object.defineProperty(psl.sane, "resolution", { get: function() { return o("resolution") }, set: function(e) { i("resolution", String(e) .trim()) } }), Object.defineProperty(psl.sane, "pagewidth", { get: function() { return o("page-width") }, set: function(e) { i("page-width", String(e) .trim()) } }), Object.defineProperty(psl.sane, "pageheight", { get: function() { return o("page-height") }, set: function(e) { i("page-height", String(e) .trim()) } }), Object.defineProperty(psl.sane, "tlx", { get: function() { return o("tl-x") }, set: function(e) { i("tl-x", String(e) .trim()) } }), Object.defineProperty(psl.sane, "tly", { get: function() { return o("tl-y") }, set: function(e) { i("tl-y", String(e) .trim()) } }), Object.defineProperty(psl.sane, "brx", { get: function() { return o("br-x") }, set: function(e) { i("br-x", String(e) .trim()) } }), Object.defineProperty(psl.sane, "bry", { get: function() { return o("br-y") }, set: function(e) { i("br-y", String(e) .trim()) } }), Object.defineProperty(psl.sane, "papersize", { get: function() { return o("paper-size") }, set: function(e) { i("paper-size", String(e) .trim()) } }), Object.defineProperty(psl.sane, "pageauto", { get: function() { return o("page-auto") }, set: function(e) { i("page-auto", r(e)) } }), Object.defineProperty(psl.sane, "pageautopriority", { get: function() { return o("page-auto-priority") }, set: function(e) { i("page-auto-priority", String(e) .trim()) } }), Object.defineProperty(psl.sane, "cropping", { get: function() { return o("cropping") }, set: function(e) { i("cropping", String(e) .trim()) } }), Object.defineProperty(psl.sane, "bgcolor", { get: function() { return o("bgcolor") }, set: function(e) { i("bgcolor", String(e) .trim()) } }), Object.defineProperty(psl.sane, "bwmode", { get: function() { return o("bw-mode") }, set: function(e) { i("bw-mode", String(e) .trim()) } }), Object.defineProperty(psl.sane, "bwidtcsensitivity", { get: function() { return o("bw-idtc-sensitivity") }, set: function(e) { i("bw-idtc-sensitivity", String(e) .trim()) } }), Object.defineProperty(psl.sane, "bwidtcbackgroundthreshold", { get: function() { return o("bw-idtc-background-threshold") }, set: function(e) { i("bw-idtc-background-threshold", String(e) .trim()) } }), Object.defineProperty(psl.sane, "bwsdtcvariance", { get: function() { return o("bw-sdtc-variance") }, set: function(e) { i("bw-sdtc-variance", String(e) .trim()) } }), Object.defineProperty(psl.sane, "threshold", { get: function() { return o("threshold") }, set: function(e) { i("threshold", String(e) .trim()) } }), Object.defineProperty(psl.sane, "brightness", { get: function() { return o("brightness") }, set: function(e) { i("brightness", String(e) .trim()) } }), Object.defineProperty(psl.sane, "contrast", { get: function() { return o("contrast") }, set: function(e) { i("contrast", String(e) .trim()) } }), Object.defineProperty(psl.sane, "shadow", { get: function() { return o("shadow") }, set: function(e) { i("shadow", String(e) .trim()) } }), Object.defineProperty(psl.sane, "highlight", { get: function() { return o("highlight") }, set: function(e) { i("highlight", String(e) .trim()) } }), Object.defineProperty(psl.sane, "gamma", { get: function() { return o("gamma") }, set: function(e) { i("gamma", String(e) .trim()) } }), Object.defineProperty(psl.sane, "multifeeddetection", { get: function() { return o("multifeed-detection") }, set: function(e) { i("multifeed-detection", String(e) .trim()) } }), Object.defineProperty(psl.sane, "mfoverlapping", { get: function() { return o("mf-overlapping") }, set: function(e) { i("mf-overlapping", r(e)) } }), Object.defineProperty(psl.sane, "mflength", { get: function() { return o("mf-length") }, set: function(e) { i("mf-length", r(e)) } }), Object.defineProperty(psl.sane, "prepick", { get: function() { return o("prepick") }, set: function(e) { i("prepick", r(e)) } }), Object.defineProperty(psl.sane, "dropoutcolor", { get: function() { return o("dropoutcolor") }, set: function(e) { i("dropoutcolor", String(e) .trim()) } }), Object.defineProperty(psl.sane, "cleanupsharpness", { get: function() { return o("cleanup-sharpness") }, set: function(e) { i("cleanup-sharpness", String(e) .trim()) } }), Object.defineProperty(psl.sane, "blankpageskip", { get: function() { return o("blank-page-skip") }, set: function(e) { i("blank-page-skip", r(e)) } }), Object.defineProperty(psl.sane, "blankpageskipsensitivity", { get: function() { return o("blank-page-skip-sensitivity") }, set: function(e) { i("blank-page-skip-sensitivity", String(e) .trim()) } }), Object.defineProperty(psl.sane, "jpeg", { get: function() { return o("jpeg") }, set: function(e) { i("jpeg", r(e)) } }), Object.defineProperty(psl.sane, "jpegtype", { get: function() { return o("jpeg-type") }, set: function(e) { i("jpeg-type", String(e) .trim()) } }), Object.defineProperty(psl.sane, "jpegquality", { get: function() { return o("jpeg-quality") }, set: function(e) { i("jpeg-quality", String(e) .trim()) } }), Object.defineProperty(psl.sane, "autofeed", { get: function() { return o("autofeed") }, set: function(e) { i("autofeed", r(e)) } }), Object.defineProperty(psl.sane, "getscstatus", { get: function() { return o("get-sc-status") }, set: function(e) { console.error("%c参数只读,不能进行设置", "color:red") } }), Object.defineProperty(psl.sane, "getscerror", { get: function() { return o("get-sc-error") }, set: function(e) { console.error("%c参数只读,不能进行设置", "color:red") } }), Object.defineProperty(psl.sane, "toneadjustment", { get: function() { return o("tone-adjustment") }, set: function(e) { i("tone-adjustment", String(e) .trim()) } }), Object.defineProperty(psl.sane, "edgerepair", { get: function() { return o("edge-repair") }, set: function(e) { i("edge-repair", r(e)) } }), Object.defineProperty(psl.sane, "holepunchremoval", { get: function() { return o("hole-punch-removal") }, set: function(e) { i("hole-punch-removal", r(e)) } }), Object.defineProperty(psl.sane, "holepunchremovalfillcolor", { get: function() { return o("hole-punch-removal-fillcolor") }, set: function(e) { i("hole-punch-removal-fillcolor", String(e) .trim()) } }), Object.defineProperty(psl.sane, "holepunchremovalmode", { get: function() { return o("hole-punch-removal-mode") }, set: function(e) { i("hole-punch-removal-mode", String(e) .trim()) } }), Object.defineProperty(psl.sane, "rotation", { get: function() { return o("rotation") }, set: function(e) { i("rotation", String(e) .trim()) } }), Object.defineProperty(psl.sane, "splitimage", { get: function() { return o("split-image") }, set: function(e) { i("split-image", r(e)) } }), Object.defineProperty(psl.sane, "frontbackmerging", { get: function() { return o("front-back-merging") }, set: function(e) { i("front-back-merging", r(e)) } }), Object.defineProperty(psl.sane, "backsidelocation", { get: function() { return o("back-side-location") }, set: function(e) { i("back-side-location", String(e) .trim()) } }), Object.defineProperty(psl.sane, "backsiderotation", { get: function() { return o("back-side-rotation") }, set: function(e) { i("back-side-rotation", String(e) .trim()) } }), Object.defineProperty(psl.sane, "colorcleanup", { get: function() { return o("color-cleanup") }, set: function(e) { i("color-cleanup", String(e) .trim()) } }), Object.defineProperty(psl.sane, "colorcleanupcleanness", { get: function() { return o("color-cleanup-cleanness") }, set: function(e) { i("color-cleanup-cleanness", String(e) .trim()) } }), Object.defineProperty(psl.sane, "timescan", { get: function() { return o("time-scan") }, set: function(e) { i("time-scan", r(e)) } }), Object.defineProperty(psl.sane, "intervaltime", { get: function() { return o("interval-time") }, set: function(e) { i("interval-time", String(e) .trim()) } }), Object.defineProperty(psl.sane, "imprinter", { get: function() { return o("imprinter") }, set: function(e) { i("imprinter", String(e) .trim()) } }), Object.defineProperty(psl.sane, "string", { get: function() { return o("string") }, set: function(e) { i("string", String(e) .trim()) } }), Object.defineProperty(psl.sane, "offset", { get: function() { return o("offset") }, set: function(e) { i("offset", String(e) .trim()) } }), Object.defineProperty(psl.sane, "initialcountervalue", { get: function() { return o("initial-counter-value") }, set: function(e) { i("initial-counter-value", String(e) .trim()) } }), Object.defineProperty(psl.sane, "counterstep", { get: function() { return o("counter-step") }, set: function(e) { i("counter-step", String(e) .trim()) } }), Object.defineProperty(psl.sane, "fonttype", { get: function() { return o("font-type") }, set: function(e) { i("font-type", String(e) .trim()) } }), Object.defineProperty(psl.sane, "fontdirection", { get: function() { return o("font-direction") }, set: function(e) { i("font-direction", String(e) .trim()) } }); var d, b, m = "", y = {}, S = {}, O = {}, h = null, j = function() {}, P = function() {}, v = function() {}, w = function() {}, k = function() {}, N = function() {}, D = function() {}, C = function() {}, x = function(e) { console.error("%c" + e, "color:red") }; e.psl.sane.init = s, e.psl.sane.registerevent = c, e.psl.sane.getdevices = a, e.psl.sane.getsettinginfo = u, e.psl.sane.scan = f, e.psl.sane.converttobase64 = p, e.psl.sane.clear = l }(window) }]);