@pisell/private-materials 3.0.61 → 3.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 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(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (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(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, 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; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), 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 ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
- 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); } }
5
- 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(undefined); }); }; }
6
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
7
4
  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."); }
8
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 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(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (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(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, 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; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), 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 ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
8
+ 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); } }
9
+ 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(undefined); }); }; }
10
10
  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; }
11
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).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; }
12
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -20,7 +20,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
20
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
  import React, { useCallback, useContext, useEffect, useMemo, useState } from "react";
22
22
  import Delete_wght300_24px from "@pisell/icon/es/Delete_wght300_24px";
23
- import AlertTriangle from "@pisell/icon/es/AlertTriangle";
24
23
  import Drawer from "../../../components/drawer";
25
24
  import { Context } from "../../model";
26
25
  import { formatAmount, locales } from "@pisell/utils";
@@ -29,11 +28,11 @@ import { Input, Button, Select, Row, Col, Form, Alert, InputNumber } from "antd"
29
28
  import "./index.less";
30
29
  import CollapsibleList from "../../../components/collapsibleList";
31
30
  import { renderBundles } from "../../../components/collapsibleList/utils";
32
- import dayjs from "dayjs";
33
31
  import { useUpdateEffect, useMemoizedFn } from "ahooks";
34
- import { sliceDayIntoFiveMinutes, formatResource, getErrorList, getServiceTimes, getServerItemExtend, deleteCacheParams, getEndDate, flexibleObj, getDuration, getDiscountTime, getServeStartTime } from "../../../utils";
32
+ import { getErrorList, getServiceTimes, deleteCacheParams } from "../../../utils";
35
33
  import Like from "../like";
36
34
  import { getNoResource } from "../../../mock";
35
+ import { formatResources, getDurationProps, getFlexibleOption, getTimeObj } from "../addService/utils";
37
36
  var Info = function Info() {
38
37
  var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$service3, _state$service3$cache, _state$service5, _state$service5$cache, _state$service5$cache2, _state$service5$cache3, _state$service$cacheI5, _state$service6, _state$service6$cache, _state$service6$cache2, _state$service$cacheI6, _state$service$cacheI7, _state$service$cacheI8, _state$service$cacheI9;
39
38
  var _Form$useForm = Form.useForm(),
@@ -51,6 +50,11 @@ var Info = function Info() {
51
50
  var _useContext = useContext(Context),
52
51
  state = _useContext.state,
53
52
  dispatch = _useContext.dispatch;
53
+ // 这里用 undefined false true 作为3个状态进行使用
54
+ var _useState3 = useState(),
55
+ _useState4 = _slicedToArray(_useState3, 2),
56
+ selectOpen = _useState4[0],
57
+ setSelectOpen = _useState4[1];
54
58
 
55
59
  // 当前商品信息+ 表单信息
56
60
  var getCurrentCacheItem = function getCurrentCacheItem() {
@@ -87,18 +91,14 @@ var Info = function Info() {
87
91
  * @Date: 2024-02-23 09:59
88
92
  */
89
93
  var durationProps = useMemo(function () {
90
- var _currentResource$_ext, _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
94
+ var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
91
95
  var _cacheItem = getCurrentCacheItem();
92
- return {
93
- startDate: dayjs(dayjs(_cacheItem._extend.start_date).format("YYYY-MM-DD ") + (getServeStartTime(useStartTime) || "00:00")),
94
- usableTime: currentResource === null || currentResource === void 0 ? void 0 : (_currentResource$_ext = currentResource._extend) === null || _currentResource$_ext === void 0 ? void 0 : _currentResource$_ext.usableTime,
95
- duration: getDuration(_cacheItem === null || _cacheItem === void 0 ? void 0 : _cacheItem.duration),
96
- locale: locales.locale,
97
- slice: (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.service_time,
98
- selectProps: {
99
- size: "large"
100
- }
101
- };
96
+ return getDurationProps({
97
+ cacheItem: _cacheItem,
98
+ useStartTime: useStartTime,
99
+ currentResource: currentResource,
100
+ slice: (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.service_time
101
+ });
102
102
  }, [currentResource, state.service.cacheItem, useStartTime, useResource, (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : (_state$bookingConfig4 = _state$bookingConfig3.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.service_time]);
103
103
 
104
104
  /**
@@ -110,19 +110,9 @@ var Info = function Info() {
110
110
  * @Date: 2024-02-23 10:10
111
111
  */
112
112
  var flexibleOption = useMemo(function () {
113
- var _duration = durationProps.duration;
114
- if (_duration === "flexible") {
115
- var _durationProps$usable, _durationProps$usable2;
116
- // 获取结束时间
117
- var endDate = getEndDate(durationProps.startDate, _duration, (_durationProps$usable = durationProps.usableTime) !== null && _durationProps$usable !== void 0 && _durationProps$usable.end_at ? dayjs((_durationProps$usable2 = durationProps.usableTime) === null || _durationProps$usable2 === void 0 ? void 0 : _durationProps$usable2.end_at) : null);
118
- // 转换为分钟
119
- var timeValue = endDate.diff(durationProps.startDate, "minute");
120
- return {
121
- label: locales.getText("pisell2.text.flexible"),
122
- value: flexibleObj.create(timeValue)
123
- };
124
- }
125
- return null;
113
+ return getFlexibleOption({
114
+ durationProps: durationProps
115
+ });
126
116
  }, [durationProps, locales.locale]);
127
117
 
128
118
  /**
@@ -133,45 +123,12 @@ var Info = function Info() {
133
123
  * @Date: 2024-01-09 13:37
134
124
  */
135
125
  var timeObj = useMemo(function () {
136
- var _state$bookingConfig5, _state$bookingConfig6, _state$bookingConfig7;
137
- var obj = sliceDayIntoFiveMinutes((_state$bookingConfig5 = state.bookingConfig) === null || _state$bookingConfig5 === void 0 ? void 0 : (_state$bookingConfig6 = _state$bookingConfig5.config) === null || _state$bookingConfig6 === void 0 ? void 0 : (_state$bookingConfig7 = _state$bookingConfig6.basic) === null || _state$bookingConfig7 === void 0 ? void 0 : _state$bookingConfig7.service_time, locales.locale);
138
- var timeSlices = _toConsumableArray(obj.timeSlices);
139
- var durationSlicesBasedOnTime = _toConsumableArray(obj.durationSlicesBasedOnTime);
140
-
141
- // 如果商品是灵活时长, 则增加灵活的选项
142
- if (flexibleOption) {
143
- durationSlicesBasedOnTime.unshift(flexibleOption);
144
- }
145
-
146
- // 如果当前设置的时长没有在列表内, 则在列表的最上面添加此项
147
- if (useDuration && !durationSlicesBasedOnTime.some(function (d) {
148
- return d.value === useDuration;
149
- })) {
150
- durationSlicesBasedOnTime.unshift({
151
- label: getDiscountTime(useDuration),
152
- value: useDuration,
153
- //@ts-ignore
154
- disabled: true
155
- });
156
- }
157
- // 如果有选择时间, 但是不在列表内 则需要在列表内添加上此值
158
- if (useStartTime && useStartTime !== "now" && !timeSlices.some(function (d) {
159
- return d.value === useStartTime;
160
- })) {
161
- timeSlices.unshift({
162
- label: dayjs(useStartTime, "HH:mm").format("hh:mm A"),
163
- value: useStartTime
164
- });
165
- }
166
-
167
- // 增加当前
168
- timeSlices.unshift({
169
- label: locales.getText("pisell2.text.now"),
170
- value: "now"
171
- });
172
- return _objectSpread(_objectSpread({}, obj), {}, {
173
- timeSlices: timeSlices,
174
- durationSlicesBasedOnTime: durationSlicesBasedOnTime
126
+ return getTimeObj({
127
+ durationProps: durationProps,
128
+ useStartTime: useStartTime,
129
+ currentResource: currentResource,
130
+ state: state,
131
+ useDuration: useDuration
175
132
  });
176
133
  }, [state, locales.locale, useDuration, useStartTime, flexibleOption]);
177
134
 
@@ -197,93 +154,54 @@ var Info = function Info() {
197
154
  */
198
155
  var getResources = /*#__PURE__*/function () {
199
156
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(cacheItem) {
200
- var data, _list, _cacheItem, _useResource;
157
+ var _state$service$cacheI, _list, autoClose, _cacheItem;
201
158
  return _regeneratorRuntime().wrap(function _callee$(_context) {
202
159
  while (1) switch (_context.prev = _context.next) {
203
160
  case 0:
204
161
  _context.prev = 0;
205
- setResourceLoading(true);
206
- _context.next = 4;
207
- return state.apis.getResources({
208
- skip: 1,
209
- num: 1000,
210
- with_date_times: state.date.value.format("YYYY-MM-DD"),
211
- codes: ["resources", "therapist", "table"],
212
- _config: {
213
- abort: true
214
- }
215
- });
216
- case 4:
217
- data = _context.sent;
218
162
  // 合并无资源
219
- _list = [getNoResource()].concat((data === null || data === void 0 ? void 0 : data.list) || []);
163
+ _list = state.service.resourcesOrigin || [];
164
+ autoClose = (_state$service$cacheI = state.service.cacheItem) === null || _state$service$cacheI === void 0 ? void 0 : _state$service$cacheI.autoClose;
220
165
  _cacheItem = cacheItem || getCurrentCacheItem();
221
166
  if (_cacheItem._extend) {
222
- _context.next = 9;
167
+ _context.next = 6;
223
168
  break;
224
169
  }
225
170
  return _context.abrupt("return");
226
- case 9:
227
- // 格式化, 添加自定义参数
228
- _list = _list.map(function (d) {
229
- return formatResource(d, _cacheItem, function (item) {
230
- return /*#__PURE__*/React.createElement("div", {
231
- className: "resource-option"
232
- }, /*#__PURE__*/React.createElement("div", {
233
- className: "like-wrap"
234
- }), item.labelText, !item.usable && /*#__PURE__*/React.createElement(AlertTriangle, {
235
- className: "resource-option-alert-icon"
236
- }));
237
- });
238
- });
239
- // 排序, 将可用资源放在最前面
240
- _list = _list.sort(function (a, b) {
241
- return b.usable ? 1 : -1;
242
- });
243
- if (useResource) {
244
- // 校验, 如果当前选择的资源 在列表里没找到, 则恢复成无资源, 防止数据错乱
245
- if (!_list.find(function (d) {
246
- return d.form_record_id === useResource;
247
- })) {
248
- form.setFieldsValue({
249
- resource: 0
250
- });
251
- }
252
- } else {
253
- // 如果只有一个资源,并且当前未选择, 则默认选中
254
- _useResource = 0;
255
- if (_list.length === 2 && useResource !== 0) {
256
- _useResource = _list[1].form_record_id;
257
- }
258
- form.setFieldsValue({
259
- resource: _useResource
260
- });
261
- }
171
+ case 6:
262
172
  dispatch({
263
173
  type: "setService",
264
174
  payload: {
265
- resources: _list
175
+ resources: formatResources({
176
+ cacheItem: _cacheItem,
177
+ resourcesOrigin: _list
178
+ })
266
179
  }
267
180
  });
268
- setTimeout(function () {
269
- var _state$service$cacheI;
270
- // 当选中资源 或者 列表只有无资源的时候 那么直接返回
271
- if ((_state$service$cacheI = state.service.cacheItem) !== null && _state$service$cacheI !== void 0 && _state$service$cacheI.autoClose || _list.length === 1 && useResource === 0) {
272
- form.submit();
181
+ if (_cacheItem.new) {
182
+ // 自动关闭的 提交数据, 否则展开资源列表
183
+ if (autoClose) {
184
+ setTimeout(function () {
185
+ form.submit();
186
+ }, 200);
187
+ } else {
188
+ setTimeout(function () {
189
+ if (selectOpen === undefined) {
190
+ setSelectOpen(true);
191
+ }
192
+ }, 500);
273
193
  }
274
- }, 200);
275
- _context.next = 18;
194
+ }
195
+ _context.next = 12;
276
196
  break;
277
- case 16:
278
- _context.prev = 16;
197
+ case 10:
198
+ _context.prev = 10;
279
199
  _context.t0 = _context["catch"](0);
280
- case 18:
281
- setResourceLoading(false);
282
- case 19:
200
+ case 12:
283
201
  case "end":
284
202
  return _context.stop();
285
203
  }
286
- }, _callee, null, [[0, 16]]);
204
+ }, _callee, null, [[0, 10]]);
287
205
  }));
288
206
  return function getResources(_x2) {
289
207
  return _ref.apply(this, arguments);
@@ -414,7 +332,7 @@ var Info = function Info() {
414
332
  * @Date: 2024-01-09 14:04
415
333
  */
416
334
  var onFinish = function onFinish(values) {
417
- var _currentResource$_ext2;
335
+ var _currentResource$_ext;
418
336
  var _list = _toConsumableArray(state.service.value);
419
337
  var _item = _objectSpread(_objectSpread({}, state.service.cacheItem), {}, {
420
338
  autoClose: false,
@@ -428,7 +346,7 @@ var Info = function Info() {
428
346
  endDate = _getServiceTimes.endDate;
429
347
  _extend.startDate = startDate;
430
348
  _extend.endDate = endDate;
431
- var _ref2 = (currentResource === null || currentResource === void 0 ? void 0 : (_currentResource$_ext2 = currentResource._extend) === null || _currentResource$_ext2 === void 0 ? void 0 : _currentResource$_ext2.usableTime) || {},
349
+ var _ref2 = (currentResource === null || currentResource === void 0 ? void 0 : (_currentResource$_ext = currentResource._extend) === null || _currentResource$_ext === void 0 ? void 0 : _currentResource$_ext.usableTime) || {},
432
350
  relation_type = _ref2.relation_type,
433
351
  item_id = _ref2.item_id,
434
352
  schedule_id = _ref2.schedule_id;
@@ -468,13 +386,14 @@ var Info = function Info() {
468
386
  var setEditData = useMemoizedFn(function () {
469
387
  if (state.service.editModal) {
470
388
  var cacheItem = state.service.cacheItem;
471
- var values = getServerItemExtend(state, cacheItem, timeObj);
389
+ var values = cacheItem._extend;
472
390
  form.setFieldsValue(values);
473
391
  if (state.renderType !== "eventBooking") {
474
392
  // 获取资源列表
475
393
  getResources();
476
394
  }
477
395
  } else {
396
+ setSelectOpen(undefined);
478
397
  form.resetFields();
479
398
  }
480
399
  });
@@ -518,7 +437,7 @@ var Info = function Info() {
518
437
  if (useStartTime && useDuration && state.renderType !== "eventBooking") {
519
438
  getResources();
520
439
  }
521
- }, [useStartTime, useDuration, state.renderType]);
440
+ }, [useStartTime, useDuration, state.renderType, state.service.resourcesOrigin]);
522
441
 
523
442
  /**
524
443
  * @title: 打开弹窗时 设置数据
@@ -572,6 +491,55 @@ var Info = function Info() {
572
491
  var _state$service4, _state$service4$cache, _state$service4$cache2, _state$service4$cache3;
573
492
  return ((_state$service4 = state.service) === null || _state$service4 === void 0 ? void 0 : (_state$service4$cache = _state$service4.cacheItem) === null || _state$service4$cache === void 0 ? void 0 : (_state$service4$cache2 = _state$service4$cache._extend) === null || _state$service4$cache2 === void 0 ? void 0 : (_state$service4$cache3 = _state$service4$cache2.other) === null || _state$service4$cache3 === void 0 ? void 0 : _state$service4$cache3.bundle) || [];
574
493
  }, [(_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : (_state$service5$cache = _state$service5.cacheItem) === null || _state$service5$cache === void 0 ? void 0 : (_state$service5$cache2 = _state$service5$cache._extend) === null || _state$service5$cache2 === void 0 ? void 0 : (_state$service5$cache3 = _state$service5$cache2.other) === null || _state$service5$cache3 === void 0 ? void 0 : _state$service5$cache3.bundle]);
494
+
495
+ /**
496
+ * @title: 获取资源列表数据
497
+ * @description:
498
+ * @return {*}
499
+ * @Author: zhiwei.Wang
500
+ * @Date: 2024-01-09 13:38
501
+ */
502
+ var getResourcesData = /*#__PURE__*/function () {
503
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
504
+ var data, _list;
505
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
506
+ while (1) switch (_context2.prev = _context2.next) {
507
+ case 0:
508
+ setResourceLoading(true);
509
+ _context2.next = 3;
510
+ return state.apis.getResources({
511
+ skip: 1,
512
+ num: 1000,
513
+ with_date_times: state.date.value.format("YYYY-MM-DD"),
514
+ codes: ["resources", "therapist", "table"],
515
+ _config: {
516
+ abort: true
517
+ }
518
+ });
519
+ case 3:
520
+ data = _context2.sent;
521
+ // 合并无资源
522
+ _list = [getNoResource()].concat((data === null || data === void 0 ? void 0 : data.list) || []);
523
+ dispatch({
524
+ type: "setService",
525
+ payload: {
526
+ resourcesOrigin: _list
527
+ }
528
+ });
529
+ setResourceLoading(false);
530
+ case 7:
531
+ case "end":
532
+ return _context2.stop();
533
+ }
534
+ }, _callee2);
535
+ }));
536
+ return function getResourcesData() {
537
+ return _ref3.apply(this, arguments);
538
+ };
539
+ }();
540
+ useEffect(function () {
541
+ getResourcesData();
542
+ }, [state.date.value]);
575
543
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Drawer, {
576
544
  zIndex: 1000,
577
545
  forceRender: true,
@@ -715,6 +683,8 @@ var Info = function Info() {
715
683
  size: "large",
716
684
  allowClear: true,
717
685
  showSearch: true,
686
+ open: selectOpen,
687
+ onDropdownVisibleChange: setSelectOpen,
718
688
  filterOption: function filterOption(str, option) {
719
689
  return (option.labelText || "").toLowerCase().includes((str || "").toLowerCase());
720
690
  }
@@ -34,6 +34,7 @@ export interface FormState {
34
34
  editModal: boolean;
35
35
  services: any[];
36
36
  resources: any[];
37
+ resourcesOrigin: any[];
37
38
  value: any[];
38
39
  cacheItem: any;
39
40
  edit: boolean;
@@ -238,7 +238,7 @@ var Footer = (props) => {
238
238
  );
239
239
  }, [isEdit, checkoutLoading, isDisabled, state, source]);
240
240
  const handleMenuClick = async (e) => {
241
- var _a2;
241
+ var _a2, _b2;
242
242
  let id = state.bookingId;
243
243
  let customer = state.bookingDetail.customer;
244
244
  if (isEdit) {
@@ -253,7 +253,8 @@ var Footer = (props) => {
253
253
  id,
254
254
  is_deposit: state.bookingDetail.is_deposit || Number((_a2 = state.bookingDetail) == null ? void 0 : _a2.deposit_amount),
255
255
  deposit_payment_time: state.bookingDetail.deposit_payment_time,
256
- customer
256
+ customer,
257
+ contacts: (_b2 = state.bookingDetail) == null ? void 0 : _b2.contacts
257
258
  },
258
259
  callback: () => {
259
260
  }
@@ -61,7 +61,8 @@ var Deposit = (props) => {
61
61
  id,
62
62
  is_deposit: 1,
63
63
  deposit_payment_time: bookingDetail.deposit_payment_time,
64
- customer: bookingDetail.customer
64
+ customer: bookingDetail.customer,
65
+ contacts: bookingDetail == null ? void 0 : bookingDetail.contacts
65
66
  },
66
67
  callback: () => {
67
68
  }
@@ -43,16 +43,11 @@ var import_index = require("./index.less");
43
43
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
44
44
  var import_serve = require("../serve");
45
45
  var import_utils = require("../../utils");
46
- var import_utils2 = require("../../../utils");
47
- var import_utils3 = require("@pisell/utils");
46
+ var import_utils2 = require("./utils");
47
+ var import_utils3 = require("../../../utils");
48
+ var import_utils4 = require("@pisell/utils");
48
49
  var import_ahooks = require("ahooks");
49
50
  var shopList = [2886, 4422, 5538, 6930, 6814, 6813, 6812, 6087, 6303];
50
- var getCacheResourceId = () => {
51
- const serviceParams = (0, import_utils2.getCacheParams)();
52
- let resId = Number(serviceParams == null ? void 0 : serviceParams.resource_id);
53
- console.log("resIdresIdresId", resId);
54
- return resId;
55
- };
56
51
  var Info = () => {
57
52
  var _a, _b, _c;
58
53
  const [search, setSearch] = (0, import_react.useState)("");
@@ -60,7 +55,7 @@ var Info = () => {
60
55
  const [loading, setLoading] = (0, import_react.useState)(false);
61
56
  const searchRef = (0, import_react.useRef)();
62
57
  const context = (0, import_useEngineContext.default)();
63
- import_utils2.request.setRequest(context.appHelper.utils.request);
58
+ import_utils3.request.setRequest(context.appHelper.utils.request);
64
59
  const setDefaultService = async (list) => {
65
60
  if (state.renderType !== "eventBooking") {
66
61
  return;
@@ -87,7 +82,7 @@ var Info = () => {
87
82
  let _item = {
88
83
  ...product,
89
84
  product_id: product.id,
90
- _id: (0, import_utils3.getUniqueId)(),
85
+ _id: (0, import_utils4.getUniqueId)(),
91
86
  _extend: {
92
87
  start_date: state.date.value,
93
88
  startDate: state.date.value,
@@ -110,11 +105,6 @@ var Info = () => {
110
105
  }
111
106
  });
112
107
  };
113
- const autoAddProduct = async (cacheItem) => {
114
- let resId = getCacheResourceId();
115
- let _cacheItem = { ...cacheItem };
116
- (0, import_utils2.deleteCacheParams)();
117
- };
118
108
  const getServices = async () => {
119
109
  var _a2;
120
110
  setLoading(true);
@@ -172,11 +162,11 @@ var Info = () => {
172
162
  is_eject: isEject ? 1 : 0
173
163
  },
174
164
  callback: (e) => {
175
- var _a2;
165
+ var _a2, _b2;
176
166
  let cacheItem = {
177
167
  ...item,
178
168
  product_id: item.id,
179
- _id: (0, import_utils3.getUniqueId)(),
169
+ _id: (0, import_utils4.getUniqueId)(),
180
170
  _key: e.key,
181
171
  _extend: {
182
172
  start_date: state.date.value,
@@ -187,7 +177,7 @@ var Info = () => {
187
177
  },
188
178
  new: 1
189
179
  };
190
- let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
180
+ let _total = (0, import_utils3.getProductTotalPrice)(cacheItem);
191
181
  cacheItem._extend.total = _total;
192
182
  cacheItem._extend.origin_total = _total;
193
183
  const _isEdit = !!state.service.cacheItem;
@@ -195,9 +185,8 @@ var Info = () => {
195
185
  cacheItem._id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
196
186
  cacheItem.new = 0;
197
187
  }
198
- console.log("_total", cacheItem);
199
- let resId = getCacheResourceId();
200
- cacheItem.autoClose = !!resId;
188
+ cacheItem._extend = (0, import_utils2.getProductExtend)({ cacheItem, state });
189
+ cacheItem.autoClose = cacheItem._extend.resource || cacheItem._extend.resource === 0 || (((_b2 = state.service) == null ? void 0 : _b2.resourcesOrigin) || []).length === 1;
201
190
  dispatch({
202
191
  type: "setService",
203
192
  payload: {
@@ -209,13 +198,14 @@ var Info = () => {
209
198
  }
210
199
  });
211
200
  };
201
+ console.log("state.service.cacheItem", state.service.cacheItem);
212
202
  const renderList = (0, import_react.useMemo)(() => {
213
203
  var _a2;
214
204
  let _list = ((_a2 = state.service) == null ? void 0 : _a2.services) || [];
215
205
  const isIncludes = (str) => {
216
206
  return str.toLowerCase().indexOf(search.toLowerCase()) !== -1;
217
207
  };
218
- return (0, import_utils2.formatProductListByCategory)(
208
+ return (0, import_utils3.formatProductListByCategory)(
219
209
  _list,
220
210
  search ? (item) => isIncludes(item.title) : void 0
221
211
  );
@@ -255,8 +245,8 @@ var Info = () => {
255
245
  {
256
246
  loading,
257
247
  showSub: false,
258
- title: import_utils3.locales.getText("pisell2.text.add-a-service"),
259
- subTitle: import_utils3.locales.getText("pisell2.text.add-another-service"),
248
+ title: import_utils4.locales.getText("pisell2.text.add-a-service"),
249
+ subTitle: import_utils4.locales.getText("pisell2.text.add-another-service"),
260
250
  onClick: handleSelectService
261
251
  }
262
252
  );
@@ -265,8 +255,8 @@ var Info = () => {
265
255
  import_addButton.default,
266
256
  {
267
257
  showSub: isService,
268
- title: import_utils3.locales.getText("pisell2.text.add-a-service"),
269
- subTitle: import_utils3.locales.getText("pisell2.text.add-another-service"),
258
+ title: import_utils4.locales.getText("pisell2.text.add-a-service"),
259
+ subTitle: import_utils4.locales.getText("pisell2.text.add-another-service"),
270
260
  onClick: handleSelectService
271
261
  }
272
262
  ) : /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 20 } });
@@ -281,7 +271,7 @@ var Info = () => {
281
271
  import_drawer.default,
282
272
  {
283
273
  open: state.service.addModal,
284
- title: import_utils3.locales.getText("pisell2.text.select-service"),
274
+ title: import_utils4.locales.getText("pisell2.text.select-service"),
285
275
  rootClassName: "booking-server-wrap",
286
276
  onClose: () => {
287
277
  dispatch({
@@ -297,7 +287,7 @@ var Info = () => {
297
287
  ref: searchRef,
298
288
  prefix: /* @__PURE__ */ import_react.default.createElement(import_SearchLg.default, null),
299
289
  style: { marginTop: 16, height: 44 },
300
- placeholder: import_utils3.locales.getText("pisell2.text.search"),
290
+ placeholder: import_utils4.locales.getText("pisell2.text.search"),
301
291
  allowClear: true,
302
292
  value: search,
303
293
  onChange: (e) => {