1/* eslint-disable */ 2;(function() { 3 4 if ( 5 typeof this.BX !== 'undefined' 6 && typeof this.BX.Vue3 !== 'undefined' 7 && typeof this.BX.Vue3.BitrixVue !== 'undefined' 8 ) 9 { 10 console.warn('BX.Vue3.BitrixVue already loaded.'); 11 return; 12 } 13 14this.BX = this.BX || {}; 15(function (exports,main_core_events,main_core,rest_client,pull_client,ui_vue3) { 16 'use strict'; 17 18 /*! 19 * Utilities from VueUse collection 20 * (c) 2019-2022 Anthony Fu 21 * Released under the MIT License. 22 * 23 * @source: https://github.com/vueuse/vueuse/blob/main/packages/shared/tryOnScopeDispose/index.ts 24 * @source: https://github.com/vueuse/vueuse/blob/main/packages/rxjs/useObservable/index.ts 25 */ 26 function tryOnScopeDispose(fn) { 27 if (ui_vue3.getCurrentScope()) { 28 ui_vue3.onScopeDispose(fn); 29 return true; 30 } 31 return false; 32 } 33 function useObservable(observable, options) { 34 const value = ui_vue3.ref(options == null ? void 0 : options.initialValue); 35 const subscription = observable.subscribe({ 36 next: val => value.value = val, 37 error: options == null ? void 0 : options.onError 38 }); 39 tryOnScopeDispose(() => { 40 subscription.unsubscribe(); 41 }); 42 return value; 43 } 44 45 /** 46 * Bitrix Vue3 plugin 47 * 48 * @package bitrix 49 * @subpackage ui 50 * @copyright 2001-2021 Bitrix 51 */ 52 var _getComponentParamsWithMutation = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("getComponentParamsWithMutation"); 53 var _getFinalComponentParams = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("getFinalComponentParams"); 54 var _cloneObjectBeforeApplyMutation = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("cloneObjectBeforeApplyMutation"); 55 var _applyMutation = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("applyMutation"); 56 class BitrixVue { 57 constructor() { 58 Object.defineProperty(this, _applyMutation, { 59 value: _applyMutation2 60 }); 61 Object.defineProperty(this, _cloneObjectBeforeApplyMutation, { 62 value: _cloneObjectBeforeApplyMutation2 63 }); 64 Object.defineProperty(this, _getFinalComponentParams, { 65 value: _getFinalComponentParams2 66 }); 67 Object.defineProperty(this, _getComponentParamsWithMutation, { 68 value: _getComponentParamsWithMutation2 69 }); 70 this.components = {}; 71 this.proxyComponents = {}; 72 this.finalComponents = {}; 73 this.cloneCounter = 0; 74 this.cloneComponents = {}; 75 this.mutations = {}; 76 this.developerMode = false; 77 this.events = { 78 restClientChange: 'RestClient::change', 79 pullClientChange: 'PullClient::change' 80 }; 81 const settings = main_core.Extension.getSettings('ui.vue3'); 82 this.localizationMode = settings.get('localizationDebug', false) ? 'development' : 'production'; 83 } 84 85 /** 86 * Create new Vue application 87 * @see https://vuejs.org/api/application.html 88 * 89 * @param {BitrixVueComponentProps} rootComponent - definition 90 * @param {{[key: string]: any}|null} rootProps - definition 91 * @returns VueCreateAppResult 92 */ 93 createApp(rootComponent, rootProps) { 94 /* Note: method will be replaced with Vue.createApp */ 95 return { 96 config: {}, 97 directive: () => {}, 98 mixin: () => {}, 99 provide: () => {}, 100 mount: () => {}, 101 unmount: () => {}, 102 use: () => {} 103 }; 104 } 105 106 /** 107 * Define BitrixVue component 108 * @see https://vuejs.org/api/component-instance.html 109 * 110 * @param {string} name 111 * @param {BitrixVueComponentProps} definition 112 * @returns {BitrixVueComponentProxy} 113 */ 114 mutableComponent(name, definition) { 115 this.components[name] = Object.assign({}, definition); 116 this.components[name].bitrixVue = { 117 name 118 }; 119 this.finalComponents[name] = babelHelpers.classPrivateFieldLooseBase(this, _getFinalComponentParams)[_getFinalComponentParams](name); 120 this.proxyComponents[name] = new Proxy(this.finalComponents[name], { 121 get: function (target, property) { 122 if (!main_core.Type.isUndefined(this.finalComponents[target.bitrixVue.name]) && !main_core.Type.isUndefined(this.finalComponents[target.bitrixVue.name][property])) { 123 return this.finalComponents[target.bitrixVue.name][property]; 124 } 125 return Reflect.get(...arguments); 126 }.bind(this) 127 }); 128 return this.proxyComponents[name]; 129 } 130 131 /** 132 * Get BitrixVue component with mutations 133 * @see https://vuejs.org/api/component-instance.html 134 * 135 * @param {string} name 136 * @param {boolean} silentMode 137 * 138 * @returns {BitrixVueComponentProps} 139 */ 140 getMutableComponent(name, silentMode = false) { 141 if (!this.isComponent(name)) { 142 if (!silentMode) { 143 this.showNotice('Component "' + name + '" is not registered yet.'); 144 } 145 return null; 146 } 147 const component = babelHelpers.classPrivateFieldLooseBase(this, _getFinalComponentParams)[_getFinalComponentParams](name); 148 for (const property in component) { 149 if (!component.hasOwnProperty(property)) { 150 continue; 151 } 152 this.proxyComponents[name][property] = component[property]; 153 } 154 return this.finalComponents[name]; 155 } 156 157 /** 158 * Define Async component
159 * @see https://vuejs.org/guide/components/async.html 160 * 161 * @param extension {string} 162 * @param componentExportName {string} 163 * @param options {VueAsyncComponentOptions|null} 164 * @return {Promise<BitrixVueComponentProps>} 165 */ 166 defineAsyncComponent(extension, componentExportName, options) { 167 let loader = () => new Promise((resolve, reject) => { 168 main_core.Runtime.loadExtension(extension).then(exports => { 169 if (!main_core.Type.isUndefined(exports[componentExportName])) { 170 resolve(exports[componentExportName]); 171 } else { 172 resolve({ 173 template: ` 174 <div style="display: inline-block; border: 1px dashed red; padding: 5px; margin: 5px;"> 175 Extension <strong>${extension}</strong> or export variable <strong>${componentExportName}</strong> is not found! 176 </div> 177 ` 178 }); 179 } 180 }); 181 }); 182 if (!main_core.Type.isObjectLike(options)) { 183 return ui_vue3.defineAsyncComponent(loader); 184 } 185 if (!main_core.Type.isObjectLike(options.loadingComponent)) { 186 return ui_vue3.defineAsyncComponent(() => new Promise((resolve, reject) => { 187 resolve({ 188 template: ` 189 <div style="display: inline-block; border: 1px dashed red; padding: 5px; margin: 5px;"> 190 Extension <strong>${extension}</strong> was not loaded due to a configuration error. Property <strong>loadingComponent</strong> is not defined. 191 </div> 192 ` 193 }); 194 })); 195 } 196 197 // this case is for development purposes only 198 if (main_core.Type.isInteger(options.delayLoadExtension)) { 199 const timeout = options.delayLoadExtension; 200 const previousLoader = loader; 201 delete options.delayLoadExtension; 202 loader = () => new Promise((resolve, reject) => { 203 setTimeout(() => { 204 previousLoader().then(component => resolve(component)); 205 }, timeout); 206 }); 207 } 208 return ui_vue3.defineAsyncComponent({ 209 loader, 210 ...options 211 }); 212 } 213 214 /** 215 * Mutate Vue component 216 * 217 * @param {String|BitrixVueComponentProxy} source - name or definition 218 * @param {Object} mutations 219 * @returns {boolean} 220 */ 221 mutateComponent(source, mutations) { 222 if (main_core.Type.isString(source)) { 223 if (main_core.Type.isUndefined(this.mutations[source])) { 224 this.mutations[source] = []; 225 } 226 this.mutations[source].push(mutations); 227 this.getMutableComponent(source, true); 228 return true; 229 } 230 if (main_core.Type.isPlainObject(source) && !main_core.Type.isUndefined(source.bitrixVue)) { 231 return this.mutateComponent(source.bitrixVue.name, mutations); 232 } 233 this.showError(`You can not mutate classic Vue components. If you need to mutate, use BitrixVue.cloneComponent instead.`, source, mutations); 234 return false; 235 } 236 237 /** 238 * Clone Vue component 239 * 240 * @param {string|object} source - name or definition 241 * @param {BitrixVueComponentProps} mutations 242 * @returns {BitrixVueComponentProxy|null} 243 */ 244 cloneComponent(source, mutations) { 245 if (main_core.Type.isString(source)) { 246 const definition = babelHelpers.classPrivateFieldLooseBase(this, _getComponentParamsWithMutation)[_getComponentParamsWithMutation](source, [mutations]); 247 if (definition) { 248 return definition; 249 } 250 this.cloneCounter += 1; 251 const component = { 252 bitrixVue: { 253 source, 254 cloneCounter: this.cloneCounter, 255 mutations 256 } 257 }; 258 return new Proxy(component, { 259 get: function (target, property, receiver) { 260 let component; 261 if (main_core.Type.isUndefined(this.cloneComponents[target.bitrixVue.cloneCounter])) { 262 component = babelHelpers.classPrivateFieldLooseBase(this, _getComponentParamsWithMutation)[_getComponentParamsWithMutation](target.bitrixVue.source, [target.bitrixVue.mutations]); 263 if (component) { 264 this.cloneComponents[target.bitrixVue.cloneCounter] = component; 265 } 266 } else { 267 component = this.cloneComponents[target.bitrixVue.cloneCounter]; 268 } 269 if (!component) { 270 if (property === 'template') { 271 this.showError(`Clone component #${target.bitrixVue.cloneCounter} is failed. Component ${target.bitrixVue.source} is not register yet.`, target.bitrixVue); 272 if (this.developerMode) { 273 return ` 274 <div style="display: inline-block; border: 1px dashed red; padding: 5px; margin: 5px;"> 275 The cloned component <strong>#${target.bitrixVue.cloneCounter}</strong> is not shown because the original component <strong>${target.bitrixVue.source}</strong> was not registered. 276 </div> 277 `; 278 } 279 return `<!-- Placeholder for clone component #${target.bitrixVue.cloneCounter}. Component ${target.bitrixVue.source} was not registered. -->`; 280 } 281 return Reflect.get(...arguments); 282 } 283 if (!main_core.Type.isUndefined(component[property])) { 284 return component[property]; 285 } 286 return Reflect.get(...arguments); 287 }.bind(this) 288 }); 289 } 290 if (main_core.Type.isPlainObject(source) && !main_core.Type.isUndefined(source.bitrixVue)) { 291 return babelHelpers.classPrivateFieldLooseBase(this, _getComponentParamsWithMutation)[_getComponentParamsWithMutation](source.bitrixVue.name, [mutations]); 292 } 293 if (main_core.Type.isPlainObject(source)) { 294 return babelHelpers.classPrivateFieldLooseBase(this, _applyMutation)[_applyMutation](babelHelpers.classPrivateFieldLooseBase(this, _cloneObjectBeforeApplyMutation)[_cloneObjectBeforeApplyMutation](source, mutations), mutations); 295 } 296 return null; 297 } 298 299 /** 300 * Check exists Vue component 301 * 302 * @param {string} name 303 * @returns {boolean} 304 */ 305 isComponent(name) { 306 return !main_core.Type.isUndefined(this.components[name]); 307 } 308 309 /** 310 * @deprecated 311 */ 312 isMutable() { 313 this.showNotice('Method BitrixVue.isMutable is deprecated, remove usages.'); 314 return true; 315 } 316 317 /** 318 * @deprecated 319 */ 320 isLocal() { 321 this.showNotice('Method BitrixVue.isLocal is deprecated, remove usages.'); 322 return false;
323 } 324 325 /** 326 * @deprecated 327 */ 328 component(name) { 329 this.showError('Method BitrixVue.component is deprecated, use Vue.component or BitrixVue.mutableComponent. Component "' + name + '" was not registered.'); 330 } 331 332 /** 333 * @deprecated 334 */ 335 localComponent(name, definition) { 336 this.showNotice('Method BitrixVue.localComponent is deprecated, use Vue.mutableComponent instead. Component "' + name + '" has been registered, but this behavior will be removed in the future.'); 337 return this.mutableComponent(name, definition); 338 } 339 340 /** 341 * @deprecated 342 */ 343 directive(name) { 344 this.showError('Method BitrixVue.directive is deprecated, use Vue.directive (from ui.vue3 extension import). Directive "' + name + '" was not registered.'); 345 } 346 347 /** 348 * Test node for compliance with parameters 349 * 350 * @param object 351 * @param params 352 * @returns {boolean} 353 */ 354 testNode(object, params) { 355 if (!params || !main_core.Type.isPlainObject(params)) { 356 return true; 357 } 358 for (const property in params) { 359 if (!params.hasOwnProperty(property)) { 360 continue; 361 } 362 switch (property) { 363 case 'tag': 364 case 'tagName': 365 if (main_core.Type.isString(params[property])) { 366 if (object.tagName.toUpperCase() !== params[property].toUpperCase()) { 367 return false; 368 } 369 } else if (params[property] instanceof RegExp) { 370 if (!params[property].test(object.tagName)) { 371 return false; 372 } 373 } 374 break; 375 case 'class': 376 case 'className': 377 if (main_core.Type.isString(params[property])) { 378 if (!main_core.Dom.hasClass(object, params[property].trim())) { 379 return false; 380 } 381 } else if (params[property] instanceof RegExp) { 382 if (!main_core.Type.isString(object.className) || !params[property].test(object.className)) { 383 return false; 384 } 385 } 386 break; 387 case 'attr': 388 case 'attrs': 389 case 'attribute': 390 if (main_core.Type.isString(params[property])) { 391 if (!object.getAttribute(params[property])) { 392 return false; 393 } 394 } else if (params[property] && Object.prototype.toString.call(params[property]) === "[object Array]") { 395 for (let i = 0, length = params[property].length; i < length; i++) { 396 if (params[property][i] && !object.getAttribute(params[property][i])) { 397 return false; 398 } 399 } 400 } else { 401 for (const paramKey in params[property]) { 402 if (!params[property].hasOwnProperty(paramKey)) { 403 continue; 404 } 405 const value = object.getAttribute(paramKey); 406 if (!main_core.Type.isString(value)) { 407 return false; 408 } 409 if (params[property][paramKey] instanceof RegExp) { 410 if (!params[property][paramKey].test(value)) { 411 return false; 412 } 413 } else if (value !== '' + params[property][paramKey]) { 414 return false; 415 } 416 } 417 } 418 break; 419 case 'property': 420 case 'props': 421 if (main_core.Type.isString(params[property])) { 422 if (!object[params[property]]) { 423 return false; 424 } 425 } else if (params[property] && Object.prototype.toString.call(params[property]) === "[object Array]") { 426 for (let i = 0, length = params[property].length; i < length; i++) { 427 if (params[property][i] && !object[params[property][i]]) { 428 return false; 429 } 430 } 431 } else { 432 for (const paramKey in params[property]) { 433 if (!params[property].hasOwnProperty(paramKey)) { 434 continue; 435 } 436 if (main_core.Type.isString(params[property][paramKey])) { 437 if (object[paramKey] !== params[property][paramKey]) { 438 return false;
439 } 440 } else if (params[property][paramKey] instanceof RegExp) { 441 if (!main_core.Type.isString(object[paramKey]) || !params[property][paramKey].test(object[paramKey])) { 442 return false; 443 } 444 } 445 } 446 } 447 break; 448 } 449 } 450 return true; 451 } 452 453 /** 454 * 455 * 456 * @param {Object} vueInstance 457 * @param {String|Array} phrasePrefix 458 * @param {Object|null} phrases 459 * @returns {ReadonlyArray<any>} 460 */ 461 getFilteredPhrases(vueInstance, phrasePrefix, phrases = null) { 462 const result = {}; 463 if (!phrases) { 464 phrases = vueInstance.$bitrix.Loc.getMessages(); 465 } 466 if (Array.isArray(phrasePrefix)) { 467 for (const message in phrases) { 468 if (!phrases.hasOwnProperty(message)) { 469 continue; 470 } 471 if (!phrasePrefix.find(element => message.toString().startsWith(element))) { 472 continue; 473 } 474 if (this.localizationMode === 'development') { 475 result[message] = message; 476 } else { 477 result[message] = phrases[message]; 478 } 479 } 480 } else { 481 for (const message in phrases) { 482 if (!phrases.hasOwnProperty(message)) { 483 continue; 484 } 485 if (!message.startsWith(phrasePrefix)) { 486 continue; 487 } 488 if (this.localizationMode === 'development') { 489 result[message] = message; 490 } else { 491 result[message] = phrases[message]; 492 } 493 } 494 } 495 return Object.freeze(result); 496 } 497 498 /** 499 * Return component params with mutation 500 * 501 * @param {String} name 502 * @param {Object} mutations 503 * @returns {null|Object} 504 * 505 * @private 506 */ 507 508 /** 509 * @private 510 * @param text 511 * @param params 512 */ 513 showNotice(text, ...params) { 514 if (this.developerMode) { 515 console.warn('BitrixVue: ' + text, ...params); 516 } 517 } 518 519 /** 520 * @private 521 * @param text 522 * @param params 523 */ 524 showError(text, ...params) { 525 console.error('BitrixVue: ' + text, ...params); 526 } 527 528 /** 529 * @deprecated Special method for plugin registration 530 */ 531 install(app) { 532 const bitrixVue = this; 533 534 // 1. Init Bitrix public api 535 const $Bitrix = {}; 536 537 // 1.1 Localization 538 $Bitrix.Loc = { 539 messages: {}, 540 getMessage: function (messageId, replacements = null) { 541 if (bitrixVue.localizationMode === 'development') { 542 let debugMessageId = [messageId]; 543 if (main_core.Type.isPlainObject(replacements)) { 544 const replaceKeys = Object.keys(replacements); 545 if (replaceKeys.length > 0) { 546 debugMessageId = [messageId, ' (replacements: ', replaceKeys.join(', '), ')']; 547 } 548 } 549 return debugMessageId.join(''); 550 } 551 let message = ''; 552 if (!main_core.Type.isUndefined(this.messages[messageId])) { 553 message = this.messages[messageId]; 554 } else { 555 message = main_core.Loc.getMessage(messageId); 556 this.messages[messageId] = message; 557 } 558 if (main_core.Type.isString(message) && main_core.Type.isPlainObject(replacements)) { 559 Object.keys(replacements).forEach(replacement => { 560 const globalRegexp = new RegExp(replacement, 'gi'); 561 message = message.replace(globalRegexp, () => { 562 return main_core.Type.isNil(replacements[replacement]) ? '' : String(replacements[replacement]); 563 }); 564 }); 565 } 566 return message; 567 }, 568 hasMessage: function (messageId) { 569 return main_core.Type.isString(messageId) && !main_core.Type.isNil(this.getMessages()[messageId]); 570 }, 571 getMessages: function () { 572 // eslint-disable-next-line bitrix-rules/no-bx-message 573 if (!main_core.Type.isUndefined(BX.message)) { 574 // eslint-disable-next-line bitrix-rules/no-bx-message 575 return { 576 ...BX.message, 577 ...this.messages 578 }; 579 } 580 return { 581 ...this.messages 582 }; 583 }, 584 setMessage: function (id, value) { 585 if (main_core.Type.isString(id)) { 586 this.messages[id] = value; 587 } 588 if (main_core.Type.isObject(id)) { 589 for (const code in id) { 590 if (id.hasOwnProperty(code)) { 591 this.messages[code] = id[code]; 592 } 593 } 594 } 595 } 596 }; 597 598 // 1.2 Application Data 599 $Bitrix.Application = { 600 instance: null, 601 get: function () { 602 return this.instance; 603 }, 604 set: function (instance) { 605 this.instance = instance; 606 } 607 }; 608 609 // 1.3 Application Data 610 $Bitrix.Data = { 611 data: {}, 612 get: function (name, defaultValue) { 613 var _this$data$name; 614 return (_this$data$name = this.data[name]) != null ? _this$data$name : defaultValue; 615 }, 616 set: function (name, value) { 617 this.data[name] = value; 618 } 619 }; 620
621 // 1.4 Application EventEmitter 622 $Bitrix.eventEmitter = new main_core_events.EventEmitter(); 623 624 // hack for old version of Bitrix SM 625 if (!main_core.Type.isFunction($Bitrix.eventEmitter.setEventNamespace)) { 626 window.BX.Event.EventEmitter.prototype.setEventNamespace = function () {}; 627 $Bitrix.eventEmitter.setEventNamespace = function () {}; 628 } 629 $Bitrix.eventEmitter.setEventNamespace('vue:app:' + app._uid); 630 631 // 1.5 Application RestClient 632 $Bitrix.RestClient = { 633 instance: null, 634 get: function () { 635 var _this$instance; 636 return (_this$instance = this.instance) != null ? _this$instance : rest_client.rest; 637 }, 638 set: function (instance) { 639 this.instance = instance; 640 $Bitrix.eventEmitter.emit(bitrixVue.events.restClientChange); 641 }, 642 isCustom() { 643 return !main_core.Type.isNull(this.instance); 644 } 645 }; 646 647 // 1.6 Application PullClient 648 $Bitrix.PullClient = { 649 instance: null, 650 get: function () { 651 var _this$instance2; 652 return (_this$instance2 = this.instance) != null ? _this$instance2 : pull_client.PULL; 653 }, 654 set: function (instance) { 655 this.instance = instance; 656 $Bitrix.eventEmitter.emit(bitrixVue.events.pullClientChange); 657 }, 658 isCustom() { 659 return !main_core.Type.isNull(this.instance); 660 } 661 }; 662 663 // 2. Apply global properties 664 app.config.globalProperties.$bitrix = $Bitrix; 665 const BitrixVueRef = this; 666 app.mixin({ 667 computed: { 668 $Bitrix: function () { 669 return this.$bitrix; 670 } 671 }, 672 mounted: function () { 673 if (!main_core.Type.isNil(this.$root.$bitrixApplication)) { 674 BitrixVueRef.showNotice("Store reference in global variables (like: this.$bitrixApplication) is deprecated, use this.$Bitrix.Data.set(...) instead."); 675 } 676 if (!main_core.Type.isNil(this.$root.$bitrixController)) { 677 BitrixVueRef.showNotice("Store reference in global variables (like: this.$bitrixController) is deprecated, use this.$Bitrix.Data.set(...) instead."); 678 } 679 if (!main_core.Type.isNil(this.$root.$bitrixMessages)) { 680 BitrixVueRef.showNotice("Store localization in global variable this.$bitrixMessages is deprecated, use this.$Bitrix.Log.setMessage(...) instead."); 681 } 682 if (!main_core.Type.isNil(this.$root.$bitrixRestClient)) { 683 BitrixVueRef.showNotice("Working with a Rest-client through an old variable this.$bitrixRestClient is deprecated, use this.$Bitrix.RestClient.get() instead."); 684 } 685 if (!main_core.Type.isNil(this.$root.$bitrixPullClient)) { 686 BitrixVueRef.showNotice("Working with a Pull-client through an old variable this.$bitrixPullClient is deprecated, use this.$Bitrix.PullClient.get() instead."); 687 } 688 } 689 }); 690 } 691 } 692 function _getComponentParamsWithMutation2(name, mutations) { 693 if (main_core.Type.isUndefined(this.components[name])) { 694 return null; 695 } 696 let componentParams = Object.assign({}, this.components[name]); 697 if (main_core.Type.isUndefined(mutations)) { 698 return componentParams; 699 } 700 mutations.forEach(mutation => { 701 componentParams = babelHelpers.classPrivateFieldLooseBase(this, _applyMutation)[_applyMutation](babelHelpers.classPrivateFieldLooseBase(this, _cloneObjectBeforeApplyMutation)[_cloneObjectBeforeApplyMutation](componentParams, mutation), mutation); 702 }); 703 return componentParams; 704 } 705 function _getFinalComponentParams2(name) { 706 return babelHelpers.classPrivateFieldLooseBase(this, _getComponentParamsWithMutation)[_getComponentParamsWithMutation](name, this.mutations[name]); 707 } 708 function _cloneObjectBeforeApplyMutation2(objectParams = {}, mutation = {}, level = 1, previousParamName = '') { 709 const object = {}; 710 for (const param in objectParams) { 711 if (!objectParams.hasOwnProperty(param)) { 712 continue; 713 } 714 if (main_core.Type.isString(objectParams[param])) {
715 object[param] = objectParams[param]; 716 } else if (main_core.Type.isArray(objectParams[param])) { 717 object[param] = [].concat(objectParams[param]); 718 } else if (main_core.Type.isObjectLike(objectParams[param])) { 719 if (previousParamName === 'watch' || previousParamName === 'props' || previousParamName === 'directives') { 720 object[param] = objectParams[param]; 721 } else if (main_core.Type.isNull(objectParams[param])) { 722 object[param] = null; 723 } else if (main_core.Type.isObjectLike(mutation[param])) { 724 object[param] = babelHelpers.classPrivateFieldLooseBase(this, _cloneObjectBeforeApplyMutation)[_cloneObjectBeforeApplyMutation](objectParams[param], mutation[param], level + 1, param); 725 } else { 726 object[param] = Object.assign({}, objectParams[param]); 727 } 728 } else if (main_core.Type.isFunction(objectParams[param])) { 729 if (!main_core.Type.isFunction(mutation[param])) { 730 object[param] = objectParams[param]; 731 } else if (level > 1) { 732 if (previousParamName === 'watch') { 733 object[param] = objectParams[param]; 734 } else { 735 object['parent' + param[0].toUpperCase() + param.substr(1)] = objectParams[param]; 736 } 737 } else { 738 if (main_core.Type.isUndefined(object['methods'])) { 739 object['methods'] = {}; 740 } 741 object['methods']['parent' + param[0].toUpperCase() + param.substr(1)] = objectParams[param]; 742 if (main_core.Type.isUndefined(objectParams['methods'])) { 743 objectParams['methods'] = {}; 744 } 745 objectParams['methods']['parent' + param[0].toUpperCase() + param.substr(1)] = objectParams[param]; 746 } 747 } else if (!main_core.Type.isUndefined(objectParams[param])) { 748 object[param] = objectParams[param]; 749 } 750 } 751 return object; 752 } 753 function _applyMutation2(clonedObject = {}, mutation = {}, level = 1) { 754 const object = Object.assign({}, clonedObject); 755 for (const param in mutation) { 756 if (!mutation.hasOwnProperty(param)) { 757 continue; 758 } 759 if (level === 1 && (param === 'compilerOptions' || param === 'setup')) { 760 object[param] = mutation[param]; 761 } else if (level === 1 && param === 'extends') { 762 object[param] = mutation[param]; 763 } else if (main_core.Type.isString(mutation[param])) { 764 if (main_core.Type.isString(object[param])) { 765 object[param] = mutation[param].replace(`#PARENT_${param.toUpperCase()}#`, object[param]); 766 } else { 767 object[param] = mutation[param].replace(`#PARENT_${param.toUpperCase()}#`, ''); 768 } 769 } else if (main_core.Type.isArray(mutation[param])) { 770 if (level === 1 && param === 'replaceMixins') { 771 object['mixins'] = [].concat(mutation[param]); 772 } else if (level === 1 && param === 'replaceInject') { 773 object['inject'] = [].concat(mutation[param]); 774 } else if (level === 1 && param === 'replaceEmits') { 775 object['emits'] = [].concat(mutation[param]); 776 } else if (level === 1 && param === 'replaceExpose') { 777 object['expose'] = [].concat(mutation[param]); 778 } else if (main_core.Type.isPlainObject(object[param])) { 779 mutation[param].forEach(element => object[param][element] = null); 780 } else { 781 object[param] = object[param].concat(mutation[param]); 782 } 783 } else if (main_core.Type.isObjectLike(mutation[param])) { 784 if (level === 1 && param === 'props' && main_core.Type.isArray(object[param]) || level === 1 && param === 'emits' && main_core.Type.isArray(object[param])) { 785 const newObject = {}; 786 object[param].forEach(element => { 787 newObject[element] = null; 788 }); 789 object[param] = newObject; 790 } 791 if (level === 1 && param === 'watch') { 792 for (const paramName in object[param]) { 793 if (!object[param].hasOwnProperty(paramName)) { 794 continue; 795 } 796 if (paramName.includes('.')) { 797 continue; 798 } 799 if (main_core.Type.isFunction(object[param][paramName]) || main_core.Type.isObject(object[param][paramName]) && main_core.Type.isFunction(object[param][paramName]['handler'])) { 800 if (main_core.Type.isUndefined(object['methods'])) { 801 object['methods'] = {}; 802 } 803 const originNewFunctionName = 'parentWatch' + paramName[0].toUpperCase() + paramName.substr(1); 804 if (main_core.Type.isFunction(object[param][paramName])) { 805 object['methods'][originNewFunctionName] = object[param][paramName]; 806 } else { 807 object['methods'][originNewFunctionName] = object[param][paramName]['handler']; 808 } 809 } 810 } 811 } 812 if (level === 1 && param === 'replaceEmits') { 813 object['emits'] = Object.assign({}, mutation[param]); 814 } else if (level === 1 && (param === 'components' || param === 'directives')) { 815 if (main_core.Type.isUndefined(object[param])) { 816 object[param] = {}; 817 } 818 for (const objectName in mutation[param]) { 819 if (!mutation[param].hasOwnProperty(objectName)) { 820 continue; 821 } 822 let parentObjectName = objectName[0].toUpperCase() + objectName.substr(1); 823 parentObjectName = param === 'components' ? 'Parent' + parentObjectName : 'parent' + parentObjectName; 824 object[param][parentObjectName] = Object.assign({}, object[param][objectName]); 825 if (param === 'components') { 826 if (main_core.Type.isUndefined(mutation[param][objectName].components)) { 827 mutation[param][objectName].components = {}; 828 } 829 mutation[param][objectName].components = Object.assign({ 830 [parentObjectName]: object[param][objectName] 831 }, mutation[param][objectName].components); 832 } 833 object[param][objectName] = mutation[param][objectName]; 834 } 835 } else if (main_core.Type.isArray(object[param])) { 836 for (const mutationName in mutation[param]) { 837 if (!mutation[param].hasOwnProperty(mutationName)) { 838 continue; 839 } 840 object[param].push(mutationName); 841 } 842 } else if (main_core.Type.isObjectLike(object[param])) { 843 object[param] = babelHelpers.classPrivateFieldLooseBase(this, _applyMutation)[_applyMutation](object[param], mutation[param], level
843+ 1); 844 } else { 845 object[param] = mutation[param]; 846 } 847 } else { 848 object[param] = mutation[param]; 849 } 850 } 851 return object; 852 } 853 BitrixVue = new BitrixVue(); 854 855 exports.useObservable = useObservable; 856 exports.BitrixVue = BitrixVue; 857 858}((this.BX.Vue3 = this.BX.Vue3 || {}),BX.Event,BX,BX,BX,BX.Vue3)); 859 860 861 862})(); 863//# sourceMappingURL=bitrixvue.bundle.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.