Changeset 2606273
- Timestamp:
- 09/28/2021 03:07:14 PM (4 years ago)
- Location:
- myloyal/trunk
- Files:
-
- 21 added
- 16 edited
-
assets/js/app.js (modified) (3 diffs)
-
core/action-runner.php (modified) (3 diffs)
-
core/ajax-action.php (modified) (2 diffs)
-
core/badge-actions.php (added)
-
core/data-case-hooks.php (added)
-
core/data-point-rules.php (modified) (8 diffs)
-
core/functions.php (added)
-
core/hooks (added)
-
core/hooks/edit-comment.php (added)
-
core/hooks/save-post.php (added)
-
core/hooks/user-register.php (added)
-
core/hooks/wp-head.php (added)
-
core/hooks/wp-insert-comment.php (added)
-
core/hooks/wp-login.php (added)
-
core/instance-post.php (added)
-
core/instance-user.php (added)
-
core/meta-panel.php (modified) (3 diffs)
-
core/options.php (modified) (1 diff)
-
core/point-processor.php (modified) (2 diffs)
-
core/point-rule.php (modified) (1 diff)
-
core/user-actions.php (modified) (2 diffs)
-
instance (added)
-
instance/log.php (added)
-
migrations/badge-user.php (added)
-
migrations/log.php (added)
-
models (added)
-
models/badge-user.php (added)
-
models/log.php (added)
-
myloyal.php (modified) (5 diffs)
-
package-lock.json (modified) (2 diffs)
-
package.json (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
resources/js/app.js (modified) (1 diff)
-
shortcodes (added)
-
shortcodes/user-profile.php (added)
-
templates/admin/partials/badge-meta-panel.php (modified) (1 diff)
-
templates/admin/point-rules.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
myloyal/trunk/assets/js/app.js
r2596776 r2606273 87 87 /******/ ({ 88 88 89 /***/ "./node_modules/@vue/composition-api/dist/vue-composition-api.mjs": 90 /*!************************************************************************!*\ 91 !*** ./node_modules/@vue/composition-api/dist/vue-composition-api.mjs ***! 92 \************************************************************************/ 93 /*! exports provided: default, EffectScope, computed, createApp, createRef, customRef, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isRaw, isReactive, isReadonly, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCSSModule, useCssModule, useSlots, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect */ 94 /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { 95 96 "use strict"; 97 __webpack_require__.r(__webpack_exports__); 98 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EffectScope", function() { return EffectScope; }); 99 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computed", function() { return computed; }); 100 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createApp", function() { return createApp; }); 101 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRef", function() { return createRef; }); 102 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "customRef", function() { return customRef; }); 103 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defineAsyncComponent", function() { return defineAsyncComponent; }); 104 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defineComponent", function() { return defineComponent; }); 105 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "del", function() { return del; }); 106 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "effectScope", function() { return effectScope; }); 107 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrentInstance", function() { return getCurrentInstance; }); 108 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrentScope", function() { return getCurrentScope; }); 109 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return createElement; }); 110 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return inject; }); 111 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRaw", function() { return isRaw; }); 112 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReactive", function() { return isReactive; }); 113 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReadonly", function() { return isReadonly; }); 114 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRef", function() { return isRef; }); 115 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "markRaw", function() { return markRaw; }); 116 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nextTick", function() { return nextTick; }); 117 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onActivated", function() { return onActivated; }); 118 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onBeforeMount", function() { return onBeforeMount; }); 119 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onBeforeUnmount", function() { return onBeforeUnmount; }); 120 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onBeforeUpdate", function() { return onBeforeUpdate; }); 121 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onDeactivated", function() { return onDeactivated; }); 122 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorCaptured", function() { return onErrorCaptured; }); 123 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onMounted", function() { return onMounted; }); 124 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onScopeDispose", function() { return onScopeDispose; }); 125 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onServerPrefetch", function() { return onServerPrefetch; }); 126 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onUnmounted", function() { return onUnmounted; }); 127 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onUpdated", function() { return onUpdated; }); 128 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "provide", function() { return provide; }); 129 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "proxyRefs", function() { return proxyRefs; }); 130 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reactive", function() { return reactive; }); 131 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readonly", function() { return readonly; }); 132 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ref", function() { return ref; }); 133 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set$1; }); 134 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shallowReactive", function() { return shallowReactive; }); 135 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shallowReadonly", function() { return shallowReadonly; }); 136 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shallowRef", function() { return shallowRef; }); 137 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRaw", function() { return toRaw; }); 138 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRef", function() { return toRef; }); 139 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRefs", function() { return toRefs; }); 140 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "triggerRef", function() { return triggerRef; }); 141 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unref", function() { return unref; }); 142 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useAttrs", function() { return useAttrs; }); 143 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useCSSModule", function() { return useCSSModule; }); 144 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useCssModule", function() { return useCssModule; }); 145 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useSlots", function() { return useSlots; }); 146 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); 147 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warn", function() { return warn; }); 148 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "watch", function() { return watch; }); 149 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "watchEffect", function() { return watchEffect; }); 150 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "watchPostEffect", function() { return watchPostEffect; }); 151 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "watchSyncEffect", function() { return watchSyncEffect; }); 152 /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); 153 154 155 var toString = function (x) { return Object.prototype.toString.call(x); }; 156 function isNative(Ctor) { 157 return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); 158 } 159 var hasSymbol = typeof Symbol !== 'undefined' && 160 isNative(Symbol) && 161 typeof Reflect !== 'undefined' && 162 isNative(Reflect.ownKeys); 163 var noopFn = function (_) { return _; }; 164 function proxy(target, key, _a) { 165 var get = _a.get, set = _a.set; 166 Object.defineProperty(target, key, { 167 enumerable: true, 168 configurable: true, 169 get: get || noopFn, 170 set: set || noopFn, 171 }); 172 } 173 function def(obj, key, val, enumerable) { 174 Object.defineProperty(obj, key, { 175 value: val, 176 enumerable: !!enumerable, 177 writable: true, 178 configurable: true, 179 }); 180 } 181 function hasOwn(obj, key) { 182 return Object.hasOwnProperty.call(obj, key); 183 } 184 function assert(condition, msg) { 185 if (!condition) { 186 throw new Error("[vue-composition-api] " + msg); 187 } 188 } 189 function isPrimitive(value) { 190 return (typeof value === 'string' || 191 typeof value === 'number' || 192 // $flow-disable-line 193 typeof value === 'symbol' || 194 typeof value === 'boolean'); 195 } 196 function isArray(x) { 197 return Array.isArray(x); 198 } 199 var objectToString = Object.prototype.toString; 200 var toTypeString = function (value) { 201 return objectToString.call(value); 202 }; 203 var isMap = function (val) { 204 return toTypeString(val) === '[object Map]'; 205 }; 206 var isSet = function (val) { 207 return toTypeString(val) === '[object Set]'; 208 }; 209 var MAX_VALID_ARRAY_LENGTH = 4294967295; // Math.pow(2, 32) - 1 210 function isValidArrayIndex(val) { 211 var n = parseFloat(String(val)); 212 return (n >= 0 && 213 Math.floor(n) === n && 214 isFinite(val) && 215 n <= MAX_VALID_ARRAY_LENGTH); 216 } 217 function isObject(val) { 218 return val !== null && typeof val === 'object'; 219 } 220 function isPlainObject(x) { 221 return toString(x) === '[object Object]'; 222 } 223 function isFunction(x) { 224 return typeof x === 'function'; 225 } 226 function isUndef(v) { 227 return v === undefined || v === null; 228 } 229 function warn$1(msg, vm) { 230 vue__WEBPACK_IMPORTED_MODULE_0__.util.warn(msg, vm); 231 } 232 function logError(err, vm, info) { 233 if ((true)) { 234 warn$1("Error in " + info + ": \"" + err.toString() + "\"", vm); 235 } 236 if (typeof window !== 'undefined' && typeof console !== 'undefined') { 237 console.error(err); 238 } 239 else { 240 throw err; 241 } 242 } 243 244 /*! ***************************************************************************** 245 Copyright (c) Microsoft Corporation. 246 247 Permission to use, copy, modify, and/or distribute this software for any 248 purpose with or without fee is hereby granted. 249 250 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 251 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 252 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 253 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 254 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 255 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 256 PERFORMANCE OF THIS SOFTWARE. 257 ***************************************************************************** */ 258 /* global Reflect, Promise */ 259 260 var extendStatics = function(d, b) { 261 extendStatics = Object.setPrototypeOf || 262 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 263 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 264 return extendStatics(d, b); 265 }; 266 267 function __extends(d, b) { 268 if (typeof b !== "function" && b !== null) 269 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 270 extendStatics(d, b); 271 function __() { this.constructor = d; } 272 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 273 } 274 275 var __assign = function() { 276 __assign = Object.assign || function __assign(t) { 277 for (var s, i = 1, n = arguments.length; i < n; i++) { 278 s = arguments[i]; 279 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 280 } 281 return t; 282 }; 283 return __assign.apply(this, arguments); 284 }; 285 286 function __values(o) { 287 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 288 if (m) return m.call(o); 289 if (o && typeof o.length === "number") return { 290 next: function () { 291 if (o && i >= o.length) o = void 0; 292 return { value: o && o[i++], done: !o }; 293 } 294 }; 295 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 296 } 297 298 function __read(o, n) { 299 var m = typeof Symbol === "function" && o[Symbol.iterator]; 300 if (!m) return o; 301 var i = m.call(o), r, ar = [], e; 302 try { 303 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 304 } 305 catch (error) { e = { error: error }; } 306 finally { 307 try { 308 if (r && !r.done && (m = i["return"])) m.call(i); 309 } 310 finally { if (e) throw e.error; } 311 } 312 return ar; 313 } 314 315 function __spreadArray(to, from) { 316 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) 317 to[j] = from[i]; 318 return to; 319 } 320 321 /** 322 * Displays a warning message (using console.error) with a stack trace if the 323 * function is called inside of active component. 324 * 325 * @param message warning message to be displayed 326 */ 327 function warn(message) { 328 var _a; 329 warn$1(message, (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy); 330 } 331 332 var activeEffectScope; 333 var effectScopeStack = []; 334 var EffectScopeImpl = /** @class */ (function () { 335 function EffectScopeImpl(vm) { 336 this.active = true; 337 this.effects = []; 338 this.cleanups = []; 339 this.vm = vm; 340 } 341 EffectScopeImpl.prototype.run = function (fn) { 342 if (this.active) { 343 try { 344 this.on(); 345 return fn(); 346 } 347 finally { 348 this.off(); 349 } 350 } 351 else if ((true)) { 352 warn("cannot run an inactive effect scope."); 353 } 354 return; 355 }; 356 EffectScopeImpl.prototype.on = function () { 357 if (this.active) { 358 effectScopeStack.push(this); 359 activeEffectScope = this; 360 } 361 }; 362 EffectScopeImpl.prototype.off = function () { 363 if (this.active) { 364 effectScopeStack.pop(); 365 activeEffectScope = effectScopeStack[effectScopeStack.length - 1]; 366 } 367 }; 368 EffectScopeImpl.prototype.stop = function () { 369 if (this.active) { 370 this.vm.$destroy(); 371 this.effects.forEach(function (e) { return e.stop(); }); 372 this.cleanups.forEach(function (cleanup) { return cleanup(); }); 373 this.active = false; 374 } 375 }; 376 return EffectScopeImpl; 377 }()); 378 var EffectScope = /** @class */ (function (_super) { 379 __extends(EffectScope, _super); 380 function EffectScope(detached) { 381 if (detached === void 0) { detached = false; } 382 var _this = this; 383 var vm = undefined; 384 withCurrentInstanceTrackingDisabled(function () { 385 vm = defineComponentInstance(getVueConstructor()); 386 }); 387 _this = _super.call(this, vm) || this; 388 if (!detached) { 389 recordEffectScope(_this); 390 } 391 return _this; 392 } 393 return EffectScope; 394 }(EffectScopeImpl)); 395 function recordEffectScope(effect, scope) { 396 var _a; 397 scope = scope || activeEffectScope; 398 if (scope && scope.active) { 399 scope.effects.push(effect); 400 return; 401 } 402 // destory on parent component unmounted 403 var vm = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy; 404 vm && vm.$on('hook:destroyed', function () { return effect.stop(); }); 405 } 406 function effectScope(detached) { 407 return new EffectScope(detached); 408 } 409 function getCurrentScope() { 410 return activeEffectScope; 411 } 412 function onScopeDispose(fn) { 413 if (activeEffectScope) { 414 activeEffectScope.cleanups.push(fn); 415 } 416 else if ((true)) { 417 warn("onScopeDispose() is called when there is no active effect scope" + 418 " to be associated with."); 419 } 420 } 421 /** 422 * @internal 423 **/ 424 function getCurrentScopeVM() { 425 var _a, _b; 426 return ((_a = getCurrentScope()) === null || _a === void 0 ? void 0 : _a.vm) || ((_b = getCurrentInstance()) === null || _b === void 0 ? void 0 : _b.proxy); 427 } 428 /** 429 * @internal 430 **/ 431 function bindCurrentScopeToVM(vm) { 432 if (!vm.scope) { 433 var scope_1 = new EffectScopeImpl(vm.proxy); 434 vm.scope = scope_1; 435 vm.proxy.$on('hook:destroyed', function () { return scope_1.stop(); }); 436 } 437 return vm.scope; 438 } 439 440 var vueDependency = undefined; 441 try { 442 var requiredVue = require('vue'); 443 if (requiredVue && isVue(requiredVue)) { 444 vueDependency = requiredVue; 445 } 446 else if (requiredVue && 447 'default' in requiredVue && 448 isVue(requiredVue.default)) { 449 vueDependency = requiredVue.default; 450 } 451 } 452 catch (_a) { 453 // not available 454 } 455 var vueConstructor = null; 456 var currentInstance = null; 457 var currentInstanceTracking = true; 458 var PluginInstalledFlag = '__composition_api_installed__'; 459 function isVue(obj) { 460 return obj && isFunction(obj) && obj.name === 'Vue'; 461 } 462 function isVueRegistered(Vue) { 463 return hasOwn(Vue, PluginInstalledFlag); 464 } 465 function getVueConstructor() { 466 if ((true)) { 467 assert(vueConstructor, "must call Vue.use(VueCompositionAPI) before using any function."); 468 } 469 return vueConstructor; 470 } 471 // returns registered vue or `vue` dependency 472 function getRegisteredVueOrDefault() { 473 var constructor = vueConstructor || vueDependency; 474 if ((true)) { 475 assert(constructor, "No vue dependency found."); 476 } 477 return constructor; 478 } 479 function setVueConstructor(Vue) { 480 // @ts-ignore 481 if (( true) && vueConstructor && Vue.__proto__ !== vueConstructor.__proto__) { 482 warn$1('[vue-composition-api] another instance of Vue installed'); 483 } 484 vueConstructor = Vue; 485 Object.defineProperty(Vue, PluginInstalledFlag, { 486 configurable: true, 487 writable: true, 488 value: true, 489 }); 490 } 491 /** 492 * For `effectScope` to create instance without populate the current instance 493 * @internal 494 **/ 495 function withCurrentInstanceTrackingDisabled(fn) { 496 var prev = currentInstanceTracking; 497 currentInstanceTracking = false; 498 try { 499 fn(); 500 } 501 finally { 502 currentInstanceTracking = prev; 503 } 504 } 505 function setCurrentInstance(instance) { 506 if (!currentInstanceTracking) 507 return; 508 var prev = currentInstance; 509 prev === null || prev === void 0 ? void 0 : prev.scope.off(); 510 currentInstance = instance; 511 currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope.on(); 512 } 513 function getCurrentInstance() { 514 return currentInstance; 515 } 516 var instanceMapCache = new WeakMap(); 517 function toVue3ComponentInstance(vm) { 518 if (instanceMapCache.has(vm)) { 519 return instanceMapCache.get(vm); 520 } 521 var instance = { 522 proxy: vm, 523 update: vm.$forceUpdate, 524 uid: vm._uid, 525 // $emit is defined on prototype and it expected to be bound 526 emit: vm.$emit.bind(vm), 527 parent: null, 528 root: null, // to be immediately set 529 }; 530 bindCurrentScopeToVM(instance); 531 // map vm.$props = 532 var instanceProps = [ 533 'data', 534 'props', 535 'attrs', 536 'refs', 537 'vnode', 538 'slots', 539 ]; 540 instanceProps.forEach(function (prop) { 541 proxy(instance, prop, { 542 get: function () { 543 return vm["$" + prop]; 544 }, 545 }); 546 }); 547 proxy(instance, 'isMounted', { 548 get: function () { 549 // @ts-expect-error private api 550 return vm._isMounted; 551 }, 552 }); 553 proxy(instance, 'isUnmounted', { 554 get: function () { 555 // @ts-expect-error private api 556 return vm._isDestroyed; 557 }, 558 }); 559 proxy(instance, 'isDeactivated', { 560 get: function () { 561 // @ts-expect-error private api 562 return vm._inactive; 563 }, 564 }); 565 proxy(instance, 'emitted', { 566 get: function () { 567 // @ts-expect-error private api 568 return vm._events; 569 }, 570 }); 571 instanceMapCache.set(vm, instance); 572 if (vm.$parent) { 573 instance.parent = toVue3ComponentInstance(vm.$parent); 574 } 575 if (vm.$root) { 576 instance.root = toVue3ComponentInstance(vm.$root); 577 } 578 return instance; 579 } 580 581 function getCurrentInstanceForFn(hook, target) { 582 target = target || getCurrentInstance(); 583 if (( true) && !target) { 584 warn$1(hook + " is called when there is no active component instance to be " + 585 "associated with. " + 586 "Lifecycle injection APIs can only be used during execution of setup()."); 587 } 588 return target; 589 } 590 function defineComponentInstance(Ctor, options) { 591 if (options === void 0) { options = {}; } 592 var silent = Ctor.config.silent; 593 Ctor.config.silent = true; 594 var vm = new Ctor(options); 595 Ctor.config.silent = silent; 596 return vm; 597 } 598 function isComponentInstance(obj) { 599 var Vue = getVueConstructor(); 600 return Vue && obj instanceof Vue; 601 } 602 function createSlotProxy(vm, slotName) { 603 return (function () { 604 var args = []; 605 for (var _i = 0; _i < arguments.length; _i++) { 606 args[_i] = arguments[_i]; 607 } 608 if (!vm.$scopedSlots[slotName]) { 609 if ((true)) 610 return warn$1("slots." + slotName + "() got called outside of the \"render()\" scope", vm); 611 return; 612 } 613 return vm.$scopedSlots[slotName].apply(vm, args); 614 }); 615 } 616 function resolveSlots(slots, normalSlots) { 617 var res; 618 if (!slots) { 619 res = {}; 620 } 621 else if (slots._normalized) { 622 // fast path 1: child component re-render only, parent did not change 623 return slots._normalized; 624 } 625 else { 626 res = {}; 627 for (var key in slots) { 628 if (slots[key] && key[0] !== '$') { 629 res[key] = true; 630 } 631 } 632 } 633 // expose normal slots on scopedSlots 634 for (var key in normalSlots) { 635 if (!(key in res)) { 636 res[key] = true; 637 } 638 } 639 return res; 640 } 641 var vueInternalClasses; 642 var getVueInternalClasses = function () { 643 if (!vueInternalClasses) { 644 var vm = defineComponentInstance(getVueConstructor(), { 645 computed: { 646 value: function () { 647 return 0; 648 }, 649 }, 650 }); 651 // to get Watcher class 652 var Watcher = vm._computedWatchers.value.constructor; 653 // to get Dep class 654 var Dep = vm._data.__ob__.dep.constructor; 655 vueInternalClasses = { 656 Watcher: Watcher, 657 Dep: Dep, 658 }; 659 vm.$destroy(); 660 } 661 return vueInternalClasses; 662 }; 663 664 function createSymbol(name) { 665 return hasSymbol ? Symbol.for(name) : name; 666 } 667 var WatcherPreFlushQueueKey = createSymbol('composition-api.preFlushQueue'); 668 var WatcherPostFlushQueueKey = createSymbol('composition-api.postFlushQueue'); 669 // must be a string, symbol key is ignored in reactive 670 var RefKey = 'composition-api.refKey'; 671 672 var accessModifiedSet = new WeakMap(); 673 var rawSet = new WeakMap(); 674 var readonlySet = new WeakMap(); 675 676 var RefImpl = /** @class */ (function () { 677 function RefImpl(_a) { 678 var get = _a.get, set = _a.set; 679 proxy(this, 'value', { 680 get: get, 681 set: set, 682 }); 683 } 684 return RefImpl; 685 }()); 686 function createRef(options, readonly) { 687 if (readonly === void 0) { readonly = false; } 688 var r = new RefImpl(options); 689 // seal the ref, this could prevent ref from being observed 690 // It's safe to seal the ref, since we really shouldn't extend it. 691 // related issues: #79 692 var sealed = Object.seal(r); 693 if (readonly) 694 readonlySet.set(sealed, true); 695 return sealed; 696 } 697 function ref(raw) { 698 var _a; 699 if (isRef(raw)) { 700 return raw; 701 } 702 var value = reactive((_a = {}, _a[RefKey] = raw, _a)); 703 return createRef({ 704 get: function () { return value[RefKey]; }, 705 set: function (v) { return (value[RefKey] = v); }, 706 }); 707 } 708 function isRef(value) { 709 return value instanceof RefImpl; 710 } 711 function unref(ref) { 712 return isRef(ref) ? ref.value : ref; 713 } 714 function toRefs(obj) { 715 if (( true) && !isReactive(obj)) { 716 warn$1("toRefs() expects a reactive object but received a plain one."); 717 } 718 if (!isPlainObject(obj)) 719 return obj; 720 var ret = {}; 721 for (var key in obj) { 722 ret[key] = toRef(obj, key); 723 } 724 return ret; 725 } 726 function customRef(factory) { 727 var version = ref(0); 728 return createRef(factory(function () { return void version.value; }, function () { 729 ++version.value; 730 })); 731 } 732 function toRef(object, key) { 733 var v = object[key]; 734 if (isRef(v)) 735 return v; 736 return createRef({ 737 get: function () { return object[key]; }, 738 set: function (v) { return (object[key] = v); }, 739 }); 740 } 741 function shallowRef(raw) { 742 var _a; 743 if (isRef(raw)) { 744 return raw; 745 } 746 var value = shallowReactive((_a = {}, _a[RefKey] = raw, _a)); 747 return createRef({ 748 get: function () { return value[RefKey]; }, 749 set: function (v) { return (value[RefKey] = v); }, 750 }); 751 } 752 function triggerRef(value) { 753 if (!isRef(value)) 754 return; 755 value.value = value.value; 756 } 757 function proxyRefs(objectWithRefs) { 758 var _a, e_1, _b; 759 if (isReactive(objectWithRefs)) { 760 return objectWithRefs; 761 } 762 var value = reactive((_a = {}, _a[RefKey] = objectWithRefs, _a)); 763 var _loop_1 = function (key) { 764 proxy(value, key, { 765 get: function () { 766 if (isRef(value[RefKey][key])) { 767 return value[RefKey][key].value; 768 } 769 return value[RefKey][key]; 770 }, 771 set: function (v) { 772 if (isRef(value[RefKey][key])) { 773 return (value[RefKey][key].value = unref(v)); 774 } 775 value[RefKey][key] = unref(v); 776 }, 777 }); 778 }; 779 try { 780 for (var _c = __values(Object.keys(objectWithRefs)), _d = _c.next(); !_d.done; _d = _c.next()) { 781 var key = _d.value; 782 _loop_1(key); 783 } 784 } 785 catch (e_1_1) { e_1 = { error: e_1_1 }; } 786 finally { 787 try { 788 if (_d && !_d.done && (_b = _c.return)) _b.call(_c); 789 } 790 finally { if (e_1) throw e_1.error; } 791 } 792 return value; 793 } 794 795 function isRaw(obj) { 796 var _a; 797 return Boolean(obj && 798 hasOwn(obj, '__ob__') && 799 typeof obj.__ob__ === 'object' && 800 ((_a = obj.__ob__) === null || _a === void 0 ? void 0 : _a.__raw__)); 801 } 802 function isReactive(obj) { 803 var _a; 804 return Boolean(obj && 805 hasOwn(obj, '__ob__') && 806 typeof obj.__ob__ === 'object' && 807 !((_a = obj.__ob__) === null || _a === void 0 ? void 0 : _a.__raw__)); 808 } 809 /** 810 * Proxing property access of target. 811 * We can do unwrapping and other things here. 812 */ 813 function setupAccessControl(target) { 814 if (!isPlainObject(target) || 815 isRaw(target) || 816 isArray(target) || 817 isRef(target) || 818 isComponentInstance(target) || 819 accessModifiedSet.has(target)) 820 return; 821 accessModifiedSet.set(target, true); 822 var keys = Object.keys(target); 823 for (var i = 0; i < keys.length; i++) { 824 defineAccessControl(target, keys[i]); 825 } 826 } 827 /** 828 * Auto unwrapping when access property 829 */ 830 function defineAccessControl(target, key, val) { 831 if (key === '__ob__') 832 return; 833 if (isRaw(target[key])) 834 return; 835 var getter; 836 var setter; 837 var property = Object.getOwnPropertyDescriptor(target, key); 838 if (property) { 839 if (property.configurable === false) { 840 return; 841 } 842 getter = property.get; 843 setter = property.set; 844 if ((!getter || setter) /* not only have getter */ && 845 arguments.length === 2) { 846 val = target[key]; 847 } 848 } 849 setupAccessControl(val); 850 proxy(target, key, { 851 get: function getterHandler() { 852 var value = getter ? getter.call(target) : val; 853 // if the key is equal to RefKey, skip the unwrap logic 854 if (key !== RefKey && isRef(value)) { 855 return value.value; 856 } 857 else { 858 return value; 859 } 860 }, 861 set: function setterHandler(newVal) { 862 if (getter && !setter) 863 return; 864 // If the key is equal to RefKey, skip the unwrap logic 865 // If and only if "value" is ref and "newVal" is not a ref, 866 // the assignment should be proxied to "value" ref. 867 if (key !== RefKey && isRef(val) && !isRef(newVal)) { 868 val.value = newVal; 869 } 870 else if (setter) { 871 setter.call(target, newVal); 872 val = newVal; 873 } 874 else { 875 val = newVal; 876 } 877 setupAccessControl(newVal); 878 }, 879 }); 880 } 881 function observe(obj) { 882 var Vue = getRegisteredVueOrDefault(); 883 var observed; 884 if (Vue.observable) { 885 observed = Vue.observable(obj); 886 } 887 else { 888 var vm = defineComponentInstance(Vue, { 889 data: { 890 $$state: obj, 891 }, 892 }); 893 observed = vm._data.$$state; 894 } 895 // in SSR, there is no __ob__. Mock for reactivity check 896 if (!hasOwn(observed, '__ob__')) { 897 mockReactivityDeep(observed); 898 } 899 return observed; 900 } 901 /** 902 * Mock __ob__ for object recursively 903 */ 904 function mockReactivityDeep(obj, seen) { 905 var e_1, _a; 906 if (seen === void 0) { seen = new Set(); } 907 if (seen.has(obj)) 908 return; 909 def(obj, '__ob__', mockObserver(obj)); 910 seen.add(obj); 911 try { 912 for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) { 913 var key = _c.value; 914 var value = obj[key]; 915 if (!(isPlainObject(value) || isArray(value)) || 916 isRaw(value) || 917 !Object.isExtensible(value)) { 918 continue; 919 } 920 mockReactivityDeep(value, seen); 921 } 922 } 923 catch (e_1_1) { e_1 = { error: e_1_1 }; } 924 finally { 925 try { 926 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 927 } 928 finally { if (e_1) throw e_1.error; } 929 } 930 } 931 function mockObserver(value) { 932 if (value === void 0) { value = {}; } 933 return { 934 value: value, 935 dep: { 936 notify: noopFn, 937 depend: noopFn, 938 addSub: noopFn, 939 removeSub: noopFn, 940 }, 941 }; 942 } 943 function createObserver() { 944 return observe({}).__ob__; 945 } 946 function shallowReactive(obj) { 947 var e_2, _a; 948 if (!isObject(obj)) { 949 if ((true)) { 950 warn$1('"shallowReactive()" must be called on an object.'); 951 } 952 return obj; 953 } 954 if (!(isPlainObject(obj) || isArray(obj)) || 955 isRaw(obj) || 956 !Object.isExtensible(obj)) { 957 return obj; 958 } 959 var observed = observe(isArray(obj) ? [] : {}); 960 setupAccessControl(observed); 961 var ob = observed.__ob__; 962 var _loop_1 = function (key) { 963 var val = obj[key]; 964 var getter; 965 var setter; 966 var property = Object.getOwnPropertyDescriptor(obj, key); 967 if (property) { 968 if (property.configurable === false) { 969 return "continue"; 970 } 971 getter = property.get; 972 setter = property.set; 973 } 974 proxy(observed, key, { 975 get: function getterHandler() { 976 var _a; 977 var value = getter ? getter.call(obj) : val; 978 (_a = ob.dep) === null || _a === void 0 ? void 0 : _a.depend(); 979 return value; 980 }, 981 set: function setterHandler(newVal) { 982 var _a; 983 if (getter && !setter) 984 return; 985 if (setter) { 986 setter.call(obj, newVal); 987 } 988 else { 989 val = newVal; 990 } 991 (_a = ob.dep) === null || _a === void 0 ? void 0 : _a.notify(); 992 }, 993 }); 994 }; 995 try { 996 for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) { 997 var key = _c.value; 998 _loop_1(key); 999 } 1000 } 1001 catch (e_2_1) { e_2 = { error: e_2_1 }; } 1002 finally { 1003 try { 1004 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 1005 } 1006 finally { if (e_2) throw e_2.error; } 1007 } 1008 return observed; 1009 } 1010 /** 1011 * Make obj reactivity 1012 */ 1013 function reactive(obj) { 1014 if (!isObject(obj)) { 1015 if ((true)) { 1016 warn$1('"reactive()" must be called on an object.'); 1017 } 1018 return obj; 1019 } 1020 if (!(isPlainObject(obj) || isArray(obj)) || 1021 isRaw(obj) || 1022 !Object.isExtensible(obj)) { 1023 return obj; 1024 } 1025 var observed = observe(obj); 1026 setupAccessControl(observed); 1027 return observed; 1028 } 1029 /** 1030 * Make sure obj can't be a reactive 1031 */ 1032 function markRaw(obj) { 1033 if (!(isPlainObject(obj) || isArray(obj)) || !Object.isExtensible(obj)) { 1034 return obj; 1035 } 1036 // set the vue observable flag at obj 1037 var ob = createObserver(); 1038 ob.__raw__ = true; 1039 def(obj, '__ob__', ob); 1040 // mark as Raw 1041 rawSet.set(obj, true); 1042 return obj; 1043 } 1044 function toRaw(observed) { 1045 var _a, _b; 1046 if (isRaw(observed) || !Object.isExtensible(observed)) { 1047 return observed; 1048 } 1049 return ((_b = (_a = observed) === null || _a === void 0 ? void 0 : _a.__ob__) === null || _b === void 0 ? void 0 : _b.value) || observed; 1050 } 1051 1052 function isReadonly(obj) { 1053 return readonlySet.has(obj); 1054 } 1055 /** 1056 * **In @vue/composition-api, `reactive` only provides type-level readonly check** 1057 * 1058 * Creates a readonly copy of the original object. Note the returned copy is not 1059 * made reactive, but `readonly` can be called on an already reactive object. 1060 */ 1061 function readonly(target) { 1062 if (( true) && !isObject(target)) { 1063 warn$1("value cannot be made reactive: " + String(target)); 1064 } 1065 else { 1066 readonlySet.set(target, true); 1067 } 1068 return target; 1069 } 1070 function shallowReadonly(obj) { 1071 var e_1, _a; 1072 if (!isObject(obj)) { 1073 if ((true)) { 1074 warn$1("value cannot be made reactive: " + String(obj)); 1075 } 1076 return obj; 1077 } 1078 if (!(isPlainObject(obj) || isArray(obj)) || 1079 (!Object.isExtensible(obj) && !isRef(obj))) { 1080 return obj; 1081 } 1082 var readonlyObj = isRef(obj) 1083 ? new RefImpl({}) 1084 : isReactive(obj) 1085 ? observe({}) 1086 : {}; 1087 var source = reactive({}); 1088 var ob = source.__ob__; 1089 var _loop_1 = function (key) { 1090 var val = obj[key]; 1091 var getter; 1092 var property = Object.getOwnPropertyDescriptor(obj, key); 1093 if (property) { 1094 if (property.configurable === false && !isRef(obj)) { 1095 return "continue"; 1096 } 1097 getter = property.get; 1098 } 1099 proxy(readonlyObj, key, { 1100 get: function getterHandler() { 1101 var value = getter ? getter.call(obj) : val; 1102 ob.dep.depend(); 1103 return value; 1104 }, 1105 set: function (v) { 1106 if ((true)) { 1107 warn$1("Set operation on key \"" + key + "\" failed: target is readonly."); 1108 } 1109 }, 1110 }); 1111 }; 1112 try { 1113 for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) { 1114 var key = _c.value; 1115 _loop_1(key); 1116 } 1117 } 1118 catch (e_1_1) { e_1 = { error: e_1_1 }; } 1119 finally { 1120 try { 1121 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 1122 } 1123 finally { if (e_1) throw e_1.error; } 1124 } 1125 readonlySet.set(readonlyObj, true); 1126 return readonlyObj; 1127 } 1128 1129 /** 1130 * Set a property on an object. Adds the new property, triggers change 1131 * notification and intercept it's subsequent access if the property doesn't 1132 * already exist. 1133 */ 1134 function set$1(target, key, val) { 1135 var _a; 1136 var Vue = getVueConstructor(); 1137 // @ts-expect-error https://github.com/vuejs/vue/pull/12132 1138 var _b = Vue.util, warn = _b.warn, defineReactive = _b.defineReactive; 1139 if (( true) && (isUndef(target) || isPrimitive(target))) { 1140 warn("Cannot set reactive property on undefined, null, or primitive value: " + target); 1141 } 1142 if (isArray(target)) { 1143 if (isValidArrayIndex(key)) { 1144 target.length = Math.max(target.length, key); 1145 target.splice(key, 1, val); 1146 return val; 1147 } 1148 else if (key === 'length' && val !== target.length) { 1149 target.length = val; 1150 (_a = target.__ob__) === null || _a === void 0 ? void 0 : _a.dep.notify(); 1151 return val; 1152 } 1153 } 1154 if (key in target && !(key in Object.prototype)) { 1155 target[key] = val; 1156 return val; 1157 } 1158 var ob = target.__ob__; 1159 if (target._isVue || (ob && ob.vmCount)) { 1160 ( true) && 1161 warn('Avoid adding reactive properties to a Vue instance or its root $data ' + 1162 'at runtime - declare it upfront in the data option.'); 1163 return val; 1164 } 1165 if (!ob) { 1166 target[key] = val; 1167 return val; 1168 } 1169 defineReactive(ob.value, key, val); 1170 // IMPORTANT: define access control before trigger watcher 1171 defineAccessControl(target, key, val); 1172 // in SSR, there is no __ob__. Mock for reactivity check 1173 if (isObject(target[key]) && !hasOwn(target[key], '__ob__')) { 1174 mockReactivityDeep(target[key]); 1175 } 1176 ob.dep.notify(); 1177 return val; 1178 } 1179 1180 /** 1181 * Delete a property and trigger change if necessary. 1182 */ 1183 function del(target, key) { 1184 var Vue = getVueConstructor(); 1185 var warn = Vue.util.warn; 1186 if (( true) && (isUndef(target) || isPrimitive(target))) { 1187 warn("Cannot delete reactive property on undefined, null, or primitive value: " + target); 1188 } 1189 if (isArray(target) && isValidArrayIndex(key)) { 1190 target.splice(key, 1); 1191 return; 1192 } 1193 var ob = target.__ob__; 1194 if (target._isVue || (ob && ob.vmCount)) { 1195 ( true) && 1196 warn('Avoid deleting properties on a Vue instance or its root $data ' + 1197 '- just set it to null.'); 1198 return; 1199 } 1200 if (!hasOwn(target, key)) { 1201 return; 1202 } 1203 delete target[key]; 1204 if (!ob) { 1205 return; 1206 } 1207 ob.dep.notify(); 1208 } 1209 1210 var genName = function (name) { return "on" + (name[0].toUpperCase() + name.slice(1)); }; 1211 function createLifeCycle(lifeCyclehook) { 1212 return function (callback, target) { 1213 var instance = getCurrentInstanceForFn(genName(lifeCyclehook), target); 1214 return (instance && 1215 injectHookOption(getVueConstructor(), instance, lifeCyclehook, callback)); 1216 }; 1217 } 1218 function injectHookOption(Vue, instance, hook, val) { 1219 var options = instance.proxy.$options; 1220 var mergeFn = Vue.config.optionMergeStrategies[hook]; 1221 var wrappedHook = wrapHookCall(instance, val); 1222 options[hook] = mergeFn(options[hook], wrappedHook); 1223 return wrappedHook; 1224 } 1225 function wrapHookCall(instance, fn) { 1226 return function () { 1227 var args = []; 1228 for (var _i = 0; _i < arguments.length; _i++) { 1229 args[_i] = arguments[_i]; 1230 } 1231 var prev = getCurrentInstance(); 1232 setCurrentInstance(instance); 1233 try { 1234 return fn.apply(void 0, __spreadArray([], __read(args))); 1235 } 1236 finally { 1237 setCurrentInstance(prev); 1238 } 1239 }; 1240 } 1241 var onBeforeMount = createLifeCycle('beforeMount'); 1242 var onMounted = createLifeCycle('mounted'); 1243 var onBeforeUpdate = createLifeCycle('beforeUpdate'); 1244 var onUpdated = createLifeCycle('updated'); 1245 var onBeforeUnmount = createLifeCycle('beforeDestroy'); 1246 var onUnmounted = createLifeCycle('destroyed'); 1247 var onErrorCaptured = createLifeCycle('errorCaptured'); 1248 var onActivated = createLifeCycle('activated'); 1249 var onDeactivated = createLifeCycle('deactivated'); 1250 var onServerPrefetch = createLifeCycle('serverPrefetch'); 1251 1252 var fallbackVM; 1253 function flushPreQueue() { 1254 flushQueue(this, WatcherPreFlushQueueKey); 1255 } 1256 function flushPostQueue() { 1257 flushQueue(this, WatcherPostFlushQueueKey); 1258 } 1259 function hasWatchEnv(vm) { 1260 return vm[WatcherPreFlushQueueKey] !== undefined; 1261 } 1262 function installWatchEnv(vm) { 1263 vm[WatcherPreFlushQueueKey] = []; 1264 vm[WatcherPostFlushQueueKey] = []; 1265 vm.$on('hook:beforeUpdate', flushPreQueue); 1266 vm.$on('hook:updated', flushPostQueue); 1267 } 1268 function getWatcherOption(options) { 1269 return __assign({ 1270 immediate: false, 1271 deep: false, 1272 flush: 'pre', 1273 }, options); 1274 } 1275 function getWatchEffectOption(options) { 1276 return __assign({ 1277 flush: 'pre', 1278 }, options); 1279 } 1280 function getWatcherVM() { 1281 var vm = getCurrentScopeVM(); 1282 if (!vm) { 1283 if (!fallbackVM) { 1284 fallbackVM = defineComponentInstance(getVueConstructor()); 1285 } 1286 vm = fallbackVM; 1287 } 1288 else if (!hasWatchEnv(vm)) { 1289 installWatchEnv(vm); 1290 } 1291 return vm; 1292 } 1293 function flushQueue(vm, key) { 1294 var queue = vm[key]; 1295 for (var index = 0; index < queue.length; index++) { 1296 queue[index](); 1297 } 1298 queue.length = 0; 1299 } 1300 function queueFlushJob(vm, fn, mode) { 1301 // flush all when beforeUpdate and updated are not fired 1302 var fallbackFlush = function () { 1303 vm.$nextTick(function () { 1304 if (vm[WatcherPreFlushQueueKey].length) { 1305 flushQueue(vm, WatcherPreFlushQueueKey); 1306 } 1307 if (vm[WatcherPostFlushQueueKey].length) { 1308 flushQueue(vm, WatcherPostFlushQueueKey); 1309 } 1310 }); 1311 }; 1312 switch (mode) { 1313 case 'pre': 1314 fallbackFlush(); 1315 vm[WatcherPreFlushQueueKey].push(fn); 1316 break; 1317 case 'post': 1318 fallbackFlush(); 1319 vm[WatcherPostFlushQueueKey].push(fn); 1320 break; 1321 default: 1322 assert(false, "flush must be one of [\"post\", \"pre\", \"sync\"], but got " + mode); 1323 break; 1324 } 1325 } 1326 function createVueWatcher(vm, getter, callback, options) { 1327 var index = vm._watchers.length; 1328 // @ts-ignore: use undocumented options 1329 vm.$watch(getter, callback, { 1330 immediate: options.immediateInvokeCallback, 1331 deep: options.deep, 1332 lazy: options.noRun, 1333 sync: options.sync, 1334 before: options.before, 1335 }); 1336 return vm._watchers[index]; 1337 } 1338 // We have to monkeypatch the teardown function so Vue will run 1339 // runCleanup() when it tears down the watcher on unmounted. 1340 function patchWatcherTeardown(watcher, runCleanup) { 1341 var _teardown = watcher.teardown; 1342 watcher.teardown = function () { 1343 var args = []; 1344 for (var _i = 0; _i < arguments.length; _i++) { 1345 args[_i] = arguments[_i]; 1346 } 1347 _teardown.apply(watcher, args); 1348 runCleanup(); 1349 }; 1350 } 1351 function createWatcher(vm, source, cb, options) { 1352 var _a; 1353 if (( true) && !cb) { 1354 if (options.immediate !== undefined) { 1355 warn$1("watch() \"immediate\" option is only respected when using the " + 1356 "watch(source, callback, options?) signature."); 1357 } 1358 if (options.deep !== undefined) { 1359 warn$1("watch() \"deep\" option is only respected when using the " + 1360 "watch(source, callback, options?) signature."); 1361 } 1362 } 1363 var flushMode = options.flush; 1364 var isSync = flushMode === 'sync'; 1365 var cleanup; 1366 var registerCleanup = function (fn) { 1367 cleanup = function () { 1368 try { 1369 fn(); 1370 } 1371 catch (error) { 1372 logError(error, vm, 'onCleanup()'); 1373 } 1374 }; 1375 }; 1376 // cleanup before running getter again 1377 var runCleanup = function () { 1378 if (cleanup) { 1379 cleanup(); 1380 cleanup = null; 1381 } 1382 }; 1383 var createScheduler = function (fn) { 1384 if (isSync || 1385 /* without a current active instance, ignore pre|post mode */ vm === 1386 fallbackVM) { 1387 return fn; 1388 } 1389 return (function () { 1390 var args = []; 1391 for (var _i = 0; _i < arguments.length; _i++) { 1392 args[_i] = arguments[_i]; 1393 } 1394 return queueFlushJob(vm, function () { 1395 fn.apply(void 0, __spreadArray([], __read(args))); 1396 }, flushMode); 1397 }); 1398 }; 1399 // effect watch 1400 if (cb === null) { 1401 var running_1 = false; 1402 var getter_1 = function () { 1403 // preventing the watch callback being call in the same execution 1404 if (running_1) { 1405 return; 1406 } 1407 try { 1408 running_1 = true; 1409 source(registerCleanup); 1410 } 1411 finally { 1412 running_1 = false; 1413 } 1414 }; 1415 var watcher_1 = createVueWatcher(vm, getter_1, noopFn, { 1416 deep: options.deep || false, 1417 sync: isSync, 1418 before: runCleanup, 1419 }); 1420 patchWatcherTeardown(watcher_1, runCleanup); 1421 // enable the watcher update 1422 watcher_1.lazy = false; 1423 var originGet = watcher_1.get.bind(watcher_1); 1424 // always run watchEffect 1425 watcher_1.get = createScheduler(originGet); 1426 return function () { 1427 watcher_1.teardown(); 1428 }; 1429 } 1430 var deep = options.deep; 1431 var isMultiSource = false; 1432 var getter; 1433 if (isRef(source)) { 1434 getter = function () { return source.value; }; 1435 } 1436 else if (isReactive(source)) { 1437 getter = function () { return source; }; 1438 deep = true; 1439 } 1440 else if (isArray(source)) { 1441 isMultiSource = true; 1442 getter = function () { 1443 return source.map(function (s) { 1444 if (isRef(s)) { 1445 return s.value; 1446 } 1447 else if (isReactive(s)) { 1448 return traverse(s); 1449 } 1450 else if (isFunction(s)) { 1451 return s(); 1452 } 1453 else { 1454 ( true) && 1455 warn$1("Invalid watch source: " + JSON.stringify(s) + ".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.", vm); 1456 return noopFn; 1457 } 1458 }); 1459 }; 1460 } 1461 else if (isFunction(source)) { 1462 getter = source; 1463 } 1464 else { 1465 getter = noopFn; 1466 ( true) && 1467 warn$1("Invalid watch source: " + JSON.stringify(source) + ".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.", vm); 1468 } 1469 if (deep) { 1470 var baseGetter_1 = getter; 1471 getter = function () { return traverse(baseGetter_1()); }; 1472 } 1473 var applyCb = function (n, o) { 1474 if (!deep && 1475 isMultiSource && 1476 n.every(function (v, i) { return Object.is(v, o[i]); })) 1477 return; 1478 // cleanup before running cb again 1479 runCleanup(); 1480 return cb(n, o, registerCleanup); 1481 }; 1482 var callback = createScheduler(applyCb); 1483 if (options.immediate) { 1484 var originalCallback_1 = callback; 1485 // `shiftCallback` is used to handle the first sync effect run. 1486 // The subsequent callbacks will redirect to `callback`. 1487 var shiftCallback_1 = function (n, o) { 1488 shiftCallback_1 = originalCallback_1; 1489 // o is undefined on the first call 1490 return applyCb(n, isArray(n) ? [] : o); 1491 }; 1492 callback = function (n, o) { 1493 return shiftCallback_1(n, o); 1494 }; 1495 } 1496 // @ts-ignore: use undocumented option "sync" 1497 var stop = vm.$watch(getter, callback, { 1498 immediate: options.immediate, 1499 deep: deep, 1500 sync: isSync, 1501 }); 1502 // Once again, we have to hack the watcher for proper teardown 1503 var watcher = vm._watchers[vm._watchers.length - 1]; 1504 // if the return value is reactive and deep:true 1505 // watch for changes, this might happen when new key is added 1506 if (isReactive(watcher.value) && ((_a = watcher.value.__ob__) === null || _a === void 0 ? void 0 : _a.dep) && deep) { 1507 watcher.value.__ob__.dep.addSub({ 1508 update: function () { 1509 // this will force the source to be revaluated and the callback 1510 // executed if needed 1511 watcher.run(); 1512 }, 1513 }); 1514 } 1515 patchWatcherTeardown(watcher, runCleanup); 1516 return function () { 1517 stop(); 1518 }; 1519 } 1520 function watchEffect(effect, options) { 1521 var opts = getWatchEffectOption(options); 1522 var vm = getWatcherVM(); 1523 return createWatcher(vm, effect, null, opts); 1524 } 1525 function watchPostEffect(effect) { 1526 return watchEffect(effect, { flush: 'post' }); 1527 } 1528 function watchSyncEffect(effect) { 1529 return watchEffect(effect, { flush: 'sync' }); 1530 } 1531 // implementation 1532 function watch(source, cb, options) { 1533 var callback = null; 1534 if (isFunction(cb)) { 1535 // source watch 1536 callback = cb; 1537 } 1538 else { 1539 // effect watch 1540 if ((true)) { 1541 warn$1("`watch(fn, options?)` signature has been moved to a separate API. " + 1542 "Use `watchEffect(fn, options?)` instead. `watch` now only " + 1543 "supports `watch(source, cb, options?) signature."); 1544 } 1545 options = cb; 1546 callback = null; 1547 } 1548 var opts = getWatcherOption(options); 1549 var vm = getWatcherVM(); 1550 return createWatcher(vm, source, callback, opts); 1551 } 1552 function traverse(value, seen) { 1553 if (seen === void 0) { seen = new Set(); } 1554 if (!isObject(value) || seen.has(value)) { 1555 return value; 1556 } 1557 seen.add(value); 1558 if (isRef(value)) { 1559 traverse(value.value, seen); 1560 } 1561 else if (isArray(value)) { 1562 for (var i = 0; i < value.length; i++) { 1563 traverse(value[i], seen); 1564 } 1565 } 1566 else if (isSet(value) || isMap(value)) { 1567 value.forEach(function (v) { 1568 traverse(v, seen); 1569 }); 1570 } 1571 else if (isPlainObject(value)) { 1572 for (var key in value) { 1573 traverse(value[key], seen); 1574 } 1575 } 1576 return value; 1577 } 1578 1579 // implement 1580 function computed(getterOrOptions) { 1581 var vm = getCurrentScopeVM(); 1582 var getter; 1583 var setter; 1584 if (isFunction(getterOrOptions)) { 1585 getter = getterOrOptions; 1586 } 1587 else { 1588 getter = getterOrOptions.get; 1589 setter = getterOrOptions.set; 1590 } 1591 var computedSetter; 1592 var computedGetter; 1593 if (vm && !vm.$isServer) { 1594 var _a = getVueInternalClasses(), Watcher_1 = _a.Watcher, Dep_1 = _a.Dep; 1595 var watcher_1; 1596 computedGetter = function () { 1597 if (!watcher_1) { 1598 watcher_1 = new Watcher_1(vm, getter, noopFn, { lazy: true }); 1599 } 1600 if (watcher_1.dirty) { 1601 watcher_1.evaluate(); 1602 } 1603 if (Dep_1.target) { 1604 watcher_1.depend(); 1605 } 1606 return watcher_1.value; 1607 }; 1608 computedSetter = function (v) { 1609 if (( true) && !setter) { 1610 warn$1('Write operation failed: computed value is readonly.', vm); 1611 return; 1612 } 1613 if (setter) { 1614 setter(v); 1615 } 1616 }; 1617 } 1618 else { 1619 // fallback 1620 var computedHost_1 = defineComponentInstance(getVueConstructor(), { 1621 computed: { 1622 $$state: { 1623 get: getter, 1624 set: setter, 1625 }, 1626 }, 1627 }); 1628 vm && vm.$on('hook:destroyed', function () { return computedHost_1.$destroy(); }); 1629 computedGetter = function () { return computedHost_1.$$state; }; 1630 computedSetter = function (v) { 1631 if (( true) && !setter) { 1632 warn$1('Write operation failed: computed value is readonly.', vm); 1633 return; 1634 } 1635 computedHost_1.$$state = v; 1636 }; 1637 } 1638 return createRef({ 1639 get: computedGetter, 1640 set: computedSetter, 1641 }, !setter); 1642 } 1643 1644 var NOT_FOUND = {}; 1645 function resolveInject(provideKey, vm) { 1646 var source = vm; 1647 while (source) { 1648 // @ts-ignore 1649 if (source._provided && hasOwn(source._provided, provideKey)) { 1650 //@ts-ignore 1651 return source._provided[provideKey]; 1652 } 1653 source = source.$parent; 1654 } 1655 return NOT_FOUND; 1656 } 1657 function provide(key, value) { 1658 var _a; 1659 var vm = (_a = getCurrentInstanceForFn('provide')) === null || _a === void 0 ? void 0 : _a.proxy; 1660 if (!vm) 1661 return; 1662 if (!vm._provided) { 1663 var provideCache_1 = {}; 1664 proxy(vm, '_provided', { 1665 get: function () { return provideCache_1; }, 1666 set: function (v) { return Object.assign(provideCache_1, v); }, 1667 }); 1668 } 1669 vm._provided[key] = value; 1670 } 1671 function inject(key, defaultValue, treatDefaultAsFactory) { 1672 var _a; 1673 if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; } 1674 var vm = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy; 1675 if (!vm) { 1676 ( true) && 1677 warn$1("inject() can only be used inside setup() or functional components."); 1678 return; 1679 } 1680 if (!key) { 1681 ( true) && warn$1("injection \"" + String(key) + "\" not found.", vm); 1682 return defaultValue; 1683 } 1684 var val = resolveInject(key, vm); 1685 if (val !== NOT_FOUND) { 1686 return val; 1687 } 1688 if (defaultValue === undefined && ("development" !== 'production')) { 1689 warn$1("Injection \"" + String(key) + "\" not found", vm); 1690 } 1691 return treatDefaultAsFactory && isFunction(defaultValue) 1692 ? defaultValue() 1693 : defaultValue; 1694 } 1695 1696 var EMPTY_OBJ = ( true) 1697 ? Object.freeze({}) 1698 : undefined; 1699 var useCssModule = function (name) { 1700 var _a; 1701 if (name === void 0) { name = '$style'; } 1702 var instance = getCurrentInstance(); 1703 if (!instance) { 1704 ( true) && warn$1("useCssModule must be called inside setup()"); 1705 return EMPTY_OBJ; 1706 } 1707 var mod = (_a = instance.proxy) === null || _a === void 0 ? void 0 : _a[name]; 1708 if (!mod) { 1709 ( true) && 1710 warn$1("Current instance does not have CSS module named \"" + name + "\"."); 1711 return EMPTY_OBJ; 1712 } 1713 return mod; 1714 }; 1715 /** 1716 * @deprecated use `useCssModule` instead. 1717 */ 1718 var useCSSModule = useCssModule; 1719 1720 function createApp(rootComponent, rootProps) { 1721 if (rootProps === void 0) { rootProps = undefined; } 1722 var V = getVueConstructor(); 1723 var mountedVM = undefined; 1724 return { 1725 config: V.config, 1726 use: V.use.bind(V), 1727 mixin: V.mixin.bind(V), 1728 component: V.component.bind(V), 1729 directive: V.directive.bind(V), 1730 mount: function (el, hydrating) { 1731 if (!mountedVM) { 1732 mountedVM = new V(__assign({ propsData: rootProps }, rootComponent)); 1733 mountedVM.$mount(el, hydrating); 1734 return mountedVM; 1735 } 1736 else { 1737 if ((true)) { 1738 warn$1("App has already been mounted.\n" + 1739 "If you want to remount the same app, move your app creation logic " + 1740 "into a factory function and create fresh app instances for each " + 1741 "mount - e.g. `const createMyApp = () => createApp(App)`"); 1742 } 1743 return mountedVM; 1744 } 1745 }, 1746 unmount: function () { 1747 if (mountedVM) { 1748 mountedVM.$destroy(); 1749 mountedVM = undefined; 1750 } 1751 else if ((true)) { 1752 warn$1("Cannot unmount an app that is not mounted."); 1753 } 1754 }, 1755 }; 1756 } 1757 1758 var nextTick = function nextTick() { 1759 var _a; 1760 var args = []; 1761 for (var _i = 0; _i < arguments.length; _i++) { 1762 args[_i] = arguments[_i]; 1763 } 1764 return (_a = getVueConstructor()) === null || _a === void 0 ? void 0 : _a.nextTick.apply(this, args); 1765 }; 1766 1767 var fallbackCreateElement; 1768 var createElement = function createElement() { 1769 var _a; 1770 var args = []; 1771 for (var _i = 0; _i < arguments.length; _i++) { 1772 args[_i] = arguments[_i]; 1773 } 1774 var instance = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy; 1775 if (!instance) { 1776 ( true) && 1777 warn$1('`createElement()` has been called outside of render function.'); 1778 if (!fallbackCreateElement) { 1779 fallbackCreateElement = defineComponentInstance(getVueConstructor()).$createElement; 1780 } 1781 return fallbackCreateElement.apply(fallbackCreateElement, args); 1782 } 1783 return instance.$createElement.apply(instance, args); 1784 }; 1785 1786 function useSlots() { 1787 return getContext().slots; 1788 } 1789 function useAttrs() { 1790 return getContext().attrs; 1791 } 1792 function getContext() { 1793 var i = getCurrentInstance(); 1794 if (( true) && !i) { 1795 warn$1("useContext() called without active instance."); 1796 } 1797 return i.setupContext; 1798 } 1799 1800 function set(vm, key, value) { 1801 var state = (vm.__composition_api_state__ = 1802 vm.__composition_api_state__ || {}); 1803 state[key] = value; 1804 } 1805 function get(vm, key) { 1806 return (vm.__composition_api_state__ || {})[key]; 1807 } 1808 var vmStateManager = { 1809 set: set, 1810 get: get, 1811 }; 1812 1813 function asVmProperty(vm, propName, propValue) { 1814 var props = vm.$options.props; 1815 if (!(propName in vm) && !(props && hasOwn(props, propName))) { 1816 if (isRef(propValue)) { 1817 proxy(vm, propName, { 1818 get: function () { return propValue.value; }, 1819 set: function (val) { 1820 propValue.value = val; 1821 }, 1822 }); 1823 } 1824 else { 1825 proxy(vm, propName, { 1826 get: function () { 1827 if (isReactive(propValue)) { 1828 propValue.__ob__.dep.depend(); 1829 } 1830 return propValue; 1831 }, 1832 set: function (val) { 1833 propValue = val; 1834 }, 1835 }); 1836 } 1837 if ((true)) { 1838 // expose binding to Vue Devtool as a data property 1839 // delay this until state has been resolved to prevent repeated works 1840 vm.$nextTick(function () { 1841 if (Object.keys(vm._data).indexOf(propName) !== -1) { 1842 return; 1843 } 1844 if (isRef(propValue)) { 1845 proxy(vm._data, propName, { 1846 get: function () { return propValue.value; }, 1847 set: function (val) { 1848 propValue.value = val; 1849 }, 1850 }); 1851 } 1852 else { 1853 proxy(vm._data, propName, { 1854 get: function () { return propValue; }, 1855 set: function (val) { 1856 propValue = val; 1857 }, 1858 }); 1859 } 1860 }); 1861 } 1862 } 1863 else if ((true)) { 1864 if (props && hasOwn(props, propName)) { 1865 warn$1("The setup binding property \"" + propName + "\" is already declared as a prop.", vm); 1866 } 1867 else { 1868 warn$1("The setup binding property \"" + propName + "\" is already declared.", vm); 1869 } 1870 } 1871 } 1872 function updateTemplateRef(vm) { 1873 var rawBindings = vmStateManager.get(vm, 'rawBindings') || {}; 1874 if (!rawBindings || !Object.keys(rawBindings).length) 1875 return; 1876 var refs = vm.$refs; 1877 var oldRefKeys = vmStateManager.get(vm, 'refs') || []; 1878 for (var index = 0; index < oldRefKeys.length; index++) { 1879 var key = oldRefKeys[index]; 1880 var setupValue = rawBindings[key]; 1881 if (!refs[key] && setupValue && isRef(setupValue)) { 1882 setupValue.value = null; 1883 } 1884 } 1885 var newKeys = Object.keys(refs); 1886 var validNewKeys = []; 1887 for (var index = 0; index < newKeys.length; index++) { 1888 var key = newKeys[index]; 1889 var setupValue = rawBindings[key]; 1890 if (refs[key] && setupValue && isRef(setupValue)) { 1891 setupValue.value = refs[key]; 1892 validNewKeys.push(key); 1893 } 1894 } 1895 vmStateManager.set(vm, 'refs', validNewKeys); 1896 } 1897 function resolveScopedSlots(vm, slotsProxy) { 1898 var parentVNode = vm.$options._parentVnode; 1899 if (!parentVNode) 1900 return; 1901 var prevSlots = vmStateManager.get(vm, 'slots') || []; 1902 var curSlots = resolveSlots(parentVNode.data.scopedSlots, vm.$slots); 1903 // remove staled slots 1904 for (var index = 0; index < prevSlots.length; index++) { 1905 var key = prevSlots[index]; 1906 if (!curSlots[key]) { 1907 delete slotsProxy[key]; 1908 } 1909 } 1910 // proxy fresh slots 1911 var slotNames = Object.keys(curSlots); 1912 for (var index = 0; index < slotNames.length; index++) { 1913 var key = slotNames[index]; 1914 if (!slotsProxy[key]) { 1915 slotsProxy[key] = createSlotProxy(vm, key); 1916 } 1917 } 1918 vmStateManager.set(vm, 'slots', slotNames); 1919 } 1920 function activateCurrentInstance(instance, fn, onError) { 1921 var preVm = getCurrentInstance(); 1922 setCurrentInstance(instance); 1923 try { 1924 return fn(instance); 1925 } 1926 catch (err) { 1927 if (onError) { 1928 onError(err); 1929 } 1930 else { 1931 throw err; 1932 } 1933 } 1934 finally { 1935 setCurrentInstance(preVm); 1936 } 1937 } 1938 1939 function mixin(Vue) { 1940 Vue.mixin({ 1941 beforeCreate: functionApiInit, 1942 mounted: function () { 1943 updateTemplateRef(this); 1944 }, 1945 updated: function () { 1946 var _a; 1947 updateTemplateRef(this); 1948 if ((_a = this.$vnode) === null || _a === void 0 ? void 0 : _a.context) { 1949 updateTemplateRef(this.$vnode.context); 1950 } 1951 }, 1952 }); 1953 /** 1954 * Vuex init hook, injected into each instances init hooks list. 1955 */ 1956 function functionApiInit() { 1957 var vm = this; 1958 var $options = vm.$options; 1959 var setup = $options.setup, render = $options.render; 1960 if (render) { 1961 // keep currentInstance accessible for createElement 1962 $options.render = function () { 1963 var _this = this; 1964 var args = []; 1965 for (var _i = 0; _i < arguments.length; _i++) { 1966 args[_i] = arguments[_i]; 1967 } 1968 return activateCurrentInstance(toVue3ComponentInstance(vm), function () { 1969 return render.apply(_this, args); 1970 }); 1971 }; 1972 } 1973 if (!setup) { 1974 return; 1975 } 1976 if (!isFunction(setup)) { 1977 if ((true)) { 1978 warn$1('The "setup" option should be a function that returns a object in component definitions.', vm); 1979 } 1980 return; 1981 } 1982 var data = $options.data; 1983 // wrapper the data option, so we can invoke setup before data get resolved 1984 $options.data = function wrappedData() { 1985 initSetup(vm, vm.$props); 1986 return isFunction(data) 1987 ? data.call(vm, vm) 1988 : data || {}; 1989 }; 1990 } 1991 function initSetup(vm, props) { 1992 if (props === void 0) { props = {}; } 1993 var setup = vm.$options.setup; 1994 var ctx = createSetupContext(vm); 1995 var instance = toVue3ComponentInstance(vm); 1996 instance.setupContext = ctx; 1997 // fake reactive for `toRefs(props)` 1998 def(props, '__ob__', createObserver()); 1999 // resolve scopedSlots and slots to functions 2000 resolveScopedSlots(vm, ctx.slots); 2001 var binding; 2002 activateCurrentInstance(instance, function () { 2003 // make props to be fake reactive, this is for `toRefs(props)` 2004 binding = setup(props, ctx); 2005 }); 2006 if (!binding) 2007 return; 2008 if (isFunction(binding)) { 2009 // keep typescript happy with the binding type. 2010 var bindingFunc_1 = binding; 2011 // keep currentInstance accessible for createElement 2012 vm.$options.render = function () { 2013 resolveScopedSlots(vm, ctx.slots); 2014 return activateCurrentInstance(instance, function () { return bindingFunc_1(); }); 2015 }; 2016 return; 2017 } 2018 else if (isPlainObject(binding)) { 2019 if (isReactive(binding)) { 2020 binding = toRefs(binding); 2021 } 2022 vmStateManager.set(vm, 'rawBindings', binding); 2023 var bindingObj_1 = binding; 2024 Object.keys(bindingObj_1).forEach(function (name) { 2025 var bindingValue = bindingObj_1[name]; 2026 if (!isRef(bindingValue)) { 2027 if (!isReactive(bindingValue)) { 2028 if (isFunction(bindingValue)) { 2029 var copy_1 = bindingValue; 2030 bindingValue = bindingValue.bind(vm); 2031 Object.keys(copy_1).forEach(function (ele) { 2032 bindingValue[ele] = copy_1[ele]; 2033 }); 2034 } 2035 else if (!isObject(bindingValue)) { 2036 bindingValue = ref(bindingValue); 2037 } 2038 else if (hasReactiveArrayChild(bindingValue)) { 2039 // creates a custom reactive properties without make the object explicitly reactive 2040 // NOTE we should try to avoid this, better implementation needed 2041 customReactive(bindingValue); 2042 } 2043 } 2044 else if (isArray(bindingValue)) { 2045 bindingValue = ref(bindingValue); 2046 } 2047 } 2048 asVmProperty(vm, name, bindingValue); 2049 }); 2050 return; 2051 } 2052 if ((true)) { 2053 assert(false, "\"setup\" must return a \"Object\" or a \"Function\", got \"" + Object.prototype.toString 2054 .call(binding) 2055 .slice(8, -1) + "\""); 2056 } 2057 } 2058 function customReactive(target, seen) { 2059 if (seen === void 0) { seen = new Set(); } 2060 if (seen.has(target)) 2061 return; 2062 if (!isPlainObject(target) || 2063 isRef(target) || 2064 isReactive(target) || 2065 isRaw(target)) 2066 return; 2067 var Vue = getVueConstructor(); 2068 // @ts-expect-error https://github.com/vuejs/vue/pull/12132 2069 var defineReactive = Vue.util.defineReactive; 2070 Object.keys(target).forEach(function (k) { 2071 var val = target[k]; 2072 defineReactive(target, k, val); 2073 if (val) { 2074 seen.add(val); 2075 customReactive(val, seen); 2076 } 2077 return; 2078 }); 2079 } 2080 function hasReactiveArrayChild(target, visited) { 2081 if (visited === void 0) { visited = new Map(); } 2082 if (visited.has(target)) { 2083 return visited.get(target); 2084 } 2085 visited.set(target, false); 2086 if (isArray(target) && isReactive(target)) { 2087 visited.set(target, true); 2088 return true; 2089 } 2090 if (!isPlainObject(target) || isRaw(target) || isRef(target)) { 2091 return false; 2092 } 2093 return Object.keys(target).some(function (x) { 2094 return hasReactiveArrayChild(target[x], visited); 2095 }); 2096 } 2097 function createSetupContext(vm) { 2098 var ctx = { slots: {} }; 2099 var propsPlain = [ 2100 'root', 2101 'parent', 2102 'refs', 2103 'listeners', 2104 'isServer', 2105 'ssrContext', 2106 ]; 2107 var propsReactiveProxy = ['attrs']; 2108 var methodReturnVoid = ['emit']; 2109 propsPlain.forEach(function (key) { 2110 var srcKey = "$" + key; 2111 proxy(ctx, key, { 2112 get: function () { return vm[srcKey]; }, 2113 set: function () { 2114 ( true) && 2115 warn$1("Cannot assign to '" + key + "' because it is a read-only property", vm); 2116 }, 2117 }); 2118 }); 2119 var propsProxy; 2120 propsReactiveProxy.forEach(function (key) { 2121 var srcKey = "$" + key; 2122 proxy(ctx, key, { 2123 get: function () { 2124 var e_1, _a; 2125 if (propsProxy) 2126 return propsProxy; 2127 propsProxy = reactive({}); 2128 var source = vm[srcKey]; 2129 var _loop_1 = function (attr) { 2130 proxy(propsProxy, attr, { 2131 get: function () { 2132 // to ensure it always return the latest value 2133 return vm[srcKey][attr]; 2134 }, 2135 }); 2136 }; 2137 try { 2138 for (var _b = __values(Object.keys(source)), _c = _b.next(); !_c.done; _c = _b.next()) { 2139 var attr = _c.value; 2140 _loop_1(attr); 2141 } 2142 } 2143 catch (e_1_1) { e_1 = { error: e_1_1 }; } 2144 finally { 2145 try { 2146 if (_c && !_c.done && (_a = _b.return)) _a.call(_b); 2147 } 2148 finally { if (e_1) throw e_1.error; } 2149 } 2150 return propsProxy; 2151 }, 2152 set: function () { 2153 ( true) && 2154 warn$1("Cannot assign to '" + key + "' because it is a read-only property", vm); 2155 }, 2156 }); 2157 }); 2158 methodReturnVoid.forEach(function (key) { 2159 var srcKey = "$" + key; 2160 proxy(ctx, key, { 2161 get: function () { 2162 return function () { 2163 var args = []; 2164 for (var _i = 0; _i < arguments.length; _i++) { 2165 args[_i] = arguments[_i]; 2166 } 2167 var fn = vm[srcKey]; 2168 fn.apply(vm, args); 2169 }; 2170 }, 2171 }); 2172 }); 2173 if (false) {} 2174 return ctx; 2175 } 2176 } 2177 2178 /** 2179 * Helper that recursively merges two data objects together. 2180 */ 2181 function mergeData(from, to) { 2182 if (!from) 2183 return to; 2184 if (!to) 2185 return from; 2186 var key; 2187 var toVal; 2188 var fromVal; 2189 var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from); 2190 for (var i = 0; i < keys.length; i++) { 2191 key = keys[i]; 2192 // in case the object is already observed... 2193 if (key === '__ob__') 2194 continue; 2195 toVal = to[key]; 2196 fromVal = from[key]; 2197 if (!hasOwn(to, key)) { 2198 to[key] = fromVal; 2199 } 2200 else if (toVal !== fromVal && 2201 isPlainObject(toVal) && 2202 !isRef(toVal) && 2203 isPlainObject(fromVal) && 2204 !isRef(fromVal)) { 2205 mergeData(fromVal, toVal); 2206 } 2207 } 2208 return to; 2209 } 2210 function install(Vue) { 2211 if (isVueRegistered(Vue)) { 2212 if ((true)) { 2213 warn$1('[vue-composition-api] already installed. Vue.use(VueCompositionAPI) should be called only once.'); 2214 } 2215 return; 2216 } 2217 if ((true)) { 2218 if (Vue.version) { 2219 if (Vue.version[0] !== '2' || Vue.version[1] !== '.') { 2220 warn$1("[vue-composition-api] only works with Vue 2, v" + Vue.version + " found."); 2221 } 2222 } 2223 else { 2224 warn$1('[vue-composition-api] no Vue version found'); 2225 } 2226 } 2227 Vue.config.optionMergeStrategies.setup = function (parent, child) { 2228 return function mergedSetupFn(props, context) { 2229 return mergeData(isFunction(parent) ? parent(props, context) || {} : undefined, isFunction(child) ? child(props, context) || {} : undefined); 2230 }; 2231 }; 2232 setVueConstructor(Vue); 2233 mixin(Vue); 2234 } 2235 var Plugin = { 2236 install: function (Vue) { return install(Vue); }, 2237 }; 2238 2239 // implementation, close to no-op 2240 function defineComponent(options) { 2241 return options; 2242 } 2243 2244 function defineAsyncComponent(source) { 2245 if (isFunction(source)) { 2246 source = { loader: source }; 2247 } 2248 var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out 2249 _b = source.suspensible, // undefined = never times out 2250 suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true 2251 userOnError = source.onError; 2252 if (( true) && suspensible) { 2253 warn$1("The suspensiblbe option for async components is not supported in Vue2. It is ignored."); 2254 } 2255 var pendingRequest = null; 2256 var retries = 0; 2257 var retry = function () { 2258 retries++; 2259 pendingRequest = null; 2260 return load(); 2261 }; 2262 var load = function () { 2263 var thisRequest; 2264 return (pendingRequest || 2265 (thisRequest = pendingRequest = loader() 2266 .catch(function (err) { 2267 err = err instanceof Error ? err : new Error(String(err)); 2268 if (userOnError) { 2269 return new Promise(function (resolve, reject) { 2270 var userRetry = function () { return resolve(retry()); }; 2271 var userFail = function () { return reject(err); }; 2272 userOnError(err, userRetry, userFail, retries + 1); 2273 }); 2274 } 2275 else { 2276 throw err; 2277 } 2278 }) 2279 .then(function (comp) { 2280 if (thisRequest !== pendingRequest && pendingRequest) { 2281 return pendingRequest; 2282 } 2283 if (( true) && !comp) { 2284 warn$1("Async component loader resolved to undefined. " + 2285 "If you are using retry(), make sure to return its return value."); 2286 } 2287 // interop module default 2288 if (comp && 2289 (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) { 2290 comp = comp.default; 2291 } 2292 if (( true) && comp && !isObject(comp) && !isFunction(comp)) { 2293 throw new Error("Invalid async component load result: " + comp); 2294 } 2295 return comp; 2296 }))); 2297 }; 2298 return function () { 2299 var component = load(); 2300 return { 2301 component: component, 2302 delay: delay, 2303 timeout: timeout, 2304 error: errorComponent, 2305 loading: loadingComponent, 2306 }; 2307 }; 2308 } 2309 2310 var version = "1.2.1"; 2311 // auto install when using CDN 2312 if (typeof window !== 'undefined' && window.Vue) { 2313 window.Vue.use(Plugin); 2314 } 2315 2316 /* harmony default export */ __webpack_exports__["default"] = (Plugin); 2317 2318 2319 2320 /***/ }), 2321 2322 /***/ "./node_modules/@vueform/multiselect/dist/multiselect.vue2.js": 2323 /*!********************************************************************!*\ 2324 !*** ./node_modules/@vueform/multiselect/dist/multiselect.vue2.js ***! 2325 \********************************************************************/ 2326 /*! exports provided: default */ 2327 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2328 2329 "use strict"; 2330 __webpack_require__.r(__webpack_exports__); 2331 /* harmony import */ var _vue_composition_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @vue/composition-api */ "./node_modules/@vue/composition-api/dist/vue-composition-api.mjs"); 2332 function l(e){return-1!==[null,void 0,!1].indexOf(e)}function r(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var u=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),u.push.apply(u,n)}return u}function s(e){for(var t=1;t<arguments.length;t++){var u=null!=arguments[t]?arguments[t]:{};t%2?o(Object(u),!0).forEach((function(t){c(e,t,u[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(u)):o(Object(u)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(u,t))}))}return e}function c(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function v(a,o,v){var p=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(a),d=p.options,f=p.mode,g=p.trackBy,b=p.limit,m=p.hideSelected,D=p.createTag,h=p.label,y=p.appendNewTag,_=p.multipleLabel,O=p.object,F=p.loading,S=p.delay,C=p.resolveOnLoad,A=p.minChars,E=p.filterResults,B=p.clearOnSearch,P=p.clearOnSelect,L=p.valueProp,w=p.canDeselect,k=p.max,q=p.strict,j=p.closeOnSelect,x=p.groups,T=(p.groupLabel,p.groupOptions),I=p.groupHideEmpty,R=p.groupSelect,V=v.iv,N=v.ev,G=v.search,H=v.clearSearch,$=v.update,M=v.pointer,U=v.clearPointer,W=v.blur,K=v.deactivate,X=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])([]),z=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])([]),J=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(!1),Q=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){if(x.value){var e=z.value||[],t=[];return e.forEach((function(e){Fe(e[T.value]).forEach((function(u){t.push(Object.assign({},u,e.disabled?{disabled:!0}:{}))}))})),t}var u=Fe(z.value||[]);return X.value.length&&(u=u.concat(X.value)),u})),Y=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return x.value?_e((z.value||[]).map((function(e){var t,u=Fe(e[T.value]);return s(s({},e),{},(c(t={group:!0},T.value,Oe(u,!1).map((function(t){return Object.assign({},t,e.disabled?{disabled:!0}:{})}))),c(t,"__VISIBLE__",Oe(u).map((function(t){return Object.assign({},t,e.disabled?{disabled:!0}:{})}))),t))}))):[]})),Z=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){var e=Q.value;return ae.value.length&&(e=ae.value.concat(e)),e=Oe(e),b.value>0&&(e=e.slice(0,b.value)),e})),ee=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){switch(f.value){case"single":return!l(V.value[L.value]);case"multiple":case"tags":return!l(V.value)&&V.value.length>0}})),te=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return void 0!==_&&void 0!==_.value?_.value(V.value):V.value&&V.value.length>1?"".concat(V.value.length," options selected"):"1 option selected"})),ue=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return!Q.value.length&&!J.value&&!ae.value.length})),ne=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return Q.value.length>0&&0==Z.value.length&&(G.value&&x.value||!x.value)})),ae=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){var e;return!1!==D.value&&G.value?-1!==De(G.value)?[]:[(e={},c(e,L.value,G.value),c(e,h.value,G.value),c(e,g.value,G.value),e)]:[]})),le=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){switch(f.value){case"single":return null;case"multiple":case"tags":return[]}})),re=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return F.value||J.value})),ie=function(e){switch("object"!==i(e)&&(e=me(e)),f.value){case"single":$(e);break;case"multiple":case"tags":$(V.value.concat(e))}o.emit("select",se(e),e)},oe=function(e){switch("object"!==i(e)&&(e=me(e)),f.value){case"single":ve();break;case"tags":case"multiple":$(Array.isArray(e)?V.value.filter((function(t){return-1===e.map((function(e){return e[L.value]})).indexOf(t[L.value])})):V.value.filter((function(t){return t[L.value]!=e[L.value]})))}o.emit("deselect",se(e),e)},se=function(e){return O.value?e:e[L.value]},ce=function(e){oe(e)},ve=function(){o.emit("clear"),$(le.value)},pe=function(e){if(void 0!==e.group)return"single"!==f.value&&(be(e[T.value])&&e[T.value].length);switch(f.value){case"single":return!l(V.value)&&V.value[L.value]==e[L.value];case"tags":case"multiple":return!l(V.value)&&-1!==V.value.map((function(e){return e[L.value]})).indexOf(e[L.value])}},de=function(e){return!0===e.disabled},fe=function(){return!(void 0===k||-1===k.value||!ee.value&&k.value>0)&&V.value.length>=k.value},ge=function(e){return void 0===e.find((function(e){return!pe(e)&&!e.disabled}))},be=function(e){return void 0===e.find((function(e){return!pe(e)}))},me=function(e){return Q.value[Q.value.map((function(e){return String(e[L.value])})).indexOf(String(e))]},De=function(e){return Q.value.map((function(e){return e[g.value]})).indexOf(e)},he=function(e){return-1!==["tags","multiple"].indexOf(f.value)&&m.value&&pe(e)},ye=function(e){X.value.push(e)},_e=function(e){return I.value?e.filter((function(e){return G.value?e.__VISIBLE__.length:e[T.value].length})):e.filter((function(e){return!G.value||e.__VISIBLE__.length}))},Oe=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=e;return G.value&&E.value&&(u=u.filter((function(e){return-1!==r(e[g.value],q.value).indexOf(r(G.value,q.value))}))),m.value&&t&&(u=u.filter((function(e){return!he(e)}))),u},Fe=function(e){var t,u=e;return t=u,"[object Object]"===Object.prototype.toString.call(t)&&(u=Object.keys(u).map((function(e){var t,n=u[e];return c(t={},L.value,e),c(t,g.value,n),c(t,h.value,n),t}))),u=u.map((function(e){var t;return"object"===i(e)?e:(c(t={},L.value,e),c(t,g.value,e),c(t,h.value,e),t)}))},Se=function(){l(N.value)||(V.value=Ae(N.value))},Ce=function(e){J.value=!0,d.value(G.value).then((function(t){z.value=t,"function"==typeof e&&e(t),J.value=!1}))},Ae=function(e){return l(e)?"single"===f.value?{}:[]:O.value?e:"single"===f.value?me(e)||{}:e.filter((function(e){return!!me(e)})).map((function(e){return me(e)}))};if("single"!==f.value&&!l(N.value)&&!Array.isArray(N.value))throw new Error('v-model must be an array when using "'.concat(f.value,'" mode'));return d&&"function"==typeof d.value?C.value?Ce(Se):1==O.value&&Se():(z.value=d.value,Se()),S.value>-1&&Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["watch"])(G,(function(e){e.length<A.value||(J.value=!0,B.value&&(z.value=[]),setTimeout((function(){e==G.value&&d.value(G.value).then((function(t){e==G.value&&(z.value=t,M.value=Z.value.filter((function(e){return!0!==e.disabled}))[0]||null,J.value=!1)}))}),S.value))}),{flush:"sync"}),Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["watch"])(N,(function(e){var t,u,n;if(l(e))V.value=Ae(e);else switch(f.value){case"single":(O.value?e[L.value]!=V.value[L.value]:e!=V.value[L.value])&&(V.value=Ae(e));break;case"multiple":case"tags":t=O.value?e.map((function(e){return e[L.value]})):e,u=V.value.map((function(e){return e[L.value]})),n=u.slice().sort(),t.length===u.length&&t.slice().sort().every((function(e,t){return e===n[t]}))||(V.value=Ae(e))}}),{deep:!0}),"function"!=typeof a.options&&Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["watch"])(d,(function(e,t){z.value=a.options,Object.keys(V.value).length||Se(),function(){if(ee.value)if("single"===f.value){var e=me(V.value[L.value])[h.value];V.value[h.value]=e,O.value&&(N.value[h.value]=e)}else V.value.forEach((function(e,t){var u=me(V.value[t][L.value])[h.value];V.value[t][h.value]=u,O.value&&(N.value[t][h.value]=u)}))}()})),{fo:Z,filteredOptions:Z,hasSelected:ee,multipleLabelText:te,eo:Q,extendedOptions:Q,fg:Y,filteredGroups:Y,noOptions:ue,noResults:ne,resolving:J,busy:re,select:ie,deselect:oe,remove:ce,clear:ve,isSelected:pe,isDisabled:de,isMax:fe,getOption:me,handleOptionClick:function(e){if(!de(e)){switch(f.value){case"single":if(pe(e))return void(w.value&&oe(e));W(),ie(e);break;case"multiple":if(pe(e))return void oe(e);if(fe())return;ie(e),P.value&&H(),m.value&&U(),j.value&&W();break;case"tags":if(pe(e))return void oe(e);if(fe())return;void 0===me(e[L.value])&&D.value&&(o.emit("tag",e[L.value]),y.value&&ye(e),H()),P.value&&H(),ie(e),m.value&&U(),j.value&&W()}j.value&&K()}},handleGroupClick:function(e){if(!de(e)&&"single"!==f.value&&R.value){switch(f.value){case"multiple":case"tags":ge(e[T.value])?oe(e[T.value]):ie(e[T.value].filter((function(e){return-1===V.value.map((function(e){return e[L.value]})).indexOf(e[L.value])})).filter((function(e){return!e.disabled})).filter((function(e,t){return V.value.length+1+t<=k.value||-1===k.value})))}j.value&&K()}},handleTagRemove:function(e,t){0===t.button?ce(e):t.preventDefault()},refreshOptions:function(e){Ce(e)},resolveOptions:Ce}}function p(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var u=Object.prototype.toString.call(e).slice(8,-1);"Object"===u&&e.constructor&&(u=e.constructor.name);if("Map"===u||"Set"===u)return Array.from(e);if("Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return d(e,t)}(e)||function(){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 d(e,t){(null==t||t>e.length)&&(t=e.length);for(var u=0,n=new Array(t);u<t;u++)n[u]=e[u];return n}function f(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var u=Object.prototype.toString.call(e).slice(8,-1);"Object"===u&&e.constructor&&(u=e.constructor.name);if("Map"===u||"Set"===u)return Array.from(e);if("Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return g(e,t)}(e)||function(){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 g(e,t){(null==t||t>e.length)&&(t=e.length);for(var u=0,n=new Array(t);u<t;u++)n[u]=e[u];return n}function b(e,t){var u=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),u.push.apply(u,n)}return u}function m(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function D(t,n,a){var l=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(t),r=l.disabled,i=l.openDirection,o=l.showOptions,s=a.isOpen,c=a.isPointed,v=a.isSelected,p=a.isDisabled,d=a.isActive,f=a.canPointGroups,g=a.resolving,D=a.fo,h=function(e){for(var t=1;t<arguments.length;t++){var u=null!=arguments[t]?arguments[t]:{};t%2?b(Object(u),!0).forEach((function(t){m(e,t,u[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(u)):b(Object(u)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(u,t))}))}return e}({container:"multiselect",containerDisabled:"is-disabled",containerOpen:"is-open",containerOpenTop:"is-open-top",containerActive:"is-active",singleLabel:"multiselect-single-label",multipleLabel:"multiselect-multiple-label",search:"multiselect-search",tags:"multiselect-tags",tag:"multiselect-tag",tagDisabled:"is-disabled",tagRemove:"multiselect-tag-remove",tagRemoveIcon:"multiselect-tag-remove-icon",tagsSearchWrapper:"multiselect-tags-search-wrapper",tagsSearch:"multiselect-tags-search",tagsSearchCopy:"multiselect-tags-search-copy",placeholder:"multiselect-placeholder",caret:"multiselect-caret",caretOpen:"is-open",clear:"multiselect-clear",clearIcon:"multiselect-clear-icon",spinner:"multiselect-spinner",dropdown:"multiselect-dropdown",dropdownTop:"is-top",dropdownHidden:"is-hidden",options:"multiselect-options",optionsTop:"is-top",group:"multiselect-group",groupLabel:"multiselect-group-label",groupLabelPointable:"is-pointable",groupLabelPointed:"is-pointed",groupLabelSelected:"is-selected",groupLabelDisabled:"is-disabled",groupLabelSelectedPointed:"is-selected is-pointed",groupLabelSelectedDisabled:"is-selected is-disabled",groupOptions:"multiselect-group-options",option:"multiselect-option",optionPointed:"is-pointed",optionSelected:"is-selected",optionDisabled:"is-disabled",optionSelectedPointed:"is-selected is-pointed",optionSelectedDisabled:"is-selected is-disabled",noOptions:"multiselect-no-options",noResults:"multiselect-no-results",fakeInput:"multiselect-fake-input",spacer:"multiselect-spacer"},l.classes.value),y=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return!!(s.value&&o.value&&(!g.value||g.value&&D.value.length))}));return{classList:Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return{container:[h.container].concat(r.value?h.containerDisabled:[]).concat(y.value&&"top"===i.value?h.containerOpenTop:[]).concat(y.value&&"top"!==i.value?h.containerOpen:[]).concat(d.value?h.containerActive:[]),spacer:h.spacer,singleLabel:h.singleLabel,multipleLabel:h.multipleLabel,search:h.search,tags:h.tags,tag:[h.tag].concat(r.value?h.tagDisabled:[]),tagRemove:h.tagRemove,tagRemoveIcon:h.tagRemoveIcon,tagsSearchWrapper:h.tagsSearchWrapper,tagsSearch:h.tagsSearch,tagsSearchCopy:h.tagsSearchCopy,placeholder:h.placeholder,caret:[h.caret].concat(s.value?h.caretOpen:[]),clear:h.clear,clearIcon:h.clearIcon,spinner:h.spinner,dropdown:[h.dropdown].concat("top"===i.value?h.dropdownTop:[]).concat(s.value&&o.value&&y.value?[]:h.dropdownHidden),options:[h.options].concat("top"===i.value?h.optionsTop:[]),group:h.group,groupLabel:function(e){var t=[h.groupLabel];return c(e)?t.push(v(e)?h.groupLabelSelectedPointed:h.groupLabelPointed):v(e)&&f.value?t.push(p(e)?h.groupLabelSelectedDisabled:h.groupLabelSelected):p(e)&&t.push(h.groupLabelDisabled),f.value&&t.push(h.groupLabelPointable),t},groupOptions:h.groupOptions,option:function(e,t){var u=[h.option];return c(e)?u.push(v(e)?h.optionSelectedPointed:h.optionPointed):v(e)?u.push(p(e)?h.optionSelectedDisabled:h.optionSelected):(p(e)||t&&p(t))&&u.push(h.optionDisabled),u},noOptions:h.noOptions,noResults:h.noResults,fakeInput:h.fakeInput}})),showDropdown:y}}function h(e,t,u,n,a,l,r,i,o,s){"boolean"!=typeof r&&(o=i,i=r,r=!1);var c,v="function"==typeof u?u.options:u;if(e&&e.render&&(v.render=e.render,v.staticRenderFns=e.staticRenderFns,v._compiled=!0,a&&(v.functional=!0)),n&&(v._scopeId=n),l?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,o(e)),e&&e._registeredComponents&&e._registeredComponents.add(l)},v._ssrRegister=c):t&&(c=r?function(e){t.call(this,s(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,i(e))}),c)if(v.functional){var p=v.render;v.render=function(e,t){return c.call(t),p(e,t)}}else{var d=v.beforeCreate;v.beforeCreate=d?[].concat(d,c):[c]}return u}const y={name:"Multiselect",emits:["open","close","select","deselect","input","search-change","tag","update:modelValue","change","clear"],props:{value:{required:!1},modelValue:{required:!1},options:{type:[Array,Object,Function],required:!1,default:()=>[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},addTagOn:{type:Array,required:!1,default:()=>["enter"]},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(r,i){const o=function(n,a){var l=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(n),r=l.value,i=l.modelValue,o=l.mode,s=l.valueProp,c=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])("single"!==o.value?[]:{}),v=void 0!==a.expose?i:r,p=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return"single"===o.value?c.value[s.value]:c.value.map((function(e){return e[s.value]}))})),d=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return"single"!==o.value?c.value.map((function(e){return e[s.value]})).join(","):c.value[s.value]}));return{iv:c,internalValue:c,ev:v,externalValue:v,textValue:d,plainValue:p}}(r,i),s=function(u,n,a){var l=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(u),r=l.groupSelect,i=l.mode,o=l.groups,s=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===i.value||!r.value)||(s.value=e)};return{pointer:s,setPointer:c,clearPointer:function(){c(null)}}}(r),c=function(u,n,a){var l=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(u).disabled,r=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(!1);return{isOpen:r,open:function(){r.value||l.value||(r.value=!0,n.emit("open"))},close:function(){r.value&&(r.value=!1,n.emit("close"))}}}(r,i),d=function(e,u,a){var l=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(null),r=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(null);return Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["watch"])(l,(function(e){u.emit("search-change",e)})),{search:l,input:r,clearSearch:function(){l.value=""},handleSearchInput:function(e){l.value=e.target.value},handlePaste:function(e){u.emit("paste",e)}}}(0,i),g=function(t,u,n){var a=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(t),r=a.object,i=a.valueProp,o=a.mode,s=n.iv,c=function(e){return r.value||l(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},v=function(e){return l(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=v(e);var t=c(e);u.emit("change",t),u.emit("input",t),u.emit("update:modelValue",t)}}}(r,i,{iv:o.iv}),b=function(n,a,l){var r=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(n),i=r.searchable,o=r.disabled,s=l.input,c=l.open,v=l.close,p=l.clearSearch,d=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(null),f=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["ref"])(!1),g=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return i.value||o.value?-1:0})),b=function(){i.value&&s.value.blur(),d.value.blur()},m=function(){f.value=!1,setTimeout((function(){f.value||(v(),p())}),1)};return{multiselect:d,tabindex:g,isActive:f,blur:b,handleFocus:function(){i.value&&!o.value&&s.value.focus()},activate:function(){o.value||(f.value=!0,c())},deactivate:m,handleCaretClick:function(){m(),b()}}}(r,0,{input:d.input,open:c.open,close:c.close,clearSearch:d.clearSearch}),m=v(r,i,{ev:o.ev,iv:o.iv,search:d.search,clearSearch:d.clearSearch,update:g.update,pointer:s.pointer,clearPointer:s.clearPointer,blur:b.blur,deactivate:b.deactivate}),h=function(t,l,r){var i=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(t),o=i.valueProp,s=i.showOptions,c=i.searchable,v=i.groupLabel,d=i.groups,f=i.mode,g=i.groupSelect,b=r.fo,m=r.fg,D=r.handleOptionClick,h=r.handleGroupClick,y=r.search,_=r.pointer,O=r.setPointer,F=r.clearPointer,S=r.multiselect,C=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return b.value.filter((function(e){return!e.disabled}))})),A=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return m.value.filter((function(e){return!e.disabled}))})),E=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return"single"!==f.value&&g.value})),B=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return _.value&&_.value.group})),P=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return V(_.value)})),L=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){var e=B.value?_.value:V(_.value),t=A.value.map((function(e){return e[v.value]})).indexOf(e[v.value]),u=A.value[t-1];return void 0===u&&(u=k.value),u})),w=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){var e=A.value.map((function(e){return e.label})).indexOf(B.value?_.value[v.value]:V(_.value)[v.value])+1;return A.value.length<=e&&(e=0),A.value[e]})),k=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return p(A.value).slice(-1)[0]})),q=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return _.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),j=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){var e=P.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(_.value[o.value])-1]})),x=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){var e=V(_.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(_.value[o.value])+1]})),T=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return p(L.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),I=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["computed"])((function(){return p(k.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),R=function(){O(C.value[0]||null)},V=function(e){return A.value.find((function(t){return-1!==t.__VISIBLE__.map((function(e){return e[o.value]})).indexOf(e[o.value])}))},N=function(){var e=S.value.querySelector("[data-pointed]");if(e){var t=e.parentElement.parentElement;d.value&&(t=B.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop<t.scrollTop&&(t.scrollTop=e.offsetTop)}};return Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["watch"])(y,(function(e){c.value&&(e.length&&s.value?R():F())})),{pointer:_,canPointGroups:E,isPointed:function(e){return!(!_.value||!(!e.group&&_.value[o.value]==e[o.value]||void 0!==e.group&&_.value[v.value]==e[v.value]))||void 0},setPointerFirst:R,selectPointer:function(){_.value&&!0!==_.value.disabled&&(B.value?h(_.value):D(_.value))},forwardPointer:function(){if(null===_.value)O((d.value&&E.value?A.value[0]:C.value[0])||null);else if(d.value&&E.value){var e=B.value?q.value:x.value;void 0===e&&(e=w.value),O(e||null)}else{var t=C.value.map((function(e){return e[o.value]})).indexOf(_.value[o.value])+1;C.value.length<=t&&(t=0),O(C.value[t]||null)}Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["nextTick"])((function(){N()}))},backwardPointer:function(){if(null===_.value){var e=C.value[C.value.length-1];d.value&&E.value&&void 0===(e=I.value)&&(e=k.value),O(e||null)}else if(d.value&&E.value){var t=B.value?T.value:j.value;void 0===t&&(t=B.value?L.value:P.value),O(t||null)}else{var u=C.value.map((function(e){return e[o.value]})).indexOf(_.value[o.value])-1;u<0&&(u=C.value.length-1),O(C.value[u]||null)}Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["nextTick"])((function(){N()}))}}}(r,0,{fo:m.fo,fg:m.fg,handleOptionClick:m.handleOptionClick,handleGroupClick:m.handleGroupClick,search:d.search,pointer:s.pointer,setPointer:s.setPointer,clearPointer:s.clearPointer,multiselect:b.multiselect}),y=function(t,u,n){var a=Object(_vue_composition_api__WEBPACK_IMPORTED_MODULE_0__["toRefs"])(t),l=a.mode,r=a.addTagOn,i=a.createTag,o=a.openDirection,s=a.searchable,c=a.showOptions,v=a.valueProp,p=a.groups,d=n.iv,g=n.update,b=n.search,m=n.setPointer,D=n.selectPointer,h=n.backwardPointer,y=n.forwardPointer,_=n.blur,O=n.fo,F=function(){"tags"===l.value&&!c.value&&i.value&&s.value&&!p.value&&m(O.value[O.value.map((function(e){return e[v.value]})).indexOf(b.value)])};return{handleKeydown:function(e){switch(e.keyCode){case 8:if("single"===l.value)return;if(s.value&&-1===[null,""].indexOf(b.value))return;if(0===d.value.length)return;g(f(d.value).slice(0,-1));break;case 13:if(e.preventDefault(),"tags"===l.value&&-1===r.value.indexOf("enter")&&i.value)return;F(),D();break;case 32:if(s.value&&"tags"!==l.value&&!i.value)return;if("tags"===l.value&&(-1===r.value.indexOf("space")&&i.value||!i.value))return;e.preventDefault(),F(),D();break;case 9:case 186:case 188:if("tags"!==l.value)return;if(-1===r.value.indexOf({9:"tab",186:";",188:","}[e.keyCode])||!i.value)return;F(),D(),e.preventDefault();break;case 27:_();break;case 38:if(e.preventDefault(),!c.value)return;"top"===o.value?y():h();break;case 40:if(e.preventDefault(),!c.value)return;"top"===o.value?h():y()}},preparePointer:F}}(r,0,{iv:o.iv,update:g.update,search:d.search,setPointer:s.setPointer,selectPointer:h.selectPointer,backwardPointer:h.backwardPointer,forwardPointer:h.forwardPointer,blur:b.blur,fo:m.fo}),_=D(r,0,{isOpen:c.isOpen,isPointed:h.isPointed,canPointGroups:h.canPointGroups,isSelected:m.isSelected,isDisabled:m.isDisabled,isActive:b.isActive,resolving:m.resolving,fo:m.fo});return{...o,...c,...b,...s,...g,...d,...m,...h,...y,..._}}};var _=function(){var e=this,t=e.$createElement,u=e._self._c||t;return u("div",{ref:"multiselect",class:e.classList.container,attrs:{tabindex:e.tabindex,id:e.id},on:{focusin:e.activate,focusout:e.deactivate,keydown:e.handleKeydown,focus:e.handleFocus}},["tags"!==e.mode&&e.searchable&&!e.disabled?[u("input",{ref:"input",class:e.classList.search,attrs:{type:e.inputType,modelValue:e.search,autocomplete:e.autocomplete},domProps:{value:e.search},on:{input:e.handleSearchInput,paste:function(t){return t.stopPropagation(),e.handlePaste(t)}}})]:e._e(),e._v(" "),"tags"==e.mode?[u("div",{class:e.classList.tags},[e._l(e.iv,(function(t,n,a){return e._t("tag",[u("span",{key:a,class:e.classList.tag},[e._v("\n "+e._s(t[e.label])+"\n "),e.disabled?e._e():u("span",{class:e.classList.tagRemove,on:{mousedown:function(u){return u.preventDefault(),e.handleTagRemove(t,u)}}},[u("span",{class:e.classList.tagRemoveIcon})])])],{option:t,handleTagRemove:e.handleTagRemove,disabled:e.disabled})})),e._v(" "),u("div",{class:e.classList.tagsSearchWrapper},[u("span",{class:e.classList.tagsSearchCopy},[e._v(e._s(e.search))]),e._v(" "),e.searchable&&!e.disabled?u("input",{ref:"input",class:e.classList.tagsSearch,attrs:{type:e.inputType,modelValue:e.search,autocomplete:e.autocomplete},domProps:{value:e.search},on:{input:e.handleSearchInput,paste:function(t){return t.stopPropagation(),e.handlePaste(t)}}}):e._e()])],2)]:e._e(),e._v(" "),"single"==e.mode&&e.hasSelected&&!e.search&&e.iv?[e._t("singlelabel",[u("div",{class:e.classList.singleLabel},[e._v("\n "+e._s(e.iv[e.label])+"\n ")])],{value:e.iv})]:e._e(),e._v(" "),"multiple"==e.mode&&e.hasSelected&&!e.search?[e._t("multiplelabel",[u("div",{class:e.classList.multipleLabel},[e._v("\n "+e._s(e.multipleLabelText)+"\n ")])],{values:e.iv})]:e._e(),e._v(" "),!e.placeholder||e.hasSelected||e.search?e._e():[e._t("placeholder",[u("div",{class:e.classList.placeholder},[e._v("\n "+e._s(e.placeholder)+"\n ")])])],e._v(" "),e.busy?e._t("spinner",[u("span",{class:e.classList.spinner})]):e._e(),e._v(" "),e.hasSelected&&!e.disabled&&e.canClear&&!e.busy?e._t("clear",[u("span",{class:e.classList.clear,on:{mousedown:e.clear}},[u("span",{class:e.classList.clearIcon})])],{clear:e.clear}):e._e(),e._v(" "),e.caret?e._t("caret",[u("span",{class:e.classList.caret,on:{click:e.handleCaretClick}})]):e._e(),e._v(" "),u("div",{class:e.classList.dropdown,attrs:{tabindex:"-1"}},[e._t("beforelist",null,{options:e.fo}),e._v(" "),u("ul",{class:e.classList.options},[e.groups?e._l(e.fg,(function(t,n,a){return u("li",{key:a,class:e.classList.group},[u("div",{class:e.classList.groupLabel(t),attrs:{"data-pointed":e.isPointed(t)},on:{mouseenter:function(u){return e.setPointer(t)},click:function(u){return e.handleGroupClick(t)}}},[e._t("grouplabel",[u("span",[e._v(e._s(t[e.groupLabel]))])],{group:t})],2),e._v(" "),u("ul",{class:e.classList.groupOptions},e._l(t.__VISIBLE__,(function(n,a,l){return u("li",{key:l,class:e.classList.option(n,t),attrs:{"data-pointed":e.isPointed(n)},on:{mouseenter:function(t){return e.setPointer(n)},click:function(t){return e.handleOptionClick(n)}}},[e._t("option",[u("span",[e._v(e._s(n[e.label]))])],{option:n,search:e.search})],2)})),0)])})):e._l(e.fo,(function(t,n,a){return u("li",{key:a,class:e.classList.option(t),attrs:{"data-pointed":e.isPointed(t)},on:{mouseenter:function(u){return e.setPointer(t)},click:function(u){return e.handleOptionClick(t)}}},[e._t("option",[u("span",[e._v(e._s(t[e.label]))])],{option:t,search:e.search})],2)}))],2),e._v(" "),e.noOptions?e._t("nooptions",[u("div",{class:e.classList.noOptions,domProps:{innerHTML:e._s(e.noOptionsText)}})]):e._e(),e._v(" "),e.noResults?e._t("noresults",[u("div",{class:e.classList.noResults,domProps:{innerHTML:e._s(e.noResultsText)}})]):e._e(),e._v(" "),e._t("afterlist",null,{options:e.fo})],2),e._v(" "),e.required?u("input",{class:e.classList.fakeInput,attrs:{tabindex:"-1",required:""},domProps:{value:e.textValue}}):e._e(),e._v(" "),e.nativeSupport?["single"==e.mode?u("input",{attrs:{type:"hidden",name:e.name},domProps:{value:void 0!==e.plainValue?e.plainValue:""}}):e._l(e.plainValue,(function(t,n){return u("input",{key:n,attrs:{type:"hidden",name:e.name+"[]"},domProps:{value:t}})}))]:e._e(),e._v(" "),u("div",{class:e.classList.spacer})],2)};_._withStripped=!0;const O=h({render:_,staticRenderFns:[]},undefined,y,undefined,false,undefined,!1,void 0,void 0,void 0);/* harmony default export */ __webpack_exports__["default"] = (O); 2333 2334 2335 /***/ }), 2336 2337 /***/ "./node_modules/@vueform/multiselect/themes/default.css": 2338 /*!**************************************************************!*\ 2339 !*** ./node_modules/@vueform/multiselect/themes/default.css ***! 2340 \**************************************************************/ 2341 /*! no static exports found */ 2342 /***/ (function(module, exports, __webpack_require__) { 2343 2344 2345 var content = __webpack_require__(/*! !../../../css-loader??ref--6-1!../../../postcss-loader/src??ref--6-2!./default.css */ "./node_modules/css-loader/index.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/@vueform/multiselect/themes/default.css"); 2346 2347 if(typeof content === 'string') content = [[module.i, content, '']]; 2348 2349 var transform; 2350 var insertInto; 2351 2352 2353 2354 var options = {"hmr":true} 2355 2356 options.transform = transform 2357 options.insertInto = undefined; 2358 2359 var update = __webpack_require__(/*! ../../../style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options); 2360 2361 if(content.locals) module.exports = content.locals; 2362 2363 if(false) {} 2364 2365 /***/ }), 2366 2367 /***/ "./node_modules/css-loader/index.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/@vueform/multiselect/themes/default.css": 2368 /*!**********************************************************************************************************************************************!*\ 2369 !*** ./node_modules/css-loader??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/@vueform/multiselect/themes/default.css ***! 2370 \**********************************************************************************************************************************************/ 2371 /*! no static exports found */ 2372 /***/ (function(module, exports, __webpack_require__) { 2373 2374 exports = module.exports = __webpack_require__(/*! ../../../css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false); 2375 // imports 2376 2377 2378 // module 2379 exports.push([module.i, ".multiselect{position:relative;margin:0 auto;width:100%;display:flex;align-items:center;justify-content:flex-end;box-sizing:border-box;cursor:pointer;outline:none;border:var(--ms-border-width,1px) solid var(--ms-border-color,#d1d5db);border-radius:var(--ms-radius,4px);background:var(--ms-bg,#fff);font-size:var(--ms-font-size,1rem);min-height:calc(var(--ms-border-width, 1px)*2 + var(--ms-font-size, 1rem)*var(--ms-line-height, 1.375) + var(--ms-py, .5rem)*2)}.multiselect.is-open{border-radius:var(--ms-radius,4px) var(--ms-radius,4px) 0 0}.multiselect.is-open-top{border-radius:0 0 var(--ms-radius,4px) var(--ms-radius,4px)}.multiselect.is-disabled{cursor:default;background:var(--ms-bg-disabled,#f3f4f6)}.multiselect.is-active{box-shadow:0 0 0 var(--ms-ring-width,3px) var(--ms-ring-color,rgba(16,185,129,.18823529411764706))}.multiselect-multiple-label,.multiselect-placeholder,.multiselect-single-label{display:flex;align-items:center;height:100%;position:absolute;left:0;top:0;pointer-events:none;background:transparent;line-height:var(--ms-line-height,1.375);padding-left:var(--ms-px,.875rem)}.multiselect-placeholder{color:var(--ms-placeholder-color,#9ca3af)}.multiselect-search{width:100%;position:absolute;top:0;bottom:0;left:0;right:0;outline:none;box-sizing:border-box;border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-size:inherit;font-family:inherit;background:var(--ms-bg,#fff);border-radius:var(--ms-radius,4px);padding-left:var(--ms-px,.875rem)}.multiselect-search::-webkit-search-cancel-button,.multiselect-search::-webkit-search-decoration,.multiselect-search::-webkit-search-results-button,.multiselect-search::-webkit-search-results-decoration{-webkit-appearance:none}.multiselect-tags{flex-grow:1;flex-shrink:1;display:flex;flex-wrap:wrap;margin:var(--ms-tag-my,.25rem) 0 0;padding-left:var(--ms-py,.5rem);align-items:center}.multiselect-tag{background:var(--ms-tag-bg,#10b981);color:var(--ms-tag-color,#fff);font-size:var(--ms-tag-font-size,.875rem);line-height:var(--ms-tag-line-height,1.25rem);font-weight:var(--ms-tag-font-weight,600);padding:var(--ms-tag-py,.125rem) 0 var(--ms-tag-py,.125rem) var(--ms-tag-px,.5rem);border-radius:var(--ms-tag-radius,4px);margin-right:var(--ms-tag-mx,.25rem);margin-bottom:var(--ms-tag-my,.25rem);display:flex;align-items:center;white-space:nowrap}.multiselect-tag.is-disabled{padding-right:var(--ms-tag-px,.5rem);background:var(--ms-tag-bg-disabled,#9ca3af);color:var(--ms-tag-color-disabled,#fff)}.multiselect-tag-remove{display:flex;align-items:center;justify-content:center;padding:var(--ms-tag-remove-py,.25rem) var(--ms-tag-remove-px,.25rem);margin:var(--ms-tag-remove-my,0) var(--ms-tag-remove-mx,.125rem);border-radius:var(--ms-tag-remove-radius,4px)}.multiselect-tag-remove:hover{background:rgba(0,0,0,.06274509803921569)}.multiselect-tag-remove-icon{-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'/%3E%3C/svg%3E\");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;background-color:currentColor;opacity:.8;display:inline-block;width:.75rem;height:.75rem}.multiselect-tags-search-wrapper{display:inline-block;position:relative;margin:0 var(--ms-tag-mx,4px) var(--ms-tag-my,4px);flex-grow:1;flex-shrink:1;height:100%}.multiselect-tags-search-copy{visibility:hidden;white-space:pre-wrap;display:inline-block;height:1px;width:100%}.multiselect-tags-search{position:absolute;left:0;right:0;top:0;bottom:0;border:0;-webkit-appearance:none;-moz-appearance:none;outline:none;padding:0;font-size:inherit;font-family:inherit;box-sizing:border-box;width:100%;appearance:none}.multiselect-tags-search::-webkit-search-cancel-button,.multiselect-tags-search::-webkit-search-decoration,.multiselect-tags-search::-webkit-search-results-button,.multiselect-tags-search::-webkit-search-results-decoration{-webkit-appearance:none}.multiselect-spinner{-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 512 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 512 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z'/%3E%3C/svg%3E\");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;background-color:var(--ms-spinner-color,#10b981);width:1rem;height:1rem;z-index:10;margin:0 var(--ms-px,.875rem) 0 0;-webkit-animation:multiselect-spin 1s linear infinite;animation:multiselect-spin 1s linear infinite;flex-shrink:0;flex-grow:0}.multiselect-clear{padding:0 var(--ms-px,.875rem) 0 0;position:relative;z-index:10;opacity:1;transition:.3s;flex-shrink:0;flex-grow:0;display:flex}.multiselect-clear:hover .multiselect-clear-icon{background-color:var(--ms-clear-color-hover,#000)}.multiselect-clear-icon{-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'/%3E%3C/svg%3E\");background-color:var(--ms-clear-color,#999);display:inline-block;transition:.3s}.multiselect-caret,.multiselect-clear-icon{-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:.625rem;height:1.125rem}.multiselect-caret{transform:rotate(0deg);transition:transform .3s;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z'/%3E%3C/svg%3E\");background-color:var(--ms-caret-color,#999);margin:0 var(--ms-px,.875rem) 0 0;position:relative;z-index:10;flex-shrink:0;flex-grow:0;pointer-events:none}.multiselect-caret.is-open{transform:rotate(180deg);pointer-events:auto}.multiselect-dropdown{position:absolute;left:calc(var(--ms-border-width, 1px)*-1);right:calc(var(--ms-border-width, 1px)*-1);bottom:0;transform:translateY(100%);border:var(--ms-dropdown-border-width,1px) solid var(--ms-dropdown-border-color,#d1d5db);margin-top:calc(var(--ms-border-width, 1px)*-1);max-height:15rem;overflow-y:scroll;-webkit-overflow-scrolling:touch;z-index:100;background:var(--ms-dropdown-bg,#fff);display:flex;flex-direction:column;border-radius:0 0 var(--ms-dropdown-radius,4px) var(--ms-dropdown-radius,4px);outline:none}.multiselect-dropdown.is-top{transform:translateY(-100%);top:var(--ms-border-width,1px);bottom:auto;flex-direction:column-reverse;border-radius:var(--ms-dropdown-radius,4px) var(--ms-dropdown-radius,4px) 0 0}.multiselect-dropdown.is-hidden{display:none}.multiselect-options{padding:0;margin:0;list-style:none;display:flex;flex-direction:column;max-height:var(--ms-max-height,10rem)}.multiselect-options.is-top{flex-direction:column-reverse}.multiselect-group{padding:0;margin:0;@apply p-0 m-0}.multiselect-group-label{padding:var(--ms-group-label-py,.3rem) var(--ms-group-label-px,.75rem);font-size:.875rem;font-weight:600;background:#e5e7eb;color:#374151;cursor:default;line-height:var(--ms-group-label-line-height,1.375);display:flex;box-sizing:border-box;text-decoration:none;align-items:center;justify-content:flex-start;text-align:left}.multiselect-group-label.is-pointable{cursor:pointer}.multiselect-group-label.is-pointed{background:var(--ms-group-label-bg-pointed,#d1d5db);color:var(--ms-group-label-color-pointed,#374151)}.multiselect-group-label.is-selected{background:var(--ms-group-label-bg-selected,#059669);color:var(--ms-group-label-color-selected,#fff)}.multiselect-group-label.is-disabled{background:var(--ms-group-label-bg-disabled,#f3f4f6);color:var(--ms-group-label-color-disabled,#d1d5db);cursor:not-allowed}.multiselect-group-label.is-selected.is-pointed{background:var(--ms-group-label-bg-selected-pointed,#0c9e70);color:var(--ms-group-label-color-selected-pointed,#fff)}.multiselect-group-label.is-selected.is-disabled{background:var(--ms-group-label-bg-selected-disabled,#75cfb1);color:var(--ms-group-label-color-selected-disabled,#d1fae5)}.multiselect-group-options{padding:0;margin:0}.multiselect-option{padding:var(--ms-option-py,.5rem) var(--ms-option-px,.75rem);font-size:var(--ms-option-font-size,1rem);line-height:var(--ms-option-line-height,1.375);cursor:pointer;display:flex;box-sizing:border-box;text-decoration:none;align-items:center;justify-content:flex-start;text-align:left}.multiselect-option.is-pointed{background:var(--ms-option-bg-pointed,#f3f4f6);color:var(--ms-option-color-pointed,#1f2937)}.multiselect-option.is-selected{background:var(--ms-option-bg-selected,#10b981);color:var(--ms-option-color-selected,#fff)}.multiselect-option.is-disabled{background:var(--ms-option-bg-disabled,#fff);color:var(--ms-option-color-disabled,#d1d5db);cursor:not-allowed}.multiselect-option.is-selected.is-pointed{background:var(--ms-option-bg-selected-pointed,#26c08e);color:var(--ms-option-color-selected-pointed,#fff)}.multiselect-option.is-selected.is-disabled{background:var(--ms-option-bg-selected-disabled,#87dcc0);color:var(--ms-option-color-selected-disabled,#d1fae5)}.multiselect-no-options,.multiselect-no-results{padding:var(--ms-option-py,.5rem) var(--ms-option-px,.75rem);color:var(--ms-empty-color,#4b5563)}.multiselect-fake-input{background:transparent;position:absolute;left:0;right:0;bottom:-1px;width:100%;height:1px;border:0;padding:0;font-size:0;outline:none}.multiselect-fake-input:active,.multiselect-fake-input:focus{outline:none}.multiselect-spacer{display:none}@-webkit-keyframes multiselect-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes multiselect-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}", ""]); 2380 2381 // exports 2382 2383 2384 /***/ }), 2385 2386 /***/ "./node_modules/css-loader/lib/css-base.js": 2387 /*!*************************************************!*\ 2388 !*** ./node_modules/css-loader/lib/css-base.js ***! 2389 \*************************************************/ 2390 /*! no static exports found */ 2391 /***/ (function(module, exports) { 2392 2393 /* 2394 MIT License http://www.opensource.org/licenses/mit-license.php 2395 Author Tobias Koppers @sokra 2396 */ 2397 // css base code, injected by the css-loader 2398 module.exports = function(useSourceMap) { 2399 var list = []; 2400 2401 // return the list of modules as css string 2402 list.toString = function toString() { 2403 return this.map(function (item) { 2404 var content = cssWithMappingToString(item, useSourceMap); 2405 if(item[2]) { 2406 return "@media " + item[2] + "{" + content + "}"; 2407 } else { 2408 return content; 2409 } 2410 }).join(""); 2411 }; 2412 2413 // import a list of modules into the list 2414 list.i = function(modules, mediaQuery) { 2415 if(typeof modules === "string") 2416 modules = [[null, modules, ""]]; 2417 var alreadyImportedModules = {}; 2418 for(var i = 0; i < this.length; i++) { 2419 var id = this[i][0]; 2420 if(typeof id === "number") 2421 alreadyImportedModules[id] = true; 2422 } 2423 for(i = 0; i < modules.length; i++) { 2424 var item = modules[i]; 2425 // skip already imported module 2426 // this implementation is not 100% perfect for weird media query combinations 2427 // when a module is imported multiple times with different media queries. 2428 // I hope this will never occur (Hey this way we have smaller bundles) 2429 if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { 2430 if(mediaQuery && !item[2]) { 2431 item[2] = mediaQuery; 2432 } else if(mediaQuery) { 2433 item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; 2434 } 2435 list.push(item); 2436 } 2437 } 2438 }; 2439 return list; 2440 }; 2441 2442 function cssWithMappingToString(item, useSourceMap) { 2443 var content = item[1] || ''; 2444 var cssMapping = item[3]; 2445 if (!cssMapping) { 2446 return content; 2447 } 2448 2449 if (useSourceMap && typeof btoa === 'function') { 2450 var sourceMapping = toComment(cssMapping); 2451 var sourceURLs = cssMapping.sources.map(function (source) { 2452 return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' 2453 }); 2454 2455 return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); 2456 } 2457 2458 return [content].join('\n'); 2459 } 2460 2461 // Adapted from convert-source-map (MIT) 2462 function toComment(sourceMap) { 2463 // eslint-disable-next-line no-undef 2464 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); 2465 var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; 2466 2467 return '/*# ' + data + ' */'; 2468 } 2469 2470 2471 /***/ }), 2472 89 2473 /***/ "./node_modules/process/browser.js": 90 2474 /*!*****************************************!*\ … … 477 2861 478 2862 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js"))) 2863 2864 /***/ }), 2865 2866 /***/ "./node_modules/style-loader/lib/addStyles.js": 2867 /*!****************************************************!*\ 2868 !*** ./node_modules/style-loader/lib/addStyles.js ***! 2869 \****************************************************/ 2870 /*! no static exports found */ 2871 /***/ (function(module, exports, __webpack_require__) { 2872 2873 /* 2874 MIT License http://www.opensource.org/licenses/mit-license.php 2875 Author Tobias Koppers @sokra 2876 */ 2877 2878 var stylesInDom = {}; 2879 2880 var memoize = function (fn) { 2881 var memo; 2882 2883 return function () { 2884 if (typeof memo === "undefined") memo = fn.apply(this, arguments); 2885 return memo; 2886 }; 2887 }; 2888 2889 var isOldIE = memoize(function () { 2890 // Test for IE <= 9 as proposed by Browserhacks 2891 // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 2892 // Tests for existence of standard globals is to allow style-loader 2893 // to operate correctly into non-standard environments 2894 // @see https://github.com/webpack-contrib/style-loader/issues/177 2895 return window && document && document.all && !window.atob; 2896 }); 2897 2898 var getTarget = function (target, parent) { 2899 if (parent){ 2900 return parent.querySelector(target); 2901 } 2902 return document.querySelector(target); 2903 }; 2904 2905 var getElement = (function (fn) { 2906 var memo = {}; 2907 2908 return function(target, parent) { 2909 // If passing function in options, then use it for resolve "head" element. 2910 // Useful for Shadow Root style i.e 2911 // { 2912 // insertInto: function () { return document.querySelector("#foo").shadowRoot } 2913 // } 2914 if (typeof target === 'function') { 2915 return target(); 2916 } 2917 if (typeof memo[target] === "undefined") { 2918 var styleTarget = getTarget.call(this, target, parent); 2919 // Special case to return head of iframe instead of iframe itself 2920 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { 2921 try { 2922 // This will throw an exception if access to iframe is blocked 2923 // due to cross-origin restrictions 2924 styleTarget = styleTarget.contentDocument.head; 2925 } catch(e) { 2926 styleTarget = null; 2927 } 2928 } 2929 memo[target] = styleTarget; 2930 } 2931 return memo[target] 2932 }; 2933 })(); 2934 2935 var singleton = null; 2936 var singletonCounter = 0; 2937 var stylesInsertedAtTop = []; 2938 2939 var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js"); 2940 2941 module.exports = function(list, options) { 2942 if (typeof DEBUG !== "undefined" && DEBUG) { 2943 if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); 2944 } 2945 2946 options = options || {}; 2947 2948 options.attrs = typeof options.attrs === "object" ? options.attrs : {}; 2949 2950 // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> 2951 // tags it will allow on a page 2952 if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE(); 2953 2954 // By default, add <style> tags to the <head> element 2955 if (!options.insertInto) options.insertInto = "head"; 2956 2957 // By default, add <style> tags to the bottom of the target 2958 if (!options.insertAt) options.insertAt = "bottom"; 2959 2960 var styles = listToStyles(list, options); 2961 2962 addStylesToDom(styles, options); 2963 2964 return function update (newList) { 2965 var mayRemove = []; 2966 2967 for (var i = 0; i < styles.length; i++) { 2968 var item = styles[i]; 2969 var domStyle = stylesInDom[item.id]; 2970 2971 domStyle.refs--; 2972 mayRemove.push(domStyle); 2973 } 2974 2975 if(newList) { 2976 var newStyles = listToStyles(newList, options); 2977 addStylesToDom(newStyles, options); 2978 } 2979 2980 for (var i = 0; i < mayRemove.length; i++) { 2981 var domStyle = mayRemove[i]; 2982 2983 if(domStyle.refs === 0) { 2984 for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); 2985 2986 delete stylesInDom[domStyle.id]; 2987 } 2988 } 2989 }; 2990 }; 2991 2992 function addStylesToDom (styles, options) { 2993 for (var i = 0; i < styles.length; i++) { 2994 var item = styles[i]; 2995 var domStyle = stylesInDom[item.id]; 2996 2997 if(domStyle) { 2998 domStyle.refs++; 2999 3000 for(var j = 0; j < domStyle.parts.length; j++) { 3001 domStyle.parts[j](item.parts[j]); 3002 } 3003 3004 for(; j < item.parts.length; j++) { 3005 domStyle.parts.push(addStyle(item.parts[j], options)); 3006 } 3007 } else { 3008 var parts = []; 3009 3010 for(var j = 0; j < item.parts.length; j++) { 3011 parts.push(addStyle(item.parts[j], options)); 3012 } 3013 3014 stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; 3015 } 3016 } 3017 } 3018 3019 function listToStyles (list, options) { 3020 var styles = []; 3021 var newStyles = {}; 3022 3023 for (var i = 0; i < list.length; i++) { 3024 var item = list[i]; 3025 var id = options.base ? item[0] + options.base : item[0]; 3026 var css = item[1]; 3027 var media = item[2]; 3028 var sourceMap = item[3]; 3029 var part = {css: css, media: media, sourceMap: sourceMap}; 3030 3031 if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); 3032 else newStyles[id].parts.push(part); 3033 } 3034 3035 return styles; 3036 } 3037 3038 function insertStyleElement (options, style) { 3039 var target = getElement(options.insertInto) 3040 3041 if (!target) { 3042 throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); 3043 } 3044 3045 var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; 3046 3047 if (options.insertAt === "top") { 3048 if (!lastStyleElementInsertedAtTop) { 3049 target.insertBefore(style, target.firstChild); 3050 } else if (lastStyleElementInsertedAtTop.nextSibling) { 3051 target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); 3052 } else { 3053 target.appendChild(style); 3054 } 3055 stylesInsertedAtTop.push(style); 3056 } else if (options.insertAt === "bottom") { 3057 target.appendChild(style); 3058 } else if (typeof options.insertAt === "object" && options.insertAt.before) { 3059 var nextSibling = getElement(options.insertAt.before, target); 3060 target.insertBefore(style, nextSibling); 3061 } else { 3062 throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); 3063 } 3064 } 3065 3066 function removeStyleElement (style) { 3067 if (style.parentNode === null) return false; 3068 style.parentNode.removeChild(style); 3069 3070 var idx = stylesInsertedAtTop.indexOf(style); 3071 if(idx >= 0) { 3072 stylesInsertedAtTop.splice(idx, 1); 3073 } 3074 } 3075 3076 function createStyleElement (options) { 3077 var style = document.createElement("style"); 3078 3079 if(options.attrs.type === undefined) { 3080 options.attrs.type = "text/css"; 3081 } 3082 3083 if(options.attrs.nonce === undefined) { 3084 var nonce = getNonce(); 3085 if (nonce) { 3086 options.attrs.nonce = nonce; 3087 } 3088 } 3089 3090 addAttrs(style, options.attrs); 3091 insertStyleElement(options, style); 3092 3093 return style; 3094 } 3095 3096 function createLinkElement (options) { 3097 var link = document.createElement("link"); 3098 3099 if(options.attrs.type === undefined) { 3100 options.attrs.type = "text/css"; 3101 } 3102 options.attrs.rel = "stylesheet"; 3103 3104 addAttrs(link, options.attrs); 3105 insertStyleElement(options, link); 3106 3107 return link; 3108 } 3109 3110 function addAttrs (el, attrs) { 3111 Object.keys(attrs).forEach(function (key) { 3112 el.setAttribute(key, attrs[key]); 3113 }); 3114 } 3115 3116 function getNonce() { 3117 if (false) {} 3118 3119 return __webpack_require__.nc; 3120 } 3121 3122 function addStyle (obj, options) { 3123 var style, update, remove, result; 3124 3125 // If a transform function was defined, run it on the css 3126 if (options.transform && obj.css) { 3127 result = typeof options.transform === 'function' 3128 ? options.transform(obj.css) 3129 : options.transform.default(obj.css); 3130 3131 if (result) { 3132 // If transform returns a value, use that instead of the original css. 3133 // This allows running runtime transformations on the css. 3134 obj.css = result; 3135 } else { 3136 // If the transform function returns a falsy value, don't add this css. 3137 // This allows conditional loading of css 3138 return function() { 3139 // noop 3140 }; 3141 } 3142 } 3143 3144 if (options.singleton) { 3145 var styleIndex = singletonCounter++; 3146 3147 style = singleton || (singleton = createStyleElement(options)); 3148 3149 update = applyToSingletonTag.bind(null, style, styleIndex, false); 3150 remove = applyToSingletonTag.bind(null, style, styleIndex, true); 3151 3152 } else if ( 3153 obj.sourceMap && 3154 typeof URL === "function" && 3155 typeof URL.createObjectURL === "function" && 3156 typeof URL.revokeObjectURL === "function" && 3157 typeof Blob === "function" && 3158 typeof btoa === "function" 3159 ) { 3160 style = createLinkElement(options); 3161 update = updateLink.bind(null, style, options); 3162 remove = function () { 3163 removeStyleElement(style); 3164 3165 if(style.href) URL.revokeObjectURL(style.href); 3166 }; 3167 } else { 3168 style = createStyleElement(options); 3169 update = applyToTag.bind(null, style); 3170 remove = function () { 3171 removeStyleElement(style); 3172 }; 3173 } 3174 3175 update(obj); 3176 3177 return function updateStyle (newObj) { 3178 if (newObj) { 3179 if ( 3180 newObj.css === obj.css && 3181 newObj.media === obj.media && 3182 newObj.sourceMap === obj.sourceMap 3183 ) { 3184 return; 3185 } 3186 3187 update(obj = newObj); 3188 } else { 3189 remove(); 3190 } 3191 }; 3192 } 3193 3194 var replaceText = (function () { 3195 var textStore = []; 3196 3197 return function (index, replacement) { 3198 textStore[index] = replacement; 3199 3200 return textStore.filter(Boolean).join('\n'); 3201 }; 3202 })(); 3203 3204 function applyToSingletonTag (style, index, remove, obj) { 3205 var css = remove ? "" : obj.css; 3206 3207 if (style.styleSheet) { 3208 style.styleSheet.cssText = replaceText(index, css); 3209 } else { 3210 var cssNode = document.createTextNode(css); 3211 var childNodes = style.childNodes; 3212 3213 if (childNodes[index]) style.removeChild(childNodes[index]); 3214 3215 if (childNodes.length) { 3216 style.insertBefore(cssNode, childNodes[index]); 3217 } else { 3218 style.appendChild(cssNode); 3219 } 3220 } 3221 } 3222 3223 function applyToTag (style, obj) { 3224 var css = obj.css; 3225 var media = obj.media; 3226 3227 if(media) { 3228 style.setAttribute("media", media) 3229 } 3230 3231 if(style.styleSheet) { 3232 style.styleSheet.cssText = css; 3233 } else { 3234 while(style.firstChild) { 3235 style.removeChild(style.firstChild); 3236 } 3237 3238 style.appendChild(document.createTextNode(css)); 3239 } 3240 } 3241 3242 function updateLink (link, options, obj) { 3243 var css = obj.css; 3244 var sourceMap = obj.sourceMap; 3245 3246 /* 3247 If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled 3248 and there is no publicPath defined then lets turn convertToAbsoluteUrls 3249 on by default. Otherwise default to the convertToAbsoluteUrls option 3250 directly 3251 */ 3252 var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; 3253 3254 if (options.convertToAbsoluteUrls || autoFixUrls) { 3255 css = fixUrls(css); 3256 } 3257 3258 if (sourceMap) { 3259 // http://stackoverflow.com/a/26603875 3260 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; 3261 } 3262 3263 var blob = new Blob([css], { type: "text/css" }); 3264 3265 var oldSrc = link.href; 3266 3267 link.href = URL.createObjectURL(blob); 3268 3269 if(oldSrc) URL.revokeObjectURL(oldSrc); 3270 } 3271 3272 3273 /***/ }), 3274 3275 /***/ "./node_modules/style-loader/lib/urls.js": 3276 /*!***********************************************!*\ 3277 !*** ./node_modules/style-loader/lib/urls.js ***! 3278 \***********************************************/ 3279 /*! no static exports found */ 3280 /***/ (function(module, exports) { 3281 3282 3283 /** 3284 * When source maps are enabled, `style-loader` uses a link element with a data-uri to 3285 * embed the css on the page. This breaks all relative urls because now they are relative to a 3286 * bundle instead of the current page. 3287 * 3288 * One solution is to only use full urls, but that may be impossible. 3289 * 3290 * Instead, this function "fixes" the relative urls to be absolute according to the current page location. 3291 * 3292 * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. 3293 * 3294 */ 3295 3296 module.exports = function (css) { 3297 // get current location 3298 var location = typeof window !== "undefined" && window.location; 3299 3300 if (!location) { 3301 throw new Error("fixUrls requires window.location"); 3302 } 3303 3304 // blank or null? 3305 if (!css || typeof css !== "string") { 3306 return css; 3307 } 3308 3309 var baseUrl = location.protocol + "//" + location.host; 3310 var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); 3311 3312 // convert each url(...) 3313 /* 3314 This regular expression is just a way to recursively match brackets within 3315 a string. 3316 3317 /url\s*\( = Match on the word "url" with any whitespace after it and then a parens 3318 ( = Start a capturing group 3319 (?: = Start a non-capturing group 3320 [^)(] = Match anything that isn't a parentheses 3321 | = OR 3322 \( = Match a start parentheses 3323 (?: = Start another non-capturing groups 3324 [^)(]+ = Match anything that isn't a parentheses 3325 | = OR 3326 \( = Match a start parentheses 3327 [^)(]* = Match anything that isn't a parentheses 3328 \) = Match a end parentheses 3329 ) = End Group 3330 *\) = Match anything and then a close parens 3331 ) = Close non-capturing group 3332 * = Match anything 3333 ) = Close capturing group 3334 \) = Match a close parens 3335 3336 /gi = Get all matches, not the first. Be case insensitive. 3337 */ 3338 var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { 3339 // strip quotes (if they exist) 3340 var unquotedOrigUrl = origUrl 3341 .trim() 3342 .replace(/^"(.*)"$/, function(o, $1){ return $1; }) 3343 .replace(/^'(.*)'$/, function(o, $1){ return $1; }); 3344 3345 // already a full url? no change 3346 if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) { 3347 return fullMatch; 3348 } 3349 3350 // convert the url to a full url 3351 var newUrl; 3352 3353 if (unquotedOrigUrl.indexOf("//") === 0) { 3354 //TODO: should we add protocol? 3355 newUrl = unquotedOrigUrl; 3356 } else if (unquotedOrigUrl.indexOf("/") === 0) { 3357 // path should be relative to the base url 3358 newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' 3359 } else { 3360 // path should be relative to current directory 3361 newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' 3362 } 3363 3364 // send back the fixed url(...) 3365 return "url(" + JSON.stringify(newUrl) + ")"; 3366 }); 3367 3368 // send back the fixed css 3369 return fixedCss; 3370 }; 3371 479 3372 480 3373 /***/ }), … … 12632 15525 /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); 12633 15526 /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__); 12634 12635 window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); 15527 /* harmony import */ var _vue_composition_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @vue/composition-api */ "./node_modules/@vue/composition-api/dist/vue-composition-api.mjs"); 15528 /* harmony import */ var _vueform_multiselect_dist_multiselect_vue2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @vueform/multiselect/dist/multiselect.vue2.js */ "./node_modules/@vueform/multiselect/dist/multiselect.vue2.js"); 15529 /* harmony import */ var _vueform_multiselect_themes_default_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @vueform/multiselect/themes/default.css */ "./node_modules/@vueform/multiselect/themes/default.css"); 15530 /* harmony import */ var _vueform_multiselect_themes_default_css__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_vueform_multiselect_themes_default_css__WEBPACK_IMPORTED_MODULE_3__); 15531 15532 window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); // import Multiselect from '@vueform/multiselect'; 15533 15534 15535 15536 15537 vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(_vue_composition_api__WEBPACK_IMPORTED_MODULE_1__["default"]); 15538 vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('multiselect', _vueform_multiselect_dist_multiselect_vue2_js__WEBPACK_IMPORTED_MODULE_2__["default"]); 12636 15539 var $ = jQuery; 12637 15540 new vue__WEBPACK_IMPORTED_MODULE_0___default.a({ -
myloyal/trunk/core/action-runner.php
r2596776 r2606273 1 1 <?php 2 2 namespace myLoyal\core; 3 4 use As247\WpEloquent\Support\Facades\DB; 5 use myLoyal\instance\Log; 6 use myLoyal\models\Badge_User; 3 7 4 8 class Action_Runner{ … … 39 43 } 40 44 41 public function run_actions() { return;42 global $myloyal_point_rules ;45 public function run_actions() { 46 global $myloyal_point_rules, $myloyal_case_hooks; 43 47 $rule_data = Options::instance()->get_option( 'rule_data', 'myloyal' ); 44 48 45 49 foreach ( $rule_data as $case => $rules_array ) { 46 $hook = $myloyal_point_rules[$case]['hook']; 47 switch ( $hook ) { 48 case 'wp_login': 49 add_action( 'wp_login', function ( $user_login, $user ) use ( $rules_array, $hook ) { 50 51 foreach ( $rules_array as $k => $rule ) { 52 $bool = apply_filters( 'myloyal_before_calculate_point', true, $rule, $hook ); 53 if ( $bool ) { 54 $point = $this->calculate_point( $rule ); 55 } 56 $bool = apply_filters( 'myloyal_after_calculate_point', $bool, $rule, $hook ); 57 58 if ( $bool ) { 59 $this->set_point( $rule, $point, 'wp_login', [ 'user' => $user ] ); 60 } 61 } 62 }, 10, 2); 63 break; 64 default: 65 do_action( 'myloyal_process_point', $hook, $rules_array ); 66 break; 50 $hook = $myloyal_case_hooks[$case]; 51 $classname = 'myloyal\\core\\hooks\\'.ucwords( $hook, '_' ); 52 if ( class_exists( $classname ) ) { 53 $classname::instance()->run( $hook, $rules_array ); 67 54 } 55 do_action( 'myloyal_process_point', $hook, $rules_array, $classname ); 68 56 } 69 57 } … … 95 83 * @param array $extra 96 84 */ 97 public function set_point( $rule, $point, $hook = null, $extra = []) {85 public function set_point( $rule, $point, $user_id ) { 98 86 //target actor 99 $result = null; 100 $new_point = 0; 101 switch ( $rule['target_actor'] ) { 102 case 'own': 103 $user = apply_filters( 'myloyal_set_point_for_user',new User( get_current_user_id() ) ) ; 87 $result = null; 88 $user = new Instance_User( $user_id ); 89 $old_point = $user->get_meta( 'points' ); 90 $new_point = $old_point + $point; 91 if ( $new_point < 0 ) { 92 $new_point = 0; 93 } 94 $result = $user->set_meta( 'points', $new_point ); 95 Log::instance()->log( $point. ' earned.', $rule['case'], $user->get_id() ); 96 do_action( 'myloyal_after_set_point', $result, $new_point, $old_point, $user ); 97 } 98 } 104 99 105 if ( $hook && $hook == 'wp_login' ) { 106 $user = new User( $extra['user']->ID ); 107 } 100 /* 101 Array 102 ( 103 [when_user_create_comment] => 104 Array 105 ( 106 [0] => Array 107 ( 108 [case] => when_user_create_comment 109 [action] => add 110 [point] => 1 111 [target_actor] => own 112 [exception_for] => no 113 [applicable_for] => all 114 [post_type] => all 115 ) 108 116 109 if ( $this->check_exception( $user, $rule ) && $this->check_if_applicable( $user, $rule ) ) {117 ) 110 118 111 $old_point = $user->get_meta( 'points' ); 112 $new_point = $old_point + $point; 113 if ( $new_point < 0 ) { 114 $new_point = 0; 115 } 116 $result = $user->set_meta( 'points', $new_point ); 117 } 118 break; 119 case 'sel_roles': 120 break; 121 } 122 123 do_action( 'myloyal_after_set_point', $result, $new_point, $old_point ); 124 } 125 126 /** 127 * @param $user 128 * @param $rule 129 * 130 * @return int 131 */ 132 public function check_if_applicable( $user, $rule ) { 133 //applicable for 134 $updatable = 1; 135 136 if( isset( $rule['applicable_for'] ) ) { 137 switch ( $rule['applicable_for'] ) { 138 case 'all': 139 break; 140 case 'roles': 141 $applicable_roles = $rule['applicable_for-roles']; 142 if( empty( array_intersect( $applicable_roles, get_userdata( get_current_user_id() )->roles ) ) ) { 143 $updatable = 0; 144 } 145 break; 146 case 'users': 147 $applicable_users = $rule['applicable_for-users']; 148 if ( !in_array( get_current_user_id(), $applicable_users ) ) { 149 $updatable = 0; 150 } 151 break; 152 default: 153 break; 154 } 155 } 156 return $updatable; 157 } 158 159 /** 160 * @param $user 161 * @param $rule 162 * 163 * @return int 164 */ 165 public function check_exception( $user, $rule ) { 166 $updatable = 1; 167 if( isset( $rule['applicable_for'] ) ) { 168 switch ( $rule['applicable_for'] ) { 169 case 'no': 170 break; 171 case 'roles': 172 $exceptional_roles = $rule['exception_for-rules']; 173 if( !empty( array_intersect( $exceptional_roles, get_userdata( get_current_user_id() )->roles ) ) ) { 174 $updatable = 0; 175 } 176 break; 177 case 'users': 178 $exceptional_users = $rule['exception_for-users']; 179 if ( in_array( get_current_user_id(), $exceptional_users ) ) { 180 $updatable = 0; 181 } 182 break; 183 default: 184 break; 185 } 186 } 187 return $updatable; 188 } 189 } 119 )*/ -
myloyal/trunk/core/ajax-action.php
r2596776 r2606273 38 38 add_action( 'wp_ajax_myloyal_save_rule_data', [ $this, 'save_rule_data' ] ); 39 39 add_action( 'wp_ajax_myloyal_save_badge_settings', [ $this, 'save_badge_settings' ] ); 40 41 //reset point 42 add_action( 'wp_ajax_myloyal_reset_point', [ $this, 'reset_point'] ); 40 43 } 41 44 … … 54 57 55 58 public function save_badge_settings() { 56 $ badge_settings = $_POST['badge_settings'];59 $new_badge_settings = $_POST['badge_settings']; 57 60 $post_id = $_POST['post_id']; 58 (new Post( $post_id ))->set_meta( 'badge_settings', $badge_settings ); 61 62 //first, take saved badge settings, and modify badges from option with it to clean up previous data 63 $instance_post = new Instance_Post( $post_id ); 64 $badge_settings = $instance_post->get_meta( 'badge_settings' ); 65 !is_array( $badge_settings ) ? $badge_settings = [] : ''; 66 if ( isset( $badge_settings['target_point'] ) ) { 67 $badges = Options::instance()->get_option( 'badges', 'myloyal' ); 68 !is_array( $badges ) ? $badges = [] : ''; 69 if ( isset( $badges[ $badge_settings['target_point'] ] ) ) { 70 foreach ( $badges[ $badge_settings['target_point'] ] as $term => $badge_ids ) { 71 if ( in_array( $post_id, $badge_ids ) ) { 72 unset( $badges[ $badge_settings['target_point'] ][$term][ array_search( $post_id , $badges[ $badge_settings['target_point'] ][$term] ) ] ); 73 if ( empty( $badges[ $badge_settings['target_point'] ][$term] ) ) { 74 unset( $badges[ $badge_settings['target_point'] ][$term] ); 75 if ( empty( $badges[ $badge_settings['target_point'] ] ) ) { 76 unset( $badges[ $badge_settings['target_point'] ] ); 77 } 78 } 79 } 80 } 81 } 82 Options::instance()->set_option( 'badges', 'myloyal', $badges ); 83 } 84 85 $instance_post->set_meta( 'badge_settings', $new_badge_settings ); 59 86 wp_send_json_success([ 60 87 'msg' => 'Settings saved successfully !' 61 88 ]); 62 89 } 90 91 public function reset_point() { 92 if ( ! Functions::instance()->current_user_can( 'reset_points' ) ) wp_send_json_error([ 'msg' => __( 'You cannot reset point !', 'myloyal' )]); 93 $new_point = intval( sanitize_text_field( $_POST['new_point'] ) ); 94 $user_id = $_POST['user_id']; 95 $instance_user = new Instance_User( $user_id ); 96 $old_point = $instance_user->get_meta( 'points' ); 97 $result = $instance_user->set_meta( 'points', $new_point ); 98 if( $result ) { 99 do_action( 'myloyal_after_set_point', $result, $new_point, $old_point, $instance_user ); 100 wp_send_json_success( [ 101 'msg' => 'Point is reset !' 102 ]); 103 } 104 wp_send_json_error( ['msg' => __( 'Something went wrong !', 'myloyal' )] ); 105 } 63 106 } -
myloyal/trunk/core/data-point-rules.php
r2596776 r2606273 1 1 <?php 2 global $myloyal_point_rules, $myloyal_badge_rule; 2 global $myloyal_point_rules, $myloyal_badge_rule, $myloyal_case_hooks; 3 $all_roles = get_editable_roles(); 4 $roles = []; 5 foreach ( $all_roles as $role_name => $role_array ) { 6 $roles[$role_name] = $role_array['name']; 7 } 8 3 9 $common_fields = [ 4 10 [ … … 30 36 'options' => [ 31 37 'own' => __( 'Who perform this', 'myloyal'), 32 /*'all' => __( 'All Users', 'myloyal' ),33 'roles' => __( 'Following Roles', 'myloyal' ),34 'users' => __( 'Specific Users', 'myloyal' )*/35 38 ], 36 39 'default' => 'own' … … 136 139 'type' => 'select', 137 140 'label' => 'Selected Roles', 141 'multiple' => true, 138 142 'desc' => 'Roles with users to who this rule will be applied', 139 143 'options' => [ … … 167 171 ]; 168 172 $myloyal_point_rules = [ 169 'when_user_login' => [ 170 'hook' => 'wp_login', 171 'label' => 'When User Login', 172 'fields' => $common_fields 173 ], 174 'when_user_create_post' => [ 175 'hook' => 'save_post', 176 'label' => 'When user create post', 177 'fields' => array_merge( $common_fields, [ 178 [ 179 'type' => 'string', 180 'string' => 'for ' 181 ], 182 [ 183 'name' => 'is_update', 173 'when_user_visit_site' => [ 174 'hook' => $myloyal_case_hooks['when_user_visit_site'], 175 'label' => __( 'When user visit site', 'myloyal' ), 176 'fields' => [ 177 [ 178 'type' => 'string', 179 'string' => ' Through ' 180 ], 181 [ 182 'name' => 'visitable_page', 183 'type' => 'select', 184 'options' => [ 185 'all' => __( 'any', 'myloyal' ), 186 'sel_page' => __( 'following pages', 'myloyal' ) 187 ] 188 ], 189 [ 190 'name' => 'sel_page', 191 'type' => 'select', 192 'options' => [ 193 '1' => __( 'page1', 'myloyal' ), 194 '2' => __( 'page1', 'myloyal' ), 195 ], 196 'multiple' => true, 197 'visible' => [ 198 [ 199 'key' => 'visitable_page', 200 'val' => 'sel_page' 201 ] 202 ], 203 ], 204 [ 205 'type' => 'string', 206 'string' => ' page and if the user is ' 207 ], 208 [ 209 'name' => 'user_type', 210 'type' => 'select', 211 'options' => [ 212 'guest' => __( 'guest', 'myloyal' ), 213 'logged_in' => __( 'logged in', 'myloyal' ) 214 ] 215 ], 216 [ 217 'type' => 'string', 218 'string' => ' user ' 219 ], 220 [ 221 'name' => 'role_constrain_type', 222 'type' => 'select', 223 'options' => [ 224 'include' => __( 'with', 'myloyal' ), 225 'logged_in' => __( 'not with', 'myloyal' ) 226 ], 227 'visible' => [ 228 [ 229 'key' => 'user_type', 230 'val' => 'logged_in' 231 ] 232 ], 233 ], 234 [ 235 'name' => 'user_role', 236 'type' => 'select', 237 'multiple' => true, 238 'options' => [ 239 'all' => __( 'Any', 'myloyal' ), 240 'role1' => __( 'Role1', 'myloyal' ), 241 'role2' => __( 'Role2', 'myloyal' ) 242 ], 243 'visible' => [ 244 [ 245 'key' => 'user_type', 246 'val' => 'logged_in' 247 ] 248 ], 249 ], 250 [ 251 'type' => 'string', 252 'string' => 'Then' 253 ], 254 [ 255 'name' => 'action', 256 'type' => 'select', 257 'label' => 'Action', 258 'options' => [ 259 'add' => 'Add', 260 'deduct' => 'Deduct' 261 ], 262 'default' => 'add', 263 'desc' => '', 264 ], 265 [ 266 'name' => 'point', 267 'type' => 'number', 268 'label' => 'Point', 269 'default' => 1, 270 'desc' => '' 271 ], 272 [ 273 'type' => 'string', 274 'string' => __( 'to', 'myloyal' ) 275 ], 276 [ 277 'name' => 'target_actor', 184 278 'type' => 'select', 185 279 'label' => '', 280 'options' => [ 281 'own' => __( 'him', 'myloyal'), 282 ], 283 'default' => 'own' 284 ], 285 ] 286 ], 287 'when_user_register' => [ 288 'hook' => $myloyal_case_hooks['when_user_register'], 289 'label' => __( 'When user registers', 'myloyal' ), 290 'fields' => [ 291 [ 292 'type' => 'string', 293 'string' => __( ' as ') 294 ], 295 [ 296 'name' => 'role', 297 'type' => 'select', 298 'multiple' => true, 299 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 300 ], 301 [ 302 'type' => 'string', 303 'string' => __( ' role(s), Then ','myloyal' ) 304 ], 305 [ 306 'name' => 'action', 307 'type' => 'select', 308 'label' => 'Action', 309 'options' => [ 310 'add' => 'Add', 311 'deduct' => 'Deduct' 312 ], 313 'default' => 'add', 186 314 'desc' => '', 187 'options' => [ 188 'all' => 'Both creating and updating', 189 'create' => 'Creating', 190 'update' => 'Updating' 315 ], 316 [ 317 'name' => 'point', 318 'type' => 'number', 319 'label' => 'Point', 320 'default' => 1, 321 'desc' => '' 322 ], 323 [ 324 'type' => 'string', 325 'string' => __( 'to', 'myloyal' ) 326 ], 327 [ 328 'name' => 'target_actor', 329 'type' => 'select', 330 'label' => '', 331 'options' => [ 332 'own' => __( 'him', 'myloyal'), 333 ], 334 'default' => 'own' 335 ], 336 ] 337 ], 338 'when_user_gets_comment' => [ 339 'hook' => $myloyal_case_hooks['when_user_gets_comment'], 340 'label' => __( 'When user gets comment', 'myloyal' ), 341 'fields' => [ 342 [ 343 'type' => 'string', 344 'string' => __( 'for his post, if the post is', 'myloyal' ) 345 ], 346 [ 347 'name' => 'sel_post', 348 'type' => 'select', 349 'label' => 'Selected Post', 350 'desc' => '', 351 'options' => [ 352 'all' => __( 'Any post', 'myloyal' ), 353 'sel_post' => __( 'Any of the following post', 'myloyal') 191 354 ], 192 355 'default' => 'all' 193 356 ], 194 357 [ 195 'type' => 'string', 196 'string' => ' post with post type' 358 'name' => 'sel_post_ids', 359 'type' => 'select', 360 'multiple' => true, 361 'options' => [], 362 'visible' => [ 363 [ 364 'key' => 'sel_post', 365 'val' => 'sel_post' 366 ] 367 ], 368 ], 369 [ 370 'type' => 'string', 371 'string' => 'and the post is of ' 197 372 ], 198 373 [ … … 201 376 'label' => 'Post Type', 202 377 'desc' => '', 203 'options' => array_merge( ['all' => 'Any post type'], get_post_types()), 204 'default' => 'post' 205 ], 206 [ 207 'type' => 'string', 208 'string' => 'and status' 378 'multiple' => true, 379 'options' => array_merge( ['all' => 'Any'], get_post_types()), 380 'default' => 'all' 381 ], 382 [ 383 'type' => 'string', 384 'string' => 'post type, and the post status is ' 209 385 ], 210 386 [ … … 213 389 'label' => 'Post Status', 214 390 'desc' => '', 391 'multiple' => true, 215 392 'options' => array_merge( ['all' => 'Any'],get_post_statuses()), 216 393 'default' => 'publish' 217 394 ], 218 ]) 219 ], 220 'when_user_create_comment' => [ 221 'hook' => 'wp_insert_comment', 222 'label' => 'When user create comment', 223 'fields' => array_merge( $common_fields, [ 224 [ 225 'type' => 'string', 226 'string' => 'for ' 227 ], 228 [ 229 'type' => 'string', 230 'string' => ' creating' 231 ], 232 [ 233 'type' => 'string', 234 'string' => ' comment in' 395 [ 396 'type' => 'string', 397 'string' => ' and the post creator ' 398 ], 399 [ 400 'name' => 'post_author_constrain', 401 'type' => 'select', 402 'options' => [ 403 'include' => __( 'is', 'myloyal' ), 404 'exclude' => __( 'is not', 'myloyal' ), 405 ] 406 ], 407 [ 408 'name' => 'constrain_author_list', 409 'type' => 'select', 410 'options' => [ 411 'all' => __( 'any', 'myloyal' ), 412 'sel_user' => __( 'following', 'myloyal' ), 413 ] 414 ], 415 [ 416 'type' => 'string', 417 'string' => ' user(s) ' 418 ], 419 [ 420 'name' => 'constrain_author_ids', 421 'type' => 'select', 422 'options' => [], 423 'multiple' => true, 424 'visible' => [ 425 [ 426 'key' => 'constrain_author_list', 427 'val' => 'sel_user' 428 ] 429 ], 430 ], 431 [ 432 'type' => 'string', 433 'string' => ' and have ' 434 ], 435 [ 436 'name' => 'constrain_author_role', 437 'type' => 'select', 438 'multiple' => true, 439 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 440 ], 441 [ 442 'type' => 'string', 443 'string' => ' role(s) ' 444 ], 445 [ 446 'type' => 'string', 447 'string' => ' and if the commentator ' 448 ], 449 [ 450 'name' => 'commenter_constrain', 451 'type' => 'select', 452 'options' => [ 453 'include' => __( 'is', 'myloyal' ), 454 'exclude' => __( 'is not', 'myloyal' ), 455 ] 456 ], 457 [ 458 'name' => 'constrain_commenter_list', 459 'type' => 'select', 460 'options' => [ 461 'all' => __( 'any', 'myloyal' ), 462 'sel_user' => __( 'following', 'myloyal' ), 463 ] 464 ], 465 [ 466 'type' => 'string', 467 'string' => ' user(s) ' 468 ], 469 [ 470 'name' => 'constrain_commenter_ids', 471 'type' => 'select', 472 'options' => [], 473 'visible' => [ 474 [ 475 'key' => 'constrain_commenter_list', 476 'val' => 'sel_user' 477 ] 478 ], 479 ], 480 [ 481 'type' => 'string', 482 'string' => ' and have ' 483 ], 484 [ 485 'name' => 'constrain_commenter_role', 486 'type' => 'select', 487 'multiple' => true, 488 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 489 ], 490 [ 491 'type' => 'string', 492 'string' => ' role(s) ' 493 ], 494 [ 495 'type' => 'string', 496 'string' => ' Then ' 497 ], 498 [ 499 'name' => 'action', 500 'type' => 'select', 501 'label' => 'Action', 502 'options' => [ 503 'add' => 'Add', 504 'deduct' => 'Deduct' 505 ], 506 'default' => 'add', 507 'desc' => '', 508 ], 509 [ 510 'name' => 'point', 511 'type' => 'number', 512 'label' => 'Point', 513 'default' => 1, 514 'desc' => '' 515 ], 516 [ 517 'type' => 'string', 518 'string' => __( 'to', 'myloyal' ) 519 ], 520 [ 521 'name' => 'target_actor', 522 'type' => 'select', 523 'label' => '', 524 'options' => [ 525 'post_author' => __( 'Post Author', 'myloyal'), 526 /*'all' => __( 'All Users', 'myloyal' ), 527 'roles' => __( 'Following Roles', 'myloyal' ), 528 'users' => __( 'Specific Users', 'myloyal' )*/ 529 ], 530 'default' => 'post_author' 531 ], 532 533 ] 534 ], 535 'when_user_login' => [ 536 'hook' => $myloyal_case_hooks['when_user_login'], 537 'label' => 'When User Login', 538 'fields' => [ 539 // 540 [ 541 'type' => 'string', 542 'string' => __( 'If the user ', 'myloyal' ) 543 ], 544 [ 545 'name' => 'user_inclusion_type', 546 'type' => 'select', 547 'label' => '', 548 'options' => [ 549 'include' => __( 'is', 'myloyal' ), 550 'exclude' => __( 'is not', 'myloyal' ) 551 ], 552 'default' => 'all' 553 ], 554 [ 555 'name' => 'applicable_for-user_type', 556 'type' => 'select', 557 'label' => '', 558 'options' => [ 559 'all' => __( 'any', 'myloyal' ), 560 'users' => __( 'following', 'myloyal' ) 561 ], 562 'default' => 'all' 563 ], 564 [ 565 'type' => 'string', 566 'string' => ' user(s)' 567 ], 568 [ 569 'name' => 'applicable_for-users', 570 'type' => 'select', 571 'label' => 'Selected Users', 572 'multiple' => true, 573 'desc' => 'Users to who this rule will be applied', 574 'options' => [ 575 'user1' => 'User1' 576 ], 577 'visible' => [ 578 [ 579 'key' => 'applicable_for-user_type', 580 'val' => 'users' 581 ] 582 ], 583 'default' => '' 584 ], 585 [ 586 'type' => 'string', 587 'string' => ' , and ' 588 ], 589 [ 590 'name' => 'role_inclusion_type', 591 'type' => 'select', 592 'label' => '', 593 'options' => [ 594 'include' => __( 'has', 'myloyal' ), 595 'exclude' => __( 'has not', 'myloyal' ) 596 ], 597 'default' => 'all' 598 ], 599 [ 600 'name' => 'applicable_for-role_type', 601 'type' => 'select', 602 'label' => '', 603 'options' => [ 604 'all' => __( 'any', 'myloyal' ), 605 'roles' => __( 'following', 'myloyal' ) 606 ], 607 'default' => 'all' 608 ], 609 [ 610 'type' => 'string', 611 'string' => ' role(s)' 612 ], 613 [ 614 'name' => 'applicable_for-roles', 615 'type' => 'select', 616 'label' => 'Selected Roles', 617 'multiple' => true, 618 'desc' => 'Roles with users to who this rule will be applied', 619 'options' => [ 620 'role1' => 'Role1' 621 ], 622 'visible' => [ 623 [ 624 'key' => 'applicable_for-role_type', 625 'val' => 'roles' 626 ] 627 ], 628 'default' => '' 629 ], 630 [ 631 'type' => 'string', 632 'string' => ' Then ' 633 ], 634 // 635 [ 636 'name' => 'action', 637 'type' => 'select', 638 'label' => 'Action', 639 'options' => [ 640 'add' => 'Add', 641 'deduct' => 'Deduct' 642 ], 643 'default' => 'add', 644 'desc' => '', 645 ], 646 [ 647 'name' => 'point', 648 'type' => 'number', 649 'label' => 'Point', 650 'default' => 1, 651 'desc' => '' 652 ], 653 [ 654 'type' => 'string', 655 'string' => __( 'to', 'myloyal' ) 656 ], 657 [ 658 'name' => 'target_actor', 659 'type' => 'select', 660 'label' => '', 661 'options' => [ 662 'own' => __( 'him', 'myloyal'), 663 ], 664 'default' => 'own' 665 ], 666 // 667 ] 668 ], 669 'when_user_creates_post' => [ 670 'hook' => $myloyal_case_hooks['when_user_creates_post'], 671 'label' => __( 'When user creates/updates post', 'myloyal' ), 672 'fields' => [ 673 [ 674 'type' => 'string', 675 'string' => __( 'If the user is ', 'myloyal' ) 676 ], 677 [ 678 'name' => 'user_type', 679 'type' => 'select', 680 'options' => [ 681 'all' => __( 'any', 'myloyal' ), 682 'sel_user' => __( 'following', 'myloyal' ), 683 ] 684 ], 685 [ 686 'type' => 'string', 687 'string' => __( ' user(s) ', 'myloyal' ) 688 ], 689 [ 690 'name' => 'sel_users', 691 'type' => 'select', 692 'multiple' => true, 693 'options' => [ 694 'user1' => __( 'User1', 'myloyal' ), 695 'user2' => __( 'User2', 'myloyal' ) 696 ], 697 'visible' => [ 698 [ 699 'key' => 'user_type', 700 'val' => 'sel_user' 701 ] 702 ], 703 ], 704 [ 705 'type' => 'string', 706 'string' => __( ' ,and if the user has ', 'myloyal' ) 707 ], 708 [ 709 'name' => 'role_types', 710 'type' => 'select', 711 'multiple' => true, 712 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 713 ], 714 [ 715 'type' => 'string', 716 'string' => __( ' roles, and if the post has ', 'myloyal' ) 717 ], 718 [ 719 'name' => 'post_statuses', 720 'type' => 'select', 721 'multiple' => true, 722 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], get_post_statuses() ) 723 ], 724 [ 725 'type' => 'string', 726 'string' => __( ' post status and has ', 'myloyal' ) 727 ], 728 [ 729 'name' => 'post_types', 730 'type' => 'select', 731 'multiple' => true, 732 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], get_post_types() ) 733 ], 734 [ 735 'type' => 'string', 736 'string' => __( ' post type(s), and if the post is ', 'myloyal' ) 737 ], 738 [ 739 'name' => 'is_update', 740 'type' => 'select', 741 'multiple' => true, 742 'options' => [ 743 'false' => __( 'created', 'myloyal' ), 744 'true' => __( 'updated', 'myloyal' ), 745 ] 746 ], 747 [ 748 'type' => 'string', 749 'string' => '<div></div>' 750 ], 751 [ 752 'type' => 'string', 753 'string' => 'Then ' 754 ], 755 [ 756 'name' => 'action', 757 'type' => 'select', 758 'label' => 'Action', 759 'options' => [ 760 'add' => 'Add', 761 'deduct' => 'Deduct' 762 ], 763 'default' => 'add', 764 'desc' => '', 765 ], 766 [ 767 'name' => 'point', 768 'type' => 'number', 769 'label' => 'Point', 770 'default' => 1, 771 'desc' => '' 772 ], 773 [ 774 'type' => 'string', 775 'string' => __( 'to', 'myloyal' ) 776 ], 777 [ 778 'name' => 'target_actor', 779 'type' => 'select', 780 'label' => '', 781 'options' => [ 782 'own' => __( 'Who perform this', 'myloyal'), 783 ], 784 'default' => 'own' 785 ] 786 ] 787 ], 788 'when_user_creates_comment' => [ 789 'hook' => $myloyal_case_hooks['when_user_creates_comment'], 790 'label' => __( 'When user creates comment', 'myloyal' ), 791 'fields' => [ 792 [ 793 'type' => 'string', 794 'string' => __( 'in a post, if the post is', 'myloyal' ) 795 ], 796 [ 797 'name' => 'sel_post', 798 'type' => 'select', 799 'label' => 'Selected Post', 800 'desc' => '', 801 'options' => [ 802 'all' => __( 'Any post', 'myloyal' ), 803 'sel_post' => __( 'Any of the following post', 'myloyal') 804 ], 805 'default' => 'all' 806 ], 807 [ 808 'name' => 'sel_post_ids', 809 'type' => 'select', 810 'multiple' => true, 811 'options' => [], 812 'visible' => [ 813 [ 814 'key' => 'sel_post', 815 'val' => 'sel_post' 816 ] 817 ], 818 ], 819 [ 820 'type' => 'string', 821 'string' => 'and the post is of ' 235 822 ], 236 823 [ … … 239 826 'label' => 'Post Type', 240 827 'desc' => '', 241 'options' => array_merge( ['all' => 'Any post type'], get_post_types()), 242 'default' => 'post' 243 ] 244 ]) 828 'multiple' => true, 829 'options' => array_merge( ['all' => 'Any'], get_post_types()), 830 'default' => 'all' 831 ], 832 [ 833 'type' => 'string', 834 'string' => 'post type, and the post status is ' 835 ], 836 [ 837 'name' => 'post_status', 838 'type' => 'select', 839 'label' => 'Post Status', 840 'desc' => '', 841 'multiple' => true, 842 'options' => array_merge( ['all' => 'Any'],get_post_statuses()), 843 'default' => 'publish' 844 ], 845 [ 846 'type' => 'string', 847 'string' => ' and the post creator ' 848 ], 849 [ 850 'name' => 'post_author_constrain', 851 'type' => 'select', 852 'options' => [ 853 'include' => __( 'is', 'myloyal' ), 854 'exclude' => __( 'is not', 'myloyal' ), 855 ] 856 ], 857 [ 858 'name' => 'constrain_author_list', 859 'type' => 'select', 860 'options' => [ 861 'all' => __( 'any', 'myloyal' ), 862 'sel_user' => __( 'following', 'myloyal' ), 863 ] 864 ], 865 [ 866 'type' => 'string', 867 'string' => ' user(s) ' 868 ], 869 [ 870 'name' => 'constrain_author_ids', 871 'type' => 'select', 872 'options' => [], 873 'multiple' => true, 874 'visible' => [ 875 [ 876 'key' => 'constrain_author_list', 877 'val' => 'sel_user' 878 ] 879 ], 880 ], 881 [ 882 'type' => 'string', 883 'string' => ' and have ' 884 ], 885 [ 886 'name' => 'constrain_author_role', 887 'type' => 'select', 888 'multiple' => true, 889 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 890 ], 891 [ 892 'type' => 'string', 893 'string' => ' role(s) ' 894 ], 895 [ 896 'type' => 'string', 897 'string' => ' and if the commentator ' 898 ], 899 [ 900 'name' => 'commenter_constrain', 901 'type' => 'select', 902 'options' => [ 903 'include' => __( 'is', 'myloyal' ), 904 'exclude' => __( 'is not', 'myloyal' ), 905 ] 906 ], 907 [ 908 'name' => 'constrain_commenter_list', 909 'type' => 'select', 910 'options' => [ 911 'all' => __( 'any', 'myloyal' ), 912 'sel_user' => __( 'following', 'myloyal' ), 913 ] 914 ], 915 [ 916 'type' => 'string', 917 'string' => ' user(s) ' 918 ], 919 [ 920 'name' => 'constrain_commenter_ids', 921 'type' => 'select', 922 'options' => [], 923 'visible' => [ 924 [ 925 'key' => 'constrain_commenter_list', 926 'val' => 'sel_user' 927 ] 928 ], 929 ], 930 [ 931 'type' => 'string', 932 'string' => ' and have ' 933 ], 934 [ 935 'name' => 'constrain_commenter_role', 936 'type' => 'select', 937 'multiple' => true, 938 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 939 ], 940 [ 941 'type' => 'string', 942 'string' => ' role(s) ' 943 ], 944 [ 945 'type' => 'string', 946 'string' => ' Then ' 947 ], 948 [ 949 'name' => 'action', 950 'type' => 'select', 951 'label' => 'Action', 952 'options' => [ 953 'add' => 'Add', 954 'deduct' => 'Deduct' 955 ], 956 'default' => 'add', 957 'desc' => '', 958 ], 959 [ 960 'name' => 'point', 961 'type' => 'number', 962 'label' => 'Point', 963 'default' => 1, 964 'desc' => '' 965 ], 966 [ 967 'type' => 'string', 968 'string' => __( 'to', 'myloyal' ) 969 ], 970 [ 971 'name' => 'target_actor', 972 'type' => 'select', 973 'label' => '', 974 'options' => [ 975 'commenter' => __( 'Commenter', 'myloyal'), 976 /*'all' => __( 'All Users', 'myloyal' ), 977 'roles' => __( 'Following Roles', 'myloyal' ), 978 'users' => __( 'Specific Users', 'myloyal' )*/ 979 ], 980 'default' => 'post_author' 981 ], 982 983 ] 245 984 ], 246 'when_user_update_comment' => [ 247 'hook' => 'edit_comment', 248 'label' => 'When user update comment', 249 'fields' => array_merge( $common_fields, [ 250 [ 251 'type' => 'string', 252 'string' => 'for ' 253 ], 254 [ 255 'type' => 'string', 256 'string' => ' updating' 257 ], 258 [ 259 'type' => 'string', 260 'string' => ' comment in' 985 'when_user_updates_comment' => [ 986 'hook' => $myloyal_case_hooks['when_user_updates_comment'], 987 'label' => __( 'When user updates comment', 'myloyal' ), 988 'fields' => [ 989 [ 990 'type' => 'string', 991 'string' => __( 'in a post, if the post is', 'myloyal' ) 992 ], 993 [ 994 'name' => 'sel_post', 995 'type' => 'select', 996 'label' => 'Selected Post', 997 'desc' => '', 998 'options' => [ 999 'all' => __( 'Any post', 'myloyal' ), 1000 'sel_post' => __( 'Any of the following post', 'myloyal') 1001 ], 1002 'default' => 'all' 1003 ], 1004 [ 1005 'name' => 'sel_post_ids', 1006 'type' => 'select', 1007 'multiple' => true, 1008 'options' => [], 1009 'visible' => [ 1010 [ 1011 'key' => 'sel_post', 1012 'val' => 'sel_post' 1013 ] 1014 ], 1015 ], 1016 [ 1017 'type' => 'string', 1018 'string' => 'and the post is of ' 261 1019 ], 262 1020 [ … … 265 1023 'label' => 'Post Type', 266 1024 'desc' => '', 267 'options' => array_merge( ['all' => 'Any post type'], get_post_types()), 268 'default' => 'post' 269 ] 270 ]) 1025 'multiple' => true, 1026 'options' => array_merge( ['all' => 'Any'], get_post_types()), 1027 'default' => 'all' 1028 ], 1029 [ 1030 'type' => 'string', 1031 'string' => 'post type, and the post status is ' 1032 ], 1033 [ 1034 'name' => 'post_status', 1035 'type' => 'select', 1036 'label' => 'Post Status', 1037 'desc' => '', 1038 'multiple' => true, 1039 'options' => array_merge( ['all' => 'Any'],get_post_statuses()), 1040 'default' => 'publish' 1041 ], 1042 [ 1043 'type' => 'string', 1044 'string' => ' and the post creator ' 1045 ], 1046 [ 1047 'name' => 'post_author_constrain', 1048 'type' => 'select', 1049 'options' => [ 1050 'include' => __( 'is', 'myloyal' ), 1051 'exclude' => __( 'is not', 'myloyal' ), 1052 ] 1053 ], 1054 [ 1055 'name' => 'constrain_author_list', 1056 'type' => 'select', 1057 'options' => [ 1058 'all' => __( 'any', 'myloyal' ), 1059 'sel_user' => __( 'following', 'myloyal' ), 1060 ] 1061 ], 1062 [ 1063 'type' => 'string', 1064 'string' => ' user(s) ' 1065 ], 1066 [ 1067 'name' => 'constrain_author_ids', 1068 'type' => 'select', 1069 'options' => [], 1070 'multiple' => true, 1071 'visible' => [ 1072 [ 1073 'key' => 'constrain_author_list', 1074 'val' => 'sel_user' 1075 ] 1076 ], 1077 ], 1078 [ 1079 'type' => 'string', 1080 'string' => ' and have ' 1081 ], 1082 [ 1083 'name' => 'constrain_author_role', 1084 'type' => 'select', 1085 'multiple' => true, 1086 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 1087 ], 1088 [ 1089 'type' => 'string', 1090 'string' => ' role(s) ' 1091 ], 1092 [ 1093 'type' => 'string', 1094 'string' => ' and if the commentator ' 1095 ], 1096 [ 1097 'name' => 'commenter_constrain', 1098 'type' => 'select', 1099 'options' => [ 1100 'include' => __( 'is', 'myloyal' ), 1101 'exclude' => __( 'is not', 'myloyal' ), 1102 ] 1103 ], 1104 [ 1105 'name' => 'constrain_commenter_list', 1106 'type' => 'select', 1107 'options' => [ 1108 'all' => __( 'any', 'myloyal' ), 1109 'sel_user' => __( 'following', 'myloyal' ), 1110 ] 1111 ], 1112 [ 1113 'type' => 'string', 1114 'string' => ' user(s) ' 1115 ], 1116 [ 1117 'name' => 'constrain_commenter_ids', 1118 'type' => 'select', 1119 'options' => [], 1120 'visible' => [ 1121 [ 1122 'key' => 'constrain_commenter_list', 1123 'val' => 'sel_user' 1124 ] 1125 ], 1126 ], 1127 [ 1128 'type' => 'string', 1129 'string' => ' and have ' 1130 ], 1131 [ 1132 'name' => 'constrain_commenter_role', 1133 'type' => 'select', 1134 'multiple' => true, 1135 'options' => array_merge( ['all' => __( 'any', 'myloyal' )], $roles ) 1136 ], 1137 [ 1138 'type' => 'string', 1139 'string' => ' role(s) ' 1140 ], 1141 [ 1142 'type' => 'string', 1143 'string' => ' Then ' 1144 ], 1145 [ 1146 'name' => 'action', 1147 'type' => 'select', 1148 'label' => 'Action', 1149 'options' => [ 1150 'add' => 'Add', 1151 'deduct' => 'Deduct' 1152 ], 1153 'default' => 'add', 1154 'desc' => '', 1155 ], 1156 [ 1157 'name' => 'point', 1158 'type' => 'number', 1159 'label' => 'Point', 1160 'default' => 1, 1161 'desc' => '' 1162 ], 1163 [ 1164 'type' => 'string', 1165 'string' => __( 'to', 'myloyal' ) 1166 ], 1167 [ 1168 'name' => 'target_actor', 1169 'type' => 'select', 1170 'label' => '', 1171 'options' => [ 1172 'commenter' => __( 'Commenter', 'myloyal'), 1173 /*'all' => __( 'All Users', 'myloyal' ), 1174 'roles' => __( 'Following Roles', 'myloyal' ), 1175 'users' => __( 'Specific Users', 'myloyal' )*/ 1176 ], 1177 'default' => 'post_author' 1178 ], 1179 1180 ] 271 1181 ], 272 1182 'when_user_create_user' => [ 273 'hook' => 'user_register',1183 'hook' => $myloyal_case_hooks['when_user_create_user'], 274 1184 'label' => 'When user create user', 275 1185 'fields' => array_merge( $common_fields, [ -
myloyal/trunk/core/meta-panel.php
r2596776 r2606273 59 59 wp_set_object_terms( $post_id, 'common', 'achievements' ); 60 60 $terms = wp_get_post_terms( $post_id, 'achievements' ); 61 62 61 } 63 62 64 63 65 $badge_settings = (new Post($post_id))->get_meta('badge_settings' ); 64 $badge_settings = (new Instance_Post($post_id))->get_meta('badge_settings' ); 65 66 66 if ( !is_array( $badge_settings ) ) { 67 67 $badge_settings = []; … … 74 74 75 75 if ( isset( $badge_settings['target_point'] ) ) { 76 $badges[$badge_settings['target_point']][ $terms[0]->slug][] = $post_id;77 $badges[$badge_settings['target_point']][ $terms[0]->slug] = array_unique( $badges[$badge_settings['target_point']][$terms[0]->slug] );76 $badges[$badge_settings['target_point']]['term_'.$terms[0]->term_id][] = $post_id; 77 $badges[$badge_settings['target_point']]['term_'.$terms[0]->term_id] = array_unique( $badges[$badge_settings['target_point']]['term_'.$terms[0]->term_id] ); 78 78 } 79 79 … … 81 81 } 82 82 } 83 84 83 /*$settings = [ 85 84 'badges' => [ -
myloyal/trunk/core/options.php
r2596776 r2606273 7 7 'myloyal' => null, //sections = rule_data, badges 8 8 //'rule_data' => null, 9 'myloyal_pages' => null, //[ 'user_profile' => id ] 9 10 ]; 10 11 -
myloyal/trunk/core/point-processor.php
r2596776 r2606273 36 36 37 37 public function __construct() { 38 add_action( 'myloyal_process_point', [ $this, 'process_point_on_actions' ], 10, 2 );39 }40 41 public function process_point_on_actions( $hook, $rules_array ) {42 switch ( $hook ) {43 case 'save_post':44 add_action( $hook, function ( $post_id, $post, $update ) use ( $hook, $rules_array ) {45 $this->process_on_save_post( $post_id, $post, $update, $hook, $rules_array );46 }, 10, 3 );47 break;48 case 'wp_insert_comment':49 add_action( $hook, function ( $id, $comment ) use ( $hook, $rules_array ) {50 $this->process_on_wp_insert_comment( $id, $comment, $hook, $rules_array );51 }, 10, 2 );52 break;53 case 'edit_comment':54 add_action( $hook, function ( $id, $comment ) use ( $hook, $rules_array ) {55 $this->process_on_edit_comment( $id, $comment, $hook, $rules_array );56 }, 10, 2 );57 break;58 case 'user_register':59 add_action( $hook, function ( $user_id, $userdata ) use ( $hook, $rules_array ) {60 $this->{'process_on_'.$hook}( $user_id, $userdata, $hook, $rules_array );61 }, 10, 2 );62 break;63 }64 }65 66 /**67 * @param $post_id68 * @param $post69 * @param $update70 * @param $hook71 * @param $rules_array72 */73 public function process_on_save_post( $post_id, $post, $update, $hook, $rules_array ) {74 foreach ( $rules_array as $k => $rule ) {75 $updatable = 1;76 77 //check is_update78 if( $rule['is_update'] != 'all' ) {79 if ( ( $update && $rule['is_update'] == 'create' ) || ( !$update && $rule['is_update'] == 'update' ) ) {80 return;81 }82 }83 84 //check post type85 if ( $rule['post_type'] != 'all' && $post->post_type !== $rule['post_type'] ) {86 return;87 }88 89 //check post status90 if( $rule['post_status'] !== 'all' && $post->post_status !== $rule['post_status'] ) {91 return;92 }93 94 $bool = apply_filters( 'myloyal_before_calculate_point', true, $rule, $hook );95 if ( $bool ) {96 $point = Action_Runner::instance()->calculate_point( $rule );97 }98 $bool = apply_filters( 'myloyal_after_calculate_point', $bool, $rule, $hook );99 100 if ( $bool ) {101 Action_Runner::instance()->set_point( $rule, $point );102 }103 }104 }105 106 /**107 * @param $id108 * @param $comment109 * @param $hook110 * @param $rules_array111 */112 function process_on_wp_insert_comment( $id, $comment, $hook, $rules_array ) {113 114 foreach ( $rules_array as $k => $rule ) {115 //check post type116 if ( $rule['post_type'] !== 'all' && get_post_type( $comment->comment_post_ID ) !== $rule['post_type'] ) {117 return;118 }119 120 $point = Action_Runner::instance()->calculate_point( $rule );121 Action_Runner::instance()->set_point( $rule, $point );122 }123 38 } 124 39 … … 130 45 */ 131 46 function process_on_edit_comment( $id, $comment, $hook, $rules_array ) { 132 foreach ( $rules_array as $k => $rule ) {133 //check post type134 if ( $rule['post_type'] !== 'all' && get_post_type( $comment['comment_post_ID'] ) !== $rule['post_type'] ) {135 return;136 }137 138 $point = Action_Runner::instance()->calculate_point( $rule );139 Action_Runner::instance()->set_point( $rule, $point );140 }141 47 } 142 48 143 49 /** 144 * @param $user_id145 * @param $userdata146 50 * @param $hook 147 51 * @param $rules_array 148 52 */ 149 public function process_on_user_register( $user_id, $userdata, $hook, $rules_array ) { 150 foreach ( $rules_array as $k => $rule ) { 151 152 if ( $rule['case'] == 'when_user_create_user' ) { 153 //check if the creator is the registerer himself, if so, return 154 if( get_current_user_id() == $user_id ) { 155 return; 156 } 157 } elseif ( $rule['case'] == 'when_user_register' ) { 158 if( get_current_user_id() != $user_id ) { 159 return; 160 } 161 } 162 163 //check role for created user 164 if ( empty( array_intersect( ['all', $userdata['role'] ], $rule['role'] ) ) ) { 165 return; 166 } 167 168 $point = Action_Runner::instance()->calculate_point( $rule ); 169 Action_Runner::instance()->set_point( $rule, $point ); 170 } 53 public function wp_head() { 171 54 } 172 55 -
myloyal/trunk/core/point-rule.php
r2596776 r2606273 37 37 38 38 public function __construct() { 39 add_action( 'myloyal_after_set_point', [ $this, 'assign_badge' ], 10, 3 );40 }41 39 42 public function assign_badge( $result, $new_point, $old_point ) {43 //check if any badge applicable44 if ( $result ) {45 $badges = Options::instance()->get_option( 'badges', 'myloyal', [] );46 47 $to = $from = null;48 $increse = null;49 50 if ( $new_point > $old_point ) {51 $from = $old_point;52 $to = $new_point;53 $increse = true;54 } elseif ( $new_point < $old_point ) {55 //decrease, detach badge56 $from = $new_point;57 $to = $old_point;58 $increse = false;59 }60 61 if ( !is_null( $increse ) ) {62 foreach ( $badges as $point => $point_data) {63 if ( $point >= $to && $point <= $from ) {64 if ( $increse ) {65 //attach66 67 } else {68 //detach69 }70 }71 }72 }73 $badges = Options::instance()->get_option( 'badges', 'myloyal', [] );74 75 }76 40 } 77 41 } -
myloyal/trunk/core/user-actions.php
r2596776 r2606273 37 37 public function __construct() { 38 38 add_action( 'show_user_profile', [ $this, 'user_profile_fields' ] ); 39 add_action( 'admin_footer', [ $this, 'wp_footer'] ); 39 40 } 40 41 … … 42 43 ?> 43 44 <h3><?php _e( 'myLoyal Info', 'myloyal' ); ?></h3> 44 <table class="form-table"> 45 <input type="hidden" name="user_id" value="<?php echo $user->ID; ?>"> 46 <table class="form-table"> 45 47 <tr> 46 48 <th><label for="address"><?php _e("Points Achieved", 'myloyal'); ?></label></th> 47 49 <td> 48 <?php echo ( new User( $user->ID ) )->get_meta('points'); ?> 50 <span class="myloyal-user-points"> 51 <?php echo ( new Instance_User( $user->ID ) )->get_meta('points'); ?> 52 </span> 49 53 </td> 54 <?php 55 if ( Functions::instance()->current_user_can( 'reset_points' ) ) { 56 ?> 57 <td> 58 <div style="margin-bottom:10px;"> 59 <a href="javascript:" class="btn btn-danger myloyal_reset_toggle_handler"><?php esc_attr_e( 'Reset Point', 'myloyal' ); ?></a> 60 </div> 61 <div class="myloyal_new_point_container"> 62 <input type="number" name="myloyal_new_point" value="0"> 63 <a href="javascript:" class="myloyal_reset_point"><?php _e( 'Reset', 'myloyal' ); ?></a> 64 </div> 65 </td> 66 <?php 67 } 68 ?> 50 69 </tr> 51 70 </table> 71 72 <?php 73 } 74 75 public function wp_footer() { 76 global $pagenow; 77 if ( $pagenow !== 'profile.php' ) return; 78 ?> 79 <style> 80 .myloyal_new_point_container { 81 display: none; 82 } 83 </style> 84 <script> 85 (function ($) { 86 $('.myloyal_reset_toggle_handler').click(function () { 87 $('.myloyal_new_point_container').toggle(); 88 }); 89 $('.myloyal_reset_point').click(function () { 90 $.post( 91 ajaxurl, 92 { 93 action: 'myloyal_reset_point', 94 new_point: $('[name="myloyal_new_point"]').val(), 95 user_id: $('[name="user_id"]').val() 96 }, 97 function (res) { 98 if ( res.success ) { 99 $('.myloyal-user-points').html( $('[name="myloyal_new_point"]').val() ); 100 } 101 $('.myloyal_new_point_container').toggle(); 102 } 103 ) 104 }); 105 }(jQuery)) 106 </script> 52 107 <?php 53 108 } -
myloyal/trunk/myloyal.php
r2601535 r2606273 5 5 * Plugin URI: 6 6 * Description: Manage points, rewards, gamifications, ranks, badges on user activities on your site 7 * Version: 1.0 7 * Version: 1.0.1 8 8 * Author: CyberCraft 9 9 * Author URI: … … 34 34 use myLoyal\core\Admin_Menu; 35 35 use myLoyal\core\Ajax_Action; 36 use myLoyal\core\Badge_Actions; 36 37 use myLoyal\core\Meta_Panel; 37 38 use myLoyal\core\Options; 38 39 use myLoyal\core\Point_Processor; 40 use myLoyal\core\Point_Rule; 39 41 use myLoyal\core\Post_Types; 40 42 use myLoyal\core\User_Actions; … … 49 51 spl_autoload_register(function ($class_name) { 50 52 $file = strtolower( str_replace( ['\\','_'], ['/','-'], $class_name ) ).'.php'; 51 if ( file_exists( dirname( __DIR__ ) . '/' . $file ) ) { 52 include_once __DIR__.'/core/'.strtolower( str_replace( '_', '-', array_pop(explode('\\', $class_name) ) ) ).'.php'; 53 $file = str_replace('myloyal', '', $file); 54 if ( file_exists( __DIR__ . '/' . $file ) ) { 55 include_once __DIR__ . '/' . $file; 53 56 } 54 57 }); … … 58 61 59 62 use As247\WpEloquent\Application; 63 use myLoyal\migrations\Badge_User; 64 use myLoyal\migrations\Log; 65 use myLoyal\shortcodes\User_Profile; 60 66 61 67 Application::bootWp(); … … 98 104 register_activation_hook( __FILE__, [ $this, 'on_active' ] ); 99 105 $this->includes(); 106 User_Profile::instance(); 100 107 Meta_Panel::instance(); 101 Point_Processor::instance();102 108 User_Actions::instance(); 109 Badge_Actions::instance(); 103 110 Ajax_Action::instance(); 104 111 Post_Types::instance(); 105 112 Admin_Menu::instance(); 113 Point_Processor::instance(); 106 114 Action_Runner::instance(); 115 Point_Rule::instance(); 107 116 } 108 117 109 118 public function includes() { 110 include_once MYLOYAL_PATH . 'core/data-point-rules.php'; 119 include_once MYLOYAL_PATH . 'core/data-case-hooks.php'; 120 add_action( 'admin_init', function () { 121 include_once MYLOYAL_PATH . 'core/data-point-rules.php'; 122 }); 111 123 } 112 124 113 125 public function on_active() { 114 126 //install db tables 115 include_once 'migrations/class-badge-user.php'; 127 (new Badge_User())->run(); 128 (new Log())->run(); 129 130 //create a page with shortcode 131 $myloyal_pages = Options::instance()->get_option( 'myloyal_pages' ); 132 if ( !$myloyal_pages || !isset( $myloyal_pages['user_profile'] ) ) { 133 $args = [ 134 'post_type' => 'page', 135 'post_status' => 'publish', 136 'post_title' => 'myLoyal User Profile', 137 'post_content' => '[myloyal_user_profile]' 138 ]; 139 $post_id = wp_insert_post( $args ); 140 $myloyal_pages['user_profile'] = $post_id; 141 Options::instance()->set_option( 'myloyal_pages', null, $myloyal_pages ); 142 } 116 143 } 117 144 } -
myloyal/trunk/package-lock.json
r2596776 r2606273 1324 1324 } 1325 1325 }, 1326 "@vue/composition-api": { 1327 "version": "1.2.1", 1328 "resolved": "https://registry.npmjs.org/@vue/composition-api/-/composition-api-1.2.1.tgz", 1329 "integrity": "sha512-Gea21Vyl2PVDLc6Fq1rr5poI2qU+1WjGze6oykWDSiGEII72n11XdZOSqF6BA53CXZZVs27cz3S3mfJM0a59Vw==", 1330 "dev": true, 1331 "requires": { 1332 "tslib": "^2.3.0" 1333 }, 1334 "dependencies": { 1335 "tslib": { 1336 "version": "2.3.1", 1337 "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", 1338 "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", 1339 "dev": true 1340 } 1341 } 1342 }, 1343 "@vueform/multiselect": { 1344 "version": "2.2.0", 1345 "resolved": "https://registry.npmjs.org/@vueform/multiselect/-/multiselect-2.2.0.tgz", 1346 "integrity": "sha512-ozY8/JDAmrBITgEmgB61Grffw3xlQm0E7od/wRsCjx9eFFCAlguLsPOAXZz5Y8eHVjLR7RPA2M5L6A3Exttmeg==" 1347 }, 1326 1348 "@webassemblyjs/ast": { 1327 1349 "version": "1.9.0", … … 11308 11330 } 11309 11331 }, 11310 "vue-multiselect": {11311 "version": "2.1.6",11312 "resolved": "https://registry.npmjs.org/vue-multiselect/-/vue-multiselect-2.1.6.tgz",11313 "integrity": "sha512-s7jmZPlm9FeueJg1RwJtnE9KNPtME/7C8uRWSfp9/yEN4M8XcS/d+bddoyVwVnvFyRh9msFo0HWeW0vTL8Qv+w=="11314 },11315 11332 "vue-router": { 11316 11333 "version": "3.5.2", -
myloyal/trunk/package.json
r2596776 r2606273 11 11 }, 12 12 "devDependencies": { 13 "@vue/composition-api": "^1.2.1", 13 14 "bootstrap": "^4.3.1", 14 15 "cross-env": "^5.1", … … 29 30 "@ckeditor/ckeditor5-build-classic": "^15.0.0", 30 31 "@ckeditor/ckeditor5-vue": "^1.0.0", 32 "@vueform/multiselect": "^2.2.0", 31 33 "axios": "^0.19.0", 32 34 "bootstrap-vue": "^2.0.0-rc.28", 33 35 "dayspan-vuetify": "^0.4.0", 34 36 "sweetalert2": "^9.4.0", 35 "vue-multiselect": "^2.1.6",36 37 "vue-router": "^3.0.6", 37 38 "vue-simple-calendar": "^4.2.2", -
myloyal/trunk/readme.txt
r2596780 r2606273 1 === myLoyal ===2 Contributors: Mithublue, cybercraftit3 Tags: rewards, points, wallet, gamification, leaderboard, loyal1 === myLoyal - reward, point, gamification and loyalty plugin with easy but smart yet rules === 2 Contributors: cybercraftit, Mithublue 3 Tags: rewards, points, wallet, ranks, gamification, leaderboard, loyal,points, achievements, badges, awards, credits, engagement, emails, notifications, progress 4 4 Requires at least: 5.0 5 Tested up to: 5.8 5 Tested up to: 5.8.1 6 6 Requires PHP: 5.6 7 Stable tag: 1.0 7 Stable tag: 1.0.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 13 13 == Description == 14 14 15 Manage points, rewards, gamifications, ranks, badges on user activities on your site 15 You can easily manage points, rewards, ranks and badges etc for your users in your site by setting RULES IN HUMAN READABLE FORMAT. This way you can keep 16 users engaged into your site. 17 18 == With myLoyal you can set rule to add/deduct points to/from users for == 19 20 * Creating post 21 * Updating post 22 * Having comments on post 23 * Commenting 24 * Registration 25 * Login 26 etc. 27 28 You can also create badge and set a rule to earn that badge. Whoever completes the rule , will earn that badge. 29 -
myloyal/trunk/resources/js/app.js
r2596776 r2606273 1 1 import Vue from 'vue'; 2 3 2 window.Vue = require('vue'); 3 // import Multiselect from '@vueform/multiselect'; 4 import VueCompositionAPI from '@vue/composition-api' 5 import Multiselect from '@vueform/multiselect/dist/multiselect.vue2.js'; 6 import '@vueform/multiselect/themes/default.css'; 7 Vue.use(VueCompositionAPI) 8 Vue.component('multiselect', Multiselect) 4 9 5 10 var $ = jQuery; -
myloyal/trunk/templates/admin/partials/badge-meta-panel.php
r2596776 r2606273 2 2 global $post, $myloyal_badge_rule; 3 3 $badges = \myLoyal\core\Options::instance()->get_option('badges', 'myloyal', [] ); 4 $badge_settings = (new \myLoyal\core\ Post( $post->ID ) )->get_meta( 'badge_settings' );4 $badge_settings = (new \myLoyal\core\Instance_Post( $post->ID ) )->get_meta( 'badge_settings' ); 5 5 if ( !is_array( $badge_settings ) ) { 6 6 $badge_settings = []; -
myloyal/trunk/templates/admin/point-rules.php
r2596776 r2606273 1 1 <?php 2 2 global $myloyal_point_rules; 3 //\myLoyal\pri($myloyal_point_rules);4 3 $data = \myLoyal\core\Options::instance()->get_option('rule_data', 'myloyal', array() ); 4 \myLoyal\pri($data); 5 5 !is_array( $data ) ? $data = [] : ''; 6 6 $formated_rules = []; … … 17 17 <a href="javascript:" class="btn bg-10B981 b-clr-10B981" @click="save_rules" 18 18 ><?php _e('Save Rules','myloyal'); ?></a> 19 <a href="javascript:" class="btn btn-ffffff clr-10B981 b-clr-10B981" @click="expand_all" 20 ><?php _e('Expand All','myloyal'); ?></a> 19 21 20 22 <div class="mt-10"> … … 22 24 <a @click="remove_rule(saved_rule)" href="javascript:" class="btn btn-FE2424 fr">Remove Rule</a> 23 25 24 <select v-model="saved_rule.case" class="w-100 mb-10 ">26 <select v-model="saved_rule.case" class="w-100 mb-10 case_select" @change="on_change_save_rule(rule_key)"> 25 27 <option :value="rule_case" v-for="(point_rule, rule_case) in point_rules">{{ point_rule.label }}</option> 26 28 </select> 29 27 30 <div> 28 <template v-for="(field, key) in point_rules[saved_rule.case].fields"> 29 <template v-if="!field.visible || ( field.visible && check_visibility_condition(saved_rule,field.visible) == true )"> 30 <template v-if="field.type == 'string'"> 31 <span v-html="field.string"> 32 </span> 33 </template> 34 <template v-if="field.type == 'select'"> 35 <template v-if="field.multiple == true"> 36 <select v-model="saved_rule[field.name]" multiple> 37 <option :value="value" v-for="(label, value) in field.options">{{ label }}</option> 38 </select> 31 <a href="javascript:" @click="expand_rule(rule_key)" 32 v-if="expandables.indexOf(rule_key) == -1" 33 >Expand</a> 34 <a href="javascript:" @click="shrink_rule(rule_key)" 35 v-if="expandables.indexOf(rule_key) !== -1" 36 >Shrink</a> 37 <div v-if="expandables.indexOf(rule_key) !== -1"> 38 <template v-for="(field, key) in point_rules[saved_rule.case].fields"> 39 <template v-if="!field.visible || ( field.visible && check_visibility_condition(saved_rule,field.visible) == true )"> 40 <template v-if="field.type == 'string'"> 41 <span v-html="field.string"> 42 </span> 39 43 </template> 40 <template v-else> 41 <select v-model="saved_rule[field.name]"> 42 <option :value="value" v-for="(label, value) in field.options">{{ label }}</option> 43 </select> 44 <template v-if="field.type == 'select'"> 45 <template v-if="field.multiple == true"> 46 <multiselect 47 v-model="saved_rule[field.name]" 48 :options="field.options" 49 mode="tags" 50 /> 51 <!--<select v-model="saved_rule[field.name]" multiple> 52 <option :value="value" v-for="(label, value) in field.options">{{ label }}</option> 53 </select>--> 54 </template> 55 <template v-else> 56 <multiselect 57 v-model="saved_rule[field.name]" 58 :options="field.options" 59 /> 60 <!--<select v-model="saved_rule[field.name]"> 61 <option :value="value" v-for="(label, value) in field.options">{{ label }}</option> 62 </select>--> 63 </template> 64 </template> 65 <template v-if="field.type == 'number'"> 66 <input type="number" v-model="saved_rule[field.name]"> {{ field.label }} 44 67 </template> 45 68 </template> 46 <template v-if="field.type == 'number'">47 <input type="number" v-model="saved_rule[field.name]"> {{ field.label }}48 </template>49 69 </template> 50 </ template>70 </div> 51 71 </div> 52 72 </div> 53 73 </div> 54 74 </div> 75 <style> 76 [type='number'],[type='text']{ 77 height: 40px; 78 border: 1px solid #ccc !important; 79 } 80 input, select,.multiselect{ 81 margin-bottom:10px; 82 } 83 .multiselect{ 84 display: inline-block; 85 min-width: 200px; 86 max-width: fit-content; 87 } 88 .multiselect-clear{ 89 position: absolute; 90 right: 0; 91 top: 10px; 92 } 93 </style> 55 94 <script> 56 95 var myloyal_point_rules = JSON.parse('<?php echo json_encode( $myloyal_point_rules ); ?>'); 96 console.log(myloyal_point_rules); 57 97 myloyal_vuedata.data = Object.assign( myloyal_vuedata.data, { 98 expandables: [], 99 test_val: 'a', 100 test_options: { 101 a: 'A', 102 b: 'B' 103 }, 58 104 test: 'This is test', 59 105 point_rules: myloyal_point_rules, … … 61 107 }); 62 108 myloyal_vuedata.methods = Object.assign( myloyal_vuedata.methods, { 109 expand_all: function () { 110 for ( var k in this.saved_rules ) { 111 if ( this.expandables.indexOf(parseInt(k)) == -1 ) { 112 this.expandables.push(parseInt(k)); 113 } 114 } 115 console.log(this.expandables); 116 }, 117 expand_rule: function (rule_key) { 118 if( this.expandables.indexOf(rule_key) == -1 ) { 119 this.expandables.push(rule_key); 120 } 121 console.log(this.expandables); 122 }, 123 shrink_rule: function (rule_key) { 124 if( this.expandables.indexOf(rule_key) !== -1 ) { 125 this.expandables.splice( this.expandables.indexOf( rule_key ), 1 ); 126 } 127 }, 63 128 add_new_rule: function () { 64 129 this.saved_rules.push({ … … 66 131 }); 67 132 }, 133 on_change_save_rule:function ( rule_key ) { 134 this.expandables.splice( this.expandables.indexOf( rule_key ), 1 ); 135 var _this = this; 136 setTimeout(function () { 137 _this.expandables.push(rule_key); 138 },1); 139 }, 68 140 check_visibility_condition: function (saved_rule,rule_condition) { 69 141 var bool = true;
Note: See TracChangeset
for help on using the changeset viewer.