← All changes
|
assets/js/packages/locations/locations.js
+2
-346
4.2.0-dev2
→
3.34.0-beta1
View file →
| @@ -1,347 +1,3 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ var __webpack_modules__ = ({ | |
| 4 | - | |
| 5 | -/***/ "./packages/packages/libs/locations/src/components/error-boundary.tsx": | |
| 6 | -/*!****************************************************************************!*\ | |
| 7 | - !*** ./packages/packages/libs/locations/src/components/error-boundary.tsx ***! | |
| 8 | - \****************************************************************************/ | |
| 9 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 10 | - | |
| 11 | -__webpack_require__.r(__webpack_exports__); | |
| 12 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | -/* harmony export */ "default": function() { return /* binding */ ErrorBoundary; } | |
| 14 | -/* harmony export */ }); | |
| 15 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 16 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 17 | - | |
| 18 | -class ErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_0__.Component { | |
| 19 | - state = { | |
| 20 | - hasError: false | |
| 21 | - }; | |
| 22 | - static getDerivedStateFromError() { | |
| 23 | - // Update state so the next render will show the fallback UI. | |
| 24 | - return { | |
| 25 | - hasError: true | |
| 26 | - }; | |
| 27 | - } | |
| 28 | - render() { | |
| 29 | - if (this.state.hasError) { | |
| 30 | - return this.props.fallback; | |
| 31 | - } | |
| 32 | - return this.props.children; | |
| 33 | - } | |
| 34 | -} | |
| 35 | - | |
| 36 | -/***/ }), | |
| 37 | - | |
| 38 | -/***/ "./packages/packages/libs/locations/src/components/injected-component-wrapper.tsx": | |
| 39 | -/*!****************************************************************************************!*\ | |
| 40 | - !*** ./packages/packages/libs/locations/src/components/injected-component-wrapper.tsx ***! | |
| 41 | - \****************************************************************************************/ | |
| 42 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 43 | - | |
| 44 | -__webpack_require__.r(__webpack_exports__); | |
| 45 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 46 | -/* harmony export */ "default": function() { return /* binding */ InjectedComponentWrapper; } | |
| 47 | -/* harmony export */ }); | |
| 48 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 49 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 50 | -/* harmony import */ var _error_boundary__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./error-boundary */ "./packages/packages/libs/locations/src/components/error-boundary.tsx"); | |
| 51 | - | |
| 52 | - | |
| 53 | - | |
| 54 | -function InjectedComponentWrapper({ | |
| 55 | - children | |
| 56 | -}) { | |
| 57 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_error_boundary__WEBPACK_IMPORTED_MODULE_1__["default"], { | |
| 58 | - fallback: null | |
| 59 | - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Suspense, { | |
| 60 | - fallback: null | |
| 61 | - }, children)); | |
| 62 | -} | |
| 63 | - | |
| 64 | -/***/ }), | |
| 65 | - | |
| 66 | -/***/ "./packages/packages/libs/locations/src/create-location.tsx": | |
| 67 | -/*!******************************************************************!*\ | |
| 68 | - !*** ./packages/packages/libs/locations/src/create-location.tsx ***! | |
| 69 | - \******************************************************************/ | |
| 70 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 71 | - | |
| 72 | -__webpack_require__.r(__webpack_exports__); | |
| 73 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 74 | -/* harmony export */ createLocation: function() { return /* binding */ createLocation; } | |
| 75 | -/* harmony export */ }); | |
| 76 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 77 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 78 | -/* harmony import */ var _injections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./injections */ "./packages/packages/libs/locations/src/injections.tsx"); | |
| 79 | -function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | |
| 80 | - | |
| 81 | - | |
| 82 | -function createLocation() { | |
| 83 | - const injections = new Map(); | |
| 84 | - const getInjections = (0,_injections__WEBPACK_IMPORTED_MODULE_1__.createGetInjections)(injections); | |
| 85 | - const useInjections = (0,_injections__WEBPACK_IMPORTED_MODULE_1__.createUseInjections)(getInjections); | |
| 86 | - const Slot = createSlot(useInjections); | |
| 87 | - const inject = createInject(injections); | |
| 88 | - | |
| 89 | - // Push the clear function to the flushInjectionsFns array, so we can flush all injections at once. | |
| 90 | - _injections__WEBPACK_IMPORTED_MODULE_1__.flushInjectionsFns.push(() => injections.clear()); | |
| 91 | - return { | |
| 92 | - inject, | |
| 93 | - getInjections, | |
| 94 | - useInjections, | |
| 95 | - Slot | |
| 96 | - }; | |
| 97 | -} | |
| 98 | -function createSlot(useInjections) { | |
| 99 | - return props => { | |
| 100 | - const injections = useInjections(); | |
| 101 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, injections.map(({ | |
| 102 | - id, | |
| 103 | - component: Component | |
| 104 | - }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, _extends({}, props, { | |
| 105 | - key: id | |
| 106 | - })))); | |
| 107 | - }; | |
| 108 | -} | |
| 109 | -function createInject(injections) { | |
| 110 | - return ({ | |
| 111 | - component, | |
| 112 | - id, | |
| 113 | - options = {} | |
| 114 | - }) => { | |
| 115 | - if (injections.has(id) && !options?.overwrite) { | |
| 116 | - // eslint-disable-next-line no-console | |
| 117 | - console.warn(`An injection with the id "${id}" already exists. Did you mean to use "options.overwrite"?`); | |
| 118 | - return; | |
| 119 | - } | |
| 120 | - injections.set(id, { | |
| 121 | - id, | |
| 122 | - component: (0,_injections__WEBPACK_IMPORTED_MODULE_1__.wrapInjectedComponent)(component), | |
| 123 | - priority: options.priority ?? _injections__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_PRIORITY | |
| 124 | - }); | |
| 125 | - }; | |
| 126 | -} | |
| 127 | - | |
| 128 | -/***/ }), | |
| 129 | - | |
| 130 | -/***/ "./packages/packages/libs/locations/src/create-replaceable-location.tsx": | |
| 131 | -/*!******************************************************************************!*\ | |
| 132 | - !*** ./packages/packages/libs/locations/src/create-replaceable-location.tsx ***! | |
| 133 | - \******************************************************************************/ | |
| 134 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 135 | - | |
| 136 | -__webpack_require__.r(__webpack_exports__); | |
| 137 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 138 | -/* harmony export */ createReplaceableLocation: function() { return /* binding */ createReplaceableLocation; } | |
| 139 | -/* harmony export */ }); | |
| 140 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 141 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 142 | -/* harmony import */ var _injections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./injections */ "./packages/packages/libs/locations/src/injections.tsx"); | |
| 143 | - | |
| 144 | - | |
| 145 | -function createReplaceableLocation() { | |
| 146 | - const injections = new Map(); | |
| 147 | - const getInjections = (0,_injections__WEBPACK_IMPORTED_MODULE_1__.createGetInjections)(injections); | |
| 148 | - const useInjections = (0,_injections__WEBPACK_IMPORTED_MODULE_1__.createUseInjections)(getInjections); | |
| 149 | - const Slot = createReplaceable(useInjections); | |
| 150 | - const inject = createRegister(injections); | |
| 151 | - | |
| 152 | - // Push the clear function to the flushInjectionsFns array, so we can flush all injections at once. | |
| 153 | - _injections__WEBPACK_IMPORTED_MODULE_1__.flushInjectionsFns.push(() => injections.clear()); | |
| 154 | - return { | |
| 155 | - getInjections, | |
| 156 | - useInjections, | |
| 157 | - inject, | |
| 158 | - Slot | |
| 159 | - }; | |
| 160 | -} | |
| 161 | -function createReplaceable(useInjections) { | |
| 162 | - return props => { | |
| 163 | - const injections = useInjections(); | |
| 164 | - const { | |
| 165 | - component: Component | |
| 166 | - } = injections.find(({ | |
| 167 | - condition | |
| 168 | - }) => condition?.(props)) ?? {}; | |
| 169 | - if (!Component) { | |
| 170 | - return props.children; | |
| 171 | - } | |
| 172 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, props); | |
| 173 | - }; | |
| 174 | -} | |
| 175 | -function createRegister(injections) { | |
| 176 | - return ({ | |
| 177 | - component, | |
| 178 | - id, | |
| 179 | - condition = () => true, | |
| 180 | - options = {} | |
| 181 | - }) => { | |
| 182 | - injections.set(id, { | |
| 183 | - id, | |
| 184 | - component: (0,_injections__WEBPACK_IMPORTED_MODULE_1__.wrapInjectedComponent)(component), | |
| 185 | - condition, | |
| 186 | - priority: options.priority ?? _injections__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_PRIORITY | |
| 187 | - }); | |
| 188 | - }; | |
| 189 | -} | |
| 190 | - | |
| 191 | -/***/ }), | |
| 192 | - | |
| 193 | -/***/ "./packages/packages/libs/locations/src/injections.tsx": | |
| 194 | -/*!*************************************************************!*\ | |
| 195 | - !*** ./packages/packages/libs/locations/src/injections.tsx ***! | |
| 196 | - \*************************************************************/ | |
| 197 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 198 | - | |
| 199 | -__webpack_require__.r(__webpack_exports__); | |
| 200 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 201 | -/* harmony export */ DEFAULT_PRIORITY: function() { return /* binding */ DEFAULT_PRIORITY; }, | |
| 202 | -/* harmony export */ createGetInjections: function() { return /* binding */ createGetInjections; }, | |
| 203 | -/* harmony export */ createUseInjections: function() { return /* binding */ createUseInjections; }, | |
| 204 | -/* harmony export */ flushAllInjections: function() { return /* binding */ flushAllInjections; }, | |
| 205 | -/* harmony export */ flushInjectionsFns: function() { return /* binding */ flushInjectionsFns; }, | |
| 206 | -/* harmony export */ wrapInjectedComponent: function() { return /* binding */ wrapInjectedComponent; } | |
| 207 | -/* harmony export */ }); | |
| 208 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 209 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 210 | -/* harmony import */ var _components_injected_component_wrapper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/injected-component-wrapper */ "./packages/packages/libs/locations/src/components/injected-component-wrapper.tsx"); | |
| 211 | - | |
| 212 | - | |
| 213 | - | |
| 214 | -const DEFAULT_PRIORITY = 10; | |
| 215 | - | |
| 216 | -// Allow flushing all injections at once, for testing purposes. | |
| 217 | -const flushInjectionsFns = []; | |
| 218 | -function flushAllInjections() { | |
| 219 | - flushInjectionsFns.forEach(flush => flush()); | |
| 220 | -} | |
| 221 | -function createGetInjections(injections) { | |
| 222 | - return () => [...injections.values()].sort((a, b) => a.priority - b.priority); | |
| 223 | -} | |
| 224 | -function createUseInjections(getInjections) { | |
| 225 | - return () => (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getInjections(), []); | |
| 226 | -} | |
| 227 | -function wrapInjectedComponent(Component) { | |
| 228 | - return props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_injected_component_wrapper__WEBPACK_IMPORTED_MODULE_1__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, props)); | |
| 229 | -} | |
| 230 | - | |
| 231 | -/***/ }), | |
| 232 | - | |
| 233 | -/***/ "./packages/packages/libs/locations/src/types.ts": | |
| 234 | -/*!*******************************************************!*\ | |
| 235 | - !*** ./packages/packages/libs/locations/src/types.ts ***! | |
| 236 | - \*******************************************************/ | |
| 237 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 238 | - | |
| 239 | -__webpack_require__.r(__webpack_exports__); | |
| 240 | - | |
| 241 | - | |
| 242 | -/***/ }), | |
| 243 | - | |
| 244 | -/***/ "react": | |
| 245 | -/*!**************************!*\ | |
| 246 | - !*** external ["React"] ***! | |
| 247 | - \**************************/ | |
| 248 | -/***/ (function(module) { | |
| 249 | - | |
| 250 | -module.exports = window["React"]; | |
| 251 | - | |
| 252 | -/***/ }) | |
| 253 | - | |
| 254 | -/******/ }); | |
| 255 | -/************************************************************************/ | |
| 256 | -/******/ // The module cache | |
| 257 | -/******/ var __webpack_module_cache__ = {}; | |
| 258 | -/******/ | |
| 259 | -/******/ // The require function | |
| 260 | -/******/ function __webpack_require__(moduleId) { | |
| 261 | -/******/ // Check if module is in cache | |
| 262 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 263 | -/******/ if (cachedModule !== undefined) { | |
| 264 | -/******/ return cachedModule.exports; | |
| 265 | -/******/ } | |
| 266 | -/******/ // Create a new module (and put it into the cache) | |
| 267 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 268 | -/******/ // no module.id needed | |
| 269 | -/******/ // no module.loaded needed | |
| 270 | -/******/ exports: {} | |
| 271 | -/******/ }; | |
| 272 | -/******/ | |
| 273 | -/******/ // Execute the module function | |
| 274 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 275 | -/******/ | |
| 276 | -/******/ // Return the exports of the module | |
| 277 | -/******/ return module.exports; | |
| 278 | -/******/ } | |
| 279 | -/******/ | |
| 280 | -/************************************************************************/ | |
| 281 | -/******/ /* webpack/runtime/compat get default export */ | |
| 282 | -/******/ !function() { | |
| 283 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 284 | -/******/ __webpack_require__.n = function(module) { | |
| 285 | -/******/ var getter = module && module.__esModule ? | |
| 286 | -/******/ function() { return module['default']; } : | |
| 287 | -/******/ function() { return module; }; | |
| 288 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 289 | -/******/ return getter; | |
| 290 | -/******/ }; | |
| 291 | -/******/ }(); | |
| 292 | -/******/ | |
| 293 | -/******/ /* webpack/runtime/define property getters */ | |
| 294 | -/******/ !function() { | |
| 295 | -/******/ // define getter functions for harmony exports | |
| 296 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 297 | -/******/ for(var key in definition) { | |
| 298 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 299 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 300 | -/******/ } | |
| 301 | -/******/ } | |
| 302 | -/******/ }; | |
| 303 | -/******/ }(); | |
| 304 | -/******/ | |
| 305 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 306 | -/******/ !function() { | |
| 307 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 308 | -/******/ }(); | |
| 309 | -/******/ | |
| 310 | -/******/ /* webpack/runtime/make namespace object */ | |
| 311 | -/******/ !function() { | |
| 312 | -/******/ // define __esModule on exports | |
| 313 | -/******/ __webpack_require__.r = function(exports) { | |
| 314 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 315 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 316 | -/******/ } | |
| 317 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 318 | -/******/ }; | |
| 319 | -/******/ }(); | |
| 320 | -/******/ | |
| 321 | -/************************************************************************/ | |
| 322 | -var __webpack_exports__ = {}; | |
| 323 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 324 | -!function() { | |
| 325 | -/*!*******************************************************!*\ | |
| 326 | - !*** ./packages/packages/libs/locations/src/index.ts ***! | |
| 327 | - \*******************************************************/ | |
| 328 | -__webpack_require__.r(__webpack_exports__); | |
| 329 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 330 | -/* harmony export */ __flushAllInjections: function() { return /* reexport safe */ _injections__WEBPACK_IMPORTED_MODULE_3__.flushAllInjections; }, | |
| 331 | -/* harmony export */ createLocation: function() { return /* reexport safe */ _create_location__WEBPACK_IMPORTED_MODULE_1__.createLocation; }, | |
| 332 | -/* harmony export */ createReplaceableLocation: function() { return /* reexport safe */ _create_replaceable_location__WEBPACK_IMPORTED_MODULE_2__.createReplaceableLocation; } | |
| 333 | -/* harmony export */ }); | |
| 334 | -/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./packages/packages/libs/locations/src/types.ts"); | |
| 335 | -/* harmony import */ var _create_location__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./create-location */ "./packages/packages/libs/locations/src/create-location.tsx"); | |
| 336 | -/* harmony import */ var _create_replaceable_location__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./create-replaceable-location */ "./packages/packages/libs/locations/src/create-replaceable-location.tsx"); | |
| 337 | -/* harmony import */ var _injections__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./injections */ "./packages/packages/libs/locations/src/injections.tsx"); | |
| 338 | - | |
| 339 | - | |
| 340 | - | |
| 341 | - | |
| 342 | -}(); | |
| 343 | -(window.elementorV2 = window.elementorV2 || {}).locations = __webpack_exports__; | |
| 344 | -/******/ })() | |
| 345 | -; | |
| 346 | -window.elementorV2.locations?.init?.(); | |
| 1 | +/*! For license information please see locations.js.LICENSE.txt */ | |
| 2 | +!function(){"use strict";var e={"./packages/packages/libs/locations/src/components/error-boundary.tsx":function(e,n,t){t.r(n),t.d(n,{default:function(){return ErrorBoundary}});var r=t("react");class ErrorBoundary extends r.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}},"./packages/packages/libs/locations/src/components/injected-component-wrapper.tsx":function(e,n,t){t.r(n),t.d(n,{default:function(){return InjectedComponentWrapper}});var r=t("react"),c=t("./packages/packages/libs/locations/src/components/error-boundary.tsx");function InjectedComponentWrapper({children:e}){return r.createElement(c.default,{fallback:null},r.createElement(r.Suspense,{fallback:null},e))}},"./packages/packages/libs/locations/src/create-location.tsx":function(e,n,t){t.r(n),t.d(n,{createLocation:function(){return createLocation}});var r=t("react"),c=t("./packages/packages/libs/locations/src/injections.tsx");function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_extends.apply(null,arguments)}function createLocation(){const e=new Map,n=(0,c.createGetInjections)(e),t=(0,c.createUseInjections)(n),o=function createSlot(e){return n=>{const t=e();return r.createElement(r.Fragment,null,t.map(({id:e,component:t})=>r.createElement(t,_extends({},n,{key:e}))))}}(t),a=function createInject(e){return({component:n,id:t,options:r={}})=>{!e.has(t)||r?.overwrite?e.set(t,{id:t,component:(0,c.wrapInjectedComponent)(n),priority:r.priority??c.DEFAULT_PRIORITY}):console.warn(`An injection with the id "${t}" already exists. Did you mean to use "options.overwrite"?`)}}(e);return c.flushInjectionsFns.push(()=>e.clear()),{inject:a,getInjections:n,useInjections:t,Slot:o}}},"./packages/packages/libs/locations/src/create-replaceable-location.tsx":function(e,n,t){t.r(n),t.d(n,{createReplaceableLocation:function(){return createReplaceableLocation}});var r=t("react"),c=t("./packages/packages/libs/locations/src/injections.tsx");function createReplaceableLocation(){const e=new Map,n=(0,c.createGetInjections)(e),t=(0,c.createUseInjections)(n),o=function createReplaceable(e){return n=>{const t=e(),{component:c}=t.find(({condition:e})=>e?.(n))??{};return c?r.createElement(c,n):n.children}}(t),a=function createRegister(e){return({component:n,id:t,condition:r=()=>!0,options:o={}})=>{e.set(t,{id:t,component:(0,c.wrapInjectedComponent)(n),condition:r,priority:o.priority??c.DEFAULT_PRIORITY})}}(e);return c.flushInjectionsFns.push(()=>e.clear()),{getInjections:n,useInjections:t,inject:a,Slot:o}}},"./packages/packages/libs/locations/src/injections.tsx":function(e,n,t){t.r(n),t.d(n,{DEFAULT_PRIORITY:function(){return o},createGetInjections:function(){return createGetInjections},createUseInjections:function(){return createUseInjections},flushAllInjections:function(){return flushAllInjections},flushInjectionsFns:function(){return a},wrapInjectedComponent:function(){return wrapInjectedComponent}});var r=t("react"),c=t("./packages/packages/libs/locations/src/components/injected-component-wrapper.tsx");const o=10,a=[];function flushAllInjections(){a.forEach(e=>e())}function createGetInjections(e){return()=>[...e.values()].sort((e,n)=>e.priority-n.priority)}function createUseInjections(e){return()=>(0,r.useMemo)(()=>e(),[])}function wrapInjectedComponent(e){return n=>r.createElement(c.default,null,r.createElement(e,n))}},"./packages/packages/libs/locations/src/types.ts":function(e,n,t){t.r(n)},react:function(e){e.exports=window.React}},n={};function __webpack_require__(t){var r=n[t];if(void 0!==r)return r.exports;var c=n[t]={exports:{}};return e[t](c,c.exports,__webpack_require__),c.exports}__webpack_require__.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(n,{a:n}),n},__webpack_require__.d=function(e,n){for(var t in n)__webpack_require__.o(n,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},__webpack_require__.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};!function(){__webpack_require__.r(t),__webpack_require__.d(t,{__flushAllInjections:function(){return r.flushAllInjections},createLocation:function(){return e.createLocation},createReplaceableLocation:function(){return n.createReplaceableLocation}});__webpack_require__("./packages/packages/libs/locations/src/types.ts");var e=__webpack_require__("./packages/packages/libs/locations/src/create-location.tsx"),n=__webpack_require__("./packages/packages/libs/locations/src/create-replaceable-location.tsx"),r=__webpack_require__("./packages/packages/libs/locations/src/injections.tsx")}(),(window.elementorV2=window.elementorV2||{}).locations=t}(),window.elementorV2.locations?.init?.(); | |
| 347 | 3 | //# sourceMappingURL=locations.js.map |