import { w as withInstall } from "../badge/index2.js"; import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createCommentVNode, toDisplayString, normalizeClass, ref, watch, onMounted, nextTick, createElementVNode, Fragment, renderList, shallowRef, createTextVNode, createVNode, useSlots, inject, Transition, withCtx, createBlock, renderSlot, h, render, isVNode, getCurrentInstance, onUnmounted, withModifiers } from "vue"; import { t as templateRef } from "../_chunks/@vueuse/index.js"; import { _ as _sfc_main$9 } from "../button/index2.js"; import { C as Cropper } from "../_chunks/cropperjs/index.js"; import { u as useI18n } from "../datePicker/index2.js"; var index$1 = /* @__PURE__ */ (() => '/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{image-orientation:0deg;display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:#3399ffbf;overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}:root{--button-primary-text-color: #fff;--button-primary-background-color: var(--global-primary-color);--button-primary-border-color: var(--global-primary-color);--button-normal-text-color: #fff;--button-normal-background-color: var(--global-normal-color);--button-normal-border-color: var(--global-normal-color);--button-warm-text-color: #fff;--button-warm-background-color: var(--global-warm-color);--button-warm-border-color: var(--global-warm-color);--button-danger-text-color: #fff;--button-danger-background-color: var(--global-danger-color);--button-danger-border-color: var(--global-danger-color);--button-border-radius: var(--global-border-radius);--button-border-color: var(--global-neutral-color-6);--button-background-color: 0 0;--button-text-color: #666}.layui-btn{height:38px;line-height:36px;padding:0 18px;font-size:14px;text-align:center;white-space:nowrap;color:var(--button-text-color);background:var(--button-background-color);border-radius:var(--button-border-radius);border-color:var(--button-border-color);border-width:1px;border-style:solid;cursor:pointer}.layui-btn-primary{color:var(--button-primary-text-color);background-color:var(--button-primary-background-color);border-color:var(--button-primary-border-color)}.layui-btn-normal{color:var(--button-normal-text-color);background-color:var(--button-normal-background-color);border-color:var(--button-normal-border-color)}.layui-btn-warm{color:var(--button-warm-text-color);background-color:var(--button-warm-background-color);border-color:var(--button-warm-border-color)}.layui-btn-danger{color:var(--button-danger-text-color);background-color:var(--button-danger-background-color);border-color:var(--button-danger-border-color)}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80)}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:12px!important}.layui-btn-fluid{width:100%}.layui-btn-radius{border-radius:100px}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border-color:#eee!important;background-color:#fbfbfb!important;color:#d2d2d2!important;cursor:not-allowed!important;opacity:1}.layui-btn+.layui-btn{margin-left:10px}.layui-btn .layui-icon{padding:0 2px;vertical-align:middle\\ ;vertical-align:bottom}.layui-upload-file{opacity:.01;position:relative;filter:alpha(opacity=1);cursor:pointer}.layui-upload-btn-box{position:relative;overflow:hidden}.layui-upload-drag,.layui-upload-form,.layui-upload-wrap{display:inline-block}.layui-upload-list{margin:10px 0}.layui-upload-choose{max-width:200px;padding:0 10px;color:#999;font-size:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-upload-drag{position:relative;padding:30px;border:1px dashed var(--global-neutral-color-4);background-color:#fff;text-align:center;cursor:pointer;color:#999}.layui-upload-drag .layui-icon{font-size:50px;color:var(--global-primary-color)}.layui-upload-drag[lay-over],.layui-upload-drag-draging{border-color:var(--global-primary-color)}.layui-upload-iframe{position:absolute;width:0;height:0;border:0;visibility:hidden}.layui-upload-wrap{position:relative;vertical-align:middle;cursor:pointer}.layui-upload-wrap .layui-upload-file{display:block!important;position:absolute;left:0;top:0;z-index:10;font-size:100px;width:1px;height:1px;opacity:.01;filter:alpha(opacity=1)}.layui-upload-file-disabled{cursor:not-allowed!important}.layui-btn-container .layui-upload-choose{padding-left:0}.layui-upload-drag-disable{opacity:.8;z-index:1;cursor:not-allowed}._lay_upload_img{display:block;max-width:100%}.layui-upload-list-disabled{width:auto;height:auto;pointer-events:none!important;background-color:#fbfbfb!important;filter:opacity(.9)}\n')(); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function() { var self = this, args = arguments; return new Promise(function(resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(void 0); }); }; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof(obj); } var runtime = { exports: {} }; (function(module) { var runtime2 = function(exports) { var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined$1; var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); return obj[key]; } try { define({}, ""); } catch (err) { define = function define2(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } exports.wrap = wrap; function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; var ContinueSentinel = {}; function Generator() { } function GeneratorFunction() { } function GeneratorFunctionPrototype() { } var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function() { return this; }); var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = GeneratorFunctionPrototype; define(Gp, "constructor", GeneratorFunctionPrototype); define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { define(prototype, method, function(arg) { return this._invoke(method, arg); }); }); } exports.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; exports.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; define(genFun, toStringTagSymbol, "GeneratorFunction"); } genFun.prototype = Object.create(Gp); return genFun; }; exports.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { return PromiseImpl.resolve(value.__await).then(function(value2) { invoke("next", value2, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return PromiseImpl.resolve(value).then(function(unwrapped) { result.value = unwrapped; resolve(result); }, function(error) { return invoke("throw", error, resolve, reject); }); } } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); define(AsyncIterator.prototype, asyncIteratorSymbol, function() { return this; }); exports.AsyncIterator = AsyncIterator; exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { if (PromiseImpl === void 0) PromiseImpl = Promise; var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; context.method = "throw"; context.arg = record.arg; } } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (method === undefined$1) { context.delegate = null; if (context.method === "throw") { if (delegate.iterator["return"]) { context.method = "return"; context.arg = undefined$1; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { return ContinueSentinel; } } context.method = "throw"; context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (!info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { context[delegate.resultName] = info.value; context.next = delegate.nextLoc; if (context.method !== "return") { context.method = "next"; context.arg = undefined$1; } } else { return info; } context.delegate = null; return ContinueSentinel; } defineIteratorMethods(Gp); define(Gp, toStringTagSymbol, "Generator"); define(Gp, iteratorSymbol, function() { return this; }); define(Gp, "toString", function() { return "[object Generator]"; }); function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } exports.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); return function next() { while (keys.length) { var key2 = keys.pop(); if (key2 in object) { next.value = key2; next.done = false; return next; } } next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next2() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next2.value = iterable[i]; next2.done = false; return next2; } } next2.value = undefined$1; next2.done = true; return next2; }; return next.next = next; } } return { next: doneResult }; } exports.values = values; function doneResult() { return { value: undefined$1, done: true }; } Context.prototype = { constructor: Context, reset: function reset2(skipTempReset) { this.prev = 0; this.next = 0; this.sent = this._sent = undefined$1; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined$1; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined$1; } } } }, stop: function stop() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; if (caught) { context.method = "next"; context.arg = undefined$1; } return !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function complete(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName, nextLoc }; if (this.method === "next") { this.arg = undefined$1; } return ContinueSentinel; } }; return exports; }(module.exports); try { regeneratorRuntime = runtime2; } catch (accidentalStrictMode) { if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") { globalThis.regeneratorRuntime = runtime2; } else { Function("r", "regeneratorRuntime = r")(runtime2); } } })(runtime); var regenerator = runtime.exports; function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var __default__$6 = { name: "Shade" }; var _sfc_main$7 = defineComponent(_objectSpread$7(_objectSpread$7({}, __default__$6), {}, { props: { opacity: null, index: null, visible: { type: [Boolean, String] } }, emits: ["shadeClick"], setup: function setup(__props, _ref) { var emit = _ref.emit; var props = __props; var styles = computed(function() { return { opacity: props.opacity, zIndex: props.index }; }); var shadeClick = function shadeClick2() { emit("shadeClick"); }; return function(_ctx, _cache) { return __props.visible ? (openBlock(), createElementBlock("div", { key: 0, class: "layui-layer-shade", style: normalizeStyle(unref(styles)), onClick: shadeClick }, null, 4)) : createCommentVNode("", true); }; } })); function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var _hoisted_1$5 = ["src"]; var __default__$5 = { name: "Iframe" }; var _sfc_main$6 = defineComponent(_objectSpread$6(_objectSpread$6({}, __default__$5), {}, { props: { src: null }, setup: function setup2(__props) { var props = __props; var src = computed(function() { return props.src; }); return function(_ctx, _cache) { return openBlock(), createElementBlock("iframe", { scrolling: "auto", class: "layui-layer-iframe", allowtransparency: "true", frameborder: "0", src: unref(src) }, null, 8, _hoisted_1$5); }; } })); function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var _hoisted_1$4 = { class: "layui-layer-title", style: { "cursor": "move" } }; var __default__$4 = { name: "Title" }; var _sfc_main$5 = defineComponent(_objectSpread$5(_objectSpread$5({}, __default__$4), {}, { props: { title: { type: [String, Boolean, Function] } }, setup: function setup3(__props) { var renderContent = function renderContent2(content) { if (typeof content === "function") { return content(); } return content; }; return function(_ctx, _cache) { return openBlock(), createElementBlock("div", _hoisted_1$4, toDisplayString(renderContent(__props.title)), 1); }; } })); function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var __default__$3 = { name: "CloseBtn" }; var _sfc_main$4 = defineComponent(_objectSpread$4(_objectSpread$4({}, __default__$3), {}, { props: { closeBtn: { type: [Number, String, Boolean] } }, emits: ["closeHandle"], setup: function setup4(__props, _ref) { var emit = _ref.emit; var closeHandle = function closeHandle2() { emit("closeHandle"); }; return function(_ctx, _cache) { return openBlock(), createElementBlock("a", { class: normalizeClass(["layui-layer-ico layui-layer-close layui-layer-close" + __props.closeBtn]), href: "javascript:;", onClick: closeHandle }, null, 2); }; } })); var _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; var _sfc_main$3 = { name: "Resize" }; var _hoisted_1$3 = { class: "layui-layer-resize" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", _hoisted_1$3); } var Resize = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]); function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var _hoisted_1$2 = { class: "layui-layer-phimg" }; var _hoisted_2$2 = ["src"]; var _hoisted_3$2 = { key: 0, class: "layui-layer-imgsee" }; var _hoisted_4$1 = { key: 0, class: "layui-layer-imguide" }; var _hoisted_5$1 = { key: 0, class: "thumb-row" }; var _hoisted_6$1 = ["onClick"]; var _hoisted_7$1 = ["src"]; var _hoisted_8 = { key: 1, class: "layui-layer-imgtit" }; var _hoisted_9 = { key: 0 }; var _hoisted_10 = { key: 1 }; var __default__$2 = { name: "Photos" }; var _sfc_main$2 = defineComponent(_objectSpread$3(_objectSpread$3({}, __default__$2), {}, { props: { imgList: null, startIndex: { default: 0 } }, emits: ["resetCalculationPohtosArea"], setup: function setup5(__props, _ref) { var emit = _ref.emit; var props = __props; var index2 = ref(props.startIndex); watch(index2, function() { emit("resetCalculationPohtosArea", index2.value); }); var changeIndex = function changeIndex2(step) { var nowIndex = index2.value; var next = nowIndex + step; if (next < 0) { next = props.imgList.length - 1; } if (next >= props.imgList.length) { next = 0; } index2.value = next; }; var showLayerImgBar = ref(false); onMounted(function() { nextTick(function() { showLayerImgBar.value = true; }); }); var ifSetThumb = computed(function() { var res = false; props.imgList.forEach(function(e) { if (e.thumb) { res = true; } }); return res; }); return function(_ctx, _cache) { return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("img", { src: __props.imgList[index2.value].src }, null, 8, _hoisted_2$2), __props.imgList.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [__props.imgList.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_4$1, [createElementVNode("a", { href: "javascript:;", class: "layui-layer-iconext layui-layer-imgprev", onClick: _cache[0] || (_cache[0] = function($event) { return changeIndex(-1); }) }), createElementVNode("a", { href: "javascript:;", class: "layui-layer-iconext layui-layer-imgnext", onClick: _cache[1] || (_cache[1] = function($event) { return changeIndex(1); }) })])) : createCommentVNode("", true), __props.imgList.length > 1 || __props.imgList[index2.value].alt ? (openBlock(), createElementBlock("div", { key: 1, class: "layui-layer-imgbar", style: normalizeStyle({ opacity: showLayerImgBar.value ? 1 : 0 }) }, [unref(ifSetThumb) ? (openBlock(), createElementBlock("div", _hoisted_5$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.imgList, function(item, i) { return openBlock(), createElementBlock("div", { class: "thumb-box", key: "thumb-box" + i, onClick: function onClick($event) { return index2.value = i; } }, [createElementVNode("img", { src: item.thumb }, null, 8, _hoisted_7$1)], 8, _hoisted_6$1); }), 128)), createElementVNode("div", { class: "thumb-box-border", style: normalizeStyle({ left: "calc(calc( calc(100% - ".concat(100 * __props.imgList.length, "px) / 2) + ").concat(index2.value * 100, "px)") }) }, null, 4)])) : (openBlock(), createElementBlock("span", _hoisted_8, [__props.imgList[index2.value].alt ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(__props.imgList[index2.value].alt), 1)) : createCommentVNode("", true), __props.imgList.length > 1 ? (openBlock(), createElementBlock("em", _hoisted_10, toDisplayString(index2.value + 1) + " / " + toDisplayString(__props.imgList.length), 1)) : createCommentVNode("", true)]))], 4)) : createCommentVNode("", true)])) : createCommentVNode("", true)]); }; } })); function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var _hoisted_1$1 = { class: "title" }; var _hoisted_2$1 = { key: 0, class: "content" }; var _hoisted_3$1 = ["innerHTML"]; var __default__$1 = { name: "Notifiy" }; var _sfc_main$1 = defineComponent(_objectSpread$2(_objectSpread$2({}, __default__$1), {}, { props: { title: null, content: null, isHtmlFragment: { type: Boolean, default: false }, icon: null, iconClass: null }, emits: ["close"], setup: function setup6(__props, _ref) { var emit = _ref.emit; var notifyRef = shallowRef(null); var close2 = function close3() { emit("close"); }; function addClass(obj, cls) { var obj_class = obj.className, blank = obj_class != "" ? " " : ""; var added = obj_class + blank + cls; obj.className = added; } onMounted(function() { nextTick(function() { setTimeout(function() { var _notifyRef$value, _notifyRef$value$pare, _notifyRef$value2, _notifyRef$value2$par; if (!((_notifyRef$value = notifyRef.value) !== null && _notifyRef$value !== void 0 && (_notifyRef$value$pare = _notifyRef$value.parentElement) !== null && _notifyRef$value$pare !== void 0 && _notifyRef$value$pare.parentElement)) return; addClass((_notifyRef$value2 = notifyRef.value) === null || _notifyRef$value2 === void 0 ? void 0 : (_notifyRef$value2$par = _notifyRef$value2.parentElement) === null || _notifyRef$value2$par === void 0 ? void 0 : _notifyRef$value2$par.parentElement, "layui-layer-notifiy-transition"); }, 300); }); }); return function(_ctx, _cache) { return openBlock(), createElementBlock("div", { class: "layui-layer-notifiy-wrapper", ref_key: "notifyRef", ref: notifyRef }, [createElementVNode("h2", _hoisted_1$1, [__props.icon ? (openBlock(), createElementBlock("i", { key: 0, class: normalizeClass(__props.iconClass) }, null, 2)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(__props.title), 1)]), !__props.isHtmlFragment ? (openBlock(), createElementBlock("div", _hoisted_2$1, [createElementVNode("p", null, toDisplayString(__props.content), 1)])) : (openBlock(), createElementBlock("div", { key: 1, class: "content", innerHTML: __props.content }, null, 8, _hoisted_3$1)), createVNode(_sfc_main$4, { onClick: close2 })], 512); }; } })); function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function nextId() { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 16), 1); } s[14] = "4"; s[19] = hexDigits.substr(s[19] & 3 | 8, 1); s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } function calculateArea(type, area, offset) { return type != "drawer" ? calculateBaseArea(area) : calculateDrawerArea(offset, area); } function calculateBaseArea(area) { if (area === "auto") { return []; } if (typeof area == "string") { return [area]; } return _toConsumableArray(area); } function calculateDrawerArea(offset) { var drawerArea = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "30%"; if (drawerArea instanceof Array) { return drawerArea; } if (drawerArea === "auto") { drawerArea = "30%"; } if (offset === "l" || offset === "r") { return [drawerArea, "100%"]; } else if (offset === "t" || offset === "b") { return ["100%", drawerArea]; } return [drawerArea, "100%"]; } function calculateOffset(offset, area, type) { var arr = ["t", "r", "b", "l", "lt", "lb", "rt", "rb"]; var t = offset[0]; var l = offset[1]; if (offset instanceof Array && type === "drawer") { offset = "r"; } if (arr.indexOf(offset) > -1) { t = "50%"; l = "50%"; } if (arr.indexOf(offset) != -1 || t.indexOf("%") > -1) t = "calc(" + t + " - (" + (area === "auto" ? "100px" : area[1]) + "/2 ))"; if (arr.indexOf(offset) != -1 || l.indexOf("%") > -1) l = "calc(" + l + " - (" + (area === "auto" ? "100px" : area[0]) + "/2 ))"; if (offset === "t") t = "0px"; else if (offset === "r") l = "calc(100% - " + area[0] + ")"; else if (offset === "b") t = "calc(100% - " + area[1] + ")"; else if (offset === "l") l = "0px"; else if (offset === "lt") { t = "0px"; l = "0px"; } else if (offset === "lb") { t = "calc(100% - " + area[1] + ")"; l = "0px"; } else if (offset === "rt") { t = "0px"; l = "calc(100% - " + area[0] + ")"; } else if (offset === "rb") { t = "calc(100% - " + area[1] + ")"; l = "calc(100% - " + area[0] + ")"; } return [t, l]; } function calculateType(modalType) { if (modalType === "dialog" || modalType == 0) { return 0; } else if (modalType === "page" || modalType == 1) { return 1; } else if (modalType === "iframe" || modalType == 2) { return 2; } else if (modalType === "loading" || modalType == 3) { return 3; } else if (modalType === "drawer" || modalType == 4) { return 4; } else if (modalType === "photos" || modalType == 5) { return 5; } else if (modalType === "notifiy" || modalType == 6) { return 6; } return 0; } function calculateContent(title2, height, btn, type, isMessage) { if (height && height.indexOf("%") != -1) { height = "100%"; } if (btn && btn.length > 0) { if (type == 0) { if (title2) { return "calc(" + height + " - 137px)"; } else { return "calc(" + height + " - 86px)"; } } if (type == 1 || type == 4) { if (title2) { return "calc(" + height + " - 102px)"; } else { return "calc(" + height + " - 51px)"; } } if (type == 2) { if (title2) { return "calc(" + height + " - 102px)"; } else { return "calc(" + height + " - 51px)"; } } } else { if (type == 0) { if (title2) { return isMessage ? "" : "calc(" + height + " - 137px)"; } else { return isMessage ? "" : "calc(" + height + " - 86px)"; } } if (type == 1 || type == 4) { if (title2) { return "calc(" + height + " - 51px)"; } else { return "calc(" + height + " - 0px)"; } } if (type == 2) { if (title2) { return "calc(" + height + " - 51px)"; } else { return "calc(" + height + " - 0px)"; } } } } function maxArea() { return { w: "100%", h: "100%" }; } function maxOffset() { return { t: "0px", l: "0px" }; } function minArea() { return { w: "180px", h: "51px" }; } function minOffset(left) { return { t: "calc(100% - 51px)", l: left + "px" }; } function getArea(dom) { var width = getComputedStyle(dom, null).width; var height = getComputedStyle(dom, null).height; return [width, height]; } var minArrays = []; function updateMinArrays(id, state) { var i = 0; if (state) { var index2 = minArrays.findIndex(function(v) { return v === void 0; }); if (index2 === -1) { minArrays.push(id); i = minArrays.length - 1; } else { minArrays[index2] = id; i = index2; } } else { delete minArrays[minArrays.findIndex(function(v) { return v == id; })]; i = -1; } return i; } function getDrawerAnimationClass(offset) { var isClose = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var prefix = "layer-drawer-anim layer-anim"; var suffix = "rl"; if (offset === "l") { suffix = "lr"; } else if (offset === "r") { suffix = "rl"; } else if (offset === "t") { suffix = "tb"; } else if (offset === "b") { suffix = "bt"; } return isClose ? "".concat(prefix, "-").concat(suffix, "-close") : "".concat(prefix, "-").concat(suffix); } function calculatePhotosArea(_x, _x2) { return _calculatePhotosArea.apply(this, arguments); } function _calculatePhotosArea() { _calculatePhotosArea = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee(url, options) { var img, area; return regenerator.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: area = function _area(img2) { var imgarea = [img2.width, img2.height]; var winarea = [window.innerWidth - 250, window.innerHeight - 250]; if (imgarea[0] > winarea[0] || imgarea[1] > winarea[1]) { var wh = [imgarea[0] / winarea[0], imgarea[1] / winarea[1]]; if (wh[0] > wh[1]) { imgarea[0] = imgarea[0] / wh[0]; imgarea[1] = imgarea[1] / wh[0]; } else if (wh[0] < wh[1]) { imgarea[0] = imgarea[0] / wh[1]; imgarea[1] = imgarea[1] / wh[1]; } } return [imgarea[0] + "px", imgarea[1] + "px"]; }; img = new Image(); img.src = url; return _context.abrupt("return", new Promise(function(resolve, reject) { if (img.complete) { resolve(area(img)); return; } var layerId = layer.load(2); img.onload = function() { layer.close(layerId); resolve(area(img)); }; img.onerror = function() { layer.close(layerId); layer.msg("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"); reject(false); }; })); case 4: case "end": return _context.stop(); } } }, _callee); })); return _calculatePhotosArea.apply(this, arguments); } function calculateNotifOffset(offset, area, layerId) { var arr = ["lt", "lb", "rt", "rb"]; var t = "0", l = "0"; var transOffsetLeft = 15; var transOffsetTop = 15; window.NotifiyQueen = window.NotifiyQueen || []; var notifiyQueen = window.NotifiyQueen; if (typeof offset != "string" || arr.indexOf(offset) === -1) { offset = "rt"; } var nodeList = notifiyQueen.filter(function(e) { if (e.offset === offset) { return e; } }); var prevNode = nodeList.length > 0 ? nodeList[nodeList.length - 1] : null; if (prevNode) { var _document$getElementB, _document$getElementB2; prevNode = (_document$getElementB = document.getElementById(prevNode["id"])) === null || _document$getElementB === void 0 ? void 0 : (_document$getElementB2 = _document$getElementB.firstElementChild) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.firstElementChild; if (offset === "rt" || offset === "lt") { transOffsetTop += prevNode.offsetHeight + parseFloat(prevNode.style["top"]); } else { var bottom = parseFloat(prevNode.style["top"].split(" - ")[1]); transOffsetTop += prevNode.offsetHeight + bottom; } } else { if (offset === "rb" || offset === "lb") { transOffsetTop += parseFloat(area[1]); } } if (offset === "rt") { t = transOffsetTop + "px"; l = "calc(100% - " + (parseFloat(area[0]) + transOffsetLeft) + "px)"; } else if (offset === "rb") { t = "calc(100vh - " + transOffsetTop + "px)"; l = "calc(100% - " + (parseFloat(area[0]) + transOffsetLeft) + "px)"; } else if (offset === "lt") { t = transOffsetTop + "px"; l = transOffsetLeft + "px"; } else if (offset === "lb") { t = "calc(100vh - " + transOffsetTop + "px)"; l = transOffsetLeft + "px"; } notifiyQueen.push({ id: layerId, offset }); return [t, l]; } function removeNotifiyFromQueen(layerId) { var _document$getElementB3, _document$getElementB4; var transOffsetTop = 15; var notifiyDom = (_document$getElementB3 = document.getElementById(layerId)) === null || _document$getElementB3 === void 0 ? void 0 : (_document$getElementB4 = _document$getElementB3.firstElementChild) === null || _document$getElementB4 === void 0 ? void 0 : _document$getElementB4.firstElementChild; var offsetHeight = notifiyDom.offsetHeight; window.NotifiyQueen = window.NotifiyQueen || []; var notifiyQueen = window.NotifiyQueen; var index2 = notifiyQueen.findIndex(function(e) { return e.id === layerId; }); var offsetType = notifiyQueen[index2].offset; var list = notifiyQueen.filter(function(e) { if (e.offset === offsetType) { return e; } }); var findIndex = list.findIndex(function(e) { return e.id === layerId; }); var needCalculatelist = list.slice(findIndex + 1); needCalculatelist.forEach(function(e) { var _document$getElementB5, _document$getElementB6; var dom = (_document$getElementB5 = document.getElementById(e.id)) === null || _document$getElementB5 === void 0 ? void 0 : (_document$getElementB6 = _document$getElementB5.firstElementChild) === null || _document$getElementB6 === void 0 ? void 0 : _document$getElementB6.firstElementChild; if (offsetType === "rt" || offsetType === "lt") { dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px"; } else { var bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight; dom.style["top"] = "calc(100vh - " + bottom + "px)"; } }); notifiyQueen.splice(index2, 1); } function getNotifyAnimationClass(offset) { var prefix = "layer-drawer-anim layer-anim"; var suffix = ""; if (offset === "lt" || offset === "lb") { suffix = "lr"; } else { suffix = "rl"; } return "".concat(prefix, "-").concat(suffix); } var useMove$1 = function useMove(el, callback) { if (el != null) { el.addEventListener("mousedown", function(event) { var path = event.composedPath && event.composedPath() || event.path; if (path[0].className === "layui-layer-resize") { if (event.button == 0 && el != null) { var x = el.offsetLeft; var y = el.offsetTop; var move = function move2(moveEvent) { if (el != null) { var offsetX = moveEvent.clientX; var offsetY = moveEvent.clientY; var w = offsetX - x; var h2 = offsetY - y; w < 260 && (w = 260); h2 < 115 && (h2 = 115); el.style.width = "".concat(w, "px"); el.style.height = "".concat(h2, "px"); callback(el.style.width, el.style.height); } return false; }; document.addEventListener("mousemove", move); var stop = function stop2() { document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", stop2); }; document.addEventListener("mouseup", stop); } } return false; }); } }; var useMove2 = function useMove3(el, callback) { el.style.position = "fixed"; var offsetX; var offsetY; if (el != null) { el.addEventListener("mousedown", function(event) { var path = event.composedPath && event.composedPath() || event.path; if (path[0].className === "layui-layer-title") { if (event.button == 0 && el != null) { var lexObj = getComputedStyle(el); offsetX = event.pageX - el.offsetLeft + parseInt(lexObj["margin-left"]); offsetY = event.pageY - el.offsetTop + parseInt(lexObj["margin-right"]); var move = function move2(event2) { if (el != null) { var x = event2.pageX - offsetX; var y = event2.pageY - offsetY; if (x < 0) { x = 0; } else if (x > document.documentElement.clientWidth - el.offsetWidth) { x = document.documentElement.clientWidth - el.offsetWidth; } if (y < 0) { y = 0; } else if (y > document.documentElement.clientHeight - el.offsetHeight) { y = document.documentElement.clientHeight - el.offsetHeight; } el.style.left = "".concat(x, "px"); el.style.top = "".concat(y, "px"); callback(el.style.left, el.style.top); } return false; }; document.addEventListener("mousemove", move); var stop = function stop2() { document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", stop2); }; document.addEventListener("mouseup", stop); } } return false; }); } }; var zIndexKey = Symbol("zIndex"); function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var _hoisted_1$6 = ["innerHTML"]; var _hoisted_2$3 = { key: 1, class: "layui-layer-setwin" }; var _hoisted_3$3 = { key: 0 }; var _hoisted_4$2 = ["onClick"]; var __default__$7 = { name: "LayLayer" }; var _sfc_main$8 = defineComponent(_objectSpread$1(_objectSpread$1({}, __default__$7), {}, { props: { id: null, title: { type: [String, Boolean, Function], default: "\u6807\u9898" }, icon: null, skin: null, zIndex: null, setTop: { type: Boolean, default: false }, offset: { default: function _default() { return ["50%", "50%"]; } }, area: { default: "auto" }, modelValue: { type: Boolean, default: false }, maxmin: { type: [Boolean, String], default: false }, btn: { type: [Array, Boolean] }, move: { type: [Boolean, String], default: true }, resize: { type: [Boolean, String], default: false }, type: { default: 1 }, content: null, isHtmlFragment: { type: Boolean, default: false }, shade: { type: [Boolean, String], default: true }, shadeClose: { type: [Boolean, String], default: true }, shadeOpacity: { default: "0.1" }, closeBtn: { type: [Boolean, String], default: "1" }, btnAlign: { default: "r" }, time: { default: 0 }, load: { default: 0 }, anim: { default: 0 }, isOutAnim: { type: Boolean, default: true }, destroy: { type: Function, default: function _default2() { } }, success: { type: Function, default: function _default3() { } }, end: { type: Function, default: function _default4() { } }, yes: null, yesText: { default: "\u786E\u5B9A" }, isFunction: { type: Boolean, default: false }, isMessage: { type: Boolean, default: false }, appContext: null, startIndex: { default: 0 }, imgList: { default: function _default5() { return []; } }, min: { type: Function, default: function _default6() { } }, full: { type: Function, default: function _default7() { } }, restore: { type: Function, default: function _default8() { } } }, emits: ["close", "update:modelValue"], setup: function setup7(__props, _ref) { var _props$zIndex; var expose = _ref.expose, emit = _ref.emit; var props = __props; var slots = useSlots(); var max = ref(false); var min = ref(false); var id = ref(props.id || nextId()); var layero = ref(null); var type = calculateType(props.type); var area = ref(calculateArea(props.type, props.area, props.offset)); var offset = ref(calculateOffset(props.offset, area.value, props.type)); var contentHeight = ref(calculateContent(props.title, area.value[1], props.btn, type, props.isMessage)); var index2 = ref((_props$zIndex = props.zIndex) !== null && _props$zIndex !== void 0 ? _props$zIndex : inject(zIndexKey, 99999)); var visible = ref(false); var first = ref(true); var w = ref(area.value[0]); var h2 = ref(area.value[1]); var t = ref(offset.value[0]); var l = ref(offset.value[1]); var _w = ref(area.value[0]); var _h = ref(area.value[0]); var _t = ref(offset.value[0]); var _l = ref(offset.value[1]); var firstOpenDelayCalculation = function firstOpenDelayCalculation2() { nextTick(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee() { return regenerator.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: area.value = getArea(layero.value); if (type == 4) { area.value = calculateDrawerArea(props.offset, props.area); } if (!(type == 5)) { _context.next = 6; break; } _context.next = 5; return calculatePhotosArea(props.imgList[props.startIndex].src, props); case 5: area.value = _context.sent; case 6: offset.value = calculateOffset(props.offset, area.value, props.type); if (type == 6) { offset.value = calculateNotifOffset(props.offset, area.value, id.value); } w.value = area.value[0]; h2.value = area.value[1]; _w.value = area.value[0]; _l.value = area.value[1]; t.value = offset.value[0]; l.value = offset.value[1]; _t.value = offset.value[0]; _l.value = offset.value[1]; supportMove(); case 17: case "end": return _context.stop(); } } }, _callee); }))); }; var notFirstOpenLayerInit = function notFirstOpenLayerInit2() { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; supportMove(); }; var beforeCloseSaveData = function beforeCloseSaveData2() { if (min.value) minHandle(); if (max.value) maxHandle(); _w.value = w.value; _h.value = h2.value; _t.value = t.value; _l.value = l.value; }; var maxHandle = function maxHandle2() { if (max.value) { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; props.restore(props.id); } else { _t.value = t.value; _l.value = l.value; _w.value = w.value; _h.value = h2.value; w.value = maxArea().w; h2.value = maxArea().h; t.value = maxOffset().t; l.value = maxOffset().l; props.full(props.id); } max.value = !max.value; }; var minHandle = function minHandle2() { var left = 180 * updateMinArrays(id.value, !min.value); if (left > document.documentElement.clientWidth - 180) { left = document.documentElement.clientWidth - 180; } if (min.value) { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; props.restore(props.id); } else { _w.value = w.value; _h.value = h2.value; _t.value = t.value; _l.value = l.value; h2.value = minArea().h; w.value = minArea().w; t.value = minOffset(left).t; l.value = minOffset(left).l; props.min(props.id); } min.value = !min.value; }; var reset2 = function reset3() { if (!first.value) { min.value = false; max.value = false; w.value = area.value[0]; h2.value = area.value[1]; t.value = offset.value[0]; l.value = offset.value[1]; _w.value = area.value[0]; _h.value = area.value[1]; _t.value = offset.value[0]; _l.value = offset.value[1]; } if (!props.modelValue) { emit("update:modelValue", true); } }; watch(function() { return props.modelValue; }, function() { visible.value = props.modelValue; if (visible.value) { if (first.value) { first.value = false; firstOpenDelayCalculation(); } else { notFirstOpenLayerInit(); } } else { beforeCloseSaveData(); } }, { deep: true, immediate: true }); watch(function() { return visible.value; }, function() { if (visible.value) { if (props.isFunction) { firstOpenDelayCalculation(); } props.success(); } }, { immediate: true }); watch(function() { return visible.value; }, function() { if (!visible.value) { props.end(); } }); watch(function() { return h2.value; }, function() { contentHeight.value = calculateContent(props.title, h2.value, props.btn, type, props.isMessage); }); var boxClasses = computed(function() { return [{ "layui-layer-dialog": type === 0, "layui-layer-page": type === 1, "layui-layer-iframe": type === 2, "layui-layer-loading": type === 3, "layui-layer-drawer": type === 4, "layui-layer-photos": type === 5, "layui-layer-notifiy": type === 6, "layui-layer-msg": props.isMessage, "layui-layer-hui": props.isMessage && !props.icon }, props.skin]; }); var supportMove = function supportMove2() { if (props.move && type != 4) { nextTick(function() { if (!layero.value) return; useMove2(layero.value, function(left, top) { l.value = left; t.value = top; }); useMove$1(layero.value, function(width, height) { h2.value = height; w.value = width; }); }); } }; var styles = computed(function() { var style = { top: t.value, left: l.value, width: w.value, height: h2.value, zIndex: index2.value }; return style; }); var contentClasses = computed(function() { return [type === 3 ? "layui-layer-loading".concat(props.load) : "", props.icon ? "layui-layer-padding" : ""]; }); var closeHandle = function closeHandle2() { emit("close"); emit("update:modelValue", false); props.destroy(); if (type === 6) { removeNotifiyFromQueen(props.id); } }; var yesHandle = function yesHandle2() { if (props.yes != void 0) props.yes(); else closeHandle(); }; var shadeHandle = function shadeHandle2() { if (props.shadeClose) closeHandle(); }; var renderContent = function renderContent2(content) { if (content instanceof Function) { return content(); } return content; }; var iconClass = computed(function() { return ["layui-layer-ico", "layui-layer-ico".concat(props.icon)]; }); var enterActiveClass = computed(function() { if (type === 4) { return getDrawerAnimationClass(props.offset); } if (type === 6) { return getNotifyAnimationClass(props.offset); } return "layer-anim layer-anim-0".concat(props.anim); }); var leaveActiveClass = computed(function() { if (type === 4) { return getDrawerAnimationClass(props.offset, true); } return props.isOutAnim ? "layer-anim-close" : ""; }); var open2 = function open3() { visible.value = true; }; var close2 = function close3() { visible.value = false; }; var shadeVisible = computed(function() { return visible.value && props.shade && !min.value; }); var showResize = computed(function() { return props.resize && !max.value && !min.value; }); var showTitle = computed(function() { return props.title && props.type != 3 && props.type != 5 && props.type != 6; }); var resetCalculationPohtosArea = function resetCalculationPohtosArea2(index22) { nextTick(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee2() { return regenerator.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return calculatePhotosArea(props.imgList[index22].src, props); case 2: area.value = _context2.sent; offset.value = calculateOffset(props.offset, area.value, props.type); w.value = area.value[0]; h2.value = area.value[1]; t.value = offset.value[0]; l.value = offset.value[1]; _w.value = area.value[0]; _l.value = area.value[1]; _t.value = offset.value[0]; _l.value = offset.value[1]; case 12: case "end": return _context2.stop(); } } }, _callee2); }))); }; expose({ reset: reset2, open: open2, close: close2 }); return function(_ctx, _cache) { return openBlock(), createElementBlock("div", null, [createVNode(_sfc_main$7, { index: index2.value, visible: unref(shadeVisible), opacity: __props.shadeOpacity, onShadeClick: shadeHandle }, null, 8, ["index", "visible", "opacity"]), createVNode(Transition, { "enter-active-class": unref(enterActiveClass), "leave-active-class": unref(leaveActiveClass) }, { default: withCtx(function() { return [visible.value ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "layero", ref: layero, class: normalizeClass(["layui-layer layui-layer-border", unref(boxClasses)]), style: normalizeStyle(unref(styles)) }, [unref(showTitle) ? (openBlock(), createBlock(_sfc_main$5, { key: 0, title: __props.title }, null, 8, ["title"])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(["layui-layer-content", unref(contentClasses)]), style: normalizeStyle({ height: contentHeight.value }) }, [unref(type) === 0 || unref(type) === 1 || unref(type) === 4 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.icon ? (openBlock(), createElementBlock("i", { key: 0, class: normalizeClass(unref(iconClass)) }, null, 2)) : createCommentVNode("", true), unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [__props.isHtmlFragment ? (openBlock(), createElementBlock("span", { key: 0, innerHTML: renderContent(props.content) }, null, 8, _hoisted_1$6)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(renderContent(props.content)), 1)], 64))], 64))], 64)) : createCommentVNode("", true), unref(type) === 2 ? (openBlock(), createBlock(_sfc_main$6, { key: 1, src: props.content }, null, 8, ["src"])) : createCommentVNode("", true), unref(type) === 5 ? (openBlock(), createBlock(_sfc_main$2, { key: 2, imgList: props.imgList, startIndex: props.startIndex, onResetCalculationPohtosArea: resetCalculationPohtosArea }, null, 8, ["imgList", "startIndex"])) : createCommentVNode("", true), unref(type) === 6 ? (openBlock(), createBlock(_sfc_main$1, { key: 3, onClose: closeHandle, title: props.title, content: props.content, isHtmlFragment: props.isHtmlFragment, icon: props.icon, iconClass: unref(iconClass) }, null, 8, ["title", "content", "isHtmlFragment", "icon", "iconClass"])) : createCommentVNode("", true)], 6), unref(type) != 3 && unref(type) != 5 && unref(type) != 6 ? (openBlock(), createElementBlock("span", _hoisted_2$3, [__props.maxmin && !max.value ? (openBlock(), createElementBlock("a", { key: 0, class: normalizeClass(["layui-layer-min", [min.value ? "layui-layer-ico layui-layer-maxmin" : ""]]), href: "javascript:;", onClick: minHandle }, [!min.value ? (openBlock(), createElementBlock("cite", _hoisted_3$3)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), __props.maxmin && !min.value ? (openBlock(), createElementBlock("a", { key: 1, class: normalizeClass(["layui-layer-ico layui-layer-max", [max.value ? "layui-layer-maxmin" : ""]]), href: "javascript:;", onClick: maxHandle }, null, 2)) : createCommentVNode("", true), __props.closeBtn != false ? (openBlock(), createBlock(_sfc_main$4, { key: 2, "close-btn": __props.closeBtn, onCloseHandle: closeHandle }, null, 8, ["close-btn"])) : createCommentVNode("", true)])) : createCommentVNode("", true), (__props.btn && __props.btn.length > 0 || unref(type) === 0) && !__props.isMessage ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(["layui-layer-btn", ["layui-layer-btn-".concat(__props.btnAlign)]]) }, [__props.btn && __props.btn.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.btn, function(b, index22) { return openBlock(), createElementBlock("a", { key: index22, class: normalizeClass(["layui-layer-btn".concat(index22)]), onClick: function onClick($event) { return b.callback(id.value); } }, toDisplayString(b.text), 11, _hoisted_4$2); }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(type) === 0 ? (openBlock(), createElementBlock("a", { key: 0, class: "layui-layer-btn0", onClick: _cache[0] || (_cache[0] = function($event) { return yesHandle(); }) }, toDisplayString(__props.yesText), 1)) : createCommentVNode("", true)], 64))], 2)) : createCommentVNode("", true), unref(showResize) ? (openBlock(), createBlock(Resize, { key: 3 })) : createCommentVNode("", true)], 6)) : createCommentVNode("", true)]; }), _: 3 }, 8, ["enter-active-class", "leave-active-class"])]); }; } })); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function(key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var layerInstance = []; var addInstance = function addInstance2(instance) { layerInstance.push(instance); }; var delInstance = function delInstance2(id) { layerInstance.forEach(function(item, index2) { if (item.modalContainer.id === id) { layerInstance.splice(index2, 1); } }); }; var cleanInstance = function cleanInstance2() { layerInstance.splice(0, layerInstance.length); }; var isExist = function isExist2(id) { var b = false; layerInstance.forEach(function(item, index2) { if (item.modalContainer.id == id) { b = true; } }); return b; }; var findById = function findById2(id) { var instance = null; layerInstance.forEach(function(item, index2) { if (item.modalContainer.id === id) { instance = item; } }); return instance; }; var mergeOption = function mergeOption2(option, defaultOption) { if (option) defaultOption = Object.assign(defaultOption, option); return defaultOption; }; var createContainer = function createContainer2(options) { var modalContainer = document.createElement("div"); modalContainer.id = options.id; document.body.appendChild(modalContainer); return modalContainer; }; var modalChildrenVNode = function modalChildrenVNode2(content) { if (typeof content === "function") { return isVNode(content()) ? { default: function _default9() { return content(); } } : void 0; } return isVNode(content) ? { default: function _default9() { return content; } } : void 0; }; var layer = { _context: null, open: function open(option, callback) { var defaultOption = {}; return layer.create(option, defaultOption, callback); }, drawer: function drawer(option, callback) { var defaultOption = { type: "drawer" }; return layer.create(option, defaultOption, callback); }, msg: function msg(message, option, callback) { var defaultOption = { type: 0, title: false, content: message, closeBtn: false, shadeClose: false, isMessage: true, shade: false, time: 1e3, btn: false }; return layer.create(option, defaultOption, callback); }, load: function load(_load, option, callback) { var defaultOption = { type: 3, load: _load, anim: 5, isOutAnim: false, shadeClose: false }; return layer.create(option, defaultOption, callback); }, confirm: function confirm(msg2, option, callback) { var defaultOption = { type: 0, content: msg2, shadeClose: false }; return layer.create(option, defaultOption, callback); }, photos: function photos(option, callback) { if (typeof option === "string") { option = { imgList: [{ src: option }] }; } var defaultOption = { type: 5, anim: 2, startIndex: 0, isOutAnim: true, shadeClose: true, shadeOpacity: "0.7" }; return layer.create(option, defaultOption, callback); }, notifiy: function notifiy() { var option = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback = arguments.length > 1 ? arguments[1] : void 0; option.type = 6; var defaultOption = { offset: "rt", time: 2e3, area: "auto", shade: false }; return layer.create(option, defaultOption, callback); }, create: function create(option, defaultOption, callback) { var _modalInstance$compon3, _modalInstance$compon4; var timer; var options = mergeOption(option, defaultOption); if (options.hasOwnProperty("id")) { layer.close(options.id); } else { options.id = nextId(); } var modalContainer = createContainer(options); var modalInstance = h(_sfc_main$8, _objectSpread(_objectSpread({}, options), {}, { isFunction: true, destroy: function destroy() { var _modalInstance$compon, _modalInstance$compon2; clearTimeout(timer); (_modalInstance$compon = modalInstance.component) === null || _modalInstance$compon === void 0 ? void 0 : (_modalInstance$compon2 = _modalInstance$compon.exposed) === null || _modalInstance$compon2 === void 0 ? void 0 : _modalInstance$compon2.close(); setTimeout(function() { render(null, modalContainer); if (document.body.contains(modalContainer)) { document.body.removeChild(modalContainer); } }, 2e3); delInstance(modalContainer.id); } }), modalChildrenVNode(options.content)); modalInstance.appContext = options.appContext || layer._context; render(modalInstance, modalContainer); (_modalInstance$compon3 = modalInstance.component) === null || _modalInstance$compon3 === void 0 ? void 0 : (_modalInstance$compon4 = _modalInstance$compon3.exposed) === null || _modalInstance$compon4 === void 0 ? void 0 : _modalInstance$compon4.open(); if (defaultOption && defaultOption.time != void 0 && defaultOption.time != 0) { timer = setTimeout(function() { var _modalInstance$compon5, _modalInstance$compon6; (_modalInstance$compon5 = modalInstance.component) === null || _modalInstance$compon5 === void 0 ? void 0 : (_modalInstance$compon6 = _modalInstance$compon5.exposed) === null || _modalInstance$compon6 === void 0 ? void 0 : _modalInstance$compon6.close(); if (callback) callback(modalContainer.id); setTimeout(function() { render(null, modalContainer); if (document.body.contains(modalContainer)) { document.body.removeChild(modalContainer); } }, 2e3); delInstance(modalContainer.id); if (options.type === 6) { removeNotifiyFromQueen(options.id); } }, defaultOption.time); } addInstance({ modalContainer, modalInstance }); return modalContainer.id; }, close: function close(id) { if (id != null && isExist(id)) { var _instance$modalInstan, _instance$modalInstan2; var instance = findById(id); (_instance$modalInstan = instance.modalInstance.component) === null || _instance$modalInstan === void 0 ? void 0 : (_instance$modalInstan2 = _instance$modalInstan.exposed) === null || _instance$modalInstan2 === void 0 ? void 0 : _instance$modalInstan2.close(); setTimeout(function() { render(null, instance.modalContainer); if (document.body.contains(instance.modalContainer)) document.body.removeChild(instance.modalContainer); }, 2e3); } delInstance(id); }, closeAll: function closeAll() { layerInstance.forEach(function(item) { var _item$modalInstance$c, _item$modalInstance$c2; (_item$modalInstance$c = item.modalInstance.component) === null || _item$modalInstance$c === void 0 ? void 0 : (_item$modalInstance$c2 = _item$modalInstance$c.exposed) === null || _item$modalInstance$c2 === void 0 ? void 0 : _item$modalInstance$c2.close(); setTimeout(function() { render(null, item.modalContainer); if (document.body.contains(item.modalContainer)) document.body.removeChild(item.modalContainer); }, 2e3); }); cleanInstance(); }, reset: function reset(instance) { var _instance$modalInstan3, _instance$modalInstan4; (_instance$modalInstan3 = instance.modalInstance.component) === null || _instance$modalInstan3 === void 0 ? void 0 : (_instance$modalInstan4 = _instance$modalInstan3.exposed) === null || _instance$modalInstan4 === void 0 ? void 0 : _instance$modalInstan4.reset(); } }; var install = function install2(app, options) { layer._context = app._context; app.component(_sfc_main$8.name, _sfc_main$8); app.config.globalProperties.$layer = layer; if (options) { app.provide(zIndexKey, options.zIndex); } }; var index = { install }; const _hoisted_1 = ["name", "field", "multiple", "accept", "disabled"]; const _hoisted_2 = { key: 0 }; const _hoisted_3 = ["onClick"]; const _hoisted_4 = ["onClick"]; const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon" }, "\uE67C", -1); const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", { class: "layui-hide", id: "uploadDemoView" }, [ /* @__PURE__ */ createElementVNode("hr"), /* @__PURE__ */ createElementVNode("img", { src: "", alt: "\u4E0A\u4F20\u6210\u529F\u540E\u6E32\u67D3", style: { "max-width": "196px" } }) ], -1); const _hoisted_7 = ["src", "id"]; const __default__ = { name: "LayUpload" }; const _sfc_main = defineComponent({ ...__default__, props: { url: null, data: null, headers: null, acceptMime: { default: "MIME_type" }, field: { default: "file" }, size: { default: 0 }, multiple: { type: Boolean, default: false }, number: { default: 0 }, drag: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, disabledPreview: { type: Boolean, default: false }, cut: { type: Boolean, default: false }, cutOptions: { default: void 0 }, text: null, dragText: null, modelValue: { default: null }, auto: { type: Boolean, default: true } }, emits: [ "choose", "chooseAfter", "before", "done", "error", "cutdone", "cutcancel", "update:modelValue" ], setup(__props, { emit }) { const props = __props; const getCutDownResult = () => { if (_cropper) { const canvas = _cropper.getCroppedCanvas(); let imgData = canvas.toDataURL('"image/png"'); let currentTimeStamp = new Date().valueOf(); let orgInfo = activeUploadFiles.value[0]; emit("cutdone", Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo })); let newFile = dataURLtoFile(imgData); if (!props.auto) { emit("update:modelValue", [newFile]); clearLightCutEffect(); return; } commonUploadTransaction([newFile]); nextTick(() => clearAllCutEffect()); } else { errorF(cutInitErrorMsg.value); } }; const closeCutDownModal = () => { let currentTimeStamp = new Date().valueOf(); emit("cutcancel", Object.assign({ currentTimeStamp })); nextTick(() => clearAllCutEffect()); }; const clearAllCutEffect = () => { activeUploadFiles.value = []; activeUploadFilesImgs.value = []; innerCutVisible.value = false; orgFileInput.value.value = ""; _cropper = null; }; const clearLightCutEffect = () => { activeUploadFiles.value = []; activeUploadFilesImgs.value = []; innerCutVisible.value = false; _cropper = null; }; const { t } = useI18n(); const text = computed(() => { return props.text ? props.text : t("upload.text"); }); const dragText = computed(() => { return props.dragText ? props.dragText : t("upload.dragText"); }); const defaultErrorMsg = computed(() => t("upload.defaultErrorMsg")); const urlErrorMsg = computed(() => t("upload.urlErrorMsg")); const numberErrorMsg = computed(() => t("upload.numberErrorMsg")); const occurFileSizeErrorMsg = computed(() => t("upload.occurFileSizeErrorMsg")); const cutInitErrorMsg = computed(() => t("upload.cutInitErrorMsg")); const uploadSuccess = computed(() => t("upload.uploadSuccess")); const startUploadMsg = computed(() => t("upload.startUploadMsg")); const cannotSupportCutMsg = computed(() => t("upload.cannotSupportCutMsg")); const title = computed(() => t("upload.title")); const confirmBtn = computed(() => t("upload.confirmBtn")); const cancelBtn = computed(() => t("upload.cancelBtn")); let defaultCutLayerOption = computed(() => { return { type: "component", title: title.value, shade: true, shadeClose: true, area: ["640px", "640px"], btn: [ { text: confirmBtn.value, callback: getCutDownResult }, { text: cancelBtn.value, callback: closeCutDownModal } ] }; }); const slot = useSlots(); slot.default && slot.default(); getCurrentInstance(); watch(() => props.modelValue, () => { if (!props.modelValue) { clearAllCutEffect(); } }); const isDragEnter = ref(false); const activeUploadFiles = ref([]); const activeUploadFilesImgs = ref([]); const orgFileInput = templateRef("orgFileInput"); let _cropper = null; let computedCutLayerOption; if (props.cutOptions && props.cutOptions.layerOption) { computedCutLayerOption = computed(() => Object.assign(defaultCutLayerOption, props.cutOptions.layerOption)); } else { computedCutLayerOption = computed(() => defaultCutLayerOption.value); } const innerCutVisible = ref(false); const localUploadTransaction = (option) => { const { url, files } = option; let formData = new FormData(); if (url.length <= 5) { errorF(urlErrorMsg.value); return; } if (Array.isArray(files) && files.length > 0) { for (let i = 0; i < files.length; i++) { let _file = files[i]; formData.append(props.field + "[" + i + "]", _file); } } if (props.data && props.data instanceof Object) { let _requestDate = props.data; for (const key in _requestDate) { formData.append(key, _requestDate[key]); } } let utimer = window.setTimeout(() => { localUpload({ url, formData }, function() { clearTimeout(utimer); }); }, 200); }; const dataURLtoFile = (dataurl) => { let arr = dataurl.split(","); let mime = ""; if (arr.length > 0) { mime = arr[0].match(/:(.*?);/)[1]; } let bstr = atob(arr[1]); let n = bstr.length; let u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new Blob([u8arr], { type: mime }); }; const errorF = (errorText) => { let currentTimeStamp = new Date().valueOf(); let errorMsg = errorText ? errorText : defaultErrorMsg; errorMsg = `layui-vue:${errorMsg}`; console.warn(errorMsg); layer.msg(errorMsg, { icon: 2, time: 1e3 }, function(res) { }); emit("error", Object.assign({ currentTimeStamp, msg: errorMsg })); }; const localUpload = (option, callback) => { let xhr = new XMLHttpRequest(); let url = option.url; let formData = option.formData; const cb = callback; xhr.onreadystatechange = function() { let currentTimeStamp2 = new Date().valueOf(); if (xhr.readyState === 1) { if (xhr.status >= 200 && xhr.status <= 300 || xhr.status === 304 || xhr.status == 0) { let successText = startUploadMsg.value; emit("before", Object.assign({ currentTimeStamp: currentTimeStamp2, msg: successText, ...option })); } } else if (xhr.readyState === 4) { let successText = xhr.responseText ? xhr.responseText : uploadSuccess; if (xhr.status >= 200 && xhr.status <= 300 || xhr.status === 304 || xhr.status == 0) { let data = xhr.responseText; emit("done", { currentTimeStamp: currentTimeStamp2, msg: successText, data }); } } }; xhr.open("post", url, true); if (props.headers) { for (let key in props.headers) { xhr.setRequestHeader(key, props.headers[key]); } } else { xhr.setRequestHeader("Accept", "application/json, text/javascript"); } let currentTimeStamp = new Date().valueOf(); emit("before", Object.assign(option, currentTimeStamp)); xhr.send(formData); if (cb && typeof cb == "function") { cb(); } clearAllCutEffect(); }; const filetoDataURL = (file, fn) => { const reader = new FileReader(); reader.onloadend = function(e) { fn(e.target.result); }; reader.readAsDataURL(file); }; const uploadChange = (e) => { e.preventDefault(); const _files = [...e.target.files || e.dataTransfer.files]; if (props.multiple && props.number != 0 && props.number < _files.length) { errorF(numberErrorMsg.value); return; } if (props.size && props.size != 0) { for (let i = 0; i < _files.length; i++) { let _file = _files[i]; let _size = _file.size; if (_size > props.size * 1024) { errorF(occurFileSizeErrorMsg.value); return; } } } for (let item of _files) { activeUploadFiles.value.push(item); filetoDataURL(item, function(res) { activeUploadFilesImgs.value.push(res); }); } let arm1 = props.cut && props.acceptMime.indexOf("image") != -1 && props.multiple == false; let arm2 = props.cut && props.acceptMime.indexOf("image") != -1 && props.multiple == true; if (arm1) { innerCutVisible.value = true; setTimeout(() => { let _imgs = document.getElementsByClassName("_lay_upload_img"); if (_imgs && _imgs.length > 0) { let _img = _imgs[0]; _cropper = new Cropper(_img, { aspectRatio: 16 / 9 }); } else { clearAllCutEffect(); } }, 200); } else { if (arm2) { console.warn(cannotSupportCutMsg.value); } if (!props.auto) { emit("update:modelValue", _files); return; } commonUploadTransaction(_files); } }; const commonUploadTransaction = (_files) => { let currentTimeStamp = new Date().valueOf(); let successText = uploadSuccess; if (props.url) { localUploadTransaction({ url: props.url, files: _files }); } else { emit("done", { currentTimeStamp, msg: successText, data: _files }); clearAllCutEffect(); } }; const chooseFile = () => { let _target = orgFileInput.value; if (_target) { _target.click(); } }; const clickOrgInput = () => { let currentTimeStamp = new Date().valueOf(); emit("choose", currentTimeStamp); }; const dragRef = ref(); function dragEnter(e) { e.stopPropagation(); e.preventDefault(); } function dragOver(e) { e.stopPropagation(); e.preventDefault(); } onMounted(() => { nextTick(() => { if (dragRef.value) { dragRef.value.addEventListener("dragenter", dragEnter, false); dragRef.value.addEventListener("dragover", dragOver, false); dragRef.value.addEventListener("drop", uploadChange, false); } }); }); onUnmounted(() => { if (dragRef.value) { dragRef.value.removeEventListener("dragenter"); dragRef.value.removeEventListener("dragover"); dragRef.value.removeEventListener("drop"); } }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["layui-upload layui-upload-wrap", __props.disabledPreview ? "layui-upload-file-disabled" : ""]) }, [ createElementVNode("input", { type: "file", class: "layui-upload-file", ref_key: "orgFileInput", ref: orgFileInput, name: __props.field, field: __props.field, multiple: __props.multiple, accept: __props.acceptMime, disabled: __props.disabled, onClick: clickOrgInput, onChange: uploadChange }, null, 40, _hoisted_1), !__props.drag ? (openBlock(), createElementBlock("div", _hoisted_2, [ createElementVNode("div", { class: "layui-upload-btn-box", onClick: withModifiers(chooseFile, ["stop"]) }, [ unref(slot).default ? renderSlot(_ctx.$slots, "default", { key: 0, disabled: __props.disabled }) : (openBlock(), createBlock(_sfc_main$9, { key: 1, type: "primary", disabled: __props.disabled }, { default: withCtx(() => [ createTextVNode(toDisplayString(unref(text)), 1) ]), _: 1 }, 8, ["disabled"])) ], 8, _hoisted_3) ])) : (openBlock(), createElementBlock("div", { key: 1, ref_key: "dragRef", ref: dragRef, class: normalizeClass([ "layui-upload-drag", __props.disabled ? "layui-upload-drag-disable" : isDragEnter.value ? "layui-upload-drag-draging" : "" ]), onClick: withModifiers(chooseFile, ["stop"]) }, [ _hoisted_5, createElementVNode("p", null, toDisplayString(unref(dragText)), 1), _hoisted_6 ], 10, _hoisted_4)), createVNode(unref(_sfc_main$8), { modelValue: innerCutVisible.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => innerCutVisible.value = $event), title: unref(computedCutLayerOption).title, move: unref(computedCutLayerOption).move, resize: unref(computedCutLayerOption).resize, shade: unref(computedCutLayerOption).shade, shadeClose: unref(computedCutLayerOption).shadeClose, shadeOpacity: unref(computedCutLayerOption).shadeOpacity, zIndex: unref(computedCutLayerOption).zIndex, btnAlign: unref(computedCutLayerOption).btnAlign, area: unref(computedCutLayerOption).area, anim: unref(computedCutLayerOption).anim, isOutAnim: unref(computedCutLayerOption).isOutAnim, btn: unref(computedCutLayerOption).btn, onClose: clearAllCutEffect }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(activeUploadFilesImgs.value, (base64str, index2) => { return openBlock(), createElementBlock("div", { class: "copper-container", key: `file${index2}` }, [ createElementVNode("img", { src: base64str, id: `_lay_upload_img${index2}`, class: "_lay_upload_img" }, null, 8, _hoisted_7) ]); }), 128)) ]), _: 1 }, 8, ["modelValue", "title", "move", "resize", "shade", "shadeClose", "shadeOpacity", "zIndex", "btnAlign", "area", "anim", "isOutAnim", "btn"]), createElementVNode("div", { class: normalizeClass(["layui-upload-list", __props.disabledPreview ? "layui-upload-list-disabled" : ""]) }, [ renderSlot(_ctx.$slots, "preview") ], 2) ], 2); }; } }); const component = withInstall(_sfc_main); export { component as c, index as i, layer as l };