PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / ai-admin.js

ai-admin.js in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at assets/js/ai-admin.js

30,427 lines 1.0 MB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(react, _elementor_ui, _wordpress_i18n, _elementor_icons, _elementor_ui_TextField) {
2
3 //#region \0rolldown/runtime.js
4 var __create = Object.create;
5 var __defProp = Object.defineProperty;
6 var __name = (target, value) => __defProp(target, "name", {
7 value,
8 configurable: true
9 });
10 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11 var __getOwnPropNames = Object.getOwnPropertyNames;
12 var __getProtoOf = Object.getPrototypeOf;
13 var __hasOwnProp = Object.prototype.hasOwnProperty;
14 var __esmMin = (fn, res, err) => () => {
15 if (err) throw err[0];
16 try {
17 return fn && (res = fn(fn = 0)), res;
18 } catch (e) {
19 throw err = [e], e;
20 }
21 };
22 var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
23 var __exportAll = (all, no_symbols) => {
24 let target = {};
25 for (var name in all) {
26 __defProp(target, name, {
27 get: all[name],
28 enumerable: true
29 });
30 }
31 if (!no_symbols) {
32 __defProp(target, Symbol.toStringTag, { value: "Module" });
33 }
34 return target;
35 };
36 var __copyProps = (to, from, except, desc) => {
37 if (from && typeof from === "object" || typeof from === "function") {
38 for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
39 key = keys[i];
40 if (!__hasOwnProp.call(to, key) && key !== except) {
41 __defProp(to, key, {
42 get: ((k) => from[k]).bind(null, key),
43 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44 });
45 }
46 }
47 }
48 return to;
49 };
50 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
51 value: mod,
52 enumerable: true
53 }) : target, mod));
54
55 //#endregion
56 let react$1 = __toESM(react, 1);
57 react = __toESM(react);
58 _elementor_ui_TextField = __toESM(_elementor_ui_TextField);
59
60 //#region node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
61 /** @license React v16.13.1
62 * react-is.development.js
63 *
64 * Copyright (c) Facebook, Inc. and its affiliates.
65 *
66 * This source code is licensed under the MIT license found in the
67 * LICENSE file in the root directory of this source tree.
68 */
69 var require_react_is_development$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
70 (function() {
71 "use strict";
72 var hasSymbol = typeof Symbol === "function" && Symbol.for;
73 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
74 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
75 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
76 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
77 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
78 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
79 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
80 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
81 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
82 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
83 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
84 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
85 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
86 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
87 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
88 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
89 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
90 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
91 function isValidElementType(type) {
92 return typeof type === "string" || typeof type === "function" || type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
93 }
94 function typeOf(object) {
95 if (typeof object === "object" && object !== null) {
96 var $$typeof = object.$$typeof;
97 switch ($$typeof) {
98 case REACT_ELEMENT_TYPE:
99 var type = object.type;
100 switch (type) {
101 case REACT_ASYNC_MODE_TYPE:
102 case REACT_CONCURRENT_MODE_TYPE:
103 case REACT_FRAGMENT_TYPE:
104 case REACT_PROFILER_TYPE:
105 case REACT_STRICT_MODE_TYPE:
106 case REACT_SUSPENSE_TYPE: return type;
107 default:
108 var $$typeofType = type && type.$$typeof;
109 switch ($$typeofType) {
110 case REACT_CONTEXT_TYPE:
111 case REACT_FORWARD_REF_TYPE:
112 case REACT_LAZY_TYPE:
113 case REACT_MEMO_TYPE:
114 case REACT_PROVIDER_TYPE: return $$typeofType;
115 default: return $$typeof;
116 }
117 }
118 case REACT_PORTAL_TYPE: return $$typeof;
119 }
120 }
121 }
122 var AsyncMode = REACT_ASYNC_MODE_TYPE;
123 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
124 var ContextConsumer = REACT_CONTEXT_TYPE;
125 var ContextProvider = REACT_PROVIDER_TYPE;
126 var Element = REACT_ELEMENT_TYPE;
127 var ForwardRef = REACT_FORWARD_REF_TYPE;
128 var Fragment = REACT_FRAGMENT_TYPE;
129 var Lazy = REACT_LAZY_TYPE;
130 var Memo = REACT_MEMO_TYPE;
131 var Portal = REACT_PORTAL_TYPE;
132 var Profiler = REACT_PROFILER_TYPE;
133 var StrictMode = REACT_STRICT_MODE_TYPE;
134 var Suspense = REACT_SUSPENSE_TYPE;
135 var hasWarnedAboutDeprecatedIsAsyncMode = false;
136 function isAsyncMode(object) {
137 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
138 hasWarnedAboutDeprecatedIsAsyncMode = true;
139 console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
140 }
141 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
142 }
143 function isConcurrentMode(object) {
144 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
145 }
146 function isContextConsumer(object) {
147 return typeOf(object) === REACT_CONTEXT_TYPE;
148 }
149 function isContextProvider(object) {
150 return typeOf(object) === REACT_PROVIDER_TYPE;
151 }
152 function isElement(object) {
153 return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
154 }
155 function isForwardRef(object) {
156 return typeOf(object) === REACT_FORWARD_REF_TYPE;
157 }
158 function isFragment(object) {
159 return typeOf(object) === REACT_FRAGMENT_TYPE;
160 }
161 function isLazy(object) {
162 return typeOf(object) === REACT_LAZY_TYPE;
163 }
164 function isMemo(object) {
165 return typeOf(object) === REACT_MEMO_TYPE;
166 }
167 function isPortal(object) {
168 return typeOf(object) === REACT_PORTAL_TYPE;
169 }
170 function isProfiler(object) {
171 return typeOf(object) === REACT_PROFILER_TYPE;
172 }
173 function isStrictMode(object) {
174 return typeOf(object) === REACT_STRICT_MODE_TYPE;
175 }
176 function isSuspense(object) {
177 return typeOf(object) === REACT_SUSPENSE_TYPE;
178 }
179 exports.AsyncMode = AsyncMode;
180 exports.ConcurrentMode = ConcurrentMode;
181 exports.ContextConsumer = ContextConsumer;
182 exports.ContextProvider = ContextProvider;
183 exports.Element = Element;
184 exports.ForwardRef = ForwardRef;
185 exports.Fragment = Fragment;
186 exports.Lazy = Lazy;
187 exports.Memo = Memo;
188 exports.Portal = Portal;
189 exports.Profiler = Profiler;
190 exports.StrictMode = StrictMode;
191 exports.Suspense = Suspense;
192 exports.isAsyncMode = isAsyncMode;
193 exports.isConcurrentMode = isConcurrentMode;
194 exports.isContextConsumer = isContextConsumer;
195 exports.isContextProvider = isContextProvider;
196 exports.isElement = isElement;
197 exports.isForwardRef = isForwardRef;
198 exports.isFragment = isFragment;
199 exports.isLazy = isLazy;
200 exports.isMemo = isMemo;
201 exports.isPortal = isPortal;
202 exports.isProfiler = isProfiler;
203 exports.isStrictMode = isStrictMode;
204 exports.isSuspense = isSuspense;
205 exports.isValidElementType = isValidElementType;
206 exports.typeOf = typeOf;
207 })();
208 }));
209
210 //#endregion
211 //#region node_modules/prop-types/node_modules/react-is/index.js
212 var require_react_is$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
213 module.exports = require_react_is_development$1();
214 }));
215
216 //#endregion
217 //#region node_modules/object-assign/index.js
218 /*
219 object-assign
220 (c) Sindre Sorhus
221 @license MIT
222 */
223 var require_object_assign = /* @__PURE__ */ __commonJSMin(((exports, module) => {
224 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
225 var hasOwnProperty = Object.prototype.hasOwnProperty;
226 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
227 function toObject(val) {
228 if (val === null || val === void 0) throw new TypeError("Object.assign cannot be called with null or undefined");
229 return Object(val);
230 }
231 function shouldUseNative() {
232 try {
233 if (!Object.assign) return false;
234 var test1 = /* @__PURE__ */ new String("abc");
235 test1[5] = "de";
236 if (Object.getOwnPropertyNames(test1)[0] === "5") return false;
237 var test2 = {};
238 for (var i = 0; i < 10; i++) test2["_" + String.fromCharCode(i)] = i;
239 if (Object.getOwnPropertyNames(test2).map(function(n) {
240 return test2[n];
241 }).join("") !== "0123456789") return false;
242 var test3 = {};
243 "abcdefghijklmnopqrst".split("").forEach(function(letter) {
244 test3[letter] = letter;
245 });
246 if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") return false;
247 return true;
248 } catch (err) {
249 return false;
250 }
251 }
252 module.exports = shouldUseNative() ? Object.assign : function(target, source) {
253 var from;
254 var to = toObject(target);
255 var symbols;
256 for (var s = 1; s < arguments.length; s++) {
257 from = Object(arguments[s]);
258 for (var key in from) if (hasOwnProperty.call(from, key)) to[key] = from[key];
259 if (getOwnPropertySymbols) {
260 symbols = getOwnPropertySymbols(from);
261 for (var i = 0; i < symbols.length; i++) if (propIsEnumerable.call(from, symbols[i])) to[symbols[i]] = from[symbols[i]];
262 }
263 }
264 return to;
265 };
266 }));
267
268 //#endregion
269 //#region node_modules/prop-types/lib/ReactPropTypesSecret.js
270 /**
271 * Copyright (c) 2013-present, Facebook, Inc.
272 *
273 * This source code is licensed under the MIT license found in the
274 * LICENSE file in the root directory of this source tree.
275 */
276 var require_ReactPropTypesSecret = /* @__PURE__ */ __commonJSMin(((exports, module) => {
277 var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
278 module.exports = ReactPropTypesSecret;
279 }));
280
281 //#endregion
282 //#region node_modules/prop-types/lib/has.js
283 var require_has = /* @__PURE__ */ __commonJSMin(((exports, module) => {
284 module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
285 }));
286
287 //#endregion
288 //#region node_modules/prop-types/checkPropTypes.js
289 /**
290 * Copyright (c) 2013-present, Facebook, Inc.
291 *
292 * This source code is licensed under the MIT license found in the
293 * LICENSE file in the root directory of this source tree.
294 */
295 var require_checkPropTypes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
296 var printWarning = function() {};
297 var ReactPropTypesSecret = require_ReactPropTypesSecret();
298 var loggedTypeFailures = {};
299 var has = require_has();
300 printWarning = function(text) {
301 var message = "Warning: " + text;
302 if (typeof console !== "undefined") console.error(message);
303 try {
304 throw new Error(message);
305 } catch (x) {}
306 };
307 /**
308 * Assert that the values match with the type specs.
309 * Error messages are memorized and will only be shown once.
310 *
311 * @param {object} typeSpecs Map of name to a ReactPropType
312 * @param {object} values Runtime values that need to be type-checked
313 * @param {string} location e.g. "prop", "context", "child context"
314 * @param {string} componentName Name of the component for error messages.
315 * @param {?Function} getStack Returns the component stack.
316 * @private
317 */
318 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
319 for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) {
320 var error;
321 try {
322 if (typeof typeSpecs[typeSpecName] !== "function") {
323 var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
324 err.name = "Invariant Violation";
325 throw err;
326 }
327 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
328 } catch (ex) {
329 error = ex;
330 }
331 if (error && !(error instanceof Error)) printWarning((componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).");
332 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
333 loggedTypeFailures[error.message] = true;
334 var stack = getStack ? getStack() : "";
335 printWarning("Failed " + location + " type: " + error.message + (stack != null ? stack : ""));
336 }
337 }
338 }
339 /**
340 * Resets warning cache when testing.
341 *
342 * @private
343 */
344 checkPropTypes.resetWarningCache = function() {
345 loggedTypeFailures = {};
346 };
347 module.exports = checkPropTypes;
348 }));
349
350 //#endregion
351 //#region node_modules/prop-types/factoryWithTypeCheckers.js
352 /**
353 * Copyright (c) 2013-present, Facebook, Inc.
354 *
355 * This source code is licensed under the MIT license found in the
356 * LICENSE file in the root directory of this source tree.
357 */
358 var require_factoryWithTypeCheckers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
359 var ReactIs = require_react_is$1();
360 var assign = require_object_assign();
361 var ReactPropTypesSecret = require_ReactPropTypesSecret();
362 var has = require_has();
363 var checkPropTypes = require_checkPropTypes();
364 var printWarning = function() {};
365 printWarning = function(text) {
366 var message = "Warning: " + text;
367 if (typeof console !== "undefined") console.error(message);
368 try {
369 throw new Error(message);
370 } catch (x) {}
371 };
372 function emptyFunctionThatReturnsNull() {
373 return null;
374 }
375 module.exports = function(isValidElement, throwOnDirectAccess) {
376 var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
377 var FAUX_ITERATOR_SYMBOL = "@@iterator";
378 /**
379 * Returns the iterator method function contained on the iterable object.
380 *
381 * Be sure to invoke the function with the iterable as context:
382 *
383 * var iteratorFn = getIteratorFn(myIterable);
384 * if (iteratorFn) {
385 * var iterator = iteratorFn.call(myIterable);
386 * ...
387 * }
388 *
389 * @param {?object} maybeIterable
390 * @return {?function}
391 */
392 function getIteratorFn(maybeIterable) {
393 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
394 if (typeof iteratorFn === "function") return iteratorFn;
395 }
396 /**
397 * Collection of methods that allow declaration and validation of props that are
398 * supplied to React components. Example usage:
399 *
400 * var Props = require('ReactPropTypes');
401 * var MyArticle = React.createClass({
402 * propTypes: {
403 * // An optional string prop named "description".
404 * description: Props.string,
405 *
406 * // A required enum prop named "category".
407 * category: Props.oneOf(['News','Photos']).isRequired,
408 *
409 * // A prop named "dialog" that requires an instance of Dialog.
410 * dialog: Props.instanceOf(Dialog).isRequired
411 * },
412 * render: function() { ... }
413 * });
414 *
415 * A more formal specification of how these methods are used:
416 *
417 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
418 * decl := ReactPropTypes.{type}(.isRequired)?
419 *
420 * Each and every declaration produces a function with the same signature. This
421 * allows the creation of custom validation functions. For example:
422 *
423 * var MyLink = React.createClass({
424 * propTypes: {
425 * // An optional string or URI prop named "href".
426 * href: function(props, propName, componentName) {
427 * var propValue = props[propName];
428 * if (propValue != null && typeof propValue !== 'string' &&
429 * !(propValue instanceof URI)) {
430 * return new Error(
431 * 'Expected a string or an URI for ' + propName + ' in ' +
432 * componentName
433 * );
434 * }
435 * }
436 * },
437 * render: function() {...}
438 * });
439 *
440 * @internal
441 */
442 var ANONYMOUS = "<<anonymous>>";
443 var ReactPropTypes = {
444 array: createPrimitiveTypeChecker("array"),
445 bigint: createPrimitiveTypeChecker("bigint"),
446 bool: createPrimitiveTypeChecker("boolean"),
447 func: createPrimitiveTypeChecker("function"),
448 number: createPrimitiveTypeChecker("number"),
449 object: createPrimitiveTypeChecker("object"),
450 string: createPrimitiveTypeChecker("string"),
451 symbol: createPrimitiveTypeChecker("symbol"),
452 any: createAnyTypeChecker(),
453 arrayOf: createArrayOfTypeChecker,
454 element: createElementTypeChecker(),
455 elementType: createElementTypeTypeChecker(),
456 instanceOf: createInstanceTypeChecker,
457 node: createNodeChecker(),
458 objectOf: createObjectOfTypeChecker,
459 oneOf: createEnumTypeChecker,
460 oneOfType: createUnionTypeChecker,
461 shape: createShapeTypeChecker,
462 exact: createStrictShapeTypeChecker
463 };
464 /**
465 * inlined Object.is polyfill to avoid requiring consumers ship their own
466 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
467 */
468 function is(x, y) {
469 if (x === y) return x !== 0 || 1 / x === 1 / y;
470 else return x !== x && y !== y;
471 }
472 /**
473 * We use an Error-like object for backward compatibility as people may call
474 * PropTypes directly and inspect their output. However, we don't use real
475 * Errors anymore. We don't inspect their stack anyway, and creating them
476 * is prohibitively expensive if they are created too often, such as what
477 * happens in oneOfType() for any type before the one that matched.
478 */
479 function PropTypeError(message, data) {
480 this.message = message;
481 this.data = data && typeof data === "object" ? data : {};
482 this.stack = "";
483 }
484 PropTypeError.prototype = Error.prototype;
485 function createChainableTypeChecker(validate) {
486 var manualPropTypeCallCache = {};
487 var manualPropTypeWarningCount = 0;
488 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
489 componentName = componentName || ANONYMOUS;
490 propFullName = propFullName || propName;
491 if (secret !== ReactPropTypesSecret) {
492 if (throwOnDirectAccess) {
493 var err = /* @__PURE__ */ new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");
494 err.name = "Invariant Violation";
495 throw err;
496 } else if (typeof console !== "undefined") {
497 var cacheKey = componentName + ":" + propName;
498 if (!manualPropTypeCallCache[cacheKey] && manualPropTypeWarningCount < 3) {
499 printWarning("You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.");
500 manualPropTypeCallCache[cacheKey] = true;
501 manualPropTypeWarningCount++;
502 }
503 }
504 }
505 if (props[propName] == null) {
506 if (isRequired) {
507 if (props[propName] === null) return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
508 return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
509 }
510 return null;
511 } else return validate(props, propName, componentName, location, propFullName);
512 }
513 var chainedCheckType = checkType.bind(null, false);
514 chainedCheckType.isRequired = checkType.bind(null, true);
515 return chainedCheckType;
516 }
517 function createPrimitiveTypeChecker(expectedType) {
518 function validate(props, propName, componentName, location, propFullName, secret) {
519 var propValue = props[propName];
520 if (getPropType(propValue) !== expectedType) {
521 var preciseType = getPreciseType(propValue);
522 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."), { expectedType });
523 }
524 return null;
525 }
526 return createChainableTypeChecker(validate);
527 }
528 function createAnyTypeChecker() {
529 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
530 }
531 function createArrayOfTypeChecker(typeChecker) {
532 function validate(props, propName, componentName, location, propFullName) {
533 if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
534 var propValue = props[propName];
535 if (!Array.isArray(propValue)) {
536 var propType = getPropType(propValue);
537 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
538 }
539 for (var i = 0; i < propValue.length; i++) {
540 var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
541 if (error instanceof Error) return error;
542 }
543 return null;
544 }
545 return createChainableTypeChecker(validate);
546 }
547 function createElementTypeChecker() {
548 function validate(props, propName, componentName, location, propFullName) {
549 var propValue = props[propName];
550 if (!isValidElement(propValue)) {
551 var propType = getPropType(propValue);
552 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
553 }
554 return null;
555 }
556 return createChainableTypeChecker(validate);
557 }
558 function createElementTypeTypeChecker() {
559 function validate(props, propName, componentName, location, propFullName) {
560 var propValue = props[propName];
561 if (!ReactIs.isValidElementType(propValue)) {
562 var propType = getPropType(propValue);
563 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
564 }
565 return null;
566 }
567 return createChainableTypeChecker(validate);
568 }
569 function createInstanceTypeChecker(expectedClass) {
570 function validate(props, propName, componentName, location, propFullName) {
571 if (!(props[propName] instanceof expectedClass)) {
572 var expectedClassName = expectedClass.name || ANONYMOUS;
573 var actualClassName = getClassName(props[propName]);
574 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
575 }
576 return null;
577 }
578 return createChainableTypeChecker(validate);
579 }
580 function createEnumTypeChecker(expectedValues) {
581 if (!Array.isArray(expectedValues)) {
582 if (arguments.length > 1) printWarning("Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).");
583 else printWarning("Invalid argument supplied to oneOf, expected an array.");
584 return emptyFunctionThatReturnsNull;
585 }
586 function validate(props, propName, componentName, location, propFullName) {
587 var propValue = props[propName];
588 for (var i = 0; i < expectedValues.length; i++) if (is(propValue, expectedValues[i])) return null;
589 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
590 if (getPreciseType(value) === "symbol") return String(value);
591 return value;
592 });
593 return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
594 }
595 return createChainableTypeChecker(validate);
596 }
597 function createObjectOfTypeChecker(typeChecker) {
598 function validate(props, propName, componentName, location, propFullName) {
599 if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
600 var propValue = props[propName];
601 var propType = getPropType(propValue);
602 if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
603 for (var key in propValue) if (has(propValue, key)) {
604 var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
605 if (error instanceof Error) return error;
606 }
607 return null;
608 }
609 return createChainableTypeChecker(validate);
610 }
611 function createUnionTypeChecker(arrayOfTypeCheckers) {
612 if (!Array.isArray(arrayOfTypeCheckers)) {
613 printWarning("Invalid argument supplied to oneOfType, expected an instance of array.");
614 return emptyFunctionThatReturnsNull;
615 }
616 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
617 var checker = arrayOfTypeCheckers[i];
618 if (typeof checker !== "function") {
619 printWarning("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + ".");
620 return emptyFunctionThatReturnsNull;
621 }
622 }
623 function validate(props, propName, componentName, location, propFullName) {
624 var expectedTypes = [];
625 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
626 var checker = arrayOfTypeCheckers[i];
627 var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
628 if (checkerResult == null) return null;
629 if (checkerResult.data && has(checkerResult.data, "expectedType")) expectedTypes.push(checkerResult.data.expectedType);
630 }
631 var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
632 return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
633 }
634 return createChainableTypeChecker(validate);
635 }
636 function createNodeChecker() {
637 function validate(props, propName, componentName, location, propFullName) {
638 if (!isNode(props[propName])) return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
639 return null;
640 }
641 return createChainableTypeChecker(validate);
642 }
643 function invalidValidatorError(componentName, location, propFullName, key, type) {
644 return new PropTypeError((componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`.");
645 }
646 function createShapeTypeChecker(shapeTypes) {
647 function validate(props, propName, componentName, location, propFullName) {
648 var propValue = props[propName];
649 var propType = getPropType(propValue);
650 if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
651 for (var key in shapeTypes) {
652 var checker = shapeTypes[key];
653 if (typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
654 var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
655 if (error) return error;
656 }
657 return null;
658 }
659 return createChainableTypeChecker(validate);
660 }
661 function createStrictShapeTypeChecker(shapeTypes) {
662 function validate(props, propName, componentName, location, propFullName) {
663 var propValue = props[propName];
664 var propType = getPropType(propValue);
665 if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
666 for (var key in assign({}, props[propName], shapeTypes)) {
667 var checker = shapeTypes[key];
668 if (has(shapeTypes, key) && typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
669 if (!checker) return new PropTypeError("Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " "));
670 var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
671 if (error) return error;
672 }
673 return null;
674 }
675 return createChainableTypeChecker(validate);
676 }
677 function isNode(propValue) {
678 switch (typeof propValue) {
679 case "number":
680 case "string":
681 case "undefined": return true;
682 case "boolean": return !propValue;
683 case "object":
684 if (Array.isArray(propValue)) return propValue.every(isNode);
685 if (propValue === null || isValidElement(propValue)) return true;
686 var iteratorFn = getIteratorFn(propValue);
687 if (iteratorFn) {
688 var iterator = iteratorFn.call(propValue);
689 var step;
690 if (iteratorFn !== propValue.entries) {
691 while (!(step = iterator.next()).done) if (!isNode(step.value)) return false;
692 } else while (!(step = iterator.next()).done) {
693 var entry = step.value;
694 if (entry) {
695 if (!isNode(entry[1])) return false;
696 }
697 }
698 } else return false;
699 return true;
700 default: return false;
701 }
702 }
703 function isSymbol(propType, propValue) {
704 if (propType === "symbol") return true;
705 if (!propValue) return false;
706 if (propValue["@@toStringTag"] === "Symbol") return true;
707 if (typeof Symbol === "function" && propValue instanceof Symbol) return true;
708 return false;
709 }
710 function getPropType(propValue) {
711 var propType = typeof propValue;
712 if (Array.isArray(propValue)) return "array";
713 if (propValue instanceof RegExp) return "object";
714 if (isSymbol(propType, propValue)) return "symbol";
715 return propType;
716 }
717 function getPreciseType(propValue) {
718 if (typeof propValue === "undefined" || propValue === null) return "" + propValue;
719 var propType = getPropType(propValue);
720 if (propType === "object") {
721 if (propValue instanceof Date) return "date";
722 else if (propValue instanceof RegExp) return "regexp";
723 }
724 return propType;
725 }
726 function getPostfixForTypeWarning(value) {
727 var type = getPreciseType(value);
728 switch (type) {
729 case "array":
730 case "object": return "an " + type;
731 case "boolean":
732 case "date":
733 case "regexp": return "a " + type;
734 default: return type;
735 }
736 }
737 function getClassName(propValue) {
738 if (!propValue.constructor || !propValue.constructor.name) return ANONYMOUS;
739 return propValue.constructor.name;
740 }
741 ReactPropTypes.checkPropTypes = checkPropTypes;
742 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
743 ReactPropTypes.PropTypes = ReactPropTypes;
744 return ReactPropTypes;
745 };
746 }));
747
748 //#endregion
749 //#region node_modules/prop-types/index.js
750 var require_prop_types = /* @__PURE__ */ __commonJSMin(((exports, module) => {
751 var ReactIs = require_react_is$1();
752 var throwOnDirectAccess = true;
753 module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
754 }));
755
756 //#endregion
757 //#region node_modules/@babel/runtime/helpers/esm/extends.js
758 function _extends$1() {
759 return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
760 for (var e = 1; e < arguments.length; e++) {
761 var t = arguments[e];
762 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
763 }
764 return n;
765 }, _extends$1.apply(null, arguments);
766 }
767 var init_extends = __esmMin((() => {
768 __name(_extends$1, "_extends");
769 }));
770
771 //#endregion
772 //#region node_modules/@babel/runtime/helpers/esm/typeof.js
773 function _typeof$1(o) {
774 "@babel/helpers - typeof";
775 return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
776 return typeof o;
777 } : function(o) {
778 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
779 }, _typeof$1(o);
780 }
781 var init_typeof$1 = __esmMin((() => {
782 __name(_typeof$1, "_typeof");
783 }));
784
785 //#endregion
786 //#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
787 function toPrimitive$1(t, r) {
788 if ("object" != _typeof$1(t) || !t) return t;
789 var e = t[Symbol.toPrimitive];
790 if (void 0 !== e) {
791 var i = e.call(t, r || "default");
792 if ("object" != _typeof$1(i)) return i;
793 throw new TypeError("@@toPrimitive must return a primitive value.");
794 }
795 return ("string" === r ? String : Number)(t);
796 }
797 var init_toPrimitive$1 = __esmMin((() => {
798 init_typeof$1();
799 __name(toPrimitive$1, "toPrimitive");
800 }));
801
802 //#endregion
803 //#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
804 function toPropertyKey$1(t) {
805 var i = toPrimitive$1(t, "string");
806 return "symbol" == _typeof$1(i) ? i : i + "";
807 }
808 var init_toPropertyKey$1 = __esmMin((() => {
809 init_typeof$1();
810 init_toPrimitive$1();
811 __name(toPropertyKey$1, "toPropertyKey");
812 }));
813
814 //#endregion
815 //#region node_modules/@babel/runtime/helpers/esm/defineProperty.js
816 function _defineProperty$1(e, r, t) {
817 return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
818 value: t,
819 enumerable: !0,
820 configurable: !0,
821 writable: !0
822 }) : e[r] = t, e;
823 }
824 var init_defineProperty$1 = __esmMin((() => {
825 init_toPropertyKey$1();
826 __name(_defineProperty$1, "_defineProperty");
827 }));
828
829 //#endregion
830 //#region node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
831 function _arrayWithHoles(r) {
832 if (Array.isArray(r)) return r;
833 }
834 var init_arrayWithHoles = __esmMin((() => {}));
835
836 //#endregion
837 //#region node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
838 function _iterableToArrayLimit(r, l) {
839 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
840 if (null != t) {
841 var e;
842 var n;
843 var i;
844 var u;
845 var a = [];
846 var f = !0;
847 var o = !1;
848 try {
849 if (i = (t = t.call(r)).next, 0 === l) {
850 if (Object(t) !== t) return;
851 f = !1;
852 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
853 } catch (r) {
854 o = !0, n = r;
855 } finally {
856 try {
857 if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
858 } finally {
859 if (o) throw n;
860 }
861 }
862 return a;
863 }
864 }
865 var init_iterableToArrayLimit = __esmMin((() => {}));
866
867 //#endregion
868 //#region node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
869 function _arrayLikeToArray$2(r, a) {
870 (null == a || a > r.length) && (a = r.length);
871 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
872 return n;
873 }
874 var init_arrayLikeToArray = __esmMin((() => {
875 __name(_arrayLikeToArray$2, "_arrayLikeToArray");
876 }));
877
878 //#endregion
879 //#region node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
880 function _unsupportedIterableToArray$2(r, a) {
881 if (r) {
882 if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
883 var t = {}.toString.call(r).slice(8, -1);
884 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
885 }
886 }
887 var init_unsupportedIterableToArray = __esmMin((() => {
888 init_arrayLikeToArray();
889 __name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray");
890 }));
891
892 //#endregion
893 //#region node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
894 function _nonIterableRest() {
895 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
896 }
897 var init_nonIterableRest = __esmMin((() => {}));
898
899 //#endregion
900 //#region node_modules/@babel/runtime/helpers/esm/slicedToArray.js
901 function _slicedToArray(r, e) {
902 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest();
903 }
904 var init_slicedToArray = __esmMin((() => {
905 init_arrayWithHoles();
906 init_iterableToArrayLimit();
907 init_unsupportedIterableToArray();
908 init_nonIterableRest();
909 }));
910
911 //#endregion
912 //#region node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
913 function asyncGeneratorStep$1(n, t, e, r, o, a, c) {
914 try {
915 var i = n[a](c);
916 var u = i.value;
917 } catch (n) {
918 e(n);
919 return;
920 }
921 i.done ? t(u) : Promise.resolve(u).then(r, o);
922 }
923 function _asyncToGenerator$1(n) {
924 return function() {
925 var t = this;
926 var e = arguments;
927 return new Promise(function(r, o) {
928 var a = n.apply(t, e);
929 function _next(n) {
930 asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n);
931 }
932 function _throw(n) {
933 asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n);
934 }
935 _next(void 0);
936 });
937 };
938 }
939 var init_asyncToGenerator = __esmMin((() => {
940 __name(asyncGeneratorStep$1, "asyncGeneratorStep");
941 __name(_asyncToGenerator$1, "_asyncToGenerator");
942 }));
943
944 //#endregion
945 //#region node_modules/@babel/runtime/helpers/OverloadYield.js
946 var require_OverloadYield = /* @__PURE__ */ __commonJSMin(((exports, module) => {
947 function _OverloadYield(e, d) {
948 this.v = e, this.k = d;
949 }
950 module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
951 }));
952
953 //#endregion
954 //#region node_modules/@babel/runtime/helpers/regeneratorDefine.js
955 var require_regeneratorDefine = /* @__PURE__ */ __commonJSMin(((exports, module) => {
956 function _regeneratorDefine(e, r, n, t) {
957 var i = Object.defineProperty;
958 try {
959 i({}, "", {});
960 } catch (e) {
961 i = 0;
962 }
963 module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
964 function o(r, n) {
965 _regeneratorDefine(e, r, function(e) {
966 return this._invoke(r, n, e);
967 });
968 }
969 r ? i ? i(e, r, {
970 value: n,
971 enumerable: !t,
972 configurable: !t,
973 writable: !t
974 }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
975 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
976 }
977 module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
978 }));
979
980 //#endregion
981 //#region node_modules/@babel/runtime/helpers/regenerator.js
982 var require_regenerator$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
983 var regeneratorDefine = require_regeneratorDefine();
984 function _regenerator() {
985 /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
986 var e;
987 var t;
988 var r = "function" == typeof Symbol ? Symbol : {};
989 var n = r.iterator || "@@iterator";
990 var o = r.toStringTag || "@@toStringTag";
991 function i(r, n, o, i) {
992 var c = n && n.prototype instanceof Generator ? n : Generator;
993 var u = Object.create(c.prototype);
994 return regeneratorDefine(u, "_invoke", function(r, n, o) {
995 var i;
996 var c;
997 var u;
998 var f = 0;
999 var p = o || [];
1000 var y = !1;
1001 var G = {
1002 p: 0,
1003 n: 0,
1004 v: e,
1005 a: d,
1006 f: d.bind(e, 4),
1007 d: function d(t, r) {
1008 return i = t, c = 0, u = e, G.n = r, a;
1009 }
1010 };
1011 function d(r, n) {
1012 for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
1013 var o;
1014 var i = p[t];
1015 var d = G.p;
1016 var l = i[2];
1017 r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
1018 }
1019 if (o || r > 1) return a;
1020 throw y = !0, n;
1021 }
1022 return function(o, p, l) {
1023 if (f > 1) throw TypeError("Generator is already running");
1024 for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
1025 i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
1026 try {
1027 if (f = 2, i) {
1028 if (c || (o = "next"), t = i[o]) {
1029 if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
1030 if (!t.done) return t;
1031 u = t.value, c < 2 && (c = 0);
1032 } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
1033 i = e;
1034 } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
1035 } catch (t) {
1036 i = e, c = 1, u = t;
1037 } finally {
1038 f = 1;
1039 }
1040 }
1041 return {
1042 value: t,
1043 done: y
1044 };
1045 };
1046 }(r, o, i), !0), u;
1047 }
1048 var a = {};
1049 function Generator() {}
1050 function GeneratorFunction() {}
1051 function GeneratorFunctionPrototype() {}
1052 t = Object.getPrototypeOf;
1053 var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function() {
1054 return this;
1055 }), t);
1056 var u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
1057 function f(e) {
1058 return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
1059 }
1060 return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function() {
1061 return this;
1062 }), regeneratorDefine(u, "toString", function() {
1063 return "[object Generator]";
1064 }), (module.exports = _regenerator = function _regenerator() {
1065 return {
1066 w: i,
1067 m: f
1068 };
1069 }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
1070 }
1071 module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
1072 }));
1073
1074 //#endregion
1075 //#region node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js
1076 var require_regeneratorAsyncIterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1077 var OverloadYield = require_OverloadYield();
1078 var regeneratorDefine = require_regeneratorDefine();
1079 function AsyncIterator(t, e) {
1080 function n(r, o, i, f) {
1081 try {
1082 var c = t[r](o);
1083 var u = c.value;
1084 return u instanceof OverloadYield ? e.resolve(u.v).then(function(t) {
1085 n("next", t, i, f);
1086 }, function(t) {
1087 n("throw", t, i, f);
1088 }) : e.resolve(u).then(function(t) {
1089 c.value = t, i(c);
1090 }, function(t) {
1091 return n("throw", t, i, f);
1092 });
1093 } catch (t) {
1094 f(t);
1095 }
1096 }
1097 var r;
1098 this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() {
1099 return this;
1100 })), regeneratorDefine(this, "_invoke", function(t, o, i) {
1101 function f() {
1102 return new e(function(e, r) {
1103 n(t, i, e, r);
1104 });
1105 }
1106 return r = r ? r.then(f, f) : f();
1107 }, !0);
1108 }
1109 module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
1110 }));
1111
1112 //#endregion
1113 //#region node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js
1114 var require_regeneratorAsyncGen = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1115 var regenerator = require_regenerator$1();
1116 var regeneratorAsyncIterator = require_regeneratorAsyncIterator();
1117 function _regeneratorAsyncGen(r, e, t, o, n) {
1118 return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
1119 }
1120 module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
1121 }));
1122
1123 //#endregion
1124 //#region node_modules/@babel/runtime/helpers/regeneratorAsync.js
1125 var require_regeneratorAsync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1126 var regeneratorAsyncGen = require_regeneratorAsyncGen();
1127 function _regeneratorAsync(n, e, r, t, o) {
1128 var a = regeneratorAsyncGen(n, e, r, t, o);
1129 return a.next().then(function(n) {
1130 return n.done ? n.value : a.next();
1131 });
1132 }
1133 module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
1134 }));
1135
1136 //#endregion
1137 //#region node_modules/@babel/runtime/helpers/regeneratorKeys.js
1138 var require_regeneratorKeys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1139 function _regeneratorKeys(e) {
1140 var n = Object(e);
1141 var r = [];
1142 for (var t in n) r.unshift(t);
1143 return function e() {
1144 for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
1145 return e.done = !0, e;
1146 };
1147 }
1148 module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
1149 }));
1150
1151 //#endregion
1152 //#region node_modules/@babel/runtime/helpers/typeof.js
1153 var require_typeof = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1154 function _typeof(o) {
1155 "@babel/helpers - typeof";
1156 return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1157 return typeof o;
1158 } : function(o) {
1159 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1160 }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
1161 }
1162 module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
1163 }));
1164
1165 //#endregion
1166 //#region node_modules/@babel/runtime/helpers/regeneratorValues.js
1167 var require_regeneratorValues = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1168 var _typeof = require_typeof()["default"];
1169 function _regeneratorValues(e) {
1170 if (null != e) {
1171 var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"];
1172 var r = 0;
1173 if (t) return t.call(e);
1174 if ("function" == typeof e.next) return e;
1175 if (!isNaN(e.length)) return { next: function next() {
1176 return e && r >= e.length && (e = void 0), {
1177 value: e && e[r++],
1178 done: !e
1179 };
1180 } };
1181 }
1182 throw new TypeError(_typeof(e) + " is not iterable");
1183 }
1184 module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
1185 }));
1186
1187 //#endregion
1188 //#region node_modules/@babel/runtime/helpers/regeneratorRuntime.js
1189 var require_regeneratorRuntime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1190 var OverloadYield = require_OverloadYield();
1191 var regenerator = require_regenerator$1();
1192 var regeneratorAsync = require_regeneratorAsync();
1193 var regeneratorAsyncGen = require_regeneratorAsyncGen();
1194 var regeneratorAsyncIterator = require_regeneratorAsyncIterator();
1195 var regeneratorKeys = require_regeneratorKeys();
1196 var regeneratorValues = require_regeneratorValues();
1197 function _regeneratorRuntime() {
1198 "use strict";
1199 var r = regenerator();
1200 var e = r.m(_regeneratorRuntime);
1201 var t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
1202 function n(r) {
1203 var e = "function" == typeof r && r.constructor;
1204 return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
1205 }
1206 var o = {
1207 "throw": 1,
1208 "return": 2,
1209 "break": 3,
1210 "continue": 3
1211 };
1212 function a(r) {
1213 var e;
1214 var t;
1215 return function(n) {
1216 e || (e = {
1217 stop: function stop() {
1218 return t(n.a, 2);
1219 },
1220 "catch": function _catch() {
1221 return n.v;
1222 },
1223 abrupt: function abrupt(r, e) {
1224 return t(n.a, o[r], e);
1225 },
1226 delegateYield: function delegateYield(r, o, a) {
1227 return e.resultName = o, t(n.d, regeneratorValues(r), a);
1228 },
1229 finish: function finish(r) {
1230 return t(n.f, r);
1231 }
1232 }, t = function t(r, _t, o) {
1233 n.p = e.prev, n.n = e.next;
1234 try {
1235 return r(_t, o);
1236 } finally {
1237 e.next = n.n;
1238 }
1239 }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
1240 try {
1241 return r.call(this, e);
1242 } finally {
1243 n.p = e.prev, n.n = e.next;
1244 }
1245 };
1246 }
1247 return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
1248 return {
1249 wrap: function wrap(e, t, n, o) {
1250 return r.w(a(e), t, n, o && o.reverse());
1251 },
1252 isGeneratorFunction: n,
1253 mark: r.m,
1254 awrap: function awrap(r, e) {
1255 return new OverloadYield(r, e);
1256 },
1257 AsyncIterator: regeneratorAsyncIterator,
1258 async: function async(r, e, t, o, u) {
1259 return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
1260 },
1261 keys: regeneratorKeys,
1262 values: regeneratorValues
1263 };
1264 }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
1265 }
1266 module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
1267 }));
1268
1269 //#endregion
1270 //#region node_modules/@babel/runtime/regenerator/index.js
1271 var require_regenerator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1272 var runtime = require_regeneratorRuntime()();
1273 module.exports = runtime;
1274 try {
1275 regeneratorRuntime = runtime;
1276 } catch (accidentalStrictMode) {
1277 if (typeof globalThis === "object") globalThis.regeneratorRuntime = runtime;
1278 else Function("r", "regeneratorRuntime = r")(runtime);
1279 }
1280 }));
1281
1282 //#endregion
1283 //#region node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
1284 function _objectWithoutPropertiesLoose$1(r, e) {
1285 if (null == r) return {};
1286 var t = {};
1287 for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1288 if (-1 !== e.indexOf(n)) continue;
1289 t[n] = r[n];
1290 }
1291 return t;
1292 }
1293 var init_objectWithoutPropertiesLoose$1 = __esmMin((() => {
1294 __name(_objectWithoutPropertiesLoose$1, "_objectWithoutPropertiesLoose");
1295 }));
1296
1297 //#endregion
1298 //#region node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
1299 function _objectWithoutProperties$1(e, t) {
1300 if (null == e) return {};
1301 var o;
1302 var r;
1303 var i = _objectWithoutPropertiesLoose$1(e, t);
1304 if (Object.getOwnPropertySymbols) {
1305 var n = Object.getOwnPropertySymbols(e);
1306 for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1307 }
1308 return i;
1309 }
1310 var init_objectWithoutProperties$1 = __esmMin((() => {
1311 init_objectWithoutPropertiesLoose$1();
1312 __name(_objectWithoutProperties$1, "_objectWithoutProperties");
1313 }));
1314
1315 //#endregion
1316 //#region modules/ai/assets/js/editor/components/loader.js
1317 function ownKeys$32(e, r) {
1318 var t = Object.keys(e);
1319 if (Object.getOwnPropertySymbols) {
1320 var o = Object.getOwnPropertySymbols(e);
1321 r && (o = o.filter(function(r) {
1322 return Object.getOwnPropertyDescriptor(e, r).enumerable;
1323 })), t.push.apply(t, o);
1324 }
1325 return t;
1326 }
1327 function _objectSpread$31(e) {
1328 for (var r = 1; r < arguments.length; r++) {
1329 var t = null != arguments[r] ? arguments[r] : {};
1330 r % 2 ? ownKeys$32(Object(t), !0).forEach(function(r) {
1331 _defineProperty$1(e, r, t[r]);
1332 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$32(Object(t)).forEach(function(r) {
1333 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
1334 });
1335 }
1336 return e;
1337 }
1338 var import_prop_types$13, _excluded$33, Loader;
1339 var init_loader = __esmMin((() => {
1340 init_extends();
1341 init_defineProperty$1();
1342 init_objectWithoutProperties$1();
1343 import_prop_types$13 = /* @__PURE__ */ __toESM(require_prop_types());
1344 _excluded$33 = ["sx", "BoxProps"];
1345 __name(ownKeys$32, "ownKeys");
1346 __name(_objectSpread$31, "_objectSpread");
1347 Loader = function Loader(_ref) {
1348 var _ref$sx = _ref.sx;
1349 var sx = _ref$sx === void 0 ? {} : _ref$sx;
1350 var _ref$BoxProps = _ref.BoxProps;
1351 var BoxProps = _ref$BoxProps === void 0 ? {} : _ref$BoxProps;
1352 var props = _objectWithoutProperties$1(_ref, _excluded$33);
1353 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({
1354 width: "100%",
1355 display: "flex",
1356 alignItems: "center"
1357 }, BoxProps, { sx: _objectSpread$31({
1358 px: 1.5,
1359 minHeight: function minHeight(theme) {
1360 return theme.spacing(5);
1361 }
1362 }, BoxProps.sx || {}) }), /*#__PURE__*/ react.default.createElement(_elementor_ui.LinearProgress, _extends$1({ color: "secondary" }, props, { sx: _objectSpread$31({ width: "100%" }, sx) })));
1363 };
1364 Loader.propTypes = {
1365 sx: import_prop_types$13.default.object,
1366 BoxProps: import_prop_types$13.default.object
1367 };
1368 }));
1369
1370 //#endregion
1371 //#region modules/ai/assets/js/editor/components/ui/search-field.js
1372 var import_prop_types$12, StyledTextField$1, SearchField;
1373 var init_search_field = __esmMin((() => {
1374 init_extends();
1375 import_prop_types$12 = /* @__PURE__ */ __toESM(require_prop_types());
1376 StyledTextField$1 = (0, _elementor_ui.styled)(_elementor_ui.TextField)(function() {
1377 return { ".wp-admin & .MuiInputBase-input, & .MuiInputBase-input:focus": {
1378 backgroundColor: "initial",
1379 boxShadow: "none",
1380 border: 0,
1381 color: "inherit",
1382 outline: 0,
1383 /**
1384 * TODO:
1385 * Find a better solution to get the component padding value dynamically or fix the global CSS override.
1386 * These values are taken from Material UI's source code (the left padding reset was added to match the component style).
1387 */
1388 padding: "16.5px 14px 16.5px 0",
1389 "&.MuiInputBase-inputSizeSmall": { padding: "8.5px 14px 8.5px 0" }
1390 } };
1391 });
1392 SearchField = (0, react.forwardRef)(function(props, ref) {
1393 return /*#__PURE__*/ react.default.createElement(StyledTextField$1, _extends$1({
1394 autoFocus: true,
1395 fullWidth: true,
1396 required: true,
1397 size: "small",
1398 color: "secondary",
1399 InputProps: {
1400 autoComplete: "off",
1401 startAdornment: /*#__PURE__*/ react.default.createElement(_elementor_ui.InputAdornment, { position: "start" }, /*#__PURE__*/ react.default.createElement(_elementor_icons.SearchIcon, null))
1402 },
1403 placeholder: props.placeholder,
1404 name: props.name,
1405 value: props.value,
1406 onChange: props.onChange
1407 }, props, { inputRef: ref }));
1408 });
1409 SearchField.propTypes = {
1410 placeholder: import_prop_types$12.default.string,
1411 name: import_prop_types$12.default.string,
1412 value: import_prop_types$12.default.string,
1413 onChange: import_prop_types$12.default.func
1414 };
1415 }));
1416
1417 //#endregion
1418 //#region modules/ai/assets/js/editor/components/prompt-search.js
1419 var PromptSearch;
1420 var init_prompt_search = __esmMin((() => {
1421 init_extends();
1422 init_search_field();
1423 PromptSearch = (0, react.forwardRef)(function(props, ref) {
1424 return /*#__PURE__*/ react.default.createElement(SearchField, _extends$1({
1425 name: "prompt",
1426 placeholder: (0, _wordpress_i18n.__)("Describe the text and tone you want to use", "elementor") + "..."
1427 }, props, { ref }));
1428 });
1429 }));
1430
1431 //#endregion
1432 //#region modules/ai/assets/js/editor/components/textarea.js
1433 var import_prop_types$11, Textarea;
1434 var init_textarea = __esmMin((() => {
1435 init_extends();
1436 import_prop_types$11 = /* @__PURE__ */ __toESM(require_prop_types());
1437 Textarea = (0, react.forwardRef)(function(props, ref) {
1438 return /*#__PURE__*/ react.default.createElement(_elementor_ui.TextField, _extends$1({
1439 inputRef: ref,
1440 multiline: true,
1441 minRows: 4,
1442 maxRows: 20,
1443 color: "secondary"
1444 }, props));
1445 });
1446 Textarea.propTypes = {
1447 value: import_prop_types$11.default.string,
1448 onChange: import_prop_types$11.default.func,
1449 helperText: import_prop_types$11.default.string
1450 };
1451 }));
1452
1453 //#endregion
1454 //#region modules/ai/assets/js/editor/components/prompt-suggestions.js
1455 var import_prop_types$10, PromptSuggestions;
1456 var init_prompt_suggestions = __esmMin((() => {
1457 import_prop_types$10 = /* @__PURE__ */ __toESM(require_prop_types());
1458 PromptSuggestions = function PromptSuggestions(props) {
1459 var _props$suggestions;
1460 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
1461 variant: "subtitle1",
1462 color: "text.secondary"
1463 }, (0, _wordpress_i18n.__)("Suggested prompts", "elementor") + ":"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
1464 direction: "column",
1465 alignItems: "flex-start",
1466 gap: 1,
1467 sx: { my: 1 }
1468 }, (_props$suggestions = props.suggestions) === null || _props$suggestions === void 0 ? void 0 : _props$suggestions.map(function(option, index) {
1469 var _props$suggestionFilt;
1470 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, {
1471 key: index,
1472 variant: "outlined",
1473 size: "large",
1474 color: "secondary",
1475 label: ((_props$suggestionFilt = props.suggestionFilter) === null || _props$suggestionFilt === void 0 ? void 0 : _props$suggestionFilt.call(props, option)) || option,
1476 onClick: function onClick() {
1477 return props.onSelect(option);
1478 }
1479 });
1480 })), props.children);
1481 };
1482 PromptSuggestions.propTypes = {
1483 suggestions: import_prop_types$10.default.arrayOf(import_prop_types$10.default.string),
1484 onSelect: import_prop_types$10.default.func.isRequired,
1485 suggestionFilter: import_prop_types$10.default.func,
1486 children: import_prop_types$10.default.node
1487 };
1488 }));
1489
1490 //#endregion
1491 //#region modules/ai/assets/js/editor/components/prompt-library-link.js
1492 var import_prop_types$9, PromptLibraryLink;
1493 var init_prompt_library_link = __esmMin((() => {
1494 import_prop_types$9 = /* @__PURE__ */ __toESM(require_prop_types());
1495 PromptLibraryLink = function PromptLibraryLink(props) {
1496 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
1497 variant: "body2",
1498 color: "text.secondary"
1499 }, (0, _wordpress_i18n.__)("For more suggestions, explore our"), " ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, {
1500 href: props.libraryLink,
1501 className: "elementor-clickable",
1502 target: "_blank"
1503 }, (0, _wordpress_i18n.__)("prompt library")));
1504 };
1505 PromptLibraryLink.propTypes = { libraryLink: import_prop_types$9.default.string };
1506 }));
1507
1508 //#endregion
1509 //#region modules/ai/assets/js/editor/components/prompt-action-selection.js
1510 init_slicedToArray();
1511 init_asyncToGenerator();
1512 var import_regenerator$3 = /* @__PURE__ */ __toESM(require_regenerator());
1513 init_loader();
1514 init_prompt_search();
1515 init_textarea();
1516 init_prompt_suggestions();
1517 init_prompt_library_link();
1518 var import_prop_types$8 = /* @__PURE__ */ __toESM(require_prop_types());
1519 var labelToDashCash = function labelToDashCash(str) {
1520 return str.toLowerCase().replace(/ /g, "-");
1521 };
1522 var PromptActionSelection = function PromptActionSelection(props) {
1523 var actionId = labelToDashCash(props.label);
1524 var _props$wrapperStyle = props.wrapperStyle;
1525 var wrapperStyle = _props$wrapperStyle === void 0 ? { maxWidth: 138 } : _props$wrapperStyle;
1526 return /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, {
1527 size: "small",
1528 color: "secondary",
1529 fullWidth: true,
1530 sx: wrapperStyle
1531 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.InputLabel, { id: actionId }, props.label), /*#__PURE__*/ react.default.createElement(_elementor_ui.Select, {
1532 id: actionId,
1533 labelId: actionId,
1534 label: props.label,
1535 value: props.value || "",
1536 onChange: props.onChange,
1537 disabled: props.disabled,
1538 sx: { "&.Mui-disabled .MuiSelect-nativeInput": {
1539 backgroundColor: "initial",
1540 opacity: 0
1541 } }
1542 }, props.options.map(function(option) {
1543 var _option$value;
1544 return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, {
1545 dense: true,
1546 key: option.label,
1547 value: (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.label
1548 }, option.label);
1549 })));
1550 };
1551 PromptActionSelection.propTypes = {
1552 label: import_prop_types$8.default.string.isRequired,
1553 options: import_prop_types$8.default.arrayOf(import_prop_types$8.default.shape({
1554 label: import_prop_types$8.default.string.isRequired,
1555 value: import_prop_types$8.default.string
1556 })).isRequired,
1557 onChange: import_prop_types$8.default.func.isRequired,
1558 value: import_prop_types$8.default.string,
1559 wrapperStyle: import_prop_types$8.default.object,
1560 disabled: import_prop_types$8.default.bool
1561 };
1562
1563 //#endregion
1564 //#region modules/ai/assets/js/editor/components/generate-button.js
1565 var GenerateButton$1;
1566 var init_generate_button = __esmMin((() => {
1567 init_extends();
1568 GenerateButton$1 = function GenerateButton(props) {
1569 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
1570 variant: "contained",
1571 endIcon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { fontSize: "small" }),
1572 disabled: !prompt,
1573 "aria-label": (0, _wordpress_i18n.__)("search", "elementor"),
1574 type: "submit",
1575 size: "small"
1576 }, props));
1577 };
1578 }));
1579
1580 //#endregion
1581 //#region modules/ai/assets/js/editor/components/prompt-action.js
1582 init_generate_button();
1583 init_extends();
1584 var PromptAction = function PromptAction(props) {
1585 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, _extends$1({
1586 size: "large",
1587 color: "secondary",
1588 variant: "outlined"
1589 }, props));
1590 };
1591
1592 //#endregion
1593 //#region modules/ai/assets/js/editor/components/prompt-error-message.js
1594 var import_prop_types$7, _excluded$32, PromptErrorMessage;
1595 var init_prompt_error_message = __esmMin((() => {
1596 init_extends();
1597 init_objectWithoutProperties$1();
1598 import_prop_types$7 = /* @__PURE__ */ __toESM(require_prop_types());
1599 _excluded$32 = [
1600 "error",
1601 "onRetry",
1602 "actionPosition"
1603 ];
1604 PromptErrorMessage = function PromptErrorMessage(_ref) {
1605 var error = _ref.error;
1606 var _ref$onRetry = _ref.onRetry;
1607 var onRetry = _ref$onRetry === void 0 ? function() {} : _ref$onRetry;
1608 var _ref$actionPosition = _ref.actionPosition;
1609 var actionPosition = _ref$actionPosition === void 0 ? "default" : _ref$actionPosition;
1610 var props = _objectWithoutProperties$1(_ref, _excluded$32);
1611 function getQuotaReachedTrailMessage(featureName) {
1612 if (!featureName) return {
1613 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("It's time to upgrade.", "elementor")),
1614 description: (0, _wordpress_i18n.__)("Enjoy the free trial? Upgrade now for unlimited access to built-in image, text and custom code generators.", "elementor"),
1615 buttonText: (0, _wordpress_i18n.__)("Upgrade", "elementor"),
1616 buttonAction: function buttonAction() {
1617 return window.open("https://go.elementor.com/ai-popup-purchase-limit-reached/", "_blank");
1618 }
1619 };
1620 return {
1621 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("You've used all AI credits for %s.", "elementor"), featureName.toLowerCase())),
1622 description: (0, _wordpress_i18n.__)("Upgrade now to keep using this feature. You still have credits for other AI features (Text, Code, Images, Containers, etc.)", "elementor"),
1623 buttonText: (0, _wordpress_i18n.__)("Upgrade now", "elementor"),
1624 buttonAction: function buttonAction() {
1625 return window.open("https://go.elementor.com/ai-popup-purchase-limit-reached/", "_blank");
1626 }
1627 };
1628 }
1629 function getErrorMessage() {
1630 var _error$extra_data;
1631 var errMsg = error.message || error;
1632 var featureName = (_error$extra_data = error.extra_data) === null || _error$extra_data === void 0 ? void 0 : _error$extra_data.featureName;
1633 var messages = {
1634 default: {
1635 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")),
1636 description: (0, _wordpress_i18n.__)("Wait a moment and give it another go, or try tweaking the prompt.", "elementor"),
1637 buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"),
1638 buttonAction: onRetry
1639 },
1640 service_outage_internal: {
1641 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")),
1642 description: (0, _wordpress_i18n.__)("Wait a moment and give it another go.", "elementor"),
1643 buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"),
1644 buttonAction: onRetry
1645 },
1646 invalid_connect_data: {
1647 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")),
1648 description: /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, (0, _wordpress_i18n.__)("Try exiting Elementor and sign in again.", "elementor"), " ", /*#__PURE__*/ react.default.createElement("a", {
1649 href: "https://elementor.com/help/disconnecting-reconnecting-your-elementor-account/",
1650 target: "_blank",
1651 rel: "noreferrer"
1652 }, (0, _wordpress_i18n.__)("Show me how", "elementor"))),
1653 buttonText: (0, _wordpress_i18n.__)("Reconnect", "elementor"),
1654 buttonAction: function buttonAction() {
1655 return window.open(window.ElementorAiConfig.connect_url);
1656 }
1657 },
1658 not_connected: {
1659 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("You aren't connected to Elementor AI.", "elementor")),
1660 description: (0, _wordpress_i18n.__)("Elementor AI is just a few clicks away. Connect your account to instantly create texts and custom code.", "elementor"),
1661 buttonText: (0, _wordpress_i18n.__)("Connect", "elementor"),
1662 buttonAction: function buttonAction() {
1663 return window.open(window.ElementorAiConfig.connect_url);
1664 }
1665 },
1666 quota_reached_trail: getQuotaReachedTrailMessage(featureName),
1667 quota_reached_subscription: {
1668 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Looks like you're out of credits.", "elementor")),
1669 description: (0, _wordpress_i18n.__)("Ready to take it to the next level?", "elementor"),
1670 buttonText: (0, _wordpress_i18n.__)("Upgrade now", "elementor"),
1671 buttonAction: function buttonAction() {
1672 return window.open("https://go.elementor.com/ai-popup-purchase-limit-reached/", "_blank");
1673 }
1674 },
1675 rate_limit_network: {
1676 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Whoa! Slow down there.", "elementor")),
1677 description: (0, _wordpress_i18n.__)("We can’t process that many requests so fast. Try again in 15 minutes.", "elementor")
1678 },
1679 invalid_prompts: {
1680 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("We were unable to generate that prompt.", "elementor")),
1681 description: (0, _wordpress_i18n.__)("Seems like the prompt contains words that could generate harmful content. Write a different prompt to continue.", "elementor")
1682 },
1683 service_unavailable: {
1684 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")),
1685 description: (0, _wordpress_i18n.__)("Wait a moment and give it another go, or try tweaking the prompt.", "elementor"),
1686 buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"),
1687 buttonAction: onRetry
1688 },
1689 request_timeout_error: {
1690 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("There was a glitch.", "elementor")),
1691 description: (0, _wordpress_i18n.__)("Wait a moment and give it another go, or try tweaking the prompt.", "elementor"),
1692 buttonText: (0, _wordpress_i18n.__)("Try again", "elementor"),
1693 buttonAction: onRetry
1694 },
1695 invalid_token: {
1696 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Try again", "elementor")),
1697 description: (0, _wordpress_i18n.__)("Try exiting Elementor and sign in again.", "elementor"),
1698 buttonText: (0, _wordpress_i18n.__)("Reconnect", "elementor"),
1699 buttonAction: onRetry
1700 },
1701 file_too_large: {
1702 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("The file is too large.", "elementor")),
1703 description: (0, _wordpress_i18n.__)("Please upload a file that is less than 4MB.", "elementor")
1704 },
1705 image_resolution_maximum_exceeded: {
1706 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("The image resolution exceeds the maximum allowed size.", "elementor")),
1707 description: (0, _wordpress_i18n.__)("Please upload a file with dimensions less than 2048x2048 pixels.", "elementor")
1708 },
1709 external_service_unavailable: {
1710 text: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Temporary external service issue", "elementor")),
1711 description: (0, _wordpress_i18n.__)("It seems that one of our partner services is temporarily unavailable. Please try again in a few minutes.", "elementor"),
1712 buttonText: (0, _wordpress_i18n.__)("Try Again", "elementor"),
1713 buttonAction: onRetry
1714 }
1715 };
1716 return messages[errMsg] || messages.default;
1717 }
1718 var message = getErrorMessage();
1719 var action = (message === null || message === void 0 ? void 0 : message.buttonText) && /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
1720 color: "inherit",
1721 size: "small",
1722 variant: "outlined",
1723 onClick: message.buttonAction
1724 }, message.buttonText);
1725 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, _extends$1({
1726 severity: message.severity || "error",
1727 action: "default" === actionPosition && action
1728 }, props), message.text, message.description, "bottom" === actionPosition && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { mt: 1 } }, action));
1729 };
1730 PromptErrorMessage.propTypes = {
1731 error: import_prop_types$7.default.oneOfType([import_prop_types$7.default.object, import_prop_types$7.default.string]),
1732 onRetry: import_prop_types$7.default.func,
1733 actionPosition: import_prop_types$7.default.oneOf(["default", "bottom"])
1734 };
1735 }));
1736
1737 //#endregion
1738 //#region modules/ai/assets/js/editor/api/index.js
1739 function ownKeys$31(e, r) {
1740 var t = Object.keys(e);
1741 if (Object.getOwnPropertySymbols) {
1742 var o = Object.getOwnPropertySymbols(e);
1743 r && (o = o.filter(function(r) {
1744 return Object.getOwnPropertyDescriptor(e, r).enumerable;
1745 })), t.push.apply(t, o);
1746 }
1747 return t;
1748 }
1749 function _objectSpread$30(e) {
1750 for (var r = 1; r < arguments.length; r++) {
1751 var t = null != arguments[r] ? arguments[r] : {};
1752 r % 2 ? ownKeys$31(Object(t), !0).forEach(function(r) {
1753 _defineProperty$1(e, r, t[r]);
1754 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$31(Object(t)).forEach(function(r) {
1755 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
1756 });
1757 }
1758 return e;
1759 }
1760 var request, getUserInformation, getRemoteConfig, getCompletionText, getEditText, getCustomCode, getCustomCSS, setGetStarted, setStatusFeedback, getTextToImageGeneration, getImageToImageGeneration, getImageToImageMaskCleanup, getImageToImageMaskGeneration, getImageToImageOutPainting, getImageToImageUpscale, getImageToImageRemoveBackground, getImageToImageIsolateObjects, getImageToImageReplaceBackground, getImagePromptEnhanced, getProductImageUnification, getAnimation, uploadImage, generateLayout, getLayoutPromptEnhanced, getHistory, deleteHistoryItem;
1761 var init_api = __esmMin((() => {
1762 init_defineProperty$1();
1763 __name(ownKeys$31, "ownKeys");
1764 __name(_objectSpread$30, "_objectSpread");
1765 request = function request(endpoint) {
1766 var data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1767 var immediately = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
1768 var signal = arguments.length > 3 ? arguments[3] : void 0;
1769 if (Object.keys(data).length) if (window.elementorAiCurrentContext) data.context = window.elementorAiCurrentContext;
1770 else data.context = window.elementorWpAiCurrentContext;
1771 return new Promise(function(resolve, reject) {
1772 var ajaxData = elementorCommon.ajax.addRequest(endpoint, {
1773 success: resolve,
1774 error: reject,
1775 data,
1776 unique_id: data.unique_id
1777 }, immediately);
1778 if (signal && ajaxData.jqXhr) signal.addEventListener("abort", ajaxData.jqXhr.abort);
1779 });
1780 };
1781 getUserInformation = function getUserInformation(immediately) {
1782 return request("ai_get_user_information", void 0, immediately);
1783 };
1784 getRemoteConfig = function getRemoteConfig() {
1785 return request("ai_get_remote_config");
1786 };
1787 getCompletionText = function getCompletionText(payload) {
1788 return request("ai_get_completion_text", { payload });
1789 };
1790 getEditText = function getEditText(payload) {
1791 return request("ai_get_edit_text", { payload });
1792 };
1793 getCustomCode = function getCustomCode(payload) {
1794 return request("ai_get_custom_code", { payload });
1795 };
1796 getCustomCSS = function getCustomCSS(payload) {
1797 return request("ai_get_custom_css", { payload });
1798 };
1799 setGetStarted = function setGetStarted() {
1800 return request("ai_set_get_started");
1801 };
1802 setStatusFeedback = function setStatusFeedback(responseId) {
1803 return request("ai_set_status_feedback", { response_id: responseId }, true);
1804 };
1805 getTextToImageGeneration = function getTextToImageGeneration(payload) {
1806 return request("ai_get_text_to_image", { payload });
1807 };
1808 getImageToImageGeneration = function getImageToImageGeneration(payload) {
1809 return request("ai_get_image_to_image", { payload });
1810 };
1811 getImageToImageMaskCleanup = function getImageToImageMaskCleanup(payload) {
1812 return request("ai_get_image_to_image_mask_cleanup", { payload });
1813 };
1814 getImageToImageMaskGeneration = function getImageToImageMaskGeneration(payload) {
1815 return request("ai_get_image_to_image_mask", { payload });
1816 };
1817 getImageToImageOutPainting = function getImageToImageOutPainting(payload) {
1818 return request("ai_get_image_to_image_outpainting", { payload });
1819 };
1820 getImageToImageUpscale = function getImageToImageUpscale(payload) {
1821 return request("ai_get_image_to_image_upscale", { payload });
1822 };
1823 getImageToImageRemoveBackground = function getImageToImageRemoveBackground(payload) {
1824 return request("ai_get_image_to_image_remove_background", { payload });
1825 };
1826 getImageToImageIsolateObjects = function getImageToImageIsolateObjects(payload) {
1827 return request("ai_get_image_to_image_isolate_objects", { payload });
1828 };
1829 getImageToImageReplaceBackground = function getImageToImageReplaceBackground(payload) {
1830 return request("ai_get_image_to_image_replace_background", { payload });
1831 };
1832 getImagePromptEnhanced = function getImagePromptEnhanced(prompt) {
1833 return request("ai_get_image_prompt_enhancer", { prompt });
1834 };
1835 getProductImageUnification = function getProductImageUnification(payload, immediately) {
1836 return request("ai_get_product_image_unification", { payload }, immediately);
1837 };
1838 getAnimation = function getAnimation(payload) {
1839 return request("ai_get_animation", { payload });
1840 };
1841 uploadImage = function uploadImage(image) {
1842 return request("ai_upload_image", _objectSpread$30(_objectSpread$30({}, image), {}, {
1843 editor_post_id: image.image.editor_post_id,
1844 unique_id: image.image.unique_id
1845 }));
1846 };
1847 generateLayout = function generateLayout(requestBody, signal) {
1848 return request("ai_generate_layout", requestBody, true, signal);
1849 };
1850 getLayoutPromptEnhanced = function getLayoutPromptEnhanced(prompt, enhanceType) {
1851 return request("ai_get_layout_prompt_enhancer", {
1852 prompt,
1853 enhance_type: enhanceType
1854 });
1855 };
1856 getHistory = function getHistory(type, page, limit) {
1857 return request("ai_get_history", {
1858 type,
1859 page,
1860 limit
1861 });
1862 };
1863 deleteHistoryItem = function deleteHistoryItem(id) {
1864 return request("ai_delete_history_item", { id });
1865 };
1866 }));
1867
1868 //#endregion
1869 //#region modules/ai/assets/js/editor/context/requests-ids.js
1870 var import_prop_types$6, Context, useRequestIds, getUniqueId, RequestIdsProvider;
1871 var init_requests_ids = __esmMin((() => {
1872 import_prop_types$6 = /* @__PURE__ */ __toESM(require_prop_types());
1873 Context = (0, react.createContext)({});
1874 useRequestIds = function useRequestIds() {
1875 var context = (0, react.useContext)(Context);
1876 if (!context) throw new Error("useRequestIds must be used within a RequestIdsProvider");
1877 return context;
1878 };
1879 getUniqueId = function getUniqueId(prefix) {
1880 return prefix + "-" + Math.random().toString(16).substr(2, 7);
1881 };
1882 window.EDITOR_SESSION_ID = window.EDITOR_SESSION_ID || getUniqueId("editor-session");
1883 RequestIdsProvider = function RequestIdsProvider(props) {
1884 var editorSessionId = (0, react.useRef)(window.EDITOR_SESSION_ID);
1885 var sessionId = (0, react.useRef)("");
1886 var generateId = (0, react.useRef)("");
1887 var batchId = (0, react.useRef)("");
1888 var requestId = (0, react.useRef)("");
1889 sessionId.current = getUniqueId("session");
1890 var setGenerate = function setGenerate() {
1891 generateId.current = getUniqueId("generate");
1892 return generateId;
1893 };
1894 var setBatch = function setBatch() {
1895 batchId.current = getUniqueId("batch");
1896 return batchId;
1897 };
1898 var setRequest = function setRequest() {
1899 requestId.current = getUniqueId("request");
1900 return requestId;
1901 };
1902 var _useState2 = _slicedToArray((0, react.useState)(0), 2);
1903 var usagePercentage = _useState2[0];
1904 var setUsagePercentage = _useState2[1];
1905 return /*#__PURE__*/ react.default.createElement(Context.Provider, { value: {
1906 editorSessionId,
1907 sessionId,
1908 generateId,
1909 batchId,
1910 requestId,
1911 setGenerate,
1912 setBatch,
1913 setRequest,
1914 usagePercentage,
1915 updateUsagePercentage: function updateUsagePercentage(newPercentage) {
1916 setUsagePercentage(newPercentage);
1917 }
1918 } }, props.children);
1919 };
1920 RequestIdsProvider.propTypes = { children: import_prop_types$6.default.node.isRequired };
1921 }));
1922
1923 //#endregion
1924 //#region modules/ai/assets/js/editor/hooks/use-prompt.js
1925 function ownKeys$30(e, r) {
1926 var t = Object.keys(e);
1927 if (Object.getOwnPropertySymbols) {
1928 var o = Object.getOwnPropertySymbols(e);
1929 r && (o = o.filter(function(r) {
1930 return Object.getOwnPropertyDescriptor(e, r).enumerable;
1931 })), t.push.apply(t, o);
1932 }
1933 return t;
1934 }
1935 function _objectSpread$29(e) {
1936 for (var r = 1; r < arguments.length; r++) {
1937 var t = null != arguments[r] ? arguments[r] : {};
1938 r % 2 ? ownKeys$30(Object(t), !0).forEach(function(r) {
1939 _defineProperty$1(e, r, t[r]);
1940 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$30(Object(t)).forEach(function(r) {
1941 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
1942 });
1943 }
1944 return e;
1945 }
1946 var _excluded$31, normalizeResponse, usePrompt;
1947 var init_use_prompt = __esmMin((() => {
1948 init_defineProperty$1();
1949 init_slicedToArray();
1950 init_objectWithoutProperties$1();
1951 init_api();
1952 init_requests_ids();
1953 _excluded$31 = [
1954 "text",
1955 "response_id",
1956 "usage",
1957 "images"
1958 ];
1959 __name(ownKeys$30, "ownKeys");
1960 __name(_objectSpread$29, "_objectSpread");
1961 normalizeResponse = function normalizeResponse(_ref) {
1962 var text = _ref.text;
1963 var responseId = _ref.response_id;
1964 var usage = _ref.usage;
1965 var images = _ref.images;
1966 var optional = _objectWithoutProperties$1(_ref, _excluded$31);
1967 var creditsData = usage ? usage.quota - usage.usedQuota : 0;
1968 var normalized = {
1969 result: text || images,
1970 responseId,
1971 credits: Math.max(creditsData, 0),
1972 usagePercentage: usage === null || usage === void 0 ? void 0 : usage.usagePercentage
1973 };
1974 if (optional.base_template_id) normalized.baseTemplateId = optional.base_template_id;
1975 normalized.type = optional.template_type;
1976 return normalized;
1977 };
1978 usePrompt = function usePrompt(fetchData, initialState) {
1979 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
1980 var isLoading = _useState2[0];
1981 var setIsLoading = _useState2[1];
1982 var _useState4 = _slicedToArray((0, react.useState)(""), 2);
1983 var error = _useState4[0];
1984 var setError = _useState4[1];
1985 var _useState6 = _slicedToArray((0, react.useState)(initialState), 2);
1986 var data = _useState6[0];
1987 var setData = _useState6[1];
1988 var _useRequestIds = useRequestIds();
1989 var updateUsagePercentage = _useRequestIds.updateUsagePercentage;
1990 var usagePercentage = _useRequestIds.usagePercentage;
1991 var send = (0, react.useRef)(/*#__PURE__*/ function() {
1992 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$3.default.mark(function _callee(payload) {
1993 return import_regenerator$3.default.wrap(function(_context) {
1994 while (1) switch (_context.prev = _context.next) {
1995 case 0: return _context.abrupt("return", payload);
1996 case 1:
1997 case "end": return _context.stop();
1998 }
1999 }, _callee);
2000 }));
2001 return function(_x) {
2002 return _ref2.apply(this, arguments);
2003 };
2004 }());
2005 var sendUsageData = (0, react.useRef)(function() {});
2006 (0, react.useEffect)(function() {
2007 var newUsageValue = data === null || data === void 0 ? void 0 : data.usagePercentage;
2008 if (newUsageValue && newUsageValue !== usagePercentage) updateUsagePercentage(newUsageValue);
2009 }, [
2010 data,
2011 usagePercentage,
2012 updateUsagePercentage
2013 ]);
2014 var _useRequestIds2 = useRequestIds();
2015 var setRequest = _useRequestIds2.setRequest;
2016 var editorSessionId = _useRequestIds2.editorSessionId;
2017 var sessionId = _useRequestIds2.sessionId;
2018 var generateId = _useRequestIds2.generateId;
2019 var batchId = _useRequestIds2.batchId;
2020 send.current = (0, react.useCallback)(/*#__PURE__*/ function() {
2021 var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$3.default.mark(function _callee2(payload) {
2022 return import_regenerator$3.default.wrap(function(_context2) {
2023 while (1) switch (_context2.prev = _context2.next) {
2024 case 0: return _context2.abrupt("return", new Promise(function(resolve, reject) {
2025 setError("");
2026 setIsLoading(true);
2027 var requestId = setRequest();
2028 var requestIds = {
2029 editorSessionId: editorSessionId.current,
2030 sessionId: sessionId.current,
2031 generateId: generateId.current,
2032 batchId: batchId.current,
2033 requestId: requestId.current
2034 };
2035 payload = _objectSpread$29(_objectSpread$29({}, payload), {}, { requestIds });
2036 fetchData(payload).then(function(result) {
2037 var normalizedData = normalizeResponse(result);
2038 setData(normalizedData);
2039 resolve(normalizedData);
2040 }).catch(function(err) {
2041 var finalError = (err === null || err === void 0 ? void 0 : err.responseText) || err;
2042 setError(finalError);
2043 reject(finalError);
2044 }).finally(function() {
2045 return setIsLoading(false);
2046 });
2047 }));
2048 case 1:
2049 case "end": return _context2.stop();
2050 }
2051 }, _callee2);
2052 }));
2053 return function(_x2) {
2054 return _ref3.apply(this, arguments);
2055 };
2056 }(), [
2057 batchId,
2058 editorSessionId,
2059 fetchData,
2060 generateId,
2061 sessionId,
2062 setRequest
2063 ]);
2064 sendUsageData.current = (0, react.useCallback)(function() {
2065 var usageData = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : data;
2066 return usageData.responseId && setStatusFeedback(usageData.responseId);
2067 }, [data]);
2068 return {
2069 isLoading,
2070 error,
2071 data,
2072 setResult: function setResult(result) {
2073 var responseId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
2074 var updatedResult = _objectSpread$29({}, data);
2075 updatedResult.result = result;
2076 if (responseId) updatedResult.responseId = responseId;
2077 setData(updatedResult);
2078 },
2079 reset: function reset() {
2080 setData(function(_ref4) {
2081 return {
2082 credits: _ref4.credits,
2083 result: "",
2084 responseId: ""
2085 };
2086 });
2087 setError("");
2088 setIsLoading(false);
2089 },
2090 send: send.current,
2091 sendUsageData: sendUsageData.current
2092 };
2093 };
2094 }));
2095
2096 //#endregion
2097 //#region modules/ai/assets/js/editor/hooks/use-text-prompt.js
2098 init_prompt_error_message();
2099 init_asyncToGenerator();
2100 var import_regenerator$2 = /* @__PURE__ */ __toESM(require_regenerator());
2101 init_api();
2102 init_use_prompt();
2103 var getTextResult = /*#__PURE__*/ function() {
2104 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(payload) {
2105 return import_regenerator$2.default.wrap(function(_context) {
2106 while (1) switch (_context.prev = _context.next) {
2107 case 0:
2108 if (!(payload !== null && payload !== void 0 && payload.instruction)) {
2109 _context.next = 1;
2110 break;
2111 }
2112 return _context.abrupt("return", getEditText(payload));
2113 case 1: return _context.abrupt("return", getCompletionText(payload));
2114 case 2:
2115 case "end": return _context.stop();
2116 }
2117 }, _callee);
2118 }));
2119 return function getTextResult(_x) {
2120 return _ref.apply(this, arguments);
2121 };
2122 }();
2123 var useTextPrompt = function useTextPrompt(initialValue) {
2124 return usePrompt(getTextResult, initialValue);
2125 };
2126
2127 //#endregion
2128 //#region modules/ai/assets/js/editor/actions-data.js
2129 var textAutocomplete, textareaAutocomplete, codeHtmlAutocomplete, codeCssAutocomplete, vocalTones, translateLanguages, motionEffectAutocomplete, hoverEffectAutocomplete;
2130 var init_actions_data = __esmMin((() => {
2131 textAutocomplete = [
2132 (0, _wordpress_i18n.__)("Craft a catchy slogan for", "elementor"),
2133 (0, _wordpress_i18n.__)("Write a strong section header for", "elementor"),
2134 (0, _wordpress_i18n.__)("Create a blog title for", "elementor"),
2135 (0, _wordpress_i18n.__)("Suggest a 4 word headline for", "elementor"),
2136 (0, _wordpress_i18n.__)("Write an attention grabbing title for", "elementor")
2137 ];
2138 textareaAutocomplete = [
2139 (0, _wordpress_i18n.__)("Write a product description for", "elementor"),
2140 (0, _wordpress_i18n.__)("Create a blog post for", "elementor"),
2141 (0, _wordpress_i18n.__)("Craft an about us section for", "elementor"),
2142 (0, _wordpress_i18n.__)("Offer a few sentences to invite visitors to", "elementor"),
2143 (0, _wordpress_i18n.__)("Write microcopy for a submission form that includes", "elementor")
2144 ];
2145 codeHtmlAutocomplete = [
2146 (0, _wordpress_i18n.__)("GA event fired on every button element click (assume GA was loaded)", "elementor"),
2147 (0, _wordpress_i18n.__)("Iframe code to embed a Spotify widget on my web page. My ID is 1234567890", "elementor"),
2148 (0, _wordpress_i18n.__)("Write an embed code of Google Analytics", "elementor"),
2149 (0, _wordpress_i18n.__)("Write an embed code of Facebook Pixel", "elementor"),
2150 (0, _wordpress_i18n.__)("HTML code that embeds the following PDF into a webpage: link to PDF", "elementor")
2151 ];
2152 codeCssAutocomplete = [
2153 (0, _wordpress_i18n.__)("On hover, animate 20% bigger, rotate 10 deg CCW", "elementor"),
2154 (0, _wordpress_i18n.__)("Add a circle-shaped clip mask, semi transparent on hover", "elementor"),
2155 (0, _wordpress_i18n.__)("Rainbow colored animated text gradient", "elementor"),
2156 (0, _wordpress_i18n.__)("Add a 3D shadow to the text", "elementor")
2157 ];
2158 vocalTones = [
2159 { label: (0, _wordpress_i18n.__)("Casual", "elementor") },
2160 { label: (0, _wordpress_i18n.__)("Confidence", "elementor") },
2161 { label: (0, _wordpress_i18n.__)("Formal", "elementor") },
2162 { label: (0, _wordpress_i18n.__)("Friendly", "elementor") },
2163 { label: (0, _wordpress_i18n.__)("Inspirational", "elementor") },
2164 { label: (0, _wordpress_i18n.__)("Motivational", "elementor") },
2165 { label: (0, _wordpress_i18n.__)("Nostalgic", "elementor") },
2166 { label: (0, _wordpress_i18n.__)("Playful", "elementor") },
2167 { label: (0, _wordpress_i18n.__)("Professional", "elementor") },
2168 { label: (0, _wordpress_i18n.__)("Scientific", "elementor") },
2169 { label: (0, _wordpress_i18n.__)("Straightforward", "elementor") },
2170 { label: (0, _wordpress_i18n.__)("Witty", "elementor") }
2171 ];
2172 translateLanguages = [
2173 {
2174 label: (0, _wordpress_i18n.__)("Arabic", "elementor"),
2175 value: "ar-SA"
2176 },
2177 {
2178 label: (0, _wordpress_i18n.__)("Chinese", "elementor"),
2179 value: "zh-CN"
2180 },
2181 {
2182 label: (0, _wordpress_i18n.__)("Czech", "elementor"),
2183 value: "cs-CZ"
2184 },
2185 {
2186 label: (0, _wordpress_i18n.__)("Danish", "elementor"),
2187 value: "da-DK"
2188 },
2189 {
2190 label: (0, _wordpress_i18n.__)("Dutch", "elementor"),
2191 value: "nl-NL"
2192 },
2193 {
2194 label: (0, _wordpress_i18n.__)("English", "elementor"),
2195 value: "en-US"
2196 },
2197 {
2198 label: (0, _wordpress_i18n.__)("Finnish", "elementor"),
2199 value: "fi-FI"
2200 },
2201 {
2202 label: (0, _wordpress_i18n.__)("French", "elementor"),
2203 value: "fr-FR"
2204 },
2205 {
2206 label: (0, _wordpress_i18n.__)("German", "elementor"),
2207 value: "de-DE"
2208 },
2209 {
2210 label: (0, _wordpress_i18n.__)("Greek", "elementor"),
2211 value: "el-GR"
2212 },
2213 {
2214 label: (0, _wordpress_i18n.__)("Hebrew", "elementor"),
2215 value: "he-IL"
2216 },
2217 {
2218 label: (0, _wordpress_i18n.__)("Hungarian", "elementor"),
2219 value: "hu-HU"
2220 },
2221 {
2222 label: (0, _wordpress_i18n.__)("Indonesian", "elementor"),
2223 value: "id-ID"
2224 },
2225 {
2226 label: (0, _wordpress_i18n.__)("Italian", "elementor"),
2227 value: "it-IT"
2228 },
2229 {
2230 label: (0, _wordpress_i18n.__)("Japanese", "elementor"),
2231 value: "ja-JP"
2232 },
2233 {
2234 label: (0, _wordpress_i18n.__)("Korean", "elementor"),
2235 value: "ko-KR"
2236 },
2237 {
2238 label: (0, _wordpress_i18n.__)("Persian", "elementor"),
2239 value: "fa-IR"
2240 },
2241 {
2242 label: (0, _wordpress_i18n.__)("Polish", "elementor"),
2243 value: "pl-PL"
2244 },
2245 {
2246 label: (0, _wordpress_i18n.__)("Portuguese", "elementor"),
2247 value: "pt-PT"
2248 },
2249 {
2250 label: (0, _wordpress_i18n.__)("Russian", "elementor"),
2251 value: "ru-RU"
2252 },
2253 {
2254 label: (0, _wordpress_i18n.__)("Spanish", "elementor"),
2255 value: "es-ES"
2256 },
2257 {
2258 label: (0, _wordpress_i18n.__)("Swedish", "elementor"),
2259 value: "sv-SE"
2260 },
2261 {
2262 label: (0, _wordpress_i18n.__)("Thai", "elementor"),
2263 value: "th-TH"
2264 },
2265 {
2266 label: (0, _wordpress_i18n.__)("Turkish", "elementor"),
2267 value: "tr-TR"
2268 },
2269 {
2270 label: (0, _wordpress_i18n.__)("Vietnamese", "elementor"),
2271 value: "vi-VN"
2272 }
2273 ];
2274 motionEffectAutocomplete = [
2275 (0, _wordpress_i18n.__)("Create Fade out animation on scroll", "elementor"),
2276 (0, _wordpress_i18n.__)("Create a Parallax effect on scroll", "elementor"),
2277 (0, _wordpress_i18n.__)("On scroll, fade in with slight scaling up", "elementor"),
2278 (0, _wordpress_i18n.__)("Move and tilt opposite to mouse position", "elementor"),
2279 (0, _wordpress_i18n.__)("Slide in from the left on load", "elementor")
2280 ];
2281 hoverEffectAutocomplete = [
2282 (0, _wordpress_i18n.__)("Move down on hover", "elementor"),
2283 (0, _wordpress_i18n.__)("Slightly shift right on hover", "elementor"),
2284 (0, _wordpress_i18n.__)("Apply a subtle 3D tilt", "elementor"),
2285 (0, _wordpress_i18n.__)("Rotate gently clockwise on hover", "elementor"),
2286 (0, _wordpress_i18n.__)("Scale down and move up on hover", "elementor")
2287 ];
2288 }));
2289
2290 //#endregion
2291 //#region modules/ai/assets/js/editor/components/prompt-history/history-types.js
2292 var HISTORY_TYPES, TRANSLATED_HISTORY_TYPES_FALLBACK, TRANSLATED_HISTORY_TYPES, getTranslatedPromptHistoryType;
2293 var init_history_types = __esmMin((() => {
2294 init_defineProperty$1();
2295 HISTORY_TYPES = Object.freeze({
2296 ALL: "all",
2297 TEXT: "text",
2298 CODE: "code",
2299 IMAGE: "images",
2300 BLOCK: "blocks"
2301 });
2302 TRANSLATED_HISTORY_TYPES_FALLBACK = (0, _wordpress_i18n.__)("things", "elementor");
2303 TRANSLATED_HISTORY_TYPES = Object.freeze(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, HISTORY_TYPES.TEXT, (0, _wordpress_i18n.__)("texts", "elementor")), HISTORY_TYPES.CODE, (0, _wordpress_i18n.__)("code", "elementor")), HISTORY_TYPES.IMAGE, (0, _wordpress_i18n.__)("images", "elementor")), HISTORY_TYPES.BLOCK, (0, _wordpress_i18n.__)("blocks", "elementor")));
2304 getTranslatedPromptHistoryType = function getTranslatedPromptHistoryType(historyType) {
2305 if (TRANSLATED_HISTORY_TYPES[historyType]) return TRANSLATED_HISTORY_TYPES[historyType];
2306 return TRANSLATED_HISTORY_TYPES_FALLBACK;
2307 };
2308 }));
2309
2310 //#endregion
2311 //#region modules/ai/assets/js/editor/helpers/index.js
2312 var vh;
2313 var init_helpers = __esmMin((() => {
2314 vh = function vh(value) {
2315 return value * Math.max(document.documentElement.clientHeight, window.innerHeight || 0) / 100;
2316 };
2317 }));
2318
2319 //#endregion
2320 //#region modules/ai/assets/js/editor/components/prompt-history/context/prompt-history-context.js
2321 var import_prop_types$5, PromptHistoryContext, DIALOG_CONTAINER_SELECTOR, getContainer, getContainerHeight, getContentHeight, setContentHeight, PromptHistoryProvider, usePromptHistoryContext;
2322 var init_prompt_history_context = __esmMin((() => {
2323 init_slicedToArray();
2324 import_prop_types$5 = /* @__PURE__ */ __toESM(require_prop_types());
2325 init_history_types();
2326 init_helpers();
2327 PromptHistoryContext = (0, react.createContext)({});
2328 DIALOG_CONTAINER_SELECTOR = ".e-ai-dialog-content";
2329 getContainer = function getContainer() {
2330 return document.querySelector(DIALOG_CONTAINER_SELECTOR);
2331 };
2332 getContainerHeight = function getContainerHeight() {
2333 var contentContainer = document.querySelector(DIALOG_CONTAINER_SELECTOR);
2334 return contentContainer === null || contentContainer === void 0 ? void 0 : contentContainer.clientHeight;
2335 };
2336 getContentHeight = function getContentHeight() {
2337 return document.querySelector(DIALOG_CONTAINER_SELECTOR).children[0].clientHeight + 50;
2338 };
2339 setContentHeight = function setContentHeight(height) {
2340 var contentContainer = document.querySelector(DIALOG_CONTAINER_SELECTOR);
2341 if ("auto" === height) {
2342 contentContainer.style.height = "auto";
2343 return;
2344 }
2345 contentContainer.style.height = "".concat(height, "px");
2346 };
2347 PromptHistoryProvider = function PromptHistoryProvider(_ref) {
2348 var historyType = _ref.historyType;
2349 var children = _ref.children;
2350 var showHistoryState = (0, react.useState)(false);
2351 return /*#__PURE__*/ react.default.createElement(PromptHistoryContext.Provider, { value: {
2352 historyType,
2353 showHistoryState
2354 } }, children);
2355 };
2356 PromptHistoryProvider.propTypes = {
2357 historyType: import_prop_types$5.default.oneOf(Object.values(HISTORY_TYPES)).isRequired,
2358 children: import_prop_types$5.default.node
2359 };
2360 usePromptHistoryContext = function usePromptHistoryContext() {
2361 var _useContext = (0, react.useContext)(PromptHistoryContext);
2362 var historyType = _useContext.historyType;
2363 var showHistoryState = _useContext.showHistoryState;
2364 var _showHistoryState = _slicedToArray(showHistoryState, 2);
2365 var showHistory = _showHistoryState[0];
2366 var setShowHistory = _showHistoryState[1];
2367 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
2368 var showModalWrapper = _useState2[0];
2369 var setShowModalWrapper = _useState2[1];
2370 var _useState4 = _slicedToArray((0, react.useState)(false), 2);
2371 var showPromptHistory = _useState4[0];
2372 var setShowPromptHistory = _useState4[1];
2373 var handleFullScreenHistoryState = function handleFullScreenHistoryState() {
2374 if (showHistory) {
2375 setShowModalWrapper(true);
2376 setTimeout(function() {
2377 return setShowPromptHistory(true);
2378 }, 200);
2379 return;
2380 }
2381 setShowPromptHistory(false);
2382 setTimeout(function() {
2383 return setShowModalWrapper(false);
2384 }, 500);
2385 };
2386 var handleDefaultHistoryState = function handleDefaultHistoryState() {
2387 if (showHistory) {
2388 var currentHeight = getContentHeight();
2389 setContentHeight(currentHeight);
2390 setTimeout(function() {
2391 if (currentHeight < vh(61)) {
2392 setContentHeight(vh(61));
2393 setTimeout(function() {
2394 return setShowModalWrapper(true);
2395 }, 200);
2396 setTimeout(function() {
2397 return setShowPromptHistory(true);
2398 }, 300);
2399 return;
2400 }
2401 setShowModalWrapper(true);
2402 setShowPromptHistory(true);
2403 }, 20);
2404 return;
2405 }
2406 setShowPromptHistory(false);
2407 setTimeout(function() {
2408 setShowModalWrapper(false);
2409 setContentHeight(getContentHeight());
2410 setTimeout(function() {
2411 return setContentHeight("auto");
2412 }, 300);
2413 }, 500);
2414 };
2415 (0, react.useEffect)(function() {
2416 if (showHistory === showModalWrapper && showHistory === showPromptHistory) return;
2417 if (historyType === HISTORY_TYPES.IMAGE) return handleFullScreenHistoryState();
2418 handleDefaultHistoryState();
2419 }, [showHistory]);
2420 return {
2421 historyType,
2422 isOpen: showPromptHistory,
2423 isModalOpen: showModalWrapper,
2424 showHistory,
2425 onOpen: function onOpen() {
2426 setShowHistory(true);
2427 },
2428 onClose: function onClose() {
2429 setShowHistory(false);
2430 },
2431 getContainer,
2432 getContainerHeight
2433 };
2434 };
2435 }));
2436
2437 //#endregion
2438 //#region modules/ai/assets/js/editor/components/prompt-history/context/prompt-history-action-context.js
2439 function _createForOfIteratorHelper$1(r, e) {
2440 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2441 if (!t) {
2442 if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) {
2443 t && (r = t);
2444 var _n = 0;
2445 var F = function F() {};
2446 return {
2447 s: F,
2448 n: function n() {
2449 return _n >= r.length ? { done: !0 } : {
2450 done: !1,
2451 value: r[_n++]
2452 };
2453 },
2454 e: function e(r) {
2455 throw r;
2456 },
2457 f: F
2458 };
2459 }
2460 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2461 }
2462 var o;
2463 var a = !0;
2464 var u = !1;
2465 return {
2466 s: function s() {
2467 t = t.call(r);
2468 },
2469 n: function n() {
2470 var r = t.next();
2471 return a = r.done, r;
2472 },
2473 e: function e(r) {
2474 u = !0, o = r;
2475 },
2476 f: function f() {
2477 try {
2478 a || null == t.return || t.return();
2479 } finally {
2480 if (u) throw o;
2481 }
2482 }
2483 };
2484 }
2485 function _unsupportedIterableToArray$1(r, a) {
2486 if (r) {
2487 if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
2488 var t = {}.toString.call(r).slice(8, -1);
2489 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
2490 }
2491 }
2492 function _arrayLikeToArray$1(r, a) {
2493 (null == a || a > r.length) && (a = r.length);
2494 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2495 return n;
2496 }
2497 var import_prop_types$4, PromptHistoryActionContext, initialActionValue, ACTION_TYPES, ENABLED_ACTIONS_BY_TYPE, PromptHistoryActionProvider, usePromptHistoryAction, useSubscribeOnPromptHistoryAction;
2498 var init_prompt_history_action_context = __esmMin((() => {
2499 init_slicedToArray();
2500 init_defineProperty$1();
2501 import_prop_types$4 = /* @__PURE__ */ __toESM(require_prop_types());
2502 init_history_types();
2503 init_prompt_history_context();
2504 __name(_createForOfIteratorHelper$1, "_createForOfIteratorHelper");
2505 __name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray");
2506 __name(_arrayLikeToArray$1, "_arrayLikeToArray");
2507 PromptHistoryActionContext = (0, react.createContext)({});
2508 initialActionValue = {
2509 type: "",
2510 id: "",
2511 data: null
2512 };
2513 ACTION_TYPES = Object.freeze({
2514 REUSE: "reuse",
2515 EDIT: "edit",
2516 RESTORE: "restore",
2517 REMOVE: "remove"
2518 });
2519 ENABLED_ACTIONS_BY_TYPE = _defineProperty$1(_defineProperty$1(_defineProperty$1({}, HISTORY_TYPES.TEXT, _defineProperty$1(_defineProperty$1(_defineProperty$1({}, ACTION_TYPES.REUSE, true), ACTION_TYPES.EDIT, true), ACTION_TYPES.REMOVE, true)), HISTORY_TYPES.CODE, _defineProperty$1(_defineProperty$1({}, ACTION_TYPES.REUSE, true), ACTION_TYPES.REMOVE, true)), HISTORY_TYPES.IMAGE, _defineProperty$1(_defineProperty$1({}, ACTION_TYPES.RESTORE, true), ACTION_TYPES.REMOVE, true));
2520 PromptHistoryActionProvider = function PromptHistoryActionProvider(_ref) {
2521 var children = _ref.children;
2522 var _useState2 = _slicedToArray((0, react.useState)(initialActionValue), 2);
2523 var state = _useState2[0];
2524 var dispatch = _useState2[1];
2525 return /*#__PURE__*/ react.default.createElement(PromptHistoryActionContext.Provider, { value: {
2526 state,
2527 dispatch
2528 } }, children);
2529 };
2530 PromptHistoryActionProvider.propTypes = { children: import_prop_types$4.default.node };
2531 usePromptHistoryAction = function usePromptHistoryAction() {
2532 var _useContext = (0, react.useContext)(PromptHistoryActionContext);
2533 var state = _useContext.state;
2534 var dispatch = _useContext.dispatch;
2535 var _usePromptHistoryCont = usePromptHistoryContext();
2536 var historyType = _usePromptHistoryCont.historyType;
2537 var onClose = _usePromptHistoryCont.onClose;
2538 var closeModalAfterAction = function closeModalAfterAction(action) {
2539 return function() {
2540 action.apply(void 0, arguments);
2541 onClose();
2542 };
2543 };
2544 return {
2545 promptHistoryAction: state,
2546 onPromptReuse: closeModalAfterAction(function onPromptReuse(id, data) {
2547 return dispatch({
2548 type: ACTION_TYPES.REUSE,
2549 id,
2550 data
2551 });
2552 }),
2553 onResultEdit: closeModalAfterAction(function onResultEdit(id, data) {
2554 return dispatch({
2555 type: ACTION_TYPES.EDIT,
2556 id,
2557 data
2558 });
2559 }),
2560 onImagesRestore: closeModalAfterAction(function onImagesRestore(id, data) {
2561 return dispatch({
2562 type: ACTION_TYPES.RESTORE,
2563 id,
2564 data
2565 });
2566 }),
2567 getAllowedActions: function getAllowedActions() {
2568 return ENABLED_ACTIONS_BY_TYPE[historyType] || {};
2569 }
2570 };
2571 };
2572 useSubscribeOnPromptHistoryAction = function useSubscribeOnPromptHistoryAction(actions) {
2573 var state = (0, react.useContext)(PromptHistoryActionContext).state;
2574 (0, react.useEffect)(function() {
2575 if (!state.type) return;
2576 var _iterator = _createForOfIteratorHelper$1(actions);
2577 var _step;
2578 try {
2579 for (_iterator.s(); !(_step = _iterator.n()).done;) {
2580 var action = _step.value;
2581 if (state.type === (action === null || action === void 0 ? void 0 : action.type)) action === null || action === void 0 || action.handler(state);
2582 }
2583 } catch (err) {
2584 _iterator.e(err);
2585 } finally {
2586 _iterator.f();
2587 }
2588 }, [state]);
2589 };
2590 }));
2591
2592 //#endregion
2593 //#region modules/ai/assets/js/editor/icons/bulb-icon.js
2594 var BulbIcon;
2595 var init_bulb_icon = __esmMin((() => {
2596 init_extends();
2597 BulbIcon = react.default.forwardRef(function(props, ref) {
2598 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({}, props, { ref }), /*#__PURE__*/ react.default.createElement("svg", {
2599 width: "22",
2600 height: "22",
2601 viewBox: "0 0 22 22",
2602 fill: "none",
2603 xmlns: "http://www.w3.org/2000/svg"
2604 }, /*#__PURE__*/ react.default.createElement("g", { clipPath: "url(#clip0_10743_8902)" }, /*#__PURE__*/ react.default.createElement("path", {
2605 d: "M2.75 10.0833H3.66667M11 2.75V3.66667M18.3333 10.0833H19.25M5.13333 5.13333L5.775 5.775M16.8667 5.13333L16.225 5.775",
2606 stroke: "#2563EB",
2607 strokeWidth: "1.5",
2608 strokeLinecap: "round",
2609 strokeLinejoin: "round"
2610 }), /*#__PURE__*/ react.default.createElement("path", {
2611 d: "M9.16675 16.041C8.70841 15.1243 6.91205 13.2842 6.62523 12.366C6.3384 11.4477 6.34775 10.4626 6.65195 9.54997C6.95615 8.63738 7.53978 7.84362 8.32016 7.28116C9.10054 6.71869 10.0381 6.41602 11.0001 6.41602C11.962 6.41602 12.8996 6.71869 13.68 7.28116C14.4604 7.84362 15.044 8.63738 15.3482 9.54997C15.6524 10.4626 15.6618 11.4477 15.3749 12.366C15.0881 13.2842 13.2917 15.1243 12.8334 16.041C12.8334 16.041 12.7597 17.3762 12.8334 17.8743C12.8334 18.3606 12.6403 18.8269 12.2964 19.1707C11.9526 19.5145 11.4863 19.7077 11.0001 19.7077C10.5139 19.7077 10.0475 19.5145 9.70372 19.1707C9.3599 18.8269 9.16675 18.3606 9.16675 17.8743C9.2405 17.3762 9.16675 16.041 9.16675 16.041Z",
2612 stroke: "#2563EB",
2613 strokeWidth: "1.5",
2614 strokeLinecap: "round",
2615 strokeLinejoin: "round"
2616 }), /*#__PURE__*/ react.default.createElement("path", {
2617 d: "M10.0833 16.5H11.9166",
2618 stroke: "#2563EB",
2619 strokeWidth: "1.5",
2620 strokeLinecap: "round",
2621 strokeLinejoin: "round"
2622 })), /*#__PURE__*/ react.default.createElement("defs", null, /*#__PURE__*/ react.default.createElement("clipPath", { id: "clip0_10743_8902" }, /*#__PURE__*/ react.default.createElement("rect", {
2623 width: "22",
2624 height: "22",
2625 fill: "white"
2626 })))));
2627 });
2628 }));
2629
2630 //#endregion
2631 //#region modules/ai/assets/js/editor/hooks/use-introduction.js
2632 function useIntroduction(key) {
2633 var _window$elementor$con;
2634 var _window$elementorAdmi;
2635 var _globalConfig$introdu;
2636 var globalConfig = window.elementor ? (_window$elementor$con = window.elementor.config) === null || _window$elementor$con === void 0 ? void 0 : _window$elementor$con.user : (_window$elementorAdmi = window.elementorAdmin) === null || _window$elementorAdmi === void 0 || (_window$elementorAdmi = _window$elementorAdmi.config) === null || _window$elementorAdmi === void 0 ? void 0 : _window$elementorAdmi.user;
2637 var _useState2 = _slicedToArray((0, react.useState)(!!(globalConfig !== null && globalConfig !== void 0 && (_globalConfig$introdu = globalConfig.introduction) !== null && _globalConfig$introdu !== void 0 && _globalConfig$introdu[key])), 2);
2638 var isViewed = _useState2[0];
2639 var setIsViewed = _useState2[1];
2640 function markAsViewed() {
2641 if (!key) return Promise.reject();
2642 return new Promise(function(resolve, reject) {
2643 if (isViewed) reject();
2644 setIsViewed(true);
2645 elementorCommon.ajax.addRequest("introduction_viewed", {
2646 data: { introductionKey: key },
2647 error: function error() {
2648 setIsViewed(false);
2649 reject();
2650 },
2651 success: function success() {
2652 setIsViewed(true);
2653 if (globalConfig !== null && globalConfig !== void 0 && globalConfig.introduction) globalConfig.introduction[key] = true;
2654 resolve();
2655 }
2656 });
2657 });
2658 }
2659 return {
2660 isViewed,
2661 markAsViewed
2662 };
2663 }
2664 var init_use_introduction = __esmMin((() => {
2665 init_slicedToArray();
2666 }));
2667
2668 //#endregion
2669 //#region modules/ai/assets/js/editor/components/voice-promotion-alert.js
2670 function ownKeys$29(e, r) {
2671 var t = Object.keys(e);
2672 if (Object.getOwnPropertySymbols) {
2673 var o = Object.getOwnPropertySymbols(e);
2674 r && (o = o.filter(function(r) {
2675 return Object.getOwnPropertyDescriptor(e, r).enumerable;
2676 })), t.push.apply(t, o);
2677 }
2678 return t;
2679 }
2680 function _objectSpread$28(e) {
2681 for (var r = 1; r < arguments.length; r++) {
2682 var t = null != arguments[r] ? arguments[r] : {};
2683 r % 2 ? ownKeys$29(Object(t), !0).forEach(function(r) {
2684 _defineProperty$1(e, r, t[r]);
2685 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$29(Object(t)).forEach(function(r) {
2686 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
2687 });
2688 }
2689 return e;
2690 }
2691 var import_prop_types$3, VoicePromotionAlert;
2692 var init_voice_promotion_alert = __esmMin((() => {
2693 init_defineProperty$1();
2694 init_bulb_icon();
2695 init_use_introduction();
2696 import_prop_types$3 = /* @__PURE__ */ __toESM(require_prop_types());
2697 __name(ownKeys$29, "ownKeys");
2698 __name(_objectSpread$28, "_objectSpread");
2699 VoicePromotionAlert = function VoicePromotionAlert(props) {
2700 var _useIntroduction = useIntroduction(props.introductionKey);
2701 var isViewed = _useIntroduction.isViewed;
2702 var markAsViewed = _useIntroduction.markAsViewed;
2703 if (isViewed) return null;
2704 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
2705 sx: _objectSpread$28({ mt: 2 }, props.sx),
2706 alignItems: "top"
2707 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, {
2708 severity: "info",
2709 variant: "standard",
2710 icon: /*#__PURE__*/ react.default.createElement(BulbIcon, { sx: { alignSelf: "flex-start" } }),
2711 onClose: markAsViewed
2712 }, (0, _wordpress_i18n.__)("Get improved results from AI by adding personal context.", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, {
2713 onClick: function onClick() {
2714 return $e.route("panel/global/menu");
2715 },
2716 className: "elementor-clickable",
2717 style: { textDecoration: "none" },
2718 color: "info.main",
2719 href: "#"
2720 }, (0, _wordpress_i18n.__)("Let’s do it", "elementor"))));
2721 };
2722 VoicePromotionAlert.propTypes = {
2723 sx: import_prop_types$3.default.object,
2724 introductionKey: import_prop_types$3.default.string
2725 };
2726 }));
2727
2728 //#endregion
2729 //#region modules/ai/assets/js/editor/pages/form-text/index.js
2730 init_asyncToGenerator();
2731 init_slicedToArray();
2732 init_actions_data();
2733 init_prompt_history_action_context();
2734 init_requests_ids();
2735 init_voice_promotion_alert();
2736 var promptActions = [
2737 {
2738 label: (0, _wordpress_i18n.__)("Simplify language", "elementor"),
2739 icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.MessageIcon, { fontSize: "small" }),
2740 value: "Simplify the language of the following message"
2741 },
2742 {
2743 label: (0, _wordpress_i18n.__)("Make it longer", "elementor"),
2744 icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.ExpandIcon, { fontSize: "small" }),
2745 value: "Make the following message longer"
2746 },
2747 {
2748 label: (0, _wordpress_i18n.__)("Make it shorter", "elementor"),
2749 icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.ShrinkIcon, { fontSize: "small" }),
2750 value: "Make the following message shorter"
2751 },
2752 {
2753 label: (0, _wordpress_i18n.__)("Fix spelling & grammar", "elementor"),
2754 icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { fontSize: "small" }),
2755 value: "Fix the spelling and grammar of the following message"
2756 }
2757 ];
2758 var promptInstructions = [{
2759 label: (0, _wordpress_i18n.__)("Change tone", "elementor"),
2760 options: vocalTones,
2761 getInstruction: function getInstruction(value) {
2762 return "Change the tone of the following message to ".concat(value);
2763 }
2764 }, {
2765 label: (0, _wordpress_i18n.__)("Translate to", "elementor"),
2766 options: translateLanguages,
2767 getInstruction: function getInstruction(value) {
2768 return "Translate the following message to ".concat(value);
2769 }
2770 }];
2771 var FormText = function FormText(_ref) {
2772 var _initialValue$result;
2773 var _initialValue$credits;
2774 var _additionalOptions$in;
2775 var type = _ref.type;
2776 var onClose = _ref.onClose;
2777 var getControlValue = _ref.getControlValue;
2778 var setControlValue = _ref.setControlValue;
2779 var additionalOptions = _ref.additionalOptions;
2780 var credits = _ref.credits;
2781 var children = _ref.children;
2782 var initialValue = getControlValue() === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.defaultValue) ? "" : getControlValue();
2783 var _useTextPrompt = useTextPrompt({
2784 result: (_initialValue$result = initialValue === null || initialValue === void 0 ? void 0 : initialValue.result) !== null && _initialValue$result !== void 0 ? _initialValue$result : initialValue,
2785 credits: (_initialValue$credits = initialValue === null || initialValue === void 0 ? void 0 : initialValue.credits) !== null && _initialValue$credits !== void 0 ? _initialValue$credits : credits,
2786 responseId: initialValue === null || initialValue === void 0 ? void 0 : initialValue.responseId
2787 });
2788 var data = _useTextPrompt.data;
2789 var isLoading = _useTextPrompt.isLoading;
2790 var txtGenErr = _useTextPrompt.error;
2791 var setResult = _useTextPrompt.setResult;
2792 var reset = _useTextPrompt.reset;
2793 var send = _useTextPrompt.send;
2794 var sendUsageData = _useTextPrompt.sendUsageData;
2795 var error = txtGenErr || (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.initError);
2796 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
2797 var prompt = _useState2[0];
2798 var setPrompt = _useState2[1];
2799 var setGenerate = useRequestIds().setGenerate;
2800 useSubscribeOnPromptHistoryAction([{
2801 type: ACTION_TYPES.REUSE,
2802 handler: function handler(action) {
2803 reset();
2804 setPrompt(action.data);
2805 }
2806 }, {
2807 type: ACTION_TYPES.EDIT,
2808 handler: function handler(action) {
2809 setResult(action.data);
2810 }
2811 }]);
2812 var searchField = (0, react.useRef)(null);
2813 var resultField = (0, react.useRef)(null);
2814 var lastRun = (0, react.useRef)((_additionalOptions$in = additionalOptions.initRetry) !== null && _additionalOptions$in !== void 0 ? _additionalOptions$in : function() {});
2815 var autocompleteItems = "textarea" === type ? textareaAutocomplete : textAutocomplete;
2816 var showSuggestions = !prompt;
2817 var handleSubmit = function handleSubmit(event) {
2818 event.preventDefault();
2819 setGenerate();
2820 lastRun.current = function() {
2821 return send({ prompt });
2822 };
2823 lastRun.current();
2824 };
2825 var handleCustomInstruction = /*#__PURE__*/ function() {
2826 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(instruction) {
2827 return import_regenerator$2.default.wrap(function(_context) {
2828 while (1) switch (_context.prev = _context.next) {
2829 case 0:
2830 setGenerate();
2831 lastRun.current = function() {
2832 return send({
2833 input: resultField.current.value,
2834 instruction
2835 });
2836 };
2837 lastRun.current();
2838 case 1:
2839 case "end": return _context.stop();
2840 }
2841 }, _callee);
2842 }));
2843 return function handleCustomInstruction(_x) {
2844 return _ref2.apply(this, arguments);
2845 };
2846 }();
2847 var handleSuggestion = function handleSuggestion(suggestion) {
2848 setPrompt(suggestion + " ");
2849 searchField.current.focus();
2850 };
2851 var applyPrompt = function applyPrompt() {
2852 sendUsageData();
2853 setControlValue(resultField.current.value);
2854 onClose();
2855 };
2856 if (isLoading) return /*#__PURE__*/ react.default.createElement(Loader, null);
2857 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, error && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, {
2858 error,
2859 onRetry: lastRun.current,
2860 sx: { mb: 2.5 }
2861 }), children, !data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
2862 component: "form",
2863 onSubmit: handleSubmit
2864 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { mb: 2.5 } }, /*#__PURE__*/ react.default.createElement(PromptSearch, {
2865 ref: searchField,
2866 placeholder: (0, _wordpress_i18n.__)("Describe the text and tone you want to use...", "elementor"),
2867 name: "prompt",
2868 value: prompt,
2869 onChange: function onChange(event) {
2870 return setPrompt(event.target.value);
2871 }
2872 })), showSuggestions && /*#__PURE__*/ react.default.createElement(PromptSuggestions, {
2873 suggestions: autocompleteItems,
2874 onSelect: handleSuggestion,
2875 suggestionFilter: function suggestionFilter(suggestion) {
2876 return suggestion + "...";
2877 }
2878 }, /*#__PURE__*/ react.default.createElement(PromptLibraryLink, { libraryLink: "https://go.elementor.com/ai-prompt-library-text/" })), additionalOptions.hideAiContext ? null : /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, {
2879 introductionKey: "ai-context-text-promotion",
2880 sx: { mb: 2 }
2881 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
2882 direction: "row",
2883 alignItems: "center",
2884 sx: {
2885 pb: 1.5,
2886 mt: 2
2887 }
2888 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
2889 direction: "row",
2890 justifyContent: "flex-end",
2891 flexGrow: 1
2892 }, /*#__PURE__*/ react.default.createElement(GenerateButton$1, null, (0, _wordpress_i18n.__)("Generate text", "elementor"))))), data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { mt: 1 } }, /*#__PURE__*/ react.default.createElement(Textarea, {
2893 fullWidth: true,
2894 ref: resultField,
2895 value: data.result,
2896 helperText: (0, _wordpress_i18n.__)("Text generated by AI may be inaccurate or offensive.", "elementor"),
2897 onChange: function onChange(event) {
2898 return setResult(event.target.value);
2899 }
2900 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Grid, {
2901 container: true,
2902 spacing: 1,
2903 sx: { mt: 2.5 }
2904 }, promptActions.map(function(_ref3) {
2905 var label = _ref3.label;
2906 var icon = _ref3.icon;
2907 var value = _ref3.value;
2908 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Grid, {
2909 item: true,
2910 key: label
2911 }, /*#__PURE__*/ react.default.createElement(PromptAction, {
2912 label,
2913 icon,
2914 onClick: function onClick() {
2915 return handleCustomInstruction(value);
2916 }
2917 }));
2918 })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
2919 direction: "row",
2920 alignItems: "center",
2921 spacing: 1,
2922 sx: { mt: 2.5 }
2923 }, promptInstructions.map(function(_ref4) {
2924 var label = _ref4.label;
2925 var options = _ref4.options;
2926 var getInstruction = _ref4.getInstruction;
2927 return /*#__PURE__*/ react.default.createElement(PromptActionSelection, {
2928 key: label,
2929 label,
2930 options,
2931 onChange: function onChange(event) {
2932 return handleCustomInstruction(getInstruction(event.target.value));
2933 }
2934 });
2935 })), additionalOptions.hideAiContext ? null : /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, {
2936 introductionKey: "ai-context-text-promotion",
2937 sx: { mb: 2 }
2938 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
2939 direction: "row",
2940 alignItems: "center",
2941 sx: { my: 1 }
2942 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
2943 direction: "row",
2944 gap: 1,
2945 justifyContent: "flex-end",
2946 flexGrow: 1
2947 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
2948 size: "small",
2949 color: "secondary",
2950 variant: "text",
2951 onClick: reset
2952 }, (0, _wordpress_i18n.__)("New prompt", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
2953 size: "small",
2954 variant: "contained",
2955 color: "primary",
2956 onClick: applyPrompt
2957 }, (0, _wordpress_i18n.__)("Use text", "elementor"))))));
2958 };
2959 FormText.propTypes = {
2960 type: import_prop_types$8.default.string.isRequired,
2961 controlType: import_prop_types$8.default.string,
2962 onClose: import_prop_types$8.default.func.isRequired,
2963 getControlValue: import_prop_types$8.default.func.isRequired,
2964 setControlValue: import_prop_types$8.default.func.isRequired,
2965 additionalOptions: import_prop_types$8.default.object,
2966 credits: import_prop_types$8.default.number,
2967 usagePercentage: import_prop_types$8.default.number,
2968 children: import_prop_types$8.default.node
2969 };
2970
2971 //#endregion
2972 //#region modules/ai/assets/js/editor/pages/connect/index.js
2973 var Connect = function Connect(_ref) {
2974 var connectUrl = _ref.connectUrl;
2975 var onSuccess = _ref.onSuccess;
2976 var approveButtonRef = (0, react.useRef)();
2977 (0, react.useEffect)(function() {
2978 if (!jQuery.fn.elementorConnect) return;
2979 jQuery(approveButtonRef.current).elementorConnect({
2980 success: function success(_, data) {
2981 return onSuccess(data);
2982 },
2983 error: function error() {
2984 throw new Error("Elementor AI: Failed to connect.");
2985 }
2986 });
2987 }, []);
2988 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
2989 alignItems: "center",
2990 gap: 2
2991 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: {
2992 color: "text.primary",
2993 fontSize: "60px",
2994 mb: 1
2995 } }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
2996 variant: "h4",
2997 sx: { color: "text.primary" }
2998 }, (0, _wordpress_i18n.__)("Step into the future with Elementor AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body2" }, (0, _wordpress_i18n.__)("Create smarter with AI text and code generators built right into the editor.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
2999 variant: "caption",
3000 sx: {
3001 maxWidth: 520,
3002 textAlign: "center"
3003 }
3004 }, " ", (0, _wordpress_i18n.__)("By clicking \"Connect\", I approve the ", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, {
3005 href: "https://go.elementor.com/ai-terms/",
3006 target: "_blank",
3007 color: "info.main"
3008 }, (0, _wordpress_i18n.__)("Terms of Service", "elementor")), " & ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, {
3009 href: "https://go.elementor.com/ai-privacy-policy/",
3010 target: "_blank",
3011 color: "info.main"
3012 }, (0, _wordpress_i18n.__)("Privacy Policy", "elementor")), (0, _wordpress_i18n.__)(" of the Elementor AI service.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
3013 ref: approveButtonRef,
3014 href: connectUrl,
3015 variant: "contained",
3016 sx: {
3017 mt: 1,
3018 "&:hover": { color: "primary.contrastText" }
3019 }
3020 }, (0, _wordpress_i18n.__)("Connect", "elementor")));
3021 };
3022 Connect.propTypes = {
3023 connectUrl: import_prop_types$8.default.string.isRequired,
3024 onSuccess: import_prop_types$8.default.func.isRequired
3025 };
3026
3027 //#endregion
3028 //#region modules/ai/assets/js/editor/pages/get-started/index.js
3029 init_asyncToGenerator();
3030 init_slicedToArray();
3031 init_api();
3032 var GetStarted = function GetStarted(_ref) {
3033 var onSuccess = _ref.onSuccess;
3034 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
3035 var isTermsChecked = _useState2[0];
3036 var setIsTermsChecked = _useState2[1];
3037 var onGetStartedClick = /*#__PURE__*/ function() {
3038 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
3039 return import_regenerator$2.default.wrap(function(_context) {
3040 while (1) switch (_context.prev = _context.next) {
3041 case 0:
3042 _context.next = 1;
3043 return setGetStarted();
3044 case 1: onSuccess();
3045 case 2:
3046 case "end": return _context.stop();
3047 }
3048 }, _callee);
3049 }));
3050 return function onGetStartedClick() {
3051 return _ref2.apply(this, arguments);
3052 };
3053 }();
3054 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
3055 alignItems: "center",
3056 gap: 1.5
3057 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: {
3058 color: "text.primary",
3059 fontSize: "60px",
3060 mb: 1
3061 } }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
3062 variant: "h4",
3063 sx: { color: "text.primary" }
3064 }, (0, _wordpress_i18n.__)("Step into the future with Elementor AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body2" }, (0, _wordpress_i18n.__)("Create smarter with AI text and code generators built right into the editor.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
3065 direction: "row",
3066 gap: 1.5,
3067 alignItems: "flex-start"
3068 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Checkbox, {
3069 id: "e-ai-terms-approval",
3070 color: "secondary",
3071 checked: isTermsChecked,
3072 onClick: function onClick() {
3073 return setIsTermsChecked(function(prevState) {
3074 return !prevState;
3075 });
3076 }
3077 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
3078 variant: "caption",
3079 sx: { maxWidth: 520 },
3080 component: "label",
3081 htmlFor: "e-ai-terms-approval"
3082 }, " ", (0, _wordpress_i18n.__)("I approve the ", "elementor"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, {
3083 href: "https://go.elementor.com/ai-terms/",
3084 target: "_blank",
3085 color: "info.main"
3086 }, (0, _wordpress_i18n.__)("Terms of Service", "elementor")), " & ", /*#__PURE__*/ react.default.createElement(_elementor_ui.Link, {
3087 href: "https://go.elementor.com/ai-privacy-policy/",
3088 target: "_blank",
3089 color: "info.main"
3090 }, (0, _wordpress_i18n.__)("Privacy Policy", "elementor")), (0, _wordpress_i18n.__)(" of the Elementor AI service.", "elementor"), /*#__PURE__*/ react.default.createElement("br", null), (0, _wordpress_i18n.__)("This includes consenting to the collection and use of data to improve user experience.", "elementor")))), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
3091 disabled: !isTermsChecked,
3092 variant: "contained",
3093 onClick: onGetStartedClick,
3094 sx: {
3095 mt: 1,
3096 "&:hover": { color: "primary.contrastText" }
3097 }
3098 }, (0, _wordpress_i18n.__)("Get Started", "elementor")));
3099 };
3100 GetStarted.propTypes = { onSuccess: import_prop_types$8.default.func.isRequired };
3101
3102 //#endregion
3103 //#region modules/ai/assets/js/editor/hooks/use-user-info.js
3104 init_defineProperty$1();
3105 init_asyncToGenerator();
3106 init_slicedToArray();
3107 init_api();
3108 function ownKeys$28(e, r) {
3109 var t = Object.keys(e);
3110 if (Object.getOwnPropertySymbols) {
3111 var o = Object.getOwnPropertySymbols(e);
3112 r && (o = o.filter(function(r) {
3113 return Object.getOwnPropertyDescriptor(e, r).enumerable;
3114 })), t.push.apply(t, o);
3115 }
3116 return t;
3117 }
3118 __name(ownKeys$28, "ownKeys");
3119 function _objectSpread$27(e) {
3120 for (var r = 1; r < arguments.length; r++) {
3121 var t = null != arguments[r] ? arguments[r] : {};
3122 r % 2 ? ownKeys$28(Object(t), !0).forEach(function(r) {
3123 _defineProperty$1(e, r, t[r]);
3124 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$28(Object(t)).forEach(function(r) {
3125 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
3126 });
3127 }
3128 return e;
3129 }
3130 __name(_objectSpread$27, "_objectSpread");
3131 var useUserInfo = function useUserInfo() {
3132 var immediately = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
3133 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
3134 var isLoaded = _useState2[0];
3135 var setIsLoaded = _useState2[1];
3136 var _useState4 = _slicedToArray((0, react.useState)(false), 2);
3137 var isLoading = _useState4[0];
3138 var setIsLoading = _useState4[1];
3139 var _useState6 = _slicedToArray((0, react.useState)({
3140 is_connected: false,
3141 is_get_started: false,
3142 connect_url: "",
3143 usage: {
3144 hasAiSubscription: false,
3145 quota: 0,
3146 usedQuota: 0
3147 }
3148 }), 2);
3149 var userInfo = _useState6[0];
3150 var setUserInfo = _useState6[1];
3151 var credits = userInfo.usage.quota - userInfo.usage.usedQuota;
3152 var usagePercentage = userInfo.usage.quota ? userInfo.usage.usedQuota / userInfo.usage.quota * 100 : 0;
3153 var fetchData = /*#__PURE__*/ function() {
3154 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
3155 var userInfoResult;
3156 return import_regenerator$2.default.wrap(function(_context) {
3157 while (1) switch (_context.prev = _context.next) {
3158 case 0:
3159 setIsLoading(true);
3160 _context.next = 1;
3161 return getUserInformation(immediately);
3162 case 1:
3163 userInfoResult = _context.sent;
3164 setUserInfo(function(prevState) {
3165 return _objectSpread$27(_objectSpread$27({}, prevState), userInfoResult);
3166 });
3167 setIsLoaded(true);
3168 setIsLoading(false);
3169 case 2:
3170 case "end": return _context.stop();
3171 }
3172 }, _callee);
3173 }));
3174 return function fetchData() {
3175 return _ref.apply(this, arguments);
3176 };
3177 }();
3178 if (!isLoaded && !isLoading) fetchData();
3179 return {
3180 isLoading,
3181 isLoaded,
3182 isConnected: userInfo.is_connected,
3183 isGetStarted: userInfo.is_get_started,
3184 connectUrl: userInfo.connect_url,
3185 builderUrl: userInfo.usage.builderUrl,
3186 hasSubscription: userInfo.usage.hasAiSubscription,
3187 credits: credits < 0 ? 0 : credits,
3188 usagePercentage: Math.round(usagePercentage),
3189 fetchData
3190 };
3191 };
3192 useUserInfo.propTypes = { immediately: import_prop_types$8.default.bool };
3193
3194 //#endregion
3195 //#region modules/ai/assets/js/editor/components/dialog-header.js
3196 init_extends();
3197 var StyledElementorLogo = (0, _elementor_ui.styled)(function ElementorLogo(props) {
3198 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 32 32" }, props), /*#__PURE__*/ react.default.createElement("path", {
3199 fillRule: "evenodd",
3200 clipRule: "evenodd",
3201 d: "M2.69648 24.8891C0.938383 22.2579 0 19.1645 0 16C0 11.7566 1.68571 7.68687 4.68629 4.68629C7.68687 1.68571 11.7566 0 16 0C19.1645 0 22.2579 0.938383 24.8891 2.69648C27.5203 4.45459 29.5711 6.95344 30.7821 9.87706C31.9931 12.8007 32.3099 16.0177 31.6926 19.1214C31.0752 22.2251 29.5514 25.0761 27.3137 27.3137C25.0761 29.5514 22.2251 31.0752 19.1214 31.6926C16.0177 32.3099 12.8007 31.9931 9.87706 30.7821C6.95344 29.5711 4.45459 27.5203 2.69648 24.8891ZM12.0006 9.33281H9.33437V22.6665H12.0006V9.33281ZM22.6657 9.33281H14.6669V11.9991H22.6657V9.33281ZM22.6657 14.6654H14.6669V17.3316H22.6657V14.6654ZM22.6657 20.0003H14.6669V22.6665H22.6657V20.0003Z"
3202 }));
3203 })(function(_ref) {
3204 var theme = _ref.theme;
3205 return {
3206 width: theme.spacing(3),
3207 height: theme.spacing(3),
3208 "& path": { fill: theme.palette.text.primary }
3209 };
3210 });
3211 var DialogHeader$1 = function DialogHeader(props) {
3212 var hideAiBetaLogo = props.hideAiBetaLogo;
3213 var onClose = props.onClose;
3214 var children = props.children;
3215 return /*#__PURE__*/ react.default.createElement(_elementor_ui.AppBar, {
3216 sx: { fontWeight: "normal" },
3217 color: "transparent",
3218 position: "relative"
3219 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Toolbar, { variant: "dense" }, !hideAiBetaLogo && /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(StyledElementorLogo, { sx: { mr: 1 } }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
3220 component: "span",
3221 variant: "subtitle2",
3222 sx: {
3223 fontWeight: "bold",
3224 textTransform: "uppercase"
3225 }
3226 }, (0, _wordpress_i18n.__)("AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, {
3227 label: (0, _wordpress_i18n.__)("Beta", "elementor"),
3228 color: "default",
3229 size: "small",
3230 sx: { ml: 1 }
3231 })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
3232 direction: "row",
3233 spacing: 1,
3234 alignItems: "center",
3235 sx: { ml: hideAiBetaLogo ? 0 : "auto" }
3236 }, children, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
3237 size: "small",
3238 "aria-label": "close",
3239 onClick: onClose,
3240 sx: { "&.MuiButtonBase-root": { mr: -1 } }
3241 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.XIcon, null)))));
3242 };
3243 DialogHeader$1.propTypes = {
3244 onClose: import_prop_types$8.default.func.isRequired,
3245 hideAiBetaLogo: import_prop_types$8.default.bool,
3246 children: import_prop_types$8.default.oneOfType([import_prop_types$8.default.arrayOf(import_prop_types$8.default.node), import_prop_types$8.default.node])
3247 };
3248
3249 //#endregion
3250 //#region modules/ai/assets/js/editor/components/wizard-dialog.js
3251 init_extends();
3252 init_defineProperty$1();
3253 init_objectWithoutProperties$1();
3254 var _excluded$30 = ["sx"];
3255 function ownKeys$27(e, r) {
3256 var t = Object.keys(e);
3257 if (Object.getOwnPropertySymbols) {
3258 var o = Object.getOwnPropertySymbols(e);
3259 r && (o = o.filter(function(r) {
3260 return Object.getOwnPropertyDescriptor(e, r).enumerable;
3261 })), t.push.apply(t, o);
3262 }
3263 return t;
3264 }
3265 __name(ownKeys$27, "ownKeys");
3266 function _objectSpread$26(e) {
3267 for (var r = 1; r < arguments.length; r++) {
3268 var t = null != arguments[r] ? arguments[r] : {};
3269 r % 2 ? ownKeys$27(Object(t), !0).forEach(function(r) {
3270 _defineProperty$1(e, r, t[r]);
3271 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$27(Object(t)).forEach(function(r) {
3272 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
3273 });
3274 }
3275 return e;
3276 }
3277 __name(_objectSpread$26, "_objectSpread");
3278 var WizardDialog = function WizardDialog(props) {
3279 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, {
3280 open: true,
3281 onClose: props.onClose,
3282 fullWidth: true,
3283 hideBackdrop: true,
3284 maxWidth: "lg",
3285 PaperProps: { sx: { height: "88vh" } },
3286 sx: { zIndex: 9999 }
3287 }, props.children);
3288 };
3289 WizardDialog.propTypes = {
3290 onClose: import_prop_types$8.default.func.isRequired,
3291 children: import_prop_types$8.default.node.isRequired
3292 };
3293 var WizardDialogContent = function WizardDialogContent(_ref) {
3294 var _ref$sx = _ref.sx;
3295 var sx = _ref$sx === void 0 ? {} : _ref$sx;
3296 var props = _objectWithoutProperties$1(_ref, _excluded$30);
3297 return /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContent, _extends$1({}, props, { sx: _objectSpread$26({
3298 display: "flex",
3299 flexDirection: "column",
3300 justifyContent: "center"
3301 }, sx) }));
3302 };
3303 WizardDialogContent.propTypes = { sx: import_prop_types$8.default.object };
3304 WizardDialog.Header = DialogHeader$1;
3305 WizardDialog.Content = WizardDialogContent;
3306
3307 //#endregion
3308 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
3309 function _typeof(o) {
3310 "@babel/helpers - typeof";
3311 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
3312 return typeof o;
3313 } : function(o) {
3314 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
3315 }, _typeof(o);
3316 }
3317 var init_typeof = __esmMin((() => {}));
3318
3319 //#endregion
3320 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
3321 function toPrimitive(t, r) {
3322 if ("object" != _typeof(t) || !t) return t;
3323 var e = t[Symbol.toPrimitive];
3324 if (void 0 !== e) {
3325 var i = e.call(t, r || "default");
3326 if ("object" != _typeof(i)) return i;
3327 throw new TypeError("@@toPrimitive must return a primitive value.");
3328 }
3329 return ("string" === r ? String : Number)(t);
3330 }
3331 var init_toPrimitive = __esmMin((() => {
3332 init_typeof();
3333 }));
3334
3335 //#endregion
3336 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
3337 function toPropertyKey(t) {
3338 var i = toPrimitive(t, "string");
3339 return "symbol" == _typeof(i) ? i : i + "";
3340 }
3341 var init_toPropertyKey = __esmMin((() => {
3342 init_typeof();
3343 init_toPrimitive();
3344 }));
3345
3346 //#endregion
3347 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
3348 function _defineProperty(e, r, t) {
3349 return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
3350 value: t,
3351 enumerable: !0,
3352 configurable: !0,
3353 writable: !0
3354 }) : e[r] = t, e;
3355 }
3356 var init_defineProperty = __esmMin((() => {
3357 init_toPropertyKey();
3358 }));
3359
3360 //#endregion
3361 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js
3362 function ownKeys$26(e, r) {
3363 var t = Object.keys(e);
3364 if (Object.getOwnPropertySymbols) {
3365 var o = Object.getOwnPropertySymbols(e);
3366 r && (o = o.filter(function(r) {
3367 return Object.getOwnPropertyDescriptor(e, r).enumerable;
3368 })), t.push.apply(t, o);
3369 }
3370 return t;
3371 }
3372 function _objectSpread2(e) {
3373 for (var r = 1; r < arguments.length; r++) {
3374 var t = null != arguments[r] ? arguments[r] : {};
3375 r % 2 ? ownKeys$26(Object(t), !0).forEach(function(r) {
3376 _defineProperty(e, r, t[r]);
3377 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$26(Object(t)).forEach(function(r) {
3378 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
3379 });
3380 }
3381 return e;
3382 }
3383 var init_objectSpread2 = __esmMin((() => {
3384 init_defineProperty();
3385 __name(ownKeys$26, "ownKeys");
3386 }));
3387
3388 //#endregion
3389 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutPropertiesLoose.js
3390 function _objectWithoutPropertiesLoose(r, e) {
3391 if (null == r) return {};
3392 var t = {};
3393 for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
3394 if (e.includes(n)) continue;
3395 t[n] = r[n];
3396 }
3397 return t;
3398 }
3399 var init_objectWithoutPropertiesLoose = __esmMin((() => {}));
3400
3401 //#endregion
3402 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutProperties.js
3403 function _objectWithoutProperties(e, t) {
3404 if (null == e) return {};
3405 var o;
3406 var r;
3407 var i = _objectWithoutPropertiesLoose(e, t);
3408 if (Object.getOwnPropertySymbols) {
3409 var s = Object.getOwnPropertySymbols(e);
3410 for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
3411 }
3412 return i;
3413 }
3414 var init_objectWithoutProperties = __esmMin((() => {
3415 init_objectWithoutPropertiesLoose();
3416 }));
3417
3418 //#endregion
3419 //#region node_modules/react-draggable/node_modules/clsx/dist/clsx.js
3420 var require_clsx = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3421 function r(e) {
3422 var o;
3423 var t;
3424 var f = "";
3425 if ("string" == typeof e || "number" == typeof e) f += e;
3426 else if ("object" == typeof e) if (Array.isArray(e)) {
3427 var n = e.length;
3428 for (o = 0; o < n; o++) e[o] && (t = r(e[o])) && (f && (f += " "), f += t);
3429 } else for (t in e) e[t] && (f && (f += " "), f += t);
3430 return f;
3431 }
3432 function e() {
3433 for (var e, o, t = 0, f = "", n = arguments.length; t < n; t++) (e = arguments[t]) && (o = r(e)) && (f && (f += " "), f += o);
3434 return f;
3435 }
3436 module.exports = e, module.exports.clsx = e;
3437 }));
3438
3439 //#endregion
3440 //#region node_modules/react-draggable/build/cjs/utils/shims.js
3441 var require_shims = /* @__PURE__ */ __commonJSMin(((exports) => {
3442 Object.defineProperty(exports, "__esModule", { value: true });
3443 exports.dontSetMe = dontSetMe;
3444 exports.findInArray = findInArray;
3445 exports.int = int;
3446 exports.isFunction = isFunction;
3447 exports.isNum = isNum;
3448 function findInArray(array, callback) {
3449 for (let i = 0, length = array.length; i < length; i++) if (callback.apply(callback, [
3450 array[i],
3451 i,
3452 array
3453 ])) return array[i];
3454 }
3455 function isFunction(func) {
3456 return typeof func === "function" || Object.prototype.toString.call(func) === "[object Function]";
3457 }
3458 function isNum(num) {
3459 return typeof num === "number" && !isNaN(num);
3460 }
3461 function int(a) {
3462 return parseInt(a, 10);
3463 }
3464 function dontSetMe(props, propName, componentName) {
3465 if (props[propName]) return /* @__PURE__ */ new Error(`Invalid prop ${propName} passed to ${componentName} - do not set this, set it on the child.`);
3466 }
3467 }));
3468
3469 //#endregion
3470 //#region node_modules/react-draggable/build/cjs/utils/getPrefix.js
3471 var require_getPrefix = /* @__PURE__ */ __commonJSMin(((exports) => {
3472 Object.defineProperty(exports, "__esModule", { value: true });
3473 exports.browserPrefixToKey = browserPrefixToKey;
3474 exports.browserPrefixToStyle = browserPrefixToStyle;
3475 exports.default = void 0;
3476 exports.getPrefix = getPrefix;
3477 var prefixes = [
3478 "Moz",
3479 "Webkit",
3480 "O",
3481 "ms"
3482 ];
3483 function getPrefix() {
3484 var _window$document;
3485 let prop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
3486 if (typeof window === "undefined") return "";
3487 const style = (_window$document = window.document) === null || _window$document === void 0 || (_window$document = _window$document.documentElement) === null || _window$document === void 0 ? void 0 : _window$document.style;
3488 if (!style) return "";
3489 if (prop in style) return "";
3490 for (let i = 0; i < prefixes.length; i++) if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
3491 return "";
3492 }
3493 function browserPrefixToKey(prop, prefix) {
3494 return prefix ? `${prefix}${kebabToTitleCase(prop)}` : prop;
3495 }
3496 function browserPrefixToStyle(prop, prefix) {
3497 return prefix ? `-${prefix.toLowerCase()}-${prop}` : prop;
3498 }
3499 function kebabToTitleCase(str) {
3500 let out = "";
3501 let shouldCapitalize = true;
3502 for (let i = 0; i < str.length; i++) if (shouldCapitalize) {
3503 out += str[i].toUpperCase();
3504 shouldCapitalize = false;
3505 } else if (str[i] === "-") shouldCapitalize = true;
3506 else out += str[i];
3507 return out;
3508 }
3509 exports.default = getPrefix();
3510 }));
3511
3512 //#endregion
3513 //#region node_modules/react-draggable/build/cjs/utils/domFns.js
3514 var require_domFns = /* @__PURE__ */ __commonJSMin(((exports) => {
3515 init_objectSpread2();
3516 Object.defineProperty(exports, "__esModule", { value: true });
3517 exports.addClassName = addClassName;
3518 exports.addEvent = addEvent;
3519 exports.addUserSelectStyles = addUserSelectStyles;
3520 exports.createCSSTransform = createCSSTransform;
3521 exports.createSVGTransform = createSVGTransform;
3522 exports.getTouch = getTouch;
3523 exports.getTouchIdentifier = getTouchIdentifier;
3524 exports.getTranslation = getTranslation;
3525 exports.innerHeight = innerHeight;
3526 exports.innerWidth = innerWidth;
3527 exports.matchesSelector = matchesSelector;
3528 exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
3529 exports.offsetXYFromParent = offsetXYFromParent;
3530 exports.outerHeight = outerHeight;
3531 exports.outerWidth = outerWidth;
3532 exports.removeClassName = removeClassName;
3533 exports.removeEvent = removeEvent;
3534 exports.scheduleRemoveUserSelectStyles = scheduleRemoveUserSelectStyles;
3535 var _shims = require_shims();
3536 var _getPrefix = _interopRequireWildcard(require_getPrefix());
3537 function _interopRequireWildcard(e, t) {
3538 if ("function" == typeof WeakMap) {
3539 var r = /* @__PURE__ */ new WeakMap();
3540 var n = /* @__PURE__ */ new WeakMap();
3541 }
3542 return (_interopRequireWildcard = function(e, t) {
3543 if (!t && e && e.__esModule) return e;
3544 var o;
3545 var i;
3546 var f = {
3547 __proto__: null,
3548 default: e
3549 };
3550 if (null === e || "object" != typeof e && "function" != typeof e) return f;
3551 if (o = t ? n : r) {
3552 if (o.has(e)) return o.get(e);
3553 o.set(e, f);
3554 }
3555 for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
3556 return f;
3557 })(e, t);
3558 }
3559 var matchesSelectorFunc = "";
3560 function matchesSelector(el, selector) {
3561 if (!matchesSelectorFunc) matchesSelectorFunc = (0, _shims.findInArray)([
3562 "matches",
3563 "webkitMatchesSelector",
3564 "mozMatchesSelector",
3565 "msMatchesSelector",
3566 "oMatchesSelector"
3567 ], function(method) {
3568 return (0, _shims.isFunction)(el[method]);
3569 });
3570 if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false;
3571 return el[matchesSelectorFunc](selector);
3572 }
3573 function matchesSelectorAndParentsTo(el, selector, baseNode) {
3574 let node = el;
3575 do {
3576 if (matchesSelector(node, selector)) return true;
3577 if (node === baseNode) return false;
3578 node = node.parentNode;
3579 } while (node);
3580 return false;
3581 }
3582 function addEvent(el, event, handler, inputOptions) {
3583 if (!el) return;
3584 const options = _objectSpread2({ capture: true }, inputOptions);
3585 if (el.addEventListener) el.addEventListener(event, handler, options);
3586 else if (el.attachEvent) el.attachEvent("on" + event, handler);
3587 else el["on" + event] = handler;
3588 }
3589 function removeEvent(el, event, handler, inputOptions) {
3590 if (!el) return;
3591 const options = _objectSpread2({ capture: true }, inputOptions);
3592 if (el.removeEventListener) el.removeEventListener(event, handler, options);
3593 else if (el.detachEvent) el.detachEvent("on" + event, handler);
3594 else el["on" + event] = null;
3595 }
3596 function outerHeight(node) {
3597 let height = node.clientHeight;
3598 const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
3599 height += (0, _shims.int)(computedStyle.borderTopWidth);
3600 height += (0, _shims.int)(computedStyle.borderBottomWidth);
3601 return height;
3602 }
3603 function outerWidth(node) {
3604 let width = node.clientWidth;
3605 const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
3606 width += (0, _shims.int)(computedStyle.borderLeftWidth);
3607 width += (0, _shims.int)(computedStyle.borderRightWidth);
3608 return width;
3609 }
3610 function innerHeight(node) {
3611 let height = node.clientHeight;
3612 const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
3613 height -= (0, _shims.int)(computedStyle.paddingTop);
3614 height -= (0, _shims.int)(computedStyle.paddingBottom);
3615 return height;
3616 }
3617 function innerWidth(node) {
3618 let width = node.clientWidth;
3619 const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
3620 width -= (0, _shims.int)(computedStyle.paddingLeft);
3621 width -= (0, _shims.int)(computedStyle.paddingRight);
3622 return width;
3623 }
3624 function offsetXYFromParent(evt, offsetParent, scale) {
3625 const offsetParentRect = offsetParent === offsetParent.ownerDocument.body ? {
3626 left: 0,
3627 top: 0
3628 } : offsetParent.getBoundingClientRect();
3629 return {
3630 x: (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale,
3631 y: (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale
3632 };
3633 }
3634 function createCSSTransform(controlPos, positionOffset) {
3635 const translation = getTranslation(controlPos, positionOffset, "px");
3636 return { [(0, _getPrefix.browserPrefixToKey)("transform", _getPrefix.default)]: translation };
3637 }
3638 function createSVGTransform(controlPos, positionOffset) {
3639 return getTranslation(controlPos, positionOffset, "");
3640 }
3641 function getTranslation(_ref, positionOffset, unitSuffix) {
3642 let { x, y } = _ref;
3643 let translation = `translate(${x}${unitSuffix},${y}${unitSuffix})`;
3644 if (positionOffset) translation = `translate(${`${typeof positionOffset.x === "string" ? positionOffset.x : positionOffset.x + unitSuffix}`}, ${`${typeof positionOffset.y === "string" ? positionOffset.y : positionOffset.y + unitSuffix}`})` + translation;
3645 return translation;
3646 }
3647 function getTouch(e, identifier) {
3648 return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, (t) => identifier === t.identifier) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, (t) => identifier === t.identifier);
3649 }
3650 function getTouchIdentifier(e) {
3651 if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
3652 if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
3653 }
3654 function addUserSelectStyles(doc) {
3655 if (!doc) return;
3656 let styleEl = doc.getElementById("react-draggable-style-el");
3657 if (!styleEl) {
3658 styleEl = doc.createElement("style");
3659 styleEl.type = "text/css";
3660 styleEl.id = "react-draggable-style-el";
3661 styleEl.innerHTML = ".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n";
3662 styleEl.innerHTML += ".react-draggable-transparent-selection *::selection {all: inherit;}\n";
3663 doc.getElementsByTagName("head")[0].appendChild(styleEl);
3664 }
3665 if (doc.body) addClassName(doc.body, "react-draggable-transparent-selection");
3666 }
3667 function scheduleRemoveUserSelectStyles(doc) {
3668 if (window.requestAnimationFrame) window.requestAnimationFrame(() => {
3669 removeUserSelectStyles(doc);
3670 });
3671 else removeUserSelectStyles(doc);
3672 }
3673 function removeUserSelectStyles(doc) {
3674 if (!doc) return;
3675 try {
3676 if (doc.body) removeClassName(doc.body, "react-draggable-transparent-selection");
3677 if (doc.selection) doc.selection.empty();
3678 else {
3679 const selection = (doc.defaultView || window).getSelection();
3680 if (selection && selection.type !== "Caret") selection.removeAllRanges();
3681 }
3682 } catch (e) {}
3683 }
3684 function addClassName(el, className) {
3685 if (el.classList) el.classList.add(className);
3686 else if (!el.className.match(new RegExp(`(?:^|\\s)${className}(?!\\S)`))) el.className += ` ${className}`;
3687 }
3688 function removeClassName(el, className) {
3689 if (el.classList) el.classList.remove(className);
3690 else el.className = el.className.replace(new RegExp(`(?:^|\\s)${className}(?!\\S)`, "g"), "");
3691 }
3692 }));
3693
3694 //#endregion
3695 //#region node_modules/react-draggable/build/cjs/utils/positionFns.js
3696 var require_positionFns = /* @__PURE__ */ __commonJSMin(((exports) => {
3697 Object.defineProperty(exports, "__esModule", { value: true });
3698 exports.canDragX = canDragX;
3699 exports.canDragY = canDragY;
3700 exports.createCoreData = createCoreData;
3701 exports.createDraggableData = createDraggableData;
3702 exports.getBoundPosition = getBoundPosition;
3703 exports.getControlPosition = getControlPosition;
3704 exports.snapToGrid = snapToGrid;
3705 var _shims = require_shims();
3706 var _domFns = require_domFns();
3707 function getBoundPosition(draggable, x, y) {
3708 if (!draggable.props.bounds) return [x, y];
3709 let { bounds } = draggable.props;
3710 bounds = typeof bounds === "string" ? bounds : cloneBounds(bounds);
3711 const node = findDOMNode(draggable);
3712 if (typeof bounds === "string") {
3713 const { ownerDocument } = node;
3714 const ownerWindow = ownerDocument.defaultView;
3715 let boundNode;
3716 if (bounds === "parent") boundNode = node.parentNode;
3717 else boundNode = node.getRootNode().querySelector(bounds);
3718 if (!(boundNode instanceof ownerWindow.HTMLElement)) throw new Error("Bounds selector \"" + bounds + "\" could not find an element.");
3719 const boundNodeEl = boundNode;
3720 const nodeStyle = ownerWindow.getComputedStyle(node);
3721 const boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl);
3722 bounds = {
3723 left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
3724 top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
3725 right: (0, _domFns.innerWidth)(boundNodeEl) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
3726 bottom: (0, _domFns.innerHeight)(boundNodeEl) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
3727 };
3728 }
3729 if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
3730 if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
3731 if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
3732 if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
3733 return [x, y];
3734 }
3735 function snapToGrid(grid, pendingX, pendingY) {
3736 return [Math.round(pendingX / grid[0]) * grid[0], Math.round(pendingY / grid[1]) * grid[1]];
3737 }
3738 function canDragX(draggable) {
3739 return draggable.props.axis === "both" || draggable.props.axis === "x";
3740 }
3741 function canDragY(draggable) {
3742 return draggable.props.axis === "both" || draggable.props.axis === "y";
3743 }
3744 function getControlPosition(e, touchIdentifier, draggableCore) {
3745 const touchObj = typeof touchIdentifier === "number" ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
3746 if (typeof touchIdentifier === "number" && !touchObj) return null;
3747 const node = findDOMNode(draggableCore);
3748 const offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
3749 return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent, draggableCore.props.scale);
3750 }
3751 function createCoreData(draggable, x, y) {
3752 const isStart = !(0, _shims.isNum)(draggable.lastX);
3753 const node = findDOMNode(draggable);
3754 if (isStart) return {
3755 node,
3756 deltaX: 0,
3757 deltaY: 0,
3758 lastX: x,
3759 lastY: y,
3760 x,
3761 y
3762 };
3763 else return {
3764 node,
3765 deltaX: x - draggable.lastX,
3766 deltaY: y - draggable.lastY,
3767 lastX: draggable.lastX,
3768 lastY: draggable.lastY,
3769 x,
3770 y
3771 };
3772 }
3773 function createDraggableData(draggable, coreData) {
3774 const scale = draggable.props.scale;
3775 return {
3776 node: coreData.node,
3777 x: draggable.state.x + coreData.deltaX / scale,
3778 y: draggable.state.y + coreData.deltaY / scale,
3779 deltaX: coreData.deltaX / scale,
3780 deltaY: coreData.deltaY / scale,
3781 lastX: draggable.state.x,
3782 lastY: draggable.state.y
3783 };
3784 }
3785 function cloneBounds(bounds) {
3786 return {
3787 left: bounds.left,
3788 top: bounds.top,
3789 right: bounds.right,
3790 bottom: bounds.bottom
3791 };
3792 }
3793 function findDOMNode(draggable) {
3794 const node = draggable.findDOMNode();
3795 if (!node) throw new Error("<DraggableCore>: Unmounted during event!");
3796 return node;
3797 }
3798 }));
3799
3800 //#endregion
3801 //#region node_modules/react-draggable/build/cjs/utils/log.js
3802 var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
3803 Object.defineProperty(exports, "__esModule", { value: true });
3804 exports.default = log;
3805 function log() {}
3806 }));
3807
3808 //#endregion
3809 //#region node_modules/react-draggable/build/cjs/DraggableCore.js
3810 var require_DraggableCore = /* @__PURE__ */ __commonJSMin(((exports) => {
3811 Object.defineProperty(exports, "__esModule", { value: true });
3812 exports.default = void 0;
3813 var React$128 = _interopRequireWildcard((globalThis.React));
3814 var _propTypes = _interopRequireDefault(require_prop_types());
3815 var _reactDom$1 = _interopRequireDefault((globalThis.ReactDOM));
3816 var _domFns = require_domFns();
3817 var _positionFns = require_positionFns();
3818 var _shims = require_shims();
3819 var _log = _interopRequireDefault(require_log());
3820 function _interopRequireDefault(e) {
3821 return e && e.__esModule ? e : { default: e };
3822 }
3823 function _interopRequireWildcard(e, t) {
3824 if ("function" == typeof WeakMap) {
3825 var r = /* @__PURE__ */ new WeakMap();
3826 var n = /* @__PURE__ */ new WeakMap();
3827 }
3828 return (_interopRequireWildcard = function(e, t) {
3829 if (!t && e && e.__esModule) return e;
3830 var o;
3831 var i;
3832 var f = {
3833 __proto__: null,
3834 default: e
3835 };
3836 if (null === e || "object" != typeof e && "function" != typeof e) return f;
3837 if (o = t ? n : r) {
3838 if (o.has(e)) return o.get(e);
3839 o.set(e, f);
3840 }
3841 for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
3842 return f;
3843 })(e, t);
3844 }
3845 function _defineProperty(e, r, t) {
3846 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
3847 value: t,
3848 enumerable: !0,
3849 configurable: !0,
3850 writable: !0
3851 }) : e[r] = t, e;
3852 }
3853 function _toPropertyKey(t) {
3854 var i = _toPrimitive(t, "string");
3855 return "symbol" == typeof i ? i : i + "";
3856 }
3857 function _toPrimitive(t, r) {
3858 if ("object" != typeof t || !t) return t;
3859 var e = t[Symbol.toPrimitive];
3860 if (void 0 !== e) {
3861 var i = e.call(t, r || "default");
3862 if ("object" != typeof i) return i;
3863 throw new TypeError("@@toPrimitive must return a primitive value.");
3864 }
3865 return ("string" === r ? String : Number)(t);
3866 }
3867 var eventsFor = {
3868 touch: {
3869 start: "touchstart",
3870 move: "touchmove",
3871 stop: "touchend"
3872 },
3873 mouse: {
3874 start: "mousedown",
3875 move: "mousemove",
3876 stop: "mouseup"
3877 }
3878 };
3879 var dragEventFor = eventsFor.mouse;
3880 var DraggableCore = class extends React$128.Component {
3881 constructor() {
3882 super(...arguments);
3883 _defineProperty(this, "dragging", false);
3884 _defineProperty(this, "lastX", NaN);
3885 _defineProperty(this, "lastY", NaN);
3886 _defineProperty(this, "touchIdentifier", null);
3887 _defineProperty(this, "mounted", false);
3888 _defineProperty(this, "handleDragStart", (e) => {
3889 this.props.onMouseDown(e);
3890 if (!this.props.allowAnyClick && typeof e.button === "number" && e.button !== 0) return false;
3891 const thisNode = this.findDOMNode();
3892 if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) throw new Error("<DraggableCore> not mounted on DragStart!");
3893 const { ownerDocument } = thisNode;
3894 if (this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, this.props.handle, thisNode) || this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, this.props.cancel, thisNode)) return;
3895 if (e.type === "touchstart" && !this.props.allowMobileScroll) e.preventDefault();
3896 const touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
3897 this.touchIdentifier = touchIdentifier;
3898 const position = (0, _positionFns.getControlPosition)(e, touchIdentifier, this);
3899 if (position == null) return;
3900 const { x, y } = position;
3901 const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
3902 (0, _log.default)("DraggableCore: handleDragStart: %j", coreEvent);
3903 (0, _log.default)("calling", this.props.onStart);
3904 if (this.props.onStart(e, coreEvent) === false || this.mounted === false) return;
3905 if (this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument);
3906 this.dragging = true;
3907 this.lastX = x;
3908 this.lastY = y;
3909 (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, this.handleDrag);
3910 (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, this.handleDragStop);
3911 });
3912 _defineProperty(this, "handleDrag", (e) => {
3913 const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this);
3914 if (position == null) return;
3915 let { x, y } = position;
3916 if (Array.isArray(this.props.grid)) {
3917 let deltaX = x - this.lastX;
3918 let deltaY = y - this.lastY;
3919 [deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
3920 if (!deltaX && !deltaY) return;
3921 x = this.lastX + deltaX, y = this.lastY + deltaY;
3922 }
3923 const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
3924 (0, _log.default)("DraggableCore: handleDrag: %j", coreEvent);
3925 if (this.props.onDrag(e, coreEvent) === false || this.mounted === false) {
3926 try {
3927 this.handleDragStop(new MouseEvent("mouseup"));
3928 } catch (err) {
3929 const event = document.createEvent("MouseEvents");
3930 event.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
3931 this.handleDragStop(event);
3932 }
3933 return;
3934 }
3935 this.lastX = x;
3936 this.lastY = y;
3937 });
3938 _defineProperty(this, "handleDragStop", (e) => {
3939 if (!this.dragging) return;
3940 const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this);
3941 if (position == null) return;
3942 let { x, y } = position;
3943 if (Array.isArray(this.props.grid)) {
3944 let deltaX = x - this.lastX || 0;
3945 let deltaY = y - this.lastY || 0;
3946 [deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
3947 x = this.lastX + deltaX, y = this.lastY + deltaY;
3948 }
3949 const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
3950 if (this.props.onStop(e, coreEvent) === false || this.mounted === false) return false;
3951 const thisNode = this.findDOMNode();
3952 if (thisNode) {
3953 if (this.props.enableUserSelectHack) (0, _domFns.scheduleRemoveUserSelectStyles)(thisNode.ownerDocument);
3954 }
3955 (0, _log.default)("DraggableCore: handleDragStop: %j", coreEvent);
3956 this.dragging = false;
3957 this.lastX = NaN;
3958 this.lastY = NaN;
3959 if (thisNode) {
3960 (0, _log.default)("DraggableCore: Removing handlers");
3961 (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, this.handleDrag);
3962 (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, this.handleDragStop);
3963 }
3964 });
3965 _defineProperty(this, "onMouseDown", (e) => {
3966 dragEventFor = eventsFor.mouse;
3967 return this.handleDragStart(e);
3968 });
3969 _defineProperty(this, "onMouseUp", (e) => {
3970 dragEventFor = eventsFor.mouse;
3971 return this.handleDragStop(e);
3972 });
3973 _defineProperty(this, "onTouchStart", (e) => {
3974 dragEventFor = eventsFor.touch;
3975 return this.handleDragStart(e);
3976 });
3977 _defineProperty(this, "onTouchEnd", (e) => {
3978 dragEventFor = eventsFor.touch;
3979 return this.handleDragStop(e);
3980 });
3981 }
3982 componentDidMount() {
3983 this.mounted = true;
3984 const thisNode = this.findDOMNode();
3985 if (thisNode) (0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, { passive: false });
3986 }
3987 componentWillUnmount() {
3988 this.mounted = false;
3989 const thisNode = this.findDOMNode();
3990 if (thisNode) {
3991 const { ownerDocument } = thisNode;
3992 (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
3993 (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
3994 (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
3995 (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
3996 (0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, { passive: false });
3997 if (this.props.enableUserSelectHack) (0, _domFns.scheduleRemoveUserSelectStyles)(ownerDocument);
3998 }
3999 }
4000 findDOMNode() {
4001 var _this$props;
4002 var _this$props2;
4003 return ((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.nodeRef) ? (_this$props2 = this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.nodeRef) === null || _this$props2 === void 0 ? void 0 : _this$props2.current : _reactDom$1.default.findDOMNode(this);
4004 }
4005 render() {
4006 return /*#__PURE__*/ React$128.cloneElement(React$128.Children.only(this.props.children), {
4007 onMouseDown: this.onMouseDown,
4008 onMouseUp: this.onMouseUp,
4009 onTouchEnd: this.onTouchEnd
4010 });
4011 }
4012 };
4013 exports.default = DraggableCore;
4014 _defineProperty(DraggableCore, "displayName", "DraggableCore");
4015 _defineProperty(DraggableCore, "propTypes", {
4016 /**
4017 * `allowAnyClick` allows dragging using any mouse button.
4018 * By default, we only accept the left button.
4019 *
4020 * Defaults to `false`.
4021 */
4022 allowAnyClick: _propTypes.default.bool,
4023 /**
4024 * `allowMobileScroll` turns off cancellation of the 'touchstart' event
4025 * on mobile devices. Only enable this if you are having trouble with click
4026 * events. Prefer using 'handle' / 'cancel' instead.
4027 *
4028 * Defaults to `false`.
4029 */
4030 allowMobileScroll: _propTypes.default.bool,
4031 children: _propTypes.default.node.isRequired,
4032 /**
4033 * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
4034 * with the exception of `onMouseDown`, will not fire.
4035 */
4036 disabled: _propTypes.default.bool,
4037 /**
4038 * By default, we add 'user-select:none' attributes to the document body
4039 * to prevent ugly text selection during drag. If this is causing problems
4040 * for your app, set this to `false`.
4041 */
4042 enableUserSelectHack: _propTypes.default.bool,
4043 /**
4044 * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
4045 * instead of using the parent node.
4046 */
4047 offsetParent: function(props, propName) {
4048 if (props[propName] && props[propName].nodeType !== 1) throw new Error("Draggable's offsetParent must be a DOM Node.");
4049 },
4050 /**
4051 * `grid` specifies the x and y that dragging should snap to.
4052 */
4053 grid: _propTypes.default.arrayOf(_propTypes.default.number),
4054 /**
4055 * `handle` specifies a selector to be used as the handle that initiates drag.
4056 *
4057 * Example:
4058 *
4059 * ```jsx
4060 * let App = React.createClass({
4061 * render: function () {
4062 * return (
4063 * <Draggable handle=".handle">
4064 * <div>
4065 * <div className="handle">Click me to drag</div>
4066 * <div>This is some other content</div>
4067 * </div>
4068 * </Draggable>
4069 * );
4070 * }
4071 * });
4072 * ```
4073 */
4074 handle: _propTypes.default.string,
4075 /**
4076 * `cancel` specifies a selector to be used to prevent drag initialization.
4077 *
4078 * Example:
4079 *
4080 * ```jsx
4081 * let App = React.createClass({
4082 * render: function () {
4083 * return(
4084 * <Draggable cancel=".cancel">
4085 * <div>
4086 * <div className="cancel">You can't drag from here</div>
4087 * <div>Dragging here works fine</div>
4088 * </div>
4089 * </Draggable>
4090 * );
4091 * }
4092 * });
4093 * ```
4094 */
4095 cancel: _propTypes.default.string,
4096 nodeRef: _propTypes.default.object,
4097 /**
4098 * Called when dragging starts.
4099 * If this function returns the boolean false, dragging will be canceled.
4100 */
4101 onStart: _propTypes.default.func,
4102 /**
4103 * Called while dragging.
4104 * If this function returns the boolean false, dragging will be canceled.
4105 */
4106 onDrag: _propTypes.default.func,
4107 /**
4108 * Called when dragging stops.
4109 * If this function returns the boolean false, the drag will remain active.
4110 */
4111 onStop: _propTypes.default.func,
4112 /**
4113 * A workaround option which can be passed if onMouseDown needs to be accessed,
4114 * since it'll always be blocked (as there is internal use of onMouseDown)
4115 */
4116 onMouseDown: _propTypes.default.func,
4117 /**
4118 * `scale`, if set, applies scaling while dragging an element
4119 */
4120 scale: _propTypes.default.number,
4121 /**
4122 * These properties should be defined on the child, not here.
4123 */
4124 className: _shims.dontSetMe,
4125 style: _shims.dontSetMe,
4126 transform: _shims.dontSetMe
4127 });
4128 _defineProperty(DraggableCore, "defaultProps", {
4129 allowAnyClick: false,
4130 allowMobileScroll: false,
4131 disabled: false,
4132 enableUserSelectHack: true,
4133 onStart: function() {},
4134 onDrag: function() {},
4135 onStop: function() {},
4136 onMouseDown: function() {},
4137 scale: 1
4138 });
4139 }));
4140
4141 //#endregion
4142 //#region node_modules/react-draggable/build/cjs/Draggable.js
4143 var require_Draggable = /* @__PURE__ */ __commonJSMin(((exports) => {
4144 init_objectSpread2();
4145 init_objectWithoutProperties();
4146 var _excluded = [
4147 "axis",
4148 "bounds",
4149 "children",
4150 "defaultPosition",
4151 "defaultClassName",
4152 "defaultClassNameDragging",
4153 "defaultClassNameDragged",
4154 "position",
4155 "positionOffset",
4156 "scale"
4157 ];
4158 Object.defineProperty(exports, "__esModule", { value: true });
4159 Object.defineProperty(exports, "DraggableCore", {
4160 enumerable: true,
4161 get: function() {
4162 return _DraggableCore.default;
4163 }
4164 });
4165 exports.default = void 0;
4166 var React$127 = _interopRequireWildcard((globalThis.React));
4167 var _propTypes = _interopRequireDefault(require_prop_types());
4168 var _reactDom = _interopRequireDefault((globalThis.ReactDOM));
4169 var _clsx = require_clsx();
4170 var _domFns = require_domFns();
4171 var _positionFns = require_positionFns();
4172 var _shims = require_shims();
4173 var _DraggableCore = _interopRequireDefault(require_DraggableCore());
4174 var _log = _interopRequireDefault(require_log());
4175 function _interopRequireDefault(e) {
4176 return e && e.__esModule ? e : { default: e };
4177 }
4178 function _interopRequireWildcard(e, t) {
4179 if ("function" == typeof WeakMap) {
4180 var r = /* @__PURE__ */ new WeakMap();
4181 var n = /* @__PURE__ */ new WeakMap();
4182 }
4183 return (_interopRequireWildcard = function(e, t) {
4184 if (!t && e && e.__esModule) return e;
4185 var o;
4186 var i;
4187 var f = {
4188 __proto__: null,
4189 default: e
4190 };
4191 if (null === e || "object" != typeof e && "function" != typeof e) return f;
4192 if (o = t ? n : r) {
4193 if (o.has(e)) return o.get(e);
4194 o.set(e, f);
4195 }
4196 for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
4197 return f;
4198 })(e, t);
4199 }
4200 function _extends() {
4201 return _extends = Object.assign ? Object.assign.bind() : function(n) {
4202 for (var e = 1; e < arguments.length; e++) {
4203 var t = arguments[e];
4204 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
4205 }
4206 return n;
4207 }, _extends.apply(null, arguments);
4208 }
4209 function _defineProperty(e, r, t) {
4210 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
4211 value: t,
4212 enumerable: !0,
4213 configurable: !0,
4214 writable: !0
4215 }) : e[r] = t, e;
4216 }
4217 function _toPropertyKey(t) {
4218 var i = _toPrimitive(t, "string");
4219 return "symbol" == typeof i ? i : i + "";
4220 }
4221 function _toPrimitive(t, r) {
4222 if ("object" != typeof t || !t) return t;
4223 var e = t[Symbol.toPrimitive];
4224 if (void 0 !== e) {
4225 var i = e.call(t, r || "default");
4226 if ("object" != typeof i) return i;
4227 throw new TypeError("@@toPrimitive must return a primitive value.");
4228 }
4229 return ("string" === r ? String : Number)(t);
4230 }
4231 var Draggable = class extends React$127.Component {
4232 static getDerivedStateFromProps(_ref, _ref2) {
4233 let { position } = _ref;
4234 let { prevPropsPosition } = _ref2;
4235 if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
4236 (0, _log.default)("Draggable: getDerivedStateFromProps %j", {
4237 position,
4238 prevPropsPosition
4239 });
4240 return {
4241 x: position.x,
4242 y: position.y,
4243 prevPropsPosition: _objectSpread2({}, position)
4244 };
4245 }
4246 return null;
4247 }
4248 constructor(props) {
4249 super(props);
4250 _defineProperty(this, "onDragStart", (e, coreData) => {
4251 (0, _log.default)("Draggable: onDragStart: %j", coreData);
4252 if (this.props.onStart(e, (0, _positionFns.createDraggableData)(this, coreData)) === false) return false;
4253 this.setState({
4254 dragging: true,
4255 dragged: true
4256 });
4257 });
4258 _defineProperty(this, "onDrag", (e, coreData) => {
4259 if (!this.state.dragging) return false;
4260 (0, _log.default)("Draggable: onDrag: %j", coreData);
4261 const uiData = (0, _positionFns.createDraggableData)(this, coreData);
4262 const newState = {
4263 x: uiData.x,
4264 y: uiData.y,
4265 slackX: 0,
4266 slackY: 0
4267 };
4268 if (this.props.bounds) {
4269 const { x, y } = newState;
4270 newState.x += this.state.slackX;
4271 newState.y += this.state.slackY;
4272 const [newStateX, newStateY] = (0, _positionFns.getBoundPosition)(this, newState.x, newState.y);
4273 newState.x = newStateX;
4274 newState.y = newStateY;
4275 newState.slackX = this.state.slackX + (x - newState.x);
4276 newState.slackY = this.state.slackY + (y - newState.y);
4277 uiData.x = newState.x;
4278 uiData.y = newState.y;
4279 uiData.deltaX = newState.x - this.state.x;
4280 uiData.deltaY = newState.y - this.state.y;
4281 }
4282 if (this.props.onDrag(e, uiData) === false) return false;
4283 this.setState(newState);
4284 });
4285 _defineProperty(this, "onDragStop", (e, coreData) => {
4286 if (!this.state.dragging) return false;
4287 if (this.props.onStop(e, (0, _positionFns.createDraggableData)(this, coreData)) === false) return false;
4288 (0, _log.default)("Draggable: onDragStop: %j", coreData);
4289 const newState = {
4290 dragging: false,
4291 slackX: 0,
4292 slackY: 0
4293 };
4294 if (Boolean(this.props.position)) {
4295 const { x, y } = this.props.position;
4296 newState.x = x;
4297 newState.y = y;
4298 }
4299 this.setState(newState);
4300 });
4301 this.state = {
4302 dragging: false,
4303 dragged: false,
4304 x: props.position ? props.position.x : props.defaultPosition.x,
4305 y: props.position ? props.position.y : props.defaultPosition.y,
4306 prevPropsPosition: _objectSpread2({}, props.position),
4307 slackX: 0,
4308 slackY: 0,
4309 isElementSVG: false
4310 };
4311 if (props.position && !(props.onDrag || props.onStop)) console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
4312 }
4313 componentDidMount() {
4314 if (typeof window.SVGElement !== "undefined" && this.findDOMNode() instanceof window.SVGElement) this.setState({ isElementSVG: true });
4315 }
4316 componentWillUnmount() {
4317 if (this.state.dragging) this.setState({ dragging: false });
4318 }
4319 findDOMNode() {
4320 var _this$props$nodeRef$c;
4321 var _this$props;
4322 return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 || (_this$props = _this$props.nodeRef) === null || _this$props === void 0 ? void 0 : _this$props.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom.default.findDOMNode(this);
4323 }
4324 render() {
4325 const _this$props2 = this.props, { axis, bounds, children, defaultPosition, defaultClassName, defaultClassNameDragging, defaultClassNameDragged, position, positionOffset, scale } = _this$props2, draggableCoreProps = _objectWithoutProperties(_this$props2, _excluded);
4326 let style = {};
4327 let svgTransform = null;
4328 const draggable = !Boolean(position) || this.state.dragging;
4329 const validPosition = position || defaultPosition;
4330 const transformOpts = {
4331 x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : validPosition.x,
4332 y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : validPosition.y
4333 };
4334 if (this.state.isElementSVG) svgTransform = (0, _domFns.createSVGTransform)(transformOpts, positionOffset);
4335 else style = (0, _domFns.createCSSTransform)(transformOpts, positionOffset);
4336 const className = (0, _clsx.clsx)(children.props.className || "", defaultClassName, {
4337 [defaultClassNameDragging]: this.state.dragging,
4338 [defaultClassNameDragged]: this.state.dragged
4339 });
4340 return /*#__PURE__*/ React$127.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
4341 onStart: this.onDragStart,
4342 onDrag: this.onDrag,
4343 onStop: this.onDragStop
4344 }), /*#__PURE__*/ React$127.cloneElement(React$127.Children.only(children), {
4345 className,
4346 style: _objectSpread2(_objectSpread2({}, children.props.style), style),
4347 transform: svgTransform
4348 }));
4349 }
4350 };
4351 exports.default = Draggable;
4352 _defineProperty(Draggable, "displayName", "Draggable");
4353 _defineProperty(Draggable, "propTypes", _objectSpread2(_objectSpread2({}, _DraggableCore.default.propTypes), {}, {
4354 /**
4355 * `axis` determines which axis the draggable can move.
4356 *
4357 * Note that all callbacks will still return data as normal. This only
4358 * controls flushing to the DOM.
4359 *
4360 * 'both' allows movement horizontally and vertically.
4361 * 'x' limits movement to horizontal axis.
4362 * 'y' limits movement to vertical axis.
4363 * 'none' limits all movement.
4364 *
4365 * Defaults to 'both'.
4366 */
4367 axis: _propTypes.default.oneOf([
4368 "both",
4369 "x",
4370 "y",
4371 "none"
4372 ]),
4373 /**
4374 * `bounds` determines the range of movement available to the element.
4375 * Available values are:
4376 *
4377 * 'parent' restricts movement within the Draggable's parent node.
4378 *
4379 * Alternatively, pass an object with the following properties, all of which are optional:
4380 *
4381 * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
4382 *
4383 * All values are in px.
4384 *
4385 * Example:
4386 *
4387 * ```jsx
4388 * let App = React.createClass({
4389 * render: function () {
4390 * return (
4391 * <Draggable bounds={{right: 300, bottom: 300}}>
4392 * <div>Content</div>
4393 * </Draggable>
4394 * );
4395 * }
4396 * });
4397 * ```
4398 */
4399 bounds: _propTypes.default.oneOfType([
4400 _propTypes.default.shape({
4401 left: _propTypes.default.number,
4402 right: _propTypes.default.number,
4403 top: _propTypes.default.number,
4404 bottom: _propTypes.default.number
4405 }),
4406 _propTypes.default.string,
4407 _propTypes.default.oneOf([false])
4408 ]),
4409 defaultClassName: _propTypes.default.string,
4410 defaultClassNameDragging: _propTypes.default.string,
4411 defaultClassNameDragged: _propTypes.default.string,
4412 /**
4413 * `defaultPosition` specifies the x and y that the dragged item should start at
4414 *
4415 * Example:
4416 *
4417 * ```jsx
4418 * let App = React.createClass({
4419 * render: function () {
4420 * return (
4421 * <Draggable defaultPosition={{x: 25, y: 25}}>
4422 * <div>I start with transformX: 25px and transformY: 25px;</div>
4423 * </Draggable>
4424 * );
4425 * }
4426 * });
4427 * ```
4428 */
4429 defaultPosition: _propTypes.default.shape({
4430 x: _propTypes.default.number,
4431 y: _propTypes.default.number
4432 }),
4433 positionOffset: _propTypes.default.shape({
4434 x: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
4435 y: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
4436 }),
4437 /**
4438 * `position`, if present, defines the current position of the element.
4439 *
4440 * This is similar to how form elements in React work - if no `position` is supplied, the component
4441 * is uncontrolled.
4442 *
4443 * Example:
4444 *
4445 * ```jsx
4446 * let App = React.createClass({
4447 * render: function () {
4448 * return (
4449 * <Draggable position={{x: 25, y: 25}}>
4450 * <div>I start with transformX: 25px and transformY: 25px;</div>
4451 * </Draggable>
4452 * );
4453 * }
4454 * });
4455 * ```
4456 */
4457 position: _propTypes.default.shape({
4458 x: _propTypes.default.number,
4459 y: _propTypes.default.number
4460 }),
4461 /**
4462 * These properties should be defined on the child, not here.
4463 */
4464 className: _shims.dontSetMe,
4465 style: _shims.dontSetMe,
4466 transform: _shims.dontSetMe
4467 }));
4468 _defineProperty(Draggable, "defaultProps", _objectSpread2(_objectSpread2({}, _DraggableCore.default.defaultProps), {}, {
4469 axis: "both",
4470 bounds: false,
4471 defaultClassName: "react-draggable",
4472 defaultClassNameDragging: "react-draggable-dragging",
4473 defaultClassNameDragged: "react-draggable-dragged",
4474 defaultPosition: {
4475 x: 0,
4476 y: 0
4477 },
4478 scale: 1
4479 }));
4480 }));
4481
4482 //#endregion
4483 //#region node_modules/react-draggable/build/cjs/cjs.js
4484 var require_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4485 var { default: Draggable, DraggableCore } = require_Draggable();
4486 module.exports = Draggable;
4487 module.exports.default = Draggable;
4488 module.exports.DraggableCore = DraggableCore;
4489 }));
4490
4491 //#endregion
4492 //#region modules/ai/assets/js/editor/components/prompt-dialog.js
4493 init_extends();
4494 init_defineProperty$1();
4495 init_slicedToArray();
4496 var import_cjs = /* @__PURE__ */ __toESM(require_cjs());
4497 function ownKeys$25(e, r) {
4498 var t = Object.keys(e);
4499 if (Object.getOwnPropertySymbols) {
4500 var o = Object.getOwnPropertySymbols(e);
4501 r && (o = o.filter(function(r) {
4502 return Object.getOwnPropertyDescriptor(e, r).enumerable;
4503 })), t.push.apply(t, o);
4504 }
4505 return t;
4506 }
4507 __name(ownKeys$25, "ownKeys");
4508 function _objectSpread$25(e) {
4509 for (var r = 1; r < arguments.length; r++) {
4510 var t = null != arguments[r] ? arguments[r] : {};
4511 r % 2 ? ownKeys$25(Object(t), !0).forEach(function(r) {
4512 _defineProperty$1(e, r, t[r]);
4513 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$25(Object(t)).forEach(function(r) {
4514 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
4515 });
4516 }
4517 return e;
4518 }
4519 __name(_objectSpread$25, "_objectSpread");
4520 var DraggablePaper = function DraggablePaper(props) {
4521 var _useState2 = _slicedToArray((0, react.useState)({
4522 x: 0,
4523 y: 0
4524 }), 2);
4525 var position = _useState2[0];
4526 var setPosition = _useState2[1];
4527 var paperRef = (0, react.useRef)(null);
4528 var timeout = (0, react.useRef)(null);
4529 var onDrag = function onDrag(_e, _ref) {
4530 var x = _ref.x;
4531 var y = _ref.y;
4532 return setPosition({
4533 x,
4534 y
4535 });
4536 };
4537 var handlePositionBoundaries = function handlePositionBoundaries() {
4538 clearTimeout(timeout.current);
4539 timeout.current = setTimeout(function() {
4540 var _paperRef$current;
4541 var dialogTop = (_paperRef$current = paperRef.current) === null || _paperRef$current === void 0 ? void 0 : _paperRef$current.getBoundingClientRect().top;
4542 if (dialogTop < 0) setPosition(function(prev) {
4543 return _objectSpread$25(_objectSpread$25({}, prev), {}, { y: prev.y - dialogTop });
4544 });
4545 }, 50);
4546 };
4547 (0, react.useEffect)(function() {
4548 var resizeObserver = new ResizeObserver(handlePositionBoundaries);
4549 resizeObserver.observe(paperRef.current);
4550 return function() {
4551 resizeObserver.disconnect();
4552 };
4553 }, []);
4554 return /*#__PURE__*/ react.default.createElement(import_cjs.default, {
4555 position,
4556 onDrag,
4557 handle: ".MuiAppBar-root",
4558 cancel: "[class*=\"MuiDialogContent-root\"]",
4559 bounds: "parent"
4560 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Paper, _extends$1({}, props, { ref: paperRef })));
4561 };
4562 var PromptDialog = function PromptDialog(props) {
4563 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, _extends$1({
4564 scroll: "paper",
4565 open: true,
4566 fullWidth: true,
4567 hideBackdrop: true,
4568 PaperComponent: DraggablePaper,
4569 disableScrollLock: true,
4570 sx: { "& .MuiDialog-container": {
4571 alignItems: "flex-start",
4572 mt: "18vh"
4573 } },
4574 PaperProps: { sx: {
4575 m: 0,
4576 maxHeight: "76vh"
4577 } }
4578 }, props), props.children);
4579 };
4580 PromptDialog.propTypes = {
4581 onClose: import_prop_types$8.default.func.isRequired,
4582 children: import_prop_types$8.default.node,
4583 maxWidth: import_prop_types$8.default.oneOf([
4584 "xs",
4585 "sm",
4586 "md",
4587 "lg",
4588 "xl",
4589 false
4590 ])
4591 };
4592 PromptDialog.Header = DialogHeader$1;
4593 PromptDialog.Content = _elementor_ui.DialogContent;
4594
4595 //#endregion
4596 //#region modules/ai/assets/js/editor/components/upgrade-chip.js
4597 init_slicedToArray();
4598 var popoverId$1 = "e-ai-upgrade-popover";
4599 var StyledContent$3 = (0, _elementor_ui.styled)(_elementor_ui.Paper)(function(_ref) {
4600 var theme = _ref.theme;
4601 return {
4602 position: "relative",
4603 "[data-popper-placement=\"top\"] &": { marginBottom: theme.spacing(2.5) },
4604 "[data-popper-placement=\"bottom\"] &": { marginTop: theme.spacing(2.5) },
4605 padding: theme.spacing(3),
4606 boxShadow: theme.shadows[4],
4607 zIndex: "9999"
4608 };
4609 });
4610 var StyledArrow$1 = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref2) {
4611 var theme = _ref2.theme;
4612 return {
4613 width: theme.spacing(5),
4614 height: theme.spacing(2.5),
4615 position: "absolute",
4616 overflow: "hidden",
4617 left: "50% !important",
4618 transform: "translateX(-50%) rotate(var(--rotate, 0deg)) !important",
4619 "[data-popper-placement=\"top\"] &": { top: "100%" },
4620 "[data-popper-placement=\"bottom\"] &": {
4621 "--rotate": "180deg",
4622 top: "calc(".concat(theme.spacing(2.5), " * -1)")
4623 },
4624 "&::after": {
4625 backgroundColor: theme.palette.background.paper,
4626 content: "\"\"",
4627 display: "block",
4628 position: "absolute",
4629 width: theme.spacing(2.5),
4630 height: theme.spacing(2.5),
4631 top: 0,
4632 left: "50%",
4633 transform: "translateX(-50%) translateY(-50%) rotate(45deg)",
4634 boxShadow: "1px 1px 5px 0px rgba(0, 0, 0, 0.2)",
4635 backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"
4636 }
4637 };
4638 });
4639 var upgradeBullets = [
4640 (0, _wordpress_i18n.__)("Get spot-on suggestions from AI Copilot and AI Context with appropriate designs, layouts, and content for your business.", "elementor"),
4641 (0, _wordpress_i18n.__)("Generate professional texts about any topic, in any tone.", "elementor"),
4642 (0, _wordpress_i18n.__)("Effortlessly create or enhance stunning images and bring your ideas to life.", "elementor"),
4643 (0, _wordpress_i18n.__)("Unleash infinite possibilities with the custom code generator.", "elementor"),
4644 (0, _wordpress_i18n.__)("Access 30-days of AI History with the AI Starter plan and 90-days with the Power plan.", "elementor")
4645 ];
4646 var Chip$2 = (0, _elementor_ui.styled)(_elementor_ui.Chip)(function() {
4647 return {
4648 "& .MuiChip-label": { lineHeight: 1.5 },
4649 "& .MuiSvgIcon-root.MuiChip-icon": { fontSize: "1.25rem" }
4650 };
4651 });
4652 var UpgradeChip = function UpgradeChip(_ref3) {
4653 var _ref3$hasSubscription = _ref3.hasSubscription;
4654 var hasSubscription = _ref3$hasSubscription === void 0 ? false : _ref3$hasSubscription;
4655 var _ref3$usagePercentage = _ref3.usagePercentage;
4656 var usagePercentage = _ref3$usagePercentage === void 0 ? 0 : _ref3$usagePercentage;
4657 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
4658 var isPopoverOpen = _useState2[0];
4659 var setIsPopoverOpen = _useState2[1];
4660 var anchorEl = (0, react.useRef)(null);
4661 var arrowEl = (0, react.useRef)(null);
4662 var showPopover = function showPopover() {
4663 return setIsPopoverOpen(true);
4664 };
4665 var hidePopover = function hidePopover() {
4666 return setIsPopoverOpen(false);
4667 };
4668 var actionUrl = "https://go.elementor.com/ai-popup-purchase-dropdown/";
4669 if (hasSubscription) actionUrl = usagePercentage >= 100 ? "https://go.elementor.com/ai-popup-upgrade-limit-reached/" : "https://go.elementor.com/ai-popup-upgrade-limit-reached-80-percent/";
4670 var actionLabel = hasSubscription ? (0, _wordpress_i18n.__)("Upgrade Elementor AI", "elementor") : (0, _wordpress_i18n.__)("Get Elementor AI", "elementor");
4671 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
4672 component: "span",
4673 "aria-owns": isPopoverOpen ? popoverId$1 : void 0,
4674 "aria-haspopup": "true",
4675 onMouseEnter: showPopover,
4676 onMouseLeave: hidePopover,
4677 ref: anchorEl,
4678 display: "flex",
4679 alignItems: "center"
4680 }, /*#__PURE__*/ react.default.createElement(Chip$2, {
4681 color: "promotion",
4682 label: (0, _wordpress_i18n.__)("Upgrade", "elementor"),
4683 icon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, null),
4684 size: "small"
4685 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popper, {
4686 open: isPopoverOpen,
4687 anchorEl: anchorEl.current,
4688 sx: {
4689 zIndex: "170001",
4690 maxWidth: 300
4691 },
4692 modifiers: [{
4693 name: "arrow",
4694 enabled: true,
4695 options: { element: arrowEl.current }
4696 }]
4697 }, /*#__PURE__*/ react.default.createElement(StyledContent$3, null, /*#__PURE__*/ react.default.createElement(StyledArrow$1, { ref: arrowEl }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
4698 variant: "h5",
4699 color: "text.primary"
4700 }, (0, _wordpress_i18n.__)("Unlimited access to Elementor AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.List, { sx: { mb: 1 } }, upgradeBullets.map(function(bullet, index) {
4701 return /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItem, {
4702 key: index,
4703 disableGutters: true,
4704 sx: { alignItems: "flex-start" }
4705 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, null, /*#__PURE__*/ react.default.createElement(_elementor_icons.CheckedCircleIcon, null)), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, { sx: { m: 0 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body2" }, bullet)));
4706 })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
4707 variant: "contained",
4708 color: "promotion",
4709 size: "small",
4710 href: actionUrl,
4711 target: "_blank",
4712 startIcon: /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, null),
4713 sx: { "&:hover": { color: "promotion.contrastText" } }
4714 }, actionLabel))));
4715 };
4716 UpgradeChip.propTypes = {
4717 hasSubscription: import_prop_types$8.default.bool,
4718 usagePercentage: import_prop_types$8.default.number
4719 };
4720
4721 //#endregion
4722 //#region node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
4723 init_arrayLikeToArray();
4724 function _arrayWithoutHoles(r) {
4725 if (Array.isArray(r)) return _arrayLikeToArray$2(r);
4726 }
4727
4728 //#endregion
4729 //#region node_modules/@babel/runtime/helpers/esm/iterableToArray.js
4730 function _iterableToArray(r) {
4731 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
4732 }
4733
4734 //#endregion
4735 //#region node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
4736 function _nonIterableSpread() {
4737 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4738 }
4739
4740 //#endregion
4741 //#region node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
4742 init_unsupportedIterableToArray();
4743 function _toConsumableArray(r) {
4744 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
4745 }
4746
4747 //#endregion
4748 //#region modules/ai/assets/js/editor/pages/form-media/context/location-context.js
4749 init_slicedToArray();
4750 init_defineProperty$1();
4751 function ownKeys$24(e, r) {
4752 var t = Object.keys(e);
4753 if (Object.getOwnPropertySymbols) {
4754 var o = Object.getOwnPropertySymbols(e);
4755 r && (o = o.filter(function(r) {
4756 return Object.getOwnPropertyDescriptor(e, r).enumerable;
4757 })), t.push.apply(t, o);
4758 }
4759 return t;
4760 }
4761 __name(ownKeys$24, "ownKeys");
4762 function _objectSpread$24(e) {
4763 for (var r = 1; r < arguments.length; r++) {
4764 var t = null != arguments[r] ? arguments[r] : {};
4765 r % 2 ? ownKeys$24(Object(t), !0).forEach(function(r) {
4766 _defineProperty$1(e, r, t[r]);
4767 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$24(Object(t)).forEach(function(r) {
4768 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
4769 });
4770 }
4771 return e;
4772 }
4773 __name(_objectSpread$24, "_objectSpread");
4774 var RoutesContext = (0, react.createContext)(null);
4775 var NAVIGATE = "NAVIGATE";
4776 var BACK = "BACK";
4777 var initialValue$1 = {
4778 current: "",
4779 history: []
4780 };
4781 var reducer$2 = function reducer(state, _ref) {
4782 var type = _ref.type;
4783 var payload = _ref.payload;
4784 switch (type) {
4785 case NAVIGATE: return _objectSpread$24(_objectSpread$24({}, state), {}, {
4786 current: payload,
4787 history: [].concat(_toConsumableArray(state.history), [payload])
4788 });
4789 case BACK: return _objectSpread$24(_objectSpread$24({}, state), {}, {
4790 current: state.history[state.history.length - 2],
4791 history: state.history.slice(0, state.history.length - 1)
4792 });
4793 default: return state;
4794 }
4795 };
4796 var LocationProvider = function LocationProvider(_ref2) {
4797 var children = _ref2.children;
4798 var _useReducer2 = _slicedToArray((0, react.useReducer)(reducer$2, initialValue$1), 2);
4799 var state = _useReducer2[0];
4800 var dispatch = _useReducer2[1];
4801 return /*#__PURE__*/ react.default.createElement(RoutesContext.Provider, { value: {
4802 state,
4803 dispatch
4804 } }, children);
4805 };
4806 LocationProvider.propTypes = { children: import_prop_types$8.default.node };
4807 var useLocation = function useLocation() {
4808 var current = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}).current;
4809 var _useContext = (0, react.useContext)(RoutesContext);
4810 var state = _useContext.state;
4811 var dispatch = _useContext.dispatch;
4812 var navigate = function navigate(location) {
4813 dispatch({
4814 type: NAVIGATE,
4815 payload: location
4816 });
4817 };
4818 var back = function back() {
4819 dispatch({ type: BACK });
4820 };
4821 (0, react.useEffect)(function() {
4822 if (current) navigate(current);
4823 }, []);
4824 return {
4825 current: state.current,
4826 history: state.history,
4827 navigate,
4828 back
4829 };
4830 };
4831
4832 //#endregion
4833 //#region modules/ai/assets/js/editor/components/ui/panel.js
4834 init_extends();
4835 init_defineProperty$1();
4836 init_objectWithoutProperties$1();
4837 var _excluded$29 = ["sx"];
4838 function ownKeys$23(e, r) {
4839 var t = Object.keys(e);
4840 if (Object.getOwnPropertySymbols) {
4841 var o = Object.getOwnPropertySymbols(e);
4842 r && (o = o.filter(function(r) {
4843 return Object.getOwnPropertyDescriptor(e, r).enumerable;
4844 })), t.push.apply(t, o);
4845 }
4846 return t;
4847 }
4848 __name(ownKeys$23, "ownKeys");
4849 function _objectSpread$23(e) {
4850 for (var r = 1; r < arguments.length; r++) {
4851 var t = null != arguments[r] ? arguments[r] : {};
4852 r % 2 ? ownKeys$23(Object(t), !0).forEach(function(r) {
4853 _defineProperty$1(e, r, t[r]);
4854 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$23(Object(t)).forEach(function(r) {
4855 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
4856 });
4857 }
4858 return e;
4859 }
4860 __name(_objectSpread$23, "_objectSpread");
4861 var Panel = function Panel(_ref) {
4862 var _ref$sx = _ref.sx;
4863 var sx = _ref$sx === void 0 ? {} : _ref$sx;
4864 var props = _objectWithoutProperties$1(_ref, _excluded$29);
4865 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ sx: _objectSpread$23({
4866 p: 4,
4867 width: 360,
4868 flexShrink: 0,
4869 height: "100%",
4870 overflowY: "auto"
4871 }, sx) }, props), props.children), /*#__PURE__*/ react.default.createElement(_elementor_ui.Divider, { orientation: "vertical" }));
4872 };
4873 Panel.propTypes = {
4874 children: import_prop_types$8.default.node,
4875 sx: import_prop_types$8.default.object
4876 };
4877
4878 //#endregion
4879 //#region modules/ai/assets/js/editor/pages/form-media/components/generate-loader.js
4880 var GenerateLoader = function GenerateLoader() {
4881 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
4882 alignItems: "center",
4883 justifyContent: "center",
4884 gap: 2,
4885 width: "100%"
4886 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: {
4887 color: "text.primary",
4888 fontSize: "60px",
4889 mb: 1
4890 } }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
4891 variant: "h5",
4892 sx: { color: "text.primary" }
4893 }, (0, _wordpress_i18n.__)("Bringing your vision to life...", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body1" }, (0, _wordpress_i18n.__)("Hold tight, painting dreams might take a moment.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
4894 px: 1.5,
4895 py: 2.5,
4896 width: "100%",
4897 maxWidth: 600
4898 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.LinearProgress, { color: "inherit" })));
4899 };
4900
4901 //#endregion
4902 //#region modules/ai/assets/js/editor/icons/chevron-left-icon.js
4903 init_extends();
4904 var ChevronLeftIcon = react.default.forwardRef(function(props, ref) {
4905 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
4906 fillRule: "evenodd",
4907 clipRule: "evenodd",
4908 d: "M15.5303 18.2803C15.8232 17.9874 15.8232 17.5126 15.5303 17.2197L10.0607 11.75L15.5303 6.28033C15.8232 5.98744 15.8232 5.51256 15.5303 5.21967C15.2374 4.92678 14.7626 4.92678 14.4697 5.21967L8.46967 11.2197C8.17678 11.5126 8.17678 11.9874 8.46967 12.2803L14.4697 18.2803C14.7626 18.5732 15.2374 18.5732 15.5303 18.2803Z"
4909 }));
4910 });
4911
4912 //#endregion
4913 //#region modules/ai/assets/js/editor/pages/form-media/components/back-button.js
4914 init_extends();
4915 init_objectWithoutProperties$1();
4916 var _excluded$28 = ["children"];
4917 var StyledChevronLeftIcon$1 = (0, _elementor_ui.withDirection)(ChevronLeftIcon);
4918 var BackButton$1 = function BackButton(_ref) {
4919 var children = _ref.children;
4920 var props = _objectWithoutProperties$1(_ref, _excluded$28);
4921 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
4922 size: "small",
4923 variant: "text",
4924 color: "secondary",
4925 startIcon: /*#__PURE__*/ react.default.createElement(StyledChevronLeftIcon$1, null)
4926 }, props), children || (0, _wordpress_i18n.__)("Back", "elementor"));
4927 };
4928 BackButton$1.propTypes = { children: import_prop_types$8.default.node };
4929
4930 //#endregion
4931 //#region modules/ai/assets/js/editor/pages/form-media/context/global-settings-context.js
4932 var GlobalSettingsContext = (0, react.createContext)({});
4933 var GlobalSettingsProvider = function GlobalSettingsProvider(_ref) {
4934 var settings = _ref.settings;
4935 var children = _ref.children;
4936 return /*#__PURE__*/ react.default.createElement(GlobalSettingsContext.Provider, { value: settings }, children);
4937 };
4938 GlobalSettingsProvider.propTypes = {
4939 settings: import_prop_types$8.default.object,
4940 children: import_prop_types$8.default.node
4941 };
4942 var useGlobalSettings = function useGlobalSettings() {
4943 return (0, react.useContext)(GlobalSettingsContext);
4944 };
4945
4946 //#endregion
4947 //#region modules/ai/assets/js/editor/components/upgrade-banner.js
4948 init_extends();
4949 init_objectWithoutProperties$1();
4950 var _excluded$27 = ["onClose"];
4951 var UpgradeBanner = function UpgradeBanner(_ref) {
4952 var onClose = _ref.onClose;
4953 var props = _objectWithoutProperties$1(_ref, _excluded$27);
4954 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, _extends$1({
4955 icon: false,
4956 action: /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertAction, { onClick: function onClick() {
4957 return window.open("https://go.elementor.com/ai-banner-free-upgrade/", "_blank");
4958 } }, (0, _wordpress_i18n.__)("Upgrade", "elementor")),
4959 variant: "filled",
4960 color: "promotion",
4961 onClose
4962 }, props), (0, _wordpress_i18n.__)("You’re using a limited license. Get maximum access to Elementor AI.", "elementor"));
4963 };
4964 UpgradeBanner.propTypes = {
4965 onClose: import_prop_types$8.default.func,
4966 sx: import_prop_types$8.default.object
4967 };
4968
4969 //#endregion
4970 //#region modules/ai/assets/js/editor/helpers/features-enum.js
4971 var FREE_TRIAL_FEATURES_NAMES = {
4972 TEXT: (0, _wordpress_i18n.__)("Text", "elementor"),
4973 IMAGES: (0, _wordpress_i18n.__)("Images", "elementor"),
4974 CODE: (0, _wordpress_i18n.__)("Code", "elementor"),
4975 CONTAINERS: (0, _wordpress_i18n.__)("Containers", "elementor"),
4976 ANIMATION: (0, _wordpress_i18n.__)("Animation", "elementor")
4977 };
4978
4979 //#endregion
4980 //#region modules/ai/assets/js/editor/components/usage-limit-alert.js
4981 init_objectWithoutProperties$1();
4982 init_extends();
4983 init_defineProperty$1();
4984 var _excluded$26 = [
4985 "onClose",
4986 "usagePercentage",
4987 "hasSubscription",
4988 "feature"
4989 ];
4990 var KEY_SUBSCRIPTION = "subscription";
4991 var KEY_NO_SUBSCRIPTION = "noSubscription";
4992 var getUsageTitle = function getUsageTitle(percentage) {
4993 return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("You’ve used %s of credits for this AI feature.", "elementor"), percentage);
4994 };
4995 var CREDITS_95_USAGE_TITLE = getUsageTitle("95%");
4996 var CREDITS_80_USAGE_TITLE = getUsageTitle("80%");
4997 var CREDITS_75_USAGE_TITLE = getUsageTitle("75%");
4998 var DESCRIPTION_SUBSCRIPTION = (0, _wordpress_i18n.__)("Get maximum access.", "elementor");
4999 var FEATURES = Object.keys(FREE_TRIAL_FEATURES_NAMES);
5000 var getDescriptionNoSubscription = function getDescriptionNoSubscription(excludedFeature) {
5001 var featuresList = FEATURES.filter(function(feature) {
5002 return feature !== excludedFeature;
5003 }).map(function(feature) {
5004 return FREE_TRIAL_FEATURES_NAMES[feature];
5005 }).join(", ");
5006 return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Upgrade now to keep using this feature. You still have credits for other AI features (%s, etc.)", "elementor"), featuresList);
5007 };
5008 var alertConfigs = [
5009 {
5010 threshold: 95,
5011 title: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, CREDITS_95_USAGE_TITLE), KEY_NO_SUBSCRIPTION, CREDITS_95_USAGE_TITLE),
5012 url: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, "https://go.elementor.com/ai-banner-paid-95-limit-reach/"), KEY_NO_SUBSCRIPTION, "https://go.elementor.com/ai-banner-free-95-limit-reach/"),
5013 color: "error"
5014 },
5015 {
5016 threshold: 80,
5017 title: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, CREDITS_80_USAGE_TITLE), KEY_NO_SUBSCRIPTION, CREDITS_80_USAGE_TITLE),
5018 url: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, "https://go.elementor.com/ai-banner-paid-80-limit-reach/"), KEY_NO_SUBSCRIPTION, "https://go.elementor.com/ai-banner-free-80-limit-reach/"),
5019 color: "warning"
5020 },
5021 {
5022 threshold: 75,
5023 title: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, CREDITS_75_USAGE_TITLE), KEY_NO_SUBSCRIPTION, CREDITS_75_USAGE_TITLE),
5024 url: _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, "https://go.elementor.com/ai-banner-paid-80-limit-reach/"), KEY_NO_SUBSCRIPTION, "https://go.elementor.com/ai-banner-free-80-limit-reach/"),
5025 color: "warning"
5026 }
5027 ];
5028 var UpgradeButton = function UpgradeButton(props) {
5029 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
5030 color: "inherit",
5031 variant: "outlined",
5032 sx: { border: "2px solid" }
5033 }, props), (0, _wordpress_i18n.__)("Upgrade now", "elementor"));
5034 };
5035 var UsageLimitAlert = function UsageLimitAlert(_ref) {
5036 _ref.onClose;
5037 var usagePercentage = _ref.usagePercentage;
5038 var hasSubscription = _ref.hasSubscription;
5039 var feature = _ref.feature;
5040 var props = _objectWithoutProperties$1(_ref, _excluded$26);
5041 var config = alertConfigs.find(function(_ref2) {
5042 return usagePercentage >= _ref2.threshold;
5043 });
5044 if (!config) return null;
5045 var subscriptionType = hasSubscription ? KEY_SUBSCRIPTION : KEY_NO_SUBSCRIPTION;
5046 var description = _defineProperty$1(_defineProperty$1({}, KEY_SUBSCRIPTION, DESCRIPTION_SUBSCRIPTION), KEY_NO_SUBSCRIPTION, getDescriptionNoSubscription(feature));
5047 var title = config.title;
5048 var url = config.url;
5049 var color = config.color;
5050 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, _extends$1({
5051 severity: "warning",
5052 action: /*#__PURE__*/ react.default.createElement(UpgradeButton, { onClick: function handleUpgradeClick() {
5053 return window.open(url[subscriptionType], "_blank");
5054 } }),
5055 color
5056 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.AlertTitle, null, title[subscriptionType]), description[subscriptionType]);
5057 };
5058 UsageLimitAlert.propTypes = {
5059 onClose: import_prop_types$8.default.func,
5060 usagePercentage: import_prop_types$8.default.number,
5061 hasSubscription: import_prop_types$8.default.bool,
5062 feature: import_prop_types$8.default.string
5063 };
5064
5065 //#endregion
5066 //#region modules/ai/assets/js/editor/hooks/use-upgrade-message.js
5067 init_use_introduction();
5068 var USAGE_PERCENTAGE_THRESHOLD = 75;
5069 var useUpgradeMessage = function useUpgradeMessage(_ref) {
5070 var usagePercentage = _ref.usagePercentage;
5071 var hasSubscription = _ref.hasSubscription;
5072 var _useIntroduction = useIntroduction("e-ai-upgrade-message");
5073 var isBannerViewed = _useIntroduction.isViewed;
5074 var markBannerAsViewed = _useIntroduction.markAsViewed;
5075 var isFreeUser = !hasSubscription;
5076 return {
5077 showBadge: usagePercentage >= 75 || isFreeUser,
5078 showBanner: !isBannerViewed && isFreeUser && usagePercentage < 75,
5079 markBannerAsViewed
5080 };
5081 };
5082
5083 //#endregion
5084 //#region modules/ai/assets/js/editor/components/usage-messages.js
5085 var UsageMessages = function UsageMessages(_ref) {
5086 var hasSubscription = _ref.hasSubscription;
5087 var usagePercentage = _ref.usagePercentage;
5088 var sx = _ref.sx;
5089 var feature = _ref.feature;
5090 var _useUpgradeMessage = useUpgradeMessage({
5091 usagePercentage,
5092 hasSubscription
5093 });
5094 var showBanner = _useUpgradeMessage.showBanner;
5095 var markBannerAsViewed = _useUpgradeMessage.markBannerAsViewed;
5096 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, showBanner && /*#__PURE__*/ react.default.createElement(UpgradeBanner, {
5097 onClose: markBannerAsViewed,
5098 sx
5099 }), /*#__PURE__*/ react.default.createElement(UsageLimitAlert, {
5100 hasSubscription,
5101 usagePercentage,
5102 sx,
5103 feature
5104 }));
5105 };
5106 UsageMessages.propTypes = {
5107 hasSubscription: import_prop_types$8.default.bool,
5108 usagePercentage: import_prop_types$8.default.number,
5109 sx: import_prop_types$8.default.object,
5110 feature: import_prop_types$8.default.string
5111 };
5112
5113 //#endregion
5114 //#region modules/ai/assets/js/editor/pages/form-media/components/view.js
5115 init_extends();
5116 init_defineProperty$1();
5117 init_objectWithoutProperties$1();
5118 init_loader();
5119 init_prompt_error_message();
5120 var _excluded$25 = ["sx"];
5121 var _excluded2$4 = ["primary", "secondary"];
5122 var _excluded3$2 = ["primary", "secondary"];
5123 var _excluded4$1 = ["children"];
5124 var _excluded5$1 = [
5125 "isLoading",
5126 "isGenerating",
5127 "children"
5128 ];
5129 var _excluded6 = ["sx"];
5130 function ownKeys$22(e, r) {
5131 var t = Object.keys(e);
5132 if (Object.getOwnPropertySymbols) {
5133 var o = Object.getOwnPropertySymbols(e);
5134 r && (o = o.filter(function(r) {
5135 return Object.getOwnPropertyDescriptor(e, r).enumerable;
5136 })), t.push.apply(t, o);
5137 }
5138 return t;
5139 }
5140 __name(ownKeys$22, "ownKeys");
5141 function _objectSpread$22(e) {
5142 for (var r = 1; r < arguments.length; r++) {
5143 var t = null != arguments[r] ? arguments[r] : {};
5144 r % 2 ? ownKeys$22(Object(t), !0).forEach(function(r) {
5145 _defineProperty$1(e, r, t[r]);
5146 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$22(Object(t)).forEach(function(r) {
5147 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
5148 });
5149 }
5150 return e;
5151 }
5152 __name(_objectSpread$22, "_objectSpread");
5153 var ViewBackButton = function ViewBackButton(_ref) {
5154 var _ref$sx = _ref.sx;
5155 var sx = _ref$sx === void 0 ? {} : _ref$sx;
5156 var props = _objectWithoutProperties$1(_ref, _excluded$25);
5157 var back = useLocation().back;
5158 if (useGlobalSettings().hideBackButton) return null;
5159 return /*#__PURE__*/ react.default.createElement(BackButton$1, _extends$1({ onClick: function onClick(e) {
5160 e.preventDefault();
5161 back();
5162 } }, props, { sx: _objectSpread$22({
5163 mb: 1,
5164 alignSelf: "flex-start"
5165 }, sx) }));
5166 };
5167 ViewBackButton.propTypes = { sx: import_prop_types$8.default.object };
5168 var PanelHeading = function PanelHeading(_ref2) {
5169 var primary = _ref2.primary;
5170 var secondary = _ref2.secondary;
5171 var props = _objectWithoutProperties$1(_ref2, _excluded2$4);
5172 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, _extends$1({
5173 spacing: 1,
5174 sx: { mb: 3 }
5175 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "h4" }, primary), secondary && /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
5176 variant: "body1",
5177 color: "secondary"
5178 }, secondary));
5179 };
5180 PanelHeading.propTypes = {
5181 primary: import_prop_types$8.default.string.isRequired,
5182 secondary: import_prop_types$8.default.string
5183 };
5184 var ContentHeading = function ContentHeading(_ref3) {
5185 var primary = _ref3.primary;
5186 var secondary = _ref3.secondary;
5187 var props = _objectWithoutProperties$1(_ref3, _excluded3$2);
5188 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, _extends$1({
5189 gap: 1.5,
5190 sx: { mb: 3 }
5191 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "h6" }, primary), secondary && /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
5192 variant: "subtitle1",
5193 color: "secondary"
5194 }, secondary));
5195 };
5196 ContentHeading.propTypes = {
5197 primary: import_prop_types$8.default.string.isRequired,
5198 secondary: import_prop_types$8.default.string
5199 };
5200 var View = function View(_ref4) {
5201 var children = _ref4.children;
5202 var props = _objectWithoutProperties$1(_ref4, _excluded4$1);
5203 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({
5204 className: "e-ai-dialog-content",
5205 display: "flex",
5206 sx: {
5207 overflowY: "auto",
5208 position: "relative"
5209 },
5210 height: "100%"
5211 }, props), children);
5212 };
5213 var Content = function Content(_ref5) {
5214 var _ref5$isLoading = _ref5.isLoading;
5215 var isLoading = _ref5$isLoading === void 0 ? false : _ref5$isLoading;
5216 var _ref5$isGenerating = _ref5.isGenerating;
5217 var isGenerating = _ref5$isGenerating === void 0 ? false : _ref5$isGenerating;
5218 var children = _ref5.children;
5219 var props = _objectWithoutProperties$1(_ref5, _excluded5$1);
5220 if (isGenerating) return /*#__PURE__*/ react.default.createElement(GenerateLoader, null);
5221 if (isLoading) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
5222 width: "100%",
5223 maxWidth: 600,
5224 margin: "0 auto",
5225 alignSelf: "center"
5226 } }, /*#__PURE__*/ react.default.createElement(Loader, { color: "inherit" }));
5227 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({
5228 sx: {
5229 overflowY: "auto",
5230 p: 4
5231 },
5232 flexGrow: 1
5233 }, props), children);
5234 };
5235 Content.propTypes = {
5236 children: import_prop_types$8.default.node,
5237 isLoading: import_prop_types$8.default.bool,
5238 isGenerating: import_prop_types$8.default.bool
5239 };
5240 var ErrorMessage = function ErrorMessage(_ref6) {
5241 var _ref6$sx = _ref6.sx;
5242 var sx = _ref6$sx === void 0 ? {} : _ref6$sx;
5243 var props = _objectWithoutProperties$1(_ref6, _excluded6);
5244 return /*#__PURE__*/ react.default.createElement(PromptErrorMessage, _extends$1({ actionPosition: "bottom" }, props, { sx: _objectSpread$22({ mb: 2.5 }, sx) }));
5245 };
5246 ErrorMessage.propTypes = { sx: import_prop_types$8.default.object };
5247 var ViewPanel = function ViewPanel(props) {
5248 var _useGlobalSettings2 = useGlobalSettings();
5249 var hasSubscription = _useGlobalSettings2.hasSubscription;
5250 var usagePercentage = _useGlobalSettings2.usagePercentage;
5251 return /*#__PURE__*/ react.default.createElement(Panel, null, /*#__PURE__*/ react.default.createElement(UsageMessages, {
5252 hasSubscription,
5253 usagePercentage,
5254 sx: { mb: 4 },
5255 feature: FREE_TRIAL_FEATURES_NAMES.IMAGES
5256 }), props.children);
5257 };
5258 ViewPanel.propTypes = { children: import_prop_types$8.default.node };
5259 View.Panel = ViewPanel;
5260 View.Content = Content;
5261 View.BackButton = ViewBackButton;
5262 View.ErrorMessage = ErrorMessage;
5263 View.PanelHeading = PanelHeading;
5264 View.ContentHeading = ContentHeading;
5265 View.propTypes = { children: import_prop_types$8.default.node };
5266
5267 //#endregion
5268 //#region modules/ai/assets/js/editor/pages/form-media/constants/index.js
5269 var LOCATIONS = {
5270 RESIZE: "resize",
5271 GENERATE: "generate",
5272 VARIATIONS: "variations",
5273 IMAGE_TOOLS: "image-tools",
5274 IN_PAINTING: "in-painting",
5275 OUT_PAINTING: "out-painting",
5276 REMOVE_BACKGROUND: "remove-background",
5277 REPLACE_BACKGROUND: "replace-background",
5278 REMOVE_TEXT: "remove-text",
5279 CLEANUP: "cleanup",
5280 PRODUCT_IMAGE_UNIFICATION: "product-image-unification",
5281 ISOLATE_OBJECT: "isolate-objects"
5282 };
5283 var IMAGE_PROMPT_SETTINGS = {
5284 IMAGE_TYPE: "image_type",
5285 IMAGE_STYLE: "style_preset",
5286 IMAGE_STRENGTH: "image_strength",
5287 IMAGE_RATIO: "ratio",
5288 IMAGE_ZOOM: "zoom",
5289 IMAGE_UPSCALE: "upscale_to",
5290 IMAGE_BACKGROUND_COLOR: "background_color"
5291 };
5292 var FEATURE_IDENTIFIER = { ISOLATE_OBJECT: "isolate-object" };
5293 var IMAGE_PROMPT_CATEGORIES = {
5294 "": {
5295 label: (0, _wordpress_i18n.__)("None", "elementor"),
5296 subCategories: {}
5297 },
5298 photographic: {
5299 label: (0, _wordpress_i18n.__)("Photographic", "elementor"),
5300 subCategories: {
5301 "": (0, _wordpress_i18n.__)("None", "elementor"),
5302 landscape: (0, _wordpress_i18n.__)("Landscape", "elementor"),
5303 macro: (0, _wordpress_i18n.__)("Macro", "elementor"),
5304 portrait: (0, _wordpress_i18n.__)("Portrait", "elementor"),
5305 "long-exposure": (0, _wordpress_i18n.__)("Long Exposure", "elementor"),
5306 product: (0, _wordpress_i18n.__)("Product", "elementor"),
5307 photorealistic: (0, _wordpress_i18n.__)("Photorealistic", "elementor")
5308 }
5309 },
5310 vector: {
5311 label: (0, _wordpress_i18n.__)("Vector / Logo", "elementor"),
5312 subCategories: {
5313 "": (0, _wordpress_i18n.__)("None", "elementor"),
5314 "typographic-logo": (0, _wordpress_i18n.__)("Typographic Logo", "elementor"),
5315 "shape-logo": (0, _wordpress_i18n.__)("Shape Logo", "elementor"),
5316 "handwritten-logo": (0, _wordpress_i18n.__)("Handwritten Logo", "elementor"),
5317 "line-art-logo": (0, _wordpress_i18n.__)("Line Art Logo", "elementor"),
5318 "old-school-logo": (0, _wordpress_i18n.__)("Old School Logo", "elementor")
5319 }
5320 },
5321 background: {
5322 label: (0, _wordpress_i18n.__)("Background", "elementor"),
5323 subCategories: {
5324 "": (0, _wordpress_i18n.__)("None", "elementor"),
5325 floral: (0, _wordpress_i18n.__)("Floral", "elementor"),
5326 gradient: (0, _wordpress_i18n.__)("Gradient", "elementor"),
5327 mosaic: (0, _wordpress_i18n.__)("Mosaic", "elementor"),
5328 neon: (0, _wordpress_i18n.__)("Neon", "elementor"),
5329 bokeh: (0, _wordpress_i18n.__)("Bokeh", "elementor")
5330 }
5331 },
5332 handmade: {
5333 label: (0, _wordpress_i18n.__)("Handmade", "elementor"),
5334 subCategories: {
5335 "": (0, _wordpress_i18n.__)("None", "elementor"),
5336 doodle: (0, _wordpress_i18n.__)("Doodle", "elementor"),
5337 "line-art": (0, _wordpress_i18n.__)("Line Art", "elementor"),
5338 "oil-painting": (0, _wordpress_i18n.__)("Oil Painting", "elementor"),
5339 "pencil-drawing": (0, _wordpress_i18n.__)("Pencil Drawing", "elementor"),
5340 watercolor: (0, _wordpress_i18n.__)("Watercolor", "elementor")
5341 }
5342 },
5343 "digital-art": {
5344 label: (0, _wordpress_i18n.__)("Digital Art", "elementor"),
5345 subCategories: {
5346 "": (0, _wordpress_i18n.__)("None", "elementor"),
5347 amine: (0, _wordpress_i18n.__)("Anime", "elementor"),
5348 cartoon: (0, _wordpress_i18n.__)("Cartoon", "elementor"),
5349 cinematic: (0, _wordpress_i18n.__)("Cinematic", "elementor"),
5350 "comic-book": (0, _wordpress_i18n.__)("Comic Book", "elementor"),
5351 "fantasy-art": (0, _wordpress_i18n.__)("Fantasy Art", "elementor"),
5352 isometric: (0, _wordpress_i18n.__)("Isometric", "elementor"),
5353 vector: (0, _wordpress_i18n.__)("Vector", "elementor"),
5354 "pixel-art": (0, _wordpress_i18n.__)("Pixel Art", "elementor"),
5355 "low-poly": (0, _wordpress_i18n.__)("Low Poly", "elementor"),
5356 "neon-punk": (0, _wordpress_i18n.__)("Neon Punk", "elementor")
5357 }
5358 },
5359 "3d": {
5360 label: (0, _wordpress_i18n.__)("3D", "elementor"),
5361 subCategories: {
5362 "": (0, _wordpress_i18n.__)("None", "elementor"),
5363 clay: (0, _wordpress_i18n.__)("Clay", "elementor"),
5364 digital: (0, _wordpress_i18n.__)("Digital", "elementor"),
5365 origami: (0, _wordpress_i18n.__)("Origami", "elementor"),
5366 stone: (0, _wordpress_i18n.__)("Stone", "elementor"),
5367 wood: (0, _wordpress_i18n.__)("Wood", "elementor")
5368 }
5369 }
5370 };
5371 var IMAGE_ASPECT_RATIO = {
5372 "1:1": {
5373 width: 512,
5374 height: 512,
5375 label: (0, _wordpress_i18n.__)("Square", "elementor") + " (1:1)"
5376 },
5377 "3:2": {
5378 width: 640,
5379 height: 448,
5380 label: (0, _wordpress_i18n.__)("Landscape", "elementor") + " (3:2)"
5381 },
5382 "4:3": {
5383 width: 640,
5384 height: 448,
5385 label: (0, _wordpress_i18n.__)("Landscape", "elementor") + " (4:3)"
5386 },
5387 "16:9": {
5388 width: 704,
5389 height: 384,
5390 label: (0, _wordpress_i18n.__)("Landscape", "elementor") + " (16:9)"
5391 },
5392 "2:3": {
5393 width: 448,
5394 height: 640,
5395 label: (0, _wordpress_i18n.__)("Portrait", "elementor") + " (2:3)"
5396 },
5397 "3:4": {
5398 width: 448,
5399 height: 640,
5400 label: (0, _wordpress_i18n.__)("Portrait", "elementor") + " (3:4)"
5401 },
5402 "9:16": {
5403 width: 384,
5404 height: 704,
5405 label: (0, _wordpress_i18n.__)("Portrait", "elementor") + " (9:16)"
5406 }
5407 };
5408 var IMAGE_PLACEHOLDERS_HOSTS = { WIREFRAME: "gene-\\d+\\.live\\.strattic\\.io" };
5409
5410 //#endregion
5411 //#region modules/ai/assets/js/editor/components/ui/overlay.js
5412 var Overlay = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref) {
5413 var theme = _ref.theme;
5414 return {
5415 width: "100%",
5416 height: "100%",
5417 position: "absolute",
5418 backgroundColor: "rgba(0,0,0,0.5)",
5419 transition: "opacity ".concat(theme.transitions.duration.short, "ms ").concat(theme.transitions.easing.easeInOut),
5420 opacity: 0,
5421 "&:hover": { opacity: 1 }
5422 };
5423 });
5424
5425 //#endregion
5426 //#region modules/ai/assets/js/editor/components/ui/overlay-bar.js
5427 var OverlayBar = (0, _elementor_ui.styled)(_elementor_ui.Stack)(function(_ref) {
5428 var theme = _ref.theme;
5429 var position = _ref.position;
5430 var style = {
5431 width: "100%",
5432 position: "absolute",
5433 left: 0,
5434 padding: theme.spacing(2.5)
5435 };
5436 if ("top" === position) style.top = 0;
5437 else if ("bottom" === position) style.bottom = 0;
5438 return style;
5439 });
5440
5441 //#endregion
5442 //#region modules/ai/assets/js/editor/components/ui/overlay-bar-text.js
5443 init_extends();
5444 init_objectWithoutProperties$1();
5445 var _excluded$24 = ["children"];
5446 var OverlayBarText = function OverlayBarText(_ref) {
5447 var children = _ref.children;
5448 var props = _objectWithoutProperties$1(_ref, _excluded$24);
5449 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, _extends$1({
5450 variant: "caption",
5451 color: "common.white"
5452 }, props), children);
5453 };
5454 OverlayBarText.propTypes = { children: import_prop_types$8.default.node };
5455
5456 //#endregion
5457 //#region modules/ai/assets/js/editor/pages/form-media/components/gallery.js
5458 init_defineProperty$1();
5459 init_slicedToArray();
5460 init_extends();
5461 init_objectWithoutProperties$1();
5462 var _excluded$23 = ["children"];
5463 var _excluded2$3 = [
5464 "alt",
5465 "src",
5466 "text",
5467 "children",
5468 "aspectRatio",
5469 "variant",
5470 "OverlayBarProps",
5471 "numImagesInRow",
5472 "overlay",
5473 "onSelectChange",
5474 "checkboxColor",
5475 "isLoading",
5476 "initialChecked"
5477 ];
5478 function ownKeys$21(e, r) {
5479 var t = Object.keys(e);
5480 if (Object.getOwnPropertySymbols) {
5481 var o = Object.getOwnPropertySymbols(e);
5482 r && (o = o.filter(function(r) {
5483 return Object.getOwnPropertyDescriptor(e, r).enumerable;
5484 })), t.push.apply(t, o);
5485 }
5486 return t;
5487 }
5488 __name(ownKeys$21, "ownKeys");
5489 function _objectSpread$21(e) {
5490 for (var r = 1; r < arguments.length; r++) {
5491 var t = null != arguments[r] ? arguments[r] : {};
5492 r % 2 ? ownKeys$21(Object(t), !0).forEach(function(r) {
5493 _defineProperty$1(e, r, t[r]);
5494 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$21(Object(t)).forEach(function(r) {
5495 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
5496 });
5497 }
5498 return e;
5499 }
5500 __name(_objectSpread$21, "_objectSpread");
5501 var aspectRatios = Object.keys(IMAGE_ASPECT_RATIO);
5502 var Gallery = function Gallery(_ref) {
5503 var children = _ref.children;
5504 var props = _objectWithoutProperties$1(_ref, _excluded$23);
5505 return /*#__PURE__*/ react.default.createElement(_elementor_ui.ImageList, _extends$1({
5506 width: "100%",
5507 cols: 2,
5508 gap: 24
5509 }, props), children);
5510 };
5511 Gallery.propTypes = { children: import_prop_types$8.default.node };
5512 var GalleryImage = function GalleryImage(_ref2) {
5513 var _elementorCommon$conf;
5514 var _elementorCommon;
5515 var alt = _ref2.alt;
5516 var src = _ref2.src;
5517 var text = _ref2.text;
5518 var children = _ref2.children;
5519 var _ref2$aspectRatio = _ref2.aspectRatio;
5520 var aspectRatio = _ref2$aspectRatio === void 0 ? "1:1" : _ref2$aspectRatio;
5521 var _ref2$variant = _ref2.variant;
5522 var variant = _ref2$variant === void 0 ? "contained" : _ref2$variant;
5523 var _ref2$OverlayBarProps = _ref2.OverlayBarProps;
5524 var OverlayBarProps = _ref2$OverlayBarProps === void 0 ? {} : _ref2$OverlayBarProps;
5525 var _ref2$numImagesInRow = _ref2.numImagesInRow;
5526 var numImagesInRow = _ref2$numImagesInRow === void 0 ? 2 : _ref2$numImagesInRow;
5527 var _ref2$overlay = _ref2.overlay;
5528 var overlay = _ref2$overlay === void 0 ? true : _ref2$overlay;
5529 var _ref2$onSelectChange = _ref2.onSelectChange;
5530 var onSelectChange = _ref2$onSelectChange === void 0 ? null : _ref2$onSelectChange;
5531 var _ref2$checkboxColor = _ref2.checkboxColor;
5532 var checkboxColor = _ref2$checkboxColor === void 0 ? "rgba(0, 0, 0, 0.54)" : _ref2$checkboxColor;
5533 var _ref2$isLoading = _ref2.isLoading;
5534 var isLoading = _ref2$isLoading === void 0 ? false : _ref2$isLoading;
5535 var _ref2$initialChecked = _ref2.initialChecked;
5536 var initialChecked = _ref2$initialChecked === void 0 ? false : _ref2$initialChecked;
5537 var props = _objectWithoutProperties$1(_ref2, _excluded2$3);
5538 var _useState2 = _slicedToArray((0, react.useState)(initialChecked), 2);
5539 var isChecked = _useState2[0];
5540 var setIsChecked = _useState2[1];
5541 var style = {};
5542 var isRTL = (_elementorCommon$conf = (_elementorCommon = elementorCommon) === null || _elementorCommon === void 0 || (_elementorCommon = _elementorCommon.config) === null || _elementorCommon === void 0 ? void 0 : _elementorCommon.isRTL) !== null && _elementorCommon$conf !== void 0 ? _elementorCommon$conf : true;
5543 (0, react.useEffect)(function() {
5544 setIsChecked(initialChecked);
5545 }, [initialChecked]);
5546 if ("thumbnail" === variant) {
5547 style.width = "100%";
5548 style.maxHeight = "238px";
5549 style.minWidth = "230px";
5550 } else {
5551 style.width = "auto";
5552 style.height = "auto";
5553 style.maxWidth = "100%";
5554 style.maxHeight = "1:1" === aspectRatio ? "initial" : "100%";
5555 style.objectFit = "contain";
5556 style.aspectRatio = aspectRatio.replace(":", " / ");
5557 }
5558 return /*#__PURE__*/ react.default.createElement(_elementor_ui.ImageListItem, props, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
5559 display: "flex",
5560 justifyContent: "center",
5561 alignItems: "center",
5562 sx: {
5563 bgcolor: "action.selected",
5564 height: "contained" === variant && numImagesInRow <= 2 ? 336 : "auto",
5565 position: "relative",
5566 overflow: "hidden"
5567 }
5568 }, /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, isLoading ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, {
5569 sx: _objectSpread$21(_objectSpread$21({}, style), {}, {
5570 width: "100%",
5571 height: "100% "
5572 }),
5573 animation: "wave",
5574 variant: "rounded"
5575 }, /*#__PURE__*/ react.default.createElement("img", {
5576 alt,
5577 src,
5578 style: _objectSpread$21(_objectSpread$21({}, style), {}, { visibility: "hidden" })
5579 })) : /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, onSelectChange && /*#__PURE__*/ react.default.createElement(_elementor_ui.Checkbox, {
5580 onClick: function onClick() {
5581 var newVal = !isChecked;
5582 setIsChecked(newVal);
5583 onSelectChange(newVal);
5584 },
5585 checked: isChecked,
5586 sx: {
5587 position: "absolute",
5588 top: 0,
5589 left: isRTL ? void 0 : 0,
5590 right: isRTL ? 0 : void 0,
5591 "& .MuiSvgIcon-root": { color: checkboxColor }
5592 }
5593 }), /*#__PURE__*/ react.default.createElement("img", {
5594 alt,
5595 src,
5596 style
5597 })))), overlay && children && /*#__PURE__*/ react.default.createElement(Overlay, null, /*#__PURE__*/ react.default.createElement(OverlayBar, _extends$1({
5598 gap: 1,
5599 position: "bottom"
5600 }, OverlayBarProps), text && /*#__PURE__*/ react.default.createElement(OverlayBarText, null, text), children)));
5601 };
5602 GalleryImage.propTypes = {
5603 alt: import_prop_types$8.default.string,
5604 src: import_prop_types$8.default.string,
5605 text: import_prop_types$8.default.string,
5606 children: import_prop_types$8.default.node,
5607 BoxProps: import_prop_types$8.default.object,
5608 OverlayBarProps: import_prop_types$8.default.object,
5609 aspectRatio: import_prop_types$8.default.oneOf(aspectRatios),
5610 variant: import_prop_types$8.default.oneOf(["contained", "thumbnail"]),
5611 numImagesInRow: import_prop_types$8.default.number,
5612 overlay: import_prop_types$8.default.bool,
5613 onSelectChange: import_prop_types$8.default.func,
5614 checkboxColor: import_prop_types$8.default.string,
5615 initialChecked: import_prop_types$8.default.bool,
5616 isLoading: import_prop_types$8.default.bool
5617 };
5618 Gallery.Image = GalleryImage;
5619
5620 //#endregion
5621 //#region modules/ai/assets/js/editor/pages/form-media/components/image-form.js
5622 init_extends();
5623 init_objectWithoutProperties$1();
5624 var _excluded$22 = ["children"];
5625 var ImageForm = function ImageForm(_ref) {
5626 var children = _ref.children;
5627 var props = _objectWithoutProperties$1(_ref, _excluded$22);
5628 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ component: "form" }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { spacing: 2.5 }, children));
5629 };
5630 ImageForm.propTypes = { children: import_prop_types$8.default.node };
5631
5632 //#endregion
5633 //#region modules/ai/assets/js/editor/icons/wand-icon.js
5634 init_extends();
5635 var WandIcon = react.default.forwardRef(function(props, ref) {
5636 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
5637 fillRule: "evenodd",
5638 clipRule: "evenodd",
5639 d: "M9 2.25C9.41421 2.25 9.75 2.58579 9.75 3C9.75 3.33152 9.8817 3.64946 10.1161 3.88388C10.3505 4.1183 10.6685 4.25 11 4.25C11.4142 4.25 11.75 4.58579 11.75 5C11.75 5.41421 11.4142 5.75 11 5.75C10.6685 5.75 10.3505 5.8817 10.1161 6.11612C9.8817 6.35054 9.75 6.66848 9.75 7C9.75 7.41421 9.41421 7.75 9 7.75C8.58579 7.75 8.25 7.41421 8.25 7C8.25 6.66848 8.1183 6.35054 7.88388 6.11612C7.64946 5.8817 7.33152 5.75 7 5.75C6.58579 5.75 6.25 5.41421 6.25 5C6.25 4.58579 6.58579 4.25 7 4.25C7.33152 4.25 7.64946 4.1183 7.88388 3.88388C8.1183 3.64946 8.25 3.33152 8.25 3C8.25 2.58579 8.58579 2.25 9 2.25ZM9 4.88746C8.98182 4.90673 8.96333 4.92576 8.94454 4.94454C8.92576 4.96333 8.90673 4.98182 8.88746 5C8.90673 5.01818 8.92576 5.03667 8.94454 5.05546C8.96333 5.07424 8.98182 5.09327 9 5.11254C9.01818 5.09327 9.03667 5.07424 9.05546 5.05546C9.07424 5.03667 9.09327 5.01818 9.11254 5C9.09327 4.98182 9.07424 4.96333 9.05546 4.94454C9.03667 4.92576 9.01818 4.90673 9 4.88746Z"
5640 }), /*#__PURE__*/ react.default.createElement("path", {
5641 fillRule: "evenodd",
5642 clipRule: "evenodd",
5643 d: "M18.5303 2.46967C18.2374 2.17678 17.7626 2.17678 17.4697 2.46967L2.46967 17.4697C2.17678 17.7626 2.17678 18.2374 2.46967 18.5303L5.46967 21.5303C5.76256 21.8232 6.23744 21.8232 6.53033 21.5303L21.5303 6.53033C21.8232 6.23744 21.8232 5.76256 21.5303 5.46967L18.5303 2.46967ZM18 7.93934L19.9393 6L18 4.06066L16.0607 6L18 7.93934ZM15 7.06066L16.9393 9L6 19.9393L4.06066 18L15 7.06066Z"
5644 }), /*#__PURE__*/ react.default.createElement("path", {
5645 fillRule: "evenodd",
5646 clipRule: "evenodd",
5647 d: "M19.75 13C19.75 12.5858 19.4142 12.25 19 12.25C18.5858 12.25 18.25 12.5858 18.25 13C18.25 13.3315 18.1183 13.6495 17.8839 13.8839C17.6495 14.1183 17.3315 14.25 17 14.25C16.5858 14.25 16.25 14.5858 16.25 15C16.25 15.4142 16.5858 15.75 17 15.75C17.3315 15.75 17.6495 15.8817 17.8839 16.1161C18.1183 16.3505 18.25 16.6685 18.25 17C18.25 17.4142 18.5858 17.75 19 17.75C19.4142 17.75 19.75 17.4142 19.75 17C19.75 16.6685 19.8817 16.3505 20.1161 16.1161C20.3505 15.8817 20.6685 15.75 21 15.75C21.4142 15.75 21.75 15.4142 21.75 15C21.75 14.5858 21.4142 14.25 21 14.25C20.6685 14.25 20.3505 14.1183 20.1161 13.8839C19.8817 13.6495 19.75 13.3315 19.75 13ZM18.9445 14.9445C18.9633 14.9258 18.9818 14.9067 19 14.8875C19.0182 14.9067 19.0367 14.9258 19.0555 14.9445C19.0742 14.9633 19.0933 14.9818 19.1125 15C19.0933 15.0182 19.0742 15.0367 19.0555 15.0555C19.0367 15.0742 19.0182 15.0933 19 15.1125C18.9818 15.0933 18.9633 15.0742 18.9445 15.0555C18.9258 15.0367 18.9067 15.0182 18.8875 15C18.9067 14.9818 18.9258 14.9633 18.9445 14.9445Z"
5648 }));
5649 });
5650
5651 //#endregion
5652 //#region modules/ai/assets/js/editor/pages/form-media/components/enhance-button.js
5653 init_extends();
5654 init_objectWithoutProperties$1();
5655 var _excluded$21 = ["isLoading"];
5656 var StyledWandIcon = (0, _elementor_ui.withDirection)(WandIcon);
5657 var EnhanceButton = function EnhanceButton(_ref) {
5658 var isLoading = _ref.isLoading;
5659 var props = _objectWithoutProperties$1(_ref, _excluded$21);
5660 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Enhance prompt", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
5661 component: "span",
5662 sx: { cursor: props.disabled ? "default" : "pointer" }
5663 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({
5664 size: "small",
5665 color: "secondary"
5666 }, props), isLoading ? /*#__PURE__*/ react.default.createElement(_elementor_ui.CircularProgress, {
5667 color: "secondary",
5668 size: 20
5669 }) : /*#__PURE__*/ react.default.createElement(StyledWandIcon, { fontSize: "small" }))));
5670 };
5671 EnhanceButton.propTypes = {
5672 disabled: import_prop_types$8.default.bool,
5673 isLoading: import_prop_types$8.default.bool
5674 };
5675
5676 //#endregion
5677 //#region modules/ai/assets/js/editor/pages/form-layout/context/config.js
5678 var MODE_LAYOUT = "layout";
5679 var MODE_VARIATION = "variation";
5680 var LAYOUT_APP_MODES = [MODE_LAYOUT, MODE_VARIATION];
5681 var ConfigContext = react.default.createContext({});
5682 var useConfig = function useConfig() {
5683 return react.default.useContext(ConfigContext);
5684 };
5685 var ConfigProvider = function ConfigProvider(props) {
5686 return /*#__PURE__*/ react.default.createElement(ConfigContext.Provider, { value: {
5687 mode: props.mode,
5688 attachmentsTypes: props.attachmentsTypes,
5689 onClose: props.onClose,
5690 onConnect: props.onConnect,
5691 onData: props.onData,
5692 onInsert: props.onInsert,
5693 onSelect: props.onSelect,
5694 onGenerate: props.onGenerate,
5695 currentContext: props.currentContext,
5696 hasPro: props.hasPro
5697 } }, props.children);
5698 };
5699 ConfigProvider.propTypes = {
5700 mode: import_prop_types$8.default.oneOf(LAYOUT_APP_MODES).isRequired,
5701 children: import_prop_types$8.default.node.isRequired,
5702 attachmentsTypes: import_prop_types$8.default.object.isRequired,
5703 onClose: import_prop_types$8.default.func.isRequired,
5704 onConnect: import_prop_types$8.default.func.isRequired,
5705 onData: import_prop_types$8.default.func.isRequired,
5706 onInsert: import_prop_types$8.default.func.isRequired,
5707 onSelect: import_prop_types$8.default.func.isRequired,
5708 onGenerate: import_prop_types$8.default.func.isRequired,
5709 currentContext: import_prop_types$8.default.object,
5710 hasPro: import_prop_types$8.default.bool
5711 };
5712
5713 //#endregion
5714 //#region modules/ai/assets/js/editor/hooks/use-prompt-enhancer.js
5715 init_api();
5716 init_use_prompt();
5717 var enhancePromptMap = /* @__PURE__ */ new Map([["media", getImagePromptEnhanced], ["layout", getLayoutPromptEnhanced]]);
5718 var getResult = function getResult(prompt, type, enhanceType) {
5719 if (!enhancePromptMap.has(type)) throw new Error("Invalid prompt type: ".concat(type));
5720 return enhancePromptMap.get(type)(prompt, enhanceType);
5721 };
5722 /**
5723 * Hook to enhance a prompt.
5724 *
5725 * @param {string} prompt
5726 * @param {'media' | 'layout'} type
5727 * @return {{enhancedPrompt: string | undefined, isEnhancing: boolean, enhance: (function(...[*]): Promise)}}
5728 */
5729 var usePromptEnhancer = function usePromptEnhancer(prompt, type) {
5730 var mode = useConfig().mode;
5731 var _usePrompt = usePrompt(function() {
5732 return getResult(prompt, type, mode);
5733 }, prompt);
5734 var enhancedData = _usePrompt.data;
5735 var isEnhancing = _usePrompt.isLoading;
5736 return {
5737 enhance: _usePrompt.send,
5738 isEnhancing,
5739 enhancedPrompt: enhancedData === null || enhancedData === void 0 ? void 0 : enhancedData.result
5740 };
5741 };
5742
5743 //#endregion
5744 //#region modules/ai/assets/js/editor/pages/form-media/components/prompt-field.js
5745 init_extends();
5746 init_objectWithoutProperties$1();
5747 init_textarea();
5748 var _excluded$20 = ["disabled", "onChange"];
5749 var PromptField = function PromptField(_ref) {
5750 var disabled = _ref.disabled;
5751 var _onChange = _ref.onChange;
5752 var props = _objectWithoutProperties$1(_ref, _excluded$20);
5753 var _usePromptEnhancer = usePromptEnhancer(props.value, "media");
5754 var enhance = _usePromptEnhancer.enhance;
5755 var isEnhancing = _usePromptEnhancer.isEnhancing;
5756 return /*#__PURE__*/ react.default.createElement(Textarea, _extends$1({
5757 minRows: 3,
5758 maxRows: 6,
5759 InputProps: { endAdornment: /*#__PURE__*/ react.default.createElement(_elementor_ui.InputAdornment, {
5760 position: "end",
5761 sx: {
5762 position: "absolute",
5763 bottom: "24px",
5764 right: "8px"
5765 }
5766 }, /*#__PURE__*/ react.default.createElement(EnhanceButton, {
5767 isLoading: isEnhancing,
5768 disabled: disabled || isEnhancing || !props.value,
5769 onClick: function onClick() {
5770 enhance(prompt).then(function(_ref2) {
5771 var result = _ref2.result;
5772 return _onChange(result);
5773 });
5774 }
5775 })) },
5776 sx: { "& .MuiInputBase-input.MuiOutlinedInput-input.MuiInputBase-inputMultiline": {
5777 pb: 5,
5778 width: "89%"
5779 } },
5780 onKeyDown: function onKeyDown(event) {
5781 if ("Tab" === event.key) {
5782 event.preventDefault();
5783 _onChange(props.placeholder);
5784 }
5785 }
5786 }, props, {
5787 onChange: function onChange(event) {
5788 return _onChange(event.target.value);
5789 },
5790 disabled: disabled || isEnhancing
5791 }));
5792 };
5793 PromptField.propTypes = {
5794 value: import_prop_types$8.default.string,
5795 disabled: import_prop_types$8.default.bool,
5796 placeholder: import_prop_types$8.default.string,
5797 onChange: import_prop_types$8.default.func.isRequired
5798 };
5799
5800 //#endregion
5801 //#region modules/ai/assets/js/editor/pages/form-media/components/image-type-select.js
5802 init_extends();
5803 init_slicedToArray();
5804 init_use_introduction();
5805 var StyledNewChip = (0, _elementor_ui.styled)(_elementor_ui.Chip)(function() {
5806 return { "& .MuiChip-label": {
5807 fontSize: "0.75rem",
5808 fontWeight: "normal"
5809 } };
5810 });
5811 var showLabel = function showLabel(label, key, isViewed, markAsViewed) {
5812 if (isViewed) return {
5813 label,
5814 value: key
5815 };
5816 return {
5817 label: /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
5818 direction: "row",
5819 width: "100%",
5820 justifyContent: "space-between",
5821 alignItems: "center"
5822 }, label, /*#__PURE__*/ react.default.createElement(StyledNewChip, {
5823 label: "New",
5824 color: "info",
5825 variant: "standard",
5826 size: "tiny"
5827 })),
5828 value: key,
5829 onClick: function onClick() {
5830 return markAsViewed();
5831 }
5832 };
5833 };
5834 var changeImageType = function changeImageType(e, props, markVectorAsViewed) {
5835 if ("vector" === e.target.value) markVectorAsViewed();
5836 if (props.onChange) props.onChange(e);
5837 };
5838 var ImageTypeSelect = function ImageTypeSelect(props) {
5839 var _useIntroduction = useIntroduction("e-ai-image-vector-option");
5840 var isVectorViewed = _useIntroduction.isViewed;
5841 var markVectorAsViewed = _useIntroduction.markAsViewed;
5842 var imageTypesWithNewChip = Object.entries(IMAGE_PROMPT_CATEGORIES).map(function(_ref) {
5843 var _ref2 = _slicedToArray(_ref, 2);
5844 var key = _ref2[0];
5845 var label = _ref2[1].label;
5846 if ("vector" === key) return showLabel(label, key, isVectorViewed, markVectorAsViewed);
5847 return {
5848 label,
5849 value: key
5850 };
5851 });
5852 return /*#__PURE__*/ react.default.createElement(PromptActionSelection, _extends$1({
5853 options: imageTypesWithNewChip,
5854 wrapperStyle: { width: "100%" },
5855 label: (0, _wordpress_i18n.__)("Image type", "elementor")
5856 }, props, { onChange: function onChange(e) {
5857 changeImageType(e, props, markVectorAsViewed);
5858 } }));
5859 };
5860 ImageTypeSelect.propTypes = {
5861 onChange: import_prop_types$8.default.func,
5862 value: import_prop_types$8.default.string,
5863 disabled: import_prop_types$8.default.bool
5864 };
5865
5866 //#endregion
5867 //#region modules/ai/assets/js/editor/pages/form-media/components/image-style-select.js
5868 init_extends();
5869 init_slicedToArray();
5870 init_objectWithoutProperties$1();
5871 var _excluded$19 = ["type"];
5872 var ImageStyleSelect = function ImageStyleSelect(_ref) {
5873 var _IMAGE_PROMPT_CATEGOR;
5874 var _ref$type = _ref.type;
5875 var type = _ref$type === void 0 ? "" : _ref$type;
5876 var props = _objectWithoutProperties$1(_ref, _excluded$19);
5877 var imageStyles = Object.entries(((_IMAGE_PROMPT_CATEGOR = IMAGE_PROMPT_CATEGORIES[type]) === null || _IMAGE_PROMPT_CATEGOR === void 0 ? void 0 : _IMAGE_PROMPT_CATEGOR.subCategories) || {}).map(function(_ref2) {
5878 var _ref3 = _slicedToArray(_ref2, 2);
5879 var value = _ref3[0];
5880 return {
5881 label: _ref3[1],
5882 value
5883 };
5884 });
5885 return /*#__PURE__*/ react.default.createElement(PromptActionSelection, _extends$1({
5886 options: imageStyles,
5887 wrapperStyle: { width: "100%" },
5888 label: (0, _wordpress_i18n.__)("Style", "elementor")
5889 }, props));
5890 };
5891 ImageStyleSelect.propTypes = { type: import_prop_types$8.default.string.isRequired };
5892
5893 //#endregion
5894 //#region modules/ai/assets/js/editor/pages/form-media/components/image-ratio-select.js
5895 init_extends();
5896 init_slicedToArray();
5897 var imageRatios = Object.entries(IMAGE_ASPECT_RATIO).map(function(_ref) {
5898 var _ref2 = _slicedToArray(_ref, 2);
5899 var value = _ref2[0];
5900 return {
5901 label: _ref2[1].label,
5902 value
5903 };
5904 });
5905 var ImageRatioSelect = function ImageRatioSelect(props) {
5906 return /*#__PURE__*/ react.default.createElement(PromptActionSelection, _extends$1({
5907 options: imageRatios,
5908 wrapperStyle: { width: "100%" },
5909 label: (0, _wordpress_i18n.__)("Aspect ratio", "elementor")
5910 }, props));
5911 };
5912
5913 //#endregion
5914 //#region modules/ai/assets/js/editor/icons/refresh-icon.js
5915 init_extends();
5916 var RefreshIcon = react.default.forwardRef(function(props, ref) {
5917 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
5918 fillRule: "evenodd",
5919 clipRule: "evenodd",
5920 d: "M7.55012 4.45178C9.23098 3.48072 11.1845 3.08925 13.1097 3.33767C15.035 3.58609 16.8251 4.46061 18.2045 5.82653C19.5838 7.19245 20.4757 8.97399 20.743 10.8967C20.8 11.307 20.5136 11.6858 20.1033 11.7428C19.6931 11.7998 19.3142 11.5135 19.2572 11.1032C19.0353 9.50635 18.2945 8.02677 17.149 6.89236C16.0035 5.75795 14.5167 5.03165 12.9178 4.82534C11.3189 4.61902 9.69644 4.94414 8.30047 5.75061C7.24361 6.36117 6.36093 7.22198 5.72541 8.24995H8.00009C8.41431 8.24995 8.75009 8.58574 8.75009 8.99995C8.75009 9.41417 8.41431 9.74995 8.00009 9.74995H4.51686C4.5055 9.75021 4.49412 9.75021 4.48272 9.74995H4.00009C3.58588 9.74995 3.25009 9.41417 3.25009 8.99995V4.99995C3.25009 4.58574 3.58588 4.24995 4.00009 4.24995C4.41431 4.24995 4.75009 4.58574 4.75009 4.99995V7.00691C5.48358 5.96916 6.43655 5.0951 7.55012 4.45178Z"
5921 }), /*#__PURE__*/ react.default.createElement("path", {
5922 fillRule: "evenodd",
5923 clipRule: "evenodd",
5924 d: "M3.89686 12.2571C4.30713 12.2001 4.68594 12.4864 4.74295 12.8967C4.96487 14.4936 5.70565 15.9731 6.85119 17.1075C7.99673 18.242 9.48347 18.9683 11.0824 19.1746C12.6813 19.3809 14.3037 19.0558 15.6997 18.2493C16.7566 17.6387 17.6393 16.7779 18.2748 15.75H16.0001C15.5859 15.75 15.2501 15.4142 15.2501 15C15.2501 14.5857 15.5859 14.25 16.0001 14.25H19.4833C19.4947 14.2497 19.5061 14.2497 19.5175 14.25H20.0001C20.4143 14.25 20.7501 14.5857 20.7501 15V19C20.7501 19.4142 20.4143 19.75 20.0001 19.75C19.5859 19.75 19.2501 19.4142 19.2501 19V16.993C18.5166 18.0307 17.5636 18.9048 16.4501 19.5481C14.7692 20.5192 12.8157 20.9107 10.8904 20.6622C8.9652 20.4138 7.17504 19.5393 5.79572 18.1734C4.4164 16.8074 3.52443 15.0259 3.25723 13.1032C3.20022 12.6929 3.48658 12.3141 3.89686 12.2571Z"
5925 }));
5926 });
5927
5928 //#endregion
5929 //#region modules/ai/assets/js/editor/pages/form-media/components/generate-again-submit.js
5930 init_extends();
5931 var GenerateAgainSubmit = function GenerateAgainSubmit(props) {
5932 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
5933 fullWidth: true,
5934 type: "submit",
5935 variant: "contained",
5936 color: "secondary",
5937 startIcon: /*#__PURE__*/ react.default.createElement(RefreshIcon, null),
5938 sx: { color: "background.paper" }
5939 }, props), (0, _wordpress_i18n.__)("Generate again", "elementor"));
5940 };
5941
5942 //#endregion
5943 //#region modules/ai/assets/js/editor/pages/form-media/components/new-prompt-button.js
5944 init_extends();
5945 var NewPromptButton = function NewPromptButton(props) {
5946 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
5947 fullWidth: true,
5948 variant: "text",
5949 color: "secondary"
5950 }, props), (0, _wordpress_i18n.__)("New prompt", "elementor"));
5951 };
5952
5953 //#endregion
5954 //#region modules/ai/assets/js/editor/pages/form-media/components/generate-images-submit.js
5955 init_extends();
5956 init_generate_button();
5957 init_voice_promotion_alert();
5958 var GenerateImagesSubmit = function GenerateImagesSubmit(props) {
5959 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(GenerateButton$1, _extends$1({
5960 size: "medium",
5961 fullWidth: true
5962 }, props), (0, _wordpress_i18n.__)("Generate images", "elementor")), /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-media-promotion" }));
5963 };
5964
5965 //#endregion
5966 //#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-size.js
5967 var useImageSize = function useImageSize(aspectRatio) {
5968 var _IMAGE_ASPECT_RATIO$a = IMAGE_ASPECT_RATIO[aspectRatio];
5969 return {
5970 width: _IMAGE_ASPECT_RATIO$a.width,
5971 height: _IMAGE_ASPECT_RATIO$a.height
5972 };
5973 };
5974
5975 //#endregion
5976 //#region modules/ai/assets/js/editor/hooks/use-image-navigation.js
5977 init_slicedToArray();
5978 var initialIndex = -1;
5979 var useImageNavigation = function useImageNavigation(images) {
5980 var _useState2 = _slicedToArray((0, react.useState)(initialIndex), 2);
5981 var zoomIndex = _useState2[0];
5982 var setZoomIndex = _useState2[1];
5983 return {
5984 zoomIndex,
5985 setZoomIndex,
5986 actions: {
5987 reset: function reset() {
5988 return setZoomIndex(initialIndex);
5989 },
5990 prev: function prev() {
5991 var prevImage = zoomIndex + 1;
5992 if (prevImage >= images.length) prevImage = 0;
5993 setZoomIndex(prevImage);
5994 },
5995 next: function next() {
5996 var nextImage = zoomIndex - 1;
5997 if (nextImage < 0) nextImage = images.length - 1;
5998 setZoomIndex(nextImage);
5999 }
6000 }
6001 };
6002 };
6003
6004 //#endregion
6005 //#region modules/ai/assets/js/editor/icons/chevron-right-icon.js
6006 init_extends();
6007 var ChevronRightIcon = react.default.forwardRef(function(props, ref) {
6008 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
6009 fillRule: "evenodd",
6010 clipRule: "evenodd",
6011 d: "M8.46967 18.2803C8.17678 17.9874 8.17678 17.5126 8.46967 17.2197L13.9393 11.75L8.46967 6.28033C8.17678 5.98744 8.17678 5.51256 8.46967 5.21967C8.76256 4.92678 9.23744 4.92678 9.53033 5.21967L15.5303 11.2197C15.8232 11.5126 15.8232 11.9874 15.5303 12.2803L9.53033 18.2803C9.23744 18.5732 8.76256 18.5732 8.46967 18.2803Z"
6012 }));
6013 });
6014
6015 //#endregion
6016 //#region modules/ai/assets/js/editor/pages/form-media/components/image-slider.js
6017 init_defineProperty$1();
6018 init_extends();
6019 init_objectWithoutProperties$1();
6020 var _excluded$18 = [
6021 "onPrev",
6022 "onNext",
6023 "children"
6024 ];
6025 var _excluded2$2 = [
6026 "children",
6027 "startAction",
6028 "sx"
6029 ];
6030 var _excluded3$1 = ["src", "alt"];
6031 function ownKeys$20(e, r) {
6032 var t = Object.keys(e);
6033 if (Object.getOwnPropertySymbols) {
6034 var o = Object.getOwnPropertySymbols(e);
6035 r && (o = o.filter(function(r) {
6036 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6037 })), t.push.apply(t, o);
6038 }
6039 return t;
6040 }
6041 __name(ownKeys$20, "ownKeys");
6042 function _objectSpread$20(e) {
6043 for (var r = 1; r < arguments.length; r++) {
6044 var t = null != arguments[r] ? arguments[r] : {};
6045 r % 2 ? ownKeys$20(Object(t), !0).forEach(function(r) {
6046 _defineProperty$1(e, r, t[r]);
6047 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$20(Object(t)).forEach(function(r) {
6048 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6049 });
6050 }
6051 return e;
6052 }
6053 __name(_objectSpread$20, "_objectSpread");
6054 var StyledChevronLeftIcon = (0, _elementor_ui.withDirection)(ChevronLeftIcon);
6055 var StyledChevronRightIcon = (0, _elementor_ui.withDirection)(ChevronRightIcon);
6056 var ImageSlider = function ImageSlider(_ref) {
6057 var onPrev = _ref.onPrev;
6058 var onNext = _ref.onNext;
6059 var children = _ref.children;
6060 var props = _objectWithoutProperties$1(_ref, _excluded$18);
6061 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, _extends$1({
6062 alignItems: "flex-start",
6063 spacing: .5
6064 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
6065 direction: "row",
6066 spacing: 2.5,
6067 alignSelf: "center",
6068 alignItems: "center"
6069 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
6070 onClick: onPrev,
6071 size: "large",
6072 color: "secondary"
6073 }, /*#__PURE__*/ react.default.createElement(StyledChevronLeftIcon, null)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
6074 spacing: .5,
6075 justifyContent: "space-around",
6076 alignItems: "center"
6077 }, children), /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
6078 onClick: onNext,
6079 size: "large",
6080 color: "secondary"
6081 }, /*#__PURE__*/ react.default.createElement(StyledChevronRightIcon, null))));
6082 };
6083 ImageSlider.propTypes = {
6084 onPrev: import_prop_types$8.default.func.isRequired,
6085 onNext: import_prop_types$8.default.func.isRequired,
6086 children: import_prop_types$8.default.node.isRequired
6087 };
6088 var Actions$1 = function Actions(_ref2) {
6089 var children = _ref2.children;
6090 var startAction = _ref2.startAction;
6091 var _ref2$sx = _ref2.sx;
6092 var sx = _ref2$sx === void 0 ? {} : _ref2$sx;
6093 var props = _objectWithoutProperties$1(_ref2, _excluded2$2);
6094 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({
6095 display: "flex",
6096 justifyContent: "flex-end",
6097 alignItems: "center",
6098 width: "100%"
6099 }, props, { sx: _objectSpread$20({ mb: 1.5 }, sx) }), startAction, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
6100 direction: "row",
6101 spacing: 2,
6102 justifyContent: "flex-end",
6103 flexGrow: 1,
6104 width: "100%"
6105 }, children));
6106 };
6107 Actions$1.propTypes = {
6108 sx: import_prop_types$8.default.object,
6109 startAction: import_prop_types$8.default.node,
6110 children: import_prop_types$8.default.node.isRequired
6111 };
6112 var Image$2 = function Image(_ref3) {
6113 var src = _ref3.src;
6114 var _ref3$alt = _ref3.alt;
6115 var alt = _ref3$alt === void 0 ? "" : _ref3$alt;
6116 var props = _objectWithoutProperties$1(_ref3, _excluded3$1);
6117 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
6118 display: "flex",
6119 justifyContent: "center",
6120 alignItems: "center"
6121 }, /*#__PURE__*/ react.default.createElement("img", _extends$1({
6122 src,
6123 alt
6124 }, props)));
6125 };
6126 Image$2.propTypes = {
6127 alt: import_prop_types$8.default.string,
6128 src: import_prop_types$8.default.string.isRequired
6129 };
6130 ImageSlider.Actions = Actions$1;
6131 ImageSlider.Image = Image$2;
6132
6133 //#endregion
6134 //#region modules/ai/assets/js/editor/icons/copy-icon.js
6135 init_extends();
6136 var CopyIcon$1 = react.default.forwardRef(function(props, ref) {
6137 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
6138 fillRule: "evenodd",
6139 clipRule: "evenodd",
6140 d: "M9 3.75C8.30964 3.75 7.75 4.30964 7.75 5V15C7.75 15.6904 8.30964 16.25 9 16.25H19C19.6904 16.25 20.25 15.6904 20.25 15V5C20.25 4.30964 19.6904 3.75 19 3.75H9ZM6.25 5C6.25 3.48122 7.48122 2.25 9 2.25H19C20.5188 2.25 21.75 3.48122 21.75 5V15C21.75 16.5188 20.5188 17.75 19 17.75H9C7.48122 17.75 6.25 16.5188 6.25 15V5Z"
6141 }), /*#__PURE__*/ react.default.createElement("path", {
6142 fillRule: "evenodd",
6143 clipRule: "evenodd",
6144 d: "M5 7.75C4.66848 7.75 4.35054 7.8817 4.11612 8.11612C3.8817 8.35054 3.75 8.66848 3.75 9V19C3.75 19.3315 3.8817 19.6495 4.11612 19.8839C4.35054 20.1183 4.66848 20.25 5 20.25H15C15.3315 20.25 15.6495 20.1183 15.8839 19.8839C16.1183 19.6495 16.25 19.3315 16.25 19V17C16.25 16.5858 16.5858 16.25 17 16.25C17.4142 16.25 17.75 16.5858 17.75 17V19C17.75 19.7293 17.4603 20.4288 16.9445 20.9445C16.4288 21.4603 15.7293 21.75 15 21.75H5C4.27065 21.75 3.57118 21.4603 3.05546 20.9445C2.53973 20.4288 2.25 19.7293 2.25 19V9C2.25 8.27065 2.53973 7.57118 3.05546 7.05546C3.57118 6.53973 4.27065 6.25 5 6.25H7C7.41421 6.25 7.75 6.58579 7.75 7C7.75 7.41421 7.41421 7.75 7 7.75H5Z"
6145 }));
6146 });
6147
6148 //#endregion
6149 //#region modules/ai/assets/js/editor/icons/edit-icon.js
6150 init_extends();
6151 var EditIcon$1 = react.default.forwardRef(function(props, ref) {
6152 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
6153 fillRule: "evenodd",
6154 clipRule: "evenodd",
6155 d: "M13.9697 4.96967C14.6408 4.29858 15.5509 3.92157 16.5 3.92157C17.4491 3.92157 18.3592 4.29858 19.0303 4.96967C19.7014 5.64075 20.0784 6.55094 20.0784 7.5C20.0784 8.44905 19.7014 9.35924 19.0303 10.0303L8.53033 20.5303C8.38968 20.671 8.19891 20.75 8 20.75H4C3.58579 20.75 3.25 20.4142 3.25 20V16C3.25 15.8011 3.32902 15.6103 3.46967 15.4697L13.9697 4.96967ZM16.5 5.42157C15.9488 5.42157 15.4201 5.64055 15.0303 6.03033L4.75 16.3107V19.25H7.68934L17.9697 8.96967C18.3595 8.57989 18.5784 8.05123 18.5784 7.5C18.5784 6.94876 18.3595 6.42011 17.9697 6.03033C17.5799 5.64055 17.0512 5.42157 16.5 5.42157Z"
6156 }), /*#__PURE__*/ react.default.createElement("path", {
6157 fillRule: "evenodd",
6158 clipRule: "evenodd",
6159 d: "M12.9697 5.96967C13.2626 5.67677 13.7374 5.67677 14.0303 5.96967L18.0303 9.96967C18.3232 10.2626 18.3232 10.7374 18.0303 11.0303C17.7374 11.3232 17.2626 11.3232 16.9697 11.0303L12.9697 7.03033C12.6768 6.73743 12.6768 6.26256 12.9697 5.96967Z"
6160 }));
6161 });
6162
6163 //#endregion
6164 //#region modules/ai/assets/js/editor/icons/download-icon.js
6165 init_extends();
6166 var DownloadIcon = react.default.forwardRef(function(props, ref) {
6167 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
6168 fillRule: "evenodd",
6169 clipRule: "evenodd",
6170 d: "M4 16.25C4.41421 16.25 4.75 16.5858 4.75 17V19C4.75 19.3315 4.8817 19.6495 5.11612 19.8839C5.35054 20.1183 5.66848 20.25 6 20.25H18C18.3315 20.25 18.6495 20.1183 18.8839 19.8839C19.1183 19.6495 19.25 19.3315 19.25 19V17C19.25 16.5858 19.5858 16.25 20 16.25C20.4142 16.25 20.75 16.5858 20.75 17V19C20.75 19.7293 20.4603 20.4288 19.9445 20.9445C19.4288 21.4603 18.7293 21.75 18 21.75H6C5.27065 21.75 4.57118 21.4603 4.05546 20.9445C3.53973 20.4288 3.25 19.7293 3.25 19V17C3.25 16.5858 3.58579 16.25 4 16.25Z"
6171 }), /*#__PURE__*/ react.default.createElement("path", {
6172 fillRule: "evenodd",
6173 clipRule: "evenodd",
6174 d: "M6.46967 10.4697C6.76256 10.1768 7.23744 10.1768 7.53033 10.4697L12 14.9393L16.4697 10.4697C16.7626 10.1768 17.2374 10.1768 17.5303 10.4697C17.8232 10.7626 17.8232 11.2374 17.5303 11.5303L12.5303 16.5303C12.2374 16.8232 11.7626 16.8232 11.4697 16.5303L6.46967 11.5303C6.17678 11.2374 6.17678 10.7626 6.46967 10.4697Z"
6175 }), /*#__PURE__*/ react.default.createElement("path", {
6176 fillRule: "evenodd",
6177 clipRule: "evenodd",
6178 d: "M12 3.25C12.4142 3.25 12.75 3.58579 12.75 4V16C12.75 16.4142 12.4142 16.75 12 16.75C11.5858 16.75 11.25 16.4142 11.25 16V4C11.25 3.58579 11.5858 3.25 12 3.25Z"
6179 }));
6180 });
6181
6182 //#endregion
6183 //#region modules/ai/assets/js/editor/icons/zoom-in-icon.js
6184 init_extends();
6185 var ZoomInIcon = react.default.forwardRef(function(props, ref) {
6186 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
6187 fillRule: "evenodd",
6188 clipRule: "evenodd",
6189 d: "M10 3.75C6.54822 3.75 3.75 6.54822 3.75 10C3.75 13.4518 6.54822 16.25 10 16.25C13.4518 16.25 16.25 13.4518 16.25 10C16.25 6.54822 13.4518 3.75 10 3.75ZM2.25 10C2.25 5.71979 5.71979 2.25 10 2.25C14.2802 2.25 17.75 5.71979 17.75 10C17.75 14.2802 14.2802 17.75 10 17.75C5.71979 17.75 2.25 14.2802 2.25 10Z"
6190 }), /*#__PURE__*/ react.default.createElement("path", {
6191 fillRule: "evenodd",
6192 clipRule: "evenodd",
6193 d: "M6.25 10C6.25 9.58579 6.58579 9.25 7 9.25H13C13.4142 9.25 13.75 9.58579 13.75 10C13.75 10.4142 13.4142 10.75 13 10.75H7C6.58579 10.75 6.25 10.4142 6.25 10Z"
6194 }), /*#__PURE__*/ react.default.createElement("path", {
6195 fillRule: "evenodd",
6196 clipRule: "evenodd",
6197 d: "M10 6.25C10.4142 6.25 10.75 6.58579 10.75 7V13C10.75 13.4142 10.4142 13.75 10 13.75C9.58579 13.75 9.25 13.4142 9.25 13V7C9.25 6.58579 9.58579 6.25 10 6.25Z"
6198 }), /*#__PURE__*/ react.default.createElement("path", {
6199 fillRule: "evenodd",
6200 clipRule: "evenodd",
6201 d: "M14.4697 14.4697C14.7626 14.1768 15.2374 14.1768 15.5303 14.4697L21.5303 20.4697C21.8232 20.7626 21.8232 21.2374 21.5303 21.5303C21.2374 21.8232 20.7626 21.8232 20.4697 21.5303L14.4697 15.5303C14.1768 15.2374 14.1768 14.7626 14.4697 14.4697Z"
6202 }));
6203 });
6204
6205 //#endregion
6206 //#region modules/ai/assets/js/editor/pages/form-media/components/image-actions.js
6207 init_defineProperty$1();
6208 init_objectWithoutProperties$1();
6209 init_extends();
6210 var _excluded$17 = ["children"];
6211 var _excluded2$1 = ["sx"];
6212 var _excluded3 = ["sx"];
6213 var _excluded4 = ["sx"];
6214 var _excluded5 = ["sx"];
6215 function ownKeys$19(e, r) {
6216 var t = Object.keys(e);
6217 if (Object.getOwnPropertySymbols) {
6218 var o = Object.getOwnPropertySymbols(e);
6219 r && (o = o.filter(function(r) {
6220 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6221 })), t.push.apply(t, o);
6222 }
6223 return t;
6224 }
6225 __name(ownKeys$19, "ownKeys");
6226 function _objectSpread$19(e) {
6227 for (var r = 1; r < arguments.length; r++) {
6228 var t = null != arguments[r] ? arguments[r] : {};
6229 r % 2 ? ownKeys$19(Object(t), !0).forEach(function(r) {
6230 _defineProperty$1(e, r, t[r]);
6231 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$19(Object(t)).forEach(function(r) {
6232 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6233 });
6234 }
6235 return e;
6236 }
6237 __name(_objectSpread$19, "_objectSpread");
6238 var StyledEditSvgIcon = (0, _elementor_ui.withDirection)(EditIcon$1);
6239 var StyledCopySvgIcon = (0, _elementor_ui.withDirection)(CopyIcon$1);
6240 var StyledZoomInIcon = (0, _elementor_ui.withDirection)(ZoomInIcon);
6241 var Tooltip$5 = function Tooltip(props) {
6242 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, _extends$1({ PopperProps: { sx: { "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { mt: 1 } } } }, props));
6243 };
6244 var ImageActions = function ImageActions(_ref) {
6245 var children = _ref.children;
6246 var props = _objectWithoutProperties$1(_ref, _excluded$17);
6247 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({
6248 display: "flex",
6249 justifyContent: "space-between",
6250 alignItems: "center",
6251 width: "100%",
6252 gap: 1
6253 }, props), children);
6254 };
6255 ImageActions.propTypes = { children: import_prop_types$8.default.node };
6256 var UseImage = function UseImage(_ref2) {
6257 var sx = _ref2.sx;
6258 var props = _objectWithoutProperties$1(_ref2, _excluded2$1);
6259 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
6260 size: "small",
6261 variant: "contained",
6262 startIcon: /*#__PURE__*/ react.default.createElement(DownloadIcon, null),
6263 sx
6264 }, props), (0, _wordpress_i18n.__)("Use Image", "elementor"));
6265 };
6266 UseImage.propTypes = { sx: import_prop_types$8.default.object };
6267 var EditImage = function EditImage(props) {
6268 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
6269 size: "small",
6270 color: "secondary",
6271 startIcon: /*#__PURE__*/ react.default.createElement(StyledEditSvgIcon, null)
6272 }, props), (0, _wordpress_i18n.__)("Edit", "elementor"));
6273 };
6274 var EditIcon = function EditIcon(_ref3) {
6275 var _ref3$sx = _ref3.sx;
6276 var sx = _ref3$sx === void 0 ? {} : _ref3$sx;
6277 var props = _objectWithoutProperties$1(_ref3, _excluded3);
6278 return /*#__PURE__*/ react.default.createElement(Tooltip$5, { title: (0, _wordpress_i18n.__)("Edit", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ sx: _objectSpread$19({
6279 mr: -1.5,
6280 ml: .5,
6281 color: "common.white",
6282 "&:hover": { color: "common.white" }
6283 }, sx) }, props), /*#__PURE__*/ react.default.createElement(StyledEditSvgIcon, null)));
6284 };
6285 EditIcon.propTypes = { sx: import_prop_types$8.default.object };
6286 var ZoomIcon = function ZoomIcon(_ref4) {
6287 var _ref4$sx = _ref4.sx;
6288 var sx = _ref4$sx === void 0 ? {} : _ref4$sx;
6289 var props = _objectWithoutProperties$1(_ref4, _excluded4);
6290 return /*#__PURE__*/ react.default.createElement(Tooltip$5, { title: (0, _wordpress_i18n.__)("Zoom", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({
6291 color: "secondary",
6292 "aria-label": (0, _wordpress_i18n.__)("Zoom", "elementor"),
6293 sx: _objectSpread$19({
6294 color: "common.white",
6295 "&:hover": { color: "common.white" }
6296 }, sx)
6297 }, props), /*#__PURE__*/ react.default.createElement(StyledZoomInIcon, null)));
6298 };
6299 ZoomIcon.propTypes = { sx: import_prop_types$8.default.object };
6300 var CopyIcon = function CopyIcon(_ref5) {
6301 var _ref5$sx = _ref5.sx;
6302 var sx = _ref5$sx === void 0 ? {} : _ref5$sx;
6303 var props = _objectWithoutProperties$1(_ref5, _excluded5);
6304 return /*#__PURE__*/ react.default.createElement(Tooltip$5, { title: (0, _wordpress_i18n.__)("Copy prompt", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({ sx: _objectSpread$19({
6305 mr: -1.5,
6306 ml: .5,
6307 color: "common.white",
6308 "&:hover": { color: "common.white" }
6309 }, sx) }, props), /*#__PURE__*/ react.default.createElement(StyledCopySvgIcon, null)));
6310 };
6311 CopyIcon.propTypes = { sx: import_prop_types$8.default.object };
6312 ImageActions.UseImage = UseImage;
6313 ImageActions.EditImage = EditImage;
6314 ImageActions.EditIcon = EditIcon;
6315 ImageActions.ZoomIcon = ZoomIcon;
6316 ImageActions.CopyIcon = CopyIcon;
6317
6318 //#endregion
6319 //#region modules/ai/assets/js/editor/pages/form-media/components/single-image-preview.js
6320 init_defineProperty$1();
6321 init_extends();
6322 init_objectWithoutProperties$1();
6323 var _excluded$16 = ["children"];
6324 var _excluded2 = ["children", "sx"];
6325 function ownKeys$18(e, r) {
6326 var t = Object.keys(e);
6327 if (Object.getOwnPropertySymbols) {
6328 var o = Object.getOwnPropertySymbols(e);
6329 r && (o = o.filter(function(r) {
6330 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6331 })), t.push.apply(t, o);
6332 }
6333 return t;
6334 }
6335 __name(ownKeys$18, "ownKeys");
6336 function _objectSpread$18(e) {
6337 for (var r = 1; r < arguments.length; r++) {
6338 var t = null != arguments[r] ? arguments[r] : {};
6339 r % 2 ? ownKeys$18(Object(t), !0).forEach(function(r) {
6340 _defineProperty$1(e, r, t[r]);
6341 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$18(Object(t)).forEach(function(r) {
6342 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6343 });
6344 }
6345 return e;
6346 }
6347 __name(_objectSpread$18, "_objectSpread");
6348 var SingleImagePreview = function SingleImagePreview(_ref) {
6349 var children = _ref.children;
6350 var props = _objectWithoutProperties$1(_ref, _excluded$16);
6351 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ display: "flex" }, props), children);
6352 };
6353 SingleImagePreview.propTypes = { children: import_prop_types$8.default.node.isRequired };
6354 var Actions = function Actions(_ref2) {
6355 var children = _ref2.children;
6356 var _ref2$sx = _ref2.sx;
6357 var sx = _ref2$sx === void 0 ? {} : _ref2$sx;
6358 var props = _objectWithoutProperties$1(_ref2, _excluded2);
6359 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({
6360 display: "flex",
6361 width: "100%",
6362 justifyContent: "flex-end",
6363 alignItems: "center"
6364 }, props, { sx: _objectSpread$18({ mb: 1.5 }, sx) }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
6365 direction: "row",
6366 spacing: 2,
6367 justifyContent: "flex-end",
6368 width: "100%"
6369 }, children));
6370 };
6371 Actions.propTypes = {
6372 sx: import_prop_types$8.default.object,
6373 children: import_prop_types$8.default.node.isRequired
6374 };
6375 var Image$1 = function Image(_ref3) {
6376 var src = _ref3.src;
6377 var alt = _ref3.alt;
6378 var _ref3$style = _ref3.style;
6379 var style = _ref3$style === void 0 ? {} : _ref3$style;
6380 var _ref3$isLoading = _ref3.isLoading;
6381 var isLoading = _ref3$isLoading === void 0 ? false : _ref3$isLoading;
6382 var children = _ref3.children;
6383 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { margin: "0 auto" }, children, isLoading ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, {
6384 sx: _objectSpread$18({
6385 maxWidth: "100%",
6386 width: "auto",
6387 maxHeight: "100%"
6388 }, style),
6389 animation: "wave",
6390 variant: "rounded"
6391 }) : /*#__PURE__*/ react.default.createElement("img", {
6392 src,
6393 alt,
6394 style: _objectSpread$18({
6395 maxWidth: "100%",
6396 width: "auto",
6397 maxHeight: "100%"
6398 }, style)
6399 }));
6400 };
6401 Image$1.propTypes = {
6402 style: import_prop_types$8.default.object,
6403 children: import_prop_types$8.default.node,
6404 src: import_prop_types$8.default.string.isRequired,
6405 alt: import_prop_types$8.default.string.isRequired,
6406 isLoading: import_prop_types$8.default.bool
6407 };
6408 SingleImagePreview.Actions = Actions;
6409 SingleImagePreview.Image = Image$1;
6410
6411 //#endregion
6412 //#region modules/ai/assets/js/editor/pages/form-media/components/images-display.js
6413 init_extends();
6414 init_defineProperty$1();
6415 init_objectWithoutProperties$1();
6416 var _excluded$15 = ["children", "sx"];
6417 function ownKeys$17(e, r) {
6418 var t = Object.keys(e);
6419 if (Object.getOwnPropertySymbols) {
6420 var o = Object.getOwnPropertySymbols(e);
6421 r && (o = o.filter(function(r) {
6422 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6423 })), t.push.apply(t, o);
6424 }
6425 return t;
6426 }
6427 __name(ownKeys$17, "ownKeys");
6428 function _objectSpread$17(e) {
6429 for (var r = 1; r < arguments.length; r++) {
6430 var t = null != arguments[r] ? arguments[r] : {};
6431 r % 2 ? ownKeys$17(Object(t), !0).forEach(function(r) {
6432 _defineProperty$1(e, r, t[r]);
6433 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$17(Object(t)).forEach(function(r) {
6434 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6435 });
6436 }
6437 return e;
6438 }
6439 __name(_objectSpread$17, "_objectSpread");
6440 var Container = function Container(_ref) {
6441 var children = _ref.children;
6442 var _ref$sx = _ref.sx;
6443 var sx = _ref$sx === void 0 ? {} : _ref$sx;
6444 var props = _objectWithoutProperties$1(_ref, _excluded$15);
6445 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, _extends$1({ flexGrow: 1 }, props, { sx: _objectSpread$17({ overflowY: "auto" }, sx) }), children);
6446 };
6447 Container.propTypes = {
6448 sx: import_prop_types$8.default.object,
6449 children: import_prop_types$8.default.node
6450 };
6451 var ImagesDisplay = function ImagesDisplay(_ref2) {
6452 var images = _ref2.images;
6453 var _ref2$aspectRatio = _ref2.aspectRatio;
6454 var aspectRatio = _ref2$aspectRatio === void 0 ? "1:1" : _ref2$aspectRatio;
6455 var _ref2$onUseImage = _ref2.onUseImage;
6456 var onUseImage = _ref2$onUseImage === void 0 ? null : _ref2$onUseImage;
6457 var _ref2$onEditImage = _ref2.onEditImage;
6458 var onEditImage = _ref2$onEditImage === void 0 ? null : _ref2$onEditImage;
6459 var _ref2$transparentCont = _ref2.transparentContainer;
6460 var transparentContainer = _ref2$transparentCont === void 0 ? false : _ref2$transparentCont;
6461 var _ref2$cols = _ref2.cols;
6462 var cols = _ref2$cols === void 0 ? 2 : _ref2$cols;
6463 var _ref2$overlay = _ref2.overlay;
6464 var overlay = _ref2$overlay === void 0 ? true : _ref2$overlay;
6465 var _ref2$onSelectChange = _ref2.onSelectChange;
6466 var onSelectChange = _ref2$onSelectChange === void 0 ? null : _ref2$onSelectChange;
6467 var _useImageNavigation = useImageNavigation(images);
6468 var zoomIndex = _useImageNavigation.zoomIndex;
6469 var setZoomIndex = _useImageNavigation.setZoomIndex;
6470 var actions = _useImageNavigation.actions;
6471 var _useImageSize = useImageSize(aspectRatio);
6472 var width = _useImageSize.width;
6473 var height = _useImageSize.height;
6474 if (zoomIndex > -1) {
6475 var currentImage = images[zoomIndex];
6476 return /*#__PURE__*/ react.default.createElement(Container, null, /*#__PURE__*/ react.default.createElement(ImageSlider, {
6477 onPrev: actions.prev,
6478 onNext: actions.next
6479 }, /*#__PURE__*/ react.default.createElement(ImageSlider.Actions, { startAction: /*#__PURE__*/ react.default.createElement(BackButton$1, { onClick: actions.reset }) }, onEditImage && /*#__PURE__*/ react.default.createElement(ImageActions.EditImage, { onClick: function onClick() {
6480 return onEditImage(currentImage);
6481 } }), onUseImage && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { onClick: function onClick() {
6482 return onUseImage(currentImage);
6483 } })), /*#__PURE__*/ react.default.createElement(ImageSlider.Image, {
6484 src: currentImage.image_url,
6485 style: {
6486 maxWidth: "630px",
6487 width: "100%",
6488 height: "auto"
6489 }
6490 })));
6491 }
6492 if (1 === images.length) {
6493 var image = images[0];
6494 var singleImageStyle = {
6495 width,
6496 height
6497 };
6498 if (transparentContainer) {
6499 singleImageStyle.backgroundImage = "linear-gradient(45deg, #bbb 25%, transparent 25%), linear-gradient(-45deg, #bbb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #bbb 75%), linear-gradient(-45deg, transparent 75%, #bbb 75%)";
6500 singleImageStyle.backgroundSize = "20px 20px";
6501 singleImageStyle.backgroundPosition = "0 0, 0 10px, 10px -10px, -10px 0px";
6502 }
6503 return /*#__PURE__*/ react.default.createElement(Container, { flexDirection: "column" }, /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, {
6504 src: image.image_url || image.url,
6505 style: singleImageStyle,
6506 alt: "generated-image",
6507 isLoading: image.isLoading
6508 }, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Actions, null, onEditImage && /*#__PURE__*/ react.default.createElement(ImageActions.EditImage, { onClick: function onClick() {
6509 return onEditImage(image);
6510 } }), onUseImage && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { onClick: function onClick() {
6511 return onUseImage(image);
6512 } })))));
6513 }
6514 return /*#__PURE__*/ react.default.createElement(Container, null, /*#__PURE__*/ react.default.createElement(Gallery, { cols }, images.map(function(image, index) {
6515 return /*#__PURE__*/ react.default.createElement(Gallery.Image, {
6516 key: "result-".concat(image.seed),
6517 alt: "generated-".concat(index),
6518 src: image.image_url,
6519 aspectRatio,
6520 "data-testid": "e-gallery-image",
6521 numImagesInRow: cols,
6522 overlay,
6523 onSelectChange: onSelectChange ? function(isChecked) {
6524 return onSelectChange(image.productId, isChecked);
6525 } : null,
6526 checkboxColor: image.checkboxColor,
6527 initialChecked: image.isChecked,
6528 isLoading: image.isLoading
6529 }, /*#__PURE__*/ react.default.createElement(ImageActions, null, onUseImage && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, {
6530 onClick: function onClick() {
6531 return onUseImage(image);
6532 },
6533 size: "medium",
6534 fullWidth: true
6535 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
6536 direction: "row",
6537 spacing: .25,
6538 alignItems: "center"
6539 }, /*#__PURE__*/ react.default.createElement(ImageActions.ZoomIcon, {
6540 onClick: function onClick() {
6541 return setZoomIndex(index);
6542 },
6543 size: "medium"
6544 }), onEditImage && /*#__PURE__*/ react.default.createElement(ImageActions.EditIcon, {
6545 onClick: function onClick() {
6546 return onEditImage(image);
6547 },
6548 size: "medium"
6549 }))));
6550 })));
6551 };
6552 ImagesDisplay.propTypes = {
6553 images: import_prop_types$8.default.array,
6554 aspectRatio: import_prop_types$8.default.string,
6555 onUseImage: import_prop_types$8.default.func,
6556 onEditImage: import_prop_types$8.default.func,
6557 transparentContainer: import_prop_types$8.default.bool,
6558 cols: import_prop_types$8.default.number,
6559 overlay: import_prop_types$8.default.bool,
6560 onSelectChange: import_prop_types$8.default.func
6561 };
6562 ImagesDisplay.Container = Container;
6563
6564 //#endregion
6565 //#region modules/ai/assets/js/editor/pages/form-media/hooks/use-prompt-settings.js
6566 init_defineProperty$1();
6567 init_slicedToArray();
6568 function ownKeys$16(e, r) {
6569 var t = Object.keys(e);
6570 if (Object.getOwnPropertySymbols) {
6571 var o = Object.getOwnPropertySymbols(e);
6572 r && (o = o.filter(function(r) {
6573 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6574 })), t.push.apply(t, o);
6575 }
6576 return t;
6577 }
6578 __name(ownKeys$16, "ownKeys");
6579 function _objectSpread$16(e) {
6580 for (var r = 1; r < arguments.length; r++) {
6581 var t = null != arguments[r] ? arguments[r] : {};
6582 r % 2 ? ownKeys$16(Object(t), !0).forEach(function(r) {
6583 _defineProperty$1(e, r, t[r]);
6584 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$16(Object(t)).forEach(function(r) {
6585 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6586 });
6587 }
6588 return e;
6589 }
6590 __name(_objectSpread$16, "_objectSpread");
6591 var IMAGE_TYPE = IMAGE_PROMPT_SETTINGS.IMAGE_TYPE;
6592 var IMAGE_STYLE = IMAGE_PROMPT_SETTINGS.IMAGE_STYLE;
6593 var IMAGE_STRENGTH = IMAGE_PROMPT_SETTINGS.IMAGE_STRENGTH;
6594 var IMAGE_RATIO = IMAGE_PROMPT_SETTINGS.IMAGE_RATIO;
6595 var IMAGE_ZOOM = IMAGE_PROMPT_SETTINGS.IMAGE_ZOOM;
6596 var IMAGE_UPSCALE = IMAGE_PROMPT_SETTINGS.IMAGE_UPSCALE;
6597 var IMAGE_BACKGROUND_COLOR = IMAGE_PROMPT_SETTINGS.IMAGE_BACKGROUND_COLOR;
6598 var DEFAULT_TYPE = "";
6599 var DEFAULT_STYLE = "";
6600 var DEFAULT_STRENGTH = 0;
6601 var DEFAULT_RATIO = "1:1";
6602 var DEFAULT_ZOOM = "1";
6603 var DEFAULT_UPSCALE = "512";
6604 var DEFAULT_COLOR = "#FFFFFF";
6605 var usePromptSettings = function usePromptSettings() {
6606 var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
6607 var _ref$type = _ref.type;
6608 var type = _ref$type === void 0 ? DEFAULT_TYPE : _ref$type;
6609 var _ref$style = _ref.style;
6610 var style = _ref$style === void 0 ? DEFAULT_STYLE : _ref$style;
6611 var _ref$imageWeight = _ref.imageWeight;
6612 var imageWeight = _ref$imageWeight === void 0 ? DEFAULT_STRENGTH : _ref$imageWeight;
6613 var _ref$aspectRatio = _ref.aspectRatio;
6614 var aspectRatio = _ref$aspectRatio === void 0 ? DEFAULT_RATIO : _ref$aspectRatio;
6615 var _ref$zoom = _ref.zoom;
6616 var zoom = _ref$zoom === void 0 ? DEFAULT_ZOOM : _ref$zoom;
6617 var _ref$upScaleTo = _ref.upScaleTo;
6618 var upScaleTo = _ref$upScaleTo === void 0 ? DEFAULT_UPSCALE : _ref$upScaleTo;
6619 var _ref$bgColor = _ref.bgColor;
6620 var bgColor = _ref$bgColor === void 0 ? DEFAULT_COLOR : _ref$bgColor;
6621 var _useState2 = _slicedToArray((0, react.useState)(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, IMAGE_TYPE, type), IMAGE_STYLE, style), IMAGE_STRENGTH, imageWeight), IMAGE_RATIO, aspectRatio), IMAGE_ZOOM, zoom), IMAGE_UPSCALE, upScaleTo), IMAGE_BACKGROUND_COLOR, bgColor)), 2);
6622 var settings = _useState2[0];
6623 var setSettings = _useState2[1];
6624 return {
6625 settings,
6626 updateSettings: function updateSettings(updated) {
6627 return setSettings(function(prev) {
6628 return _objectSpread$16(_objectSpread$16({}, prev), updated);
6629 });
6630 },
6631 resetSettings: function resetSettings() {
6632 setSettings(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, IMAGE_TYPE, type), IMAGE_STYLE, DEFAULT_STYLE), IMAGE_STRENGTH, DEFAULT_STRENGTH), IMAGE_RATIO, aspectRatio), IMAGE_ZOOM, DEFAULT_ZOOM), IMAGE_UPSCALE, DEFAULT_UPSCALE), IMAGE_BACKGROUND_COLOR, bgColor));
6633 }
6634 };
6635 };
6636
6637 //#endregion
6638 //#region modules/ai/assets/js/editor/hooks/use-images-preload.js
6639 init_slicedToArray();
6640 var loadImage$1 = function loadImage(url) {
6641 return new Promise(function(resolve, reject) {
6642 var loadImg = new Image();
6643 loadImg.src = url;
6644 loadImg.onload = function() {
6645 return resolve(url);
6646 };
6647 loadImg.onerror = function(err) {
6648 return reject(err);
6649 };
6650 });
6651 };
6652 var useImagesPreload = function useImagesPreload() {
6653 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
6654 var ready = _useState2[0];
6655 var setReady = _useState2[1];
6656 return {
6657 ready,
6658 preloadImages: function preloadImages(images) {
6659 setReady(false);
6660 Promise.all(images.map(function(url) {
6661 return loadImage$1(url);
6662 })).then(function() {
6663 return setReady(true);
6664 }).catch(function(err) {
6665 return console.log("Failed to load images", err);
6666 });
6667 }
6668 };
6669 };
6670
6671 //#endregion
6672 //#region modules/ai/assets/js/editor/pages/form-media/views/generate/hooks/use-suggested-images.js
6673 init_slicedToArray();
6674 var shuffleImages = function shuffleImages(images) {
6675 return images.map(function(image) {
6676 return [Math.random(), image];
6677 }).sort(function(_ref, _ref2) {
6678 return _slicedToArray(_ref, 1)[0] - _slicedToArray(_ref2, 1)[0];
6679 }).map(function(_ref5) {
6680 return _slicedToArray(_ref5, 2)[1];
6681 });
6682 };
6683 var checkImageTypeIgnoreStyle = function checkImageTypeIgnoreStyle(imageType, selectedType) {
6684 return _slicedToArray(imageType.split("/"), 1)[0] === selectedType;
6685 };
6686 var useSuggestedImages = function useSuggestedImages(_ref7) {
6687 var selectedType = _ref7.selectedType;
6688 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
6689 var isLoading = _useState2[0];
6690 var setIsLoading = _useState2[1];
6691 var _useState4 = _slicedToArray((0, react.useState)({ images: [] }), 2);
6692 var data = _useState4[0];
6693 var setImagesState = _useState4[1];
6694 var _useImagesPreload = useImagesPreload();
6695 var ready = _useImagesPreload.ready;
6696 var preloadImages = _useImagesPreload.preloadImages;
6697 var imagesData = (0, react.useMemo)(function() {
6698 var shuffledImages = shuffleImages(data.images);
6699 if (!selectedType) return shuffledImages;
6700 var categoryImages = shuffledImages.filter(function(_ref8) {
6701 var imageType = _ref8.imageType;
6702 return checkImageTypeIgnoreStyle(imageType, selectedType);
6703 });
6704 return categoryImages.length ? categoryImages : shuffledImages;
6705 }, [selectedType, data]);
6706 var fetchImages = function fetchImages() {
6707 setIsLoading(true);
6708 fetch("https://my.elementor.com/ai/images-prompt-gallery/ai-gallery.json").then(function(response) {
6709 return response.json();
6710 }).then(function(json) {
6711 return setImagesState(json);
6712 }).catch(function(e) {
6713 return console.log(e.message);
6714 }).finally(function() {
6715 return setIsLoading(false);
6716 });
6717 };
6718 (0, react.useEffect)(function() {
6719 if (0 === (data === null || data === void 0 ? void 0 : data.images.length)) {
6720 fetchImages();
6721 return;
6722 }
6723 preloadImages(data.images.map(function(_ref9) {
6724 return _ref9.thumbnailUrl;
6725 }));
6726 }, [data]);
6727 return {
6728 imagesData,
6729 isLoading: !ready || isLoading
6730 };
6731 };
6732
6733 //#endregion
6734 //#region modules/ai/assets/js/editor/pages/form-media/utils/index.js
6735 init_asyncToGenerator();
6736 init_defineProperty$1();
6737 init_slicedToArray();
6738 function ownKeys$15(e, r) {
6739 var t = Object.keys(e);
6740 if (Object.getOwnPropertySymbols) {
6741 var o = Object.getOwnPropertySymbols(e);
6742 r && (o = o.filter(function(r) {
6743 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6744 })), t.push.apply(t, o);
6745 }
6746 return t;
6747 }
6748 __name(ownKeys$15, "ownKeys");
6749 function _objectSpread$15(e) {
6750 for (var r = 1; r < arguments.length; r++) {
6751 var t = null != arguments[r] ? arguments[r] : {};
6752 r % 2 ? ownKeys$15(Object(t), !0).forEach(function(r) {
6753 _defineProperty$1(e, r, t[r]);
6754 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$15(Object(t)).forEach(function(r) {
6755 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6756 });
6757 }
6758 return e;
6759 }
6760 __name(_objectSpread$15, "_objectSpread");
6761 var getAspectRatioSizes = function getAspectRatioSizes(width, height) {
6762 var aspectRatios = Object.keys(IMAGE_ASPECT_RATIO);
6763 var targetRatio = width / height;
6764 var closestRatio = aspectRatios[0];
6765 var minDiff = Infinity;
6766 aspectRatios.forEach(function(ratio) {
6767 var _ratio$split$map2 = _slicedToArray(ratio.split(":").map(Number), 2);
6768 var w = _ratio$split$map2[0];
6769 var h = _ratio$split$map2[1];
6770 var diff = Math.abs(targetRatio - w / h);
6771 if (diff < minDiff) {
6772 minDiff = diff;
6773 closestRatio = ratio;
6774 }
6775 });
6776 return _objectSpread$15({ ratio: closestRatio }, IMAGE_ASPECT_RATIO[closestRatio]);
6777 };
6778 var fetchImageAsBase64 = /*#__PURE__*/ function() {
6779 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(url) {
6780 var response;
6781 var blob;
6782 var reader;
6783 var _t;
6784 return import_regenerator$2.default.wrap(function(_context) {
6785 while (1) switch (_context.prev = _context.next) {
6786 case 0:
6787 _context.prev = 0;
6788 _context.next = 1;
6789 return fetch(url);
6790 case 1:
6791 response = _context.sent;
6792 _context.next = 2;
6793 return response.blob();
6794 case 2:
6795 blob = _context.sent;
6796 reader = new FileReader();
6797 return _context.abrupt("return", new Promise(function(resolve, reject) {
6798 reader.onloadend = function() {
6799 resolve(reader.result);
6800 };
6801 reader.onerror = reject;
6802 reader.readAsDataURL(blob);
6803 }));
6804 case 3:
6805 _context.prev = 3;
6806 _t = _context["catch"](0);
6807 throw _t;
6808 case 4:
6809 case "end": return _context.stop();
6810 }
6811 }, _callee, null, [[0, 3]]);
6812 }));
6813 return function fetchImageAsBase64(_x) {
6814 return _ref.apply(this, arguments);
6815 };
6816 }();
6817
6818 //#endregion
6819 //#region modules/ai/assets/js/editor/pages/form-media/context/edit-image-context.js
6820 init_slicedToArray();
6821 init_defineProperty$1();
6822 function ownKeys$14(e, r) {
6823 var t = Object.keys(e);
6824 if (Object.getOwnPropertySymbols) {
6825 var o = Object.getOwnPropertySymbols(e);
6826 r && (o = o.filter(function(r) {
6827 return Object.getOwnPropertyDescriptor(e, r).enumerable;
6828 })), t.push.apply(t, o);
6829 }
6830 return t;
6831 }
6832 __name(ownKeys$14, "ownKeys");
6833 function _objectSpread$14(e) {
6834 for (var r = 1; r < arguments.length; r++) {
6835 var t = null != arguments[r] ? arguments[r] : {};
6836 r % 2 ? ownKeys$14(Object(t), !0).forEach(function(r) {
6837 _defineProperty$1(e, r, t[r]);
6838 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$14(Object(t)).forEach(function(r) {
6839 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6840 });
6841 }
6842 return e;
6843 }
6844 __name(_objectSpread$14, "_objectSpread");
6845 var EditImageContext = (0, react.createContext)({});
6846 var SET_STATE = "SET_STATE";
6847 var SET_ASPECT_RATIO = "SET_ASPECT_RATIO";
6848 var SET_LOADING = "SET_LOADING";
6849 var RESET = "RESET";
6850 var initialValue = {
6851 id: "",
6852 url: "",
6853 isLoading: false,
6854 aspectRatio: "1:1"
6855 };
6856 var reducer$1 = function reducer(state, _ref) {
6857 var type = _ref.type;
6858 var payload = _ref.payload;
6859 switch (type) {
6860 case SET_STATE: return _objectSpread$14(_objectSpread$14({}, state), payload);
6861 case SET_ASPECT_RATIO: return _objectSpread$14(_objectSpread$14({}, state), {}, { aspectRatio: payload });
6862 case SET_LOADING: return _objectSpread$14(_objectSpread$14({}, state), {}, { isLoading: payload });
6863 case RESET: return initialValue;
6864 default: throw Error("Unknown action.");
6865 }
6866 };
6867 var EditImageProvider = function EditImageProvider(_ref2) {
6868 var children = _ref2.children;
6869 var imageData = _ref2.imageData;
6870 var _useReducer2 = _slicedToArray((0, react.useReducer)(reducer$1, _objectSpread$14(_objectSpread$14({}, initialValue), imageData)), 2);
6871 var state = _useReducer2[0];
6872 var dispatch = _useReducer2[1];
6873 return /*#__PURE__*/ react.default.createElement(EditImageContext.Provider, { value: {
6874 state,
6875 dispatch
6876 } }, children);
6877 };
6878 EditImageProvider.propTypes = {
6879 children: import_prop_types$8.default.node,
6880 imageData: import_prop_types$8.default.object
6881 };
6882 var useEditImage = function useEditImage() {
6883 var _useContext = (0, react.useContext)(EditImageContext);
6884 var state = _useContext.state;
6885 var dispatch = _useContext.dispatch;
6886 var id = state.id;
6887 var url = state.url;
6888 var aspectRatio = state.aspectRatio;
6889 var isLoading = state.isLoading;
6890 var _useImageSize = useImageSize(aspectRatio);
6891 var width = _useImageSize.width;
6892 var height = _useImageSize.height;
6893 var setEditImage = function setEditImage(payload) {
6894 return dispatch({
6895 type: SET_STATE,
6896 payload
6897 });
6898 };
6899 var setAspectRatio = function setAspectRatio(payload) {
6900 return dispatch({
6901 type: SET_ASPECT_RATIO,
6902 payload
6903 });
6904 };
6905 var reset = function reset() {
6906 return dispatch({ type: RESET });
6907 };
6908 (0, react.useEffect)(function() {
6909 if (!id) return;
6910 dispatch({
6911 type: SET_LOADING,
6912 payload: true
6913 });
6914 var img = new Image();
6915 img.src = url;
6916 img.onload = function() {
6917 var ratio = getAspectRatioSizes(img.width, img.height).ratio;
6918 dispatch({
6919 type: SET_STATE,
6920 payload: {
6921 aspectRatio: ratio,
6922 isLoading: false
6923 }
6924 });
6925 };
6926 }, [id]);
6927 return {
6928 editImage: state,
6929 isLoading,
6930 aspectRatio,
6931 width,
6932 height,
6933 setEditImage,
6934 setAspectRatio,
6935 reset
6936 };
6937 };
6938
6939 //#endregion
6940 //#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-upload.js
6941 init_slicedToArray();
6942 init_api();
6943 var useImageUpload = function useImageUpload() {
6944 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
6945 var isUploading = _useState2[0];
6946 var setIsUploading = _useState2[1];
6947 var _useState4 = _slicedToArray((0, react.useState)(""), 2);
6948 var uploadError = _useState4[0];
6949 var setUploadError = _useState4[1];
6950 var _useState6 = _slicedToArray((0, react.useState)({}), 2);
6951 var attachmentData = _useState6[0];
6952 var setAttachmentData = _useState6[1];
6953 return {
6954 upload: function upload(_ref) {
6955 var image = _ref.image;
6956 var prompt = _ref.prompt;
6957 return new Promise(function(resolve, reject) {
6958 setUploadError("");
6959 setAttachmentData({});
6960 setIsUploading(true);
6961 uploadImage({
6962 image,
6963 prompt
6964 }).then(function(result) {
6965 setAttachmentData(result);
6966 resolve(result);
6967 }).catch(function(err) {
6968 var error = (err === null || err === void 0 ? void 0 : err.responseText) || err;
6969 setUploadError(error);
6970 reject(error);
6971 }).finally(function() {
6972 return setIsUploading(false);
6973 });
6974 });
6975 },
6976 resetUpload: function resetUpload() {
6977 setUploadError("");
6978 setAttachmentData({});
6979 setIsUploading(false);
6980 },
6981 isUploading,
6982 uploadError,
6983 attachmentData
6984 };
6985 };
6986
6987 //#endregion
6988 //#region modules/ai/assets/js/editor/pages/form-media/context/global-actions-context.js
6989 var GlobalActionsContext = (0, react.createContext)({});
6990 var GlobalActionsProvider = function GlobalActionsProvider(_ref) {
6991 var actions = _ref.actions;
6992 var children = _ref.children;
6993 return /*#__PURE__*/ react.default.createElement(GlobalActionsContext.Provider, { value: actions }, children);
6994 };
6995 GlobalActionsProvider.propTypes = {
6996 actions: import_prop_types$8.default.object,
6997 children: import_prop_types$8.default.node
6998 };
6999 var useGlobalActions = function useGlobalActions() {
7000 return (0, react.useContext)(GlobalActionsContext);
7001 };
7002
7003 //#endregion
7004 //#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js
7005 function _classCallCheck(a, n) {
7006 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
7007 }
7008
7009 //#endregion
7010 //#region node_modules/@babel/runtime/helpers/esm/createClass.js
7011 init_toPropertyKey$1();
7012 function _defineProperties(e, r) {
7013 for (var t = 0; t < r.length; t++) {
7014 var o = r[t];
7015 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$1(o.key), o);
7016 }
7017 }
7018 function _createClass(e, r, t) {
7019 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
7020 }
7021
7022 //#endregion
7023 //#region assets/dev/js/editor/utils/files-upload-handler.js
7024 var FilesUploadHandler = /*#__PURE__*/ function() {
7025 function FilesUploadHandler() {
7026 _classCallCheck(this, FilesUploadHandler);
7027 }
7028 return _createClass(FilesUploadHandler, null, [
7029 {
7030 key: "isUploadEnabled",
7031 value: function isUploadEnabled(mediaType) {
7032 if (!["svg", "application/json"].includes(mediaType)) return true;
7033 return elementorCommon.config.filesUpload.unfilteredFiles;
7034 }
7035 },
7036 {
7037 key: "setUploadTypeCaller",
7038 value: function setUploadTypeCaller(frame) {
7039 frame.uploader.uploader.param("uploadTypeCaller", "elementor-wp-media-upload");
7040 }
7041 },
7042 {
7043 key: "getUnfilteredFilesNonAdminDialog",
7044 value: function getUnfilteredFilesNonAdminDialog() {
7045 return elementorCommon.dialogsManager.createWidget("alert", {
7046 id: "e-unfiltered-files-disabled-dialog",
7047 headerMessage: (0, _wordpress_i18n.__)("Sorry, you can't upload that file yet", "elementor"),
7048 message: (0, _wordpress_i18n.__)("This is because JSON files may pose a security risk.", "elementor") + "<br><br>" + (0, _wordpress_i18n.__)("To upload them anyway, ask the site administrator to enable unfiltered file uploads.", "elementor"),
7049 strings: { confirm: (0, _wordpress_i18n.__)("Got it", "elementor") }
7050 });
7051 }
7052 },
7053 {
7054 key: "getUnfilteredFilesNotEnabledDialog",
7055 value: function getUnfilteredFilesNotEnabledDialog(callback) {
7056 var elementorInstance = window.elementorAdmin || window.elementor;
7057 if (!elementorInstance.config.user.is_administrator) return this.getUnfilteredFilesNonAdminDialog();
7058 return elementorInstance.helpers.getSimpleDialog("e-enable-unfiltered-files-dialog", (0, _wordpress_i18n.__)("Enable Unfiltered File Uploads", "elementor"), (0, _wordpress_i18n.__)("Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.", "elementor"), (0, _wordpress_i18n.__)("Enable", "elementor"), function onConfirm() {
7059 elementorCommon.ajax.addRequest("enable_unfiltered_files_upload", {}, true);
7060 elementorCommon.config.filesUpload.unfilteredFiles = true;
7061 callback();
7062 });
7063 }
7064 },
7065 {
7066 key: "getUnfilteredFilesNotEnabledImportTemplateDialog",
7067 value: function getUnfilteredFilesNotEnabledImportTemplateDialog(callback) {
7068 if (!(window.elementorAdmin || window.elementor).config.user.is_administrator) return this.getUnfilteredFilesNonAdminDialog();
7069 return elementorCommon.dialogsManager.createWidget("confirm", {
7070 id: "e-enable-unfiltered-files-dialog-import-template",
7071 headerMessage: (0, _wordpress_i18n.__)("Enable Unfiltered File Uploads", "elementor"),
7072 message: (0, _wordpress_i18n.__)("Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.", "elementor") + "<br /><br />" + (0, _wordpress_i18n.__)("If you do not enable uploading unfiltered files, any SVG or JSON (including lottie) files used in the uploaded template will not be imported.", "elementor"),
7073 position: {
7074 my: "center center",
7075 at: "center center"
7076 },
7077 strings: {
7078 confirm: (0, _wordpress_i18n.__)("Enable and Import", "elementor"),
7079 cancel: (0, _wordpress_i18n.__)("Import Without Enabling", "elementor")
7080 },
7081 onConfirm: function onConfirm() {
7082 elementorCommon.ajax.addRequest("enable_unfiltered_files_upload", { success: function success() {
7083 elementorCommon.config.filesUpload.unfilteredFiles = true;
7084 callback();
7085 } }, true);
7086 },
7087 onCancel: function onCancel() {
7088 return callback();
7089 }
7090 });
7091 }
7092 }
7093 ]);
7094 }();
7095
7096 //#endregion
7097 //#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-actions.js
7098 init_objectWithoutProperties$1();
7099 init_asyncToGenerator();
7100 init_defineProperty$1();
7101 var _excluded$14 = ["image"];
7102 function ownKeys$13(e, r) {
7103 var t = Object.keys(e);
7104 if (Object.getOwnPropertySymbols) {
7105 var o = Object.getOwnPropertySymbols(e);
7106 r && (o = o.filter(function(r) {
7107 return Object.getOwnPropertyDescriptor(e, r).enumerable;
7108 })), t.push.apply(t, o);
7109 }
7110 return t;
7111 }
7112 __name(ownKeys$13, "ownKeys");
7113 function _objectSpread$13(e) {
7114 for (var r = 1; r < arguments.length; r++) {
7115 var t = null != arguments[r] ? arguments[r] : {};
7116 r % 2 ? ownKeys$13(Object(t), !0).forEach(function(r) {
7117 _defineProperty$1(e, r, t[r]);
7118 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$13(Object(t)).forEach(function(r) {
7119 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
7120 });
7121 }
7122 return e;
7123 }
7124 __name(_objectSpread$13, "_objectSpread");
7125 var normalizeImageData = function normalizeImageData(imageToUpload) {
7126 if (!(imageToUpload !== null && imageToUpload !== void 0 && imageToUpload.imageUrl)) return imageToUpload;
7127 return _objectSpread$13(_objectSpread$13({}, imageToUpload), {}, {
7128 image_url: imageToUpload.imageUrl,
7129 use_gallery_image: true
7130 });
7131 };
7132 var useImageActions = function useImageActions() {
7133 var _useEditImage = useEditImage();
7134 var editImage = _useEditImage.editImage;
7135 var setEditImage = _useEditImage.setEditImage;
7136 var _useGlobalActions = useGlobalActions();
7137 var setControlValue = _useGlobalActions.setControlValue;
7138 var saveAndClose = _useGlobalActions.saveAndClose;
7139 var _useImageUpload = useImageUpload();
7140 var attachmentData = _useImageUpload.attachmentData;
7141 var isUploading = _useImageUpload.isUploading;
7142 var uploadError = _useImageUpload.uploadError;
7143 var uploadImage = _useImageUpload.upload;
7144 var resetUpload = _useImageUpload.resetUpload;
7145 var ensureSVGUploading = function ensureSVGUploading(imageUrl) {
7146 if (!imageUrl) return true;
7147 var imageExtension = new URL(imageUrl).pathname.split(".").pop();
7148 var isUploadAllowed = window._wpPluploadSettings.defaults.filters.mime_types[0].extensions.split(",").includes(imageExtension) || elementorCommon.config.filesUpload.unfilteredFiles;
7149 if (!isUploadAllowed) {
7150 var dialog = FilesUploadHandler.getUnfilteredFilesNotEnabledDialog(function() {});
7151 dialog.getElements("widget").css("z-index", "170001");
7152 dialog.show();
7153 }
7154 return isUploadAllowed;
7155 };
7156 var upload = function upload(imageToUpload, prompt) {
7157 if (!ensureSVGUploading(imageToUpload.image_url)) return Promise.reject(/* @__PURE__ */ new Error("SVG Uploading is not allowed"));
7158 return uploadImage({
7159 image: normalizeImageData(imageToUpload),
7160 prompt: prompt || imageToUpload.prompt
7161 });
7162 };
7163 var getFinalImage = /*#__PURE__*/ function() {
7164 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(imageToUpload, prompt) {
7165 var isImageAlreadyUploaded;
7166 var _result;
7167 var result;
7168 return import_regenerator$2.default.wrap(function(_context) {
7169 while (1) switch (_context.prev = _context.next) {
7170 case 0:
7171 isImageAlreadyUploaded = editImage.url === imageToUpload.url;
7172 if (!isImageAlreadyUploaded) {
7173 _context.next = 1;
7174 break;
7175 }
7176 editImage.image, _result = _objectWithoutProperties$1(editImage, _excluded$14);
7177 return _context.abrupt("return", _result);
7178 case 1:
7179 _context.next = 2;
7180 return upload(imageToUpload, prompt);
7181 case 2:
7182 result = _context.sent;
7183 return _context.abrupt("return", result === null || result === void 0 ? void 0 : result.image);
7184 case 3:
7185 case "end": return _context.stop();
7186 }
7187 }, _callee);
7188 }));
7189 return function getFinalImage(_x, _x2) {
7190 return _ref.apply(this, arguments);
7191 };
7192 }();
7193 return {
7194 use: /* @__PURE__ */ function() {
7195 var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee3(imageToUpload, prompt) {
7196 var result;
7197 return import_regenerator$2.default.wrap(function(_context3) {
7198 while (1) switch (_context3.prev = _context3.next) {
7199 case 0:
7200 _context3.next = 1;
7201 return getFinalImage(imageToUpload, prompt);
7202 case 1:
7203 result = _context3.sent;
7204 setControlValue(result);
7205 saveAndClose();
7206 case 2:
7207 case "end": return _context3.stop();
7208 }
7209 }, _callee3);
7210 }));
7211 return function use(_x5, _x6) {
7212 return _ref3.apply(this, arguments);
7213 };
7214 }(),
7215 edit: /* @__PURE__ */ function() {
7216 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2(imageToUpload, prompt) {
7217 var result;
7218 return import_regenerator$2.default.wrap(function(_context2) {
7219 while (1) switch (_context2.prev = _context2.next) {
7220 case 0:
7221 _context2.next = 1;
7222 return upload(imageToUpload, prompt);
7223 case 1:
7224 result = _context2.sent;
7225 setEditImage(result.image);
7226 case 2:
7227 case "end": return _context2.stop();
7228 }
7229 }, _callee2);
7230 }));
7231 return function edit(_x3, _x4) {
7232 return _ref2.apply(this, arguments);
7233 };
7234 }(),
7235 reset: resetUpload,
7236 error: uploadError,
7237 data: attachmentData,
7238 isLoading: isUploading,
7239 useMultipleImages: /* @__PURE__ */ function() {
7240 var _ref4 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee6(imagesToUpload) {
7241 var results;
7242 return import_regenerator$2.default.wrap(function(_context6) {
7243 while (1) switch (_context6.prev = _context6.next) {
7244 case 0:
7245 _context6.next = 1;
7246 return Promise.all(imagesToUpload.map(/*#__PURE__*/ function() {
7247 var _ref5 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee4(img) {
7248 return import_regenerator$2.default.wrap(function(_context4) {
7249 while (1) switch (_context4.prev = _context4.next) {
7250 case 0:
7251 _context4.next = 1;
7252 return getFinalImage(img, null).catch(function(_) {
7253 return null;
7254 });
7255 case 1: return _context4.abrupt("return", _context4.sent);
7256 case 2:
7257 case "end": return _context4.stop();
7258 }
7259 }, _callee4);
7260 }));
7261 return function(_x8) {
7262 return _ref5.apply(this, arguments);
7263 };
7264 }()));
7265 case 1:
7266 results = _context6.sent;
7267 _context6.next = 2;
7268 return Promise.all(results.filter(function(result) {
7269 return result;
7270 }).map(/*#__PURE__*/ function() {
7271 var _ref6 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee5(result) {
7272 return import_regenerator$2.default.wrap(function(_context5) {
7273 while (1) switch (_context5.prev = _context5.next) {
7274 case 0:
7275 _context5.next = 1;
7276 return setControlValue(result);
7277 case 1: return _context5.abrupt("return", _context5.sent);
7278 case 2:
7279 case "end": return _context5.stop();
7280 }
7281 }, _callee5);
7282 }));
7283 return function(_x9) {
7284 return _ref6.apply(this, arguments);
7285 };
7286 }()));
7287 case 2:
7288 case "end": return _context6.stop();
7289 }
7290 }, _callee6);
7291 }));
7292 return function useMultipleImages(_x7) {
7293 return _ref4.apply(this, arguments);
7294 };
7295 }()
7296 };
7297 };
7298
7299 //#endregion
7300 //#region modules/ai/assets/js/editor/pages/form-media/views/variations/components/images-placeholder.js
7301 var ImagesPlaceholder = function ImagesPlaceholder() {
7302 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7303 sx: { overflowY: "scroll" },
7304 flexGrow: 1
7305 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7306 display: "grid",
7307 gridTemplateColumns: "repeat(2, 1fr)",
7308 gap: 3
7309 }, Array(4).fill(true).map(function(_, index) {
7310 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7311 key: "placeholder-".concat(index),
7312 display: "flex",
7313 justifyContent: "center",
7314 alignItems: "center",
7315 sx: {
7316 bgcolor: "action.selected",
7317 height: 336
7318 }
7319 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, {
7320 color: "secondary",
7321 sx: { fontSize: 36 }
7322 }));
7323 })));
7324 };
7325 ImagesPlaceholder.propTypes = {};
7326
7327 //#endregion
7328 //#region modules/ai/assets/js/editor/pages/form-media/views/generate/index.js
7329 init_defineProperty$1();
7330 init_slicedToArray();
7331 init_prompt_history_action_context();
7332 init_prompt_library_link();
7333 init_requests_ids();
7334 function ownKeys$12(e, r) {
7335 var t = Object.keys(e);
7336 if (Object.getOwnPropertySymbols) {
7337 var o = Object.getOwnPropertySymbols(e);
7338 r && (o = o.filter(function(r) {
7339 return Object.getOwnPropertyDescriptor(e, r).enumerable;
7340 })), t.push.apply(t, o);
7341 }
7342 return t;
7343 }
7344 __name(ownKeys$12, "ownKeys");
7345 function _objectSpread$12(e) {
7346 for (var r = 1; r < arguments.length; r++) {
7347 var t = null != arguments[r] ? arguments[r] : {};
7348 r % 2 ? ownKeys$12(Object(t), !0).forEach(function(r) {
7349 _defineProperty$1(e, r, t[r]);
7350 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$12(Object(t)).forEach(function(r) {
7351 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
7352 });
7353 }
7354 return e;
7355 }
7356 __name(_objectSpread$12, "_objectSpread");
7357 var getPromptPlaceholder = function getPromptPlaceholder(images) {
7358 if (!(images !== null && images !== void 0 && images.length)) return (0, _wordpress_i18n.__)("describe your image", "elementor");
7359 return images[Math.floor(Math.random() * images.length)].prompt;
7360 };
7361 var Generate = function Generate(_ref) {
7362 var textToImageHook = _ref.textToImageHook;
7363 var _ref$predefinedPrompt = _ref.predefinedPrompt;
7364 var predefinedPrompt = _ref$predefinedPrompt === void 0 ? "" : _ref$predefinedPrompt;
7365 var _ref$initialSettings = _ref.initialSettings;
7366 var initialSettings = _ref$initialSettings === void 0 ? {} : _ref$initialSettings;
7367 var _useState2 = _slicedToArray((0, react.useState)(predefinedPrompt), 2);
7368 var prompt = _useState2[0];
7369 var setPrompt = _useState2[1];
7370 var setGenerate = useRequestIds().setGenerate;
7371 var initialImageType = useGlobalSettings().initialImageType;
7372 var _usePromptSettings = usePromptSettings(_objectSpread$12({ type: initialImageType }, initialSettings));
7373 var settings = _usePromptSettings.settings;
7374 var updateSettings = _usePromptSettings.updateSettings;
7375 var resetSettings = _usePromptSettings.resetSettings;
7376 var _useSuggestedImages = useSuggestedImages({ selectedType: settings[IMAGE_TYPE] });
7377 var suggestedImages = _useSuggestedImages.imagesData;
7378 var isPreloading = _useSuggestedImages.isLoading;
7379 var promptPlaceholder = getPromptPlaceholder(suggestedImages);
7380 var _textToImageHook = textToImageHook({});
7381 var generatedImages = _textToImageHook.data;
7382 var setResult = _textToImageHook.setResult;
7383 var send = _textToImageHook.send;
7384 var isGenerating = _textToImageHook.isLoading;
7385 var error = _textToImageHook.error;
7386 var reset = _textToImageHook.reset;
7387 var _useImageActions = useImageActions();
7388 var use = _useImageActions.use;
7389 var edit = _useImageActions.edit;
7390 var isUploading = _useImageActions.isLoading;
7391 var isLoading = isPreloading || isGenerating || isUploading;
7392 var generateAspectRatio = (0, react.useMemo)(function() {
7393 return settings[IMAGE_RATIO];
7394 }, [generatedImages === null || generatedImages === void 0 ? void 0 : generatedImages.result]);
7395 var handleSubmit = function handleSubmit(event) {
7396 event.preventDefault();
7397 setGenerate();
7398 if (!settings[IMAGE_STYLE]) settings[IMAGE_STYLE] = "general";
7399 send({
7400 prompt,
7401 settings
7402 });
7403 };
7404 var handleCopyPrompt = function handleCopyPrompt(_ref2) {
7405 var selectedPrompt = _ref2.prompt;
7406 var imageType = _ref2.imageType;
7407 setPrompt(selectedPrompt);
7408 var _imageType$split2 = _slicedToArray(imageType.split("/"), 2);
7409 var type = _imageType$split2[0];
7410 var style = _imageType$split2[1];
7411 updateSettings(_defineProperty$1(_defineProperty$1({}, IMAGE_TYPE, type), IMAGE_STYLE, style));
7412 };
7413 useSubscribeOnPromptHistoryAction([{
7414 type: ACTION_TYPES.RESTORE,
7415 handler: function handler(action) {
7416 var _action$data;
7417 var _action$data2;
7418 var _action$data3;
7419 var _action$data4;
7420 handleCopyPrompt({
7421 prompt: (_action$data = action.data) === null || _action$data === void 0 ? void 0 : _action$data.prompt,
7422 imageType: ((_action$data2 = action.data) === null || _action$data2 === void 0 ? void 0 : _action$data2.imageType) || ""
7423 });
7424 updateSettings(_defineProperty$1({}, IMAGE_RATIO, (_action$data3 = action.data) === null || _action$data3 === void 0 ? void 0 : _action$data3.ratio));
7425 setResult((_action$data4 = action.data) === null || _action$data4 === void 0 ? void 0 : _action$data4.images, action.id);
7426 }
7427 }]);
7428 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
7429 primary: (0, _wordpress_i18n.__)("Imagine anything create everything", "elementor"),
7430 secondary: (0, _wordpress_i18n.__)("Generate images by selecting the desired type and style, and entering a prompt.", "elementor")
7431 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
7432 error,
7433 onRetry: handleSubmit
7434 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(PromptField, {
7435 "data-testid": "e-image-prompt",
7436 value: prompt,
7437 disabled: isLoading,
7438 placeholder: promptPlaceholder,
7439 onChange: setPrompt
7440 }), /*#__PURE__*/ react.default.createElement(ImageTypeSelect, {
7441 disabled: isLoading,
7442 value: settings[IMAGE_TYPE],
7443 onChange: function onChange(event) {
7444 return updateSettings(_defineProperty$1({}, IMAGE_TYPE, event.target.value));
7445 }
7446 }), /*#__PURE__*/ react.default.createElement(ImageStyleSelect, {
7447 type: settings[IMAGE_TYPE],
7448 value: settings[IMAGE_STYLE],
7449 disabled: isLoading || !settings[IMAGE_TYPE] || false,
7450 onChange: function onChange(event) {
7451 return updateSettings(_defineProperty$1({}, IMAGE_STYLE, event.target.value));
7452 }
7453 }), /*#__PURE__*/ react.default.createElement(ImageRatioSelect, {
7454 disabled: isLoading,
7455 value: settings[IMAGE_RATIO],
7456 onChange: function onChange(event) {
7457 return updateSettings(_defineProperty$1({}, IMAGE_RATIO, event.target.value));
7458 }
7459 }), generatedImages !== null && generatedImages !== void 0 && generatedImages.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
7460 gap: 2,
7461 sx: { my: 2.5 }
7462 }, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading || "" === prompt }), /*#__PURE__*/ react.default.createElement(NewPromptButton, {
7463 disabled: isLoading,
7464 onClick: function onClick() {
7465 resetSettings();
7466 setPrompt("");
7467 reset();
7468 }
7469 })) : /*#__PURE__*/ react.default.createElement(GenerateImagesSubmit, { disabled: isLoading || "" === prompt }))), /*#__PURE__*/ react.default.createElement(View.Content, {
7470 isLoading: isPreloading || isUploading,
7471 isGenerating
7472 }, generatedImages !== null && generatedImages !== void 0 && generatedImages.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
7473 images: generatedImages === null || generatedImages === void 0 ? void 0 : generatedImages.result,
7474 aspectRatio: generateAspectRatio,
7475 onUseImage: use,
7476 onEditImage: edit
7477 }) : /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, predefinedPrompt ? /*#__PURE__*/ react.default.createElement(ImagesPlaceholder, null) : /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(View.ContentHeading, { primary: (0, _wordpress_i18n.__)("Spark your imagination with images generated by our community", "elementor") }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { sx: { mb: 3 } }, /*#__PURE__*/ react.default.createElement(PromptLibraryLink, { libraryLink: "https://go.elementor.com/ai-prompt-library-image/" })), /*#__PURE__*/ react.default.createElement(Gallery, { cols: 3 }, suggestedImages === null || suggestedImages === void 0 ? void 0 : suggestedImages.map(function(suggestedPrompt) {
7478 return /*#__PURE__*/ react.default.createElement(Gallery.Image, {
7479 variant: "thumbnail",
7480 key: suggestedPrompt.prompt,
7481 alt: suggestedPrompt.prompt,
7482 text: suggestedPrompt.prompt,
7483 src: suggestedPrompt.thumbnailUrl
7484 }, /*#__PURE__*/ react.default.createElement(ImageActions, null, /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, {
7485 onClick: function onClick() {
7486 return use(suggestedPrompt);
7487 },
7488 fullWidth: true
7489 }), /*#__PURE__*/ react.default.createElement(ImageActions.CopyIcon, { onClick: function onClick() {
7490 return handleCopyPrompt(suggestedPrompt);
7491 } }), /*#__PURE__*/ react.default.createElement(ImageActions.EditIcon, { onClick: function onClick() {
7492 return edit(suggestedPrompt);
7493 } })));
7494 }))))));
7495 };
7496 Generate.propTypes = {
7497 predefinedPrompt: import_prop_types$8.default.string,
7498 textToImageHook: import_prop_types$8.default.func,
7499 initialSettings: import_prop_types$8.default.object
7500 };
7501
7502 //#endregion
7503 //#region modules/ai/assets/js/editor/icons/expand-icon.js
7504 init_extends();
7505 var ExpandIcon$1 = react.default.forwardRef(function(props, ref) {
7506 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
7507 fillRule: "evenodd",
7508 clipRule: "evenodd",
7509 d: "M16 3.25C15.5858 3.25 15.25 3.58579 15.25 4C15.25 4.41421 15.5858 4.75 16 4.75H18.1893L13.4697 9.46967C13.1768 9.76256 13.1768 10.2374 13.4697 10.5303C13.7626 10.8232 14.2374 10.8232 14.5303 10.5303L19.25 5.81066V8C19.25 8.41421 19.5858 8.75 20 8.75C20.4142 8.75 20.75 8.41421 20.75 8V4C20.75 3.80806 20.6768 3.61612 20.5303 3.46967C20.4584 3.39776 20.3755 3.34351 20.2871 3.30691C20.1987 3.27024 20.1017 3.25 20 3.25H16ZM4 15.25C4.41421 15.25 4.75 15.5858 4.75 16V18.1893L9.46967 13.4697C9.76256 13.1768 10.2374 13.1768 10.5303 13.4697C10.8232 13.7626 10.8232 14.2374 10.5303 14.5303L5.81066 19.25H8C8.41421 19.25 8.75 19.5858 8.75 20C8.75 20.4142 8.41421 20.75 8 20.75H4C3.80806 20.75 3.61612 20.6768 3.46967 20.5303C3.39776 20.4584 3.34351 20.3755 3.30691 20.2871C3.27024 20.1987 3.25 20.1017 3.25 20V16C3.25 15.5858 3.58579 15.25 4 15.25ZM20.75 16V20C20.75 20.1017 20.7298 20.1987 20.6931 20.2871C20.6565 20.3755 20.6022 20.4584 20.5303 20.5303C20.4584 20.6022 20.3755 20.6565 20.2871 20.6931C20.2099 20.7251 20.1262 20.7446 20.0386 20.749C20.0258 20.7497 20.0129 20.75 20 20.75H16C15.5858 20.75 15.25 20.4142 15.25 20C15.25 19.5858 15.5858 19.25 16 19.25H18.1893L13.4697 14.5303C13.1768 14.2374 13.1768 13.7626 13.4697 13.4697C13.7626 13.1768 14.2374 13.1768 14.5303 13.4697L19.25 18.1893V16C19.25 15.5858 19.5858 15.25 20 15.25C20.4142 15.25 20.75 15.5858 20.75 16ZM3.71291 3.30691C3.80134 3.27024 3.89831 3.25 4 3.25H8C8.41421 3.25 8.75 3.58579 8.75 4C8.75 4.41421 8.41421 4.75 8 4.75H5.81066L10.5303 9.46967C10.8232 9.76256 10.8232 10.2374 10.5303 10.5303C10.2374 10.8232 9.76256 10.8232 9.46967 10.5303L4.75 5.81066V8C4.75 8.41421 4.41421 8.75 4 8.75C3.58579 8.75 3.25 8.41421 3.25 8V4C3.25 3.7937 3.33329 3.60686 3.46808 3.47126C3.46861 3.47073 3.46914 3.4702 3.46967 3.46967C3.4702 3.46914 3.47073 3.46861 3.47126 3.46808C3.5428 3.39696 3.62511 3.34324 3.71291 3.30691Z"
7510 }));
7511 });
7512
7513 //#endregion
7514 //#region modules/ai/assets/js/editor/icons/brush-icon.js
7515 init_extends();
7516 var BrushIcon = react.default.forwardRef(function(props, ref) {
7517 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
7518 fillRule: "evenodd",
7519 clipRule: "evenodd",
7520 d: "M20.8815 2.25919C20.9203 2.25301 20.9599 2.24983 21 2.24988C21.0827 2.24978 21.1629 2.26335 21.2384 2.2887C21.367 2.33162 21.4784 2.40776 21.5642 2.5058C21.6895 2.64891 21.76 2.83868 21.749 3.03992C21.7477 3.06492 21.7452 3.08966 21.7414 3.11407C21.3311 6.09743 20.124 8.91507 18.2472 11.2703C16.5079 13.4529 14.2532 15.1635 11.6906 16.2509C11.8289 17.1168 11.7249 18.0054 11.3884 18.8177C11.0289 19.6857 10.4201 20.4275 9.63896 20.9495C8.85782 21.4714 7.93946 21.75 7 21.75H3C2.58579 21.75 2.25 21.4142 2.25 21V17C2.25 16.0605 2.52858 15.1421 3.05052 14.361C3.57246 13.5799 4.3143 12.9711 5.18225 12.6115C5.99455 12.2751 6.88314 12.1711 7.74905 12.3094C8.83643 9.74682 10.547 7.49212 12.7296 5.75287C15.0837 3.87693 17.8998 2.67012 20.8815 2.25919ZM10.0984 16.0649C10.077 16.0082 10.0629 15.9506 10.0557 15.893C9.89413 15.4471 9.63624 15.04 9.2981 14.7019C8.96001 14.3638 8.55301 14.1059 8.10721 13.9444C8.04953 13.9372 7.99178 13.9231 7.93499 13.9016C7.90509 13.8903 7.87632 13.8773 7.84877 13.8628C7.77794 13.8436 7.70633 13.8268 7.63404 13.8124C7.0036 13.687 6.35014 13.7514 5.75628 13.9974C5.16242 14.2433 4.65484 14.6599 4.29772 15.1944C3.94061 15.7288 3.75 16.3572 3.75 17V20.25H7C7.64279 20.25 8.27114 20.0594 8.8056 19.7022C9.34006 19.3451 9.75662 18.8376 10.0026 18.2437C10.2486 17.6498 10.313 16.9964 10.1876 16.3659C10.1732 16.2935 10.1563 16.2218 10.1371 16.1509C10.1226 16.1234 10.1097 16.0947 10.0984 16.0649ZM10.3588 13.6412C10.7069 13.9894 10.9969 14.3876 11.2204 14.8204C12.2258 14.3839 13.1782 13.8417 14.0621 13.2048C13.3066 11.827 12.173 10.6933 10.7952 9.93782C10.1583 10.8218 9.61603 11.7741 9.17957 12.7795C9.61238 13.0031 10.0106 13.293 10.3588 13.6412ZM11.7434 8.75107C13.1943 9.59789 14.4021 10.8057 15.2489 12.2565C15.9093 11.6727 16.5204 11.0304 17.0741 10.3355C18.5698 8.45849 19.5983 6.25889 20.0821 3.9179C17.7411 4.40165 15.5415 5.43018 13.6644 6.92595C12.9696 7.47964 12.3273 8.0907 11.7434 8.75107Z"
7521 }));
7522 });
7523
7524 //#endregion
7525 //#region modules/ai/assets/js/editor/icons/evolve-icon.js
7526 init_extends();
7527 var EvolveIcon = react.default.forwardRef(function(props, ref) {
7528 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
7529 fillRule: "evenodd",
7530 clipRule: "evenodd",
7531 d: "M2.30691 2.71291C2.27024 2.80134 2.25 2.89831 2.25 3V8C2.25 8.41421 2.58579 8.75 3 8.75C3.41421 8.75 3.75 8.41421 3.75 8V4.81066L10.0056 11.0663L10.0057 11.0663C10.8022 11.8631 11.2497 12.9434 11.25 14.07V14.0702V15V21C11.25 21.4142 11.5858 21.75 12 21.75C12.4142 21.75 12.75 21.4142 12.75 21V15V14.0702V14.07C12.7503 12.9434 13.1979 11.863 13.9944 11.0663L20.25 4.81066V8C20.25 8.41421 20.5858 8.75 21 8.75C21.4142 8.75 21.75 8.41421 21.75 8V3C21.75 2.98706 21.7497 2.97419 21.749 2.96141C21.7446 2.87376 21.7251 2.79009 21.6931 2.71291C21.6565 2.62445 21.6022 2.54158 21.5303 2.46967C21.4584 2.39776 21.3755 2.34351 21.2871 2.30691C21.1987 2.27024 21.1017 2.25 21 2.25H16C15.5858 2.25 15.25 2.58579 15.25 3C15.25 3.41421 15.5858 3.75 16 3.75H19.1893L12.9337 10.0057L12.9336 10.0057C12.5656 10.3739 12.2526 10.7867 12 11.2316C11.7474 10.7867 11.4344 10.3739 11.0664 10.0057L11.0663 10.0057L4.81066 3.75H8C8.41421 3.75 8.75 3.41421 8.75 3C8.75 2.58579 8.41421 2.25 8 2.25H3C2.7937 2.25 2.60686 2.33329 2.47126 2.46808C2.47073 2.46861 2.4702 2.46914 2.46967 2.46967C2.46914 2.4702 2.46861 2.47073 2.46808 2.47126C2.39696 2.5428 2.34324 2.62511 2.30691 2.71291Z"
7532 }));
7533 });
7534
7535 //#endregion
7536 //#region modules/ai/assets/js/editor/icons/enlarger-icon.js
7537 init_extends();
7538 var ExpandIcon = react.default.forwardRef(function(props, ref) {
7539 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
7540 fillRule: "evenodd",
7541 clipRule: "evenodd",
7542 d: "M5.11612 5.11612C5.35054 4.8817 5.66848 4.75 6 4.75H18C18.3315 4.75 18.6495 4.8817 18.8839 5.11612C19.1183 5.35054 19.25 5.66848 19.25 6V18C19.25 18.3315 19.1183 18.6495 18.8839 18.8839C18.6495 19.1183 18.3315 19.25 18 19.25H11.7335C11.7444 19.1709 11.75 19.0908 11.75 19.01V14.01C11.75 13.8051 11.7141 13.604 11.6457 13.4149L16.25 8.81066V11C16.25 11.4142 16.5858 11.75 17 11.75C17.4142 11.75 17.75 11.4142 17.75 11V7C17.75 6.89831 17.7298 6.80134 17.6931 6.71291C17.6565 6.62445 17.6022 6.54158 17.5303 6.46967C17.4584 6.39776 17.3755 6.34351 17.2871 6.30691C17.1993 6.27051 17.1031 6.2503 17.0022 6.25C17.0015 6.25 17.0007 6.25 17 6.25H16.9997H13C12.5858 6.25 12.25 6.58579 12.25 7C12.25 7.41421 12.5858 7.75 13 7.75H15.1893L10.5803 12.359C10.3956 12.2941 10.1995 12.26 10 12.26H5C4.91585 12.26 4.83232 12.2661 4.75 12.278V6C4.75 5.66848 4.8817 5.35054 5.11612 5.11612ZM4.75 14.01V18C4.75 18.3315 4.8817 18.6495 5.11612 18.8839C5.35054 19.1183 5.66848 19.25 6 19.25H10.07C10.11 19.2383 10.1468 19.2168 10.1768 19.1868C10.2237 19.1399 10.25 19.0763 10.25 19.01V14.01C10.25 13.9437 10.2237 13.8801 10.1768 13.8332C10.1299 13.7863 10.0663 13.76 10 13.76H5C4.9337 13.76 4.87011 13.7863 4.82322 13.8332C4.77634 13.8801 4.75 13.9437 4.75 14.01ZM3.25 14.01V6C3.25 5.27065 3.53973 4.57118 4.05546 4.05546C4.57118 3.53973 5.27065 3.25 6 3.25H18C18.7293 3.25 19.4288 3.53973 19.9445 4.05546C20.4603 4.57118 20.75 5.27065 20.75 6V18C20.75 18.7293 20.4603 19.4288 19.9445 19.9445C19.4288 20.4603 18.7293 20.75 18 20.75H10.187C10.1251 20.7566 10.0627 20.76 10 20.76H5C4.53587 20.76 4.09075 20.5756 3.76256 20.2474C3.43438 19.9193 3.25 19.4741 3.25 19.01V18V14.01Z"
7543 }));
7544 });
7545
7546 //#endregion
7547 //#region modules/ai/assets/js/editor/icons/remove-bg.js
7548 init_extends();
7549 var RemoveBackgroundIcon = react.default.forwardRef(function(props, ref) {
7550 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 16 16" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { d: "M5.74996 2.50038C5.74996 2.2242 5.52607 2.00031 5.24989 2.00031C4.9737 2.00031 4.74981 2.2242 4.74981 2.50038V2.50705C4.74981 2.78323 4.9737 3.00712 5.24989 3.00712C5.52607 3.00712 5.74996 2.78323 5.74996 2.50705V2.50038Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M7.9997 2.00031C8.27588 2.00031 8.49978 2.2242 8.49978 2.50038V2.50705C8.49978 2.78323 8.27588 3.00712 7.9997 3.00712C7.72352 3.00712 7.49963 2.78323 7.49963 2.50705V2.50038C7.49963 2.2242 7.72352 2.00031 7.9997 2.00031Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M11.2496 2.50038C11.2496 2.2242 11.0257 2.00031 10.7495 2.00031C10.4733 2.00031 10.2494 2.2242 10.2494 2.50038V2.50705C10.2494 2.78323 10.4733 3.00712 10.7495 3.00712C11.0257 3.00712 11.2496 2.78323 11.2496 2.50705V2.50038Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M13.4993 2.00031C13.7755 2.00031 13.9994 2.2242 13.9994 2.50038V2.50705C13.9994 2.78323 13.7755 3.00712 13.4993 3.00712C13.2231 3.00712 12.9993 2.78323 12.9993 2.50705V2.50038C12.9993 2.2242 13.2231 2.00031 13.4993 2.00031Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M13.9994 5.25019C13.9994 4.97401 13.7755 4.75012 13.4993 4.75012C13.2231 4.75012 12.9993 4.97401 12.9993 5.25019V5.25686C12.9993 5.53304 13.2231 5.75694 13.4993 5.75694C13.7755 5.75694 13.9994 5.53304 13.9994 5.25686V5.25019Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M13.9994 8.00001C13.9994 7.72382 13.7755 7.49993 13.4993 7.49993C13.2231 7.49993 12.9993 7.72382 12.9993 8.00001V8.00667C12.9993 8.28286 13.2231 8.50675 13.4993 8.50675C13.7755 8.50675 13.9994 8.28286 13.9994 8.00667V8.00001Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M2.50007 7.49993C2.77626 7.49993 3.00015 7.72382 3.00015 8.00001V8.00667C3.00015 8.28286 2.77626 8.50675 2.50007 8.50675C2.22389 8.50675 2 8.28286 2 8.00667V8.00001C2 7.72382 2.22389 7.49993 2.50007 7.49993Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M3.00015 5.25019C3.00015 4.97401 2.77626 4.75012 2.50007 4.75012C2.22389 4.75012 2 4.97401 2 5.25019V5.25686C2 5.53304 2.22389 5.75694 2.50007 5.75694C2.77626 5.75694 3.00015 5.53304 3.00015 5.25686V5.25019Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M2.50007 2.00031C2.77626 2.00031 3.00015 2.2242 3.00015 2.50038V2.50705C3.00015 2.78323 2.77626 3.00712 2.50007 3.00712C2.22389 3.00712 2 2.78323 2 2.50705V2.50038C2 2.2242 2.22389 2.00031 2.50007 2.00031Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M9.37461 7.31255C9.94411 7.31255 10.4058 6.85088 10.4058 6.28137C10.4058 5.71187 9.94411 5.25019 9.37461 5.25019C8.8051 5.25019 8.34343 5.71187 8.34343 6.28137C8.34343 6.85088 8.8051 7.31255 9.37461 7.31255Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M9.37461 9.21061L7.6724 7.44357L7.66567 7.43672C7.27331 7.04478 6.79598 6.81248 6.28107 6.81248C5.76615 6.81248 5.28883 7.04478 4.89647 7.43672L4.88973 7.44358L2.13992 10.2982C2.05015 10.3913 2 10.5157 2 10.6451V13.4996C2 13.7758 2.22389 13.9997 2.50007 13.9997H13.4993C13.7755 13.9997 13.9994 13.7758 13.9994 13.4996V10.6451C13.9994 10.6365 13.9992 10.6279 13.9988 10.6194C13.9958 10.562 13.9833 10.5072 13.9627 10.4566C13.9409 10.403 13.9093 10.3523 13.8681 10.3073C13.8651 10.304 13.8621 10.3008 13.859 10.2976L12.4846 8.87085L12.4778 8.86399C12.0855 8.47205 11.6082 8.23975 11.0932 8.23975C10.5783 8.23975 10.101 8.47205 9.70864 8.86399L9.70191 8.87084L9.37461 9.21061ZM5.60649 8.14113L3.00015 10.8468V12.9996H12.9993V10.8468L11.7678 9.5684C11.5234 9.32549 11.2897 9.2399 11.0932 9.2399C10.8968 9.2399 10.6631 9.32549 10.4187 9.5684L10.069 9.93142L11.1097 11.0118C11.3013 11.2107 11.2954 11.5272 11.0965 11.7188C10.8975 11.9104 10.581 11.9045 10.3894 11.7056L9.01604 10.28C9.01482 10.2787 9.01361 10.2775 9.01241 10.2762L6.95564 8.14113C6.7112 7.89822 6.4775 7.81263 6.28107 7.81263C6.08463 7.81263 5.85094 7.89822 5.60649 8.14113Z" }));
7551 });
7552
7553 //#endregion
7554 //#region modules/ai/assets/js/editor/icons/replace-bg.js
7555 init_extends();
7556 var ReplaceBackgroundIcon = react.default.forwardRef(function(props, ref) {
7557 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 16 16" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { d: "M4.35355 1.64645C4.54882 1.84171 4.54882 2.15829 4.35355 2.35355L2.35355 4.35355C2.15829 4.54882 1.84171 4.54882 1.64645 4.35355C1.45118 4.15829 1.45118 3.84171 1.64645 3.64645L3.64645 1.64645C3.84171 1.45118 4.15829 1.45118 4.35355 1.64645Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M7.68689 1.64645C7.88215 1.84171 7.88215 2.15829 7.68689 2.35355L2.35355 7.68689C2.15829 7.88215 1.84171 7.88215 1.64645 7.68689C1.45118 7.49162 1.45118 7.17504 1.64645 6.97978L6.97978 1.64645C7.17504 1.45118 7.49162 1.45118 7.68689 1.64645Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M11.0202 1.64645C11.2155 1.84171 11.2155 2.15829 11.0202 2.35355L6.68689 6.68689C6.49162 6.88215 6.17504 6.88215 5.97978 6.68689C5.78452 6.49162 5.78452 6.17504 5.97978 5.97978L10.3131 1.64645C10.5084 1.45118 10.825 1.45118 11.0202 1.64645Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M14.3536 1.64645C14.5488 1.84171 14.5488 2.15829 14.3536 2.35355L11.0202 5.68689C10.825 5.88215 10.5084 5.88215 10.3131 5.68689C10.1179 5.49162 10.1179 5.17504 10.3131 4.97978L13.6464 1.64645C13.8417 1.45118 14.1583 1.45118 14.3536 1.64645Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M14.3536 4.97978C14.5488 5.17504 14.5488 5.49162 14.3536 5.68689L12.0202 8.02022C11.825 8.21548 11.5084 8.21548 11.3131 8.02022C11.1179 7.82496 11.1179 7.50838 11.3131 7.31311L13.6464 4.97978C13.8417 4.78452 14.1583 4.78452 14.3536 4.97978Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M14.3536 8.31311C14.5488 8.50838 14.5488 8.82496 14.3536 9.02022L14.0202 9.35355C13.825 9.54882 13.5084 9.54882 13.3131 9.35355C13.1179 9.15829 13.1179 8.84171 13.3131 8.64645L13.6464 8.31311C13.8417 8.11785 14.1583 8.11785 14.3536 8.31311Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M10.3333 7C10.3333 7.55228 9.88562 8 9.33333 8C8.78105 8 8.33333 7.55228 8.33333 7C8.33333 6.44772 8.78105 6 9.33333 6C9.88562 6 10.3333 6.44772 10.3333 7Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M6.33333 8.5C6.14679 8.5 5.92267 8.58153 5.6867 8.81725C5.67587 8.82806 5.66455 8.83838 5.65278 8.84816L2.5 11.4665V13.5H13.5V11.2318C13.5 10.9556 13.7239 10.7318 14 10.7318C14.2761 10.7318 14.5 10.9556 14.5 11.2318V14C14.5 14.2761 14.2761 14.5 14 14.5H2C1.72386 14.5 1.5 14.2761 1.5 14V11.2318C1.5 11.0831 1.56617 10.9421 1.68056 10.8471L4.99717 8.09274C5.37661 7.72073 5.83674 7.5 6.33333 7.5C6.83746 7.5 7.304 7.72747 7.6867 8.10976L7.69343 8.11662L11.0268 11.5769C11.2183 11.7758 11.2124 12.0923 11.0136 12.2839C10.8147 12.4755 10.4981 12.4696 10.3066 12.2707L6.97679 8.81408C6.74199 8.5808 6.51904 8.5 6.33333 8.5Z" }), /*#__PURE__*/ react.default.createElement("path", { d: "M10.3564 10.1984L9.69343 10.8866C9.50185 11.0854 9.18532 11.0914 8.98645 10.8998C8.78757 10.7082 8.78166 10.3917 8.97324 10.1928L9.6399 9.50073L9.64663 9.49387C10.4992 8.64223 11.843 8.83788 12.6387 9.45172C12.6435 9.45538 12.6482 9.45913 12.6528 9.46297L14.3194 10.8471C14.5319 11.0235 14.5611 11.3388 14.3846 11.5512C14.2082 11.7636 13.893 11.7928 13.6806 11.6164L12.0213 10.2384C11.4855 9.82976 10.7405 9.81862 10.3564 10.1984Z" }));
7558 });
7559
7560 //#endregion
7561 //#region modules/ai/assets/js/editor/icons/cleanup-icon.js
7562 init_extends();
7563 var Cleanup$1 = react.default.forwardRef(function(props, ref) {
7564 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 16 16" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
7565 fillRule: "evenodd",
7566 clipRule: "evenodd",
7567 d: "M10.6668 11.8334H3.66679C3.53235 11.8334 3.40357 11.7792 3.30952 11.6832L0.505518 8.81921L0.504041 8.81772C0.287672 8.59928 0.16626 8.30423 0.16626 7.99671C0.16626 7.68849 0.288225 7.3928 0.505518 7.17421L0.506568 7.17316L7.17323 0.506492L7.17429 0.505442C7.39288 0.288149 7.68857 0.166183 7.99679 0.166183C8.30501 0.166183 8.6007 0.288149 8.81929 0.505442L8.82034 0.50649L12.1547 3.84088C12.372 4.05947 12.494 4.35516 12.494 4.66338C12.494 4.97134 12.3722 5.26679 12.1553 5.48533L12.1547 5.48588L6.86473 10.8334H10.6668C10.9429 10.8334 11.1668 11.0572 11.1668 11.3334C11.1668 11.6095 10.9429 11.8334 10.6668 11.8334ZM7.87959 1.21435C7.91079 1.18349 7.9529 1.16618 7.99679 1.16618C8.04067 1.16618 8.08278 1.18349 8.11398 1.21434L11.4455 4.54588C11.4763 4.57707 11.494 4.61951 11.494 4.66338C11.494 4.70741 11.4766 4.74965 11.4455 4.78088L11.4447 4.78174L10.0411 6.20059L6.46721 2.62673L7.87959 1.21435ZM5.7601 3.33383L1.21473 7.87921C1.18387 7.91041 1.16626 7.95282 1.16626 7.99671C1.16626 8.04074 1.18368 8.08298 1.21473 8.11421L1.2174 8.11691L3.877 10.8334H5.4581L9.33779 6.91152L5.7601 3.33383Z"
7568 }));
7569 });
7570
7571 //#endregion
7572 //#region modules/ai/assets/js/editor/icons/isolate-object-icon.js
7573 init_extends();
7574 var IsolateObjectIcon = react.default.forwardRef(function(props, ref) {
7575 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 16 16" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
7576 fillRule: "evenodd",
7577 clipRule: "evenodd",
7578 d: "M2.6665 2.16699C2.94265 2.16699 3.1665 2.39085 3.1665 2.66699V2.67366C3.1665 2.9498 2.94265 3.17366 2.6665 3.17366C2.39036 3.17366 2.1665 2.9498 2.1665 2.67366V2.66699C2.1665 2.39085 2.39036 2.16699 2.6665 2.16699ZM5.33317 2.16699C5.60931 2.16699 5.83317 2.39085 5.83317 2.66699V2.67366C5.83317 2.9498 5.60931 3.17366 5.33317 3.17366C5.05703 3.17366 4.83317 2.9498 4.83317 2.67366V2.66699C4.83317 2.39085 5.05703 2.16699 5.33317 2.16699ZM7.99984 2.16699C8.27598 2.16699 8.49984 2.39085 8.49984 2.66699V2.67366C8.49984 2.9498 8.27598 3.17366 7.99984 3.17366C7.72369 3.17366 7.49984 2.9498 7.49984 2.67366V2.66699C7.49984 2.39085 7.72369 2.16699 7.99984 2.16699ZM10.6665 2.16699C10.9426 2.16699 11.1665 2.39085 11.1665 2.66699V2.67366C11.1665 2.9498 10.9426 3.17366 10.6665 3.17366C10.3904 3.17366 10.1665 2.9498 10.1665 2.67366V2.66699C10.1665 2.39085 10.3904 2.16699 10.6665 2.16699ZM13.3332 2.16699C13.6093 2.16699 13.8332 2.39085 13.8332 2.66699V2.67366C13.8332 2.9498 13.6093 3.17366 13.3332 3.17366C13.057 3.17366 12.8332 2.9498 12.8332 2.67366V2.66699C12.8332 2.39085 13.057 2.16699 13.3332 2.16699ZM2.6665 4.83366C2.94265 4.83366 3.1665 5.05752 3.1665 5.33366V5.34033C3.1665 5.61647 2.94265 5.84033 2.6665 5.84033C2.39036 5.84033 2.1665 5.61647 2.1665 5.34033V5.33366C2.1665 5.05752 2.39036 4.83366 2.6665 4.83366ZM4.83317 5.33366C4.83317 5.05752 5.05703 4.83366 5.33317 4.83366H10.6665C10.9426 4.83366 11.1665 5.05752 11.1665 5.33366V10.667C11.1665 10.9431 10.9426 11.167 10.6665 11.167H5.33317C5.05703 11.167 4.83317 10.9431 4.83317 10.667V5.33366ZM5.83317 5.83366V10.167H10.1665V5.83366H5.83317ZM13.3332 4.83366C13.6093 4.83366 13.8332 5.05752 13.8332 5.33366V5.34033C13.8332 5.61647 13.6093 5.84033 13.3332 5.84033C13.057 5.84033 12.8332 5.61647 12.8332 5.34033V5.33366C12.8332 5.05752 13.057 4.83366 13.3332 4.83366ZM2.6665 7.50033C2.94265 7.50033 3.1665 7.72418 3.1665 8.00033V8.00699C3.1665 8.28313 2.94265 8.50699 2.6665 8.50699C2.39036 8.50699 2.1665 8.28313 2.1665 8.00699V8.00033C2.1665 7.72418 2.39036 7.50033 2.6665 7.50033ZM13.3332 7.50033C13.6093 7.50033 13.8332 7.72418 13.8332 8.00033V8.00699C13.8332 8.28313 13.6093 8.50699 13.3332 8.50699C13.057 8.50699 12.8332 8.28313 12.8332 8.00699V8.00033C12.8332 7.72418 13.057 7.50033 13.3332 7.50033ZM2.6665 10.167C2.94265 10.167 3.1665 10.3908 3.1665 10.667V10.6737C3.1665 10.9498 2.94265 11.1737 2.6665 11.1737C2.39036 11.1737 2.1665 10.9498 2.1665 10.6737V10.667C2.1665 10.3908 2.39036 10.167 2.6665 10.167ZM13.3332 10.167C13.6093 10.167 13.8332 10.3908 13.8332 10.667V10.6737C13.8332 10.9498 13.6093 11.1737 13.3332 11.1737C13.057 11.1737 12.8332 10.9498 12.8332 10.6737V10.667C12.8332 10.3908 13.057 10.167 13.3332 10.167ZM2.6665 12.8337C2.94265 12.8337 3.1665 13.0575 3.1665 13.3337V13.3403C3.1665 13.6165 2.94265 13.8403 2.6665 13.8403C2.39036 13.8403 2.1665 13.6165 2.1665 13.3403V13.3337C2.1665 13.0575 2.39036 12.8337 2.6665 12.8337ZM5.33317 12.8337C5.60931 12.8337 5.83317 13.0575 5.83317 13.3337V13.3403C5.83317 13.6165 5.60931 13.8403 5.33317 13.8403C5.05703 13.8403 4.83317 13.6165 4.83317 13.3403V13.3337C4.83317 13.0575 5.05703 12.8337 5.33317 12.8337ZM7.99984 12.8337C8.27598 12.8337 8.49984 13.0575 8.49984 13.3337V13.3403C8.49984 13.6165 8.27598 13.8403 7.99984 13.8403C7.72369 13.8403 7.49984 13.6165 7.49984 13.3403V13.3337C7.49984 13.0575 7.72369 12.8337 7.99984 12.8337ZM10.6665 12.8337C10.9426 12.8337 11.1665 13.0575 11.1665 13.3337V13.3403C11.1665 13.6165 10.9426 13.8403 10.6665 13.8403C10.3904 13.8403 10.1665 13.6165 10.1665 13.3403V13.3337C10.1665 13.0575 10.3904 12.8337 10.6665 12.8337ZM13.3332 12.8337C13.6093 12.8337 13.8332 13.0575 13.8332 13.3337V13.3403C13.8332 13.6165 13.6093 13.8403 13.3332 13.8403C13.057 13.8403 12.8332 13.6165 12.8332 13.3403V13.3337C12.8332 13.0575 13.057 12.8337 13.3332 12.8337Z"
7579 }));
7580 });
7581
7582 //#endregion
7583 //#region modules/ai/assets/js/editor/pages/form-media/views/image-tools/image-tools-panel.js
7584 init_use_introduction();
7585 var TeaserDrawing = function TeaserDrawing() {
7586 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, {
7587 viewBox: "0 0 184 80",
7588 sx: {
7589 width: 184,
7590 height: 80
7591 }
7592 }, /*#__PURE__*/ react.default.createElement("g", { clipPath: "url(#clip0_3127_96542)" }, /*#__PURE__*/ react.default.createElement("path", {
7593 fillRule: "evenodd",
7594 clipRule: "evenodd",
7595 d: "M49.6014 1.36364C49.6014 0.610521 48.9907 0 48.2373 0C47.4839 0 46.8731 0.610521 46.8731 1.36364C46.8731 1.9664 46.6336 2.54448 46.2072 2.9707C45.7808 3.39692 45.2025 3.63636 44.5995 3.63636C43.8461 3.63636 43.2354 4.24689 43.2354 5C43.2354 5.75311 43.8461 6.36364 44.5995 6.36364C45.2025 6.36364 45.7808 6.60308 46.2072 7.0293C46.6336 7.45552 46.8731 8.0336 46.8731 8.63636C46.8731 9.38948 47.4839 10 48.2373 10C48.9907 10 49.6014 9.38948 49.6014 8.63636C49.6014 8.0336 49.8409 7.45552 50.2673 7.0293C50.6937 6.60308 51.272 6.36364 51.875 6.36364C52.6284 6.36364 53.2392 5.75311 53.2392 5C53.2392 4.24689 52.6284 3.63636 51.875 3.63636C51.272 3.63636 50.6937 3.39692 50.2673 2.9707C49.8409 2.54448 49.6014 1.9664 49.6014 1.36364ZM48.1364 4.89917C48.1706 4.86501 48.2042 4.83041 48.2373 4.79538C48.2703 4.83041 48.304 4.86501 48.3381 4.89917C48.3723 4.93333 48.4069 4.96694 48.4419 5C48.4069 5.03306 48.3723 5.06667 48.3381 5.10083C48.304 5.13499 48.2703 5.16959 48.2373 5.20462C48.2042 5.16959 48.1706 5.13499 48.1364 5.10083C48.1022 5.06667 48.0676 5.03306 48.0326 5C48.0676 4.96694 48.1022 4.93333 48.1364 4.89917Z",
7596 fill: "#69727D"
7597 }), /*#__PURE__*/ react.default.createElement("path", {
7598 fillRule: "evenodd",
7599 clipRule: "evenodd",
7600 d: "M66.6927 22.3677C66.6927 21.6177 66.082 21.0098 65.3286 21.0098C64.5752 21.0098 63.9644 21.6177 63.9644 22.3677C63.9644 22.9679 63.7249 23.5436 63.2985 23.968C62.8721 24.3924 62.2938 24.6309 61.6908 24.6309C60.9374 24.6309 60.3267 25.2388 60.3267 25.9888C60.3267 26.7387 60.9374 27.3467 61.6908 27.3467C62.2938 27.3467 62.8721 27.5851 63.2985 28.0096C63.7249 28.434 63.9644 29.0096 63.9644 29.6099C63.9644 30.3598 64.5752 30.9678 65.3286 30.9678C66.082 30.9678 66.6927 30.3598 66.6927 29.6099C66.6927 29.0096 66.9323 28.434 67.3586 28.0096C67.785 27.5851 68.3633 27.3467 68.9663 27.3467C69.7197 27.3467 70.3305 26.7387 70.3305 25.9888C70.3305 25.2388 69.7197 24.6309 68.9663 24.6309C68.3633 24.6309 67.785 24.3924 67.3586 23.968C66.9323 23.5436 66.6927 22.9679 66.6927 22.3677ZM65.2277 25.8884C65.2619 25.8544 65.2955 25.8199 65.3286 25.785C65.3616 25.8199 65.3953 25.8544 65.4294 25.8884C65.4636 25.9224 65.4982 25.9559 65.5333 25.9888C65.4982 26.0217 65.4636 26.0552 65.4294 26.0892C65.3953 26.1232 65.3616 26.1577 65.3286 26.1925C65.2955 26.1577 65.2619 26.1232 65.2277 26.0892C65.1935 26.0552 65.1589 26.0217 65.1239 25.9888C65.1589 25.9559 65.1935 25.9224 65.2277 25.8884Z",
7601 fill: "#69727D"
7602 }), /*#__PURE__*/ react.default.createElement("path", {
7603 d: "M53.9717 12L57.2198 17.0456L3.24796 51.4731L-0.000164873 46.4275L53.9717 12Z",
7604 fill: "#69727D"
7605 }), /*#__PURE__*/ react.default.createElement("path", {
7606 d: "M64.9761 5L68.2242 10.0456L57.2612 17.0387L54.013 11.9931L64.9761 5Z",
7607 fill: "#E6E8EA"
7608 }), /*#__PURE__*/ react.default.createElement("path", {
7609 fillRule: "evenodd",
7610 clipRule: "evenodd",
7611 d: "M65.7284 9.49923L64.432 7.48537L56.5088 12.5394L57.8052 14.5533L65.7284 9.49923ZM64.9761 5L54.013 11.9931L57.2612 17.0387L68.2242 10.0456L64.9761 5Z",
7612 fill: "#69727D"
7613 }), /*#__PURE__*/ react.default.createElement("path", {
7614 fillRule: "evenodd",
7615 clipRule: "evenodd",
7616 d: "M128 41C128 43.7687 121.671 46.2089 112.052 47.6451L114.482 74.7976C114.494 74.8647 114.5 74.9322 114.5 75C114.5 75.0001 114.5 75.0002 114.5 75.0003C114.513 75.1456 114.487 75.2779 114.43 75.3982C113.514 77.9735 103.8 80 91.95 80C79.496 80 69.4 77.7614 69.4 75C69.4 74.8146 69.4456 74.6315 69.5343 74.4513L71.2141 47.5326C62.0087 46.0835 56 43.6977 56 41C56 36.5817 72.1177 33 92 33C111.882 33 128 36.5817 128 41Z",
7617 fill: "#69727D"
7618 }), /*#__PURE__*/ react.default.createElement("path", {
7619 d: "M106.685 3.08259C112.562 16.564 109.338 34.1761 106.713 41.4407C106.713 41.4407 105.151 41.9127 100.894 41.9715C96.6371 42.0303 95.0251 41.9866 95.0251 41.4558C95.0252 40.9249 94.6272 34.6461 96.4177 22.3308C98.0343 11.2116 102.692 5.02553 105.448 2.75675C105.865 2.4137 106.47 2.58777 106.685 3.08259Z",
7620 fill: "#E6E8EA"
7621 }), /*#__PURE__*/ react.default.createElement("path", {
7622 fillRule: "evenodd",
7623 clipRule: "evenodd",
7624 d: "M104.883 4.66783C105.347 4.17219 106.14 4.35208 106.38 4.9873C108.716 11.1748 109.254 18.1507 108.889 24.5355C108.513 31.1152 107.184 36.9856 105.954 40.5842C105.778 40.6166 105.55 40.6541 105.265 40.6927C104.388 40.8119 102.974 40.9423 100.88 40.9712C98.7385 41.0008 97.3196 41.0031 96.4377 40.9371C96.2614 40.9239 96.1203 40.9088 96.0088 40.8935C95.9567 39.0573 95.8782 32.9919 97.4073 22.4743C98.766 13.1288 102.302 7.42438 104.883 4.66783ZM106.713 41.4403L107.002 42.3975C107.305 42.3062 107.546 42.0773 107.653 41.7802C109 38.0524 110.481 31.7376 110.886 24.6496C111.29 17.5654 110.626 9.61894 107.602 2.68255C107.147 1.63949 105.792 1.17814 104.812 1.98425C101.838 4.43294 97.0752 10.8574 95.4281 22.1866C93.7715 33.5811 93.975 39.865 94.0187 41.2138C94.0225 41.3324 94.0251 41.4128 94.0251 41.4552C94.025 42.261 94.695 42.5983 95.0067 42.7098C95.3591 42.8358 95.8079 42.8956 96.2886 42.9316C97.2769 43.0055 98.7924 43.0002 100.908 42.971C103.071 42.9411 104.566 42.806 105.534 42.6745C106.018 42.6088 106.371 42.5438 106.61 42.4932C106.729 42.4679 106.82 42.4461 106.885 42.4296C106.917 42.4214 106.943 42.4144 106.962 42.409L106.987 42.4021L106.996 42.3995L106.999 42.3984L107.001 42.398C107.001 42.398 107.002 42.3975 106.713 41.4403ZM106.426 40.4822L106.428 40.4817L106.43 40.4812C106.43 40.4812 106.429 40.4814 106.426 40.4822Z",
7625 fill: "#69727D"
7626 }), /*#__PURE__*/ react.default.createElement("path", {
7627 fillRule: "evenodd",
7628 clipRule: "evenodd",
7629 d: "M104.22 13.8372C104.787 15.7536 104.996 18.3439 104.953 21.2589C104.907 24.4148 104.569 27.8559 104.134 31.0529C103.7 34.2469 103.172 37.1799 102.753 39.3152C102.544 40.3824 102.361 41.2491 102.232 41.8481C102.22 41.9009 102.209 41.9516 102.199 42.0001H100.503C100.526 38.5025 100.676 33.4168 101.183 28.2866C101.724 22.8227 102.66 17.4299 104.22 13.8372ZM103 43.0001C103.974 43.2266 103.974 43.2264 103.974 43.2262L103.978 43.2093L103.989 43.1613C103.999 43.1192 104.013 43.0571 104.031 42.976C104.067 42.814 104.12 42.5763 104.186 42.2713C104.318 41.6613 104.503 40.7819 104.716 39.7006C105.14 37.5391 105.675 34.5658 106.116 31.3223C106.556 28.0818 106.905 24.5541 106.953 21.2881C107 18.0456 106.753 14.9635 105.943 12.6671C105.815 12.3045 105.676 11.9539 105.512 11.6797C105.394 11.4809 105.045 10.9388 104.371 10.9076C103.702 10.8766 103.301 11.3772 103.156 11.5722C102.959 11.8385 102.774 12.1912 102.594 12.5778C100.767 16.4945 99.7565 22.3931 99.1929 28.0897C98.6258 33.8211 98.5 39.4812 98.5 43.0001V44.0001H103.794L103.974 43.2262L103 43.0001Z",
7630 fill: "#69727D"
7631 }), /*#__PURE__*/ react.default.createElement("path", {
7632 d: "M79.2952 3.08259C73.4181 16.564 76.6423 34.1761 79.2676 41.4407C79.2676 41.4407 80.8299 41.9127 85.0867 41.9715C89.3434 42.0303 90.9554 41.9866 90.9554 41.4558C90.9553 40.9249 91.3533 34.6461 89.5628 22.3308C87.9462 11.2116 83.2888 5.02553 80.5325 2.75675C80.1157 2.4137 79.511 2.58777 79.2952 3.08259Z",
7633 fill: "#E6E8EA"
7634 }), /*#__PURE__*/ react.default.createElement("path", {
7635 fillRule: "evenodd",
7636 clipRule: "evenodd",
7637 d: "M81.0978 4.66783C80.6337 4.17219 79.8403 4.35208 79.6005 4.9873C77.2644 11.1748 76.7267 18.1507 77.0914 24.5355C77.4671 31.1152 78.7963 36.9856 80.0267 40.5842C80.2028 40.6166 80.4308 40.6541 80.7155 40.6927C81.5929 40.8119 83.0069 40.9423 85.1005 40.9712C87.242 41.0008 88.6609 41.0031 89.5427 40.9371C89.7191 40.9239 89.8602 40.9088 89.9716 40.8935C90.0238 39.0573 90.1023 32.9919 88.5732 22.4743C87.2145 13.1288 83.6789 7.42438 81.0978 4.66783ZM79.2676 41.4403L78.9784 42.3975C78.676 42.3062 78.4345 42.0773 78.3271 41.7802C76.98 38.0524 75.4994 31.7376 75.0946 24.6496C74.69 17.5654 75.3547 9.61894 78.3786 2.68255C78.8333 1.63949 80.1887 1.17814 81.168 1.98425C84.1429 4.43294 88.9053 10.8574 90.5524 22.1866C92.209 33.5811 92.0055 39.865 91.9618 41.2138C91.958 41.3324 91.9554 41.4128 91.9554 41.4552C91.9554 42.261 91.2855 42.5983 90.9737 42.7098C90.6214 42.8358 90.1726 42.8956 89.6919 42.9316C88.7036 43.0055 87.1881 43.0002 85.0728 42.971C82.9096 42.9411 81.4141 42.806 80.4462 42.6745C79.9621 42.6088 79.6094 42.5438 79.3707 42.4932C79.2514 42.4679 79.1605 42.4461 79.0958 42.4296C79.0635 42.4214 79.0377 42.4144 79.0182 42.409L78.9937 42.4021L78.9849 42.3995L78.9814 42.3984L78.9798 42.398C78.9798 42.398 78.9784 42.3975 79.2676 41.4403ZM79.5541 40.4822L79.5526 40.4817L79.5507 40.4812C79.5507 40.4812 79.5514 40.4814 79.5541 40.4822Z",
7638 fill: "#69727D"
7639 }), /*#__PURE__*/ react.default.createElement("path", {
7640 fillRule: "evenodd",
7641 clipRule: "evenodd",
7642 d: "M81.7604 13.8372C81.1939 15.7536 80.9847 18.3439 81.0272 21.2589C81.0733 24.4148 81.4118 27.8559 81.8464 31.0529C82.2805 34.2469 82.8081 37.1799 83.2274 39.3152C83.4369 40.3824 83.6192 41.2491 83.7488 41.8481C83.7603 41.9009 83.7713 41.9516 83.7819 42.0001H85.4771C85.4542 38.5025 85.3049 33.4168 84.7973 28.2866C84.2567 22.8227 83.32 17.4299 81.7604 13.8372ZM82.9805 43.0001C82.0065 43.2266 82.0064 43.2264 82.0064 43.2262L82.0025 43.2093L81.9914 43.1613C81.9818 43.1192 81.9677 43.0571 81.9494 42.976C81.913 42.814 81.8602 42.5763 81.7941 42.2713C81.6621 41.6613 81.4772 40.7819 81.2648 39.7006C80.8404 37.5391 80.3054 34.5658 79.8646 31.3223C79.4241 28.0818 79.0751 24.5541 79.0275 21.2881C78.9801 18.0456 79.227 14.9635 80.0375 12.6671C80.1655 12.3045 80.305 11.9539 80.4683 11.6797C80.5868 11.4809 80.9351 10.9388 81.6092 10.9076C82.2782 10.8766 82.6793 11.3772 82.8241 11.5722C83.0217 11.8385 83.2064 12.1912 83.3867 12.5778C85.2136 16.4945 86.224 22.3931 86.7876 28.0897C87.3546 33.8211 87.4805 39.4812 87.4805 43.0001V44.0001H82.1863L82.0064 43.2262L82.9805 43.0001Z",
7643 fill: "#69727D"
7644 })), /*#__PURE__*/ react.default.createElement("defs", null, /*#__PURE__*/ react.default.createElement("clipPath", { id: "clip0_3127_96542" }, /*#__PURE__*/ react.default.createElement("rect", {
7645 width: "184",
7646 height: "80",
7647 fill: "white"
7648 }))));
7649 };
7650 var ImageToolsContainer = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref) {
7651 var theme = _ref.theme;
7652 return { height: "calc(100% - ".concat(theme.spacing(13), ")") };
7653 });
7654 var ToolsTeaserContainer = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref2) {
7655 return {
7656 position: "sticky",
7657 top: "100%",
7658 padding: _ref2.theme.spacing(4, 0, 1)
7659 };
7660 });
7661 var StyledChip = (0, _elementor_ui.styled)(_elementor_ui.Chip)(function() {
7662 return {
7663 position: "absolute",
7664 top: 8,
7665 right: 8,
7666 "& .MuiChip-label": {
7667 fontSize: "0.75rem",
7668 fontWeight: "normal"
7669 }
7670 };
7671 });
7672 var ImageToolsPanel = function ImageToolsPanel() {
7673 var navigate = useLocation().navigate;
7674 var _useIntroduction = useIntroduction("e-ai-image-isolate-tool");
7675 var isIsolateViewed = _useIntroduction.isViewed;
7676 var markIsolateAsViewed = _useIntroduction.markAsViewed;
7677 var tools = [
7678 {
7679 label: (0, _wordpress_i18n.__)("Expand Image", "elementor"),
7680 Icon: ExpandIcon$1,
7681 onClick: function onClick() {
7682 return navigate(LOCATIONS.OUT_PAINTING);
7683 }
7684 },
7685 {
7686 label: (0, _wordpress_i18n.__)("Generative Fill", "elementor"),
7687 Icon: BrushIcon,
7688 onClick: function onClick() {
7689 return navigate(LOCATIONS.IN_PAINTING);
7690 }
7691 },
7692 {
7693 label: (0, _wordpress_i18n.__)("Resize", "elementor"),
7694 Icon: ExpandIcon,
7695 onClick: function onClick() {
7696 return navigate(LOCATIONS.RESIZE);
7697 }
7698 },
7699 {
7700 label: (0, _wordpress_i18n.__)("Variations", "elementor"),
7701 Icon: EvolveIcon,
7702 onClick: function onClick() {
7703 return navigate(LOCATIONS.VARIATIONS);
7704 }
7705 },
7706 {
7707 label: (0, _wordpress_i18n.__)("Remove Background", "elementor"),
7708 Icon: RemoveBackgroundIcon,
7709 onClick: function onClick() {
7710 return navigate(LOCATIONS.REMOVE_BACKGROUND);
7711 }
7712 },
7713 {
7714 label: (0, _wordpress_i18n.__)("Replace Background", "elementor"),
7715 Icon: ReplaceBackgroundIcon,
7716 onClick: function onClick() {
7717 return navigate(LOCATIONS.REPLACE_BACKGROUND);
7718 }
7719 },
7720 {
7721 label: (0, _wordpress_i18n.__)("Cleanup", "elementor"),
7722 Icon: Cleanup$1,
7723 onClick: function onClick() {
7724 return navigate(LOCATIONS.CLEANUP);
7725 }
7726 },
7727 {
7728 label: (0, _wordpress_i18n.__)("Isolate object", "elementor"),
7729 Icon: IsolateObjectIcon,
7730 ChipParam: !isIsolateViewed ? /*#__PURE__*/ react.default.createElement(StyledChip, {
7731 label: "New",
7732 color: "info",
7733 variant: "standard",
7734 size: "tiny"
7735 }) : null,
7736 onClick: function onClick() {
7737 markIsolateAsViewed();
7738 navigate(LOCATIONS.ISOLATE_OBJECT);
7739 }
7740 }
7741 ];
7742 return /*#__PURE__*/ react.default.createElement(ImageToolsContainer, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7743 display: "grid",
7744 gridTemplateColumns: "repeat(2, 1fr)",
7745 gap: 1,
7746 justifyContent: "center"
7747 }, tools.map(function(_ref3) {
7748 var label = _ref3.label;
7749 var Icon = _ref3.Icon;
7750 var ChipParam = _ref3.ChipParam;
7751 var onClick = _ref3.onClick;
7752 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
7753 onClick,
7754 key: label,
7755 variant: "outlined",
7756 color: "secondary",
7757 disabled: false,
7758 sx: {
7759 py: 3,
7760 fontSize: "12px",
7761 height: "auto",
7762 borderRadius: "4px"
7763 }
7764 }, ChipParam, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7765 display: "flex",
7766 justifyContent: "center",
7767 alignItems: "center",
7768 flexDirection: "column"
7769 }, /*#__PURE__*/ react.default.createElement(Icon, { sx: { mb: .5 } }), label));
7770 })), /*#__PURE__*/ react.default.createElement(ToolsTeaserContainer, {
7771 display: "flex",
7772 flexDirection: "column",
7773 alignItems: "center"
7774 }, /*#__PURE__*/ react.default.createElement(TeaserDrawing, null), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
7775 variant: "body2",
7776 align: "center",
7777 color: "secondary",
7778 sx: { mt: 2 }
7779 }, (0, _wordpress_i18n.__)("Stay tuned! More incredible AI tools are coming your way soon.", "elementor"))));
7780 };
7781 ImageToolsPanel.propTypes = {
7782 generateNewPrompt: import_prop_types$8.default.func,
7783 panelActive: import_prop_types$8.default.bool
7784 };
7785
7786 //#endregion
7787 //#region modules/ai/assets/js/editor/pages/form-media/views/image-tools/image-tools-content.js
7788 var ImageToolsContent = function ImageToolsContent() {
7789 var _useEditImage = useEditImage();
7790 var editImage = _useEditImage.editImage;
7791 var width = _useEditImage.width;
7792 var height = _useEditImage.height;
7793 var use = useImageActions().use;
7794 return /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, {
7795 src: editImage.url,
7796 style: {
7797 width,
7798 height
7799 },
7800 alt: editImage.alt || (0, _wordpress_i18n.__)("Image preview", "elementor")
7801 }, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Actions, null, /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, { onClick: function onClick() {
7802 return use(editImage);
7803 } }))));
7804 };
7805
7806 //#endregion
7807 //#region modules/ai/assets/js/editor/pages/form-media/views/image-tools/index.js
7808 var ImageTools = function ImageTools() {
7809 var navigate = useLocation().navigate;
7810 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, { onClick: function onClick() {
7811 return navigate(LOCATIONS.GENERATE);
7812 } }, (0, _wordpress_i18n.__)("Generate with a prompt", "elementor")), /*#__PURE__*/ react.default.createElement(View.PanelHeading, { primary: (0, _wordpress_i18n.__)("Edit with AI", "elementor") }), /*#__PURE__*/ react.default.createElement(ImageToolsPanel, null)), /*#__PURE__*/ react.default.createElement(View.Content, null, /*#__PURE__*/ react.default.createElement(ImageToolsContent, null)));
7813 };
7814
7815 //#endregion
7816 //#region modules/ai/assets/js/editor/pages/form-media/components/generate-submit.js
7817 init_extends();
7818 var GenerateSubmit = function GenerateSubmit(props) {
7819 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
7820 fullWidth: true,
7821 size: "medium",
7822 type: "submit",
7823 variant: "contained"
7824 }, props), props.children || (0, _wordpress_i18n.__)("Generate", "elementor"));
7825 };
7826 GenerateSubmit.propTypes = { children: import_prop_types$8.default.node };
7827
7828 //#endregion
7829 //#region modules/ai/assets/js/editor/pages/form-media/hooks/use-image-prompt.js
7830 init_use_prompt();
7831 var useImagePrompt = function useImagePrompt() {
7832 var promptData = usePrompt.apply(void 0, arguments);
7833 var _useGlobalActions = useGlobalActions();
7834 var setHasUnsavedChanges = _useGlobalActions.setHasUnsavedChanges;
7835 var state = _useGlobalActions.state;
7836 (0, react.useEffect)(function() {
7837 var _promptData$data;
7838 if ((_promptData$data = promptData.data) !== null && _promptData$data !== void 0 && _promptData$data.result) setHasUnsavedChanges(true);
7839 }, [promptData.data]);
7840 (0, react.useEffect)(function() {
7841 if (state.isAllSaved) promptData.sendUsageData();
7842 }, [state.isAllSaved]);
7843 return promptData;
7844 };
7845
7846 //#endregion
7847 //#region modules/ai/assets/js/editor/pages/form-media/views/resize/hooks/use-resize.js
7848 init_api();
7849 var useResize = function useResize(initialValue) {
7850 return useImagePrompt(function fetchAction(payload) {
7851 return getImageToImageUpscale(payload);
7852 }, initialValue);
7853 };
7854
7855 //#endregion
7856 //#region modules/ai/assets/js/editor/pages/form-media/views/resize/index.js
7857 init_defineProperty$1();
7858 init_requests_ids();
7859 var Resize = function Resize() {
7860 var _useEditImage = useEditImage();
7861 var editImage = _useEditImage.editImage;
7862 var initialEditImageWidth = _useEditImage.width;
7863 var setGenerate = useRequestIds().setGenerate;
7864 var _useImageActions = useImageActions();
7865 var use = _useImageActions.use;
7866 var edit = _useImageActions.edit;
7867 var isUploading = _useImageActions.isLoading;
7868 var _usePromptSettings = usePromptSettings();
7869 var settings = _usePromptSettings.settings;
7870 var updateSettings = _usePromptSettings.updateSettings;
7871 var _useResize = useResize();
7872 var data = _useResize.data;
7873 var send = _useResize.send;
7874 var isGenerating = _useResize.isLoading;
7875 var error = _useResize.error;
7876 var isLoading = isGenerating || isUploading;
7877 var handleSubmit = function handleSubmit(event) {
7878 event.preventDefault();
7879 setGenerate();
7880 send({
7881 promptSettings: settings,
7882 image: editImage
7883 });
7884 };
7885 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
7886 primary: (0, _wordpress_i18n.__)("Resize", "elementor"),
7887 secondary: (0, _wordpress_i18n.__)("Make an image larger and improve it’s resolution.", "elementor")
7888 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
7889 error,
7890 onRetry: handleSubmit
7891 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { spacing: .2 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7892 display: "flex",
7893 justifyContent: "space-between",
7894 alignItems: "center"
7895 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "caption" }, "512px"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "caption" }, "2048px")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Slider, {
7896 marks: true,
7897 step: 64,
7898 min: 512,
7899 max: 2048,
7900 id: "upscale_to",
7901 color: "secondary",
7902 name: "upscale_to",
7903 disabled: isLoading,
7904 defaultValue: initialEditImageWidth,
7905 valueLabelDisplay: "auto",
7906 "aria-label": (0, _wordpress_i18n.__)("Upscale to", "elementor"),
7907 onChange: function onChange(_, value) {
7908 return updateSettings(_defineProperty$1({}, IMAGE_UPSCALE, value));
7909 }
7910 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
7911 display: "flex",
7912 justifyContent: "space-between",
7913 alignItems: "center"
7914 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "caption" }, (0, _wordpress_i18n.__)("Current", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "caption" }, (0, _wordpress_i18n.__)("Output", "elementor")))), /*#__PURE__*/ react.default.createElement(GenerateSubmit, { disabled: isLoading }))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
7915 onUseImage: use,
7916 onEditImage: edit,
7917 images: data.result,
7918 aspectRatio: editImage.aspectRatio
7919 }) : /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, {
7920 src: editImage.url,
7921 alt: editImage.alt,
7922 style: {
7923 width: editImage.width,
7924 height: editImage.height
7925 }
7926 }))));
7927 };
7928
7929 //#endregion
7930 //#region node_modules/react-sketch-canvas/dist/react-sketch-canvas.esm.js
7931 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
7932 try {
7933 var info = gen[key](arg);
7934 var value = info.value;
7935 } catch (error) {
7936 reject(error);
7937 return;
7938 }
7939 if (info.done) resolve(value);
7940 else Promise.resolve(value).then(_next, _throw);
7941 }
7942 function _asyncToGenerator(fn) {
7943 return function() {
7944 var self = this;
7945 var args = arguments;
7946 return new Promise(function(resolve, reject) {
7947 var gen = fn.apply(self, args);
7948 function _next(value) {
7949 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
7950 }
7951 function _throw(err) {
7952 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
7953 }
7954 _next(void 0);
7955 });
7956 };
7957 }
7958 function _extends() {
7959 _extends = Object.assign || function(target) {
7960 for (var i = 1; i < arguments.length; i++) {
7961 var source = arguments[i];
7962 for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
7963 }
7964 return target;
7965 };
7966 return _extends.apply(this, arguments);
7967 }
7968 var runtime = { exports: {} };
7969 /**
7970 * Copyright (c) 2014-present, Facebook, Inc.
7971 *
7972 * This source code is licensed under the MIT license found in the
7973 * LICENSE file in the root directory of this source tree.
7974 */
7975 (function(module) {
7976 var runtime = function(exports) {
7977 var Op = Object.prototype;
7978 var hasOwn = Op.hasOwnProperty;
7979 var undefined$1;
7980 var $Symbol = typeof Symbol === "function" ? Symbol : {};
7981 var iteratorSymbol = $Symbol.iterator || "@@iterator";
7982 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
7983 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
7984 function define(obj, key, value) {
7985 Object.defineProperty(obj, key, {
7986 value,
7987 enumerable: true,
7988 configurable: true,
7989 writable: true
7990 });
7991 return obj[key];
7992 }
7993 try {
7994 define({}, "");
7995 } catch (err) {
7996 define = function(obj, key, value) {
7997 return obj[key] = value;
7998 };
7999 }
8000 function wrap(innerFn, outerFn, self, tryLocsList) {
8001 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
8002 var generator = Object.create(protoGenerator.prototype);
8003 generator._invoke = makeInvokeMethod(innerFn, self, new Context(tryLocsList || []));
8004 return generator;
8005 }
8006 exports.wrap = wrap;
8007 function tryCatch(fn, obj, arg) {
8008 try {
8009 return {
8010 type: "normal",
8011 arg: fn.call(obj, arg)
8012 };
8013 } catch (err) {
8014 return {
8015 type: "throw",
8016 arg: err
8017 };
8018 }
8019 }
8020 var GenStateSuspendedStart = "suspendedStart";
8021 var GenStateSuspendedYield = "suspendedYield";
8022 var GenStateExecuting = "executing";
8023 var GenStateCompleted = "completed";
8024 var ContinueSentinel = {};
8025 function Generator() {}
8026 function GeneratorFunction() {}
8027 function GeneratorFunctionPrototype() {}
8028 var IteratorPrototype = {};
8029 define(IteratorPrototype, iteratorSymbol, function() {
8030 return this;
8031 });
8032 var getProto = Object.getPrototypeOf;
8033 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
8034 if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) IteratorPrototype = NativeIteratorPrototype;
8035 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
8036 GeneratorFunction.prototype = GeneratorFunctionPrototype;
8037 define(Gp, "constructor", GeneratorFunctionPrototype);
8038 define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
8039 GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
8040 function defineIteratorMethods(prototype) {
8041 [
8042 "next",
8043 "throw",
8044 "return"
8045 ].forEach(function(method) {
8046 define(prototype, method, function(arg) {
8047 return this._invoke(method, arg);
8048 });
8049 });
8050 }
8051 exports.isGeneratorFunction = function(genFun) {
8052 var ctor = typeof genFun === "function" && genFun.constructor;
8053 return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
8054 };
8055 exports.mark = function(genFun) {
8056 if (Object.setPrototypeOf) Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
8057 else {
8058 genFun.__proto__ = GeneratorFunctionPrototype;
8059 define(genFun, toStringTagSymbol, "GeneratorFunction");
8060 }
8061 genFun.prototype = Object.create(Gp);
8062 return genFun;
8063 };
8064 exports.awrap = function(arg) {
8065 return { __await: arg };
8066 };
8067 function AsyncIterator(generator, PromiseImpl) {
8068 function invoke(method, arg, resolve, reject) {
8069 var record = tryCatch(generator[method], generator, arg);
8070 if (record.type === "throw") reject(record.arg);
8071 else {
8072 var result = record.arg;
8073 var value = result.value;
8074 if (value && typeof value === "object" && hasOwn.call(value, "__await")) return PromiseImpl.resolve(value.__await).then(function(value) {
8075 invoke("next", value, resolve, reject);
8076 }, function(err) {
8077 invoke("throw", err, resolve, reject);
8078 });
8079 return PromiseImpl.resolve(value).then(function(unwrapped) {
8080 result.value = unwrapped;
8081 resolve(result);
8082 }, function(error) {
8083 return invoke("throw", error, resolve, reject);
8084 });
8085 }
8086 }
8087 var previousPromise;
8088 function enqueue(method, arg) {
8089 function callInvokeWithMethodAndArg() {
8090 return new PromiseImpl(function(resolve, reject) {
8091 invoke(method, arg, resolve, reject);
8092 });
8093 }
8094 return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
8095 }
8096 this._invoke = enqueue;
8097 }
8098 defineIteratorMethods(AsyncIterator.prototype);
8099 define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
8100 return this;
8101 });
8102 exports.AsyncIterator = AsyncIterator;
8103 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
8104 if (PromiseImpl === void 0) PromiseImpl = Promise;
8105 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
8106 return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
8107 return result.done ? result.value : iter.next();
8108 });
8109 };
8110 function makeInvokeMethod(innerFn, self, context) {
8111 var state = GenStateSuspendedStart;
8112 return function invoke(method, arg) {
8113 if (state === GenStateExecuting) throw new Error("Generator is already running");
8114 if (state === GenStateCompleted) {
8115 if (method === "throw") throw arg;
8116 return doneResult();
8117 }
8118 context.method = method;
8119 context.arg = arg;
8120 while (true) {
8121 var delegate = context.delegate;
8122 if (delegate) {
8123 var delegateResult = maybeInvokeDelegate(delegate, context);
8124 if (delegateResult) {
8125 if (delegateResult === ContinueSentinel) continue;
8126 return delegateResult;
8127 }
8128 }
8129 if (context.method === "next") context.sent = context._sent = context.arg;
8130 else if (context.method === "throw") {
8131 if (state === GenStateSuspendedStart) {
8132 state = GenStateCompleted;
8133 throw context.arg;
8134 }
8135 context.dispatchException(context.arg);
8136 } else if (context.method === "return") context.abrupt("return", context.arg);
8137 state = GenStateExecuting;
8138 var record = tryCatch(innerFn, self, context);
8139 if (record.type === "normal") {
8140 state = context.done ? GenStateCompleted : GenStateSuspendedYield;
8141 if (record.arg === ContinueSentinel) continue;
8142 return {
8143 value: record.arg,
8144 done: context.done
8145 };
8146 } else if (record.type === "throw") {
8147 state = GenStateCompleted;
8148 context.method = "throw";
8149 context.arg = record.arg;
8150 }
8151 }
8152 };
8153 }
8154 function maybeInvokeDelegate(delegate, context) {
8155 var method = delegate.iterator[context.method];
8156 if (method === undefined$1) {
8157 context.delegate = null;
8158 if (context.method === "throw") {
8159 if (delegate.iterator["return"]) {
8160 context.method = "return";
8161 context.arg = undefined$1;
8162 maybeInvokeDelegate(delegate, context);
8163 if (context.method === "throw") return ContinueSentinel;
8164 }
8165 context.method = "throw";
8166 context.arg = /* @__PURE__ */ new TypeError("The iterator does not provide a 'throw' method");
8167 }
8168 return ContinueSentinel;
8169 }
8170 var record = tryCatch(method, delegate.iterator, context.arg);
8171 if (record.type === "throw") {
8172 context.method = "throw";
8173 context.arg = record.arg;
8174 context.delegate = null;
8175 return ContinueSentinel;
8176 }
8177 var info = record.arg;
8178 if (!info) {
8179 context.method = "throw";
8180 context.arg = /* @__PURE__ */ new TypeError("iterator result is not an object");
8181 context.delegate = null;
8182 return ContinueSentinel;
8183 }
8184 if (info.done) {
8185 context[delegate.resultName] = info.value;
8186 context.next = delegate.nextLoc;
8187 if (context.method !== "return") {
8188 context.method = "next";
8189 context.arg = undefined$1;
8190 }
8191 } else return info;
8192 context.delegate = null;
8193 return ContinueSentinel;
8194 }
8195 defineIteratorMethods(Gp);
8196 define(Gp, toStringTagSymbol, "Generator");
8197 define(Gp, iteratorSymbol, function() {
8198 return this;
8199 });
8200 define(Gp, "toString", function() {
8201 return "[object Generator]";
8202 });
8203 function pushTryEntry(locs) {
8204 var entry = { tryLoc: locs[0] };
8205 if (1 in locs) entry.catchLoc = locs[1];
8206 if (2 in locs) {
8207 entry.finallyLoc = locs[2];
8208 entry.afterLoc = locs[3];
8209 }
8210 this.tryEntries.push(entry);
8211 }
8212 function resetTryEntry(entry) {
8213 var record = entry.completion || {};
8214 record.type = "normal";
8215 delete record.arg;
8216 entry.completion = record;
8217 }
8218 function Context(tryLocsList) {
8219 this.tryEntries = [{ tryLoc: "root" }];
8220 tryLocsList.forEach(pushTryEntry, this);
8221 this.reset(true);
8222 }
8223 exports.keys = function(object) {
8224 var keys = [];
8225 for (var key in object) keys.push(key);
8226 keys.reverse();
8227 return function next() {
8228 while (keys.length) {
8229 var key = keys.pop();
8230 if (key in object) {
8231 next.value = key;
8232 next.done = false;
8233 return next;
8234 }
8235 }
8236 next.done = true;
8237 return next;
8238 };
8239 };
8240 function values(iterable) {
8241 if (iterable) {
8242 var iteratorMethod = iterable[iteratorSymbol];
8243 if (iteratorMethod) return iteratorMethod.call(iterable);
8244 if (typeof iterable.next === "function") return iterable;
8245 if (!isNaN(iterable.length)) {
8246 var i = -1;
8247 var next = function next() {
8248 while (++i < iterable.length) if (hasOwn.call(iterable, i)) {
8249 next.value = iterable[i];
8250 next.done = false;
8251 return next;
8252 }
8253 next.value = undefined$1;
8254 next.done = true;
8255 return next;
8256 };
8257 return next.next = next;
8258 }
8259 }
8260 return { next: doneResult };
8261 }
8262 exports.values = values;
8263 function doneResult() {
8264 return {
8265 value: undefined$1,
8266 done: true
8267 };
8268 }
8269 Context.prototype = {
8270 constructor: Context,
8271 reset: function(skipTempReset) {
8272 this.prev = 0;
8273 this.next = 0;
8274 this.sent = this._sent = undefined$1;
8275 this.done = false;
8276 this.delegate = null;
8277 this.method = "next";
8278 this.arg = undefined$1;
8279 this.tryEntries.forEach(resetTryEntry);
8280 if (!skipTempReset) {
8281 for (var name in this) if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) this[name] = undefined$1;
8282 }
8283 },
8284 stop: function() {
8285 this.done = true;
8286 var rootRecord = this.tryEntries[0].completion;
8287 if (rootRecord.type === "throw") throw rootRecord.arg;
8288 return this.rval;
8289 },
8290 dispatchException: function(exception) {
8291 if (this.done) throw exception;
8292 var context = this;
8293 function handle(loc, caught) {
8294 record.type = "throw";
8295 record.arg = exception;
8296 context.next = loc;
8297 if (caught) {
8298 context.method = "next";
8299 context.arg = undefined$1;
8300 }
8301 return !!caught;
8302 }
8303 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8304 var entry = this.tryEntries[i];
8305 var record = entry.completion;
8306 if (entry.tryLoc === "root") return handle("end");
8307 if (entry.tryLoc <= this.prev) {
8308 var hasCatch = hasOwn.call(entry, "catchLoc");
8309 var hasFinally = hasOwn.call(entry, "finallyLoc");
8310 if (hasCatch && hasFinally) {
8311 if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true);
8312 else if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
8313 } else if (hasCatch) {
8314 if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true);
8315 } else if (hasFinally) {
8316 if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
8317 } else throw new Error("try statement without catch or finally");
8318 }
8319 }
8320 },
8321 abrupt: function(type, arg) {
8322 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8323 var entry = this.tryEntries[i];
8324 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
8325 var finallyEntry = entry;
8326 break;
8327 }
8328 }
8329 if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) finallyEntry = null;
8330 var record = finallyEntry ? finallyEntry.completion : {};
8331 record.type = type;
8332 record.arg = arg;
8333 if (finallyEntry) {
8334 this.method = "next";
8335 this.next = finallyEntry.finallyLoc;
8336 return ContinueSentinel;
8337 }
8338 return this.complete(record);
8339 },
8340 complete: function(record, afterLoc) {
8341 if (record.type === "throw") throw record.arg;
8342 if (record.type === "break" || record.type === "continue") this.next = record.arg;
8343 else if (record.type === "return") {
8344 this.rval = this.arg = record.arg;
8345 this.method = "return";
8346 this.next = "end";
8347 } else if (record.type === "normal" && afterLoc) this.next = afterLoc;
8348 return ContinueSentinel;
8349 },
8350 finish: function(finallyLoc) {
8351 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8352 var entry = this.tryEntries[i];
8353 if (entry.finallyLoc === finallyLoc) {
8354 this.complete(entry.completion, entry.afterLoc);
8355 resetTryEntry(entry);
8356 return ContinueSentinel;
8357 }
8358 }
8359 },
8360 "catch": function(tryLoc) {
8361 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8362 var entry = this.tryEntries[i];
8363 if (entry.tryLoc === tryLoc) {
8364 var record = entry.completion;
8365 if (record.type === "throw") {
8366 var thrown = record.arg;
8367 resetTryEntry(entry);
8368 }
8369 return thrown;
8370 }
8371 }
8372 throw new Error("illegal catch attempt");
8373 },
8374 delegateYield: function(iterable, resultName, nextLoc) {
8375 this.delegate = {
8376 iterator: values(iterable),
8377 resultName,
8378 nextLoc
8379 };
8380 if (this.method === "next") this.arg = undefined$1;
8381 return ContinueSentinel;
8382 }
8383 };
8384 return exports;
8385 }(module.exports);
8386 try {
8387 regeneratorRuntime = runtime;
8388 } catch (accidentalStrictMode) {
8389 if (typeof globalThis === "object") globalThis.regeneratorRuntime = runtime;
8390 else Function("r", "regeneratorRuntime = r")(runtime);
8391 }
8392 })(runtime);
8393 var _regeneratorRuntime$19 = runtime.exports;
8394 /**
8395 * Generate SVG Path tag from the given points
8396 */
8397 var SvgPath = function SvgPath(_ref) {
8398 var paths = _ref.paths;
8399 var id = _ref.id;
8400 var strokeWidth = _ref.strokeWidth;
8401 var strokeColor = _ref.strokeColor;
8402 var _ref$command = _ref.command;
8403 var command = _ref$command === void 0 ? bezierCommand : _ref$command;
8404 if (paths.length === 1) {
8405 var _paths$ = paths[0];
8406 var x = _paths$.x;
8407 var y = _paths$.y;
8408 var radius = strokeWidth / 2;
8409 return react.createElement("circle", {
8410 key: id,
8411 id,
8412 cx: x,
8413 cy: y,
8414 r: radius,
8415 stroke: strokeColor,
8416 fill: strokeColor
8417 });
8418 }
8419 var d = paths.reduce(function(acc, point, i, a) {
8420 return i === 0 ? "M " + point.x + "," + point.y : acc + " " + command(point, i, a);
8421 }, "");
8422 return react.createElement("path", {
8423 key: id,
8424 id,
8425 d,
8426 fill: "none",
8427 strokeLinecap: "round",
8428 stroke: strokeColor,
8429 strokeWidth
8430 });
8431 };
8432 var line = function line(pointA, pointB) {
8433 var lengthX = pointB.x - pointA.x;
8434 var lengthY = pointB.y - pointA.y;
8435 return {
8436 length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),
8437 angle: Math.atan2(lengthY, lengthX)
8438 };
8439 };
8440 var controlPoint = function controlPoint(controlPoints) {
8441 var current = controlPoints.current;
8442 var next = controlPoints.next;
8443 var previous = controlPoints.previous;
8444 var reverse = controlPoints.reverse;
8445 var p = previous || current;
8446 var n = next || current;
8447 var smoothing = .2;
8448 var o = line(p, n);
8449 var angle = o.angle + (reverse ? Math.PI : 0);
8450 var length = o.length * smoothing;
8451 return [current.x + Math.cos(angle) * length, current.y + Math.sin(angle) * length];
8452 };
8453 var bezierCommand = function bezierCommand(point, i, a) {
8454 var cpsX = null;
8455 var cpsY = null;
8456 switch (i) {
8457 case 0:
8458 var _controlPoint = controlPoint({ current: point });
8459 cpsX = _controlPoint[0];
8460 cpsY = _controlPoint[1];
8461 break;
8462 case 1:
8463 var _controlPoint2 = controlPoint({
8464 current: a[i - 1],
8465 next: point
8466 });
8467 cpsX = _controlPoint2[0];
8468 cpsY = _controlPoint2[1];
8469 break;
8470 default:
8471 var _controlPoint3 = controlPoint({
8472 current: a[i - 1],
8473 previous: a[i - 2],
8474 next: point
8475 });
8476 cpsX = _controlPoint3[0];
8477 cpsY = _controlPoint3[1];
8478 break;
8479 }
8480 var _controlPoint4 = controlPoint({
8481 current: point,
8482 previous: a[i - 1],
8483 next: a[i + 1],
8484 reverse: true
8485 });
8486 var cpeX = _controlPoint4[0];
8487 var cpeY = _controlPoint4[1];
8488 return "C " + cpsX + "," + cpsY + " " + cpeX + "," + cpeY + " " + point.x + ", " + point.y;
8489 };
8490 var Paths = function Paths(_ref2) {
8491 var id = _ref2.id;
8492 var paths = _ref2.paths;
8493 return react.createElement(react.Fragment, null, paths.map(function(path, index) {
8494 return react.createElement(SvgPath, {
8495 key: id + "__" + index,
8496 paths: path.paths,
8497 id: id + "__" + index,
8498 strokeWidth: path.strokeWidth,
8499 strokeColor: path.strokeColor,
8500 command: bezierCommand
8501 });
8502 }));
8503 };
8504 var loadImage = function loadImage(url) {
8505 return new Promise(function(resolve, reject) {
8506 var img = new Image();
8507 img.addEventListener("load", function() {
8508 if (img.width > 0) resolve(img);
8509 reject("Image not found");
8510 });
8511 img.addEventListener("error", function(err) {
8512 return reject(err);
8513 });
8514 img.src = url;
8515 img.setAttribute("crossorigin", "anonymous");
8516 });
8517 };
8518 function getCanvasWithViewBox(canvas) {
8519 var _canvas$firstChild;
8520 var svgCanvas = (_canvas$firstChild = canvas.firstChild) == null ? void 0 : _canvas$firstChild.cloneNode(true);
8521 var width = canvas.offsetWidth;
8522 var height = canvas.offsetHeight;
8523 svgCanvas.setAttribute("viewBox", "0 0 " + width + " " + height);
8524 svgCanvas.setAttribute("width", width.toString());
8525 svgCanvas.setAttribute("height", height.toString());
8526 return {
8527 svgCanvas,
8528 width,
8529 height
8530 };
8531 }
8532 var Canvas = /*#__PURE__*/ react.forwardRef(function(props, ref) {
8533 var paths = props.paths;
8534 var isDrawing = props.isDrawing;
8535 var onPointerDown = props.onPointerDown;
8536 var onPointerMove = props.onPointerMove;
8537 var onPointerUp = props.onPointerUp;
8538 var _props$id = props.id;
8539 var id = _props$id === void 0 ? "react-sketch-canvas" : _props$id;
8540 var _props$width = props.width;
8541 var width = _props$width === void 0 ? "100%" : _props$width;
8542 var _props$height = props.height;
8543 var height = _props$height === void 0 ? "100%" : _props$height;
8544 var _props$className = props.className;
8545 var className = _props$className === void 0 ? "react-sketch-canvas" : _props$className;
8546 var _props$canvasColor = props.canvasColor;
8547 var canvasColor = _props$canvasColor === void 0 ? "red" : _props$canvasColor;
8548 var _props$backgroundImag = props.backgroundImage;
8549 var backgroundImage = _props$backgroundImag === void 0 ? "" : _props$backgroundImag;
8550 var _props$exportWithBack = props.exportWithBackgroundImage;
8551 var exportWithBackgroundImage = _props$exportWithBack === void 0 ? false : _props$exportWithBack;
8552 var _props$preserveBackgr = props.preserveBackgroundImageAspectRatio;
8553 var preserveBackgroundImageAspectRatio = _props$preserveBackgr === void 0 ? "none" : _props$preserveBackgr;
8554 var _props$allowOnlyPoint = props.allowOnlyPointerType;
8555 var allowOnlyPointerType = _props$allowOnlyPoint === void 0 ? "all" : _props$allowOnlyPoint;
8556 var _props$style = props.style;
8557 var style = _props$style === void 0 ? {
8558 border: "0.0625rem solid #9c9c9c",
8559 borderRadius: "0.25rem"
8560 } : _props$style;
8561 var _props$svgStyle = props.svgStyle;
8562 var svgStyle = _props$svgStyle === void 0 ? {} : _props$svgStyle;
8563 var canvasRef = react.useRef(null);
8564 var getCoordinates = function getCoordinates(pointerEvent) {
8565 var _canvasRef$current;
8566 var _window$scrollX;
8567 var _window$scrollY;
8568 var boundingArea = (_canvasRef$current = canvasRef.current) == null ? void 0 : _canvasRef$current.getBoundingClientRect();
8569 var scrollLeft = (_window$scrollX = window.scrollX) != null ? _window$scrollX : 0;
8570 var scrollTop = (_window$scrollY = window.scrollY) != null ? _window$scrollY : 0;
8571 if (!boundingArea) return {
8572 x: 0,
8573 y: 0
8574 };
8575 return {
8576 x: pointerEvent.pageX - boundingArea.left - scrollLeft,
8577 y: pointerEvent.pageY - boundingArea.top - scrollTop
8578 };
8579 };
8580 var handlePointerDown = function handlePointerDown(event) {
8581 if (allowOnlyPointerType !== "all" && event.pointerType !== allowOnlyPointerType) return;
8582 if (event.pointerType === "mouse" && event.button !== 0) return;
8583 onPointerDown(getCoordinates(event));
8584 };
8585 var handlePointerMove = function handlePointerMove(event) {
8586 if (!isDrawing) return;
8587 if (allowOnlyPointerType !== "all" && event.pointerType !== allowOnlyPointerType) return;
8588 onPointerMove(getCoordinates(event));
8589 };
8590 var handlePointerUp = function handlePointerUp(event) {
8591 if (event.pointerType === "mouse" && event.button !== 0) return;
8592 if (allowOnlyPointerType !== "all" && event.pointerType !== allowOnlyPointerType) return;
8593 onPointerUp();
8594 };
8595 react.useImperativeHandle(ref, function() {
8596 return {
8597 exportImage: function exportImage(imageType) {
8598 return new Promise(/*#__PURE__*/ function() {
8599 var _ref = _asyncToGenerator(/*#__PURE__*/ _regeneratorRuntime$19.mark(function _callee(resolve, reject) {
8600 var canvas;
8601 var _getCanvasWithViewBox;
8602 var svgCanvas;
8603 var _width;
8604 var _height;
8605 var canvasSketch;
8606 var loadImagePromises;
8607 var img;
8608 return _regeneratorRuntime$19.wrap(function _callee$(_context) {
8609 while (1) switch (_context.prev = _context.next) {
8610 case 0:
8611 _context.prev = 0;
8612 canvas = canvasRef.current;
8613 if (canvas) {
8614 _context.next = 4;
8615 break;
8616 }
8617 throw Error("Canvas not rendered yet");
8618 case 4:
8619 _getCanvasWithViewBox = getCanvasWithViewBox(canvas), svgCanvas = _getCanvasWithViewBox.svgCanvas, _width = _getCanvasWithViewBox.width, _height = _getCanvasWithViewBox.height;
8620 canvasSketch = "data:image/svg+xml;base64," + btoa(svgCanvas.outerHTML);
8621 _context.next = 8;
8622 return loadImage(canvasSketch);
8623 case 8:
8624 _context.t0 = _context.sent;
8625 loadImagePromises = [_context.t0];
8626 if (!exportWithBackgroundImage) {
8627 _context.next = 21;
8628 break;
8629 }
8630 _context.prev = 11;
8631 _context.next = 14;
8632 return loadImage(backgroundImage);
8633 case 14:
8634 img = _context.sent;
8635 loadImagePromises.push(img);
8636 _context.next = 21;
8637 break;
8638 case 18:
8639 _context.prev = 18;
8640 _context.t1 = _context["catch"](11);
8641 console.warn("exportWithBackgroundImage props is set without a valid background image URL. This option is ignored");
8642 case 21:
8643 Promise.all(loadImagePromises).then(function(images) {
8644 var renderCanvas = document.createElement("canvas");
8645 renderCanvas.setAttribute("width", _width.toString());
8646 renderCanvas.setAttribute("height", _height.toString());
8647 var context = renderCanvas.getContext("2d");
8648 if (!context) throw Error("Canvas not rendered yet");
8649 images.reverse().forEach(function(image) {
8650 context.drawImage(image, 0, 0);
8651 });
8652 resolve(renderCanvas.toDataURL("image/" + imageType));
8653 })["catch"](function(e) {
8654 throw e;
8655 });
8656 _context.next = 27;
8657 break;
8658 case 24:
8659 _context.prev = 24;
8660 _context.t2 = _context["catch"](0);
8661 reject(_context.t2);
8662 case 27:
8663 case "end": return _context.stop();
8664 }
8665 }, _callee, null, [[0, 24], [11, 18]]);
8666 }));
8667 return function(_x, _x2) {
8668 return _ref.apply(this, arguments);
8669 };
8670 }());
8671 },
8672 exportSvg: function exportSvg() {
8673 return new Promise(function(resolve, reject) {
8674 try {
8675 var _canvasRef$current2;
8676 var canvas = (_canvasRef$current2 = canvasRef.current) != null ? _canvasRef$current2 : null;
8677 if (canvas !== null) {
8678 var _svgCanvas$querySelec;
8679 var _svgCanvas$querySelec2;
8680 var svgCanvas = getCanvasWithViewBox(canvas).svgCanvas;
8681 if (exportWithBackgroundImage) {
8682 resolve(svgCanvas.outerHTML);
8683 return;
8684 }
8685 (_svgCanvas$querySelec = svgCanvas.querySelector("#" + id + "__background")) == null || _svgCanvas$querySelec.remove();
8686 (_svgCanvas$querySelec2 = svgCanvas.querySelector("#" + id + "__canvas-background")) == null || _svgCanvas$querySelec2.setAttribute("fill", canvasColor);
8687 resolve(svgCanvas.outerHTML);
8688 }
8689 reject(/* @__PURE__ */ new Error("Canvas not loaded"));
8690 } catch (e) {
8691 reject(e);
8692 }
8693 });
8694 }
8695 };
8696 });
8697 react.useEffect(function() {
8698 document.addEventListener("pointerup", handlePointerUp);
8699 return function() {
8700 document.removeEventListener("pointerup", handlePointerUp);
8701 };
8702 }, [handlePointerUp]);
8703 var eraserPaths = paths.filter(function(path) {
8704 return !path.drawMode;
8705 });
8706 var currentGroup = 0;
8707 var pathGroups = paths.reduce(function(arrayGroup, path) {
8708 if (!path.drawMode) {
8709 currentGroup += 1;
8710 return arrayGroup;
8711 }
8712 if (arrayGroup[currentGroup] === void 0) arrayGroup[currentGroup] = [];
8713 arrayGroup[currentGroup].push(path);
8714 return arrayGroup;
8715 }, [[]]);
8716 return react.createElement("div", {
8717 role: "presentation",
8718 ref: canvasRef,
8719 className,
8720 style: _extends({
8721 touchAction: "none",
8722 width,
8723 height
8724 }, style),
8725 "touch-action": "none",
8726 onPointerDown: handlePointerDown,
8727 onPointerMove: handlePointerMove,
8728 onPointerUp: handlePointerUp
8729 }, react.createElement("svg", {
8730 version: "1.1",
8731 baseProfile: "full",
8732 xmlns: "http://www.w3.org/2000/svg",
8733 xmlnsXlink: "http://www.w3.org/1999/xlink",
8734 style: _extends({
8735 width: "100%",
8736 height: "100%"
8737 }, svgStyle),
8738 id
8739 }, react.createElement("g", {
8740 id: id + "__eraser-stroke-group",
8741 display: "none"
8742 }, react.createElement("rect", {
8743 id: id + "__mask-background",
8744 x: "0",
8745 y: "0",
8746 width: "100%",
8747 height: "100%",
8748 fill: "white"
8749 }), eraserPaths.map(function(eraserPath, i) {
8750 return react.createElement(SvgPath, {
8751 key: id + "__eraser-" + i,
8752 id: id + "__eraser-" + i,
8753 paths: eraserPath.paths,
8754 strokeColor: "#000000",
8755 strokeWidth: eraserPath.strokeWidth
8756 });
8757 })), react.createElement("defs", null, backgroundImage && react.createElement("pattern", {
8758 id: id + "__background",
8759 x: "0",
8760 y: "0",
8761 width: "100%",
8762 height: "100%",
8763 patternUnits: "userSpaceOnUse"
8764 }, react.createElement("image", {
8765 x: "0",
8766 y: "0",
8767 width: "100%",
8768 height: "100%",
8769 xlinkHref: backgroundImage,
8770 preserveAspectRatio: preserveBackgroundImageAspectRatio
8771 })), eraserPaths.map(function(_, i) {
8772 return react.createElement("mask", {
8773 id: id + "__eraser-mask-" + i,
8774 key: id + "__eraser-mask-" + i,
8775 maskUnits: "userSpaceOnUse"
8776 }, react.createElement("use", { href: "#" + id + "__mask-background" }), Array.from({ length: eraserPaths.length - i }, function(_, j) {
8777 return j + i;
8778 }).map(function(k) {
8779 return react.createElement("use", {
8780 key: k.toString(),
8781 href: "#" + id + "__eraser-" + k.toString()
8782 });
8783 }));
8784 })), react.createElement("g", { id: id + "__canvas-background-group" }, react.createElement("rect", {
8785 id: id + "__canvas-background",
8786 x: "0",
8787 y: "0",
8788 width: "100%",
8789 height: "100%",
8790 fill: backgroundImage ? "url(#" + id + "__background)" : canvasColor
8791 })), pathGroups.map(function(pathGroup, i) {
8792 return react.createElement("g", {
8793 id: id + "__stroke-group-" + i,
8794 key: id + "__stroke-group-" + i,
8795 mask: "url(#" + id + "__eraser-mask-" + i + ")"
8796 }, react.createElement(Paths, {
8797 id,
8798 paths: pathGroup
8799 }));
8800 })));
8801 });
8802 var ReactSketchCanvas = /*#__PURE__*/ react.forwardRef(function(props, ref) {
8803 var _props$id = props.id;
8804 var id = _props$id === void 0 ? "react-sketch-canvas" : _props$id;
8805 var _props$width = props.width;
8806 var width = _props$width === void 0 ? "100%" : _props$width;
8807 var _props$height = props.height;
8808 var height = _props$height === void 0 ? "100%" : _props$height;
8809 var _props$className = props.className;
8810 var className = _props$className === void 0 ? "" : _props$className;
8811 var _props$canvasColor = props.canvasColor;
8812 var canvasColor = _props$canvasColor === void 0 ? "white" : _props$canvasColor;
8813 var _props$strokeColor = props.strokeColor;
8814 var strokeColor = _props$strokeColor === void 0 ? "red" : _props$strokeColor;
8815 var _props$backgroundImag = props.backgroundImage;
8816 var backgroundImage = _props$backgroundImag === void 0 ? "" : _props$backgroundImag;
8817 var _props$exportWithBack = props.exportWithBackgroundImage;
8818 var exportWithBackgroundImage = _props$exportWithBack === void 0 ? false : _props$exportWithBack;
8819 var _props$preserveBackgr = props.preserveBackgroundImageAspectRatio;
8820 var preserveBackgroundImageAspectRatio = _props$preserveBackgr === void 0 ? "none" : _props$preserveBackgr;
8821 var _props$strokeWidth = props.strokeWidth;
8822 var strokeWidth = _props$strokeWidth === void 0 ? 4 : _props$strokeWidth;
8823 var _props$eraserWidth = props.eraserWidth;
8824 var eraserWidth = _props$eraserWidth === void 0 ? 8 : _props$eraserWidth;
8825 var _props$allowOnlyPoint = props.allowOnlyPointerType;
8826 var allowOnlyPointerType = _props$allowOnlyPoint === void 0 ? "all" : _props$allowOnlyPoint;
8827 var _props$style = props.style;
8828 var style = _props$style === void 0 ? {
8829 border: "0.0625rem solid #9c9c9c",
8830 borderRadius: "0.25rem"
8831 } : _props$style;
8832 var _props$svgStyle = props.svgStyle;
8833 var svgStyle = _props$svgStyle === void 0 ? {} : _props$svgStyle;
8834 var _props$onChange = props.onChange;
8835 var onChange = _props$onChange === void 0 ? function(_paths) {} : _props$onChange;
8836 var _props$onStroke = props.onStroke;
8837 var onStroke = _props$onStroke === void 0 ? function(_path, _isEraser) {} : _props$onStroke;
8838 var _props$withTimestamp = props.withTimestamp;
8839 var withTimestamp = _props$withTimestamp === void 0 ? false : _props$withTimestamp;
8840 var svgCanvas = react.createRef();
8841 var _React$useState = react.useState(true);
8842 var drawMode = _React$useState[0];
8843 var setDrawMode = _React$useState[1];
8844 var _React$useState2 = react.useState(false);
8845 var isDrawing = _React$useState2[0];
8846 var setIsDrawing = _React$useState2[1];
8847 var _React$useState3 = react.useState([]);
8848 var resetStack = _React$useState3[0];
8849 var setResetStack = _React$useState3[1];
8850 var _React$useState4 = react.useState([]);
8851 var undoStack = _React$useState4[0];
8852 var setUndoStack = _React$useState4[1];
8853 var _React$useState5 = react.useState([]);
8854 var currentPaths = _React$useState5[0];
8855 var setCurrentPaths = _React$useState5[1];
8856 var liftStrokeUp = react.useCallback(function() {
8857 var _currentPaths$slice$;
8858 var _currentPaths$slice;
8859 var lastStroke = (_currentPaths$slice$ = (_currentPaths$slice = currentPaths.slice(-1)) == null ? void 0 : _currentPaths$slice[0]) != null ? _currentPaths$slice$ : null;
8860 if (lastStroke === null) {
8861 console.warn("No stroke found!");
8862 return;
8863 }
8864 onStroke(lastStroke, !lastStroke.drawMode);
8865 }, [isDrawing]);
8866 react.useEffect(function() {
8867 liftStrokeUp();
8868 }, [isDrawing]);
8869 react.useEffect(function() {
8870 onChange(currentPaths);
8871 }, [currentPaths]);
8872 react.useImperativeHandle(ref, function() {
8873 return {
8874 eraseMode: function eraseMode(erase) {
8875 setDrawMode(!erase);
8876 },
8877 clearCanvas: function clearCanvas() {
8878 setResetStack([].concat(currentPaths));
8879 setCurrentPaths([]);
8880 },
8881 undo: function undo() {
8882 if (resetStack.length !== 0) {
8883 setCurrentPaths([].concat(resetStack));
8884 setResetStack([]);
8885 return;
8886 }
8887 setUndoStack(function(undoStack) {
8888 return [].concat(undoStack, currentPaths.slice(-1));
8889 });
8890 setCurrentPaths(function(currentPaths) {
8891 return currentPaths.slice(0, -1);
8892 });
8893 },
8894 redo: function redo() {
8895 if (undoStack.length === 0) return;
8896 setCurrentPaths(function(currentPaths) {
8897 return [].concat(currentPaths, undoStack.slice(-1));
8898 });
8899 setUndoStack(function(undoStack) {
8900 return undoStack.slice(0, -1);
8901 });
8902 },
8903 exportImage: function exportImage(imageType) {
8904 var _svgCanvas$current;
8905 var exportImage = (_svgCanvas$current = svgCanvas.current) == null ? void 0 : _svgCanvas$current.exportImage;
8906 if (!exportImage) throw Error("Export function called before canvas loaded");
8907 else return exportImage(imageType);
8908 },
8909 exportSvg: function exportSvg() {
8910 return new Promise(function(resolve, reject) {
8911 var _svgCanvas$current2;
8912 var exportSvg = (_svgCanvas$current2 = svgCanvas.current) == null ? void 0 : _svgCanvas$current2.exportSvg;
8913 if (!exportSvg) reject(Error("Export function called before canvas loaded"));
8914 else exportSvg().then(function(data) {
8915 resolve(data);
8916 })["catch"](function(e) {
8917 reject(e);
8918 });
8919 });
8920 },
8921 exportPaths: function exportPaths() {
8922 return new Promise(function(resolve, reject) {
8923 try {
8924 resolve(currentPaths);
8925 } catch (e) {
8926 reject(e);
8927 }
8928 });
8929 },
8930 loadPaths: function loadPaths(paths) {
8931 setCurrentPaths(function(currentPaths) {
8932 return [].concat(currentPaths, paths);
8933 });
8934 },
8935 getSketchingTime: function getSketchingTime() {
8936 return new Promise(function(resolve, reject) {
8937 if (!withTimestamp) reject(/* @__PURE__ */ new Error("Set 'withTimestamp' prop to get sketching time"));
8938 try {
8939 resolve(currentPaths.reduce(function(totalSketchingTime, path) {
8940 var _path$startTimestamp;
8941 var _path$endTimestamp;
8942 var startTimestamp = (_path$startTimestamp = path.startTimestamp) != null ? _path$startTimestamp : 0;
8943 return totalSketchingTime + (((_path$endTimestamp = path.endTimestamp) != null ? _path$endTimestamp : 0) - startTimestamp);
8944 }, 0));
8945 } catch (e) {
8946 reject(e);
8947 }
8948 });
8949 },
8950 resetCanvas: function resetCanvas() {
8951 setResetStack([]);
8952 setUndoStack([]);
8953 setCurrentPaths([]);
8954 }
8955 };
8956 });
8957 return react.createElement(Canvas, {
8958 ref: svgCanvas,
8959 id,
8960 width,
8961 height,
8962 className,
8963 canvasColor,
8964 backgroundImage,
8965 exportWithBackgroundImage,
8966 preserveBackgroundImageAspectRatio,
8967 allowOnlyPointerType,
8968 style,
8969 svgStyle,
8970 paths: currentPaths,
8971 isDrawing,
8972 onPointerDown: function handlePointerDown(point) {
8973 setIsDrawing(true);
8974 setUndoStack([]);
8975 var stroke = {
8976 drawMode,
8977 strokeColor: drawMode ? strokeColor : "#000000",
8978 strokeWidth: drawMode ? strokeWidth : eraserWidth,
8979 paths: [point]
8980 };
8981 if (withTimestamp) stroke = _extends({}, stroke, {
8982 startTimestamp: Date.now(),
8983 endTimestamp: 0
8984 });
8985 setCurrentPaths(function(currentPaths) {
8986 return [].concat(currentPaths, [stroke]);
8987 });
8988 },
8989 onPointerMove: function handlePointerMove(point) {
8990 if (!isDrawing) return;
8991 var currentStroke = currentPaths.slice(-1)[0];
8992 var updatedStroke = _extends({}, currentStroke, { paths: [].concat(currentStroke.paths, [point]) });
8993 setCurrentPaths(function(currentPaths) {
8994 return [].concat(currentPaths.slice(0, -1), [updatedStroke]);
8995 });
8996 },
8997 onPointerUp: function handlePointerUp() {
8998 var _currentPaths$slice$2;
8999 var _currentPaths$slice2;
9000 if (!isDrawing) return;
9001 setIsDrawing(false);
9002 if (!withTimestamp) return;
9003 var currentStroke = (_currentPaths$slice$2 = (_currentPaths$slice2 = currentPaths.slice(-1)) == null ? void 0 : _currentPaths$slice2[0]) != null ? _currentPaths$slice$2 : null;
9004 if (currentStroke === null) return;
9005 var updatedStroke = _extends({}, currentStroke, { endTimestamp: Date.now() });
9006 setCurrentPaths(function(currentPaths) {
9007 return [].concat(currentPaths.slice(0, -1), [updatedStroke]);
9008 });
9009 }
9010 });
9011 });
9012
9013 //#endregion
9014 //#region modules/ai/assets/js/editor/icons/undo-icon.js
9015 init_extends();
9016 var UndoIcon = react.default.forwardRef(function(props, ref) {
9017 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { d: "M9.53033 6.53033C9.82322 6.23744 9.82322 5.76256 9.53033 5.46967C9.23744 5.17678 8.76256 5.17678 8.46967 5.46967L4.46967 9.46967C4.39776 9.54158 4.34351 9.62445 4.30691 9.71291C4.27024 9.80134 4.25 9.89831 4.25 10C4.25 10.1017 4.27024 10.1987 4.30691 10.2871C4.34351 10.3755 4.39776 10.4584 4.46967 10.5303L8.46967 14.5303C8.76256 14.8232 9.23744 14.8232 9.53033 14.5303C9.82322 14.2374 9.82322 13.7626 9.53033 13.4697L6.81066 10.75H16C16.862 10.75 17.6886 11.0924 18.2981 11.7019C18.9076 12.3114 19.25 13.138 19.25 14C19.25 14.862 18.9076 15.6886 18.2981 16.2981C17.6886 16.9076 16.862 17.25 16 17.25H15C14.5858 17.25 14.25 17.5858 14.25 18C14.25 18.4142 14.5858 18.75 15 18.75H16C17.2598 18.75 18.468 18.2496 19.3588 17.3588C20.2496 16.468 20.75 15.2598 20.75 14C20.75 12.7402 20.2496 11.532 19.3588 10.6412C18.468 9.75044 17.2598 9.25 16 9.25H6.81066L9.53033 6.53033Z" }));
9018 });
9019
9020 //#endregion
9021 //#region modules/ai/assets/js/editor/icons/redo-icon.js
9022 init_extends();
9023 var RedoIcon = react.default.forwardRef(function(props, ref) {
9024 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { d: "M15.5303 5.46967C15.2374 5.17678 14.7626 5.17678 14.4697 5.46967C14.1768 5.76256 14.1768 6.23744 14.4697 6.53033L17.1893 9.25H8C6.74022 9.25 5.53204 9.75044 4.64124 10.6412C3.75044 11.532 3.25 12.7402 3.25 14C3.25 15.2598 3.75044 16.468 4.64124 17.3588C5.53204 18.2496 6.74022 18.75 8 18.75H9C9.41421 18.75 9.75 18.4142 9.75 18C9.75 17.5858 9.41421 17.25 9 17.25H8C7.13805 17.25 6.3114 16.9076 5.7019 16.2981C5.09241 15.6886 4.75 14.862 4.75 14C4.75 13.138 5.09241 12.3114 5.7019 11.7019C6.3114 11.0924 7.13805 10.75 8 10.75H17.1893L14.4697 13.4697C14.1768 13.7626 14.1768 14.2374 14.4697 14.5303C14.7626 14.8232 15.2374 14.8232 15.5303 14.5303L19.5303 10.5303C19.6768 10.3839 19.75 10.1919 19.75 10C19.75 9.89831 19.7298 9.80134 19.6931 9.71291C19.6565 9.62445 19.6022 9.54158 19.5303 9.46967L15.5303 5.46967Z" }));
9025 });
9026
9027 //#endregion
9028 //#region modules/ai/assets/js/editor/pages/form-media/views/in-painting/in-painting-content.js
9029 init_asyncToGenerator();
9030 init_slicedToArray();
9031 var STROKE_SELECT_WIDTH$1 = 120;
9032 var BRUSH_COLOR$1 = "rgba(255, 255, 255)";
9033 var CANVAS_COLOR$1 = "rgba(0, 0, 0)";
9034 var StyledUndoIcon$1 = (0, _elementor_ui.withDirection)(UndoIcon);
9035 var StyledRedoIcon$1 = (0, _elementor_ui.withDirection)(RedoIcon);
9036 var BrushCursor$1 = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) {
9037 return "size" === prop;
9038 } })(function(_ref) {
9039 var theme = _ref.theme;
9040 var size = _ref.size;
9041 return {
9042 position: "absolute",
9043 width: size,
9044 height: size,
9045 borderRadius: "50%",
9046 backgroundColor: BRUSH_COLOR$1,
9047 pointerEvents: "none",
9048 transform: "translate(".concat("rtl" === theme.direction ? "50%" : "-50%", ", -50%)"),
9049 border: "1px solid #fff"
9050 };
9051 });
9052 var BrishSizeIcon$1 = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) {
9053 return "size" === prop;
9054 } })(function(_ref2) {
9055 var theme = _ref2.theme;
9056 var size = _ref2.size;
9057 return {
9058 width: size / 2,
9059 height: size / 2,
9060 borderRadius: "50%",
9061 backgroundColor: theme.palette.secondary.main
9062 };
9063 });
9064 var InPaintingContent = function InPaintingContent(_ref3) {
9065 var editImage = _ref3.editImage;
9066 var setMask = _ref3.setMask;
9067 var setIsCanvasChanged = _ref3.setIsCanvasChanged;
9068 var canvasWidth = _ref3.width;
9069 var canvasHeight = _ref3.height;
9070 var sketchRef = (0, react.useRef)();
9071 var _useState2 = _slicedToArray((0, react.useState)(30), 2);
9072 var stroke = _useState2[0];
9073 var setStroke = _useState2[1];
9074 var brushCursorRef = (0, react.useRef)();
9075 (0, react.useEffect)(function() {
9076 var canvas = document.querySelector(".eui-in-painting-canvas");
9077 var positionElement = function positionElement(e) {
9078 var _canvas$getBoundingCl = canvas.getBoundingClientRect();
9079 var left = _canvas$getBoundingCl.left;
9080 var top = _canvas$getBoundingCl.top;
9081 var width = _canvas$getBoundingCl.width;
9082 var height = _canvas$getBoundingCl.height;
9083 var x = e.clientX - left;
9084 var y = e.clientY - top;
9085 if (x > 0 && x < width && y > 0 && y < height) {
9086 brushCursorRef.current.style.left = "".concat(x, "px");
9087 brushCursorRef.current.style.top = "".concat(y, "px");
9088 }
9089 };
9090 window.addEventListener("mousemove", positionElement);
9091 return function() {
9092 window.removeEventListener("mousemove", positionElement);
9093 };
9094 }, [stroke]);
9095 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
9096 alignItems: "flex-start",
9097 spacing: .5,
9098 flexGrow: 1
9099 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
9100 width: "100%",
9101 direction: "row",
9102 spacing: 3,
9103 alignSelf: "center",
9104 justifyContent: "center",
9105 sx: { marginBottom: "20px !important" }
9106 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
9107 direction: "row",
9108 gap: 1
9109 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Undo", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
9110 variant: "outlined",
9111 color: "secondary",
9112 onClick: function onClick() {
9113 return sketchRef.current.undo();
9114 },
9115 sx: { px: 0 }
9116 }, /*#__PURE__*/ react.default.createElement(StyledUndoIcon$1, null))), /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Redo", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
9117 variant: "outlined",
9118 color: "secondary",
9119 onClick: function onClick() {
9120 return sketchRef.current.redo();
9121 },
9122 sx: { px: 0 }
9123 }, /*#__PURE__*/ react.default.createElement(StyledRedoIcon$1, null)))), /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, {
9124 size: "small",
9125 color: "secondary",
9126 sx: { minWidth: STROKE_SELECT_WIDTH$1 }
9127 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.InputLabel, { id: "stroke" }, "Stroke"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Select, {
9128 autoWidth: true,
9129 label: "Stroke",
9130 value: stroke,
9131 id: "demo-simple-select",
9132 labelId: "demo-simple-select-label",
9133 onChange: function onChange(e) {
9134 return setStroke(e.target.value);
9135 },
9136 MenuProps: {
9137 PaperProps: { sx: { maxWidth: STROKE_SELECT_WIDTH$1 } },
9138 MenuListProps: { sx: { minWidth: STROKE_SELECT_WIDTH$1 } }
9139 },
9140 sx: { "& .MuiSelect-select .MuiListItemIcon-root": {
9141 mr: .25,
9142 width: "initial",
9143 minWidth: "initial",
9144 justifyContent: "flex-start"
9145 } }
9146 }, [
9147 10,
9148 20,
9149 30,
9150 40,
9151 50
9152 ].map(function(value) {
9153 return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, {
9154 key: "stroke-width-option-" + value,
9155 value
9156 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
9157 direction: "row",
9158 alignItems: "center",
9159 gap: 1
9160 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, { sx: {
9161 width: 30,
9162 display: "flex",
9163 justifyContent: "center"
9164 } }, /*#__PURE__*/ react.default.createElement(BrishSizeIcon$1, { size: value })), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, null, value)));
9165 })))), /*#__PURE__*/ react.default.createElement("div", { style: {
9166 margin: "0 auto",
9167 position: "relative",
9168 cursor: "none",
9169 overflow: "hidden"
9170 } }, /*#__PURE__*/ react.default.createElement(BrushCursor$1, {
9171 ref: brushCursorRef,
9172 size: stroke
9173 }), /*#__PURE__*/ react.default.createElement(ReactSketchCanvas, {
9174 className: "eui-in-painting-canvas",
9175 withViewBox: true,
9176 ref: sketchRef,
9177 height: canvasHeight + "px",
9178 width: canvasWidth + "px",
9179 strokeWidth: stroke,
9180 strokeColor: BRUSH_COLOR$1,
9181 canvasColor: CANVAS_COLOR$1,
9182 backgroundImage: editImage.url,
9183 onStroke: function onStroke() {
9184 return setIsCanvasChanged(true);
9185 },
9186 onChange: /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
9187 var svg;
9188 return import_regenerator$2.default.wrap(function(_context) {
9189 while (1) switch (_context.prev = _context.next) {
9190 case 0:
9191 _context.next = 1;
9192 return sketchRef.current.exportSvg();
9193 case 1:
9194 svg = _context.sent;
9195 setMask(svg);
9196 case 2:
9197 case "end": return _context.stop();
9198 }
9199 }, _callee);
9200 }))
9201 })));
9202 };
9203 InPaintingContent.propTypes = {
9204 setMask: import_prop_types$8.default.func.isRequired,
9205 setIsCanvasChanged: import_prop_types$8.default.func.isRequired,
9206 width: import_prop_types$8.default.number.isRequired,
9207 height: import_prop_types$8.default.number.isRequired,
9208 editImage: import_prop_types$8.default.object.isRequired
9209 };
9210
9211 //#endregion
9212 //#region modules/ai/assets/js/editor/pages/form-media/views/in-painting/hooks/use-in-painting.js
9213 init_api();
9214 var useInPainting = function useInPainting(initialValue) {
9215 return useImagePrompt(function fetchAction(payload) {
9216 return getImageToImageMaskGeneration(payload);
9217 }, initialValue);
9218 };
9219
9220 //#endregion
9221 //#region modules/ai/assets/js/editor/pages/form-media/views/in-painting/index.js
9222 init_asyncToGenerator();
9223 init_slicedToArray();
9224 init_requests_ids();
9225 var InPainting = function InPainting() {
9226 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
9227 var prompt = _useState2[0];
9228 var setPrompt = _useState2[1];
9229 var setGenerate = useRequestIds().setGenerate;
9230 var _useState4 = _slicedToArray((0, react.useState)(""), 2);
9231 var mask = _useState4[0];
9232 var setMask = _useState4[1];
9233 var _useState6 = _slicedToArray((0, react.useState)(false), 2);
9234 var isCanvasChanged = _useState6[0];
9235 var setIsCanvasChanged = _useState6[1];
9236 var _usePromptSettings = usePromptSettings();
9237 var settings = _usePromptSettings.settings;
9238 var resetSettings = _usePromptSettings.resetSettings;
9239 var _useEditImage = useEditImage();
9240 var editImage = _useEditImage.editImage;
9241 var width = _useEditImage.width;
9242 var height = _useEditImage.height;
9243 var _useImageActions = useImageActions();
9244 var use = _useImageActions.use;
9245 var edit = _useImageActions.edit;
9246 var isUploading = _useImageActions.isLoading;
9247 var _useInPainting = useInPainting();
9248 var data = _useInPainting.data;
9249 var send = _useInPainting.send;
9250 var isGenerating = _useInPainting.isLoading;
9251 var error = _useInPainting.error;
9252 var reset = _useInPainting.reset;
9253 var isLoading = isGenerating || isUploading;
9254 var handleSubmit = /*#__PURE__*/ function() {
9255 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) {
9256 var finalPrompt;
9257 return import_regenerator$2.default.wrap(function(_context) {
9258 while (1) switch (_context.prev = _context.next) {
9259 case 0:
9260 event.preventDefault();
9261 finalPrompt = prompt || "Remove object and fill based on the surroundings";
9262 setGenerate();
9263 send({
9264 prompt: finalPrompt,
9265 settings,
9266 image: editImage,
9267 mask
9268 });
9269 case 1:
9270 case "end": return _context.stop();
9271 }
9272 }, _callee);
9273 }));
9274 return function handleSubmit(_x) {
9275 return _ref.apply(this, arguments);
9276 };
9277 }();
9278 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
9279 primary: (0, _wordpress_i18n.__)("Generative Fill", "elementor"),
9280 secondary: (0, _wordpress_i18n.__)("Mark an area and edit it with a prompt.", "elementor")
9281 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
9282 error,
9283 onRetry: handleSubmit
9284 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(PromptField, {
9285 value: prompt,
9286 disabled: isLoading,
9287 onChange: setPrompt,
9288 placeholder: (0, _wordpress_i18n.__)("Describe what you want to generate in the marked area (English only)", "elementor")
9289 }), data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
9290 gap: 2,
9291 sx: { my: 2.5 }
9292 }, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading }), /*#__PURE__*/ react.default.createElement(NewPromptButton, {
9293 disabled: isLoading,
9294 onClick: function onClick() {
9295 resetSettings();
9296 setPrompt("");
9297 reset();
9298 }
9299 })) : /*#__PURE__*/ react.default.createElement(GenerateSubmit, { disabled: isLoading || !prompt || !isCanvasChanged }))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
9300 images: data.result,
9301 aspectRatio: editImage.aspectRatio,
9302 onUseImage: use,
9303 onEditImage: edit
9304 }) : /*#__PURE__*/ react.default.createElement(InPaintingContent, {
9305 editImage,
9306 width,
9307 height,
9308 setMask,
9309 setIsCanvasChanged
9310 })));
9311 };
9312
9313 //#endregion
9314 //#region node_modules/react-avatar-editor/dist/index.js
9315 var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9316 (function(e, t) {
9317 "object" == typeof exports && "undefined" != typeof module ? module.exports = t(require_prop_types(), (globalThis.React)) : "function" == typeof define && define.amd ? define(["prop-types", "react"], t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).AvatarEditor = t(e.PropTypes, e.React);
9318 })(exports, function(e, t) {
9319 "use strict";
9320 function o(e) {
9321 return e && "object" == typeof e && "default" in e ? e : { default: e };
9322 }
9323 var n = o(e);
9324 var i = o(t);
9325 function r(e, t) {
9326 for (var o = 0; o < t.length; o++) {
9327 var n = t[o];
9328 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
9329 }
9330 }
9331 function s(e, t, o) {
9332 return t in e ? Object.defineProperty(e, t, {
9333 value: o,
9334 enumerable: !0,
9335 configurable: !0,
9336 writable: !0
9337 }) : e[t] = o, e;
9338 }
9339 function u() {
9340 return (u = Object.assign || function(e) {
9341 for (var t = 1; t < arguments.length; t++) {
9342 var o = arguments[t];
9343 for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && (e[n] = o[n]);
9344 }
9345 return e;
9346 }).apply(this, arguments);
9347 }
9348 function a(t, e) {
9349 var o;
9350 var n = Object.keys(t);
9351 return Object.getOwnPropertySymbols && (o = Object.getOwnPropertySymbols(t), e && (o = o.filter(function(e) {
9352 return Object.getOwnPropertyDescriptor(t, e).enumerable;
9353 })), n.push.apply(n, o)), n;
9354 }
9355 function y(t) {
9356 for (var e = 1; e < arguments.length; e++) {
9357 var o = null != arguments[e] ? arguments[e] : {};
9358 e % 2 ? a(Object(o), !0).forEach(function(e) {
9359 s(t, e, o[e]);
9360 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : a(Object(o)).forEach(function(e) {
9361 Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(o, e));
9362 });
9363 }
9364 return t;
9365 }
9366 function h(e) {
9367 return (h = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
9368 return e.__proto__ || Object.getPrototypeOf(e);
9369 })(e);
9370 }
9371 function c(e, t) {
9372 return (c = Object.setPrototypeOf || function(e, t) {
9373 return e.__proto__ = t, e;
9374 })(e, t);
9375 }
9376 function l(e, t) {
9377 if (null == e) return {};
9378 var o;
9379 var n = function(e, t) {
9380 if (null == e) return {};
9381 for (var o, n = {}, a = Object.keys(e), r = 0; r < a.length; r++) o = a[r], 0 <= t.indexOf(o) || (n[o] = e[o]);
9382 return n;
9383 }(e, t);
9384 if (Object.getOwnPropertySymbols) for (var a = Object.getOwnPropertySymbols(e), r = 0; r < a.length; r++) o = a[r], 0 <= t.indexOf(o) || Object.prototype.propertyIsEnumerable.call(e, o) && (n[o] = e[o]);
9385 return n;
9386 }
9387 function d(e) {
9388 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9389 return e;
9390 }
9391 function p(r) {
9392 var i = function() {
9393 if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
9394 if (Reflect.construct.sham) return !1;
9395 if ("function" == typeof Proxy) return !0;
9396 try {
9397 return Date.prototype.toString.call(Reflect.construct(Date, [], function() {})), !0;
9398 } catch (e) {
9399 return !1;
9400 }
9401 }();
9402 return function() {
9403 var e;
9404 var t;
9405 var o;
9406 var n;
9407 var a = h(r);
9408 return t = i ? (e = h(this).constructor, Reflect.construct(a, arguments, e)) : a.apply(this, arguments), o = this, !(n = t) || "object" != typeof n && "function" != typeof n ? d(o) : n;
9409 };
9410 }
9411 function m(e, t) {
9412 return function(e) {
9413 if (Array.isArray(e)) return e;
9414 }(e) || function(e, t) {
9415 if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(e))) return;
9416 var o = [];
9417 var n = !0;
9418 var a = !1;
9419 var r = void 0;
9420 try {
9421 for (var i, s = e[Symbol.iterator](); !(n = (i = s.next()).done) && (o.push(i.value), !t || o.length !== t); n = !0);
9422 } catch (e) {
9423 a = !0, r = e;
9424 } finally {
9425 try {
9426 n || null == s.return || s.return();
9427 } finally {
9428 if (a) throw r;
9429 }
9430 }
9431 return o;
9432 }(e, t) || g(e, t) || function() {
9433 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9434 }();
9435 }
9436 function g(e, t) {
9437 if (e) {
9438 if ("string" == typeof e) return f(e, t);
9439 var o = Object.prototype.toString.call(e).slice(8, -1);
9440 return "Object" === o && e.constructor && (o = e.constructor.name), "Map" === o || "Set" === o ? Array.from(e) : "Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o) ? f(e, t) : void 0;
9441 }
9442 }
9443 function f(e, t) {
9444 (null == t || t > e.length) && (t = e.length);
9445 for (var o = 0, n = new Array(t); o < t; o++) n[o] = e[o];
9446 return n;
9447 }
9448 function v(a, r) {
9449 return new Promise(function(e, t) {
9450 var o;
9451 var n = new Image();
9452 n.onload = function() {
9453 return e(n);
9454 }, n.onerror = t, !1 == (null !== (o = a) && !!o.match(/^\s*data:([a-z]+\/[a-z]+(;[a-z-]+=[a-z-]+)?)?(;base64)?,[a-z0-9!$&',()*+;=\-._~:@/?%\s]*\s*$/i)) && r && (n.crossOrigin = r), n.src = a;
9455 });
9456 }
9457 var b;
9458 var w = !("undefined" == typeof window || "undefined" == typeof navigator || !("ontouchstart" in window || 0 < navigator.msMaxTouchPoints));
9459 var M = "undefined" != typeof File;
9460 var O = {
9461 touch: {
9462 react: {
9463 down: "onTouchStart",
9464 mouseDown: "onMouseDown",
9465 drag: "onTouchMove",
9466 move: "onTouchMove",
9467 mouseMove: "onMouseMove",
9468 up: "onTouchEnd",
9469 mouseUp: "onMouseUp"
9470 },
9471 native: {
9472 down: "touchstart",
9473 mouseDown: "mousedown",
9474 drag: "touchmove",
9475 move: "touchmove",
9476 mouseMove: "mousemove",
9477 up: "touchend",
9478 mouseUp: "mouseup"
9479 }
9480 },
9481 desktop: {
9482 react: {
9483 down: "onMouseDown",
9484 drag: "onDragOver",
9485 move: "onMouseMove",
9486 up: "onMouseUp"
9487 },
9488 native: {
9489 down: "mousedown",
9490 drag: "dragStart",
9491 move: "mousemove",
9492 up: "mouseup"
9493 }
9494 }
9495 };
9496 var I = w ? O.touch : O.desktop;
9497 var P = "undefined" != typeof window && window.devicePixelRatio ? window.devicePixelRatio : 1;
9498 var C = {
9499 x: .5,
9500 y: .5
9501 };
9502 var x = function() {
9503 (function(e, t) {
9504 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
9505 e.prototype = Object.create(t && t.prototype, { constructor: {
9506 value: e,
9507 writable: !0,
9508 configurable: !0
9509 } }), t && c(e, t);
9510 })(a, i["default"].Component);
9511 var e;
9512 var t;
9513 var o;
9514 var n = p(a);
9515 function a(e) {
9516 var v;
9517 return function(e, t) {
9518 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
9519 }(this, a), s(d(v = n.call(this, e)), "state", {
9520 drag: !1,
9521 my: null,
9522 mx: null,
9523 image: C
9524 }), s(d(v), "handleImageReady", function(e) {
9525 var t = v.getInitialSize(e.width, e.height);
9526 t.resource = e, t.x = .5, t.y = .5, t.backgroundColor = v.props.backgroundColor, v.setState({
9527 drag: !1,
9528 image: t
9529 }, v.props.onImageReady), v.props.onLoadSuccess(t);
9530 }), s(d(v), "clearImage", function() {
9531 v.canvas.getContext("2d").clearRect(0, 0, v.canvas.width, v.canvas.height), v.setState({ image: C });
9532 }), s(d(v), "handleMouseDown", function(e) {
9533 (e = e || window.event).preventDefault(), v.setState({
9534 drag: !0,
9535 mx: null,
9536 my: null
9537 });
9538 }), s(d(v), "handleMouseUp", function() {
9539 v.state.drag && (v.setState({ drag: !1 }), v.props.onMouseUp());
9540 }), s(d(v), "handleMouseMove", function(e) {
9541 var t;
9542 var o;
9543 var n;
9544 var a;
9545 var r;
9546 var i;
9547 var s;
9548 var u;
9549 var h;
9550 var c;
9551 var l;
9552 var d;
9553 var p;
9554 var g;
9555 var f;
9556 var m;
9557 e = e || window.event, !1 !== v.state.drag && (e.preventDefault(), n = {
9558 mx: t = e.targetTouches ? e.targetTouches[0].pageX : e.clientX,
9559 my: o = e.targetTouches ? e.targetTouches[0].pageY : e.clientY
9560 }, m = v.props.rotate, m = (m %= 360) < 0 ? m + 360 : m, v.state.mx && v.state.my && (a = v.state.mx - t, r = v.state.my - o, i = v.state.image.width * v.props.scale, s = v.state.image.height * v.props.scale, h = (u = v.getCroppingRect()).x, c = u.y, h *= i, c *= s, l = function(e) {
9561 return e * (Math.PI / 180);
9562 }, d = Math.cos(l(m)), g = c + -a * (p = Math.sin(l(m))) + r * d, f = {
9563 x: (h + a * d + r * p) / i + 1 / v.props.scale * v.getXScale() / 2,
9564 y: g / s + 1 / v.props.scale * v.getYScale() / 2
9565 }, v.props.onPositionChange(f), n.image = y(y({}, v.state.image), f)), v.setState(n), v.props.onMouseMove(e));
9566 }), s(d(v), "setCanvas", function(e) {
9567 v.canvas = e;
9568 }), v.canvas = null, v;
9569 }
9570 return e = a, (t = [
9571 {
9572 key: "componentDidMount",
9573 value: function() {
9574 this.props.disableHiDPIScaling && (P = 1);
9575 var e;
9576 var t;
9577 var o = this.canvas.getContext("2d");
9578 this.props.image && this.loadImage(this.props.image), this.paint(o), document && (e = !!function() {
9579 var t = !1;
9580 try {
9581 var e = Object.defineProperty({}, "passive", { get: function() {
9582 t = !0;
9583 } });
9584 window.addEventListener("test", e, e), window.removeEventListener("test", e, e);
9585 } catch (e) {
9586 t = !1;
9587 }
9588 return t;
9589 }() && { passive: !1 }, t = I.native, document.addEventListener(t.move, this.handleMouseMove, e), document.addEventListener(t.up, this.handleMouseUp, e), w && (document.addEventListener(t.mouseMove, this.handleMouseMove, e), document.addEventListener(t.mouseUp, this.handleMouseUp, e)));
9590 }
9591 },
9592 {
9593 key: "componentDidUpdate",
9594 value: function(e, t) {
9595 this.props.image && this.props.image !== e.image || this.props.width !== e.width || this.props.height !== e.height || this.props.backgroundColor !== e.backgroundColor ? this.loadImage(this.props.image) : this.props.image || t.image === C || this.clearImage();
9596 var o = this.canvas.getContext("2d");
9597 o.clearRect(0, 0, this.canvas.width, this.canvas.height), this.paint(o), this.paintImage(o, this.state.image, this.props.border), e.image === this.props.image && e.width === this.props.width && e.height === this.props.height && e.position === this.props.position && e.scale === this.props.scale && e.rotate === this.props.rotate && t.my === this.state.my && t.mx === this.state.mx && t.image.x === this.state.image.x && t.image.y === this.state.image.y && t.backgroundColor === this.state.backgroundColor || this.props.onImageChange();
9598 }
9599 },
9600 {
9601 key: "componentWillUnmount",
9602 value: function() {
9603 var e;
9604 document && (e = I.native, document.removeEventListener(e.move, this.handleMouseMove, !1), document.removeEventListener(e.up, this.handleMouseUp, !1), w && (document.removeEventListener(e.mouseMove, this.handleMouseMove, !1), document.removeEventListener(e.mouseUp, this.handleMouseUp, !1)));
9605 }
9606 },
9607 {
9608 key: "isVertical",
9609 value: function() {
9610 return !this.props.disableCanvasRotation && this.props.rotate % 180 != 0;
9611 }
9612 },
9613 {
9614 key: "getBorders",
9615 value: function(e) {
9616 var t = 0 < arguments.length && void 0 !== e ? e : this.props.border;
9617 return Array.isArray(t) ? t : [t, t];
9618 }
9619 },
9620 {
9621 key: "getDimensions",
9622 value: function() {
9623 var e = this.props;
9624 var t = e.width;
9625 var o = e.height;
9626 var n = e.rotate;
9627 var a = e.border;
9628 var r = {};
9629 var i = m(this.getBorders(a), 2);
9630 var s = i[0];
9631 var u = i[1];
9632 var h = t;
9633 var c = o;
9634 return this.isVertical() ? (r.width = c, r.height = h) : (r.width = h, r.height = c), r.width += 2 * s, r.height += 2 * u, {
9635 canvas: r,
9636 rotate: n,
9637 width: t,
9638 height: o,
9639 border: a
9640 };
9641 }
9642 },
9643 {
9644 key: "getImage",
9645 value: function() {
9646 var e = this.getCroppingRect();
9647 var t = this.state.image;
9648 e.x *= t.resource.width, e.y *= t.resource.height, e.width *= t.resource.width, e.height *= t.resource.height;
9649 var o = document.createElement("canvas");
9650 this.isVertical() ? (o.width = e.height, o.height = e.width) : (o.width = e.width, o.height = e.height);
9651 var n = o.getContext("2d");
9652 return n.translate(o.width / 2, o.height / 2), n.rotate(this.props.rotate * Math.PI / 180), n.translate(-o.width / 2, -o.height / 2), this.isVertical() && n.translate((o.width - o.height) / 2, (o.height - o.width) / 2), t.backgroundColor && (n.fillStyle = t.backgroundColor, n.fillRect(-e.x, -e.y, t.resource.width, t.resource.height)), n.drawImage(t.resource, -e.x, -e.y), o;
9653 }
9654 },
9655 {
9656 key: "getImageScaledToCanvas",
9657 value: function() {
9658 var e = this.getDimensions();
9659 var t = e.width;
9660 var o = e.height;
9661 var n = document.createElement("canvas");
9662 return this.isVertical() ? (n.width = o, n.height = t) : (n.width = t, n.height = o), this.paintImage(n.getContext("2d"), this.state.image, 0, 1), n;
9663 }
9664 },
9665 {
9666 key: "getXScale",
9667 value: function() {
9668 var e = this.props.width / this.props.height;
9669 var t = this.state.image.width / this.state.image.height;
9670 return Math.min(1, e / t);
9671 }
9672 },
9673 {
9674 key: "getYScale",
9675 value: function() {
9676 var e = this.props.height / this.props.width;
9677 var t = this.state.image.height / this.state.image.width;
9678 return Math.min(1, e / t);
9679 }
9680 },
9681 {
9682 key: "getCroppingRect",
9683 value: function() {
9684 var e = this.props.position || {
9685 x: this.state.image.x,
9686 y: this.state.image.y
9687 };
9688 var t = 1 / this.props.scale * this.getXScale();
9689 var o = 1 / this.props.scale * this.getYScale();
9690 var n = {
9691 x: e.x - t / 2,
9692 y: e.y - o / 2,
9693 width: t,
9694 height: o
9695 };
9696 var a = 0;
9697 var r = 1 - n.width;
9698 var i = 0;
9699 var s = 1 - n.height;
9700 return (this.props.disableBoundaryChecks || 1 < t || 1 < o) && (a = -n.width, i = -n.height, s = r = 1), y(y({}, n), {}, {
9701 x: Math.max(a, Math.min(n.x, r)),
9702 y: Math.max(i, Math.min(n.y, s))
9703 });
9704 }
9705 },
9706 {
9707 key: "loadImage",
9708 value: function(e) {
9709 var t;
9710 M && e instanceof File ? this.loadingImage = (t = e, new Promise(function(o, n) {
9711 var e = new FileReader();
9712 e.onload = function(e) {
9713 try {
9714 o(v(e.target.result));
9715 } catch (e) {
9716 n(e);
9717 }
9718 }, e.readAsDataURL(t);
9719 }).then(this.handleImageReady).catch(this.props.onLoadFailure)) : "string" == typeof e && (this.loadingImage = v(e, this.props.crossOrigin).then(this.handleImageReady).catch(this.props.onLoadFailure));
9720 }
9721 },
9722 {
9723 key: "getInitialSize",
9724 value: function(e, t) {
9725 var o;
9726 var n;
9727 var a = this.getDimensions();
9728 return t / e < a.height / a.width ? n = e * ((o = this.getDimensions().height) / t) : o = t * ((n = this.getDimensions().width) / e), {
9729 height: o,
9730 width: n
9731 };
9732 }
9733 },
9734 {
9735 key: "paintImage",
9736 value: function(e, t, o, n) {
9737 var a;
9738 var r = 3 < arguments.length && void 0 !== n ? n : P;
9739 t.resource && (a = this.calculatePosition(t, o), e.save(), e.translate(e.canvas.width / 2, e.canvas.height / 2), e.rotate(this.props.rotate * Math.PI / 180), e.translate(-e.canvas.width / 2, -e.canvas.height / 2), this.isVertical() && e.translate((e.canvas.width - e.canvas.height) / 2, (e.canvas.height - e.canvas.width) / 2), e.scale(r, r), e.globalCompositeOperation = "destination-over", e.drawImage(t.resource, a.x, a.y, a.width, a.height), t.backgroundColor && (e.fillStyle = t.backgroundColor, e.fillRect(a.x, a.y, a.width, a.height)), e.restore());
9740 }
9741 },
9742 {
9743 key: "calculatePosition",
9744 value: function(e, t) {
9745 e = e || this.state.image;
9746 var o = m(this.getBorders(t), 2);
9747 var n = o[0];
9748 var a = o[1];
9749 var r = this.getCroppingRect();
9750 var i = e.width * this.props.scale;
9751 var s = e.height * this.props.scale;
9752 var u = -r.x * i;
9753 var h = -r.y * s;
9754 return this.isVertical() ? (u += a, h += n) : (u += n, h += a), {
9755 x: u,
9756 y: h,
9757 height: s,
9758 width: i
9759 };
9760 }
9761 },
9762 {
9763 key: "paint",
9764 value: function(e) {
9765 e.save(), e.scale(P, P), e.translate(0, 0), e.fillStyle = "rgba(" + this.props.color.slice(0, 4).join(",") + ")";
9766 var t;
9767 var o;
9768 var n;
9769 var a;
9770 var r;
9771 var i;
9772 var s;
9773 var u;
9774 var h = this.props.borderRadius;
9775 var c = this.getDimensions();
9776 var l = m(this.getBorders(c.border), 2);
9777 var d = l[0];
9778 var p = l[1];
9779 var g = c.canvas.height;
9780 var f = c.canvas.width;
9781 var h = Math.max(h, 0);
9782 h = Math.min(h, f / 2 - d, g / 2 - p), e.beginPath(), t = e, a = f - 2 * (o = d), r = g - 2 * (n = p), 0 === (i = h) ? t.rect(o, n, a, r) : (s = a - i, u = r - i, t.translate(o, n), t.arc(i, i, i, Math.PI, 1.5 * Math.PI), t.lineTo(s, 0), t.arc(s, i, i, 1.5 * Math.PI, 2 * Math.PI), t.lineTo(a, u), t.arc(s, u, i, 2 * Math.PI, .5 * Math.PI), t.lineTo(i, r), t.arc(i, u, i, .5 * Math.PI, Math.PI), t.translate(-o, -n)), e.rect(f, 0, -f, g), e.fill("evenodd"), e.restore();
9783 }
9784 },
9785 {
9786 key: "render",
9787 value: function() {
9788 var e = this.props;
9789 var t = (e.scale, e.rotate, e.image, e.border, e.borderRadius, e.width, e.height, e.position, e.color, e.backgroundColor, e.style);
9790 var o = (e.crossOrigin, e.onLoadFailure, e.onLoadSuccess, e.onImageReady, e.onImageChange, e.onMouseUp, e.onMouseMove, e.onPositionChange, e.disableBoundaryChecks, e.disableHiDPIScaling, e.disableCanvasRotation, l(e, [
9791 "scale",
9792 "rotate",
9793 "image",
9794 "border",
9795 "borderRadius",
9796 "width",
9797 "height",
9798 "position",
9799 "color",
9800 "backgroundColor",
9801 "style",
9802 "crossOrigin",
9803 "onLoadFailure",
9804 "onLoadSuccess",
9805 "onImageReady",
9806 "onImageChange",
9807 "onMouseUp",
9808 "onMouseMove",
9809 "onPositionChange",
9810 "disableBoundaryChecks",
9811 "disableHiDPIScaling",
9812 "disableCanvasRotation"
9813 ]));
9814 var n = this.getDimensions();
9815 var a = {
9816 width: n.canvas.width,
9817 height: n.canvas.height,
9818 cursor: this.state.drag ? "grabbing" : "grab",
9819 touchAction: "none"
9820 };
9821 var r = {
9822 width: n.canvas.width * P,
9823 height: n.canvas.height * P,
9824 style: y(y({}, a), t)
9825 };
9826 return r[I.react.down] = this.handleMouseDown, w && (r[I.react.mouseDown] = this.handleMouseDown), i.default.createElement("canvas", u({ ref: this.setCanvas }, r, o));
9827 }
9828 }
9829 ]) && r(e.prototype, t), o && r(e, o), a;
9830 }();
9831 return s(x, "propTypes", {
9832 scale: n.default.number,
9833 rotate: n.default.number,
9834 image: n.default.oneOfType([n.default.string].concat(function(e) {
9835 if (Array.isArray(e)) return f(e);
9836 }(b = M ? [n.default.instanceOf(File)] : []) || function(e) {
9837 if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e);
9838 }(b) || g(b) || function() {
9839 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9840 }())),
9841 border: n.default.oneOfType([n.default.number, n.default.arrayOf(n.default.number)]),
9842 borderRadius: n.default.number,
9843 width: n.default.number,
9844 height: n.default.number,
9845 position: n.default.shape({
9846 x: n.default.number,
9847 y: n.default.number
9848 }),
9849 color: n.default.arrayOf(n.default.number),
9850 backgroundColor: n.default.string,
9851 crossOrigin: n.default.oneOf([
9852 "",
9853 "anonymous",
9854 "use-credentials"
9855 ]),
9856 onLoadFailure: n.default.func,
9857 onLoadSuccess: n.default.func,
9858 onImageReady: n.default.func,
9859 onImageChange: n.default.func,
9860 onMouseUp: n.default.func,
9861 onMouseMove: n.default.func,
9862 onPositionChange: n.default.func,
9863 disableBoundaryChecks: n.default.bool,
9864 disableHiDPIScaling: n.default.bool,
9865 disableCanvasRotation: n.default.bool
9866 }), s(x, "defaultProps", {
9867 scale: 1,
9868 rotate: 0,
9869 border: 25,
9870 borderRadius: 0,
9871 width: 200,
9872 height: 200,
9873 color: [
9874 0,
9875 0,
9876 0,
9877 .5
9878 ],
9879 onLoadFailure: function() {},
9880 onLoadSuccess: function() {},
9881 onImageReady: function() {},
9882 onImageChange: function() {},
9883 onMouseUp: function() {},
9884 onMouseMove: function() {},
9885 onPositionChange: function() {},
9886 disableBoundaryChecks: !1,
9887 disableHiDPIScaling: !1,
9888 disableCanvasRotation: !0
9889 }), x;
9890 });
9891 }));
9892
9893 //#endregion
9894 //#region modules/ai/assets/js/editor/pages/form-media/views/out-painting/out-painting-content.js
9895 init_asyncToGenerator();
9896 var import_dist = /* @__PURE__ */ __toESM(require_dist());
9897 var OutPaintingContent = function OutPaintingContent(_ref) {
9898 var scale = _ref.scale;
9899 var setMask = _ref.setMask;
9900 var editImage = _ref.editImage;
9901 var aspectRatio = _ref.aspectRatio;
9902 var setImageSize = _ref.setImageSize;
9903 var setPosition = _ref.setPosition;
9904 var cropperRef = (0, react.useRef)();
9905 var position = (0, react.useRef)({
9906 x: .5,
9907 y: .5
9908 });
9909 var _useImageSize = useImageSize(aspectRatio);
9910 var width = _useImageSize.width;
9911 var height = _useImageSize.height;
9912 var imageSize = {
9913 width,
9914 height
9915 };
9916 var updateMask = /*#__PURE__*/ function() {
9917 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
9918 var imageDataURL;
9919 return import_regenerator$2.default.wrap(function(_context) {
9920 while (1) switch (_context.prev = _context.next) {
9921 case 0:
9922 _context.next = 1;
9923 return cropperRef.current.getImageScaledToCanvas().toDataURL();
9924 case 1:
9925 imageDataURL = _context.sent;
9926 setMask(imageDataURL);
9927 case 2:
9928 case "end": return _context.stop();
9929 }
9930 }, _callee);
9931 }));
9932 return function updateMask() {
9933 return _ref2.apply(this, arguments);
9934 };
9935 }();
9936 var _onPositionChange = /*#__PURE__*/ function() {
9937 var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2(args) {
9938 return import_regenerator$2.default.wrap(function(_context2) {
9939 while (1) switch (_context2.prev = _context2.next) {
9940 case 0:
9941 position.current = {
9942 x: args.x,
9943 y: args.y
9944 };
9945 _context2.next = 1;
9946 return updateMask();
9947 case 1: setPosition(position.current);
9948 case 2:
9949 case "end": return _context2.stop();
9950 }
9951 }, _callee2);
9952 }));
9953 return function onPositionChange(_x) {
9954 return _ref3.apply(this, arguments);
9955 };
9956 }();
9957 var onImageChange = /*#__PURE__*/ function() {
9958 var _ref4 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee3() {
9959 return import_regenerator$2.default.wrap(function(_context3) {
9960 while (1) switch (_context3.prev = _context3.next) {
9961 case 0:
9962 imageSize = {
9963 width: imageSize.width * scale,
9964 height: imageSize.height * scale
9965 };
9966 _context3.next = 1;
9967 return updateMask();
9968 case 1: setImageSize(imageSize);
9969 case 2:
9970 case "end": return _context3.stop();
9971 }
9972 }, _callee3);
9973 }));
9974 return function onImageChange() {
9975 return _ref4.apply(this, arguments);
9976 };
9977 }();
9978 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
9979 alignItems: "center",
9980 spacing: .5,
9981 flexGrow: 1
9982 }, /*#__PURE__*/ react.default.createElement(import_dist.default, {
9983 ref: cropperRef,
9984 image: editImage.url,
9985 style: {
9986 backgroundImage: "linear-gradient(45deg, #bbb 25%, transparent 25%), linear-gradient(-45deg, #bbb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #bbb 75%), linear-gradient(-45deg, transparent 75%, #bbb 75%)",
9987 backgroundSize: "20px 20px",
9988 backgroundPosition: "0 0, 0 10px, 10px -10px, -10px 0px",
9989 outline: "2px dashed #000",
9990 marginTop: "12px"
9991 },
9992 color: [
9993 0,
9994 0,
9995 0,
9996 .9
9997 ],
9998 rotate: 0,
9999 border: 0,
10000 allowZoomOut: true,
10001 backgroundColor: "transparent",
10002 showGrid: true,
10003 onImageChange,
10004 onPositionChange: function onPositionChange(args) {
10005 return _onPositionChange(args);
10006 },
10007 width,
10008 height,
10009 scale
10010 }));
10011 };
10012 OutPaintingContent.propTypes = {
10013 scale: import_prop_types$8.default.number.isRequired,
10014 setMask: import_prop_types$8.default.func.isRequired,
10015 editImage: import_prop_types$8.default.object.isRequired,
10016 aspectRatio: import_prop_types$8.default.string.isRequired,
10017 setImageSize: import_prop_types$8.default.func.isRequired,
10018 setPosition: import_prop_types$8.default.func.isRequired
10019 };
10020
10021 //#endregion
10022 //#region modules/ai/assets/js/editor/pages/form-media/views/out-painting/hooks/use-out-painting.js
10023 init_api();
10024 var useOutPainting = function useOutPainting(initialValue) {
10025 return useImagePrompt(function fetchAction(payload) {
10026 return getImageToImageOutPainting(payload);
10027 }, initialValue);
10028 };
10029
10030 //#endregion
10031 //#region modules/ai/assets/js/editor/pages/form-media/views/out-painting/index.js
10032 init_defineProperty$1();
10033 init_asyncToGenerator();
10034 init_slicedToArray();
10035 init_requests_ids();
10036 var OutPainting = function OutPainting() {
10037 var _useState2 = _slicedToArray((0, react.useState)({
10038 width: 0,
10039 height: 0
10040 }), 2);
10041 var imageSize = _useState2[0];
10042 var setImageSize = _useState2[1];
10043 var _useState4 = _slicedToArray((0, react.useState)({
10044 x: .5,
10045 y: .5
10046 }), 2);
10047 var position = _useState4[0];
10048 var setPosition = _useState4[1];
10049 var _useState6 = _slicedToArray((0, react.useState)(""), 2);
10050 var mask = _useState6[0];
10051 var setMask = _useState6[1];
10052 var setGenerate = useRequestIds().setGenerate;
10053 var _useEditImage = useEditImage();
10054 var editImage = _useEditImage.editImage;
10055 var initialAspectRatio = _useEditImage.aspectRatio;
10056 var _usePromptSettings = usePromptSettings({ aspectRatio: initialAspectRatio });
10057 var settings = _usePromptSettings.settings;
10058 var updateSettings = _usePromptSettings.updateSettings;
10059 var _useImageActions = useImageActions();
10060 var use = _useImageActions.use;
10061 var edit = _useImageActions.edit;
10062 var isUploading = _useImageActions.isLoading;
10063 var _useOutPainting = useOutPainting();
10064 var data = _useOutPainting.data;
10065 var send = _useOutPainting.send;
10066 var isGenerating = _useOutPainting.isLoading;
10067 var error = _useOutPainting.error;
10068 var isLoading = isGenerating || isUploading;
10069 var generatedAspectRatio = (0, react.useMemo)(function() {
10070 return settings[IMAGE_RATIO];
10071 }, [data === null || data === void 0 ? void 0 : data.result]);
10072 var hasGeneratedResult = !!(data !== null && data !== void 0 && data.result);
10073 var handleSubmit = /*#__PURE__*/ function() {
10074 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) {
10075 var imageBase64;
10076 return import_regenerator$2.default.wrap(function(_context) {
10077 while (1) switch (_context.prev = _context.next) {
10078 case 0:
10079 event.preventDefault();
10080 setGenerate();
10081 _context.next = 1;
10082 return fetchImageAsBase64(editImage.url);
10083 case 1:
10084 imageBase64 = _context.sent;
10085 send({
10086 settings,
10087 image: editImage,
10088 mask,
10089 size: imageSize,
10090 position,
10091 image_base64: imageBase64
10092 });
10093 case 2:
10094 case "end": return _context.stop();
10095 }
10096 }, _callee);
10097 }));
10098 return function handleSubmit(_x) {
10099 return _ref.apply(this, arguments);
10100 };
10101 }();
10102 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
10103 primary: (0, _wordpress_i18n.__)("Expand Image", "elementor"),
10104 secondary: (0, _wordpress_i18n.__)("Position image in it’s new size to generate content around the edges.", "elementor")
10105 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
10106 error,
10107 onRetry: handleSubmit
10108 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(ImageRatioSelect, {
10109 disabled: isLoading || hasGeneratedResult,
10110 value: settings[IMAGE_RATIO],
10111 onChange: function onChange(event) {
10112 return updateSettings(_defineProperty$1({}, IMAGE_RATIO, event.target.value));
10113 }
10114 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, { sx: {
10115 width: "100%",
10116 mb: 2.5
10117 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Slider, {
10118 marks: true,
10119 id: "zoom",
10120 name: "zoom",
10121 max: 1,
10122 min: .1,
10123 step: .1,
10124 color: "secondary",
10125 defaultValue: 1,
10126 disabled: isLoading || hasGeneratedResult,
10127 valueLabelDisplay: "auto",
10128 "aria-labelledby": "image-size-slider",
10129 "aria-label": (0, _wordpress_i18n.__)("Reference strength", "elementor"),
10130 onChange: function onChange(_, value) {
10131 return updateSettings(_defineProperty$1({}, IMAGE_ZOOM, value));
10132 }
10133 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
10134 id: "image-size-slider",
10135 variant: "caption",
10136 gutterBottom: true
10137 }, (0, _wordpress_i18n.__)("Original image size", "elementor"))), data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10138 gap: 2,
10139 sx: { my: 2.5 }
10140 }, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading })) : /*#__PURE__*/ react.default.createElement(GenerateSubmit, { disabled: isLoading }))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, hasGeneratedResult ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
10141 onUseImage: use,
10142 onEditImage: edit,
10143 images: data.result,
10144 aspectRatio: generatedAspectRatio
10145 }) : /*#__PURE__*/ react.default.createElement(OutPaintingContent, {
10146 setMask,
10147 editImage,
10148 scale: settings[IMAGE_ZOOM],
10149 aspectRatio: settings[IMAGE_RATIO],
10150 setImageSize,
10151 setPosition
10152 })));
10153 };
10154
10155 //#endregion
10156 //#region modules/ai/assets/js/editor/pages/form-media/views/variations/hooks/use-image-to-image.js
10157 init_api();
10158 var useImageToImage = function useImageToImage(initialValue) {
10159 return useImagePrompt(function fetchAction(payload) {
10160 return getImageToImageGeneration(payload);
10161 }, initialValue);
10162 };
10163
10164 //#endregion
10165 //#region modules/ai/assets/js/editor/pages/form-media/views/variations/index.js
10166 init_slicedToArray();
10167 init_requests_ids();
10168 var IMAGE_WEIGHT_DEFAULT = 45;
10169 var Variations = function Variations() {
10170 var _data$result;
10171 var prompt = _slicedToArray((0, react.useState)(""), 1)[0];
10172 var setGenerate = useRequestIds().setGenerate;
10173 var _useEditImage = useEditImage();
10174 var editImage = _useEditImage.editImage;
10175 var initialAspectRatio = _useEditImage.aspectRatio;
10176 var settings = usePromptSettings({
10177 aspectRatio: initialAspectRatio,
10178 imageWeight: IMAGE_WEIGHT_DEFAULT
10179 }).settings;
10180 var _useImageToImage = useImageToImage();
10181 var data = _useImageToImage.data;
10182 var send = _useImageToImage.send;
10183 var isGenerating = _useImageToImage.isLoading;
10184 var error = _useImageToImage.error;
10185 var _useImageActions = useImageActions();
10186 var use = _useImageActions.use;
10187 var edit = _useImageActions.edit;
10188 var isUploading = _useImageActions.isLoading;
10189 var isLoading = isGenerating || isUploading;
10190 var generatedAspectRatio = (0, react.useMemo)(function() {
10191 return settings[IMAGE_RATIO];
10192 }, [data === null || data === void 0 ? void 0 : data.result]);
10193 var handleSubmit = function handleSubmit(event) {
10194 event.preventDefault();
10195 setGenerate();
10196 send({
10197 prompt,
10198 settings,
10199 image: editImage
10200 });
10201 };
10202 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
10203 primary: (0, _wordpress_i18n.__)("Variations", "elementor"),
10204 secondary: (0, _wordpress_i18n.__)("Create new versions of the original image.", "elementor")
10205 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
10206 error,
10207 onRetry: handleSubmit
10208 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
10209 display: "flex",
10210 alignItems: "center",
10211 justifyContent: "center",
10212 bgcolor: "action.selected"
10213 } }, /*#__PURE__*/ react.default.createElement("img", {
10214 src: (editImage === null || editImage === void 0 ? void 0 : editImage.image_url) || (editImage === null || editImage === void 0 ? void 0 : editImage.url),
10215 alt: prompt,
10216 style: {
10217 width: "auto",
10218 height: "auto",
10219 maxWidth: "100%",
10220 maxHeight: 166,
10221 objectFit: "contained"
10222 }
10223 })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10224 gap: 2,
10225 sx: { my: 2.5 }
10226 }, (data === null || data === void 0 || (_data$result = data.result) === null || _data$result === void 0 ? void 0 : _data$result.length) > 0 ? /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading }) : /*#__PURE__*/ react.default.createElement(GenerateImagesSubmit, { disabled: isLoading })))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
10227 images: data.result,
10228 aspectRatio: generatedAspectRatio,
10229 onUseImage: use,
10230 onEditImage: edit
10231 }) : /*#__PURE__*/ react.default.createElement(ImagesPlaceholder, null)));
10232 };
10233 Variations.propTypes = {};
10234
10235 //#endregion
10236 //#region modules/ai/assets/js/editor/pages/form-media/views/replace-background/hooks/use-replace-background.js
10237 init_api();
10238 var useReplaceBackground = function useReplaceBackground(initialValue) {
10239 return useImagePrompt(function fetchAction(payload) {
10240 return getImageToImageReplaceBackground(payload);
10241 }, initialValue);
10242 };
10243
10244 //#endregion
10245 //#region modules/ai/assets/js/editor/pages/form-media/views/replace-background/index.js
10246 init_slicedToArray();
10247 init_requests_ids();
10248 var ReplaceBackground = function ReplaceBackground() {
10249 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
10250 var prompt = _useState2[0];
10251 var setPrompt = _useState2[1];
10252 var setGenerate = useRequestIds().setGenerate;
10253 var editImage = useEditImage().editImage;
10254 var _useImageActions = useImageActions();
10255 var use = _useImageActions.use;
10256 var edit = _useImageActions.edit;
10257 var isUploading = _useImageActions.isLoading;
10258 var _useReplaceBackground = useReplaceBackground();
10259 var data = _useReplaceBackground.data;
10260 var send = _useReplaceBackground.send;
10261 var isGenerating = _useReplaceBackground.isLoading;
10262 var error = _useReplaceBackground.error;
10263 var navigate = useLocation().navigate;
10264 var isLoading = isGenerating || isUploading;
10265 var handleSubmit = function handleSubmit(event) {
10266 event.preventDefault();
10267 setGenerate();
10268 send({
10269 prompt,
10270 image: editImage
10271 });
10272 };
10273 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
10274 primary: (0, _wordpress_i18n.__)("Replace Background", "elementor"),
10275 secondary: (0, _wordpress_i18n.__)("Generate a new background with a prompt.", "elementor")
10276 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
10277 error,
10278 onRetry: handleSubmit
10279 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(PromptField, {
10280 value: prompt,
10281 disabled: isLoading,
10282 onChange: setPrompt,
10283 placeholder: (0, _wordpress_i18n.__)("Describe what you want to generate in the background (English only)", "elementor")
10284 }), /*#__PURE__*/ react.default.createElement(GenerateSubmit, {
10285 disabled: isLoading || "" === prompt,
10286 color: data !== null && data !== void 0 && data.result ? "secondary" : "primary"
10287 }, data !== null && data !== void 0 && data.result ? (0, _wordpress_i18n.__)("Generate Again", "elementor") : (0, _wordpress_i18n.__)("Replace Background", "elementor")), (data === null || data === void 0 ? void 0 : data.result) && /*#__PURE__*/ react.default.createElement(NewPromptButton, {
10288 disabled: isLoading,
10289 onClick: function onClick() {
10290 return navigate(LOCATIONS.GENERATE);
10291 }
10292 }))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
10293 onUseImage: use,
10294 onEditImage: edit,
10295 images: data.result,
10296 aspectRatio: editImage.aspectRatio
10297 }) : /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, {
10298 src: editImage.url,
10299 alt: editImage.alt,
10300 style: {
10301 width: editImage.width,
10302 height: editImage.height
10303 }
10304 }))));
10305 };
10306
10307 //#endregion
10308 //#region modules/ai/assets/js/editor/pages/form-media/views/remove-background/hooks/use-remove-background.js
10309 init_api();
10310 var useRemoveBackground = function useRemoveBackground(initialValue) {
10311 return useImagePrompt(function fetchAction(payload) {
10312 return getImageToImageRemoveBackground(payload);
10313 }, initialValue);
10314 };
10315
10316 //#endregion
10317 //#region modules/ai/assets/js/editor/pages/form-media/views/remove-background/index.js
10318 init_requests_ids();
10319 var RemoveBackground = function RemoveBackground() {
10320 var editImage = useEditImage().editImage;
10321 var setGenerate = useRequestIds().setGenerate;
10322 var _useImageActions = useImageActions();
10323 var use = _useImageActions.use;
10324 var edit = _useImageActions.edit;
10325 var isUploading = _useImageActions.isLoading;
10326 var _useRemoveBackground = useRemoveBackground();
10327 var data = _useRemoveBackground.data;
10328 var send = _useRemoveBackground.send;
10329 var isGenerating = _useRemoveBackground.isLoading;
10330 var error = _useRemoveBackground.error;
10331 var navigate = useLocation().navigate;
10332 var isLoading = isGenerating || isUploading;
10333 var _useImageSize = useImageSize(editImage.aspectRatio);
10334 var width = _useImageSize.width;
10335 var height = _useImageSize.height;
10336 var handleSubmit = function handleSubmit(event) {
10337 event.preventDefault();
10338 setGenerate();
10339 send({ image: editImage });
10340 };
10341 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
10342 primary: (0, _wordpress_i18n.__)("Remove Background", "elementor"),
10343 secondary: (0, _wordpress_i18n.__)("Create an image of the subject with a transparent background", "elementor")
10344 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
10345 error,
10346 onRetry: handleSubmit
10347 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(NewPromptButton, {
10348 variant: "contained",
10349 disabled: isLoading,
10350 onClick: function onClick() {
10351 return navigate(LOCATIONS.GENERATE);
10352 }
10353 }) : /*#__PURE__*/ react.default.createElement(GenerateSubmit, { disabled: isLoading }, (0, _wordpress_i18n.__)("Remove Background", "elementor")))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
10354 transparentContainer: true,
10355 onUseImage: use,
10356 onEditImage: edit,
10357 images: data.result,
10358 aspectRatio: editImage.aspectRatio
10359 })) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, {
10360 src: editImage.url,
10361 alt: editImage.alt,
10362 style: {
10363 width,
10364 height
10365 }
10366 })))));
10367 };
10368
10369 //#endregion
10370 //#region modules/ai/assets/js/editor/pages/form-media/views/cleanup/cleanup-content.js
10371 init_asyncToGenerator();
10372 init_slicedToArray();
10373 var STROKE_SELECT_WIDTH = 120;
10374 var BRUSH_COLOR = "rgba(255, 255, 255)";
10375 var CANVAS_COLOR = "rgba(0, 0, 0)";
10376 var StyledUndoIcon = (0, _elementor_ui.withDirection)(UndoIcon);
10377 var StyledRedoIcon = (0, _elementor_ui.withDirection)(RedoIcon);
10378 var BrushCursor = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) {
10379 return "size" === prop;
10380 } })(function(_ref) {
10381 var theme = _ref.theme;
10382 var size = _ref.size;
10383 return {
10384 position: "absolute",
10385 width: size,
10386 height: size,
10387 borderRadius: "50%",
10388 backgroundColor: BRUSH_COLOR,
10389 pointerEvents: "none",
10390 transform: "translate(".concat("rtl" === theme.direction ? "50%" : "-50%", ", -50%)"),
10391 border: "1px solid #fff"
10392 };
10393 });
10394 var BrishSizeIcon = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) {
10395 return "size" === prop;
10396 } })(function(_ref2) {
10397 var theme = _ref2.theme;
10398 var size = _ref2.size;
10399 return {
10400 width: size / 2,
10401 height: size / 2,
10402 borderRadius: "50%",
10403 backgroundColor: theme.palette.secondary.main
10404 };
10405 });
10406 var CleanupContent = function CleanupContent(_ref3) {
10407 var editImage = _ref3.editImage;
10408 var setMask = _ref3.setMask;
10409 var setIsCanvasChanged = _ref3.setIsCanvasChanged;
10410 var canvasWidth = _ref3.width;
10411 var canvasHeight = _ref3.height;
10412 var sketchRef = (0, react.useRef)();
10413 var _useState2 = _slicedToArray((0, react.useState)(30), 2);
10414 var stroke = _useState2[0];
10415 var setStroke = _useState2[1];
10416 var brushCursorRef = (0, react.useRef)();
10417 (0, react.useEffect)(function() {
10418 var canvas = document.querySelector(".eui-in-painting-canvas");
10419 var positionElement = function positionElement(e) {
10420 var _canvas$getBoundingCl = canvas.getBoundingClientRect();
10421 var left = _canvas$getBoundingCl.left;
10422 var top = _canvas$getBoundingCl.top;
10423 var width = _canvas$getBoundingCl.width;
10424 var height = _canvas$getBoundingCl.height;
10425 var x = e.clientX - left;
10426 var y = e.clientY - top;
10427 if (x > 0 && x < width && y > 0 && y < height) {
10428 brushCursorRef.current.style.left = "".concat(x, "px");
10429 brushCursorRef.current.style.top = "".concat(y, "px");
10430 }
10431 };
10432 window.addEventListener("mousemove", positionElement);
10433 return function() {
10434 window.removeEventListener("mousemove", positionElement);
10435 };
10436 }, [stroke]);
10437 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10438 alignItems: "flex-start",
10439 spacing: .5,
10440 flexGrow: 1
10441 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10442 width: "100%",
10443 direction: "row",
10444 spacing: 3,
10445 alignSelf: "center",
10446 justifyContent: "center",
10447 sx: { mb: 2.5 }
10448 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10449 direction: "row",
10450 gap: 1
10451 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Undo", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
10452 variant: "outlined",
10453 color: "secondary",
10454 onClick: function onClick() {
10455 return sketchRef.current.undo();
10456 },
10457 sx: { px: 0 }
10458 }, /*#__PURE__*/ react.default.createElement(StyledUndoIcon, null))), /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Redo", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
10459 variant: "outlined",
10460 color: "secondary",
10461 onClick: function onClick() {
10462 return sketchRef.current.redo();
10463 },
10464 sx: { px: 0 }
10465 }, /*#__PURE__*/ react.default.createElement(StyledRedoIcon, null)))), /*#__PURE__*/ react.default.createElement(_elementor_ui.FormControl, {
10466 size: "small",
10467 color: "secondary",
10468 sx: { minWidth: STROKE_SELECT_WIDTH }
10469 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.InputLabel, { id: "stroke" }, "Stroke"), /*#__PURE__*/ react.default.createElement(_elementor_ui.Select, {
10470 autoWidth: true,
10471 label: "Stroke",
10472 value: stroke,
10473 id: "demo-simple-select",
10474 labelId: "demo-simple-select-label",
10475 onChange: function onChange(e) {
10476 return setStroke(e.target.value);
10477 },
10478 MenuProps: {
10479 PaperProps: { sx: { maxWidth: STROKE_SELECT_WIDTH } },
10480 MenuListProps: { sx: { minWidth: STROKE_SELECT_WIDTH } }
10481 },
10482 sx: { "& .MuiSelect-select .MuiListItemIcon-root": {
10483 mr: .25,
10484 width: "initial",
10485 minWidth: "initial",
10486 justifyContent: "flex-start"
10487 } }
10488 }, [
10489 10,
10490 20,
10491 30,
10492 40,
10493 50
10494 ].map(function(value) {
10495 return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, {
10496 key: "stroke-width-option-" + value,
10497 value
10498 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10499 direction: "row",
10500 alignItems: "center",
10501 gap: 1
10502 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, { sx: {
10503 width: 30,
10504 display: "flex",
10505 justifyContent: "center"
10506 } }, /*#__PURE__*/ react.default.createElement(BrishSizeIcon, { size: value })), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, null, value)));
10507 })))), /*#__PURE__*/ react.default.createElement("div", { style: {
10508 margin: "0 auto",
10509 position: "relative",
10510 cursor: "none",
10511 overflow: "hidden"
10512 } }, /*#__PURE__*/ react.default.createElement(BrushCursor, {
10513 ref: brushCursorRef,
10514 size: stroke
10515 }), /*#__PURE__*/ react.default.createElement(ReactSketchCanvas, {
10516 className: "eui-in-painting-canvas",
10517 withViewBox: true,
10518 ref: sketchRef,
10519 height: canvasHeight + "px",
10520 width: canvasWidth + "px",
10521 strokeWidth: stroke,
10522 strokeColor: BRUSH_COLOR,
10523 canvasColor: CANVAS_COLOR,
10524 backgroundImage: editImage.url,
10525 onStroke: function onStroke() {
10526 return setIsCanvasChanged(true);
10527 },
10528 onChange: /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
10529 var svg;
10530 return import_regenerator$2.default.wrap(function(_context) {
10531 while (1) switch (_context.prev = _context.next) {
10532 case 0:
10533 _context.next = 1;
10534 return sketchRef.current.exportSvg();
10535 case 1:
10536 svg = _context.sent;
10537 setMask(svg);
10538 case 2:
10539 case "end": return _context.stop();
10540 }
10541 }, _callee);
10542 }))
10543 })));
10544 };
10545 CleanupContent.propTypes = {
10546 setMask: import_prop_types$8.default.func.isRequired,
10547 setIsCanvasChanged: import_prop_types$8.default.func.isRequired,
10548 width: import_prop_types$8.default.number.isRequired,
10549 height: import_prop_types$8.default.number.isRequired,
10550 editImage: import_prop_types$8.default.object.isRequired
10551 };
10552
10553 //#endregion
10554 //#region modules/ai/assets/js/editor/pages/form-media/views/cleanup/hooks/use-cleanup.js
10555 init_api();
10556 var useCleanup = function useCleanup(initialValue) {
10557 return useImagePrompt(function fetchAction(payload) {
10558 return getImageToImageMaskCleanup(payload);
10559 }, initialValue);
10560 };
10561
10562 //#endregion
10563 //#region modules/ai/assets/js/editor/pages/form-media/views/cleanup/index.js
10564 init_asyncToGenerator();
10565 init_slicedToArray();
10566 init_requests_ids();
10567 var Cleanup = function Cleanup() {
10568 var setGenerate = useRequestIds().setGenerate;
10569 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
10570 var mask = _useState2[0];
10571 var setMask = _useState2[1];
10572 var _useState4 = _slicedToArray((0, react.useState)(false), 2);
10573 var isCanvasChanged = _useState4[0];
10574 var setIsCanvasChanged = _useState4[1];
10575 var _usePromptSettings = usePromptSettings();
10576 var settings = _usePromptSettings.settings;
10577 var resetSettings = _usePromptSettings.resetSettings;
10578 var _useEditImage = useEditImage();
10579 var editImage = _useEditImage.editImage;
10580 var width = _useEditImage.width;
10581 var height = _useEditImage.height;
10582 var _useImageActions = useImageActions();
10583 var use = _useImageActions.use;
10584 var edit = _useImageActions.edit;
10585 var isUploading = _useImageActions.isLoading;
10586 var _useCleanup = useCleanup();
10587 var data = _useCleanup.data;
10588 var send = _useCleanup.send;
10589 var isGenerating = _useCleanup.isLoading;
10590 var error = _useCleanup.error;
10591 var reset = _useCleanup.reset;
10592 var isLoading = isGenerating || isUploading;
10593 var handleSubmit = /*#__PURE__*/ function() {
10594 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) {
10595 return import_regenerator$2.default.wrap(function(_context) {
10596 while (1) switch (_context.prev = _context.next) {
10597 case 0:
10598 event.preventDefault();
10599 setGenerate();
10600 send({
10601 settings,
10602 image: editImage,
10603 mask
10604 });
10605 case 1:
10606 case "end": return _context.stop();
10607 }
10608 }, _callee);
10609 }));
10610 return function handleSubmit(_x) {
10611 return _ref.apply(this, arguments);
10612 };
10613 }();
10614 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
10615 primary: (0, _wordpress_i18n.__)("Cleanup", "elementor"),
10616 secondary: (0, _wordpress_i18n.__)("Remove unwanted area from your image.", "elementor")
10617 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
10618 error,
10619 onRetry: handleSubmit
10620 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
10621 gap: 2,
10622 sx: { my: 2.5 }
10623 }, /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading }), /*#__PURE__*/ react.default.createElement(NewPromptButton, {
10624 disabled: isLoading,
10625 onClick: function onClick() {
10626 resetSettings();
10627 reset();
10628 }
10629 })) : /*#__PURE__*/ react.default.createElement(GenerateSubmit, { disabled: isLoading || !isCanvasChanged }))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
10630 images: data.result,
10631 aspectRatio: editImage.aspectRatio,
10632 onUseImage: use,
10633 onEditImage: edit
10634 }) : /*#__PURE__*/ react.default.createElement(CleanupContent, {
10635 editImage,
10636 width,
10637 height,
10638 setMask,
10639 setIsCanvasChanged
10640 })));
10641 };
10642
10643 //#endregion
10644 //#region modules/ai/assets/js/editor/pages/form-media/views/generate/hooks/use-text-to-image.js
10645 init_api();
10646 var useTextToImage = function useTextToImage(initialValue) {
10647 return useImagePrompt(getTextToImageGeneration, initialValue);
10648 };
10649
10650 //#endregion
10651 //#region node_modules/react-colorful/dist/index.mjs
10652 function u() {
10653 return (u = Object.assign || function(e) {
10654 for (var r = 1; r < arguments.length; r++) {
10655 var t = arguments[r];
10656 for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
10657 }
10658 return e;
10659 }).apply(this, arguments);
10660 }
10661 function c(e, r) {
10662 if (null == e) return {};
10663 var t;
10664 var n;
10665 var o = {};
10666 var a = Object.keys(e);
10667 for (n = 0; n < a.length; n++) r.indexOf(t = a[n]) >= 0 || (o[t] = e[t]);
10668 return o;
10669 }
10670 function i(e) {
10671 var t = (0, react$1.useRef)(e);
10672 var n = (0, react$1.useRef)(function(e) {
10673 t.current && t.current(e);
10674 });
10675 return t.current = e, n.current;
10676 }
10677 var s = function(e, r, t) {
10678 return void 0 === r && (r = 0), void 0 === t && (t = 1), e > t ? t : e < r ? r : e;
10679 };
10680 var f = function(e) {
10681 return "touches" in e;
10682 };
10683 var v = function(e) {
10684 return e && e.ownerDocument.defaultView || self;
10685 };
10686 var d = function(e, r, t) {
10687 var n = e.getBoundingClientRect();
10688 var o = f(r) ? function(e, r) {
10689 for (var t = 0; t < e.length; t++) if (e[t].identifier === r) return e[t];
10690 return e[0];
10691 }(r.touches, t) : r;
10692 return {
10693 left: s((o.pageX - (n.left + v(e).pageXOffset)) / n.width),
10694 top: s((o.pageY - (n.top + v(e).pageYOffset)) / n.height)
10695 };
10696 };
10697 var h = function(e) {
10698 !f(e) && e.preventDefault();
10699 };
10700 var m$1 = react$1.default.memo(function(o) {
10701 var a = o.onMove;
10702 var l = o.onKey;
10703 var s = c(o, ["onMove", "onKey"]);
10704 var m = (0, react$1.useRef)(null);
10705 var g = i(a);
10706 var p = i(l);
10707 var b = (0, react$1.useRef)(null);
10708 var _ = (0, react$1.useRef)(!1);
10709 var x = (0, react$1.useMemo)(function() {
10710 var e = function(e) {
10711 h(e), (f(e) ? e.touches.length > 0 : e.buttons > 0) && m.current ? g(d(m.current, e, b.current)) : t(!1);
10712 };
10713 var r = function() {
10714 return t(!1);
10715 };
10716 function t(t) {
10717 var n = _.current;
10718 var o = v(m.current);
10719 var a = t ? o.addEventListener : o.removeEventListener;
10720 a(n ? "touchmove" : "mousemove", e), a(n ? "touchend" : "mouseup", r);
10721 }
10722 return [
10723 function(e) {
10724 var r = e.nativeEvent;
10725 var n = m.current;
10726 if (n && (h(r), !function(e, r) {
10727 return r && !f(e);
10728 }(r, _.current) && n)) {
10729 if (f(r)) {
10730 _.current = !0;
10731 var o = r.changedTouches || [];
10732 o.length && (b.current = o[0].identifier);
10733 }
10734 n.focus(), g(d(n, r, b.current)), t(!0);
10735 }
10736 },
10737 function(e) {
10738 var r = e.which || e.keyCode;
10739 r < 37 || r > 40 || (e.preventDefault(), p({
10740 left: 39 === r ? .05 : 37 === r ? -.05 : 0,
10741 top: 40 === r ? .05 : 38 === r ? -.05 : 0
10742 }));
10743 },
10744 t
10745 ];
10746 }, [p, g]);
10747 var C = x[0];
10748 var E = x[1];
10749 var H = x[2];
10750 return (0, react$1.useEffect)(function() {
10751 return H;
10752 }, [H]), react$1.default.createElement("div", u({}, s, {
10753 onTouchStart: C,
10754 onMouseDown: C,
10755 className: "react-colorful__interactive",
10756 ref: m,
10757 onKeyDown: E,
10758 tabIndex: 0,
10759 role: "slider"
10760 }));
10761 });
10762 var g = function(e) {
10763 return e.filter(Boolean).join(" ");
10764 };
10765 var p = function(r) {
10766 var t = r.color;
10767 var n = r.left;
10768 var o = r.top;
10769 var a = void 0 === o ? .5 : o;
10770 var l = g(["react-colorful__pointer", r.className]);
10771 return react$1.default.createElement("div", {
10772 className: l,
10773 style: {
10774 top: 100 * a + "%",
10775 left: 100 * n + "%"
10776 }
10777 }, react$1.default.createElement("div", {
10778 className: "react-colorful__pointer-fill",
10779 style: { backgroundColor: t }
10780 }));
10781 };
10782 var b = function(e, r, t) {
10783 return void 0 === r && (r = 0), void 0 === t && (t = Math.pow(10, r)), Math.round(t * e) / t;
10784 };
10785 var _ = {
10786 grad: .9,
10787 turn: 360,
10788 rad: 360 / (2 * Math.PI)
10789 };
10790 var x = function(e) {
10791 return L(C(e));
10792 };
10793 var C = function(e) {
10794 return "#" === e[0] && (e = e.substring(1)), e.length < 6 ? {
10795 r: parseInt(e[0] + e[0], 16),
10796 g: parseInt(e[1] + e[1], 16),
10797 b: parseInt(e[2] + e[2], 16),
10798 a: 4 === e.length ? b(parseInt(e[3] + e[3], 16) / 255, 2) : 1
10799 } : {
10800 r: parseInt(e.substring(0, 2), 16),
10801 g: parseInt(e.substring(2, 4), 16),
10802 b: parseInt(e.substring(4, 6), 16),
10803 a: 8 === e.length ? b(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
10804 };
10805 };
10806 var w = function(e) {
10807 return K(I(e));
10808 };
10809 var y = function(e) {
10810 var r = e.s;
10811 var t = e.v;
10812 var n = e.a;
10813 var o = (200 - r) * t / 100;
10814 return {
10815 h: b(e.h),
10816 s: b(o > 0 && o < 200 ? r * t / 100 / (o <= 100 ? o : 200 - o) * 100 : 0),
10817 l: b(o / 2),
10818 a: b(n, 2)
10819 };
10820 };
10821 var q = function(e) {
10822 var r = y(e);
10823 return "hsl(" + r.h + ", " + r.s + "%, " + r.l + "%)";
10824 };
10825 var I = function(e) {
10826 var r = e.h;
10827 var t = e.s;
10828 var n = e.v;
10829 var o = e.a;
10830 r = r / 360 * 6, t /= 100, n /= 100;
10831 var a = Math.floor(r);
10832 var l = n * (1 - t);
10833 var u = n * (1 - (r - a) * t);
10834 var c = n * (1 - (1 - r + a) * t);
10835 var i = a % 6;
10836 return {
10837 r: b(255 * [
10838 n,
10839 u,
10840 l,
10841 l,
10842 c,
10843 n
10844 ][i]),
10845 g: b(255 * [
10846 c,
10847 n,
10848 n,
10849 u,
10850 l,
10851 l
10852 ][i]),
10853 b: b(255 * [
10854 l,
10855 l,
10856 c,
10857 n,
10858 n,
10859 u
10860 ][i]),
10861 a: b(o, 2)
10862 };
10863 };
10864 var D = function(e) {
10865 var r = e.toString(16);
10866 return r.length < 2 ? "0" + r : r;
10867 };
10868 var K = function(e) {
10869 var r = e.r;
10870 var t = e.g;
10871 var n = e.b;
10872 var o = e.a;
10873 var a = o < 1 ? D(b(255 * o)) : "";
10874 return "#" + D(r) + D(t) + D(n) + a;
10875 };
10876 var L = function(e) {
10877 var r = e.r;
10878 var t = e.g;
10879 var n = e.b;
10880 var o = e.a;
10881 var a = Math.max(r, t, n);
10882 var l = a - Math.min(r, t, n);
10883 var u = l ? a === r ? (t - n) / l : a === t ? 2 + (n - r) / l : 4 + (r - t) / l : 0;
10884 return {
10885 h: b(60 * (u < 0 ? u + 6 : u)),
10886 s: b(a ? l / a * 100 : 0),
10887 v: b(a / 255 * 100),
10888 a: o
10889 };
10890 };
10891 var S = react$1.default.memo(function(r) {
10892 var t = r.hue;
10893 var n = r.onChange;
10894 var o = g(["react-colorful__hue", r.className]);
10895 return react$1.default.createElement("div", { className: o }, react$1.default.createElement(m$1, {
10896 onMove: function(e) {
10897 n({ h: 360 * e.left });
10898 },
10899 onKey: function(e) {
10900 n({ h: s(t + 360 * e.left, 0, 360) });
10901 },
10902 "aria-label": "Hue",
10903 "aria-valuenow": b(t),
10904 "aria-valuemax": "360",
10905 "aria-valuemin": "0"
10906 }, react$1.default.createElement(p, {
10907 className: "react-colorful__hue-pointer",
10908 left: t / 360,
10909 color: q({
10910 h: t,
10911 s: 100,
10912 v: 100,
10913 a: 1
10914 })
10915 })));
10916 });
10917 var T = react$1.default.memo(function(r) {
10918 var t = r.hsva;
10919 var n = r.onChange;
10920 var o = { backgroundColor: q({
10921 h: t.h,
10922 s: 100,
10923 v: 100,
10924 a: 1
10925 }) };
10926 return react$1.default.createElement("div", {
10927 className: "react-colorful__saturation",
10928 style: o
10929 }, react$1.default.createElement(m$1, {
10930 onMove: function(e) {
10931 n({
10932 s: 100 * e.left,
10933 v: 100 - 100 * e.top
10934 });
10935 },
10936 onKey: function(e) {
10937 n({
10938 s: s(t.s + 100 * e.left, 0, 100),
10939 v: s(t.v - 100 * e.top, 0, 100)
10940 });
10941 },
10942 "aria-label": "Color",
10943 "aria-valuetext": "Saturation " + b(t.s) + "%, Brightness " + b(t.v) + "%"
10944 }, react$1.default.createElement(p, {
10945 className: "react-colorful__saturation-pointer",
10946 top: 1 - t.v / 100,
10947 left: t.s / 100,
10948 color: q(t)
10949 })));
10950 });
10951 var F = function(e, r) {
10952 if (e === r) return !0;
10953 for (var t in e) if (e[t] !== r[t]) return !1;
10954 return !0;
10955 };
10956 var X = function(e, r) {
10957 return e.toLowerCase() === r.toLowerCase() || F(C(e), C(r));
10958 };
10959 function Y(e, t, l) {
10960 var u = i(l);
10961 var c = (0, react$1.useState)(function() {
10962 return e.toHsva(t);
10963 });
10964 var s = c[0];
10965 var f = c[1];
10966 var v = (0, react$1.useRef)({
10967 color: t,
10968 hsva: s
10969 });
10970 (0, react$1.useEffect)(function() {
10971 if (!e.equal(t, v.current.color)) {
10972 var r = e.toHsva(t);
10973 v.current = {
10974 hsva: r,
10975 color: t
10976 }, f(r);
10977 }
10978 }, [t, e]), (0, react$1.useEffect)(function() {
10979 var r;
10980 F(s, v.current.hsva) || e.equal(r = e.fromHsva(s), v.current.color) || (v.current = {
10981 hsva: s,
10982 color: r
10983 }, u(r));
10984 }, [
10985 s,
10986 e,
10987 u
10988 ]);
10989 return [s, (0, react$1.useCallback)(function(e) {
10990 f(function(r) {
10991 return Object.assign({}, r, e);
10992 });
10993 }, [])];
10994 }
10995 var R;
10996 var V = "undefined" != typeof window ? react$1.useLayoutEffect : react$1.useEffect;
10997 var $ = function() {
10998 return R || ("undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : void 0);
10999 };
11000 var J = /* @__PURE__ */ new Map();
11001 var Q = function(e) {
11002 V(function() {
11003 var r = e.current ? e.current.ownerDocument : document;
11004 if (void 0 !== r && !J.has(r)) {
11005 var t = r.createElement("style");
11006 t.innerHTML = ".react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:\"\";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill-opacity=\".05\"><path d=\"M8 0h8v8H8zM0 8h8v8H0z\"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}", J.set(r, t);
11007 var n = $();
11008 n && t.setAttribute("nonce", n), r.head.appendChild(t);
11009 }
11010 }, []);
11011 };
11012 var U = function(t) {
11013 var n = t.className;
11014 var o = t.colorModel;
11015 var a = t.color;
11016 var l = void 0 === a ? o.defaultColor : a;
11017 var i = t.onChange;
11018 var s = c(t, [
11019 "className",
11020 "colorModel",
11021 "color",
11022 "onChange"
11023 ]);
11024 var f = (0, react$1.useRef)(null);
11025 Q(f);
11026 var v = Y(o, l, i);
11027 var d = v[0];
11028 var h = v[1];
11029 var m = g(["react-colorful", n]);
11030 return react$1.default.createElement("div", u({}, s, {
11031 ref: f,
11032 className: m
11033 }), react$1.default.createElement(T, {
11034 hsva: d,
11035 onChange: h
11036 }), react$1.default.createElement(S, {
11037 hue: d.h,
11038 onChange: h,
11039 className: "react-colorful__last-control"
11040 }));
11041 };
11042 var W = {
11043 defaultColor: "000",
11044 toHsva: x,
11045 fromHsva: function(e) {
11046 return w({
11047 h: e.h,
11048 s: e.s,
11049 v: e.v,
11050 a: 1
11051 });
11052 },
11053 equal: X
11054 };
11055 var Z = function(r) {
11056 return react$1.default.createElement(U, u({}, r, { colorModel: W }));
11057 };
11058
11059 //#endregion
11060 //#region modules/ai/assets/js/editor/pages/form-media/components/color-picker.js
11061 init_defineProperty$1();
11062 init_slicedToArray();
11063 function ownKeys$11(e, r) {
11064 var t = Object.keys(e);
11065 if (Object.getOwnPropertySymbols) {
11066 var o = Object.getOwnPropertySymbols(e);
11067 r && (o = o.filter(function(r) {
11068 return Object.getOwnPropertyDescriptor(e, r).enumerable;
11069 })), t.push.apply(t, o);
11070 }
11071 return t;
11072 }
11073 __name(ownKeys$11, "ownKeys");
11074 function _objectSpread$11(e) {
11075 for (var r = 1; r < arguments.length; r++) {
11076 var t = null != arguments[r] ? arguments[r] : {};
11077 r % 2 ? ownKeys$11(Object(t), !0).forEach(function(r) {
11078 _defineProperty$1(e, r, t[r]);
11079 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$11(Object(t)).forEach(function(r) {
11080 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
11081 });
11082 }
11083 return e;
11084 }
11085 __name(_objectSpread$11, "_objectSpread");
11086 var ColorInput = function ColorInput(_ref) {
11087 var _elementorCommon$conf;
11088 var _elementorCommon;
11089 var label = _ref.label;
11090 var color = _ref.color;
11091 var onChange = _ref.onChange;
11092 var disabled = _ref.disabled;
11093 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
11094 var isOpened = _useState2[0];
11095 var setIsOpened = _useState2[1];
11096 var anchorEl = (0, react.useRef)();
11097 var _useState4 = _slicedToArray((0, react.useState)(170001), 2);
11098 var zIndex = _useState4[0];
11099 var setZIndex = _useState4[1];
11100 var isRTL = (_elementorCommon$conf = (_elementorCommon = elementorCommon) === null || _elementorCommon === void 0 || (_elementorCommon = _elementorCommon.config) === null || _elementorCommon === void 0 ? void 0 : _elementorCommon.isRTL) !== null && _elementorCommon$conf !== void 0 ? _elementorCommon$conf : true;
11101 (0, react.useEffect)(function() {
11102 if (anchorEl.current) {
11103 var element = anchorEl.current;
11104 var currentZIndex = 0;
11105 while (element && element !== document.body) {
11106 var computedZIndex = window.getComputedStyle(element).zIndex;
11107 if (computedZIndex !== "auto") {
11108 currentZIndex = parseInt(computedZIndex, 10) || 0;
11109 break;
11110 }
11111 element = element.parentElement;
11112 }
11113 setZIndex(currentZIndex > 0 ? currentZIndex + 1 : 170001);
11114 }
11115 }, [isOpened]);
11116 var handleClick = function handleClick() {
11117 return setIsOpened(true);
11118 };
11119 var handleClose = function handleClose() {
11120 setIsOpened(false);
11121 };
11122 var handleKeyDown = function handleKeyDown(event) {
11123 if ("Enter" === event.key || " " === event.key) {
11124 event.preventDefault();
11125 handleClick();
11126 }
11127 };
11128 var handleTextFieldChange = function handleTextFieldChange(event) {
11129 onChange("#".concat(event.target.value));
11130 };
11131 var handleColorPickerChange = function handleColorPickerChange(colorValue) {
11132 onChange(colorValue);
11133 };
11134 var id = isOpened ? "simple-popover" : void 0;
11135 return /*#__PURE__*/ react.default.createElement("div", {
11136 className: "el-ai-color-input-wrapper",
11137 style: _objectSpread$11({
11138 display: "flex",
11139 alignItems: "center"
11140 }, disabled ? {
11141 pointerEvents: "none",
11142 opacity: .5
11143 } : {})
11144 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.FormLabel, { sx: {
11145 whiteSpace: "nowrap",
11146 flex: 4
11147 } }, label), /*#__PURE__*/ react.default.createElement("button", {
11148 type: "button",
11149 onClick: handleClick,
11150 onKeyDown: handleKeyDown,
11151 style: {
11152 cursor: "pointer",
11153 borderRadius: "4px",
11154 marginRight: "8px",
11155 marginLeft: "8px",
11156 background: color,
11157 width: "100%",
11158 height: "auto",
11159 borderColor: "rgba(0, 0, 0, 0.23)",
11160 borderWidth: "1px",
11161 borderStyle: "solid",
11162 aspectRatio: "1 / 1",
11163 flex: 1.1
11164 },
11165 "aria-describedby": id,
11166 ref: anchorEl
11167 }), /*#__PURE__*/ react.default.createElement(StyledTextField, {
11168 value: color.substring(1, 7),
11169 color: "secondary",
11170 fullWidth: true,
11171 InputProps: {
11172 autoComplete: "off",
11173 color: "secondary",
11174 sx: { height: "100%" },
11175 startAdornment: /*#__PURE__*/ react.default.createElement(_elementor_ui.InputAdornment, { position: "start" }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
11176 variant: "body1",
11177 color: "secondary"
11178 }, "#"))
11179 },
11180 onChange: handleTextFieldChange,
11181 sx: {
11182 flex: 3,
11183 height: "40px"
11184 }
11185 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popover, {
11186 id,
11187 anchorOrigin: {
11188 vertical: "bottom",
11189 horizontal: isRTL ? "right" : "left"
11190 },
11191 transformOrigin: {
11192 vertical: "top",
11193 horizontal: isRTL ? "right" : "left"
11194 },
11195 onClose: handleClose,
11196 open: isOpened,
11197 anchorEl: anchorEl.current,
11198 style: {
11199 zIndex,
11200 overflow: "hidden"
11201 }
11202 }, /*#__PURE__*/ react.default.createElement("div", {
11203 className: "el-ai-custom-color-picker",
11204 style: {
11205 height: "min-content",
11206 overflow: "hidden"
11207 }
11208 }, /*#__PURE__*/ react.default.createElement(Z, {
11209 color,
11210 onChange: handleColorPickerChange
11211 }))));
11212 };
11213 var StyledTextField = (0, _elementor_ui.styled)(_elementor_ui_TextField.default)(function() {
11214 return { ".wp-admin & .MuiInputBase-input, & .MuiInputBase-input:focus": {
11215 backgroundColor: "initial",
11216 boxShadow: "none",
11217 border: 0,
11218 color: "inherit",
11219 outline: 0,
11220 padding: 0,
11221 fontFamily: "inherit",
11222 minHeight: "2.4375em"
11223 } };
11224 });
11225 ColorInput.propTypes = {
11226 label: import_prop_types$8.default.string,
11227 color: import_prop_types$8.default.string,
11228 onChange: import_prop_types$8.default.func.isRequired,
11229 disabled: import_prop_types$8.default.bool
11230 };
11231
11232 //#endregion
11233 //#region modules/ai/assets/js/editor/pages/form-media/views/product-image-unification/hooks/use-product-image-unification.js
11234 init_api();
11235 var useProductImageUnification = function useProductImageUnification(initialValue) {
11236 return useImagePrompt((0, react.useRef)(function(payload) {
11237 return getProductImageUnification(payload, true);
11238 }).current, initialValue);
11239 };
11240
11241 //#endregion
11242 //#region modules/ai/assets/js/editor/pages/form-media/views/product-image-unification/components/product-image.js
11243 init_defineProperty$1();
11244 var ProductImage = function ProductImage(_ref) {
11245 var productId = _ref.productId;
11246 var ratio = _ref.ratio;
11247 var bgColor = _ref.bgColor;
11248 var image = _ref.image;
11249 var onUpdate = _ref.onUpdate;
11250 var isUploading = useImageActions().isLoading;
11251 var _useProductImageUnifi = useProductImageUnification(_defineProperty$1(_defineProperty$1(_defineProperty$1({ productId }, IMAGE_RATIO, ratio), IMAGE_BACKGROUND_COLOR, bgColor), "image", image));
11252 var data = _useProductImageUnifi.data;
11253 var isGenerating = _useProductImageUnifi.isLoading;
11254 var error = _useProductImageUnifi.error;
11255 var send = _useProductImageUnifi.send;
11256 var sendUsageData = _useProductImageUnifi.sendUsageData;
11257 (0, react.useEffect)(function() {
11258 if (onUpdate) onUpdate(data, isGenerating || isUploading, error, send, productId, ratio, bgColor, image, sendUsageData);
11259 }, [
11260 data,
11261 isGenerating,
11262 error,
11263 send,
11264 productId,
11265 ratio,
11266 bgColor,
11267 image,
11268 isUploading,
11269 onUpdate,
11270 sendUsageData
11271 ]);
11272 return /*#__PURE__*/ react.default.createElement("div", { style: { visibility: "hidden" } });
11273 };
11274 ProductImage.propTypes = {
11275 productId: import_prop_types$8.default.number,
11276 ratio: import_prop_types$8.default.string,
11277 bgColor: import_prop_types$8.default.string,
11278 image: import_prop_types$8.default.object,
11279 onUpdate: import_prop_types$8.default.func
11280 };
11281
11282 //#endregion
11283 //#region modules/ai/assets/js/editor/pages/form-media/views/product-image-unification/index.js
11284 init_defineProperty$1();
11285 init_asyncToGenerator();
11286 init_slicedToArray();
11287 init_requests_ids();
11288 function ownKeys$10(e, r) {
11289 var t = Object.keys(e);
11290 if (Object.getOwnPropertySymbols) {
11291 var o = Object.getOwnPropertySymbols(e);
11292 r && (o = o.filter(function(r) {
11293 return Object.getOwnPropertyDescriptor(e, r).enumerable;
11294 })), t.push.apply(t, o);
11295 }
11296 return t;
11297 }
11298 __name(ownKeys$10, "ownKeys");
11299 function _objectSpread$10(e) {
11300 for (var r = 1; r < arguments.length; r++) {
11301 var t = null != arguments[r] ? arguments[r] : {};
11302 r % 2 ? ownKeys$10(Object(t), !0).forEach(function(r) {
11303 _defineProperty$1(e, r, t[r]);
11304 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$10(Object(t)).forEach(function(r) {
11305 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
11306 });
11307 }
11308 return e;
11309 }
11310 __name(_objectSpread$10, "_objectSpread");
11311 var ProductImageUnification = function ProductImageUnification(_ref) {
11312 var _products$images$leng;
11313 var _products$images;
11314 var _Object$values;
11315 var _products$images$leng2;
11316 var _products$images2;
11317 var _products$images$leng3;
11318 var _products$images3;
11319 var _errorlessProducts$le;
11320 var _products$images4;
11321 var onClose = _ref.onClose;
11322 var setGenerate = useRequestIds().setGenerate;
11323 var products = useEditImage().editImage;
11324 var _usePromptSettings = usePromptSettings();
11325 var settings = _usePromptSettings.settings;
11326 var updateSettings = _usePromptSettings.updateSettings;
11327 var _useState2 = _slicedToArray((0, react.useState)({}), 2);
11328 var productsData = _useState2[0];
11329 var setProductsData = _useState2[1];
11330 var _useState4 = _slicedToArray((0, react.useState)({}), 2);
11331 var loadingMap = _useState4[0];
11332 var setLoadingMap = _useState4[1];
11333 var _useState6 = _slicedToArray((0, react.useState)({}), 2);
11334 var errorMap = _useState6[0];
11335 var setErrorMap = _useState6[1];
11336 var _useState8 = _slicedToArray((0, react.useState)({}), 2);
11337 var checkboxColorMap = _useState8[0];
11338 var setCheckboxColorMap = _useState8[1];
11339 var _useState0 = _slicedToArray((0, react.useState)(false), 2);
11340 var wasGeneratedOnce = _useState0[0];
11341 var setWasGeneratedOnce = _useState0[1];
11342 var useMultipleImages = useImageActions().useMultipleImages;
11343 var _useState10 = _slicedToArray((0, react.useState)(false), 2);
11344 var isSavingImages = _useState10[0];
11345 var setIsSavingImages = _useState10[1];
11346 var errorlessProducts = Object.values(productsData).filter(function(_ref2) {
11347 var _errorMap$productId;
11348 return !((_errorMap$productId = errorMap[_ref2.productId]) !== null && _errorMap$productId !== void 0 && _errorMap$productId.errorGenerating);
11349 });
11350 var use = (0, react.useCallback)(/*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
11351 var generatedImages;
11352 var imagesToSave;
11353 return import_regenerator$2.default.wrap(function(_context) {
11354 while (1) switch (_context.prev = _context.next) {
11355 case 0:
11356 setIsSavingImages(true);
11357 generatedImages = errorlessProducts.filter(function(_ref4) {
11358 var data = _ref4.data;
11359 return _ref4.wasGenerated && (data === null || data === void 0 ? void 0 : data.isChecked) && (data === null || data === void 0 ? void 0 : data.productId) !== void 0;
11360 });
11361 imagesToSave = generatedImages.map(function(_ref5) {
11362 var data = _ref5.data;
11363 return _objectSpread$10(_objectSpread$10({}, data), {}, {
11364 editor_post_id: data.productId,
11365 unique_id: "ai-product-unification-".concat(data.productId)
11366 });
11367 });
11368 _context.next = 1;
11369 return useMultipleImages(imagesToSave);
11370 case 1:
11371 generatedImages.forEach(function(_ref6) {
11372 var sendUsageData = _ref6.sendUsageData;
11373 sendUsageData();
11374 });
11375 onClose();
11376 case 2:
11377 case "end": return _context.stop();
11378 }
11379 }, _callee);
11380 })), [
11381 onClose,
11382 errorlessProducts,
11383 useMultipleImages
11384 ]);
11385 var generatedAspectRatio = (0, react.useMemo)(function() {
11386 return settings[IMAGE_RATIO];
11387 }, [settings]);
11388 var generatedBgColor = (0, react.useMemo)(function() {
11389 return settings[IMAGE_BACKGROUND_COLOR];
11390 }, [settings]);
11391 var onProductUpdate = (0, react.useCallback)(function(res, isLoadingResult, errorGenerating, _req, productId, ratio, bgColor, image, sendUsageData) {
11392 setLoadingMap(function(prevState) {
11393 return _objectSpread$10(_objectSpread$10({}, prevState), {}, _defineProperty$1({}, productId, !!isLoadingResult));
11394 });
11395 setErrorMap(function(prevState) {
11396 return _objectSpread$10(_objectSpread$10({}, prevState), {}, _defineProperty$1({}, productId, { errorGenerating }));
11397 });
11398 setProductsData(function(prevState) {
11399 var _res$result;
11400 var _ref7;
11401 var _res$result$;
11402 var _res$result2;
11403 var _prevState$productId;
11404 var _prevState$productId$;
11405 var _prevState$productId2;
11406 var _checkboxColorMap$pro;
11407 return _objectSpread$10(_objectSpread$10({}, prevState), {}, _defineProperty$1({}, productId, _objectSpread$10(_objectSpread$10({}, prevState[productId]), {}, {
11408 productId,
11409 res,
11410 req: function req() {
11411 return _req({
11412 postId: productId,
11413 settings: _defineProperty$1(_defineProperty$1({}, IMAGE_RATIO, ratio), IMAGE_BACKGROUND_COLOR, bgColor),
11414 image
11415 });
11416 },
11417 sendUsageData,
11418 wasGenerated: (res === null || res === void 0 || (_res$result = res.result) === null || _res$result === void 0 ? void 0 : _res$result[0]) !== void 0,
11419 data: _objectSpread$10(_objectSpread$10({ productId }, !errorGenerating ? (_ref7 = (_res$result$ = res === null || res === void 0 || (_res$result2 = res.result) === null || _res$result2 === void 0 ? void 0 : _res$result2[0]) !== null && _res$result$ !== void 0 ? _res$result$ : image) !== null && _ref7 !== void 0 ? _ref7 : (_prevState$productId = prevState[productId]) === null || _prevState$productId === void 0 ? void 0 : _prevState$productId.image : {}), {}, {
11420 seed: productId,
11421 isChecked: (_prevState$productId$ = (_prevState$productId2 = prevState[productId]) === null || _prevState$productId2 === void 0 || (_prevState$productId2 = _prevState$productId2.data) === null || _prevState$productId2 === void 0 ? void 0 : _prevState$productId2.isChecked) !== null && _prevState$productId$ !== void 0 ? _prevState$productId$ : true,
11422 isLoading: isLoadingResult,
11423 checkboxColor: (_checkboxColorMap$pro = checkboxColorMap[productId]) !== null && _checkboxColorMap$pro !== void 0 ? _checkboxColorMap$pro : "rgba(0, 0, 0, 0.54)"
11424 })
11425 })));
11426 });
11427 }, [checkboxColorMap]);
11428 var isLoading = errorlessProducts.some(function(_ref8) {
11429 return loadingMap[_ref8.productId];
11430 });
11431 var isError = Object.values(errorMap).length && Object.values(errorMap).every(function(_ref9) {
11432 return _ref9.errorGenerating;
11433 });
11434 var thumbnailThreshold = 10;
11435 var exceedThumbnailThreshold = ((_products$images$leng = products === null || products === void 0 || (_products$images = products.images) === null || _products$images === void 0 ? void 0 : _products$images.length) !== null && _products$images$leng !== void 0 ? _products$images$leng : 0) - thumbnailThreshold > 0;
11436 var selectedProducts = errorlessProducts.filter(function(_ref0) {
11437 var data = _ref0.data;
11438 return data.isChecked && !data.isLoading;
11439 });
11440 var handleSubmit = (0, react.useCallback)(function(event) {
11441 event.preventDefault();
11442 setGenerate();
11443 setWasGeneratedOnce(true);
11444 var isLightColor = function isLightColor(color) {
11445 var rgb = parseInt(color.slice(1), 16);
11446 var r = rgb >> 16 & 255;
11447 var g = rgb >> 8 & 255;
11448 var b = rgb >> 0 & 255;
11449 return .299 * r + .587 * g + .114 * b > 128;
11450 };
11451 var productsToUnify = (errorlessProducts.length ? errorlessProducts : Object.values(productsData)).filter(function(product) {
11452 var _product$data;
11453 return ((_product$data = product.data) === null || _product$data === void 0 ? void 0 : _product$data.isChecked) && product.req;
11454 });
11455 var newCheckboxColor = isLightColor(generatedBgColor) ? "rgba(0, 0, 0, 0.54)" : "rgba( 255, 255, 255, 0.7 )";
11456 if (productsToUnify.find(function(product) {
11457 return checkboxColorMap[product.productId] !== newCheckboxColor;
11458 })) setCheckboxColorMap(function(prevState) {
11459 var newColorMap = _objectSpread$10({}, prevState);
11460 productsToUnify.forEach(function(product) {
11461 newColorMap[product.productId] = newCheckboxColor;
11462 });
11463 return newColorMap;
11464 });
11465 productsToUnify.forEach(function(product) {
11466 return product.req().catch(function() {});
11467 });
11468 }, [
11469 checkboxColorMap,
11470 errorlessProducts,
11471 generatedBgColor,
11472 productsData,
11473 setGenerate
11474 ]);
11475 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
11476 primary: (0, _wordpress_i18n.__)("Unify images", "elementor"),
11477 secondary: (0, _wordpress_i18n.__)("Select a set of parameters and AI will automate your adjustments:", "elementor")
11478 }), isError && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
11479 error: (_Object$values = Object.values(errorMap)) === null || _Object$values === void 0 || (_Object$values = _Object$values[0]) === null || _Object$values === void 0 ? void 0 : _Object$values.errorGenerating,
11480 onRetry: handleSubmit
11481 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { gap: 2 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
11482 display: "flex",
11483 flexWrap: "wrap",
11484 width: "100%",
11485 "& .MuiAvatar-root": { margin: .5 }
11486 } }, products === null || products === void 0 ? void 0 : products.images.slice(0, exceedThumbnailThreshold ? thumbnailThreshold - 1 : thumbnailThreshold).map(function(img) {
11487 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Avatar, {
11488 key: img.productId,
11489 alt: img.productId + "",
11490 src: img.image_url,
11491 variant: "square",
11492 sx: {
11493 width: 50,
11494 height: 50
11495 }
11496 });
11497 }), exceedThumbnailThreshold && /*#__PURE__*/ react.default.createElement(_elementor_ui.Avatar, {
11498 variant: "square",
11499 sx: {
11500 bgcolor: "lightgray",
11501 width: 50,
11502 height: 50
11503 }
11504 }, ((_products$images$leng2 = products === null || products === void 0 || (_products$images2 = products.images) === null || _products$images2 === void 0 ? void 0 : _products$images2.length) !== null && _products$images$leng2 !== void 0 ? _products$images$leng2 : 0) - (thumbnailThreshold - 1))), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
11505 gap: 2,
11506 sx: { my: 2.5 }
11507 }, /*#__PURE__*/ react.default.createElement(ColorInput, {
11508 label: (0, _wordpress_i18n.__)("Background Color", "elementor"),
11509 color: generatedBgColor,
11510 onChange: function onChange(color) {
11511 return updateSettings(_defineProperty$1({}, IMAGE_BACKGROUND_COLOR, color));
11512 },
11513 disabled: isLoading
11514 }), /*#__PURE__*/ react.default.createElement(ImageRatioSelect, {
11515 disabled: true,
11516 value: generatedAspectRatio,
11517 onChange: function onChange(event) {
11518 return updateSettings(_defineProperty$1({}, IMAGE_RATIO, event.target.value));
11519 }
11520 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
11521 gap: 2,
11522 sx: { my: 2.5 }
11523 }, wasGeneratedOnce ? /*#__PURE__*/ react.default.createElement(GenerateAgainSubmit, { disabled: isLoading }) : /*#__PURE__*/ react.default.createElement(GenerateSubmit, { disabled: isLoading })))))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isSavingImages }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
11524 display: "flex",
11525 flexDirection: "column",
11526 height: "100%",
11527 alignItems: "center",
11528 justifyContent: "center",
11529 minHeight: "76vh"
11530 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
11531 flex: 1,
11532 overflowY: "auto",
11533 display: "flex",
11534 flexDirection: "column",
11535 height: "100%",
11536 alignItems: "center",
11537 justifyContent: "center",
11538 overflowX: "hidden"
11539 } }, wasGeneratedOnce ? /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, errorlessProducts.length > 1 && errorlessProducts.some(function(_ref1) {
11540 return !_ref1.data.isLoading;
11541 }) && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
11542 display: "flex",
11543 flexDirection: "row",
11544 alignItems: "inherit",
11545 justifyContent: "space-between",
11546 width: "100%"
11547 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
11548 variant: "body2",
11549 color: "secondary"
11550 }, (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%1$d/%2$d selected", "elementor"), selectedProducts.length, (_products$images$leng3 = products === null || products === void 0 || (_products$images3 = products.images) === null || _products$images3 === void 0 ? void 0 : _products$images3.length) !== null && _products$images$leng3 !== void 0 ? _products$images$leng3 : 0)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
11551 variant: "text",
11552 color: "secondary",
11553 onClick: function onClick() {
11554 var isChecked = !selectedProducts.some(function(product) {
11555 var _product$data2;
11556 return (_product$data2 = product.data) === null || _product$data2 === void 0 ? void 0 : _product$data2.isChecked;
11557 });
11558 setProductsData(function(prevState) {
11559 var newState = _objectSpread$10({}, prevState);
11560 Object.values(newState).forEach(function(product) {
11561 var _product$data3;
11562 if (isChecked !== ((_product$data3 = product.data) === null || _product$data3 === void 0 ? void 0 : _product$data3.isChecked)) newState[product.productId] = _objectSpread$10(_objectSpread$10({}, product), {}, { data: _objectSpread$10(_objectSpread$10({}, product.data), {}, { isChecked }) });
11563 });
11564 return newState;
11565 });
11566 }
11567 }, selectedProducts.some(function(product) {
11568 var _product$data4;
11569 return (_product$data4 = product.data) === null || _product$data4 === void 0 ? void 0 : _product$data4.isChecked;
11570 }) ? (0, _wordpress_i18n.__)("Clear all", "elementor") : (0, _wordpress_i18n.__)("Select all", "elementor"))), /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
11571 images: errorlessProducts.map(function(product) {
11572 return product.data;
11573 }),
11574 cols: function getCols() {
11575 var dataLength = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
11576 return Math.min(Math.ceil(Math.sqrt(dataLength !== null && dataLength !== void 0 ? dataLength : 1)), 4);
11577 }((_errorlessProducts$le = errorlessProducts.length) !== null && _errorlessProducts$le !== void 0 ? _errorlessProducts$le : 1),
11578 overlay: false,
11579 onSelectChange: function onSelectChange(productId, isChecked) {
11580 return setProductsData(function(prevState) {
11581 var _prevState$productId3;
11582 if ((_prevState$productId3 = prevState[productId]) !== null && _prevState$productId3 !== void 0 && _prevState$productId3.data) prevState[productId].data.isChecked = isChecked;
11583 return _objectSpread$10({}, prevState);
11584 });
11585 }
11586 })) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
11587 component: "img",
11588 src: window.UnifyProductImagesConfig.placeholder,
11589 alt: (0, _wordpress_i18n.__)("Example GIF", "elementor")
11590 })), wasGeneratedOnce && !isError && errorlessProducts.length && errorlessProducts.some(function(_ref10) {
11591 var data = _ref10.data;
11592 var errorGenerating = _ref10.errorGenerating;
11593 var wasGenerated = _ref10.wasGenerated;
11594 return (data === null || data === void 0 ? void 0 : data.isChecked) && !(data !== null && data !== void 0 && data.isLoadingResult) && !errorGenerating && wasGenerated;
11595 }) && /*#__PURE__*/ react.default.createElement(ImageActions.UseImage, {
11596 onClick: use,
11597 sx: {
11598 alignSelf: "flex-end",
11599 mt: 2
11600 }
11601 }))), (_products$images4 = products.images) === null || _products$images4 === void 0 ? void 0 : _products$images4.filter(function(img) {
11602 return img.productId;
11603 }).map(function(img) {
11604 return /*#__PURE__*/ react.default.createElement(ProductImage, {
11605 key: "product-".concat(img.productId),
11606 productId: img.productId,
11607 ratio: settings[IMAGE_RATIO],
11608 bgColor: settings[IMAGE_BACKGROUND_COLOR],
11609 image: img,
11610 onUpdate: onProductUpdate
11611 });
11612 }));
11613 };
11614 ProductImageUnification.propTypes = { onClose: import_prop_types$8.default.func };
11615
11616 //#endregion
11617 //#region modules/ai/assets/js/editor/pages/form-media/views/isolate-objects/hooks/use-isolate-objects.js
11618 init_api();
11619 var useIsolateObject = function useIsolateObject(initialValue) {
11620 return useImagePrompt(function fetchAction(payload) {
11621 return getImageToImageIsolateObjects(payload);
11622 }, initialValue);
11623 };
11624
11625 //#endregion
11626 //#region modules/ai/assets/js/editor/pages/form-media/views/isolate-objects/index.js
11627 init_defineProperty$1();
11628 init_requests_ids();
11629 var IsolateObject = function IsolateObject() {
11630 var editImage = useEditImage().editImage;
11631 var setGenerate = useRequestIds().setGenerate;
11632 var _useImageActions = useImageActions();
11633 var use = _useImageActions.use;
11634 var edit = _useImageActions.edit;
11635 var isUploading = _useImageActions.isLoading;
11636 var _usePromptSettings = usePromptSettings();
11637 var settings = _usePromptSettings.settings;
11638 var updateSettings = _usePromptSettings.updateSettings;
11639 var _useIsolateObject = useIsolateObject();
11640 var data = _useIsolateObject.data;
11641 var send = _useIsolateObject.send;
11642 var isGenerating = _useIsolateObject.isLoading;
11643 var error = _useIsolateObject.error;
11644 var isLoading = isGenerating || isUploading;
11645 var _useImageSize = useImageSize(editImage.aspectRatio);
11646 var width = _useImageSize.width;
11647 var height = _useImageSize.height;
11648 var generatedAspectRatio = (0, react.useMemo)(function() {
11649 return settings[IMAGE_RATIO];
11650 }, [settings]);
11651 var generatedBgColor = (0, react.useMemo)(function() {
11652 return settings[IMAGE_BACKGROUND_COLOR];
11653 }, [settings]);
11654 var handleSubmit = function handleSubmit(event) {
11655 event.preventDefault();
11656 setGenerate();
11657 send({
11658 image: editImage,
11659 settings: _defineProperty$1(_defineProperty$1({}, IMAGE_RATIO, generatedAspectRatio), IMAGE_BACKGROUND_COLOR, generatedBgColor),
11660 featureIdentifier: FEATURE_IDENTIFIER.ISOLATE_OBJECT
11661 });
11662 };
11663 return /*#__PURE__*/ react.default.createElement(View, null, /*#__PURE__*/ react.default.createElement(View.Panel, null, /*#__PURE__*/ react.default.createElement(View.BackButton, null), /*#__PURE__*/ react.default.createElement(View.PanelHeading, {
11664 primary: (0, _wordpress_i18n.__)("Isolate Object", "elementor"),
11665 secondary: (0, _wordpress_i18n.__)("Remove the background, center your object, and add a drop shadow for a clean look.", "elementor")
11666 }), error && /*#__PURE__*/ react.default.createElement(View.ErrorMessage, {
11667 error,
11668 onRetry: handleSubmit
11669 }), /*#__PURE__*/ react.default.createElement(ImageForm, { onSubmit: handleSubmit }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
11670 gap: 2,
11671 sx: { my: 2.5 }
11672 }, /*#__PURE__*/ react.default.createElement(ColorInput, {
11673 label: (0, _wordpress_i18n.__)("Background Color", "elementor"),
11674 color: generatedBgColor,
11675 onChange: function onChange(color) {
11676 return updateSettings(_defineProperty$1({}, IMAGE_BACKGROUND_COLOR, color));
11677 },
11678 disabled: isLoading
11679 }), /*#__PURE__*/ react.default.createElement(GenerateSubmit, {
11680 disabled: isLoading,
11681 loading: isLoading
11682 }, (0, _wordpress_i18n.__)("Isolate Object", "elementor"))))), /*#__PURE__*/ react.default.createElement(View.Content, { isGenerating: isLoading }, data !== null && data !== void 0 && data.result ? /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(ImagesDisplay, {
11683 transparentContainer: true,
11684 onUseImage: use,
11685 onEditImage: edit,
11686 images: data.result,
11687 aspectRatio: editImage.aspectRatio
11688 })) : /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview, null, /*#__PURE__*/ react.default.createElement(SingleImagePreview.Image, {
11689 src: editImage.url,
11690 alt: editImage.alt,
11691 style: {
11692 width,
11693 height
11694 }
11695 })))));
11696 };
11697
11698 //#endregion
11699 //#region modules/ai/assets/js/editor/pages/form-media/media-outlet.js
11700 init_loader();
11701 init_prompt_history_action_context();
11702 var MediaOutlet = function MediaOutlet(_ref) {
11703 var _ref$additionalOption = _ref.additionalOptions;
11704 var additionalOptions = _ref$additionalOption === void 0 ? null : _ref$additionalOption;
11705 var _ref$onClose = _ref.onClose;
11706 var onClose = _ref$onClose === void 0 ? null : _ref$onClose;
11707 var editImage = useEditImage().editImage;
11708 var _useLocation = useLocation({ current: (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.location) || LOCATIONS.GENERATE });
11709 var current = _useLocation.current;
11710 var navigate = _useLocation.navigate;
11711 (0, react.useEffect)(function() {
11712 if ((additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.location) && additionalOptions.location !== LOCATIONS.GENERATE) {
11713 navigate(additionalOptions.location);
11714 return;
11715 }
11716 if (editImage.url) if (new RegExp(IMAGE_PLACEHOLDERS_HOSTS.WIREFRAME).test(new URL(editImage.url).host)) navigate(LOCATIONS.GENERATE);
11717 else if ("url" === editImage.source || editImage.id) navigate(LOCATIONS.IMAGE_TOOLS);
11718 else navigate(LOCATIONS.GENERATE);
11719 }, [
11720 editImage.id,
11721 editImage.url,
11722 editImage.source,
11723 additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.location
11724 ]);
11725 useSubscribeOnPromptHistoryAction([{
11726 type: ACTION_TYPES.RESTORE,
11727 handler: function handler() {
11728 if (current !== LOCATIONS.GENERATE) navigate(LOCATIONS.GENERATE);
11729 }
11730 }]);
11731 if (!current) return /*#__PURE__*/ react.default.createElement(View, { alignItems: "center" }, /*#__PURE__*/ react.default.createElement(Loader, null));
11732 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, current === LOCATIONS.GENERATE && /*#__PURE__*/ react.default.createElement(Generate, {
11733 textToImageHook: additionalOptions !== null && additionalOptions !== void 0 && additionalOptions.textToImageHook ? additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.textToImageHook : useTextToImage,
11734 predefinedPrompt: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.predefinedPrompt,
11735 initialSettings: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.initialSettings
11736 }), current === LOCATIONS.IMAGE_TOOLS && /*#__PURE__*/ react.default.createElement(ImageTools, null), current === LOCATIONS.VARIATIONS && /*#__PURE__*/ react.default.createElement(Variations, null), current === LOCATIONS.IN_PAINTING && /*#__PURE__*/ react.default.createElement(InPainting, null), current === LOCATIONS.OUT_PAINTING && /*#__PURE__*/ react.default.createElement(OutPainting, null), current === LOCATIONS.RESIZE && /*#__PURE__*/ react.default.createElement(Resize, null), current === LOCATIONS.REPLACE_BACKGROUND && /*#__PURE__*/ react.default.createElement(ReplaceBackground, null), current === LOCATIONS.REMOVE_BACKGROUND && /*#__PURE__*/ react.default.createElement(RemoveBackground, null), current === LOCATIONS.CLEANUP && /*#__PURE__*/ react.default.createElement(Cleanup, null), current === LOCATIONS.PRODUCT_IMAGE_UNIFICATION && /*#__PURE__*/ react.default.createElement(ProductImageUnification, { onClose }), current === LOCATIONS.ISOLATE_OBJECT && /*#__PURE__*/ react.default.createElement(IsolateObject, null));
11737 };
11738 MediaOutlet.propTypes = {
11739 additionalOptions: import_prop_types$8.default.object,
11740 onClose: import_prop_types$8.default.func
11741 };
11742
11743 //#endregion
11744 //#region modules/ai/assets/js/editor/pages/form-media/components/unsaved-changes-alert.js
11745 init_extends();
11746 init_objectWithoutProperties$1();
11747 var _excluded$13 = ["onClose", "onCancel"];
11748 var UnsavedChangesAlert$1 = function UnsavedChangesAlert(_ref) {
11749 var onClose = _ref.onClose;
11750 var onCancel = _ref.onCancel;
11751 var props = _objectWithoutProperties$1(_ref, _excluded$13);
11752 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, _extends$1({
11753 sx: { zIndex: 2e5 },
11754 "aria-labelledby": "unsaved-changes-alert-title",
11755 "aria-describedby": "unsaved-changes-alert-description"
11756 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogTitle, { id: "unsaved-changes-alert-title" }, (0, _wordpress_i18n.__)("Leave Elementor AI?", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContent, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContentText, { id: "unsaved-changes-alert-description" }, (0, _wordpress_i18n.__)("Images will be gone forever and we won’t be able to recover them.", "elementor"))), /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogActions, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
11757 onClick: onCancel,
11758 color: "secondary"
11759 }, (0, _wordpress_i18n.__)("Cancel", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
11760 onClick: onClose,
11761 color: "error",
11762 variant: "contained"
11763 }, (0, _wordpress_i18n.__)("Yes, leave", "elementor"))));
11764 };
11765 UnsavedChangesAlert$1.propTypes = {
11766 onClose: import_prop_types$8.default.func,
11767 onCancel: import_prop_types$8.default.func
11768 };
11769
11770 //#endregion
11771 //#region node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js
11772 function _taggedTemplateLiteral(e, t) {
11773 return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } }));
11774 }
11775
11776 //#endregion
11777 //#region modules/ai/assets/js/editor/components/prompt-history/history-button.js
11778 init_extends();
11779 init_objectWithoutProperties$1();
11780 var _excluded$12 = ["isActive"];
11781 var _templateObject$5;
11782 var StyledHistoryButton = (0, _elementor_ui.styled)(_elementor_ui.IconButton)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral([
11783 "\n margin-right: ",
11784 ";\n\n ",
11785 "\n"
11786 ])), function(_ref) {
11787 return _ref.theme.spacing(2);
11788 }, function(_ref2) {
11789 var isActive = _ref2.isActive;
11790 var theme = _ref2.theme;
11791 return isActive && "\n background-color: ".concat(theme.palette.action.hover, ";\n color: ").concat(theme.palette.text.tertiary, ";\n ");
11792 });
11793 var PromptHistoryButton = function PromptHistoryButton(_ref3) {
11794 var isActive = _ref3.isActive;
11795 var props = _objectWithoutProperties$1(_ref3, _excluded$12);
11796 return /*#__PURE__*/ react.default.createElement(StyledHistoryButton, _extends$1({
11797 "aria-label": (0, _wordpress_i18n.__)("Show prompt history", "elementor"),
11798 type: "button",
11799 size: "small",
11800 isActive
11801 }, props), /*#__PURE__*/ react.default.createElement(_elementor_icons.HistoryIcon, null));
11802 };
11803 PromptHistoryButton.propTypes = { isActive: import_prop_types$8.default.bool.isRequired };
11804
11805 //#endregion
11806 //#region modules/ai/assets/js/editor/hooks/use-prompt-history.js
11807 init_asyncToGenerator();
11808 init_slicedToArray();
11809 init_defineProperty$1();
11810 init_api();
11811 function ownKeys$9(e, r) {
11812 var t = Object.keys(e);
11813 if (Object.getOwnPropertySymbols) {
11814 var o = Object.getOwnPropertySymbols(e);
11815 r && (o = o.filter(function(r) {
11816 return Object.getOwnPropertyDescriptor(e, r).enumerable;
11817 })), t.push.apply(t, o);
11818 }
11819 return t;
11820 }
11821 __name(ownKeys$9, "ownKeys");
11822 function _objectSpread$9(e) {
11823 for (var r = 1; r < arguments.length; r++) {
11824 var t = null != arguments[r] ? arguments[r] : {};
11825 r % 2 ? ownKeys$9(Object(t), !0).forEach(function(r) {
11826 _defineProperty$1(e, r, t[r]);
11827 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function(r) {
11828 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
11829 });
11830 }
11831 return e;
11832 }
11833 __name(_objectSpread$9, "_objectSpread");
11834 var getImageThumbnailURL = function getImageThumbnailURL(base, imageURL) {
11835 if (!base) return imageURL;
11836 return "".concat(base, "/?o=").concat(btoa(imageURL, false));
11837 };
11838 var normalizeItems = function normalizeItems(response) {
11839 var meta = response.meta;
11840 var items = response.items;
11841 return items === null || items === void 0 ? void 0 : items.map(function(item) {
11842 var _item$request;
11843 var _item$request2;
11844 var _item$request3;
11845 var _item$response;
11846 var _item$response2;
11847 var _item$response3;
11848 return {
11849 id: item === null || item === void 0 ? void 0 : item.elementorApiId,
11850 date: item === null || item === void 0 ? void 0 : item.createdAt,
11851 action: item === null || item === void 0 ? void 0 : item.action,
11852 prompt: item === null || item === void 0 || (_item$request = item.request) === null || _item$request === void 0 ? void 0 : _item$request.prompt,
11853 imageType: item === null || item === void 0 || (_item$request2 = item.request) === null || _item$request2 === void 0 ? void 0 : _item$request2.image_type,
11854 ratio: item === null || item === void 0 || (_item$request3 = item.request) === null || _item$request3 === void 0 ? void 0 : _item$request3.ratio,
11855 text: item === null || item === void 0 || (_item$response = item.response) === null || _item$response === void 0 || (_item$response = _item$response.results) === null || _item$response === void 0 ? void 0 : _item$response.text,
11856 images: item === null || item === void 0 || (_item$response2 = item.response) === null || _item$response2 === void 0 || (_item$response2 = _item$response2.results) === null || _item$response2 === void 0 ? void 0 : _item$response2.images,
11857 thumbnails: item === null || item === void 0 || (_item$response3 = item.response) === null || _item$response3 === void 0 || (_item$response3 = _item$response3.results) === null || _item$response3 === void 0 || (_item$response3 = _item$response3.images) === null || _item$response3 === void 0 ? void 0 : _item$response3.map(function(image) {
11858 return _objectSpread$9(_objectSpread$9({}, image), {}, { image_url: getImageThumbnailURL(meta.thumbnailUrl, image.image_url) });
11859 })
11860 };
11861 });
11862 };
11863 var usePromptHistory = function usePromptHistory(historyType) {
11864 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
11865 var isLoading = _useState2[0];
11866 var setIsLoading = _useState2[1];
11867 var _useState4 = _slicedToArray((0, react.useState)({}), 2);
11868 var data = _useState4[0];
11869 var setData = _useState4[1];
11870 var _useState6 = _slicedToArray((0, react.useState)(""), 2);
11871 var error = _useState6[0];
11872 var setError = _useState6[1];
11873 var fetchData = /*#__PURE__*/ function() {
11874 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(_ref) {
11875 var page;
11876 var limit;
11877 return import_regenerator$2.default.wrap(function(_context) {
11878 while (1) switch (_context.prev = _context.next) {
11879 case 0:
11880 page = _ref.page, limit = _ref.limit;
11881 return _context.abrupt("return", new Promise(function(resolve, reject) {
11882 setIsLoading(true);
11883 getHistory(historyType, page, limit).then(function(response) {
11884 var clone = JSON.parse(JSON.stringify(data));
11885 clone.meta = response.meta;
11886 clone.items = [].concat(_toConsumableArray((clone === null || clone === void 0 ? void 0 : clone.items) || []), _toConsumableArray(normalizeItems(response)));
11887 setData(clone);
11888 resolve(true);
11889 }).catch(function(err) {
11890 var finalError = (err === null || err === void 0 ? void 0 : err.responseText) || err;
11891 setError(finalError);
11892 reject(finalError);
11893 }).finally(function() {
11894 return setIsLoading(false);
11895 });
11896 }));
11897 case 1:
11898 case "end": return _context.stop();
11899 }
11900 }, _callee);
11901 }));
11902 return function fetchData(_x) {
11903 return _ref2.apply(this, arguments);
11904 };
11905 }();
11906 return {
11907 isLoading,
11908 error,
11909 items: data.items,
11910 meta: data.meta,
11911 fetchData,
11912 deleteItemById: function deleteItemById(id) {
11913 var itemIndex = data.items.findIndex(function(item) {
11914 return item.id === id;
11915 });
11916 if (-1 === itemIndex) return false;
11917 var clone = JSON.parse(JSON.stringify(data));
11918 clone.items.splice(itemIndex, 1);
11919 setData(clone);
11920 return true;
11921 }
11922 };
11923 };
11924
11925 //#endregion
11926 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-header.js
11927 var StyledContent$2 = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref) {
11928 var theme = _ref.theme;
11929 return {
11930 marginTop: 0,
11931 padding: theme.spacing(1.5),
11932 borderBottom: "1px solid ".concat(theme.palette.action.focus),
11933 display: "flex",
11934 alignItems: "center",
11935 justifyContent: "space-between"
11936 };
11937 });
11938 var PromptHistoryModalHeader = function PromptHistoryModalHeader(_ref2) {
11939 var onClose = _ref2.onClose;
11940 return /*#__PURE__*/ react.default.createElement(StyledContent$2, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
11941 fontWeight: "bolder",
11942 variant: "h6",
11943 sx: { userSelect: "none" }
11944 }, (0, _wordpress_i18n.__)("History", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
11945 size: "small",
11946 "aria-label": (0, _wordpress_i18n.__)("Hide prompt history", "elementor"),
11947 onClick: onClose
11948 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.XIcon, { fontSize: "small" })));
11949 };
11950 PromptHistoryModalHeader.propTypes = { onClose: import_prop_types$8.default.func.isRequired };
11951
11952 //#endregion
11953 //#region modules/ai/assets/js/editor/hooks/use-delete-prompt-history-item.js
11954 init_asyncToGenerator();
11955 init_slicedToArray();
11956 init_api();
11957 var useDeletePromptHistoryItem = function useDeletePromptHistoryItem() {
11958 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
11959 var isLoading = _useState2[0];
11960 var setIsLoading = _useState2[1];
11961 var _useState4 = _slicedToArray((0, react.useState)(""), 2);
11962 var error = _useState4[0];
11963 var setError = _useState4[1];
11964 return {
11965 isLoading,
11966 error,
11967 deleteItem: /* @__PURE__ */ function() {
11968 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(id) {
11969 return import_regenerator$2.default.wrap(function(_context) {
11970 while (1) switch (_context.prev = _context.next) {
11971 case 0: return _context.abrupt("return", new Promise(function(resolve, reject) {
11972 setError("");
11973 setIsLoading(true);
11974 deleteHistoryItem(id).then(function() {
11975 resolve(true);
11976 }).catch(function(err) {
11977 var finalError = (err === null || err === void 0 ? void 0 : err.responseText) || err;
11978 setError(finalError);
11979 reject(finalError);
11980 }).finally(function() {
11981 return setIsLoading(false);
11982 });
11983 }));
11984 case 1:
11985 case "end": return _context.stop();
11986 }
11987 }, _callee);
11988 }));
11989 return function deleteItem(_x) {
11990 return _ref.apply(this, arguments);
11991 };
11992 }()
11993 };
11994 };
11995
11996 //#endregion
11997 //#region modules/ai/assets/js/editor/helpers/date-helpers.js
11998 /**
11999 * Formats a date (like wp_date() in PHP), translating it into site's locale.
12000 *
12001 * @param {string} format PHP-style formatting string.
12002 * @param {Date | string | undefined} date Date object
12003 * @param {string | number | undefined=} timezone Timezone to output result in or a UTC offset. Defaults to timezone from site.
12004 * @return {string}
12005 */
12006 var translateDate = function translateDate(format, date, timezone) {
12007 var _window$wp;
12008 if ((_window$wp = window.wp) !== null && _window$wp !== void 0 && _window$wp.date) {
12009 var _window$wp2;
12010 var dateI18n = ((_window$wp2 = window.wp) === null || _window$wp2 === void 0 ? void 0 : _window$wp2.date).dateI18n;
12011 return dateI18n(format, date, timezone);
12012 }
12013 return date;
12014 };
12015 /**
12016 * Returns difference in days between two dates
12017 *
12018 * @param {Date} firstDate
12019 * @param {Date} secondDate
12020 * @return {number} Positive or negative number in days
12021 */
12022 var daysDiff = function daysDiff(firstDate, secondDate) {
12023 var MS_PER_DAY = 1e3 * 60 * 60 * 24;
12024 var firstUTC = Date.UTC(firstDate.getFullYear(), firstDate.getMonth(), firstDate.getDate());
12025 var secondUTC = Date.UTC(secondDate.getFullYear(), secondDate.getMonth(), secondDate.getDate());
12026 return Math.floor((secondUTC - firstUTC) / MS_PER_DAY);
12027 };
12028
12029 //#endregion
12030 //#region modules/ai/assets/js/editor/icons/restore-icon.js
12031 init_extends();
12032 var RestoreIcon = react.default.forwardRef(function(props, ref) {
12033 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
12034 fillRule: "evenodd",
12035 d: "M11.913 3.22a8.781 8.781 0 0 1 3.367.634.75.75 0 1 1-.56 1.392A7.281 7.281 0 0 0 8.25 18.24V15a.75.75 0 0 1 1.5 0v4.433a.73.73 0 0 1 0 .034V20a.75.75 0 0 1-.75.75H4a.75.75 0 0 1 0-1.5h3.045a8.782 8.782 0 0 1 4.868-16.03ZM18.37 6.41a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-1.5 0v-.01a.75.75 0 0 1 .75-.75ZM13 19.19a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-1.5 0v-.01a.75.75 0 0 1 .75-.75ZM16.84 17.62a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-1.5 0v-.01a.75.75 0 0 1 .75-.75ZM19.37 14.35a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-1.5 0v-.01a.75.75 0 0 1 .75-.75ZM19.94 10.25a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-1.5 0V11a.75.75 0 0 1 .75-.75Z",
12036 clipRule: "evenodd"
12037 }));
12038 });
12039
12040 //#endregion
12041 //#region modules/ai/assets/js/editor/components/tooltip.js
12042 init_extends();
12043 init_objectWithoutProperties$1();
12044 var _excluded$11 = ["children"];
12045 var Tooltip$2 = function Tooltip(_ref) {
12046 var children = _ref.children;
12047 var props = _objectWithoutProperties$1(_ref, _excluded$11);
12048 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, _extends$1({ componentsProps: { tooltip: { sx: {
12049 "&.MuiTooltip-tooltip[class*=\"MuiTooltip-tooltipPlacement\"]": {
12050 m: 0,
12051 fontSize: "10px",
12052 fontWeight: 500,
12053 lineHeight: "1.4em"
12054 },
12055 py: .5,
12056 px: 1
12057 } } } }, props), children);
12058 };
12059 Tooltip$2.propTypes = { children: import_prop_types$8.default.oneOfType([import_prop_types$8.default.arrayOf(import_prop_types$8.default.node), import_prop_types$8.default.node]) };
12060
12061 //#endregion
12062 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item-action-button.js
12063 init_extends();
12064 init_objectWithoutProperties$1();
12065 var _excluded$10 = ["tooltipTitle"];
12066 var ActionButton = function ActionButton(_ref) {
12067 var tooltipTitle = _ref.tooltipTitle;
12068 var props = _objectWithoutProperties$1(_ref, _excluded$10);
12069 return /*#__PURE__*/ react.default.createElement(Tooltip$2, {
12070 title: tooltipTitle,
12071 placement: "top"
12072 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, _extends$1({
12073 type: "button",
12074 size: "small",
12075 disableRipple: true,
12076 disableFocusRipple: true,
12077 disableTouchRipple: true
12078 }, props)));
12079 };
12080 ActionButton.propTypes = { tooltipTitle: import_prop_types$8.default.string.isRequired };
12081
12082 //#endregion
12083 //#region modules/ai/assets/js/editor/icons/text-icon.js
12084 init_extends();
12085 var TextIcon = react.default.forwardRef(function(props, ref) {
12086 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
12087 fillRule: "evenodd",
12088 d: "M4.25 5A.75.75 0 0 1 5 4.25h14a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0V5.75H5.75V7a.75.75 0 0 1-1.5 0V5Z",
12089 clipRule: "evenodd"
12090 }), /*#__PURE__*/ react.default.createElement("path", {
12091 fillRule: "evenodd",
12092 d: "M12 4.25a.75.75 0 0 1 .75.75v14a.75.75 0 0 1-1.5 0V5a.75.75 0 0 1 .75-.75Z",
12093 clipRule: "evenodd"
12094 }), /*#__PURE__*/ react.default.createElement("path", {
12095 fillRule: "evenodd",
12096 d: "M9.25 19a.75.75 0 0 1 .75-.75h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1-.75-.75Z",
12097 clipRule: "evenodd"
12098 }));
12099 });
12100
12101 //#endregion
12102 //#region modules/ai/assets/js/editor/icons/code-icon.js
12103 init_extends();
12104 var CodeIcon = react.default.forwardRef(function(props, ref) {
12105 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
12106 fillRule: "evenodd",
12107 d: "M7.53 7.47a.75.75 0 0 1 0 1.06L4.06 12l3.47 3.47a.75.75 0 1 1-1.06 1.06l-4-4a.75.75 0 0 1 0-1.06l4-4a.75.75 0 0 1 1.06 0ZM16.47 7.47a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 1 1-1.06-1.06L19.94 12l-3.47-3.47a.75.75 0 0 1 0-1.06ZM14.182 3.272a.75.75 0 0 1 .546.91l-4 16a.75.75 0 0 1-1.456-.364l4-16a.75.75 0 0 1 .91-.546Z",
12108 clipRule: "evenodd"
12109 }));
12110 });
12111
12112 //#endregion
12113 //#region modules/ai/assets/js/editor/components/prompt-history/parts/action-icon.js
12114 var FALLBACK_ICON = /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { "data-testid": "e-ph-fi" });
12115 var ICONS_BY_ACTIONS = Object.freeze({
12116 "enhance-image-prompt": /*#__PURE__*/ react.default.createElement(TextIcon, null),
12117 "get-text": /*#__PURE__*/ react.default.createElement(TextIcon, null),
12118 "edit-text": /*#__PURE__*/ react.default.createElement(TextIcon, null),
12119 "custom-css": /*#__PURE__*/ react.default.createElement(CodeIcon, null),
12120 "custom-code": /*#__PURE__*/ react.default.createElement(CodeIcon, null)
12121 });
12122 var PromptHistoryActionIcon = function PromptHistoryActionIcon(_ref) {
12123 var action = _ref.action;
12124 if (ICONS_BY_ACTIONS[action]) return ICONS_BY_ACTIONS[action];
12125 return FALLBACK_ICON;
12126 };
12127 PromptHistoryActionIcon.propTypes = { action: import_prop_types$8.default.string.isRequired };
12128
12129 //#endregion
12130 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item-title.js
12131 var _templateObject$4;
12132 var StyledTitle = (0, _elementor_ui.styled)(_elementor_ui.Typography)(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n"])), function(_ref) {
12133 return _ref.theme.spacing(.5);
12134 });
12135 var PromptHistoryItemTitle = function PromptHistoryItemTitle(_ref2) {
12136 var prompt = _ref2.prompt;
12137 return /*#__PURE__*/ react.default.createElement(Tooltip$2, {
12138 title: prompt,
12139 arrow: false,
12140 placement: "bottom-start"
12141 }, /*#__PURE__*/ react.default.createElement(StyledTitle, {
12142 variant: "body2",
12143 noWrap: true,
12144 paragraph: true
12145 }, prompt));
12146 };
12147 PromptHistoryItemTitle.propTypes = { prompt: import_prop_types$8.default.string.isRequired };
12148
12149 //#endregion
12150 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item-secondary-content.js
12151 var _templateObject$3;
12152 var _templateObject2$1;
12153 var StyledDateSubtitle = (0, _elementor_ui.styled)(_elementor_ui.Typography)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n color: ", ";\n"])), function(_ref) {
12154 return _ref.theme.palette.secondary.light;
12155 });
12156 var StyledImage = (0, _elementor_ui.styled)("img")(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n height: 72px;\n width: 72px;\n object-fit: cover;\n margin-right: ", ";\n"])), function(_ref2) {
12157 return _ref2.theme.spacing(.5);
12158 });
12159 var PromptHistoryItemSecondaryContent = function PromptHistoryItemSecondaryContent(_ref3) {
12160 var date = _ref3.date;
12161 var thumbnails = _ref3.thumbnails;
12162 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
12163 direction: "column",
12164 width: "90%"
12165 }, /*#__PURE__*/ react.default.createElement(StyledDateSubtitle, { variant: "caption" }, date), (thumbnails === null || thumbnails === void 0 ? void 0 : thumbnails.length) > 0 && /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
12166 flexDirection: "row",
12167 mt: 1
12168 }, thumbnails.map(
12169 /**
12170 * @param {Object} thumb
12171 * @return {React.ReactNode}
12172 */
12173 function(thumb) {
12174 return /*#__PURE__*/ react.default.createElement(StyledImage, {
12175 key: "thumbnail-".concat(thumb.seed),
12176 alt: "",
12177 src: thumb.image_url
12178 });
12179 }
12180 )));
12181 };
12182 PromptHistoryItemSecondaryContent.propTypes = {
12183 date: import_prop_types$8.default.string.isRequired,
12184 thumbnails: import_prop_types$8.default.array
12185 };
12186
12187 //#endregion
12188 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-item.js
12189 init_objectWithoutProperties$1();
12190 init_prompt_history_action_context();
12191 var _excluded$9 = [
12192 "id",
12193 "date",
12194 "onHistoryItemDelete"
12195 ];
12196 var _templateObject$2;
12197 var _templateObject2;
12198 var _templateObject3;
12199 var _templateObject4;
12200 var StyledListItem = (0, _elementor_ui.styled)(_elementor_ui.ListItem)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n & .e-prompt-history-item-actions {\n position: absolute;\n top: -9999px;\n }\n\n &:hover,\n &:focus-visible,\n &:focus-within {\n .MuiTypography-body2 {\n font-weight: 700;\n max-width: ", ";\n }\n\n .e-prompt-history-item-actions {\n position: relative;\n top: -3px;\n }\n }\n"])), function(_ref) {
12201 var actionsCount = _ref.actionsCount;
12202 return "calc(100% - ".concat(actionsCount, " * 26px)");
12203 });
12204 var StyledListItemButton = (0, _elementor_ui.styled)(_elementor_ui.ListItemButton)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", ";\n align-items: flex-start;\n cursor: inherit;\n"])), function(_ref2) {
12205 return _ref2.theme.spacing(.5, 2);
12206 });
12207 var StyledListItemIcon = (0, _elementor_ui.styled)(_elementor_ui.ListItemIcon)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([
12208 "\n min-width: auto;\n\n & > .MuiSvgIcon-root {\n margin-right: ",
12209 ";\n font-size: 1rem;\n position: relative;\n top: ",
12210 ";\n }\n"
12211 ])), function(_ref3) {
12212 return _ref3.theme.spacing(1.5);
12213 }, function(_ref4) {
12214 return _ref4.theme.spacing(.5);
12215 });
12216 var StyledButtonsWrapper = (0, _elementor_ui.styled)(_elementor_ui.Box)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n & .MuiSvgIcon-root {\n font-size: 1rem;\n }\n"])));
12217 var PromptHistoryItem = function PromptHistoryItem(_ref5) {
12218 var id = _ref5.id;
12219 var date = _ref5.date;
12220 var onHistoryItemDelete = _ref5.onHistoryItemDelete;
12221 var props = _objectWithoutProperties$1(_ref5, _excluded$9);
12222 var _usePromptHistoryActi = usePromptHistoryAction();
12223 var getAllowedActions = _usePromptHistoryActi.getAllowedActions;
12224 var onPromptReuse = _usePromptHistoryActi.onPromptReuse;
12225 var onResultEdit = _usePromptHistoryActi.onResultEdit;
12226 var onImagesRestore = _usePromptHistoryActi.onImagesRestore;
12227 var action = props.action;
12228 var prompt = props.prompt;
12229 var text = props.text;
12230 var images = props.images;
12231 var thumbnails = props.thumbnails;
12232 var imageType = props.imageType;
12233 var ratio = props.ratio;
12234 var allowedActions = getAllowedActions();
12235 return /*#__PURE__*/ react.default.createElement(StyledListItem, {
12236 tabIndex: "0",
12237 "data-testid": "e-ph-i",
12238 disableGutters: true,
12239 disablePadding: true,
12240 actionsCount: Object.keys(allowedActions).length
12241 }, /*#__PURE__*/ react.default.createElement(StyledListItemButton, {
12242 component: "div",
12243 role: void 0
12244 }, /*#__PURE__*/ react.default.createElement(StyledListItemIcon, null, /*#__PURE__*/ react.default.createElement(PromptHistoryActionIcon, { action })), /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemText, {
12245 disableTypography: true,
12246 primary: /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
12247 direction: "row",
12248 justifyContent: "space-between",
12249 alignItems: "center",
12250 height: "16px"
12251 }, /*#__PURE__*/ react.default.createElement(PromptHistoryItemTitle, { prompt }), /*#__PURE__*/ react.default.createElement(StyledButtonsWrapper, { className: "e-prompt-history-item-actions" }, allowedActions[ACTION_TYPES.REMOVE] && /*#__PURE__*/ react.default.createElement(ActionButton, {
12252 onClick: function onClick() {
12253 return onHistoryItemDelete(id);
12254 },
12255 "aria-label": (0, _wordpress_i18n.__)("Remove item", "elementor"),
12256 tooltipTitle: (0, _wordpress_i18n.__)("Remove", "elementor")
12257 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.TrashIcon, null)), allowedActions[ACTION_TYPES.REUSE] && /*#__PURE__*/ react.default.createElement(ActionButton, {
12258 onClick: function onClick() {
12259 return onPromptReuse(id, prompt);
12260 },
12261 "aria-label": (0, _wordpress_i18n.__)("Reuse prompt", "elementor"),
12262 tooltipTitle: (0, _wordpress_i18n.__)("Reuse prompt", "elementor")
12263 }, /*#__PURE__*/ react.default.createElement(RefreshIcon, null)), allowedActions[ACTION_TYPES.RESTORE] && /*#__PURE__*/ react.default.createElement(ActionButton, {
12264 onClick: function onClick() {
12265 return onImagesRestore(id, {
12266 prompt,
12267 images,
12268 imageType,
12269 ratio
12270 });
12271 },
12272 "aria-label": (0, _wordpress_i18n.__)("Restore", "elementor"),
12273 tooltipTitle: (0, _wordpress_i18n.__)("Restore", "elementor")
12274 }, /*#__PURE__*/ react.default.createElement(RestoreIcon, null)), allowedActions[ACTION_TYPES.EDIT] && /*#__PURE__*/ react.default.createElement(ActionButton, {
12275 onClick: function onClick() {
12276 return onResultEdit(id, text);
12277 },
12278 "aria-label": (0, _wordpress_i18n.__)("Edit result", "elementor"),
12279 tooltipTitle: (0, _wordpress_i18n.__)("Edit", "elementor")
12280 }, /*#__PURE__*/ react.default.createElement(EditIcon$1, null)))),
12281 secondary: /*#__PURE__*/ react.default.createElement(PromptHistoryItemSecondaryContent, {
12282 date,
12283 thumbnails
12284 })
12285 })));
12286 };
12287 PromptHistoryItem.propTypes = {
12288 id: import_prop_types$8.default.string.isRequired,
12289 action: import_prop_types$8.default.string.isRequired,
12290 prompt: import_prop_types$8.default.string.isRequired,
12291 date: import_prop_types$8.default.string.isRequired,
12292 onHistoryItemDelete: import_prop_types$8.default.func.isRequired,
12293 text: import_prop_types$8.default.string,
12294 images: import_prop_types$8.default.array,
12295 thumbnails: import_prop_types$8.default.array,
12296 imageType: import_prop_types$8.default.string,
12297 ratio: import_prop_types$8.default.string
12298 };
12299
12300 //#endregion
12301 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-period.js
12302 init_extends();
12303 init_objectWithoutProperties$1();
12304 var _excluded$8 = ["id", "date"];
12305 var StyledPeriodList = (0, _elementor_ui.styled)(_elementor_ui.List)(function(_ref) {
12306 var theme = _ref.theme;
12307 return { borderBottom: "1px solid ".concat(theme.palette.action.focus) };
12308 });
12309 var StyledPeriodTitle = (0, _elementor_ui.styled)(_elementor_ui.Typography)(function(_ref2) {
12310 var theme = _ref2.theme;
12311 return {
12312 padding: theme.spacing(1.5, 2),
12313 color: theme.palette.secondary.light
12314 };
12315 });
12316 var DATE_FORMAT = (0, _wordpress_i18n.__)("F j, g:i A", "elementor");
12317 var PromptHistoryPeriod = function PromptHistoryPeriod(_ref3) {
12318 var periodTitle = _ref3.periodTitle;
12319 var historyItems = _ref3.historyItems;
12320 var _onHistoryItemDelete = _ref3.onHistoryItemDelete;
12321 return /*#__PURE__*/ react.default.createElement(StyledPeriodList, {
12322 "data-testid": "e-ph-p",
12323 subheader: /*#__PURE__*/ react.default.createElement(_elementor_ui.ListSubheader, {
12324 disableSticky: true,
12325 disableGutters: true
12326 }, /*#__PURE__*/ react.default.createElement(StyledPeriodTitle, {
12327 variant: "body2",
12328 role: "heading",
12329 "aria-level": "6"
12330 }, periodTitle))
12331 }, historyItems.map(function(_ref4) {
12332 var id = _ref4.id;
12333 var date = _ref4.date;
12334 var props = _objectWithoutProperties$1(_ref4, _excluded$8);
12335 return /*#__PURE__*/ react.default.createElement(PromptHistoryItem, _extends$1({
12336 key: id,
12337 date: translateDate(DATE_FORMAT, date),
12338 onHistoryItemDelete: function onHistoryItemDelete() {
12339 return _onHistoryItemDelete(id);
12340 },
12341 id
12342 }, props));
12343 }));
12344 };
12345 PromptHistoryPeriod.propTypes = {
12346 periodTitle: import_prop_types$8.default.string.isRequired,
12347 historyItems: import_prop_types$8.default.array.isRequired,
12348 onHistoryItemDelete: import_prop_types$8.default.func.isRequired
12349 };
12350
12351 //#endregion
12352 //#region modules/ai/assets/js/editor/components/prompt-history/helpers/history-period-helpers.js
12353 init_defineProperty$1();
12354 function _createForOfIteratorHelper(r, e) {
12355 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
12356 if (!t) {
12357 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
12358 t && (r = t);
12359 var _n = 0;
12360 var F = function F() {};
12361 return {
12362 s: F,
12363 n: function n() {
12364 return _n >= r.length ? { done: !0 } : {
12365 done: !1,
12366 value: r[_n++]
12367 };
12368 },
12369 e: function e(r) {
12370 throw r;
12371 },
12372 f: F
12373 };
12374 }
12375 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12376 }
12377 var o;
12378 var a = !0;
12379 var u = !1;
12380 return {
12381 s: function s() {
12382 t = t.call(r);
12383 },
12384 n: function n() {
12385 var r = t.next();
12386 return a = r.done, r;
12387 },
12388 e: function e(r) {
12389 u = !0, o = r;
12390 },
12391 f: function f() {
12392 try {
12393 a || null == t.return || t.return();
12394 } finally {
12395 if (u) throw o;
12396 }
12397 }
12398 };
12399 }
12400 function _unsupportedIterableToArray(r, a) {
12401 if (r) {
12402 if ("string" == typeof r) return _arrayLikeToArray(r, a);
12403 var t = {}.toString.call(r).slice(8, -1);
12404 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
12405 }
12406 }
12407 function _arrayLikeToArray(r, a) {
12408 (null == a || a > r.length) && (a = r.length);
12409 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
12410 return n;
12411 }
12412 var DATE_KEY = "date";
12413 var LAST_7_DAYS_KEY = "7-days";
12414 var LAST_30_DAYS_KEY = "30-days";
12415 var MONTH_FORMAT = (0, _wordpress_i18n.__)("F", "elementor");
12416 /**
12417 * Sorts items in ascending order by date.
12418 *
12419 * @param {Array} historyData
12420 * @return {Array}
12421 */
12422 var sortPromptHistoryData = function sortPromptHistoryData(historyData) {
12423 return _toConsumableArray(historyData).sort(function(a, b) {
12424 return new Date(b[DATE_KEY]) - new Date(a[DATE_KEY]);
12425 });
12426 };
12427 /**
12428 * Groups prompt history data by time periods.
12429 *
12430 * @param {Array} historyData
12431 * @return {Object.<string, {label: string, items: any[]}>}
12432 */
12433 var groupPromptHistoryData = function groupPromptHistoryData(historyData) {
12434 var data = sortPromptHistoryData(historyData);
12435 var currentDate = /* @__PURE__ */ new Date();
12436 var result = _defineProperty$1(_defineProperty$1({}, LAST_7_DAYS_KEY, {
12437 label: (0, _wordpress_i18n.__)("Last 7 days", "elementor"),
12438 items: []
12439 }), LAST_30_DAYS_KEY, {
12440 label: (0, _wordpress_i18n.__)("Last 30 days", "elementor"),
12441 items: []
12442 });
12443 var _iterator = _createForOfIteratorHelper(data);
12444 var _step;
12445 try {
12446 for (_iterator.s(); !(_step = _iterator.n()).done;) {
12447 var item = _step.value;
12448 var date = new Date(item[DATE_KEY]);
12449 var diff = daysDiff(date, currentDate);
12450 if (diff <= 7) {
12451 result[LAST_7_DAYS_KEY].items.push(item);
12452 continue;
12453 }
12454 if (diff <= 30) {
12455 result[LAST_30_DAYS_KEY].items.push(item);
12456 continue;
12457 }
12458 var month = date.getMonth();
12459 if (!result[month]) result[month] = {
12460 label: translateDate(MONTH_FORMAT, date),
12461 items: []
12462 };
12463 result[month].items.push(item);
12464 }
12465 } catch (err) {
12466 _iterator.e(err);
12467 } finally {
12468 _iterator.f();
12469 }
12470 return result;
12471 };
12472 var renderPeriods = function renderPeriods(_ref) {
12473 var _groupData$LAST_7_DAY;
12474 var _groupData$LAST_30_DA;
12475 var items = _ref.items;
12476 var onDelete = _ref.onDelete;
12477 var groupData = groupPromptHistoryData(items);
12478 var periods = [];
12479 if ((_groupData$LAST_7_DAY = groupData["7-days"]) !== null && _groupData$LAST_7_DAY !== void 0 && (_groupData$LAST_7_DAY = _groupData$LAST_7_DAY.items) !== null && _groupData$LAST_7_DAY !== void 0 && _groupData$LAST_7_DAY.length) periods.push(/*#__PURE__*/ react.default.createElement(PromptHistoryPeriod, {
12480 periodTitle: groupData[LAST_7_DAYS_KEY].label,
12481 onHistoryItemDelete: onDelete,
12482 historyItems: groupData[LAST_7_DAYS_KEY].items
12483 }));
12484 if ((_groupData$LAST_30_DA = groupData["30-days"]) !== null && _groupData$LAST_30_DA !== void 0 && (_groupData$LAST_30_DA = _groupData$LAST_30_DA.items) !== null && _groupData$LAST_30_DA !== void 0 && _groupData$LAST_30_DA.length) periods.push(/*#__PURE__*/ react.default.createElement(PromptHistoryPeriod, {
12485 periodTitle: groupData[LAST_30_DAYS_KEY].label,
12486 onHistoryItemDelete: onDelete,
12487 historyItems: groupData[LAST_30_DAYS_KEY].items
12488 }));
12489 for (var i = 12; i >= 0; i--) if (groupData[i]) periods.push(/*#__PURE__*/ react.default.createElement(PromptHistoryPeriod, {
12490 periodTitle: groupData[i].label,
12491 onHistoryItemDelete: onDelete,
12492 historyItems: groupData[i].items
12493 }));
12494 return periods;
12495 };
12496
12497 //#endregion
12498 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-empty.js
12499 init_history_types();
12500 var PromptHistoryEmpty = function PromptHistoryEmpty(_ref) {
12501 var historyType = _ref.historyType;
12502 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
12503 justifyContent: "center",
12504 sx: {
12505 height: "100%",
12506 textAlign: "center"
12507 },
12508 "data-testid": "e-ph-empty"
12509 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "h6" }, (0, _wordpress_i18n.__)("Prepare to be amazed", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body1" }, (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("This is where you'll find all the %s you've generated using Elementor AI.", "elementor"), getTranslatedPromptHistoryType(historyType))));
12510 };
12511 PromptHistoryEmpty.propTypes = { historyType: import_prop_types$8.default.oneOf(Object.values(HISTORY_TYPES)).isRequired };
12512
12513 //#endregion
12514 //#region node_modules/react-infinite-scroller/src/InfiniteScroll.js
12515 init_objectWithoutProperties();
12516 init_defineProperty();
12517 var _excluded$7 = [
12518 "children",
12519 "element",
12520 "hasMore",
12521 "initialLoad",
12522 "isReverse",
12523 "loader",
12524 "loadMore",
12525 "pageStart",
12526 "ref",
12527 "threshold",
12528 "useCapture",
12529 "useWindow",
12530 "getScrollParent"
12531 ];
12532 var InfiniteScroll = class extends react.Component {
12533 constructor(props) {
12534 super(props);
12535 this.scrollListener = this.scrollListener.bind(this);
12536 this.eventListenerOptions = this.eventListenerOptions.bind(this);
12537 this.mousewheelListener = this.mousewheelListener.bind(this);
12538 }
12539 componentDidMount() {
12540 this.pageLoaded = this.props.pageStart;
12541 this.options = this.eventListenerOptions();
12542 this.attachScrollListener();
12543 }
12544 componentDidUpdate() {
12545 if (this.props.isReverse && this.loadMore) {
12546 const parentElement = this.getParentElement(this.scrollComponent);
12547 parentElement.scrollTop = parentElement.scrollHeight - this.beforeScrollHeight + this.beforeScrollTop;
12548 this.loadMore = false;
12549 }
12550 this.attachScrollListener();
12551 }
12552 componentWillUnmount() {
12553 this.detachScrollListener();
12554 this.detachMousewheelListener();
12555 }
12556 isPassiveSupported() {
12557 let passive = false;
12558 const testOptions = { get passive() {
12559 passive = true;
12560 } };
12561 try {
12562 document.addEventListener("test", null, testOptions);
12563 document.removeEventListener("test", null, testOptions);
12564 } catch (e) {}
12565 return passive;
12566 }
12567 eventListenerOptions() {
12568 let options = this.props.useCapture;
12569 if (this.isPassiveSupported()) options = {
12570 useCapture: this.props.useCapture,
12571 passive: true
12572 };
12573 else options = { passive: false };
12574 return options;
12575 }
12576 setDefaultLoader(loader) {
12577 this.defaultLoader = loader;
12578 }
12579 detachMousewheelListener() {
12580 let scrollEl = window;
12581 if (this.props.useWindow === false) scrollEl = this.scrollComponent.parentNode;
12582 scrollEl.removeEventListener("mousewheel", this.mousewheelListener, this.options ? this.options : this.props.useCapture);
12583 }
12584 detachScrollListener() {
12585 let scrollEl = window;
12586 if (this.props.useWindow === false) scrollEl = this.getParentElement(this.scrollComponent);
12587 scrollEl.removeEventListener("scroll", this.scrollListener, this.options ? this.options : this.props.useCapture);
12588 scrollEl.removeEventListener("resize", this.scrollListener, this.options ? this.options : this.props.useCapture);
12589 }
12590 getParentElement(el) {
12591 const scrollParent = this.props.getScrollParent && this.props.getScrollParent();
12592 if (scrollParent != null) return scrollParent;
12593 return el && el.parentNode;
12594 }
12595 filterProps(props) {
12596 return props;
12597 }
12598 attachScrollListener() {
12599 const parentElement = this.getParentElement(this.scrollComponent);
12600 if (!this.props.hasMore || !parentElement) return;
12601 let scrollEl = window;
12602 if (this.props.useWindow === false) scrollEl = parentElement;
12603 scrollEl.addEventListener("mousewheel", this.mousewheelListener, this.options ? this.options : this.props.useCapture);
12604 scrollEl.addEventListener("scroll", this.scrollListener, this.options ? this.options : this.props.useCapture);
12605 scrollEl.addEventListener("resize", this.scrollListener, this.options ? this.options : this.props.useCapture);
12606 if (this.props.initialLoad) this.scrollListener();
12607 }
12608 mousewheelListener(e) {
12609 if (e.deltaY === 1 && !this.isPassiveSupported()) e.preventDefault();
12610 }
12611 scrollListener() {
12612 const el = this.scrollComponent;
12613 const scrollEl = window;
12614 const parentNode = this.getParentElement(el);
12615 let offset;
12616 if (this.props.useWindow) {
12617 const doc = document.documentElement || document.body.parentNode || document.body;
12618 const scrollTop = scrollEl.pageYOffset !== void 0 ? scrollEl.pageYOffset : doc.scrollTop;
12619 if (this.props.isReverse) offset = scrollTop;
12620 else offset = this.calculateOffset(el, scrollTop);
12621 } else if (this.props.isReverse) offset = parentNode.scrollTop;
12622 else offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight;
12623 if (offset < Number(this.props.threshold) && el && el.offsetParent !== null) {
12624 this.detachScrollListener();
12625 this.beforeScrollHeight = parentNode.scrollHeight;
12626 this.beforeScrollTop = parentNode.scrollTop;
12627 if (typeof this.props.loadMore === "function") {
12628 this.props.loadMore(this.pageLoaded += 1);
12629 this.loadMore = true;
12630 }
12631 }
12632 }
12633 calculateOffset(el, scrollTop) {
12634 if (!el) return 0;
12635 return this.calculateTopPosition(el) + (el.offsetHeight - scrollTop - window.innerHeight);
12636 }
12637 calculateTopPosition(el) {
12638 if (!el) return 0;
12639 return el.offsetTop + this.calculateTopPosition(el.offsetParent);
12640 }
12641 render() {
12642 const renderProps = this.filterProps(this.props);
12643 const { children, element, hasMore, initialLoad, isReverse, loader, loadMore, pageStart, ref, threshold, useCapture, useWindow, getScrollParent } = renderProps, props = _objectWithoutProperties(renderProps, _excluded$7);
12644 props.ref = (node) => {
12645 this.scrollComponent = node;
12646 if (ref) ref(node);
12647 };
12648 const childrenArray = [children];
12649 if (hasMore) {
12650 if (loader) isReverse ? childrenArray.unshift(loader) : childrenArray.push(loader);
12651 else if (this.defaultLoader) isReverse ? childrenArray.unshift(this.defaultLoader) : childrenArray.push(this.defaultLoader);
12652 }
12653 return react.default.createElement(element, props, childrenArray);
12654 }
12655 };
12656 _defineProperty(InfiniteScroll, "propTypes", {
12657 children: import_prop_types$8.default.node.isRequired,
12658 element: import_prop_types$8.default.node,
12659 hasMore: import_prop_types$8.default.bool,
12660 initialLoad: import_prop_types$8.default.bool,
12661 isReverse: import_prop_types$8.default.bool,
12662 loader: import_prop_types$8.default.node,
12663 loadMore: import_prop_types$8.default.func.isRequired,
12664 pageStart: import_prop_types$8.default.number,
12665 ref: import_prop_types$8.default.func,
12666 getScrollParent: import_prop_types$8.default.func,
12667 threshold: import_prop_types$8.default.number,
12668 useCapture: import_prop_types$8.default.bool,
12669 useWindow: import_prop_types$8.default.bool
12670 });
12671 _defineProperty(InfiniteScroll, "defaultProps", {
12672 element: "div",
12673 hasMore: false,
12674 initialLoad: true,
12675 pageStart: 0,
12676 ref: null,
12677 threshold: 250,
12678 useWindow: true,
12679 isReverse: false,
12680 useCapture: false,
12681 loader: null,
12682 getScrollParent: null
12683 });
12684
12685 //#endregion
12686 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-upgrade.js
12687 init_defineProperty$1();
12688 init_history_types();
12689 var VARIANT_FULL = "full";
12690 var VARIANT_SMALL = "small";
12691 var messages = _defineProperty$1(_defineProperty$1({}, VARIANT_FULL, (0, _wordpress_i18n.__)("Want to see your %s generation history for as far as the past 90 days?", "elementor")), VARIANT_SMALL, (0, _wordpress_i18n.__)("Want to see your %s generation history for the past 90 days?", "elementor"));
12692 var actionUrl = "https://go.elementor.com/ai-popup-purchase-dropdown/";
12693 var getMessage = function getMessage(variant, historyType) {
12694 return (0, _wordpress_i18n.sprintf)(messages[variant] || messages[VARIANT_FULL], getTranslatedPromptHistoryType(historyType));
12695 };
12696 var PromptHistoryUpgrade = function PromptHistoryUpgrade(_ref) {
12697 var variant = _ref.variant;
12698 var historyType = _ref.historyType;
12699 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
12700 justifyContent: "center",
12701 sx: {
12702 height: VARIANT_SMALL === variant ? "auto" : "100%",
12703 textAlign: "center",
12704 p: 2
12705 },
12706 "data-testid": "e-ph-upgrade-".concat(variant)
12707 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
12708 variant: "body1",
12709 sx: { marginBottom: 2 }
12710 }, getMessage(variant, historyType)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
12711 variant: "contained",
12712 color: "promotion",
12713 size: "small",
12714 href: actionUrl,
12715 target: "_blank",
12716 rel: "noopener noreferrer",
12717 startIcon: /*#__PURE__*/ react.default.createElement(_elementor_icons.UpgradeIcon, null),
12718 sx: {
12719 width: "50%",
12720 alignSelf: "center",
12721 "&:hover": { color: "promotion.contrastText" }
12722 }
12723 }, (0, _wordpress_i18n.__)("Upgrade now", "elementor")));
12724 };
12725 PromptHistoryUpgrade.propTypes = {
12726 variant: import_prop_types$8.default.oneOf([VARIANT_FULL, VARIANT_SMALL]).isRequired,
12727 historyType: import_prop_types$8.default.oneOf(Object.values(HISTORY_TYPES)).isRequired
12728 };
12729
12730 //#endregion
12731 //#region modules/ai/assets/js/editor/components/prompt-history/parts/modal-container.js
12732 init_extends();
12733 init_objectWithoutProperties$1();
12734 init_prompt_history_context();
12735 var _excluded$6 = ["children"];
12736 var _templateObject$1;
12737 var StyledContent$1 = (0, _elementor_ui.styled)(_elementor_ui.Box)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral([
12738 "\n width: 360px;\n position: relative;\n margin-top: ",
12739 ";\n margin-right: ",
12740 ";\n background-color: ",
12741 ";\n border-radius: ",
12742 ";\n height: ",
12743 ";\n\n @media screen and (max-width: 456px) {\n width: 320px;\n }\n\n @media screen and (max-width: 420px) {\n width: 230px;\n }\n"
12744 ])), function(_ref) {
12745 return _ref.theme.spacing(2);
12746 }, function(_ref2) {
12747 return _ref2.theme.spacing(2);
12748 }, function(_ref3) {
12749 return _ref3.theme.palette.background.paper;
12750 }, function(_ref4) {
12751 var theme = _ref4.theme;
12752 return "".concat(theme.shape.borderRadius, "px");
12753 }, function(_ref5) {
12754 var height = _ref5.height;
12755 return "calc( ".concat(height, "px - 32px )");
12756 });
12757 var ModalContainer = function ModalContainer(_ref6) {
12758 var children = _ref6.children;
12759 var props = _objectWithoutProperties$1(_ref6, _excluded$6);
12760 var _usePromptHistoryCont = usePromptHistoryContext();
12761 var isOpen = _usePromptHistoryCont.isOpen;
12762 var isModalOpen = _usePromptHistoryCont.isModalOpen;
12763 var onClose = _usePromptHistoryCont.onClose;
12764 var getContainerHeight = _usePromptHistoryCont.getContainerHeight;
12765 var getContainer = _usePromptHistoryCont.getContainer;
12766 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Modal, _extends$1({
12767 container: getContainer(),
12768 open: isModalOpen,
12769 hideBackdrop: true,
12770 onClose,
12771 sx: { position: "absolute" }
12772 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.Backdrop, {
12773 open: true,
12774 sx: {
12775 position: "absolute",
12776 justifyContent: "flex-end",
12777 alignItems: "flex-start"
12778 },
12779 "aria-hidden": false
12780 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Slide, {
12781 direction: "left",
12782 in: isOpen,
12783 timeout: 500,
12784 easing: "ease-in-out"
12785 }, /*#__PURE__*/ react.default.createElement(StyledContent$1, {
12786 "aria-label": (0, _wordpress_i18n.__)("Prompt history modal", "elementor"),
12787 height: getContainerHeight()
12788 }, children))));
12789 };
12790 ModalContainer.propTypes = {
12791 isOpen: import_prop_types$8.default.bool.isRequired,
12792 isModalOpen: import_prop_types$8.default.bool.isRequired,
12793 onClose: import_prop_types$8.default.func.isRequired,
12794 children: import_prop_types$8.default.oneOfType([import_prop_types$8.default.arrayOf(import_prop_types$8.default.node), import_prop_types$8.default.node])
12795 };
12796
12797 //#endregion
12798 //#region modules/ai/assets/js/editor/components/prompt-history/history-modal.js
12799 init_asyncToGenerator();
12800 init_prompt_error_message();
12801 init_prompt_history_context();
12802 var ITEMS_LIMIT = 10;
12803 var FREE_PLAN_ERRORS = ["invalid_connect_data", "no_subscription"];
12804 var PromptHistoryModal = function PromptHistoryModal(props) {
12805 var lastRun = (0, react.useRef)(function() {});
12806 var scrollContainer = (0, react.useRef)(null);
12807 var _usePromptHistoryCont = usePromptHistoryContext();
12808 var historyType = _usePromptHistoryCont.historyType;
12809 var onClose = _usePromptHistoryCont.onClose;
12810 var _usePromptHistory = usePromptHistory(historyType);
12811 var items = _usePromptHistory.items;
12812 var meta = _usePromptHistory.meta;
12813 var isHistoryFetchingInProgress = _usePromptHistory.isLoading;
12814 var historyFetchingError = _usePromptHistory.error;
12815 var fetchData = _usePromptHistory.fetchData;
12816 var deleteItemFromState = _usePromptHistory.deleteItemById;
12817 var _useDeletePromptHisto = useDeletePromptHistoryItem();
12818 var isDeletingInProgress = _useDeletePromptHisto.isLoading;
12819 var historyDeletingError = _useDeletePromptHisto.error;
12820 var deleteItem = _useDeletePromptHisto.deleteItem;
12821 var error = historyFetchingError || historyDeletingError;
12822 var isLoading = isHistoryFetchingInProgress || isDeletingInProgress;
12823 var isLastPage = meta && (meta === null || meta === void 0 ? void 0 : meta.currentPage) === (meta === null || meta === void 0 ? void 0 : meta.totalPages);
12824 var showUpgrade = (items === null || items === void 0 ? void 0 : items.length) > 0 && (meta === null || meta === void 0 ? void 0 : meta.allowedDays) < 90 && isLastPage;
12825 (0, react.useEffect)(function() {
12826 lastRun.current = /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
12827 return import_regenerator$2.default.wrap(function(_context) {
12828 while (1) switch (_context.prev = _context.next) {
12829 case 0: return _context.abrupt("return", fetchData({
12830 page: 1,
12831 limit: ITEMS_LIMIT
12832 }));
12833 case 1:
12834 case "end": return _context.stop();
12835 }
12836 }, _callee);
12837 }));
12838 lastRun.current();
12839 }, []);
12840 var loadNext = function loadNext() {
12841 if (isLoading || isLastPage) return;
12842 lastRun.current = /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee2() {
12843 return import_regenerator$2.default.wrap(function(_context2) {
12844 while (1) switch (_context2.prev = _context2.next) {
12845 case 0: return _context2.abrupt("return", fetchData({
12846 page: meta.currentPage + 1,
12847 limit: ITEMS_LIMIT
12848 }));
12849 case 1:
12850 case "end": return _context2.stop();
12851 }
12852 }, _callee2);
12853 }));
12854 lastRun.current();
12855 };
12856 var onHistoryItemDelete = /*#__PURE__*/ function() {
12857 var _ref3 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee4(id) {
12858 return import_regenerator$2.default.wrap(function(_context4) {
12859 while (1) switch (_context4.prev = _context4.next) {
12860 case 0:
12861 lastRun.current = /*#__PURE__*/ _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee3() {
12862 return import_regenerator$2.default.wrap(function(_context3) {
12863 while (1) switch (_context3.prev = _context3.next) {
12864 case 0:
12865 _context3.next = 1;
12866 return deleteItem(id);
12867 case 1: return _context3.abrupt("return", _context3.sent);
12868 case 2:
12869 case "end": return _context3.stop();
12870 }
12871 }, _callee3);
12872 }));
12873 _context4.next = 1;
12874 return lastRun.current();
12875 case 1: if (!historyDeletingError) deleteItemFromState(id);
12876 case 2:
12877 case "end": return _context4.stop();
12878 }
12879 }, _callee4);
12880 }));
12881 return function onHistoryItemDelete(_x) {
12882 return _ref3.apply(this, arguments);
12883 };
12884 }();
12885 return /*#__PURE__*/ react.default.createElement(ModalContainer, props, /*#__PURE__*/ react.default.createElement(PromptHistoryModalHeader, { onClose }), error && !FREE_PLAN_ERRORS.includes(error) && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, {
12886 error,
12887 onRetry: lastRun.current,
12888 sx: {
12889 position: "absolute",
12890 zIndex: 1,
12891 marginTop: isLoading ? .5 : "revert"
12892 }
12893 }), isLoading && /*#__PURE__*/ react.default.createElement(_elementor_ui.LinearProgress, {
12894 role: "progressbar",
12895 "aria-label": (0, _wordpress_i18n.__)("Loading", "elementor"),
12896 color: "secondary"
12897 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
12898 sx: {
12899 overflowY: "scroll",
12900 height: "85%"
12901 },
12902 ref: scrollContainer
12903 }, error && FREE_PLAN_ERRORS.includes(error) && /*#__PURE__*/ react.default.createElement(PromptHistoryUpgrade, {
12904 variant: "full",
12905 historyType
12906 }), !error && 0 === (items === null || items === void 0 ? void 0 : items.length) && /*#__PURE__*/ react.default.createElement(PromptHistoryEmpty, { historyType }), (items === null || items === void 0 ? void 0 : items.length) > 0 && /*#__PURE__*/ react.default.createElement(InfiniteScroll, {
12907 loadMore: loadNext,
12908 getScrollParent: function getScrollParent() {
12909 return scrollContainer.current;
12910 },
12911 useWindow: false,
12912 isReverse: false,
12913 threshold: 30,
12914 initialLoad: false,
12915 hasMore: !isLastPage
12916 }, renderPeriods({
12917 items,
12918 onDelete: onHistoryItemDelete
12919 })), showUpgrade && /*#__PURE__*/ react.default.createElement(PromptHistoryUpgrade, {
12920 variant: "small",
12921 historyType
12922 })));
12923 };
12924
12925 //#endregion
12926 //#region modules/ai/assets/js/editor/components/prompt-history/index.js
12927 init_prompt_history_context();
12928 var PROMPT_HISTORY_MODAL_ID = "prompt-history-modal";
12929 var PromptHistory = function PromptHistory() {
12930 var _usePromptHistoryCont = usePromptHistoryContext();
12931 var isOpen = _usePromptHistoryCont.isOpen;
12932 var isModalOpen = _usePromptHistoryCont.isModalOpen;
12933 var onOpen = _usePromptHistoryCont.onOpen;
12934 var onClose = _usePromptHistoryCont.onClose;
12935 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(PromptHistoryButton, {
12936 isActive: isOpen,
12937 onClick: function onClick() {
12938 return isOpen ? onClose() : onOpen();
12939 },
12940 "aria-haspopup": "dialog",
12941 "aria-controls": PROMPT_HISTORY_MODAL_ID
12942 }), isModalOpen && /*#__PURE__*/ react.default.createElement(PromptHistoryModal, { id: PROMPT_HISTORY_MODAL_ID }));
12943 };
12944
12945 //#endregion
12946 //#region modules/ai/assets/js/editor/pages/form-media/index.js
12947 init_extends();
12948 init_slicedToArray();
12949 init_defineProperty$1();
12950 function ownKeys$8(e, r) {
12951 var t = Object.keys(e);
12952 if (Object.getOwnPropertySymbols) {
12953 var o = Object.getOwnPropertySymbols(e);
12954 r && (o = o.filter(function(r) {
12955 return Object.getOwnPropertyDescriptor(e, r).enumerable;
12956 })), t.push.apply(t, o);
12957 }
12958 return t;
12959 }
12960 __name(ownKeys$8, "ownKeys");
12961 function _objectSpread$8(e) {
12962 for (var r = 1; r < arguments.length; r++) {
12963 var t = null != arguments[r] ? arguments[r] : {};
12964 r % 2 ? ownKeys$8(Object(t), !0).forEach(function(r) {
12965 _defineProperty$1(e, r, t[r]);
12966 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function(r) {
12967 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
12968 });
12969 }
12970 return e;
12971 }
12972 __name(_objectSpread$8, "_objectSpread");
12973 var initialData = {
12974 isAllSaved: false,
12975 hasUnsavedChanges: false
12976 };
12977 var SET_UNSAVED_CHANGES = "SET_UNSAVED_CHANGES";
12978 var SAVE_AND_CLOSE = "SAVE_AND_CLOSE";
12979 var reducer = function reducer(state, _ref) {
12980 var type = _ref.type;
12981 var payload = _ref.payload;
12982 switch (type) {
12983 case SET_UNSAVED_CHANGES: return _objectSpread$8(_objectSpread$8({}, state), {}, {
12984 hasUnsavedChanges: payload,
12985 isAllSaved: payload ? false : state.isAllSaved
12986 });
12987 case SAVE_AND_CLOSE: return _objectSpread$8(_objectSpread$8({}, state), {}, {
12988 isAllSaved: true,
12989 hasUnsavedChanges: false
12990 });
12991 default: throw Error("Unknown action.");
12992 }
12993 };
12994 var FormMedia = function FormMedia(_ref2) {
12995 var onClose = _ref2.onClose;
12996 var DialogProps = _ref2.DialogProps;
12997 var getControlValue = _ref2.getControlValue;
12998 var setControlValue = _ref2.setControlValue;
12999 var additionalOptions = _ref2.additionalOptions;
13000 var maybeRenderUpgradeChip = _ref2.maybeRenderUpgradeChip;
13001 var hasSubscription = _ref2.hasSubscription;
13002 var usagePercentage = _ref2.usagePercentage;
13003 var _useReducer2 = _slicedToArray((0, react.useReducer)(reducer, initialData), 2);
13004 var state = _useReducer2[0];
13005 var dispatch = _useReducer2[1];
13006 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
13007 var showUnsavedChangeAlert = _useState2[0];
13008 var setShowUnsavedChangeAlert = _useState2[1];
13009 var setHasUnsavedChanges = function setHasUnsavedChanges(payload) {
13010 return dispatch({
13011 type: SET_UNSAVED_CHANGES,
13012 payload
13013 });
13014 };
13015 var saveAndClose = function saveAndClose() {
13016 return dispatch({ type: SAVE_AND_CLOSE });
13017 };
13018 var onCloseIntent = function onCloseIntent() {
13019 if (state.hasUnsavedChanges) {
13020 setShowUnsavedChangeAlert(true);
13021 return;
13022 }
13023 onClose();
13024 };
13025 var editImageInitialData = getControlValue() === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.defaultValue) ? {} : getControlValue();
13026 var globalSettings = {
13027 initialImageType: (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.defaultImageType) || "",
13028 hasSubscription,
13029 usagePercentage,
13030 hideBackButton: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideBackButton
13031 };
13032 var globalActions = {
13033 state,
13034 getControlValue,
13035 setControlValue,
13036 saveAndClose,
13037 close: onCloseIntent,
13038 setHasUnsavedChanges
13039 };
13040 (0, react.useEffect)(function() {
13041 if (state.isAllSaved) onClose();
13042 }, [state.isAllSaved]);
13043 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({
13044 id: "e-form-media",
13045 onClose: function onClose() {
13046 return onCloseIntent();
13047 },
13048 maxWidth: "lg"
13049 }, DialogProps), /*#__PURE__*/ react.default.createElement(PromptDialog.Header, {
13050 onClose: function onClose() {
13051 return onCloseIntent();
13052 },
13053 hideAiBetaLogo: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideAiBetaLogo
13054 }, !additionalOptions.withoutHistory && /*#__PURE__*/ react.default.createElement(PromptHistory, null), maybeRenderUpgradeChip()), /*#__PURE__*/ react.default.createElement(_elementor_ui.Divider, null), /*#__PURE__*/ react.default.createElement(GlobalSettingsProvider, { settings: globalSettings }, /*#__PURE__*/ react.default.createElement(GlobalActionsProvider, { actions: globalActions }, /*#__PURE__*/ react.default.createElement(LocationProvider, null, /*#__PURE__*/ react.default.createElement(EditImageProvider, { imageData: editImageInitialData }, /*#__PURE__*/ react.default.createElement(MediaOutlet, {
13055 additionalOptions,
13056 onClose
13057 })))))), showUnsavedChangeAlert && /*#__PURE__*/ react.default.createElement(UnsavedChangesAlert$1, {
13058 onClose,
13059 onCancel: function onCancel() {
13060 return setShowUnsavedChangeAlert(false);
13061 },
13062 open: true
13063 }));
13064 };
13065 FormMedia.propTypes = {
13066 onClose: import_prop_types$8.default.func.isRequired,
13067 DialogProps: import_prop_types$8.default.object,
13068 getControlValue: import_prop_types$8.default.func.isRequired,
13069 setControlValue: import_prop_types$8.default.func.isRequired,
13070 additionalOptions: import_prop_types$8.default.object,
13071 credits: import_prop_types$8.default.number,
13072 maybeRenderUpgradeChip: import_prop_types$8.default.func,
13073 hasSubscription: import_prop_types$8.default.bool,
13074 usagePercentage: import_prop_types$8.default.number
13075 };
13076
13077 //#endregion
13078 //#region modules/ai/assets/js/editor/hooks/use-animation-prompt.js
13079 init_typeof$1();
13080 init_slicedToArray();
13081 init_defineProperty$1();
13082 init_asyncToGenerator();
13083 init_api();
13084 init_use_prompt();
13085 function ownKeys$7(e, r) {
13086 var t = Object.keys(e);
13087 if (Object.getOwnPropertySymbols) {
13088 var o = Object.getOwnPropertySymbols(e);
13089 r && (o = o.filter(function(r) {
13090 return Object.getOwnPropertyDescriptor(e, r).enumerable;
13091 })), t.push.apply(t, o);
13092 }
13093 return t;
13094 }
13095 __name(ownKeys$7, "ownKeys");
13096 function _objectSpread$7(e) {
13097 for (var r = 1; r < arguments.length; r++) {
13098 var t = null != arguments[r] ? arguments[r] : {};
13099 r % 2 ? ownKeys$7(Object(t), !0).forEach(function(r) {
13100 _defineProperty$1(e, r, t[r]);
13101 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function(r) {
13102 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
13103 });
13104 }
13105 return e;
13106 }
13107 __name(_objectSpread$7, "_objectSpread");
13108 var getAnimationResult = /*#__PURE__*/ function() {
13109 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(payload, motionEffectType) {
13110 return import_regenerator$2.default.wrap(function(_context) {
13111 while (1) switch (_context.prev = _context.next) {
13112 case 0: return _context.abrupt("return", getAnimation(_objectSpread$7(_objectSpread$7({}, payload), {}, { motionEffectType })));
13113 case 1:
13114 case "end": return _context.stop();
13115 }
13116 }, _callee);
13117 }));
13118 return function getAnimationResult(_x, _x2) {
13119 return _ref.apply(this, arguments);
13120 };
13121 }();
13122 var useAnimationPrompt = function useAnimationPrompt(motionEffectType, widgetType, initialValue) {
13123 var _usePrompt = usePrompt(function(payload) {
13124 return getAnimationResult(payload, motionEffectType);
13125 }, initialValue);
13126 var data = _usePrompt.data;
13127 var isLoading = _usePrompt.isLoading;
13128 var error = _usePrompt.error;
13129 var reset = _usePrompt.reset;
13130 var send = _usePrompt.send;
13131 var sendUsageData = _usePrompt.sendUsageData;
13132 var getControlData = function getControlData(controlKey) {
13133 var _elementor$widgetsCac;
13134 var _elementor$widgetsCac2;
13135 return {
13136 label: (_elementor$widgetsCac = elementor.widgetsCache) === null || _elementor$widgetsCac === void 0 || (_elementor$widgetsCac = _elementor$widgetsCac[widgetType !== null && widgetType !== void 0 ? widgetType : ""]) === null || _elementor$widgetsCac === void 0 || (_elementor$widgetsCac = _elementor$widgetsCac.controls[controlKey]) === null || _elementor$widgetsCac === void 0 ? void 0 : _elementor$widgetsCac.label,
13137 innerTab: (_elementor$widgetsCac2 = elementor.widgetsCache) === null || _elementor$widgetsCac2 === void 0 || (_elementor$widgetsCac2 = _elementor$widgetsCac2[widgetType !== null && widgetType !== void 0 ? widgetType : ""]) === null || _elementor$widgetsCac2 === void 0 || (_elementor$widgetsCac2 = _elementor$widgetsCac2.controls[controlKey]) === null || _elementor$widgetsCac2 === void 0 ? void 0 : _elementor$widgetsCac2.inner_tab
13138 };
13139 };
13140 var processMotionEffects = function processMotionEffects(jsonObject) {
13141 var result = {};
13142 var firstChild = jsonObject[Object.keys(jsonObject)[0]];
13143 var firstEnableControlKey = Object.keys(firstChild)[0];
13144 result[firstEnableControlKey] = {
13145 isParent: true,
13146 label: getControlData(firstEnableControlKey).label,
13147 value: jsonObject.enabled[firstEnableControlKey],
13148 tabs: 0
13149 };
13150 var processOtherProps = function processOtherProps(props) {
13151 for (var _i = 0, _Object$entries = Object.entries(props); _i < _Object$entries.length; _i++) {
13152 var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2);
13153 var key = _Object$entries$_i[0];
13154 var value = _Object$entries$_i[1];
13155 if ("enabled" === key && value) {
13156 var enableControlKey = Object.keys(value)[0];
13157 result[enableControlKey] = {
13158 isParent: false,
13159 label: getControlData(enableControlKey).label,
13160 value: value[enableControlKey],
13161 tabs: 1
13162 };
13163 } else {
13164 if ("none" === value || "normal" === value) continue;
13165 result[key] = { value };
13166 }
13167 }
13168 };
13169 for (var _i2 = 0, _Object$entries2 = Object.entries(jsonObject); _i2 < _Object$entries2.length; _i2++) {
13170 var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2);
13171 var propKey = _Object$entries2$_i[0];
13172 var propValue = _Object$entries2$_i[1];
13173 if (propKey !== "enabled" && "object" === _typeof$1(propValue)) processOtherProps(propValue);
13174 }
13175 return result;
13176 };
13177 var processEntranceEffects = function processEntranceEffects(jsonObject) {
13178 var result = {};
13179 var firstChildKey = Object.keys(jsonObject)[0];
13180 var firstChild = jsonObject[firstChildKey];
13181 result[firstChildKey] = {
13182 isParent: true,
13183 label: getControlData(firstChildKey).label,
13184 value: firstChild,
13185 tabs: 0
13186 };
13187 result[firstChild] = {
13188 isParent: false,
13189 label: firstChild,
13190 tabs: 1
13191 };
13192 var processProps = function processProps(props) {
13193 for (var _i3 = 0, _Object$entries3 = Object.entries(props); _i3 < _Object$entries3.length; _i3++) {
13194 var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2);
13195 var key = _Object$entries3$_i[0];
13196 var value = _Object$entries3$_i[1];
13197 if ("none" === value || "normal" === value) continue;
13198 result[key] = { value };
13199 }
13200 };
13201 for (var _i4 = 0, _Object$entries4 = Object.entries(jsonObject); _i4 < _Object$entries4.length; _i4++) {
13202 var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2);
13203 var propKey = _Object$entries4$_i[0];
13204 var propValue = _Object$entries4$_i[1];
13205 if (propKey !== firstChildKey && "object" === _typeof$1(propValue)) processProps(propValue);
13206 }
13207 return result;
13208 };
13209 var processHoverEffects = function processHoverEffects(jsonObject) {
13210 var result = {};
13211 var isHoverLabelAdded = false;
13212 var processProps = function processProps(props) {
13213 for (var _i5 = 0, _Object$entries5 = Object.entries(props); _i5 < _Object$entries5.length; _i5++) {
13214 var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2);
13215 var key = _Object$entries5$_i[0];
13216 var value = _Object$entries5$_i[1];
13217 if ("enabled" === key && value) {
13218 var enableControlKey = Object.keys(value)[0];
13219 var _getControlData = getControlData(enableControlKey);
13220 var label = _getControlData.label;
13221 var innerTab = _getControlData.innerTab;
13222 if (!isHoverLabelAdded) {
13223 result[innerTab] = {
13224 isParent: true,
13225 label: getControlData(innerTab).label,
13226 tabs: 0
13227 };
13228 isHoverLabelAdded = true;
13229 }
13230 result[enableControlKey] = {
13231 isParent: false,
13232 label,
13233 value: value[enableControlKey],
13234 tabs: 1
13235 };
13236 } else {
13237 if ("none" === value || "normal" === value) continue;
13238 result[key] = { value };
13239 }
13240 }
13241 };
13242 for (var _i6 = 0, _Object$entries6 = Object.entries(jsonObject); _i6 < _Object$entries6.length; _i6++) {
13243 var propValue = _slicedToArray(_Object$entries6[_i6], 2)[1];
13244 if ("object" === _typeof$1(propValue)) processProps(propValue);
13245 }
13246 return result;
13247 };
13248 var digestResult = function digestResult(jsonString) {
13249 var result = {};
13250 function traverse(currentObj) {
13251 if (!currentObj || _typeof$1(currentObj) !== "object") return;
13252 for (var key in currentObj) {
13253 if (!currentObj.hasOwnProperty(key)) continue;
13254 if (["scrolling_effects", "mouse_effects"].includes(key)) {
13255 result = _objectSpread$7(_objectSpread$7({}, result), processMotionEffects(currentObj[key]));
13256 continue;
13257 }
13258 if ("entrance_effects" === key) {
13259 result = _objectSpread$7(_objectSpread$7({}, result), processEntranceEffects(currentObj[key]));
13260 continue;
13261 }
13262 if ("hover_effects" === key) {
13263 result = _objectSpread$7(_objectSpread$7({}, result), processHoverEffects(currentObj[key]));
13264 return;
13265 }
13266 traverse(currentObj[key]);
13267 }
13268 }
13269 traverse(JSON.parse(jsonString));
13270 return result;
13271 };
13272 (0, react.useEffect)(function() {
13273 if (data.result) data.result = digestResult(data.result);
13274 }, [data]);
13275 return {
13276 data,
13277 isLoading,
13278 error,
13279 reset,
13280 send,
13281 sendUsageData
13282 };
13283 };
13284
13285 //#endregion
13286 //#region modules/ai/assets/js/editor/pages/form-animation/index.js
13287 init_asyncToGenerator();
13288 init_slicedToArray();
13289 init_actions_data();
13290 init_loader();
13291 init_prompt_search();
13292 init_prompt_suggestions();
13293 init_generate_button();
13294 init_prompt_error_message();
13295 init_requests_ids();
13296 init_voice_promotion_alert();
13297 var CodeDisplayWrapper$1 = (0, _elementor_ui.styled)(_elementor_ui.Box)(function() {
13298 return {
13299 "& p": {
13300 mb: "10px",
13301 fontSize: "14px",
13302 lineHeight: "1.5"
13303 },
13304 "& pre": { position: "relative" },
13305 "& textarea": {
13306 fontSize: "13px",
13307 lineHeight: "1.7"
13308 }
13309 };
13310 });
13311 var FormAnimation = function FormAnimation(_ref) {
13312 var onClose = _ref.onClose;
13313 var getControlValue = _ref.getControlValue;
13314 var setControlValue = _ref.setControlValue;
13315 var additionalOptions = _ref.additionalOptions;
13316 var credits = _ref.credits;
13317 var children = _ref.children;
13318 var _useAnimationPrompt = useAnimationPrompt(additionalOptions.animationType, additionalOptions.widgetType, credits);
13319 var data = _useAnimationPrompt.data;
13320 var isLoading = _useAnimationPrompt.isLoading;
13321 var error = _useAnimationPrompt.error;
13322 var reset = _useAnimationPrompt.reset;
13323 var send = _useAnimationPrompt.send;
13324 var sendUsageData = _useAnimationPrompt.sendUsageData;
13325 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
13326 var prompt = _useState2[0];
13327 var setPrompt = _useState2[1];
13328 var setGenerate = useRequestIds().setGenerate;
13329 var _useState4 = _slicedToArray((0, react.useState)(""), 2);
13330 var animationSummary = _useState4[0];
13331 var setAnimationSummary = _useState4[1];
13332 var _useState6 = _slicedToArray((0, react.useState)(), 2);
13333 var prevControlValue = _useState6[0];
13334 var setPrevControlValue = _useState6[1];
13335 var lastRun = (0, react.useRef)(function() {});
13336 var autocompleteItems = "hover" === additionalOptions.animationType ? hoverEffectAutocomplete : motionEffectAutocomplete;
13337 var showSuggestions = !prompt;
13338 var handleSubmit = /*#__PURE__*/ function() {
13339 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(event) {
13340 return import_regenerator$2.default.wrap(function(_context) {
13341 while (1) switch (_context.prev = _context.next) {
13342 case 0:
13343 event.preventDefault();
13344 setGenerate();
13345 lastRun.current = function() {
13346 return send({ prompt });
13347 };
13348 _context.next = 1;
13349 return lastRun.current();
13350 case 1:
13351 case "end": return _context.stop();
13352 }
13353 }, _callee);
13354 }));
13355 return function handleSubmit(_x) {
13356 return _ref2.apply(this, arguments);
13357 };
13358 }();
13359 (0, react.useEffect)(function() {
13360 if (data.result) showPreview(data.result);
13361 }, [data]);
13362 (0, react.useEffect)(function() {
13363 return function() {
13364 restorePrevSettings();
13365 };
13366 }, []);
13367 var showPreview = function showPreview(result) {
13368 var summary = Object.keys(result).filter(function(key) {
13369 return result[key].label;
13370 }).map(function(key) {
13371 var item = result[key];
13372 var tabs = "&nbsp;".repeat(item.tabs);
13373 var bulletIcon = item.tabs > 0 ? "&#8226; " : "";
13374 var label = item.isParent ? "<br/><b>".concat(item.label, ":</b>") : "".concat(bulletIcon, " ").concat(item.label);
13375 return "".concat(tabs).concat(label);
13376 }).join("<br/>");
13377 var title = "".concat((0, _wordpress_i18n.__)("Here’s a breakdown of what was done for creating the animation", "elementor"));
13378 setAnimationSummary("<b>".concat(title, ":</b><br/>").concat(summary));
13379 setPrevControlValue(getControlValue());
13380 elementor.documents.getCurrent().history.setActive(false);
13381 setControlValue(getValidElementor(result));
13382 };
13383 var restorePrevSettings = function restorePrevSettings() {
13384 setControlValue(prevControlValue);
13385 elementor.documents.getCurrent().history.setActive(true);
13386 };
13387 var getValidElementor = function getValidElementor(result) {
13388 return Object.entries(result).filter(function(_ref3) {
13389 return _slicedToArray(_ref3, 2)[1].hasOwnProperty("value");
13390 }).reduce(function(previousValue, _ref5) {
13391 var _ref6 = _slicedToArray(_ref5, 2);
13392 var key = _ref6[0];
13393 previousValue[key] = _ref6[1].value;
13394 return previousValue;
13395 }, {});
13396 };
13397 var applyPrompt = function applyPrompt(result) {
13398 sendUsageData();
13399 restorePrevSettings();
13400 setControlValue(getValidElementor(result));
13401 onClose();
13402 };
13403 if (isLoading) return /*#__PURE__*/ react.default.createElement(Loader, null);
13404 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, error && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, {
13405 error,
13406 onRetry: lastRun.current,
13407 sx: { mb: 2.5 }
13408 }), children, !data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
13409 component: "form",
13410 onSubmit: handleSubmit
13411 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { pb: 1.5 } }, /*#__PURE__*/ react.default.createElement(PromptSearch, {
13412 placeholder: (0, _wordpress_i18n.__)("Describe the animation you want to create...", "elementor"),
13413 name: "prompt",
13414 value: prompt,
13415 color: "secondary",
13416 onChange: function onChange(event) {
13417 return setPrompt(event.target.value);
13418 }
13419 })), showSuggestions && /*#__PURE__*/ react.default.createElement(PromptSuggestions, {
13420 suggestions: autocompleteItems,
13421 onSelect: setPrompt
13422 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
13423 direction: "row",
13424 alignItems: "center",
13425 sx: {
13426 py: 1.5,
13427 mt: 4
13428 }
13429 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
13430 direction: "row",
13431 justifyContent: "flex-end",
13432 flexGrow: 1
13433 }, /*#__PURE__*/ react.default.createElement(GenerateButton$1, null, (0, _wordpress_i18n.__)("Generate Animation", "elementor"))))), data.result && animationSummary && /*#__PURE__*/ react.default.createElement(CodeDisplayWrapper$1, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
13434 backgroundColor: "rgba(0, 0, 0, 0.06); ",
13435 padding: "1em",
13436 borderRadius: "4px",
13437 width: "100%",
13438 height: "260px",
13439 overflowX: "auto"
13440 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
13441 variant: "body1",
13442 dangerouslySetInnerHTML: { __html: animationSummary }
13443 })), /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-animation-promotion" }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
13444 direction: "row",
13445 alignItems: "center",
13446 sx: { mt: 4 }
13447 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
13448 direction: "row",
13449 gap: 1,
13450 justifyContent: "flex-end",
13451 flexGrow: 1
13452 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
13453 size: "small",
13454 color: "secondary",
13455 variant: "text",
13456 onClick: function onClick() {
13457 restorePrevSettings();
13458 reset();
13459 }
13460 }, (0, _wordpress_i18n.__)("New prompt", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
13461 size: "small",
13462 variant: "contained",
13463 color: "primary",
13464 onClick: function onClick() {
13465 return applyPrompt(data.result);
13466 }
13467 }, (0, _wordpress_i18n.__)("Use animation", "elementor"))))));
13468 };
13469 FormAnimation.propTypes = {
13470 onClose: import_prop_types$8.default.func.isRequired,
13471 getControlValue: import_prop_types$8.default.func.isRequired,
13472 setControlValue: import_prop_types$8.default.func.isRequired,
13473 additionalOptions: import_prop_types$8.default.shape({
13474 animationType: import_prop_types$8.default.string,
13475 widgetType: import_prop_types$8.default.string
13476 }),
13477 credits: import_prop_types$8.default.number,
13478 children: import_prop_types$8.default.node
13479 };
13480
13481 //#endregion
13482 //#region \0vite/preload-helper.js
13483 var scriptRel, assetsURL, seen, __vitePreload;
13484 var init_preload_helper = __esmMin((() => {
13485 scriptRel = "modulepreload";
13486 assetsURL = function(dep) {
13487 return "/" + dep;
13488 };
13489 seen = {};
13490 __vitePreload = function preload(baseModule, deps, importerUrl) {
13491 let promise = Promise.resolve();
13492 if (false && deps && deps.length > 0) {
13493 const links = document.getElementsByTagName("link");
13494 const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
13495 const cspNonce = (cspNonceMeta === null || cspNonceMeta === void 0 ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta === null || cspNonceMeta === void 0 ? void 0 : cspNonceMeta.getAttribute("nonce"));
13496 function allSettled(promises) {
13497 return Promise.all(promises.map((p) => Promise.resolve(p).then((value) => ({
13498 status: "fulfilled",
13499 value
13500 }), (reason) => ({
13501 status: "rejected",
13502 reason
13503 }))));
13504 }
13505 function importMetaResolve(specifier) {
13506 if ({}.resolve) return {}.resolve(specifier);
13507 return new URL(
13508 specifier,
13509 /** #__KEEP__ */
13510 {}.url
13511 ).href;
13512 }
13513 promise = allSettled(deps.map((dep) => {
13514 dep = assetsURL(dep, importerUrl);
13515 dep = importMetaResolve(dep);
13516 if (dep in seen) return;
13517 seen[dep] = true;
13518 const isCss = dep.endsWith(".css");
13519 for (let i = links.length - 1; i >= 0; i--) {
13520 const link = links[i];
13521 if (link.href === dep && (!isCss || link.rel === "stylesheet")) return;
13522 }
13523 const link = document.createElement("link");
13524 link.rel = isCss ? "stylesheet" : scriptRel;
13525 if (!isCss) link.as = "script";
13526 link.crossOrigin = "";
13527 link.href = dep;
13528 if (cspNonce) link.setAttribute("nonce", cspNonce);
13529 document.head.appendChild(link);
13530 if (isCss) return new Promise((res, rej) => {
13531 link.addEventListener("load", res);
13532 link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
13533 });
13534 }));
13535 }
13536 function handlePreloadError(err) {
13537 const e = new Event("vite:preloadError", { cancelable: true });
13538 e.payload = err;
13539 window.dispatchEvent(e);
13540 if (!e.defaultPrevented) throw err;
13541 }
13542 return promise.then((res) => {
13543 for (const item of res || []) {
13544 if (item.status !== "rejected") continue;
13545 handlePreloadError(item.reason);
13546 }
13547 return baseModule().catch(handlePreloadError);
13548 });
13549 };
13550 }));
13551
13552 //#endregion
13553 //#region modules/ai/assets/js/editor/pages/form-code/code-block.js
13554 var import_prop_types$2, _excluded$5, CodeBlock;
13555 var init_code_block = __esmMin((() => {
13556 init_extends();
13557 init_objectWithoutProperties$1();
13558 import_prop_types$2 = /* @__PURE__ */ __toESM(require_prop_types());
13559 init_textarea();
13560 _excluded$5 = [
13561 "node",
13562 "inline",
13563 "children",
13564 "defaultValue",
13565 "onInsert"
13566 ];
13567 CodeBlock = function CodeBlock(_ref) {
13568 _ref.node;
13569 var inline = _ref.inline;
13570 var children = _ref.children;
13571 var defaultValue = _ref.defaultValue;
13572 var onInsert = _ref.onInsert;
13573 var props = _objectWithoutProperties$1(_ref, _excluded$5);
13574 var codeBlockInput = (0, react.useRef)(null);
13575 if (inline) return /*#__PURE__*/ react.default.createElement("code", props);
13576 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
13577 sx: { position: "relative" },
13578 dir: "ltr"
13579 }, /*#__PURE__*/ react.default.createElement(Textarea, _extends$1({
13580 fullWidth: true,
13581 ref: codeBlockInput,
13582 defaultValue: children[0],
13583 sx: { mb: 1 },
13584 helperText: (0, _wordpress_i18n.__)("Code generated by AI may be inaccurate.", "elementor")
13585 }, props)), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
13586 size: "small",
13587 variant: "contained",
13588 onClick: function onClick() {
13589 return onInsert(defaultValue + "\n" + codeBlockInput.current.value);
13590 },
13591 sx: {
13592 position: "absolute",
13593 right: "11px /* @noflip */",
13594 bottom: "44px"
13595 }
13596 }, (0, _wordpress_i18n.__)("Insert", "elementor")));
13597 };
13598 CodeBlock.propTypes = {
13599 node: import_prop_types$2.default.object,
13600 inline: import_prop_types$2.default.bool,
13601 children: import_prop_types$2.default.arrayOf(import_prop_types$2.default.node).isRequired,
13602 defaultValue: import_prop_types$2.default.string,
13603 onInsert: import_prop_types$2.default.func.isRequired
13604 };
13605 }));
13606
13607 //#endregion
13608 //#region modules/ai/assets/js/editor/hooks/use-code-prompt.js
13609 function ownKeys$6(e, r) {
13610 var t = Object.keys(e);
13611 if (Object.getOwnPropertySymbols) {
13612 var o = Object.getOwnPropertySymbols(e);
13613 r && (o = o.filter(function(r) {
13614 return Object.getOwnPropertyDescriptor(e, r).enumerable;
13615 })), t.push.apply(t, o);
13616 }
13617 return t;
13618 }
13619 function _objectSpread$6(e) {
13620 for (var r = 1; r < arguments.length; r++) {
13621 var t = null != arguments[r] ? arguments[r] : {};
13622 r % 2 ? ownKeys$6(Object(t), !0).forEach(function(r) {
13623 _defineProperty$1(e, r, t[r]);
13624 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function(r) {
13625 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
13626 });
13627 }
13628 return e;
13629 }
13630 var import_regenerator$1, getCodeResult, useCodePrompt;
13631 var init_use_code_prompt = __esmMin((() => {
13632 init_defineProperty$1();
13633 init_asyncToGenerator();
13634 import_regenerator$1 = /* @__PURE__ */ __toESM(require_regenerator());
13635 init_api();
13636 init_use_prompt();
13637 __name(ownKeys$6, "ownKeys");
13638 __name(_objectSpread$6, "_objectSpread");
13639 getCodeResult = /*#__PURE__*/ function() {
13640 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$1.default.mark(function _callee(payload, _ref) {
13641 var codeLanguage;
13642 var htmlMarkup;
13643 var elementId;
13644 return import_regenerator$1.default.wrap(function(_context) {
13645 while (1) switch (_context.prev = _context.next) {
13646 case 0:
13647 codeLanguage = _ref.codeLanguage, htmlMarkup = _ref.htmlMarkup, elementId = _ref.elementId;
13648 if (!("css" === codeLanguage)) {
13649 _context.next = 1;
13650 break;
13651 }
13652 return _context.abrupt("return", getCustomCSS(_objectSpread$6(_objectSpread$6({}, payload), {}, {
13653 html_markup: htmlMarkup,
13654 element_id: elementId
13655 })));
13656 case 1: return _context.abrupt("return", getCustomCode(_objectSpread$6(_objectSpread$6({}, payload), {}, { language: codeLanguage })));
13657 case 2:
13658 case "end": return _context.stop();
13659 }
13660 }, _callee);
13661 }));
13662 return function getCodeResult(_x, _x2) {
13663 return _ref2.apply(this, arguments);
13664 };
13665 }();
13666 useCodePrompt = function useCodePrompt(_ref3) {
13667 var codeLanguage = _ref3.codeLanguage;
13668 var htmlMarkup = _ref3.htmlMarkup;
13669 var elementId = _ref3.elementId;
13670 var credits = _ref3.initialCredits;
13671 return usePrompt(function(payload) {
13672 return getCodeResult(payload, {
13673 codeLanguage,
13674 htmlMarkup,
13675 elementId
13676 });
13677 }, { credits });
13678 };
13679 }));
13680
13681 //#endregion
13682 //#region modules/ai/assets/js/editor/pages/form-code/splitTextResult.js
13683 function splitText(inputText) {
13684 if (!inputText) return {};
13685 var codeMatch = inputText.match(/```([\s\S]*?)```/);
13686 var code = codeMatch ? "```".concat(codeMatch[1], "```").trim() : "";
13687 var detailsMatch = inputText.match(/```[\s\S]*?```([\s\S]*)/);
13688 return {
13689 code,
13690 details: detailsMatch === null || detailsMatch === void 0 ? void 0 : detailsMatch[1].trim()
13691 };
13692 }
13693 var init_splitTextResult = __esmMin((() => {}));
13694
13695 //#endregion
13696 //#region node_modules/react-markdown/lib/uri-transformer.js
13697 /**
13698 * @param {string} uri
13699 * @returns {string}
13700 */
13701 function uriTransformer(uri) {
13702 const url = (uri || "").trim();
13703 const first = url.charAt(0);
13704 if (first === "#" || first === "/") return url;
13705 const colon = url.indexOf(":");
13706 if (colon === -1) return url;
13707 let index = -1;
13708 while (++index < protocols.length) {
13709 const protocol = protocols[index];
13710 if (colon === protocol.length && url.slice(0, protocol.length).toLowerCase() === protocol) return url;
13711 }
13712 index = url.indexOf("?");
13713 if (index !== -1 && colon > index) return url;
13714 index = url.indexOf("#");
13715 if (index !== -1 && colon > index) return url;
13716 return "javascript:void(0)";
13717 }
13718 var protocols;
13719 var init_uri_transformer = __esmMin((() => {
13720 protocols = [
13721 "http",
13722 "https",
13723 "mailto",
13724 "tel"
13725 ];
13726 }));
13727
13728 //#endregion
13729 //#region node_modules/vfile/node_modules/is-buffer/index.js
13730 var require_is_buffer$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13731 /*!
13732 * Determine if an object is a Buffer
13733 *
13734 * @author Feross Aboukhadijeh <https://feross.org>
13735 * @license MIT
13736 */
13737 module.exports = function isBuffer(obj) {
13738 return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
13739 };
13740 }));
13741
13742 //#endregion
13743 //#region node_modules/unist-util-stringify-position/lib/index.js
13744 /**
13745 * @typedef {import('unist').Node} Node
13746 * @typedef {import('unist').Point} Point
13747 * @typedef {import('unist').Position} Position
13748 */
13749 /**
13750 * @typedef NodeLike
13751 * @property {string} type
13752 * @property {PositionLike | null | undefined} [position]
13753 *
13754 * @typedef PositionLike
13755 * @property {PointLike | null | undefined} [start]
13756 * @property {PointLike | null | undefined} [end]
13757 *
13758 * @typedef PointLike
13759 * @property {number | null | undefined} [line]
13760 * @property {number | null | undefined} [column]
13761 * @property {number | null | undefined} [offset]
13762 */
13763 /**
13764 * Serialize the positional info of a point, position (start and end points),
13765 * or node.
13766 *
13767 * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]
13768 * Node, position, or point.
13769 * @returns {string}
13770 * Pretty printed positional info of a node (`string`).
13771 *
13772 * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
13773 * or a point `l:c` (when given `point`), where `l` stands for line, `c` for
13774 * column, `s` for `start`, and `e` for end.
13775 * An empty string (`''`) is returned if the given value is neither `node`,
13776 * `position`, nor `point`.
13777 */
13778 function stringifyPosition(value) {
13779 if (!value || typeof value !== "object") return "";
13780 if ("position" in value || "type" in value) return position$1(value.position);
13781 if ("start" in value || "end" in value) return position$1(value);
13782 if ("line" in value || "column" in value) return point$2(value);
13783 return "";
13784 }
13785 /**
13786 * @param {Point | PointLike | null | undefined} point
13787 * @returns {string}
13788 */
13789 function point$2(point) {
13790 return index(point && point.line) + ":" + index(point && point.column);
13791 }
13792 /**
13793 * @param {Position | PositionLike | null | undefined} pos
13794 * @returns {string}
13795 */
13796 function position$1(pos) {
13797 return point$2(pos && pos.start) + "-" + point$2(pos && pos.end);
13798 }
13799 /**
13800 * @param {number | null | undefined} value
13801 * @returns {number}
13802 */
13803 function index(value) {
13804 return value && typeof value === "number" ? value : 1;
13805 }
13806 var init_lib$15 = __esmMin((() => {
13807 __name(point$2, "point");
13808 __name(position$1, "position");
13809 }));
13810
13811 //#endregion
13812 //#region node_modules/unist-util-stringify-position/index.js
13813 var init_unist_util_stringify_position = __esmMin((() => {
13814 init_lib$15();
13815 }));
13816
13817 //#endregion
13818 //#region node_modules/vfile-message/lib/index.js
13819 var VFileMessage;
13820 var init_lib$14 = __esmMin((() => {
13821 init_unist_util_stringify_position();
13822 VFileMessage = class extends Error {
13823 /**
13824 * Create a message for `reason` at `place` from `origin`.
13825 *
13826 * When an error is passed in as `reason`, the `stack` is copied.
13827 *
13828 * @param {string | Error | VFileMessage} reason
13829 * Reason for message, uses the stack and message of the error if given.
13830 *
13831 * > 👉 **Note**: you should use markdown.
13832 * @param {Node | NodeLike | Position | Point | null | undefined} [place]
13833 * Place in file where the message occurred.
13834 * @param {string | null | undefined} [origin]
13835 * Place in code where the message originates (example:
13836 * `'my-package:my-rule'` or `'my-rule'`).
13837 * @returns
13838 * Instance of `VFileMessage`.
13839 */
13840 constructor(reason, place, origin) {
13841 /** @type {[string | null, string | null]} */
13842 const parts = [null, null];
13843 /** @type {Position} */
13844 let position = {
13845 start: {
13846 line: null,
13847 column: null
13848 },
13849 end: {
13850 line: null,
13851 column: null
13852 }
13853 };
13854 super();
13855 if (typeof place === "string") {
13856 origin = place;
13857 place = void 0;
13858 }
13859 if (typeof origin === "string") {
13860 const index = origin.indexOf(":");
13861 if (index === -1) parts[1] = origin;
13862 else {
13863 parts[0] = origin.slice(0, index);
13864 parts[1] = origin.slice(index + 1);
13865 }
13866 }
13867 if (place) {
13868 if ("type" in place || "position" in place) {
13869 if (place.position) position = place.position;
13870 } else if ("start" in place || "end" in place) position = place;
13871 else if ("line" in place || "column" in place) position.start = place;
13872 }
13873 /**
13874 * Serialized positional info of error.
13875 *
13876 * On normal errors, this would be something like `ParseError`, buit in
13877 * `VFile` messages we use this space to show where an error happened.
13878 */
13879 this.name = stringifyPosition(place) || "1:1";
13880 /**
13881 * Reason for message.
13882 *
13883 * @type {string}
13884 */
13885 this.message = typeof reason === "object" ? reason.message : reason;
13886 /**
13887 * Stack of message.
13888 *
13889 * This is used by normal errors to show where something happened in
13890 * programming code, irrelevant for `VFile` messages,
13891 *
13892 * @type {string}
13893 */
13894 this.stack = "";
13895 if (typeof reason === "object" && reason.stack) this.stack = reason.stack;
13896 /**
13897 * Reason for message.
13898 *
13899 * > 👉 **Note**: you should use markdown.
13900 *
13901 * @type {string}
13902 */
13903 this.reason = this.message;
13904 /**
13905 * State of problem.
13906 *
13907 * * `true` — marks associated file as no longer processable (error)
13908 * * `false` — necessitates a (potential) change (warning)
13909 * * `null | undefined` — for things that might not need changing (info)
13910 *
13911 * @type {boolean | null | undefined}
13912 */
13913 this.fatal;
13914 /**
13915 * Starting line of error.
13916 *
13917 * @type {number | null}
13918 */
13919 this.line = position.start.line;
13920 /**
13921 * Starting column of error.
13922 *
13923 * @type {number | null}
13924 */
13925 this.column = position.start.column;
13926 /**
13927 * Full unist position.
13928 *
13929 * @type {Position | null}
13930 */
13931 this.position = position;
13932 /**
13933 * Namespace of message (example: `'my-package'`).
13934 *
13935 * @type {string | null}
13936 */
13937 this.source = parts[0];
13938 /**
13939 * Category of message (example: `'my-rule'`).
13940 *
13941 * @type {string | null}
13942 */
13943 this.ruleId = parts[1];
13944 /**
13945 * Path of a file (used throughout the `VFile` ecosystem).
13946 *
13947 * @type {string | null}
13948 */
13949 this.file;
13950 /**
13951 * Specify the source value that’s being reported, which is deemed
13952 * incorrect.
13953 *
13954 * @type {string | null}
13955 */
13956 this.actual;
13957 /**
13958 * Suggest acceptable values that can be used instead of `actual`.
13959 *
13960 * @type {Array<string> | null}
13961 */
13962 this.expected;
13963 /**
13964 * Link to docs for the message.
13965 *
13966 * > 👉 **Note**: this must be an absolute URL that can be passed as `x`
13967 * > to `new URL(x)`.
13968 *
13969 * @type {string | null}
13970 */
13971 this.url;
13972 /**
13973 * Long form description of the message (you should use markdown).
13974 *
13975 * @type {string | null}
13976 */
13977 this.note;
13978 }
13979 };
13980 VFileMessage.prototype.file = "";
13981 VFileMessage.prototype.name = "";
13982 VFileMessage.prototype.reason = "";
13983 VFileMessage.prototype.message = "";
13984 VFileMessage.prototype.stack = "";
13985 VFileMessage.prototype.fatal = null;
13986 VFileMessage.prototype.column = null;
13987 VFileMessage.prototype.line = null;
13988 VFileMessage.prototype.source = null;
13989 VFileMessage.prototype.ruleId = null;
13990 VFileMessage.prototype.position = null;
13991 }));
13992
13993 //#endregion
13994 //#region node_modules/vfile-message/index.js
13995 var init_vfile_message = __esmMin((() => {
13996 init_lib$14();
13997 }));
13998
13999 //#endregion
14000 //#region node_modules/vfile/lib/minpath.browser.js
14001 /**
14002 * Get the basename from a path.
14003 *
14004 * @param {string} path
14005 * File path.
14006 * @param {string | undefined} [ext]
14007 * Extension to strip.
14008 * @returns {string}
14009 * Stem or basename.
14010 */
14011 function basename(path, ext) {
14012 if (ext !== void 0 && typeof ext !== "string") throw new TypeError("\"ext\" argument must be a string");
14013 assertPath$1(path);
14014 let start = 0;
14015 let end = -1;
14016 let index = path.length;
14017 /** @type {boolean | undefined} */
14018 let seenNonSlash;
14019 if (ext === void 0 || ext.length === 0 || ext.length > path.length) {
14020 while (index--) if (path.charCodeAt(index) === 47) {
14021 if (seenNonSlash) {
14022 start = index + 1;
14023 break;
14024 }
14025 } else if (end < 0) {
14026 seenNonSlash = true;
14027 end = index + 1;
14028 }
14029 return end < 0 ? "" : path.slice(start, end);
14030 }
14031 if (ext === path) return "";
14032 let firstNonSlashEnd = -1;
14033 let extIndex = ext.length - 1;
14034 while (index--) if (path.charCodeAt(index) === 47) {
14035 if (seenNonSlash) {
14036 start = index + 1;
14037 break;
14038 }
14039 } else {
14040 if (firstNonSlashEnd < 0) {
14041 seenNonSlash = true;
14042 firstNonSlashEnd = index + 1;
14043 }
14044 if (extIndex > -1) if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) {
14045 if (extIndex < 0) end = index;
14046 } else {
14047 extIndex = -1;
14048 end = firstNonSlashEnd;
14049 }
14050 }
14051 if (start === end) end = firstNonSlashEnd;
14052 else if (end < 0) end = path.length;
14053 return path.slice(start, end);
14054 }
14055 /**
14056 * Get the dirname from a path.
14057 *
14058 * @param {string} path
14059 * File path.
14060 * @returns {string}
14061 * File path.
14062 */
14063 function dirname(path) {
14064 assertPath$1(path);
14065 if (path.length === 0) return ".";
14066 let end = -1;
14067 let index = path.length;
14068 /** @type {boolean | undefined} */
14069 let unmatchedSlash;
14070 while (--index) if (path.charCodeAt(index) === 47) {
14071 if (unmatchedSlash) {
14072 end = index;
14073 break;
14074 }
14075 } else if (!unmatchedSlash) unmatchedSlash = true;
14076 return end < 0 ? path.charCodeAt(0) === 47 ? "/" : "." : end === 1 && path.charCodeAt(0) === 47 ? "//" : path.slice(0, end);
14077 }
14078 /**
14079 * Get an extname from a path.
14080 *
14081 * @param {string} path
14082 * File path.
14083 * @returns {string}
14084 * Extname.
14085 */
14086 function extname(path) {
14087 assertPath$1(path);
14088 let index = path.length;
14089 let end = -1;
14090 let startPart = 0;
14091 let startDot = -1;
14092 let preDotState = 0;
14093 /** @type {boolean | undefined} */
14094 let unmatchedSlash;
14095 while (index--) {
14096 const code = path.charCodeAt(index);
14097 if (code === 47) {
14098 if (unmatchedSlash) {
14099 startPart = index + 1;
14100 break;
14101 }
14102 continue;
14103 }
14104 if (end < 0) {
14105 unmatchedSlash = true;
14106 end = index + 1;
14107 }
14108 if (code === 46) {
14109 if (startDot < 0) startDot = index;
14110 else if (preDotState !== 1) preDotState = 1;
14111 } else if (startDot > -1) preDotState = -1;
14112 }
14113 if (startDot < 0 || end < 0 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) return "";
14114 return path.slice(startDot, end);
14115 }
14116 /**
14117 * Join segments from a path.
14118 *
14119 * @param {Array<string>} segments
14120 * Path segments.
14121 * @returns {string}
14122 * File path.
14123 */
14124 function join(...segments) {
14125 let index = -1;
14126 /** @type {string | undefined} */
14127 let joined;
14128 while (++index < segments.length) {
14129 assertPath$1(segments[index]);
14130 if (segments[index]) joined = joined === void 0 ? segments[index] : joined + "/" + segments[index];
14131 }
14132 return joined === void 0 ? "." : normalize$1(joined);
14133 }
14134 /**
14135 * Normalize a basic file path.
14136 *
14137 * @param {string} path
14138 * File path.
14139 * @returns {string}
14140 * File path.
14141 */
14142 function normalize$1(path) {
14143 assertPath$1(path);
14144 const absolute = path.charCodeAt(0) === 47;
14145 let value = normalizeString(path, !absolute);
14146 if (value.length === 0 && !absolute) value = ".";
14147 if (value.length > 0 && path.charCodeAt(path.length - 1) === 47) value += "/";
14148 return absolute ? "/" + value : value;
14149 }
14150 /**
14151 * Resolve `.` and `..` elements in a path with directory names.
14152 *
14153 * @param {string} path
14154 * File path.
14155 * @param {boolean} allowAboveRoot
14156 * Whether `..` can move above root.
14157 * @returns {string}
14158 * File path.
14159 */
14160 function normalizeString(path, allowAboveRoot) {
14161 let result = "";
14162 let lastSegmentLength = 0;
14163 let lastSlash = -1;
14164 let dots = 0;
14165 let index = -1;
14166 /** @type {number | undefined} */
14167 let code;
14168 /** @type {number} */
14169 let lastSlashIndex;
14170 while (++index <= path.length) {
14171 if (index < path.length) code = path.charCodeAt(index);
14172 else if (code === 47) break;
14173 else code = 47;
14174 if (code === 47) {
14175 if (lastSlash === index - 1 || dots === 1) {} else if (lastSlash !== index - 1 && dots === 2) {
14176 if (result.length < 2 || lastSegmentLength !== 2 || result.charCodeAt(result.length - 1) !== 46 || result.charCodeAt(result.length - 2) !== 46) {
14177 if (result.length > 2) {
14178 lastSlashIndex = result.lastIndexOf("/");
14179 if (lastSlashIndex !== result.length - 1) {
14180 if (lastSlashIndex < 0) {
14181 result = "";
14182 lastSegmentLength = 0;
14183 } else {
14184 result = result.slice(0, lastSlashIndex);
14185 lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
14186 }
14187 lastSlash = index;
14188 dots = 0;
14189 continue;
14190 }
14191 } else if (result.length > 0) {
14192 result = "";
14193 lastSegmentLength = 0;
14194 lastSlash = index;
14195 dots = 0;
14196 continue;
14197 }
14198 }
14199 if (allowAboveRoot) {
14200 result = result.length > 0 ? result + "/.." : "..";
14201 lastSegmentLength = 2;
14202 }
14203 } else {
14204 if (result.length > 0) result += "/" + path.slice(lastSlash + 1, index);
14205 else result = path.slice(lastSlash + 1, index);
14206 lastSegmentLength = index - lastSlash - 1;
14207 }
14208 lastSlash = index;
14209 dots = 0;
14210 } else if (code === 46 && dots > -1) dots++;
14211 else dots = -1;
14212 }
14213 return result;
14214 }
14215 /**
14216 * Make sure `path` is a string.
14217 *
14218 * @param {string} path
14219 * File path.
14220 * @returns {asserts path is string}
14221 * Nothing.
14222 */
14223 function assertPath$1(path) {
14224 if (typeof path !== "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
14225 }
14226 var path;
14227 var init_minpath_browser = __esmMin((() => {
14228 path = {
14229 basename,
14230 dirname,
14231 extname,
14232 join,
14233 sep: "/"
14234 };
14235 __name(normalize$1, "normalize");
14236 __name(assertPath$1, "assertPath");
14237 }));
14238
14239 //#endregion
14240 //#region node_modules/vfile/lib/minproc.browser.js
14241 function cwd() {
14242 return "/";
14243 }
14244 var proc;
14245 var init_minproc_browser = __esmMin((() => {
14246 proc = { cwd };
14247 }));
14248
14249 //#endregion
14250 //#region node_modules/vfile/lib/minurl.shared.js
14251 /**
14252 * @typedef URL
14253 * @property {string} hash
14254 * @property {string} host
14255 * @property {string} hostname
14256 * @property {string} href
14257 * @property {string} origin
14258 * @property {string} password
14259 * @property {string} pathname
14260 * @property {string} port
14261 * @property {string} protocol
14262 * @property {string} search
14263 * @property {any} searchParams
14264 * @property {string} username
14265 * @property {() => string} toString
14266 * @property {() => string} toJSON
14267 */
14268 /**
14269 * Check if `fileUrlOrPath` looks like a URL.
14270 *
14271 * @param {unknown} fileUrlOrPath
14272 * File path or URL.
14273 * @returns {fileUrlOrPath is URL}
14274 * Whether it’s a URL.
14275 */
14276 function isUrl(fileUrlOrPath) {
14277 return fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && fileUrlOrPath.href && fileUrlOrPath.origin;
14278 }
14279 var init_minurl_shared = __esmMin((() => {}));
14280
14281 //#endregion
14282 //#region node_modules/vfile/lib/minurl.browser.js
14283 /**
14284 * @param {string | URL} path
14285 * File URL.
14286 * @returns {string}
14287 * File URL.
14288 */
14289 function urlToPath(path) {
14290 if (typeof path === "string") path = new URL(path);
14291 else if (!isUrl(path)) {
14292 /** @type {NodeJS.ErrnoException} */
14293 const error = /* @__PURE__ */ new TypeError("The \"path\" argument must be of type string or an instance of URL. Received `" + path + "`");
14294 error.code = "ERR_INVALID_ARG_TYPE";
14295 throw error;
14296 }
14297 if (path.protocol !== "file:") {
14298 /** @type {NodeJS.ErrnoException} */
14299 const error = /* @__PURE__ */ new TypeError("The URL must be of scheme file");
14300 error.code = "ERR_INVALID_URL_SCHEME";
14301 throw error;
14302 }
14303 return getPathFromURLPosix(path);
14304 }
14305 /**
14306 * Get a path from a POSIX URL.
14307 *
14308 * @param {URL} url
14309 * URL.
14310 * @returns {string}
14311 * File path.
14312 */
14313 function getPathFromURLPosix(url) {
14314 if (url.hostname !== "") {
14315 /** @type {NodeJS.ErrnoException} */
14316 const error = /* @__PURE__ */ new TypeError("File URL host must be \"localhost\" or empty on darwin");
14317 error.code = "ERR_INVALID_FILE_URL_HOST";
14318 throw error;
14319 }
14320 const pathname = url.pathname;
14321 let index = -1;
14322 while (++index < pathname.length) if (pathname.charCodeAt(index) === 37 && pathname.charCodeAt(index + 1) === 50) {
14323 const third = pathname.charCodeAt(index + 2);
14324 if (third === 70 || third === 102) {
14325 /** @type {NodeJS.ErrnoException} */
14326 const error = /* @__PURE__ */ new TypeError("File URL path must not include encoded / characters");
14327 error.code = "ERR_INVALID_FILE_URL_PATH";
14328 throw error;
14329 }
14330 }
14331 return decodeURIComponent(pathname);
14332 }
14333 var init_minurl_browser = __esmMin((() => {
14334 init_minurl_shared();
14335 }));
14336
14337 //#endregion
14338 //#region node_modules/vfile/lib/index.js
14339 /**
14340 * Assert that `part` is not a path (as in, does not contain `path.sep`).
14341 *
14342 * @param {string | null | undefined} part
14343 * File path part.
14344 * @param {string} name
14345 * Part name.
14346 * @returns {void}
14347 * Nothing.
14348 */
14349 function assertPart(part, name) {
14350 if (part && part.includes(path.sep)) throw new Error("`" + name + "` cannot be a path: did not expect `" + path.sep + "`");
14351 }
14352 /**
14353 * Assert that `part` is not empty.
14354 *
14355 * @param {string | undefined} part
14356 * Thing.
14357 * @param {string} name
14358 * Part name.
14359 * @returns {asserts part is string}
14360 * Nothing.
14361 */
14362 function assertNonEmpty(part, name) {
14363 if (!part) throw new Error("`" + name + "` cannot be empty");
14364 }
14365 /**
14366 * Assert `path` exists.
14367 *
14368 * @param {string | undefined} path
14369 * Path.
14370 * @param {string} name
14371 * Dependency name.
14372 * @returns {asserts path is string}
14373 * Nothing.
14374 */
14375 function assertPath(path, name) {
14376 if (!path) throw new Error("Setting `" + name + "` requires `path` to be set too");
14377 }
14378 /**
14379 * Assert `value` is a buffer.
14380 *
14381 * @param {unknown} value
14382 * thing.
14383 * @returns {value is Buffer}
14384 * Whether `value` is a Node.js buffer.
14385 */
14386 function buffer(value) {
14387 return (0, import_is_buffer$1.default)(value);
14388 }
14389 var import_is_buffer$1, order, VFile;
14390 var init_lib$13 = __esmMin((() => {
14391 import_is_buffer$1 = /* @__PURE__ */ __toESM(require_is_buffer$1(), 1);
14392 init_vfile_message();
14393 init_minpath_browser();
14394 init_minproc_browser();
14395 init_minurl_browser();
14396 order = [
14397 "history",
14398 "path",
14399 "basename",
14400 "stem",
14401 "extname",
14402 "dirname"
14403 ];
14404 VFile = class {
14405 /**
14406 * Create a new virtual file.
14407 *
14408 * `options` is treated as:
14409 *
14410 * * `string` or `Buffer` — `{value: options}`
14411 * * `URL` — `{path: options}`
14412 * * `VFile` — shallow copies its data over to the new file
14413 * * `object` — all fields are shallow copied over to the new file
14414 *
14415 * Path related fields are set in the following order (least specific to
14416 * most specific): `history`, `path`, `basename`, `stem`, `extname`,
14417 * `dirname`.
14418 *
14419 * You cannot set `dirname` or `extname` without setting either `history`,
14420 * `path`, `basename`, or `stem` too.
14421 *
14422 * @param {Compatible | null | undefined} [value]
14423 * File value.
14424 * @returns
14425 * New instance.
14426 */
14427 constructor(value) {
14428 /** @type {Options | VFile} */
14429 let options;
14430 if (!value) options = {};
14431 else if (typeof value === "string" || buffer(value)) options = { value };
14432 else if (isUrl(value)) options = { path: value };
14433 else options = value;
14434 /**
14435 * Place to store custom information (default: `{}`).
14436 *
14437 * It’s OK to store custom data directly on the file but moving it to
14438 * `data` is recommended.
14439 *
14440 * @type {Data}
14441 */
14442 this.data = {};
14443 /**
14444 * List of messages associated with the file.
14445 *
14446 * @type {Array<VFileMessage>}
14447 */
14448 this.messages = [];
14449 /**
14450 * List of filepaths the file moved between.
14451 *
14452 * The first is the original path and the last is the current path.
14453 *
14454 * @type {Array<string>}
14455 */
14456 this.history = [];
14457 /**
14458 * Base of `path` (default: `process.cwd()` or `'/'` in browsers).
14459 *
14460 * @type {string}
14461 */
14462 this.cwd = proc.cwd();
14463 /**
14464 * Raw value.
14465 *
14466 * @type {Value}
14467 */
14468 this.value;
14469 /**
14470 * Whether a file was saved to disk.
14471 *
14472 * This is used by vfile reporters.
14473 *
14474 * @type {boolean}
14475 */
14476 this.stored;
14477 /**
14478 * Custom, non-string, compiled, representation.
14479 *
14480 * This is used by unified to store non-string results.
14481 * One example is when turning markdown into React nodes.
14482 *
14483 * @type {unknown}
14484 */
14485 this.result;
14486 /**
14487 * Source map.
14488 *
14489 * This type is equivalent to the `RawSourceMap` type from the `source-map`
14490 * module.
14491 *
14492 * @type {Map | null | undefined}
14493 */
14494 this.map;
14495 let index = -1;
14496 while (++index < order.length) {
14497 const prop = order[index];
14498 if (prop in options && options[prop] !== void 0 && options[prop] !== null) this[prop] = prop === "history" ? [...options[prop]] : options[prop];
14499 }
14500 /** @type {string} */
14501 let prop;
14502 for (prop in options) if (!order.includes(prop)) this[prop] = options[prop];
14503 }
14504 /**
14505 * Get the full path (example: `'~/index.min.js'`).
14506 *
14507 * @returns {string}
14508 */
14509 get path() {
14510 return this.history[this.history.length - 1];
14511 }
14512 /**
14513 * Set the full path (example: `'~/index.min.js'`).
14514 *
14515 * Cannot be nullified.
14516 * You can set a file URL (a `URL` object with a `file:` protocol) which will
14517 * be turned into a path with `url.fileURLToPath`.
14518 *
14519 * @param {string | URL} path
14520 */
14521 set path(path) {
14522 if (isUrl(path)) path = urlToPath(path);
14523 assertNonEmpty(path, "path");
14524 if (this.path !== path) this.history.push(path);
14525 }
14526 /**
14527 * Get the parent path (example: `'~'`).
14528 */
14529 get dirname() {
14530 return typeof this.path === "string" ? path.dirname(this.path) : void 0;
14531 }
14532 /**
14533 * Set the parent path (example: `'~'`).
14534 *
14535 * Cannot be set if there’s no `path` yet.
14536 */
14537 set dirname(dirname) {
14538 assertPath(this.basename, "dirname");
14539 this.path = path.join(dirname || "", this.basename);
14540 }
14541 /**
14542 * Get the basename (including extname) (example: `'index.min.js'`).
14543 */
14544 get basename() {
14545 return typeof this.path === "string" ? path.basename(this.path) : void 0;
14546 }
14547 /**
14548 * Set basename (including extname) (`'index.min.js'`).
14549 *
14550 * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
14551 * on windows).
14552 * Cannot be nullified (use `file.path = file.dirname` instead).
14553 */
14554 set basename(basename) {
14555 assertNonEmpty(basename, "basename");
14556 assertPart(basename, "basename");
14557 this.path = path.join(this.dirname || "", basename);
14558 }
14559 /**
14560 * Get the extname (including dot) (example: `'.js'`).
14561 */
14562 get extname() {
14563 return typeof this.path === "string" ? path.extname(this.path) : void 0;
14564 }
14565 /**
14566 * Set the extname (including dot) (example: `'.js'`).
14567 *
14568 * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
14569 * on windows).
14570 * Cannot be set if there’s no `path` yet.
14571 */
14572 set extname(extname) {
14573 assertPart(extname, "extname");
14574 assertPath(this.dirname, "extname");
14575 if (extname) {
14576 if (extname.charCodeAt(0) !== 46) throw new Error("`extname` must start with `.`");
14577 if (extname.includes(".", 1)) throw new Error("`extname` cannot contain multiple dots");
14578 }
14579 this.path = path.join(this.dirname, this.stem + (extname || ""));
14580 }
14581 /**
14582 * Get the stem (basename w/o extname) (example: `'index.min'`).
14583 */
14584 get stem() {
14585 return typeof this.path === "string" ? path.basename(this.path, this.extname) : void 0;
14586 }
14587 /**
14588 * Set the stem (basename w/o extname) (example: `'index.min'`).
14589 *
14590 * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
14591 * on windows).
14592 * Cannot be nullified (use `file.path = file.dirname` instead).
14593 */
14594 set stem(stem) {
14595 assertNonEmpty(stem, "stem");
14596 assertPart(stem, "stem");
14597 this.path = path.join(this.dirname || "", stem + (this.extname || ""));
14598 }
14599 /**
14600 * Serialize the file.
14601 *
14602 * @param {BufferEncoding | null | undefined} [encoding='utf8']
14603 * Character encoding to understand `value` as when it’s a `Buffer`
14604 * (default: `'utf8'`).
14605 * @returns {string}
14606 * Serialized file.
14607 */
14608 toString(encoding) {
14609 return (this.value || "").toString(encoding || void 0);
14610 }
14611 /**
14612 * Create a warning message associated with the file.
14613 *
14614 * Its `fatal` is set to `false` and `file` is set to the current file path.
14615 * Its added to `file.messages`.
14616 *
14617 * @param {string | Error | VFileMessage} reason
14618 * Reason for message, uses the stack and message of the error if given.
14619 * @param {Node | NodeLike | Position | Point | null | undefined} [place]
14620 * Place in file where the message occurred.
14621 * @param {string | null | undefined} [origin]
14622 * Place in code where the message originates (example:
14623 * `'my-package:my-rule'` or `'my-rule'`).
14624 * @returns {VFileMessage}
14625 * Message.
14626 */
14627 message(reason, place, origin) {
14628 const message = new VFileMessage(reason, place, origin);
14629 if (this.path) {
14630 message.name = this.path + ":" + message.name;
14631 message.file = this.path;
14632 }
14633 message.fatal = false;
14634 this.messages.push(message);
14635 return message;
14636 }
14637 /**
14638 * Create an info message associated with the file.
14639 *
14640 * Its `fatal` is set to `null` and `file` is set to the current file path.
14641 * Its added to `file.messages`.
14642 *
14643 * @param {string | Error | VFileMessage} reason
14644 * Reason for message, uses the stack and message of the error if given.
14645 * @param {Node | NodeLike | Position | Point | null | undefined} [place]
14646 * Place in file where the message occurred.
14647 * @param {string | null | undefined} [origin]
14648 * Place in code where the message originates (example:
14649 * `'my-package:my-rule'` or `'my-rule'`).
14650 * @returns {VFileMessage}
14651 * Message.
14652 */
14653 info(reason, place, origin) {
14654 const message = this.message(reason, place, origin);
14655 message.fatal = null;
14656 return message;
14657 }
14658 /**
14659 * Create a fatal error associated with the file.
14660 *
14661 * Its `fatal` is set to `true` and `file` is set to the current file path.
14662 * Its added to `file.messages`.
14663 *
14664 * > 👉 **Note**: a fatal error means that a file is no longer processable.
14665 *
14666 * @param {string | Error | VFileMessage} reason
14667 * Reason for message, uses the stack and message of the error if given.
14668 * @param {Node | NodeLike | Position | Point | null | undefined} [place]
14669 * Place in file where the message occurred.
14670 * @param {string | null | undefined} [origin]
14671 * Place in code where the message originates (example:
14672 * `'my-package:my-rule'` or `'my-rule'`).
14673 * @returns {never}
14674 * Message.
14675 * @throws {VFileMessage}
14676 * Message.
14677 */
14678 fail(reason, place, origin) {
14679 const message = this.message(reason, place, origin);
14680 message.fatal = true;
14681 throw message;
14682 }
14683 };
14684 }));
14685
14686 //#endregion
14687 //#region node_modules/vfile/index.js
14688 var init_vfile = __esmMin((() => {
14689 init_lib$13();
14690 }));
14691
14692 //#endregion
14693 //#region node_modules/bail/index.js
14694 /**
14695 * Throw a given error.
14696 *
14697 * @param {Error|null|undefined} [error]
14698 * Maybe error.
14699 * @returns {asserts error is null|undefined}
14700 */
14701 function bail(error) {
14702 if (error) throw error;
14703 }
14704 var init_bail = __esmMin((() => {}));
14705
14706 //#endregion
14707 //#region node_modules/unified/node_modules/is-buffer/index.js
14708 var require_is_buffer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14709 /*!
14710 * Determine if an object is a Buffer
14711 *
14712 * @author Feross Aboukhadijeh <https://feross.org>
14713 * @license MIT
14714 */
14715 module.exports = function isBuffer(obj) {
14716 return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
14717 };
14718 }));
14719
14720 //#endregion
14721 //#region node_modules/extend/index.js
14722 var require_extend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14723 var hasOwn = Object.prototype.hasOwnProperty;
14724 var toStr = Object.prototype.toString;
14725 var defineProperty = Object.defineProperty;
14726 var gOPD = Object.getOwnPropertyDescriptor;
14727 var isArray = function isArray(arr) {
14728 if (typeof Array.isArray === "function") return Array.isArray(arr);
14729 return toStr.call(arr) === "[object Array]";
14730 };
14731 var isPlainObject = function isPlainObject(obj) {
14732 if (!obj || toStr.call(obj) !== "[object Object]") return false;
14733 var hasOwnConstructor = hasOwn.call(obj, "constructor");
14734 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
14735 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) return false;
14736 var key;
14737 for (key in obj);
14738 return typeof key === "undefined" || hasOwn.call(obj, key);
14739 };
14740 var setProperty = function setProperty(target, options) {
14741 if (defineProperty && options.name === "__proto__") defineProperty(target, options.name, {
14742 enumerable: true,
14743 configurable: true,
14744 value: options.newValue,
14745 writable: true
14746 });
14747 else target[options.name] = options.newValue;
14748 };
14749 var getProperty = function getProperty(obj, name) {
14750 if (name === "__proto__") {
14751 if (!hasOwn.call(obj, name)) return;
14752 else if (gOPD) return gOPD(obj, name).value;
14753 }
14754 return obj[name];
14755 };
14756 module.exports = function extend() {
14757 var options;
14758 var name;
14759 var src;
14760 var copy;
14761 var copyIsArray;
14762 var clone;
14763 var target = arguments[0];
14764 var i = 1;
14765 var length = arguments.length;
14766 var deep = false;
14767 if (typeof target === "boolean") {
14768 deep = target;
14769 target = arguments[1] || {};
14770 i = 2;
14771 }
14772 if (target == null || typeof target !== "object" && typeof target !== "function") target = {};
14773 for (; i < length; ++i) {
14774 options = arguments[i];
14775 if (options != null) for (name in options) {
14776 src = getProperty(target, name);
14777 copy = getProperty(options, name);
14778 if (target !== copy) {
14779 if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
14780 if (copyIsArray) {
14781 copyIsArray = false;
14782 clone = src && isArray(src) ? src : [];
14783 } else clone = src && isPlainObject(src) ? src : {};
14784 setProperty(target, {
14785 name,
14786 newValue: extend(deep, clone, copy)
14787 });
14788 } else if (typeof copy !== "undefined") setProperty(target, {
14789 name,
14790 newValue: copy
14791 });
14792 }
14793 }
14794 }
14795 return target;
14796 };
14797 }));
14798
14799 //#endregion
14800 //#region node_modules/is-plain-obj/index.js
14801 function isPlainObject(value) {
14802 if (typeof value !== "object" || value === null) return false;
14803 const prototype = Object.getPrototypeOf(value);
14804 return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14805 }
14806 var init_is_plain_obj = __esmMin((() => {}));
14807
14808 //#endregion
14809 //#region node_modules/trough/lib/index.js
14810 /**
14811 * @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback
14812 * Callback.
14813 *
14814 * @typedef {(...input: Array<any>) => any} Middleware
14815 * Ware.
14816 *
14817 * @typedef Pipeline
14818 * Pipeline.
14819 * @property {Run} run
14820 * Run the pipeline.
14821 * @property {Use} use
14822 * Add middleware.
14823 *
14824 * @typedef {(...input: Array<any>) => void} Run
14825 * Call all middleware.
14826 *
14827 * Calls `done` on completion with either an error or the output of the
14828 * last middleware.
14829 *
14830 * > 👉 **Note**: as the length of input defines whether async functions get a
14831 * > `next` function,
14832 * > it’s recommended to keep `input` at one value normally.
14833
14834 *
14835 * @typedef {(fn: Middleware) => Pipeline} Use
14836 * Add middleware.
14837 */
14838 /**
14839 * Create new middleware.
14840 *
14841 * @returns {Pipeline}
14842 * Pipeline.
14843 */
14844 function trough() {
14845 /** @type {Array<Middleware>} */
14846 const fns = [];
14847 /** @type {Pipeline} */
14848 const pipeline = {
14849 run,
14850 use
14851 };
14852 return pipeline;
14853 /** @type {Run} */
14854 function run(...values) {
14855 let middlewareIndex = -1;
14856 /** @type {Callback} */
14857 const callback = values.pop();
14858 if (typeof callback !== "function") throw new TypeError("Expected function as last argument, not " + callback);
14859 next(null, ...values);
14860 /**
14861 * Run the next `fn`, or we’re done.
14862 *
14863 * @param {Error | null | undefined} error
14864 * @param {Array<any>} output
14865 */
14866 function next(error, ...output) {
14867 const fn = fns[++middlewareIndex];
14868 let index = -1;
14869 if (error) {
14870 callback(error);
14871 return;
14872 }
14873 while (++index < values.length) if (output[index] === null || output[index] === void 0) output[index] = values[index];
14874 values = output;
14875 if (fn) wrap$1(fn, next)(...output);
14876 else callback(null, ...output);
14877 }
14878 }
14879 /** @type {Use} */
14880 function use(middelware) {
14881 if (typeof middelware !== "function") throw new TypeError("Expected `middelware` to be a function, not " + middelware);
14882 fns.push(middelware);
14883 return pipeline;
14884 }
14885 }
14886 /**
14887 * Wrap `middleware` into a uniform interface.
14888 *
14889 * You can pass all input to the resulting function.
14890 * `callback` is then called with the output of `middleware`.
14891 *
14892 * If `middleware` accepts more arguments than the later given in input,
14893 * an extra `done` function is passed to it after that input,
14894 * which must be called by `middleware`.
14895 *
14896 * The first value in `input` is the main input value.
14897 * All other input values are the rest input values.
14898 * The values given to `callback` are the input values,
14899 * merged with every non-nullish output value.
14900 *
14901 * * if `middleware` throws an error,
14902 * returns a promise that is rejected,
14903 * or calls the given `done` function with an error,
14904 * `callback` is called with that error
14905 * * if `middleware` returns a value or returns a promise that is resolved,
14906 * that value is the main output value
14907 * * if `middleware` calls `done`,
14908 * all non-nullish values except for the first one (the error) overwrite the
14909 * output values
14910 *
14911 * @param {Middleware} middleware
14912 * Function to wrap.
14913 * @param {Callback} callback
14914 * Callback called with the output of `middleware`.
14915 * @returns {Run}
14916 * Wrapped middleware.
14917 */
14918 function wrap$1(middleware, callback) {
14919 /** @type {boolean} */
14920 let called;
14921 return wrapped;
14922 /**
14923 * Call `middleware`.
14924 * @this {any}
14925 * @param {Array<any>} parameters
14926 * @returns {void}
14927 */
14928 function wrapped(...parameters) {
14929 const fnExpectsCallback = middleware.length > parameters.length;
14930 /** @type {any} */
14931 let result;
14932 if (fnExpectsCallback) parameters.push(done);
14933 try {
14934 result = middleware.apply(this, parameters);
14935 } catch (error) {
14936 const exception = error;
14937 if (fnExpectsCallback && called) throw exception;
14938 return done(exception);
14939 }
14940 if (!fnExpectsCallback) if (result && result.then && typeof result.then === "function") result.then(then, done);
14941 else if (result instanceof Error) done(result);
14942 else then(result);
14943 }
14944 /**
14945 * Call `callback`, only once.
14946 *
14947 * @type {Callback}
14948 */
14949 function done(error, ...output) {
14950 if (!called) {
14951 called = true;
14952 callback(error, ...output);
14953 }
14954 }
14955 /**
14956 * Call `done` with one value.
14957 *
14958 * @param {any} [value]
14959 */
14960 function then(value) {
14961 done(null, value);
14962 }
14963 }
14964 var init_lib$12 = __esmMin((() => {
14965 __name(wrap$1, "wrap");
14966 }));
14967
14968 //#endregion
14969 //#region node_modules/trough/index.js
14970 var init_trough = __esmMin((() => {
14971 init_lib$12();
14972 }));
14973
14974 //#endregion
14975 //#region node_modules/unified/lib/index.js
14976 /**
14977 * @returns {Processor}
14978 */
14979 function base() {
14980 const transformers = trough();
14981 /** @type {Processor['attachers']} */
14982 const attachers = [];
14983 /** @type {Record<string, unknown>} */
14984 let namespace = {};
14985 /** @type {boolean|undefined} */
14986 let frozen;
14987 let freezeIndex = -1;
14988 processor.data = data;
14989 processor.Parser = void 0;
14990 processor.Compiler = void 0;
14991 processor.freeze = freeze;
14992 processor.attachers = attachers;
14993 processor.use = use;
14994 processor.parse = parse;
14995 processor.stringify = stringify;
14996 processor.run = run;
14997 processor.runSync = runSync;
14998 processor.process = process;
14999 processor.processSync = processSync;
15000 return processor;
15001 /** @type {Processor} */
15002 function processor() {
15003 const destination = base();
15004 let index = -1;
15005 while (++index < attachers.length) destination.use(...attachers[index]);
15006 destination.data((0, import_extend.default)(true, {}, namespace));
15007 return destination;
15008 }
15009 /**
15010 * @param {string|Record<string, unknown>} [key]
15011 * @param {unknown} [value]
15012 * @returns {unknown}
15013 */
15014 function data(key, value) {
15015 if (typeof key === "string") {
15016 if (arguments.length === 2) {
15017 assertUnfrozen("data", frozen);
15018 namespace[key] = value;
15019 return processor;
15020 }
15021 return own$6.call(namespace, key) && namespace[key] || null;
15022 }
15023 if (key) {
15024 assertUnfrozen("data", frozen);
15025 namespace = key;
15026 return processor;
15027 }
15028 return namespace;
15029 }
15030 /** @type {Processor['freeze']} */
15031 function freeze() {
15032 if (frozen) return processor;
15033 while (++freezeIndex < attachers.length) {
15034 const [attacher, ...options] = attachers[freezeIndex];
15035 if (options[0] === false) continue;
15036 if (options[0] === true) options[0] = void 0;
15037 /** @type {Transformer|void} */
15038 const transformer = attacher.call(processor, ...options);
15039 if (typeof transformer === "function") transformers.use(transformer);
15040 }
15041 frozen = true;
15042 freezeIndex = Number.POSITIVE_INFINITY;
15043 return processor;
15044 }
15045 /**
15046 * @param {Pluggable|null|undefined} [value]
15047 * @param {...unknown} options
15048 * @returns {Processor}
15049 */
15050 function use(value, ...options) {
15051 /** @type {Record<string, unknown>|undefined} */
15052 let settings;
15053 assertUnfrozen("use", frozen);
15054 if (value === null || value === void 0) {} else if (typeof value === "function") addPlugin(value, ...options);
15055 else if (typeof value === "object") if (Array.isArray(value)) addList(value);
15056 else addPreset(value);
15057 else throw new TypeError("Expected usable value, not `" + value + "`");
15058 if (settings) namespace.settings = Object.assign(namespace.settings || {}, settings);
15059 return processor;
15060 /**
15061 * @param {import('..').Pluggable<unknown[]>} value
15062 * @returns {void}
15063 */
15064 function add(value) {
15065 if (typeof value === "function") addPlugin(value);
15066 else if (typeof value === "object") if (Array.isArray(value)) {
15067 const [plugin, ...options] = value;
15068 addPlugin(plugin, ...options);
15069 } else addPreset(value);
15070 else throw new TypeError("Expected usable value, not `" + value + "`");
15071 }
15072 /**
15073 * @param {Preset} result
15074 * @returns {void}
15075 */
15076 function addPreset(result) {
15077 addList(result.plugins);
15078 if (result.settings) settings = Object.assign(settings || {}, result.settings);
15079 }
15080 /**
15081 * @param {PluggableList|null|undefined} [plugins]
15082 * @returns {void}
15083 */
15084 function addList(plugins) {
15085 let index = -1;
15086 if (plugins === null || plugins === void 0) {} else if (Array.isArray(plugins)) while (++index < plugins.length) {
15087 const thing = plugins[index];
15088 add(thing);
15089 }
15090 else throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
15091 }
15092 /**
15093 * @param {Plugin} plugin
15094 * @param {...unknown} [value]
15095 * @returns {void}
15096 */
15097 function addPlugin(plugin, value) {
15098 let index = -1;
15099 /** @type {Processor['attachers'][number]|undefined} */
15100 let entry;
15101 while (++index < attachers.length) if (attachers[index][0] === plugin) {
15102 entry = attachers[index];
15103 break;
15104 }
15105 if (entry) {
15106 if (isPlainObject(entry[1]) && isPlainObject(value)) value = (0, import_extend.default)(true, entry[1], value);
15107 entry[1] = value;
15108 } else attachers.push([...arguments]);
15109 }
15110 }
15111 /** @type {Processor['parse']} */
15112 function parse(doc) {
15113 processor.freeze();
15114 const file = vfile(doc);
15115 const Parser = processor.Parser;
15116 assertParser("parse", Parser);
15117 if (newable(Parser, "parse")) return new Parser(String(file), file).parse();
15118 return Parser(String(file), file);
15119 }
15120 /** @type {Processor['stringify']} */
15121 function stringify(node, doc) {
15122 processor.freeze();
15123 const file = vfile(doc);
15124 const Compiler = processor.Compiler;
15125 assertCompiler("stringify", Compiler);
15126 assertNode(node);
15127 if (newable(Compiler, "compile")) return new Compiler(node, file).compile();
15128 return Compiler(node, file);
15129 }
15130 /**
15131 * @param {Node} node
15132 * @param {VFileCompatible|RunCallback} [doc]
15133 * @param {RunCallback} [callback]
15134 * @returns {Promise<Node>|void}
15135 */
15136 function run(node, doc, callback) {
15137 assertNode(node);
15138 processor.freeze();
15139 if (!callback && typeof doc === "function") {
15140 callback = doc;
15141 doc = void 0;
15142 }
15143 if (!callback) return new Promise(executor);
15144 executor(null, callback);
15145 /**
15146 * @param {null|((node: Node) => void)} resolve
15147 * @param {(error: Error) => void} reject
15148 * @returns {void}
15149 */
15150 function executor(resolve, reject) {
15151 transformers.run(node, vfile(doc), done);
15152 /**
15153 * @param {Error|null} error
15154 * @param {Node} tree
15155 * @param {VFile} file
15156 * @returns {void}
15157 */
15158 function done(error, tree, file) {
15159 tree = tree || node;
15160 if (error) reject(error);
15161 else if (resolve) resolve(tree);
15162 else callback(null, tree, file);
15163 }
15164 }
15165 }
15166 /** @type {Processor['runSync']} */
15167 function runSync(node, file) {
15168 /** @type {Node|undefined} */
15169 let result;
15170 /** @type {boolean|undefined} */
15171 let complete;
15172 processor.run(node, file, done);
15173 assertDone("runSync", "run", complete);
15174 return result;
15175 /**
15176 * @param {Error|null} [error]
15177 * @param {Node} [tree]
15178 * @returns {void}
15179 */
15180 function done(error, tree) {
15181 bail(error);
15182 result = tree;
15183 complete = true;
15184 }
15185 }
15186 /**
15187 * @param {VFileCompatible} doc
15188 * @param {ProcessCallback} [callback]
15189 * @returns {Promise<VFile>|undefined}
15190 */
15191 function process(doc, callback) {
15192 processor.freeze();
15193 assertParser("process", processor.Parser);
15194 assertCompiler("process", processor.Compiler);
15195 if (!callback) return new Promise(executor);
15196 executor(null, callback);
15197 /**
15198 * @param {null|((file: VFile) => void)} resolve
15199 * @param {(error?: Error|null|undefined) => void} reject
15200 * @returns {void}
15201 */
15202 function executor(resolve, reject) {
15203 const file = vfile(doc);
15204 processor.run(processor.parse(file), file, (error, tree, file) => {
15205 if (error || !tree || !file) done(error);
15206 else {
15207 /** @type {unknown} */
15208 const result = processor.stringify(tree, file);
15209 if (result === void 0 || result === null) {} else if (looksLikeAVFileValue(result)) file.value = result;
15210 else file.result = result;
15211 done(error, file);
15212 }
15213 });
15214 /**
15215 * @param {Error|null|undefined} [error]
15216 * @param {VFile|undefined} [file]
15217 * @returns {void}
15218 */
15219 function done(error, file) {
15220 if (error || !file) reject(error);
15221 else if (resolve) resolve(file);
15222 else callback(null, file);
15223 }
15224 }
15225 }
15226 /** @type {Processor['processSync']} */
15227 function processSync(doc) {
15228 /** @type {boolean|undefined} */
15229 let complete;
15230 processor.freeze();
15231 assertParser("processSync", processor.Parser);
15232 assertCompiler("processSync", processor.Compiler);
15233 const file = vfile(doc);
15234 processor.process(file, done);
15235 assertDone("processSync", "process", complete);
15236 return file;
15237 /**
15238 * @param {Error|null|undefined} [error]
15239 * @returns {void}
15240 */
15241 function done(error) {
15242 complete = true;
15243 bail(error);
15244 }
15245 }
15246 }
15247 /**
15248 * Check if `value` is a constructor.
15249 *
15250 * @param {unknown} value
15251 * @param {string} name
15252 * @returns {boolean}
15253 */
15254 function newable(value, name) {
15255 return typeof value === "function" && value.prototype && (keys(value.prototype) || name in value.prototype);
15256 }
15257 /**
15258 * Check if `value` is an object with keys.
15259 *
15260 * @param {Record<string, unknown>} value
15261 * @returns {boolean}
15262 */
15263 function keys(value) {
15264 /** @type {string} */
15265 let key;
15266 for (key in value) if (own$6.call(value, key)) return true;
15267 return false;
15268 }
15269 /**
15270 * Assert a parser is available.
15271 *
15272 * @param {string} name
15273 * @param {unknown} value
15274 * @returns {asserts value is Parser}
15275 */
15276 function assertParser(name, value) {
15277 if (typeof value !== "function") throw new TypeError("Cannot `" + name + "` without `Parser`");
15278 }
15279 /**
15280 * Assert a compiler is available.
15281 *
15282 * @param {string} name
15283 * @param {unknown} value
15284 * @returns {asserts value is Compiler}
15285 */
15286 function assertCompiler(name, value) {
15287 if (typeof value !== "function") throw new TypeError("Cannot `" + name + "` without `Compiler`");
15288 }
15289 /**
15290 * Assert the processor is not frozen.
15291 *
15292 * @param {string} name
15293 * @param {unknown} frozen
15294 * @returns {asserts frozen is false}
15295 */
15296 function assertUnfrozen(name, frozen) {
15297 if (frozen) throw new Error("Cannot call `" + name + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.");
15298 }
15299 /**
15300 * Assert `node` is a unist node.
15301 *
15302 * @param {unknown} node
15303 * @returns {asserts node is Node}
15304 */
15305 function assertNode(node) {
15306 if (!isPlainObject(node) || typeof node.type !== "string") throw new TypeError("Expected node, got `" + node + "`");
15307 }
15308 /**
15309 * Assert that `complete` is `true`.
15310 *
15311 * @param {string} name
15312 * @param {string} asyncName
15313 * @param {unknown} complete
15314 * @returns {asserts complete is true}
15315 */
15316 function assertDone(name, asyncName, complete) {
15317 if (!complete) throw new Error("`" + name + "` finished async. Use `" + asyncName + "` instead");
15318 }
15319 /**
15320 * @param {VFileCompatible} [value]
15321 * @returns {VFile}
15322 */
15323 function vfile(value) {
15324 return looksLikeAVFile(value) ? value : new VFile(value);
15325 }
15326 /**
15327 * @param {VFileCompatible} [value]
15328 * @returns {value is VFile}
15329 */
15330 function looksLikeAVFile(value) {
15331 return Boolean(value && typeof value === "object" && "message" in value && "messages" in value);
15332 }
15333 /**
15334 * @param {unknown} [value]
15335 * @returns {value is VFileValue}
15336 */
15337 function looksLikeAVFileValue(value) {
15338 return typeof value === "string" || (0, import_is_buffer.default)(value);
15339 }
15340 var import_is_buffer, import_extend, unified, own$6;
15341 var init_lib$11 = __esmMin((() => {
15342 init_bail();
15343 import_is_buffer = /* @__PURE__ */ __toESM(require_is_buffer(), 1);
15344 import_extend = /* @__PURE__ */ __toESM(require_extend(), 1);
15345 init_is_plain_obj();
15346 init_trough();
15347 init_vfile();
15348 unified = base().freeze();
15349 own$6 = {}.hasOwnProperty;
15350 }));
15351
15352 //#endregion
15353 //#region node_modules/unified/index.js
15354 var init_unified = __esmMin((() => {
15355 init_lib$11();
15356 }));
15357
15358 //#endregion
15359 //#region node_modules/mdast-util-to-string/lib/index.js
15360 /**
15361 * Get the text content of a node or list of nodes.
15362 *
15363 * Prefers the node’s plain-text fields, otherwise serializes its children,
15364 * and if the given value is an array, serialize the nodes in it.
15365 *
15366 * @param {unknown} value
15367 * Thing to serialize, typically `Node`.
15368 * @param {Options | null | undefined} [options]
15369 * Configuration (optional).
15370 * @returns {string}
15371 * Serialized `value`.
15372 */
15373 function toString(value, options) {
15374 const settings = options || emptyOptions;
15375 return one$1(value, typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true, typeof settings.includeHtml === "boolean" ? settings.includeHtml : true);
15376 }
15377 /**
15378 * One node or several nodes.
15379 *
15380 * @param {unknown} value
15381 * Thing to serialize.
15382 * @param {boolean} includeImageAlt
15383 * Include image `alt`s.
15384 * @param {boolean} includeHtml
15385 * Include HTML.
15386 * @returns {string}
15387 * Serialized node.
15388 */
15389 function one$1(value, includeImageAlt, includeHtml) {
15390 if (node(value)) {
15391 if ("value" in value) return value.type === "html" && !includeHtml ? "" : value.value;
15392 if (includeImageAlt && "alt" in value && value.alt) return value.alt;
15393 if ("children" in value) return all$1(value.children, includeImageAlt, includeHtml);
15394 }
15395 if (Array.isArray(value)) return all$1(value, includeImageAlt, includeHtml);
15396 return "";
15397 }
15398 /**
15399 * Serialize a list of nodes.
15400 *
15401 * @param {Array<unknown>} values
15402 * Thing to serialize.
15403 * @param {boolean} includeImageAlt
15404 * Include image `alt`s.
15405 * @param {boolean} includeHtml
15406 * Include HTML.
15407 * @returns {string}
15408 * Serialized nodes.
15409 */
15410 function all$1(values, includeImageAlt, includeHtml) {
15411 /** @type {Array<string>} */
15412 const result = [];
15413 let index = -1;
15414 while (++index < values.length) result[index] = one$1(values[index], includeImageAlt, includeHtml);
15415 return result.join("");
15416 }
15417 /**
15418 * Check if `value` looks like a node.
15419 *
15420 * @param {unknown} value
15421 * Thing.
15422 * @returns {value is Node}
15423 * Whether `value` is a node.
15424 */
15425 function node(value) {
15426 return Boolean(value && typeof value === "object");
15427 }
15428 var emptyOptions;
15429 var init_lib$10 = __esmMin((() => {
15430 emptyOptions = {};
15431 __name(one$1, "one");
15432 __name(all$1, "all");
15433 }));
15434
15435 //#endregion
15436 //#region node_modules/mdast-util-to-string/index.js
15437 var init_mdast_util_to_string = __esmMin((() => {
15438 init_lib$10();
15439 }));
15440
15441 //#endregion
15442 //#region node_modules/micromark-util-chunked/index.js
15443 /**
15444 * Like `Array#splice`, but smarter for giant arrays.
15445 *
15446 * `Array#splice` takes all items to be inserted as individual argument which
15447 * causes a stack overflow in V8 when trying to insert 100k items for instance.
15448 *
15449 * Otherwise, this does not return the removed items, and takes `items` as an
15450 * array instead of rest parameters.
15451 *
15452 * @template {unknown} T
15453 * Item type.
15454 * @param {Array<T>} list
15455 * List to operate on.
15456 * @param {number} start
15457 * Index to remove/insert at (can be negative).
15458 * @param {number} remove
15459 * Number of items to remove.
15460 * @param {Array<T>} items
15461 * Items to inject into `list`.
15462 * @returns {void}
15463 * Nothing.
15464 */
15465 function splice(list, start, remove, items) {
15466 const end = list.length;
15467 let chunkStart = 0;
15468 /** @type {Array<unknown>} */
15469 let parameters;
15470 if (start < 0) start = -start > end ? 0 : end + start;
15471 else start = start > end ? end : start;
15472 remove = remove > 0 ? remove : 0;
15473 if (items.length < 1e4) {
15474 parameters = Array.from(items);
15475 parameters.unshift(start, remove);
15476 list.splice(...parameters);
15477 } else {
15478 if (remove) list.splice(start, remove);
15479 while (chunkStart < items.length) {
15480 parameters = items.slice(chunkStart, chunkStart + 1e4);
15481 parameters.unshift(start, 0);
15482 list.splice(...parameters);
15483 chunkStart += 1e4;
15484 start += 1e4;
15485 }
15486 }
15487 }
15488 /**
15489 * Append `items` (an array) at the end of `list` (another array).
15490 * When `list` was empty, returns `items` instead.
15491 *
15492 * This prevents a potentially expensive operation when `list` is empty,
15493 * and adds items in batches to prevent V8 from hanging.
15494 *
15495 * @template {unknown} T
15496 * Item type.
15497 * @param {Array<T>} list
15498 * List to operate on.
15499 * @param {Array<T>} items
15500 * Items to add to `list`.
15501 * @returns {Array<T>}
15502 * Either `list` or `items`.
15503 */
15504 function push(list, items) {
15505 if (list.length > 0) {
15506 splice(list, list.length, 0, items);
15507 return list;
15508 }
15509 return items;
15510 }
15511 var init_micromark_util_chunked = __esmMin((() => {}));
15512
15513 //#endregion
15514 //#region node_modules/micromark-util-combine-extensions/index.js
15515 /**
15516 * Combine multiple syntax extensions into one.
15517 *
15518 * @param {Array<Extension>} extensions
15519 * List of syntax extensions.
15520 * @returns {NormalizedExtension}
15521 * A single combined extension.
15522 */
15523 function combineExtensions(extensions) {
15524 /** @type {NormalizedExtension} */
15525 const all = {};
15526 let index = -1;
15527 while (++index < extensions.length) syntaxExtension(all, extensions[index]);
15528 return all;
15529 }
15530 /**
15531 * Merge `extension` into `all`.
15532 *
15533 * @param {NormalizedExtension} all
15534 * Extension to merge into.
15535 * @param {Extension} extension
15536 * Extension to merge.
15537 * @returns {void}
15538 */
15539 function syntaxExtension(all, extension) {
15540 /** @type {keyof Extension} */
15541 let hook;
15542 for (hook in extension) {
15543 /** @type {Record<string, unknown>} */
15544 const left = (hasOwnProperty.call(all, hook) ? all[hook] : void 0) || (all[hook] = {});
15545 /** @type {Record<string, unknown> | undefined} */
15546 const right = extension[hook];
15547 /** @type {string} */
15548 let code;
15549 if (right) for (code in right) {
15550 if (!hasOwnProperty.call(left, code)) left[code] = [];
15551 const value = right[code];
15552 constructs(left[code], Array.isArray(value) ? value : value ? [value] : []);
15553 }
15554 }
15555 }
15556 /**
15557 * Merge `list` into `existing` (both lists of constructs).
15558 * Mutates `existing`.
15559 *
15560 * @param {Array<unknown>} existing
15561 * @param {Array<unknown>} list
15562 * @returns {void}
15563 */
15564 function constructs(existing, list) {
15565 let index = -1;
15566 /** @type {Array<unknown>} */
15567 const before = [];
15568 while (++index < list.length) (list[index].add === "after" ? existing : before).push(list[index]);
15569 splice(existing, 0, 0, before);
15570 }
15571 var hasOwnProperty;
15572 var init_micromark_util_combine_extensions = __esmMin((() => {
15573 init_micromark_util_chunked();
15574 hasOwnProperty = {}.hasOwnProperty;
15575 }));
15576
15577 //#endregion
15578 //#region node_modules/micromark-util-character/lib/unicode-punctuation-regex.js
15579 var unicodePunctuationRegex;
15580 var init_unicode_punctuation_regex = __esmMin((() => {
15581 unicodePunctuationRegex = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;
15582 }));
15583
15584 //#endregion
15585 //#region node_modules/micromark-util-character/index.js
15586 /**
15587 * Check whether a character code is an ASCII control character.
15588 *
15589 * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
15590 * to U+001F (US), or U+007F (DEL).
15591 *
15592 * @param {Code} code
15593 * Code.
15594 * @returns {boolean}
15595 * Whether it matches.
15596 */
15597 function asciiControl(code) {
15598 return code !== null && (code < 32 || code === 127);
15599 }
15600 /**
15601 * Check whether a character code is a markdown line ending.
15602 *
15603 * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
15604 * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
15605 *
15606 * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
15607 * RETURN (CR) are replaced by these virtual characters depending on whether
15608 * they occurred together.
15609 *
15610 * @param {Code} code
15611 * Code.
15612 * @returns {boolean}
15613 * Whether it matches.
15614 */
15615 function markdownLineEnding(code) {
15616 return code !== null && code < -2;
15617 }
15618 /**
15619 * Check whether a character code is a markdown line ending (see
15620 * `markdownLineEnding`) or markdown space (see `markdownSpace`).
15621 *
15622 * @param {Code} code
15623 * Code.
15624 * @returns {boolean}
15625 * Whether it matches.
15626 */
15627 function markdownLineEndingOrSpace(code) {
15628 return code !== null && (code < 0 || code === 32);
15629 }
15630 /**
15631 * Check whether a character code is a markdown space.
15632 *
15633 * A **markdown space** is the concrete character U+0020 SPACE (SP) and the
15634 * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
15635 *
15636 * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
15637 * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
15638 * SPACE (VS) characters, depending on the column at which the tab occurred.
15639 *
15640 * @param {Code} code
15641 * Code.
15642 * @returns {boolean}
15643 * Whether it matches.
15644 */
15645 function markdownSpace(code) {
15646 return code === -2 || code === -1 || code === 32;
15647 }
15648 /**
15649 * Create a code check from a regex.
15650 *
15651 * @param {RegExp} regex
15652 * @returns {(code: Code) => boolean}
15653 */
15654 function regexCheck(regex) {
15655 return check;
15656 /**
15657 * Check whether a code matches the bound regex.
15658 *
15659 * @param {Code} code
15660 * Character code.
15661 * @returns {boolean}
15662 * Whether the character code matches the bound regex.
15663 */
15664 function check(code) {
15665 return code !== null && regex.test(String.fromCharCode(code));
15666 }
15667 }
15668 var asciiAlpha, asciiAlphanumeric, asciiAtext, asciiDigit, asciiHexDigit, asciiPunctuation, unicodePunctuation, unicodeWhitespace;
15669 var init_micromark_util_character = __esmMin((() => {
15670 init_unicode_punctuation_regex();
15671 asciiAlpha = regexCheck(/[A-Za-z]/);
15672 asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
15673 asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
15674 asciiDigit = regexCheck(/\d/);
15675 asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
15676 asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
15677 unicodePunctuation = regexCheck(unicodePunctuationRegex);
15678 unicodeWhitespace = regexCheck(/\s/);
15679 }));
15680
15681 //#endregion
15682 //#region node_modules/micromark-factory-space/index.js
15683 /**
15684 * Parse spaces and tabs.
15685 *
15686 * There is no `nok` parameter:
15687 *
15688 * * spaces in markdown are often optional, in which case this factory can be
15689 * used and `ok` will be switched to whether spaces were found or not
15690 * * one line ending or space can be detected with `markdownSpace(code)` right
15691 * before using `factorySpace`
15692 *
15693 * ###### Examples
15694 *
15695 * Where `␉` represents a tab (plus how much it expands) and `␠` represents a
15696 * single space.
15697 *
15698 * ```markdown
15699 * ␉
15700 * ␠␠␠␠
15701 * ␉␠
15702 * ```
15703 *
15704 * @param {Effects} effects
15705 * Context.
15706 * @param {State} ok
15707 * State switched to when successful.
15708 * @param {TokenType} type
15709 * Type (`' \t'`).
15710 * @param {number | undefined} [max=Infinity]
15711 * Max (exclusive).
15712 * @returns
15713 * Start state.
15714 */
15715 function factorySpace(effects, ok, type, max) {
15716 const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
15717 let size = 0;
15718 return start;
15719 /** @type {State} */
15720 function start(code) {
15721 if (markdownSpace(code)) {
15722 effects.enter(type);
15723 return prefix(code);
15724 }
15725 return ok(code);
15726 }
15727 /** @type {State} */
15728 function prefix(code) {
15729 if (markdownSpace(code) && size++ < limit) {
15730 effects.consume(code);
15731 return prefix;
15732 }
15733 effects.exit(type);
15734 return ok(code);
15735 }
15736 }
15737 var init_micromark_factory_space = __esmMin((() => {
15738 init_micromark_util_character();
15739 }));
15740
15741 //#endregion
15742 //#region node_modules/micromark/lib/initialize/content.js
15743 /**
15744 * @this {TokenizeContext}
15745 * @type {Initializer}
15746 */
15747 function initializeContent(effects) {
15748 const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
15749 /** @type {Token} */
15750 let previous;
15751 return contentStart;
15752 /** @type {State} */
15753 function afterContentStartConstruct(code) {
15754 if (code === null) {
15755 effects.consume(code);
15756 return;
15757 }
15758 effects.enter("lineEnding");
15759 effects.consume(code);
15760 effects.exit("lineEnding");
15761 return factorySpace(effects, contentStart, "linePrefix");
15762 }
15763 /** @type {State} */
15764 function paragraphInitial(code) {
15765 effects.enter("paragraph");
15766 return lineStart(code);
15767 }
15768 /** @type {State} */
15769 function lineStart(code) {
15770 const token = effects.enter("chunkText", {
15771 contentType: "text",
15772 previous
15773 });
15774 if (previous) previous.next = token;
15775 previous = token;
15776 return data(code);
15777 }
15778 /** @type {State} */
15779 function data(code) {
15780 if (code === null) {
15781 effects.exit("chunkText");
15782 effects.exit("paragraph");
15783 effects.consume(code);
15784 return;
15785 }
15786 if (markdownLineEnding(code)) {
15787 effects.consume(code);
15788 effects.exit("chunkText");
15789 return lineStart;
15790 }
15791 effects.consume(code);
15792 return data;
15793 }
15794 }
15795 var content$1;
15796 var init_content$1 = __esmMin((() => {
15797 init_micromark_factory_space();
15798 init_micromark_util_character();
15799 content$1 = { tokenize: initializeContent };
15800 }));
15801
15802 //#endregion
15803 //#region node_modules/micromark/lib/initialize/document.js
15804 /**
15805 * @this {TokenizeContext}
15806 * @type {Initializer}
15807 */
15808 function initializeDocument(effects) {
15809 const self = this;
15810 /** @type {Array<StackItem>} */
15811 const stack = [];
15812 let continued = 0;
15813 /** @type {TokenizeContext | undefined} */
15814 let childFlow;
15815 /** @type {Token | undefined} */
15816 let childToken;
15817 /** @type {number} */
15818 let lineStartOffset;
15819 return start;
15820 /** @type {State} */
15821 function start(code) {
15822 if (continued < stack.length) {
15823 const item = stack[continued];
15824 self.containerState = item[1];
15825 return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);
15826 }
15827 return checkNewContainers(code);
15828 }
15829 /** @type {State} */
15830 function documentContinue(code) {
15831 continued++;
15832 if (self.containerState._closeFlow) {
15833 self.containerState._closeFlow = void 0;
15834 if (childFlow) closeFlow();
15835 const indexBeforeExits = self.events.length;
15836 let indexBeforeFlow = indexBeforeExits;
15837 /** @type {Point | undefined} */
15838 let point;
15839 while (indexBeforeFlow--) if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") {
15840 point = self.events[indexBeforeFlow][1].end;
15841 break;
15842 }
15843 exitContainers(continued);
15844 let index = indexBeforeExits;
15845 while (index < self.events.length) {
15846 self.events[index][1].end = Object.assign({}, point);
15847 index++;
15848 }
15849 splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
15850 self.events.length = index;
15851 return checkNewContainers(code);
15852 }
15853 return start(code);
15854 }
15855 /** @type {State} */
15856 function checkNewContainers(code) {
15857 if (continued === stack.length) {
15858 if (!childFlow) return documentContinued(code);
15859 if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) return flowStart(code);
15860 self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);
15861 }
15862 self.containerState = {};
15863 return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
15864 }
15865 /** @type {State} */
15866 function thereIsANewContainer(code) {
15867 if (childFlow) closeFlow();
15868 exitContainers(continued);
15869 return documentContinued(code);
15870 }
15871 /** @type {State} */
15872 function thereIsNoNewContainer(code) {
15873 self.parser.lazy[self.now().line] = continued !== stack.length;
15874 lineStartOffset = self.now().offset;
15875 return flowStart(code);
15876 }
15877 /** @type {State} */
15878 function documentContinued(code) {
15879 self.containerState = {};
15880 return effects.attempt(containerConstruct, containerContinue, flowStart)(code);
15881 }
15882 /** @type {State} */
15883 function containerContinue(code) {
15884 continued++;
15885 stack.push([self.currentConstruct, self.containerState]);
15886 return documentContinued(code);
15887 }
15888 /** @type {State} */
15889 function flowStart(code) {
15890 if (code === null) {
15891 if (childFlow) closeFlow();
15892 exitContainers(0);
15893 effects.consume(code);
15894 return;
15895 }
15896 childFlow = childFlow || self.parser.flow(self.now());
15897 effects.enter("chunkFlow", {
15898 contentType: "flow",
15899 previous: childToken,
15900 _tokenizer: childFlow
15901 });
15902 return flowContinue(code);
15903 }
15904 /** @type {State} */
15905 function flowContinue(code) {
15906 if (code === null) {
15907 writeToChild(effects.exit("chunkFlow"), true);
15908 exitContainers(0);
15909 effects.consume(code);
15910 return;
15911 }
15912 if (markdownLineEnding(code)) {
15913 effects.consume(code);
15914 writeToChild(effects.exit("chunkFlow"));
15915 continued = 0;
15916 self.interrupt = void 0;
15917 return start;
15918 }
15919 effects.consume(code);
15920 return flowContinue;
15921 }
15922 /**
15923 * @param {Token} token
15924 * @param {boolean | undefined} [eof]
15925 * @returns {void}
15926 */
15927 function writeToChild(token, eof) {
15928 const stream = self.sliceStream(token);
15929 if (eof) stream.push(null);
15930 token.previous = childToken;
15931 if (childToken) childToken.next = token;
15932 childToken = token;
15933 childFlow.defineSkip(token.start);
15934 childFlow.write(stream);
15935 if (self.parser.lazy[token.start.line]) {
15936 let index = childFlow.events.length;
15937 while (index--) if (childFlow.events[index][1].start.offset < lineStartOffset && (!childFlow.events[index][1].end || childFlow.events[index][1].end.offset > lineStartOffset)) return;
15938 const indexBeforeExits = self.events.length;
15939 let indexBeforeFlow = indexBeforeExits;
15940 /** @type {boolean | undefined} */
15941 let seen;
15942 /** @type {Point | undefined} */
15943 let point;
15944 while (indexBeforeFlow--) if (self.events[indexBeforeFlow][0] === "exit" && self.events[indexBeforeFlow][1].type === "chunkFlow") {
15945 if (seen) {
15946 point = self.events[indexBeforeFlow][1].end;
15947 break;
15948 }
15949 seen = true;
15950 }
15951 exitContainers(continued);
15952 index = indexBeforeExits;
15953 while (index < self.events.length) {
15954 self.events[index][1].end = Object.assign({}, point);
15955 index++;
15956 }
15957 splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
15958 self.events.length = index;
15959 }
15960 }
15961 /**
15962 * @param {number} size
15963 * @returns {void}
15964 */
15965 function exitContainers(size) {
15966 let index = stack.length;
15967 while (index-- > size) {
15968 const entry = stack[index];
15969 self.containerState = entry[1];
15970 entry[0].exit.call(self, effects);
15971 }
15972 stack.length = size;
15973 }
15974 function closeFlow() {
15975 childFlow.write([null]);
15976 childToken = void 0;
15977 childFlow = void 0;
15978 self.containerState._closeFlow = void 0;
15979 }
15980 }
15981 /**
15982 * @this {TokenizeContext}
15983 * @type {Tokenizer}
15984 */
15985 function tokenizeContainer(effects, ok, nok) {
15986 return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
15987 }
15988 var document$2, containerConstruct;
15989 var init_document = __esmMin((() => {
15990 init_micromark_factory_space();
15991 init_micromark_util_character();
15992 init_micromark_util_chunked();
15993 document$2 = { tokenize: initializeDocument };
15994 containerConstruct = { tokenize: tokenizeContainer };
15995 }));
15996
15997 //#endregion
15998 //#region node_modules/micromark-util-classify-character/index.js
15999 /**
16000 * Classify whether a code represents whitespace, punctuation, or something
16001 * else.
16002 *
16003 * Used for attention (emphasis, strong), whose sequences can open or close
16004 * based on the class of surrounding characters.
16005 *
16006 * > 👉 **Note**: eof (`null`) is seen as whitespace.
16007 *
16008 * @param {Code} code
16009 * Code.
16010 * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
16011 * Group.
16012 */
16013 function classifyCharacter(code) {
16014 if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) return 1;
16015 if (unicodePunctuation(code)) return 2;
16016 }
16017 var init_micromark_util_classify_character = __esmMin((() => {
16018 init_micromark_util_character();
16019 }));
16020
16021 //#endregion
16022 //#region node_modules/micromark-util-resolve-all/index.js
16023 /**
16024 * @typedef {import('micromark-util-types').Event} Event
16025 * @typedef {import('micromark-util-types').Resolver} Resolver
16026 * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
16027 */
16028 /**
16029 * Call all `resolveAll`s.
16030 *
16031 * @param {Array<{resolveAll?: Resolver | undefined}>} constructs
16032 * List of constructs, optionally with `resolveAll`s.
16033 * @param {Array<Event>} events
16034 * List of events.
16035 * @param {TokenizeContext} context
16036 * Context used by `tokenize`.
16037 * @returns {Array<Event>}
16038 * Changed events.
16039 */
16040 function resolveAll(constructs, events, context) {
16041 /** @type {Array<Resolver>} */
16042 const called = [];
16043 let index = -1;
16044 while (++index < constructs.length) {
16045 const resolve = constructs[index].resolveAll;
16046 if (resolve && !called.includes(resolve)) {
16047 events = resolve(events, context);
16048 called.push(resolve);
16049 }
16050 }
16051 return events;
16052 }
16053 var init_micromark_util_resolve_all = __esmMin((() => {}));
16054
16055 //#endregion
16056 //#region node_modules/micromark-core-commonmark/lib/attention.js
16057 /**
16058 * Take all events and resolve attention to emphasis or strong.
16059 *
16060 * @type {Resolver}
16061 */
16062 function resolveAllAttention(events, context) {
16063 let index = -1;
16064 /** @type {number} */
16065 let open;
16066 /** @type {Token} */
16067 let group;
16068 /** @type {Token} */
16069 let text;
16070 /** @type {Token} */
16071 let openingSequence;
16072 /** @type {Token} */
16073 let closingSequence;
16074 /** @type {number} */
16075 let use;
16076 /** @type {Array<Event>} */
16077 let nextEvents;
16078 /** @type {number} */
16079 let offset;
16080 while (++index < events.length) if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
16081 open = index;
16082 while (open--) if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
16083 if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) continue;
16084 use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
16085 const start = Object.assign({}, events[open][1].end);
16086 const end = Object.assign({}, events[index][1].start);
16087 movePoint(start, -use);
16088 movePoint(end, use);
16089 openingSequence = {
16090 type: use > 1 ? "strongSequence" : "emphasisSequence",
16091 start,
16092 end: Object.assign({}, events[open][1].end)
16093 };
16094 closingSequence = {
16095 type: use > 1 ? "strongSequence" : "emphasisSequence",
16096 start: Object.assign({}, events[index][1].start),
16097 end
16098 };
16099 text = {
16100 type: use > 1 ? "strongText" : "emphasisText",
16101 start: Object.assign({}, events[open][1].end),
16102 end: Object.assign({}, events[index][1].start)
16103 };
16104 group = {
16105 type: use > 1 ? "strong" : "emphasis",
16106 start: Object.assign({}, openingSequence.start),
16107 end: Object.assign({}, closingSequence.end)
16108 };
16109 events[open][1].end = Object.assign({}, openingSequence.start);
16110 events[index][1].start = Object.assign({}, closingSequence.end);
16111 nextEvents = [];
16112 if (events[open][1].end.offset - events[open][1].start.offset) nextEvents = push(nextEvents, [[
16113 "enter",
16114 events[open][1],
16115 context
16116 ], [
16117 "exit",
16118 events[open][1],
16119 context
16120 ]]);
16121 nextEvents = push(nextEvents, [
16122 [
16123 "enter",
16124 group,
16125 context
16126 ],
16127 [
16128 "enter",
16129 openingSequence,
16130 context
16131 ],
16132 [
16133 "exit",
16134 openingSequence,
16135 context
16136 ],
16137 [
16138 "enter",
16139 text,
16140 context
16141 ]
16142 ]);
16143 nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));
16144 nextEvents = push(nextEvents, [
16145 [
16146 "exit",
16147 text,
16148 context
16149 ],
16150 [
16151 "enter",
16152 closingSequence,
16153 context
16154 ],
16155 [
16156 "exit",
16157 closingSequence,
16158 context
16159 ],
16160 [
16161 "exit",
16162 group,
16163 context
16164 ]
16165 ]);
16166 if (events[index][1].end.offset - events[index][1].start.offset) {
16167 offset = 2;
16168 nextEvents = push(nextEvents, [[
16169 "enter",
16170 events[index][1],
16171 context
16172 ], [
16173 "exit",
16174 events[index][1],
16175 context
16176 ]]);
16177 } else offset = 0;
16178 splice(events, open - 1, index - open + 3, nextEvents);
16179 index = open + nextEvents.length - offset - 2;
16180 break;
16181 }
16182 }
16183 index = -1;
16184 while (++index < events.length) if (events[index][1].type === "attentionSequence") events[index][1].type = "data";
16185 return events;
16186 }
16187 /**
16188 * @this {TokenizeContext}
16189 * @type {Tokenizer}
16190 */
16191 function tokenizeAttention(effects, ok) {
16192 const attentionMarkers = this.parser.constructs.attentionMarkers.null;
16193 const previous = this.previous;
16194 const before = classifyCharacter(previous);
16195 /** @type {NonNullable<Code>} */
16196 let marker;
16197 return start;
16198 /**
16199 * Before a sequence.
16200 *
16201 * ```markdown
16202 * > | **
16203 * ^
16204 * ```
16205 *
16206 * @type {State}
16207 */
16208 function start(code) {
16209 marker = code;
16210 effects.enter("attentionSequence");
16211 return inside(code);
16212 }
16213 /**
16214 * In a sequence.
16215 *
16216 * ```markdown
16217 * > | **
16218 * ^^
16219 * ```
16220 *
16221 * @type {State}
16222 */
16223 function inside(code) {
16224 if (code === marker) {
16225 effects.consume(code);
16226 return inside;
16227 }
16228 const token = effects.exit("attentionSequence");
16229 const after = classifyCharacter(code);
16230 const open = !after || after === 2 && before || attentionMarkers.includes(code);
16231 const close = !before || before === 2 && after || attentionMarkers.includes(previous);
16232 token._open = Boolean(marker === 42 ? open : open && (before || !close));
16233 token._close = Boolean(marker === 42 ? close : close && (after || !open));
16234 return ok(code);
16235 }
16236 }
16237 /**
16238 * Move a point a bit.
16239 *
16240 * Note: `move` only works inside lines! It’s not possible to move past other
16241 * chunks (replacement characters, tabs, or line endings).
16242 *
16243 * @param {Point} point
16244 * @param {number} offset
16245 * @returns {void}
16246 */
16247 function movePoint(point, offset) {
16248 point.column += offset;
16249 point.offset += offset;
16250 point._bufferIndex += offset;
16251 }
16252 var attention;
16253 var init_attention = __esmMin((() => {
16254 init_micromark_util_chunked();
16255 init_micromark_util_classify_character();
16256 init_micromark_util_resolve_all();
16257 attention = {
16258 name: "attention",
16259 tokenize: tokenizeAttention,
16260 resolveAll: resolveAllAttention
16261 };
16262 }));
16263
16264 //#endregion
16265 //#region node_modules/micromark-core-commonmark/lib/autolink.js
16266 /**
16267 * @this {TokenizeContext}
16268 * @type {Tokenizer}
16269 */
16270 function tokenizeAutolink(effects, ok, nok) {
16271 let size = 0;
16272 return start;
16273 /**
16274 * Start of an autolink.
16275 *
16276 * ```markdown
16277 * > | a<https://example.com>b
16278 * ^
16279 * > | a<user@example.com>b
16280 * ^
16281 * ```
16282 *
16283 * @type {State}
16284 */
16285 function start(code) {
16286 effects.enter("autolink");
16287 effects.enter("autolinkMarker");
16288 effects.consume(code);
16289 effects.exit("autolinkMarker");
16290 effects.enter("autolinkProtocol");
16291 return open;
16292 }
16293 /**
16294 * After `<`, at protocol or atext.
16295 *
16296 * ```markdown
16297 * > | a<https://example.com>b
16298 * ^
16299 * > | a<user@example.com>b
16300 * ^
16301 * ```
16302 *
16303 * @type {State}
16304 */
16305 function open(code) {
16306 if (asciiAlpha(code)) {
16307 effects.consume(code);
16308 return schemeOrEmailAtext;
16309 }
16310 return emailAtext(code);
16311 }
16312 /**
16313 * At second byte of protocol or atext.
16314 *
16315 * ```markdown
16316 * > | a<https://example.com>b
16317 * ^
16318 * > | a<user@example.com>b
16319 * ^
16320 * ```
16321 *
16322 * @type {State}
16323 */
16324 function schemeOrEmailAtext(code) {
16325 if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
16326 size = 1;
16327 return schemeInsideOrEmailAtext(code);
16328 }
16329 return emailAtext(code);
16330 }
16331 /**
16332 * In ambiguous protocol or atext.
16333 *
16334 * ```markdown
16335 * > | a<https://example.com>b
16336 * ^
16337 * > | a<user@example.com>b
16338 * ^
16339 * ```
16340 *
16341 * @type {State}
16342 */
16343 function schemeInsideOrEmailAtext(code) {
16344 if (code === 58) {
16345 effects.consume(code);
16346 size = 0;
16347 return urlInside;
16348 }
16349 if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {
16350 effects.consume(code);
16351 return schemeInsideOrEmailAtext;
16352 }
16353 size = 0;
16354 return emailAtext(code);
16355 }
16356 /**
16357 * After protocol, in URL.
16358 *
16359 * ```markdown
16360 * > | a<https://example.com>b
16361 * ^
16362 * ```
16363 *
16364 * @type {State}
16365 */
16366 function urlInside(code) {
16367 if (code === 62) {
16368 effects.exit("autolinkProtocol");
16369 effects.enter("autolinkMarker");
16370 effects.consume(code);
16371 effects.exit("autolinkMarker");
16372 effects.exit("autolink");
16373 return ok;
16374 }
16375 if (code === null || code === 32 || code === 60 || asciiControl(code)) return nok(code);
16376 effects.consume(code);
16377 return urlInside;
16378 }
16379 /**
16380 * In email atext.
16381 *
16382 * ```markdown
16383 * > | a<user.name@example.com>b
16384 * ^
16385 * ```
16386 *
16387 * @type {State}
16388 */
16389 function emailAtext(code) {
16390 if (code === 64) {
16391 effects.consume(code);
16392 return emailAtSignOrDot;
16393 }
16394 if (asciiAtext(code)) {
16395 effects.consume(code);
16396 return emailAtext;
16397 }
16398 return nok(code);
16399 }
16400 /**
16401 * In label, after at-sign or dot.
16402 *
16403 * ```markdown
16404 * > | a<user.name@example.com>b
16405 * ^ ^
16406 * ```
16407 *
16408 * @type {State}
16409 */
16410 function emailAtSignOrDot(code) {
16411 return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);
16412 }
16413 /**
16414 * In label, where `.` and `>` are allowed.
16415 *
16416 * ```markdown
16417 * > | a<user.name@example.com>b
16418 * ^
16419 * ```
16420 *
16421 * @type {State}
16422 */
16423 function emailLabel(code) {
16424 if (code === 46) {
16425 effects.consume(code);
16426 size = 0;
16427 return emailAtSignOrDot;
16428 }
16429 if (code === 62) {
16430 effects.exit("autolinkProtocol").type = "autolinkEmail";
16431 effects.enter("autolinkMarker");
16432 effects.consume(code);
16433 effects.exit("autolinkMarker");
16434 effects.exit("autolink");
16435 return ok;
16436 }
16437 return emailValue(code);
16438 }
16439 /**
16440 * In label, where `.` and `>` are *not* allowed.
16441 *
16442 * Though, this is also used in `emailLabel` to parse other values.
16443 *
16444 * ```markdown
16445 * > | a<user.name@ex-ample.com>b
16446 * ^
16447 * ```
16448 *
16449 * @type {State}
16450 */
16451 function emailValue(code) {
16452 if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
16453 const next = code === 45 ? emailValue : emailLabel;
16454 effects.consume(code);
16455 return next;
16456 }
16457 return nok(code);
16458 }
16459 }
16460 var autolink;
16461 var init_autolink = __esmMin((() => {
16462 init_micromark_util_character();
16463 autolink = {
16464 name: "autolink",
16465 tokenize: tokenizeAutolink
16466 };
16467 }));
16468
16469 //#endregion
16470 //#region node_modules/micromark-core-commonmark/lib/blank-line.js
16471 /**
16472 * @this {TokenizeContext}
16473 * @type {Tokenizer}
16474 */
16475 function tokenizeBlankLine(effects, ok, nok) {
16476 return start;
16477 /**
16478 * Start of blank line.
16479 *
16480 * > 👉 **Note**: `␠` represents a space character.
16481 *
16482 * ```markdown
16483 * > | ␠␠␊
16484 * ^
16485 * > | ␊
16486 * ^
16487 * ```
16488 *
16489 * @type {State}
16490 */
16491 function start(code) {
16492 return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code);
16493 }
16494 /**
16495 * At eof/eol, after optional whitespace.
16496 *
16497 * > 👉 **Note**: `␠` represents a space character.
16498 *
16499 * ```markdown
16500 * > | ␠␠␊
16501 * ^
16502 * > | ␊
16503 * ^
16504 * ```
16505 *
16506 * @type {State}
16507 */
16508 function after(code) {
16509 return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
16510 }
16511 }
16512 var blankLine;
16513 var init_blank_line = __esmMin((() => {
16514 init_micromark_factory_space();
16515 init_micromark_util_character();
16516 blankLine = {
16517 tokenize: tokenizeBlankLine,
16518 partial: true
16519 };
16520 }));
16521
16522 //#endregion
16523 //#region node_modules/micromark-core-commonmark/lib/block-quote.js
16524 /**
16525 * @this {TokenizeContext}
16526 * @type {Tokenizer}
16527 */
16528 function tokenizeBlockQuoteStart(effects, ok, nok) {
16529 const self = this;
16530 return start;
16531 /**
16532 * Start of block quote.
16533 *
16534 * ```markdown
16535 * > | > a
16536 * ^
16537 * ```
16538 *
16539 * @type {State}
16540 */
16541 function start(code) {
16542 if (code === 62) {
16543 const state = self.containerState;
16544 if (!state.open) {
16545 effects.enter("blockQuote", { _container: true });
16546 state.open = true;
16547 }
16548 effects.enter("blockQuotePrefix");
16549 effects.enter("blockQuoteMarker");
16550 effects.consume(code);
16551 effects.exit("blockQuoteMarker");
16552 return after;
16553 }
16554 return nok(code);
16555 }
16556 /**
16557 * After `>`, before optional whitespace.
16558 *
16559 * ```markdown
16560 * > | > a
16561 * ^
16562 * ```
16563 *
16564 * @type {State}
16565 */
16566 function after(code) {
16567 if (markdownSpace(code)) {
16568 effects.enter("blockQuotePrefixWhitespace");
16569 effects.consume(code);
16570 effects.exit("blockQuotePrefixWhitespace");
16571 effects.exit("blockQuotePrefix");
16572 return ok;
16573 }
16574 effects.exit("blockQuotePrefix");
16575 return ok(code);
16576 }
16577 }
16578 /**
16579 * Start of block quote continuation.
16580 *
16581 * ```markdown
16582 * | > a
16583 * > | > b
16584 * ^
16585 * ```
16586 *
16587 * @this {TokenizeContext}
16588 * @type {Tokenizer}
16589 */
16590 function tokenizeBlockQuoteContinuation(effects, ok, nok) {
16591 const self = this;
16592 return contStart;
16593 /**
16594 * Start of block quote continuation.
16595 *
16596 * Also used to parse the first block quote opening.
16597 *
16598 * ```markdown
16599 * | > a
16600 * > | > b
16601 * ^
16602 * ```
16603 *
16604 * @type {State}
16605 */
16606 function contStart(code) {
16607 if (markdownSpace(code)) return factorySpace(effects, contBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code);
16608 return contBefore(code);
16609 }
16610 /**
16611 * At `>`, after optional whitespace.
16612 *
16613 * Also used to parse the first block quote opening.
16614 *
16615 * ```markdown
16616 * | > a
16617 * > | > b
16618 * ^
16619 * ```
16620 *
16621 * @type {State}
16622 */
16623 function contBefore(code) {
16624 return effects.attempt(blockQuote, ok, nok)(code);
16625 }
16626 }
16627 /** @type {Exiter} */
16628 function exit(effects) {
16629 effects.exit("blockQuote");
16630 }
16631 var blockQuote;
16632 var init_block_quote = __esmMin((() => {
16633 init_micromark_factory_space();
16634 init_micromark_util_character();
16635 blockQuote = {
16636 name: "blockQuote",
16637 tokenize: tokenizeBlockQuoteStart,
16638 continuation: { tokenize: tokenizeBlockQuoteContinuation },
16639 exit
16640 };
16641 }));
16642
16643 //#endregion
16644 //#region node_modules/micromark-core-commonmark/lib/character-escape.js
16645 /**
16646 * @this {TokenizeContext}
16647 * @type {Tokenizer}
16648 */
16649 function tokenizeCharacterEscape(effects, ok, nok) {
16650 return start;
16651 /**
16652 * Start of character escape.
16653 *
16654 * ```markdown
16655 * > | a\*b
16656 * ^
16657 * ```
16658 *
16659 * @type {State}
16660 */
16661 function start(code) {
16662 effects.enter("characterEscape");
16663 effects.enter("escapeMarker");
16664 effects.consume(code);
16665 effects.exit("escapeMarker");
16666 return inside;
16667 }
16668 /**
16669 * After `\`, at punctuation.
16670 *
16671 * ```markdown
16672 * > | a\*b
16673 * ^
16674 * ```
16675 *
16676 * @type {State}
16677 */
16678 function inside(code) {
16679 if (asciiPunctuation(code)) {
16680 effects.enter("characterEscapeValue");
16681 effects.consume(code);
16682 effects.exit("characterEscapeValue");
16683 effects.exit("characterEscape");
16684 return ok;
16685 }
16686 return nok(code);
16687 }
16688 }
16689 var characterEscape;
16690 var init_character_escape = __esmMin((() => {
16691 init_micromark_util_character();
16692 characterEscape = {
16693 name: "characterEscape",
16694 tokenize: tokenizeCharacterEscape
16695 };
16696 }));
16697
16698 //#endregion
16699 //#region node_modules/decode-named-character-reference/index.dom.js
16700 /**
16701 * @param {string} value
16702 * @returns {string | false}
16703 */
16704 function decodeNamedCharacterReference(value) {
16705 const characterReference = "&" + value + ";";
16706 element.innerHTML = characterReference;
16707 const character = element.textContent;
16708 if (character.charCodeAt(character.length - 1) === 59 && value !== "semi") return false;
16709 return character === characterReference ? false : character;
16710 }
16711 var element;
16712 var init_index_dom = __esmMin((() => {
16713 element = document.createElement("i");
16714 }));
16715
16716 //#endregion
16717 //#region node_modules/micromark-core-commonmark/lib/character-reference.js
16718 /**
16719 * @this {TokenizeContext}
16720 * @type {Tokenizer}
16721 */
16722 function tokenizeCharacterReference(effects, ok, nok) {
16723 const self = this;
16724 let size = 0;
16725 /** @type {number} */
16726 let max;
16727 /** @type {(code: Code) => boolean} */
16728 let test;
16729 return start;
16730 /**
16731 * Start of character reference.
16732 *
16733 * ```markdown
16734 * > | a&amp;b
16735 * ^
16736 * > | a&#123;b
16737 * ^
16738 * > | a&#x9;b
16739 * ^
16740 * ```
16741 *
16742 * @type {State}
16743 */
16744 function start(code) {
16745 effects.enter("characterReference");
16746 effects.enter("characterReferenceMarker");
16747 effects.consume(code);
16748 effects.exit("characterReferenceMarker");
16749 return open;
16750 }
16751 /**
16752 * After `&`, at `#` for numeric references or alphanumeric for named
16753 * references.
16754 *
16755 * ```markdown
16756 * > | a&amp;b
16757 * ^
16758 * > | a&#123;b
16759 * ^
16760 * > | a&#x9;b
16761 * ^
16762 * ```
16763 *
16764 * @type {State}
16765 */
16766 function open(code) {
16767 if (code === 35) {
16768 effects.enter("characterReferenceMarkerNumeric");
16769 effects.consume(code);
16770 effects.exit("characterReferenceMarkerNumeric");
16771 return numeric;
16772 }
16773 effects.enter("characterReferenceValue");
16774 max = 31;
16775 test = asciiAlphanumeric;
16776 return value(code);
16777 }
16778 /**
16779 * After `#`, at `x` for hexadecimals or digit for decimals.
16780 *
16781 * ```markdown
16782 * > | a&#123;b
16783 * ^
16784 * > | a&#x9;b
16785 * ^
16786 * ```
16787 *
16788 * @type {State}
16789 */
16790 function numeric(code) {
16791 if (code === 88 || code === 120) {
16792 effects.enter("characterReferenceMarkerHexadecimal");
16793 effects.consume(code);
16794 effects.exit("characterReferenceMarkerHexadecimal");
16795 effects.enter("characterReferenceValue");
16796 max = 6;
16797 test = asciiHexDigit;
16798 return value;
16799 }
16800 effects.enter("characterReferenceValue");
16801 max = 7;
16802 test = asciiDigit;
16803 return value(code);
16804 }
16805 /**
16806 * After markers (`&#x`, `&#`, or `&`), in value, before `;`.
16807 *
16808 * The character reference kind defines what and how many characters are
16809 * allowed.
16810 *
16811 * ```markdown
16812 * > | a&amp;b
16813 * ^^^
16814 * > | a&#123;b
16815 * ^^^
16816 * > | a&#x9;b
16817 * ^
16818 * ```
16819 *
16820 * @type {State}
16821 */
16822 function value(code) {
16823 if (code === 59 && size) {
16824 const token = effects.exit("characterReferenceValue");
16825 if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) return nok(code);
16826 effects.enter("characterReferenceMarker");
16827 effects.consume(code);
16828 effects.exit("characterReferenceMarker");
16829 effects.exit("characterReference");
16830 return ok;
16831 }
16832 if (test(code) && size++ < max) {
16833 effects.consume(code);
16834 return value;
16835 }
16836 return nok(code);
16837 }
16838 }
16839 var characterReference;
16840 var init_character_reference = __esmMin((() => {
16841 init_index_dom();
16842 init_micromark_util_character();
16843 characterReference = {
16844 name: "characterReference",
16845 tokenize: tokenizeCharacterReference
16846 };
16847 }));
16848
16849 //#endregion
16850 //#region node_modules/micromark-core-commonmark/lib/code-fenced.js
16851 /**
16852 * @this {TokenizeContext}
16853 * @type {Tokenizer}
16854 */
16855 function tokenizeCodeFenced(effects, ok, nok) {
16856 const self = this;
16857 /** @type {Construct} */
16858 const closeStart = {
16859 tokenize: tokenizeCloseStart,
16860 partial: true
16861 };
16862 let initialPrefix = 0;
16863 let sizeOpen = 0;
16864 /** @type {NonNullable<Code>} */
16865 let marker;
16866 return start;
16867 /**
16868 * Start of code.
16869 *
16870 * ```markdown
16871 * > | ~~~js
16872 * ^
16873 * | alert(1)
16874 * | ~~~
16875 * ```
16876 *
16877 * @type {State}
16878 */
16879 function start(code) {
16880 return beforeSequenceOpen(code);
16881 }
16882 /**
16883 * In opening fence, after prefix, at sequence.
16884 *
16885 * ```markdown
16886 * > | ~~~js
16887 * ^
16888 * | alert(1)
16889 * | ~~~
16890 * ```
16891 *
16892 * @type {State}
16893 */
16894 function beforeSequenceOpen(code) {
16895 const tail = self.events[self.events.length - 1];
16896 initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
16897 marker = code;
16898 effects.enter("codeFenced");
16899 effects.enter("codeFencedFence");
16900 effects.enter("codeFencedFenceSequence");
16901 return sequenceOpen(code);
16902 }
16903 /**
16904 * In opening fence sequence.
16905 *
16906 * ```markdown
16907 * > | ~~~js
16908 * ^
16909 * | alert(1)
16910 * | ~~~
16911 * ```
16912 *
16913 * @type {State}
16914 */
16915 function sequenceOpen(code) {
16916 if (code === marker) {
16917 sizeOpen++;
16918 effects.consume(code);
16919 return sequenceOpen;
16920 }
16921 if (sizeOpen < 3) return nok(code);
16922 effects.exit("codeFencedFenceSequence");
16923 return markdownSpace(code) ? factorySpace(effects, infoBefore, "whitespace")(code) : infoBefore(code);
16924 }
16925 /**
16926 * In opening fence, after the sequence (and optional whitespace), before info.
16927 *
16928 * ```markdown
16929 * > | ~~~js
16930 * ^
16931 * | alert(1)
16932 * | ~~~
16933 * ```
16934 *
16935 * @type {State}
16936 */
16937 function infoBefore(code) {
16938 if (code === null || markdownLineEnding(code)) {
16939 effects.exit("codeFencedFence");
16940 return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code);
16941 }
16942 effects.enter("codeFencedFenceInfo");
16943 effects.enter("chunkString", { contentType: "string" });
16944 return info(code);
16945 }
16946 /**
16947 * In info.
16948 *
16949 * ```markdown
16950 * > | ~~~js
16951 * ^
16952 * | alert(1)
16953 * | ~~~
16954 * ```
16955 *
16956 * @type {State}
16957 */
16958 function info(code) {
16959 if (code === null || markdownLineEnding(code)) {
16960 effects.exit("chunkString");
16961 effects.exit("codeFencedFenceInfo");
16962 return infoBefore(code);
16963 }
16964 if (markdownSpace(code)) {
16965 effects.exit("chunkString");
16966 effects.exit("codeFencedFenceInfo");
16967 return factorySpace(effects, metaBefore, "whitespace")(code);
16968 }
16969 if (code === 96 && code === marker) return nok(code);
16970 effects.consume(code);
16971 return info;
16972 }
16973 /**
16974 * In opening fence, after info and whitespace, before meta.
16975 *
16976 * ```markdown
16977 * > | ~~~js eval
16978 * ^
16979 * | alert(1)
16980 * | ~~~
16981 * ```
16982 *
16983 * @type {State}
16984 */
16985 function metaBefore(code) {
16986 if (code === null || markdownLineEnding(code)) return infoBefore(code);
16987 effects.enter("codeFencedFenceMeta");
16988 effects.enter("chunkString", { contentType: "string" });
16989 return meta(code);
16990 }
16991 /**
16992 * In meta.
16993 *
16994 * ```markdown
16995 * > | ~~~js eval
16996 * ^
16997 * | alert(1)
16998 * | ~~~
16999 * ```
17000 *
17001 * @type {State}
17002 */
17003 function meta(code) {
17004 if (code === null || markdownLineEnding(code)) {
17005 effects.exit("chunkString");
17006 effects.exit("codeFencedFenceMeta");
17007 return infoBefore(code);
17008 }
17009 if (code === 96 && code === marker) return nok(code);
17010 effects.consume(code);
17011 return meta;
17012 }
17013 /**
17014 * At eol/eof in code, before a non-lazy closing fence or content.
17015 *
17016 * ```markdown
17017 * > | ~~~js
17018 * ^
17019 * > | alert(1)
17020 * ^
17021 * | ~~~
17022 * ```
17023 *
17024 * @type {State}
17025 */
17026 function atNonLazyBreak(code) {
17027 return effects.attempt(closeStart, after, contentBefore)(code);
17028 }
17029 /**
17030 * Before code content, not a closing fence, at eol.
17031 *
17032 * ```markdown
17033 * | ~~~js
17034 * > | alert(1)
17035 * ^
17036 * | ~~~
17037 * ```
17038 *
17039 * @type {State}
17040 */
17041 function contentBefore(code) {
17042 effects.enter("lineEnding");
17043 effects.consume(code);
17044 effects.exit("lineEnding");
17045 return contentStart;
17046 }
17047 /**
17048 * Before code content, not a closing fence.
17049 *
17050 * ```markdown
17051 * | ~~~js
17052 * > | alert(1)
17053 * ^
17054 * | ~~~
17055 * ```
17056 *
17057 * @type {State}
17058 */
17059 function contentStart(code) {
17060 return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, "linePrefix", initialPrefix + 1)(code) : beforeContentChunk(code);
17061 }
17062 /**
17063 * Before code content, after optional prefix.
17064 *
17065 * ```markdown
17066 * | ~~~js
17067 * > | alert(1)
17068 * ^
17069 * | ~~~
17070 * ```
17071 *
17072 * @type {State}
17073 */
17074 function beforeContentChunk(code) {
17075 if (code === null || markdownLineEnding(code)) return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code);
17076 effects.enter("codeFlowValue");
17077 return contentChunk(code);
17078 }
17079 /**
17080 * In code content.
17081 *
17082 * ```markdown
17083 * | ~~~js
17084 * > | alert(1)
17085 * ^^^^^^^^
17086 * | ~~~
17087 * ```
17088 *
17089 * @type {State}
17090 */
17091 function contentChunk(code) {
17092 if (code === null || markdownLineEnding(code)) {
17093 effects.exit("codeFlowValue");
17094 return beforeContentChunk(code);
17095 }
17096 effects.consume(code);
17097 return contentChunk;
17098 }
17099 /**
17100 * After code.
17101 *
17102 * ```markdown
17103 * | ~~~js
17104 * | alert(1)
17105 * > | ~~~
17106 * ^
17107 * ```
17108 *
17109 * @type {State}
17110 */
17111 function after(code) {
17112 effects.exit("codeFenced");
17113 return ok(code);
17114 }
17115 /**
17116 * @this {TokenizeContext}
17117 * @type {Tokenizer}
17118 */
17119 function tokenizeCloseStart(effects, ok, nok) {
17120 let size = 0;
17121 return startBefore;
17122 /**
17123 *
17124 *
17125 * @type {State}
17126 */
17127 function startBefore(code) {
17128 effects.enter("lineEnding");
17129 effects.consume(code);
17130 effects.exit("lineEnding");
17131 return start;
17132 }
17133 /**
17134 * Before closing fence, at optional whitespace.
17135 *
17136 * ```markdown
17137 * | ~~~js
17138 * | alert(1)
17139 * > | ~~~
17140 * ^
17141 * ```
17142 *
17143 * @type {State}
17144 */
17145 function start(code) {
17146 effects.enter("codeFencedFence");
17147 return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code) : beforeSequenceClose(code);
17148 }
17149 /**
17150 * In closing fence, after optional whitespace, at sequence.
17151 *
17152 * ```markdown
17153 * | ~~~js
17154 * | alert(1)
17155 * > | ~~~
17156 * ^
17157 * ```
17158 *
17159 * @type {State}
17160 */
17161 function beforeSequenceClose(code) {
17162 if (code === marker) {
17163 effects.enter("codeFencedFenceSequence");
17164 return sequenceClose(code);
17165 }
17166 return nok(code);
17167 }
17168 /**
17169 * In closing fence sequence.
17170 *
17171 * ```markdown
17172 * | ~~~js
17173 * | alert(1)
17174 * > | ~~~
17175 * ^
17176 * ```
17177 *
17178 * @type {State}
17179 */
17180 function sequenceClose(code) {
17181 if (code === marker) {
17182 size++;
17183 effects.consume(code);
17184 return sequenceClose;
17185 }
17186 if (size >= sizeOpen) {
17187 effects.exit("codeFencedFenceSequence");
17188 return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, "whitespace")(code) : sequenceCloseAfter(code);
17189 }
17190 return nok(code);
17191 }
17192 /**
17193 * After closing fence sequence, after optional whitespace.
17194 *
17195 * ```markdown
17196 * | ~~~js
17197 * | alert(1)
17198 * > | ~~~
17199 * ^
17200 * ```
17201 *
17202 * @type {State}
17203 */
17204 function sequenceCloseAfter(code) {
17205 if (code === null || markdownLineEnding(code)) {
17206 effects.exit("codeFencedFence");
17207 return ok(code);
17208 }
17209 return nok(code);
17210 }
17211 }
17212 }
17213 /**
17214 * @this {TokenizeContext}
17215 * @type {Tokenizer}
17216 */
17217 function tokenizeNonLazyContinuation(effects, ok, nok) {
17218 const self = this;
17219 return start;
17220 /**
17221 *
17222 *
17223 * @type {State}
17224 */
17225 function start(code) {
17226 if (code === null) return nok(code);
17227 effects.enter("lineEnding");
17228 effects.consume(code);
17229 effects.exit("lineEnding");
17230 return lineStart;
17231 }
17232 /**
17233 *
17234 *
17235 * @type {State}
17236 */
17237 function lineStart(code) {
17238 return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
17239 }
17240 }
17241 var nonLazyContinuation, codeFenced;
17242 var init_code_fenced = __esmMin((() => {
17243 init_micromark_factory_space();
17244 init_micromark_util_character();
17245 nonLazyContinuation = {
17246 tokenize: tokenizeNonLazyContinuation,
17247 partial: true
17248 };
17249 codeFenced = {
17250 name: "codeFenced",
17251 tokenize: tokenizeCodeFenced,
17252 concrete: true
17253 };
17254 }));
17255
17256 //#endregion
17257 //#region node_modules/micromark-core-commonmark/lib/code-indented.js
17258 /**
17259 * @this {TokenizeContext}
17260 * @type {Tokenizer}
17261 */
17262 function tokenizeCodeIndented(effects, ok, nok) {
17263 const self = this;
17264 return start;
17265 /**
17266 * Start of code (indented).
17267 *
17268 * > **Parsing note**: it is not needed to check if this first line is a
17269 * > filled line (that it has a non-whitespace character), because blank lines
17270 * > are parsed already, so we never run into that.
17271 *
17272 * ```markdown
17273 * > | aaa
17274 * ^
17275 * ```
17276 *
17277 * @type {State}
17278 */
17279 function start(code) {
17280 effects.enter("codeIndented");
17281 return factorySpace(effects, afterPrefix, "linePrefix", 5)(code);
17282 }
17283 /**
17284 * At start, after 1 or 4 spaces.
17285 *
17286 * ```markdown
17287 * > | aaa
17288 * ^
17289 * ```
17290 *
17291 * @type {State}
17292 */
17293 function afterPrefix(code) {
17294 const tail = self.events[self.events.length - 1];
17295 return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code);
17296 }
17297 /**
17298 * At a break.
17299 *
17300 * ```markdown
17301 * > | aaa
17302 * ^ ^
17303 * ```
17304 *
17305 * @type {State}
17306 */
17307 function atBreak(code) {
17308 if (code === null) return after(code);
17309 if (markdownLineEnding(code)) return effects.attempt(furtherStart, atBreak, after)(code);
17310 effects.enter("codeFlowValue");
17311 return inside(code);
17312 }
17313 /**
17314 * In code content.
17315 *
17316 * ```markdown
17317 * > | aaa
17318 * ^^^^
17319 * ```
17320 *
17321 * @type {State}
17322 */
17323 function inside(code) {
17324 if (code === null || markdownLineEnding(code)) {
17325 effects.exit("codeFlowValue");
17326 return atBreak(code);
17327 }
17328 effects.consume(code);
17329 return inside;
17330 }
17331 /** @type {State} */
17332 function after(code) {
17333 effects.exit("codeIndented");
17334 return ok(code);
17335 }
17336 }
17337 /**
17338 * @this {TokenizeContext}
17339 * @type {Tokenizer}
17340 */
17341 function tokenizeFurtherStart(effects, ok, nok) {
17342 const self = this;
17343 return furtherStart;
17344 /**
17345 * At eol, trying to parse another indent.
17346 *
17347 * ```markdown
17348 * > | aaa
17349 * ^
17350 * | bbb
17351 * ```
17352 *
17353 * @type {State}
17354 */
17355 function furtherStart(code) {
17356 if (self.parser.lazy[self.now().line]) return nok(code);
17357 if (markdownLineEnding(code)) {
17358 effects.enter("lineEnding");
17359 effects.consume(code);
17360 effects.exit("lineEnding");
17361 return furtherStart;
17362 }
17363 return factorySpace(effects, afterPrefix, "linePrefix", 5)(code);
17364 }
17365 /**
17366 * At start, after 1 or 4 spaces.
17367 *
17368 * ```markdown
17369 * > | aaa
17370 * ^
17371 * ```
17372 *
17373 * @type {State}
17374 */
17375 function afterPrefix(code) {
17376 const tail = self.events[self.events.length - 1];
17377 return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
17378 }
17379 }
17380 var codeIndented, furtherStart;
17381 var init_code_indented = __esmMin((() => {
17382 init_micromark_factory_space();
17383 init_micromark_util_character();
17384 codeIndented = {
17385 name: "codeIndented",
17386 tokenize: tokenizeCodeIndented
17387 };
17388 furtherStart = {
17389 tokenize: tokenizeFurtherStart,
17390 partial: true
17391 };
17392 }));
17393
17394 //#endregion
17395 //#region node_modules/micromark-core-commonmark/lib/code-text.js
17396 /** @type {Resolver} */
17397 function resolveCodeText(events) {
17398 let tailExitIndex = events.length - 4;
17399 let headEnterIndex = 3;
17400 /** @type {number} */
17401 let index;
17402 /** @type {number | undefined} */
17403 let enter;
17404 if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) {
17405 index = headEnterIndex;
17406 while (++index < tailExitIndex) if (events[index][1].type === "codeTextData") {
17407 events[headEnterIndex][1].type = "codeTextPadding";
17408 events[tailExitIndex][1].type = "codeTextPadding";
17409 headEnterIndex += 2;
17410 tailExitIndex -= 2;
17411 break;
17412 }
17413 }
17414 index = headEnterIndex - 1;
17415 tailExitIndex++;
17416 while (++index <= tailExitIndex) if (enter === void 0) {
17417 if (index !== tailExitIndex && events[index][1].type !== "lineEnding") enter = index;
17418 } else if (index === tailExitIndex || events[index][1].type === "lineEnding") {
17419 events[enter][1].type = "codeTextData";
17420 if (index !== enter + 2) {
17421 events[enter][1].end = events[index - 1][1].end;
17422 events.splice(enter + 2, index - enter - 2);
17423 tailExitIndex -= index - enter - 2;
17424 index = enter + 2;
17425 }
17426 enter = void 0;
17427 }
17428 return events;
17429 }
17430 /**
17431 * @this {TokenizeContext}
17432 * @type {Previous}
17433 */
17434 function previous(code) {
17435 return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
17436 }
17437 /**
17438 * @this {TokenizeContext}
17439 * @type {Tokenizer}
17440 */
17441 function tokenizeCodeText(effects, ok, nok) {
17442 let sizeOpen = 0;
17443 /** @type {number} */
17444 let size;
17445 /** @type {Token} */
17446 let token;
17447 return start;
17448 /**
17449 * Start of code (text).
17450 *
17451 * ```markdown
17452 * > | `a`
17453 * ^
17454 * > | \`a`
17455 * ^
17456 * ```
17457 *
17458 * @type {State}
17459 */
17460 function start(code) {
17461 effects.enter("codeText");
17462 effects.enter("codeTextSequence");
17463 return sequenceOpen(code);
17464 }
17465 /**
17466 * In opening sequence.
17467 *
17468 * ```markdown
17469 * > | `a`
17470 * ^
17471 * ```
17472 *
17473 * @type {State}
17474 */
17475 function sequenceOpen(code) {
17476 if (code === 96) {
17477 effects.consume(code);
17478 sizeOpen++;
17479 return sequenceOpen;
17480 }
17481 effects.exit("codeTextSequence");
17482 return between(code);
17483 }
17484 /**
17485 * Between something and something else.
17486 *
17487 * ```markdown
17488 * > | `a`
17489 * ^^
17490 * ```
17491 *
17492 * @type {State}
17493 */
17494 function between(code) {
17495 if (code === null) return nok(code);
17496 if (code === 32) {
17497 effects.enter("space");
17498 effects.consume(code);
17499 effects.exit("space");
17500 return between;
17501 }
17502 if (code === 96) {
17503 token = effects.enter("codeTextSequence");
17504 size = 0;
17505 return sequenceClose(code);
17506 }
17507 if (markdownLineEnding(code)) {
17508 effects.enter("lineEnding");
17509 effects.consume(code);
17510 effects.exit("lineEnding");
17511 return between;
17512 }
17513 effects.enter("codeTextData");
17514 return data(code);
17515 }
17516 /**
17517 * In data.
17518 *
17519 * ```markdown
17520 * > | `a`
17521 * ^
17522 * ```
17523 *
17524 * @type {State}
17525 */
17526 function data(code) {
17527 if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) {
17528 effects.exit("codeTextData");
17529 return between(code);
17530 }
17531 effects.consume(code);
17532 return data;
17533 }
17534 /**
17535 * In closing sequence.
17536 *
17537 * ```markdown
17538 * > | `a`
17539 * ^
17540 * ```
17541 *
17542 * @type {State}
17543 */
17544 function sequenceClose(code) {
17545 if (code === 96) {
17546 effects.consume(code);
17547 size++;
17548 return sequenceClose;
17549 }
17550 if (size === sizeOpen) {
17551 effects.exit("codeTextSequence");
17552 effects.exit("codeText");
17553 return ok(code);
17554 }
17555 token.type = "codeTextData";
17556 return data(code);
17557 }
17558 }
17559 var codeText;
17560 var init_code_text = __esmMin((() => {
17561 init_micromark_util_character();
17562 codeText = {
17563 name: "codeText",
17564 tokenize: tokenizeCodeText,
17565 resolve: resolveCodeText,
17566 previous
17567 };
17568 }));
17569
17570 //#endregion
17571 //#region node_modules/micromark-util-subtokenize/index.js
17572 /**
17573 * Tokenize subcontent.
17574 *
17575 * @param {Array<Event>} events
17576 * List of events.
17577 * @returns {boolean}
17578 * Whether subtokens were found.
17579 */
17580 function subtokenize(events) {
17581 /** @type {Record<string, number>} */
17582 const jumps = {};
17583 let index = -1;
17584 /** @type {Event} */
17585 let event;
17586 /** @type {number | undefined} */
17587 let lineIndex;
17588 /** @type {number} */
17589 let otherIndex;
17590 /** @type {Event} */
17591 let otherEvent;
17592 /** @type {Array<Event>} */
17593 let parameters;
17594 /** @type {Array<Event>} */
17595 let subevents;
17596 /** @type {boolean | undefined} */
17597 let more;
17598 while (++index < events.length) {
17599 while (index in jumps) index = jumps[index];
17600 event = events[index];
17601 if (index && event[1].type === "chunkFlow" && events[index - 1][1].type === "listItemPrefix") {
17602 subevents = event[1]._tokenizer.events;
17603 otherIndex = 0;
17604 if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") otherIndex += 2;
17605 if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") while (++otherIndex < subevents.length) {
17606 if (subevents[otherIndex][1].type === "content") break;
17607 if (subevents[otherIndex][1].type === "chunkText") {
17608 subevents[otherIndex][1]._isInFirstContentOfListItem = true;
17609 otherIndex++;
17610 }
17611 }
17612 }
17613 if (event[0] === "enter") {
17614 if (event[1].contentType) {
17615 Object.assign(jumps, subcontent(events, index));
17616 index = jumps[index];
17617 more = true;
17618 }
17619 } else if (event[1]._container) {
17620 otherIndex = index;
17621 lineIndex = void 0;
17622 while (otherIndex--) {
17623 otherEvent = events[otherIndex];
17624 if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
17625 if (otherEvent[0] === "enter") {
17626 if (lineIndex) events[lineIndex][1].type = "lineEndingBlank";
17627 otherEvent[1].type = "lineEnding";
17628 lineIndex = otherIndex;
17629 }
17630 } else break;
17631 }
17632 if (lineIndex) {
17633 event[1].end = Object.assign({}, events[lineIndex][1].start);
17634 parameters = events.slice(lineIndex, index);
17635 parameters.unshift(event);
17636 splice(events, lineIndex, index - lineIndex + 1, parameters);
17637 }
17638 }
17639 }
17640 return !more;
17641 }
17642 /**
17643 * Tokenize embedded tokens.
17644 *
17645 * @param {Array<Event>} events
17646 * @param {number} eventIndex
17647 * @returns {Record<string, number>}
17648 */
17649 function subcontent(events, eventIndex) {
17650 const token = events[eventIndex][1];
17651 const context = events[eventIndex][2];
17652 let startPosition = eventIndex - 1;
17653 /** @type {Array<number>} */
17654 const startPositions = [];
17655 const tokenizer = token._tokenizer || context.parser[token.contentType](token.start);
17656 const childEvents = tokenizer.events;
17657 /** @type {Array<[number, number]>} */
17658 const jumps = [];
17659 /** @type {Record<string, number>} */
17660 const gaps = {};
17661 /** @type {Array<Chunk>} */
17662 let stream;
17663 /** @type {Token | undefined} */
17664 let previous;
17665 let index = -1;
17666 /** @type {Token | undefined} */
17667 let current = token;
17668 let adjust = 0;
17669 let start = 0;
17670 const breaks = [start];
17671 while (current) {
17672 while (events[++startPosition][1] !== current);
17673 startPositions.push(startPosition);
17674 if (!current._tokenizer) {
17675 stream = context.sliceStream(current);
17676 if (!current.next) stream.push(null);
17677 if (previous) tokenizer.defineSkip(current.start);
17678 if (current._isInFirstContentOfListItem) tokenizer._gfmTasklistFirstContentOfListItem = true;
17679 tokenizer.write(stream);
17680 if (current._isInFirstContentOfListItem) tokenizer._gfmTasklistFirstContentOfListItem = void 0;
17681 }
17682 previous = current;
17683 current = current.next;
17684 }
17685 current = token;
17686 while (++index < childEvents.length) if (childEvents[index][0] === "exit" && childEvents[index - 1][0] === "enter" && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) {
17687 start = index + 1;
17688 breaks.push(start);
17689 current._tokenizer = void 0;
17690 current.previous = void 0;
17691 current = current.next;
17692 }
17693 tokenizer.events = [];
17694 if (current) {
17695 current._tokenizer = void 0;
17696 current.previous = void 0;
17697 } else breaks.pop();
17698 index = breaks.length;
17699 while (index--) {
17700 const slice = childEvents.slice(breaks[index], breaks[index + 1]);
17701 const start = startPositions.pop();
17702 jumps.unshift([start, start + slice.length - 1]);
17703 splice(events, start, 2, slice);
17704 }
17705 index = -1;
17706 while (++index < jumps.length) {
17707 gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
17708 adjust += jumps[index][1] - jumps[index][0] - 1;
17709 }
17710 return gaps;
17711 }
17712 var init_micromark_util_subtokenize = __esmMin((() => {
17713 init_micromark_util_chunked();
17714 }));
17715
17716 //#endregion
17717 //#region node_modules/micromark-core-commonmark/lib/content.js
17718 /**
17719 * Content is transparent: it’s parsed right now. That way, definitions are also
17720 * parsed right now: before text in paragraphs (specifically, media) are parsed.
17721 *
17722 * @type {Resolver}
17723 */
17724 function resolveContent(events) {
17725 subtokenize(events);
17726 return events;
17727 }
17728 /**
17729 * @this {TokenizeContext}
17730 * @type {Tokenizer}
17731 */
17732 function tokenizeContent(effects, ok) {
17733 /** @type {Token | undefined} */
17734 let previous;
17735 return chunkStart;
17736 /**
17737 * Before a content chunk.
17738 *
17739 * ```markdown
17740 * > | abc
17741 * ^
17742 * ```
17743 *
17744 * @type {State}
17745 */
17746 function chunkStart(code) {
17747 effects.enter("content");
17748 previous = effects.enter("chunkContent", { contentType: "content" });
17749 return chunkInside(code);
17750 }
17751 /**
17752 * In a content chunk.
17753 *
17754 * ```markdown
17755 * > | abc
17756 * ^^^
17757 * ```
17758 *
17759 * @type {State}
17760 */
17761 function chunkInside(code) {
17762 if (code === null) return contentEnd(code);
17763 if (markdownLineEnding(code)) return effects.check(continuationConstruct, contentContinue, contentEnd)(code);
17764 effects.consume(code);
17765 return chunkInside;
17766 }
17767 /**
17768 *
17769 *
17770 * @type {State}
17771 */
17772 function contentEnd(code) {
17773 effects.exit("chunkContent");
17774 effects.exit("content");
17775 return ok(code);
17776 }
17777 /**
17778 *
17779 *
17780 * @type {State}
17781 */
17782 function contentContinue(code) {
17783 effects.consume(code);
17784 effects.exit("chunkContent");
17785 previous.next = effects.enter("chunkContent", {
17786 contentType: "content",
17787 previous
17788 });
17789 previous = previous.next;
17790 return chunkInside;
17791 }
17792 }
17793 /**
17794 * @this {TokenizeContext}
17795 * @type {Tokenizer}
17796 */
17797 function tokenizeContinuation(effects, ok, nok) {
17798 const self = this;
17799 return startLookahead;
17800 /**
17801 *
17802 *
17803 * @type {State}
17804 */
17805 function startLookahead(code) {
17806 effects.exit("chunkContent");
17807 effects.enter("lineEnding");
17808 effects.consume(code);
17809 effects.exit("lineEnding");
17810 return factorySpace(effects, prefixed, "linePrefix");
17811 }
17812 /**
17813 *
17814 *
17815 * @type {State}
17816 */
17817 function prefixed(code) {
17818 if (code === null || markdownLineEnding(code)) return nok(code);
17819 const tail = self.events[self.events.length - 1];
17820 if (!self.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) return ok(code);
17821 return effects.interrupt(self.parser.constructs.flow, nok, ok)(code);
17822 }
17823 }
17824 var content, continuationConstruct;
17825 var init_content = __esmMin((() => {
17826 init_micromark_factory_space();
17827 init_micromark_util_character();
17828 init_micromark_util_subtokenize();
17829 content = {
17830 tokenize: tokenizeContent,
17831 resolve: resolveContent
17832 };
17833 continuationConstruct = {
17834 tokenize: tokenizeContinuation,
17835 partial: true
17836 };
17837 }));
17838
17839 //#endregion
17840 //#region node_modules/micromark-factory-destination/index.js
17841 /**
17842 * Parse destinations.
17843 *
17844 * ###### Examples
17845 *
17846 * ```markdown
17847 * <a>
17848 * <a\>b>
17849 * <a b>
17850 * <a)>
17851 * a
17852 * a\)b
17853 * a(b)c
17854 * a(b)
17855 * ```
17856 *
17857 * @param {Effects} effects
17858 * Context.
17859 * @param {State} ok
17860 * State switched to when successful.
17861 * @param {State} nok
17862 * State switched to when unsuccessful.
17863 * @param {TokenType} type
17864 * Type for whole (`<a>` or `b`).
17865 * @param {TokenType} literalType
17866 * Type when enclosed (`<a>`).
17867 * @param {TokenType} literalMarkerType
17868 * Type for enclosing (`<` and `>`).
17869 * @param {TokenType} rawType
17870 * Type when not enclosed (`b`).
17871 * @param {TokenType} stringType
17872 * Type for the value (`a` or `b`).
17873 * @param {number | undefined} [max=Infinity]
17874 * Depth of nested parens (inclusive).
17875 * @returns {State}
17876 * Start state.
17877 */ function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
17878 const limit = max || Number.POSITIVE_INFINITY;
17879 let balance = 0;
17880 return start;
17881 /**
17882 * Start of destination.
17883 *
17884 * ```markdown
17885 * > | <aa>
17886 * ^
17887 * > | aa
17888 * ^
17889 * ```
17890 *
17891 * @type {State}
17892 */
17893 function start(code) {
17894 if (code === 60) {
17895 effects.enter(type);
17896 effects.enter(literalType);
17897 effects.enter(literalMarkerType);
17898 effects.consume(code);
17899 effects.exit(literalMarkerType);
17900 return enclosedBefore;
17901 }
17902 if (code === null || code === 32 || code === 41 || asciiControl(code)) return nok(code);
17903 effects.enter(type);
17904 effects.enter(rawType);
17905 effects.enter(stringType);
17906 effects.enter("chunkString", { contentType: "string" });
17907 return raw(code);
17908 }
17909 /**
17910 * After `<`, at an enclosed destination.
17911 *
17912 * ```markdown
17913 * > | <aa>
17914 * ^
17915 * ```
17916 *
17917 * @type {State}
17918 */
17919 function enclosedBefore(code) {
17920 if (code === 62) {
17921 effects.enter(literalMarkerType);
17922 effects.consume(code);
17923 effects.exit(literalMarkerType);
17924 effects.exit(literalType);
17925 effects.exit(type);
17926 return ok;
17927 }
17928 effects.enter(stringType);
17929 effects.enter("chunkString", { contentType: "string" });
17930 return enclosed(code);
17931 }
17932 /**
17933 * In enclosed destination.
17934 *
17935 * ```markdown
17936 * > | <aa>
17937 * ^
17938 * ```
17939 *
17940 * @type {State}
17941 */
17942 function enclosed(code) {
17943 if (code === 62) {
17944 effects.exit("chunkString");
17945 effects.exit(stringType);
17946 return enclosedBefore(code);
17947 }
17948 if (code === null || code === 60 || markdownLineEnding(code)) return nok(code);
17949 effects.consume(code);
17950 return code === 92 ? enclosedEscape : enclosed;
17951 }
17952 /**
17953 * After `\`, at a special character.
17954 *
17955 * ```markdown
17956 * > | <a\*a>
17957 * ^
17958 * ```
17959 *
17960 * @type {State}
17961 */
17962 function enclosedEscape(code) {
17963 if (code === 60 || code === 62 || code === 92) {
17964 effects.consume(code);
17965 return enclosed;
17966 }
17967 return enclosed(code);
17968 }
17969 /**
17970 * In raw destination.
17971 *
17972 * ```markdown
17973 * > | aa
17974 * ^
17975 * ```
17976 *
17977 * @type {State}
17978 */
17979 function raw(code) {
17980 if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) {
17981 effects.exit("chunkString");
17982 effects.exit(stringType);
17983 effects.exit(rawType);
17984 effects.exit(type);
17985 return ok(code);
17986 }
17987 if (balance < limit && code === 40) {
17988 effects.consume(code);
17989 balance++;
17990 return raw;
17991 }
17992 if (code === 41) {
17993 effects.consume(code);
17994 balance--;
17995 return raw;
17996 }
17997 if (code === null || code === 32 || code === 40 || asciiControl(code)) return nok(code);
17998 effects.consume(code);
17999 return code === 92 ? rawEscape : raw;
18000 }
18001 /**
18002 * After `\`, at special character.
18003 *
18004 * ```markdown
18005 * > | a\*a
18006 * ^
18007 * ```
18008 *
18009 * @type {State}
18010 */
18011 function rawEscape(code) {
18012 if (code === 40 || code === 41 || code === 92) {
18013 effects.consume(code);
18014 return raw;
18015 }
18016 return raw(code);
18017 }
18018 }
18019 var init_micromark_factory_destination = __esmMin((() => {
18020 init_micromark_util_character();
18021 }));
18022
18023 //#endregion
18024 //#region node_modules/micromark-factory-label/index.js
18025 /**
18026 * Parse labels.
18027 *
18028 * > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
18029 *
18030 * ###### Examples
18031 *
18032 * ```markdown
18033 * [a]
18034 * [a
18035 * b]
18036 * [a\]b]
18037 * ```
18038 *
18039 * @this {TokenizeContext}
18040 * Tokenize context.
18041 * @param {Effects} effects
18042 * Context.
18043 * @param {State} ok
18044 * State switched to when successful.
18045 * @param {State} nok
18046 * State switched to when unsuccessful.
18047 * @param {TokenType} type
18048 * Type of the whole label (`[a]`).
18049 * @param {TokenType} markerType
18050 * Type for the markers (`[` and `]`).
18051 * @param {TokenType} stringType
18052 * Type for the identifier (`a`).
18053 * @returns {State}
18054 * Start state.
18055 */ function factoryLabel(effects, ok, nok, type, markerType, stringType) {
18056 const self = this;
18057 let size = 0;
18058 /** @type {boolean} */
18059 let seen;
18060 return start;
18061 /**
18062 * Start of label.
18063 *
18064 * ```markdown
18065 * > | [a]
18066 * ^
18067 * ```
18068 *
18069 * @type {State}
18070 */
18071 function start(code) {
18072 effects.enter(type);
18073 effects.enter(markerType);
18074 effects.consume(code);
18075 effects.exit(markerType);
18076 effects.enter(stringType);
18077 return atBreak;
18078 }
18079 /**
18080 * In label, at something, before something else.
18081 *
18082 * ```markdown
18083 * > | [a]
18084 * ^
18085 * ```
18086 *
18087 * @type {State}
18088 */
18089 function atBreak(code) {
18090 if (size > 999 || code === null || code === 91 || code === 93 && !seen || code === 94 && !size && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
18091 if (code === 93) {
18092 effects.exit(stringType);
18093 effects.enter(markerType);
18094 effects.consume(code);
18095 effects.exit(markerType);
18096 effects.exit(type);
18097 return ok;
18098 }
18099 if (markdownLineEnding(code)) {
18100 effects.enter("lineEnding");
18101 effects.consume(code);
18102 effects.exit("lineEnding");
18103 return atBreak;
18104 }
18105 effects.enter("chunkString", { contentType: "string" });
18106 return labelInside(code);
18107 }
18108 /**
18109 * In label, in text.
18110 *
18111 * ```markdown
18112 * > | [a]
18113 * ^
18114 * ```
18115 *
18116 * @type {State}
18117 */
18118 function labelInside(code) {
18119 if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) {
18120 effects.exit("chunkString");
18121 return atBreak(code);
18122 }
18123 effects.consume(code);
18124 if (!seen) seen = !markdownSpace(code);
18125 return code === 92 ? labelEscape : labelInside;
18126 }
18127 /**
18128 * After `\`, at a special character.
18129 *
18130 * ```markdown
18131 * > | [a\*a]
18132 * ^
18133 * ```
18134 *
18135 * @type {State}
18136 */
18137 function labelEscape(code) {
18138 if (code === 91 || code === 92 || code === 93) {
18139 effects.consume(code);
18140 size++;
18141 return labelInside;
18142 }
18143 return labelInside(code);
18144 }
18145 }
18146 var init_micromark_factory_label = __esmMin((() => {
18147 init_micromark_util_character();
18148 }));
18149
18150 //#endregion
18151 //#region node_modules/micromark-factory-title/index.js
18152 /**
18153 * Parse titles.
18154 *
18155 * ###### Examples
18156 *
18157 * ```markdown
18158 * "a"
18159 * 'b'
18160 * (c)
18161 * "a
18162 * b"
18163 * 'a
18164 * b'
18165 * (a\)b)
18166 * ```
18167 *
18168 * @param {Effects} effects
18169 * Context.
18170 * @param {State} ok
18171 * State switched to when successful.
18172 * @param {State} nok
18173 * State switched to when unsuccessful.
18174 * @param {TokenType} type
18175 * Type of the whole title (`"a"`, `'b'`, `(c)`).
18176 * @param {TokenType} markerType
18177 * Type for the markers (`"`, `'`, `(`, and `)`).
18178 * @param {TokenType} stringType
18179 * Type for the value (`a`).
18180 * @returns {State}
18181 * Start state.
18182 */ function factoryTitle(effects, ok, nok, type, markerType, stringType) {
18183 /** @type {NonNullable<Code>} */
18184 let marker;
18185 return start;
18186 /**
18187 * Start of title.
18188 *
18189 * ```markdown
18190 * > | "a"
18191 * ^
18192 * ```
18193 *
18194 * @type {State}
18195 */
18196 function start(code) {
18197 if (code === 34 || code === 39 || code === 40) {
18198 effects.enter(type);
18199 effects.enter(markerType);
18200 effects.consume(code);
18201 effects.exit(markerType);
18202 marker = code === 40 ? 41 : code;
18203 return begin;
18204 }
18205 return nok(code);
18206 }
18207 /**
18208 * After opening marker.
18209 *
18210 * This is also used at the closing marker.
18211 *
18212 * ```markdown
18213 * > | "a"
18214 * ^
18215 * ```
18216 *
18217 * @type {State}
18218 */
18219 function begin(code) {
18220 if (code === marker) {
18221 effects.enter(markerType);
18222 effects.consume(code);
18223 effects.exit(markerType);
18224 effects.exit(type);
18225 return ok;
18226 }
18227 effects.enter(stringType);
18228 return atBreak(code);
18229 }
18230 /**
18231 * At something, before something else.
18232 *
18233 * ```markdown
18234 * > | "a"
18235 * ^
18236 * ```
18237 *
18238 * @type {State}
18239 */
18240 function atBreak(code) {
18241 if (code === marker) {
18242 effects.exit(stringType);
18243 return begin(marker);
18244 }
18245 if (code === null) return nok(code);
18246 if (markdownLineEnding(code)) {
18247 effects.enter("lineEnding");
18248 effects.consume(code);
18249 effects.exit("lineEnding");
18250 return factorySpace(effects, atBreak, "linePrefix");
18251 }
18252 effects.enter("chunkString", { contentType: "string" });
18253 return inside(code);
18254 }
18255 /**
18256 *
18257 *
18258 * @type {State}
18259 */
18260 function inside(code) {
18261 if (code === marker || code === null || markdownLineEnding(code)) {
18262 effects.exit("chunkString");
18263 return atBreak(code);
18264 }
18265 effects.consume(code);
18266 return code === 92 ? escape : inside;
18267 }
18268 /**
18269 * After `\`, at a special character.
18270 *
18271 * ```markdown
18272 * > | "a\*b"
18273 * ^
18274 * ```
18275 *
18276 * @type {State}
18277 */
18278 function escape(code) {
18279 if (code === marker || code === 92) {
18280 effects.consume(code);
18281 return inside;
18282 }
18283 return inside(code);
18284 }
18285 }
18286 var init_micromark_factory_title = __esmMin((() => {
18287 init_micromark_factory_space();
18288 init_micromark_util_character();
18289 }));
18290
18291 //#endregion
18292 //#region node_modules/micromark-factory-whitespace/index.js
18293 /**
18294 * Parse spaces and tabs.
18295 *
18296 * There is no `nok` parameter:
18297 *
18298 * * line endings or spaces in markdown are often optional, in which case this
18299 * factory can be used and `ok` will be switched to whether spaces were found
18300 * or not
18301 * * one line ending or space can be detected with
18302 * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`
18303 *
18304 * @param {Effects} effects
18305 * Context.
18306 * @param {State} ok
18307 * State switched to when successful.
18308 * @returns
18309 * Start state.
18310 */
18311 function factoryWhitespace(effects, ok) {
18312 /** @type {boolean} */
18313 let seen;
18314 return start;
18315 /** @type {State} */
18316 function start(code) {
18317 if (markdownLineEnding(code)) {
18318 effects.enter("lineEnding");
18319 effects.consume(code);
18320 effects.exit("lineEnding");
18321 seen = true;
18322 return start;
18323 }
18324 if (markdownSpace(code)) return factorySpace(effects, start, seen ? "linePrefix" : "lineSuffix")(code);
18325 return ok(code);
18326 }
18327 }
18328 var init_micromark_factory_whitespace = __esmMin((() => {
18329 init_micromark_factory_space();
18330 init_micromark_util_character();
18331 }));
18332
18333 //#endregion
18334 //#region node_modules/micromark-util-normalize-identifier/index.js
18335 /**
18336 * Normalize an identifier (as found in references, definitions).
18337 *
18338 * Collapses markdown whitespace, trim, and then lower- and uppercase.
18339 *
18340 * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their
18341 * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different
18342 * uppercase character (U+0398 (`Θ`)).
18343 * So, to get a canonical form, we perform both lower- and uppercase.
18344 *
18345 * Using uppercase last makes sure keys will never interact with default
18346 * prototypal values (such as `constructor`): nothing in the prototype of
18347 * `Object` is uppercase.
18348 *
18349 * @param {string} value
18350 * Identifier to normalize.
18351 * @returns {string}
18352 * Normalized identifier.
18353 */
18354 function normalizeIdentifier(value) {
18355 return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
18356 }
18357 var init_micromark_util_normalize_identifier = __esmMin((() => {}));
18358
18359 //#endregion
18360 //#region node_modules/micromark-core-commonmark/lib/definition.js
18361 /**
18362 * @this {TokenizeContext}
18363 * @type {Tokenizer}
18364 */
18365 function tokenizeDefinition(effects, ok, nok) {
18366 const self = this;
18367 /** @type {string} */
18368 let identifier;
18369 return start;
18370 /**
18371 * At start of a definition.
18372 *
18373 * ```markdown
18374 * > | [a]: b "c"
18375 * ^
18376 * ```
18377 *
18378 * @type {State}
18379 */
18380 function start(code) {
18381 effects.enter("definition");
18382 return before(code);
18383 }
18384 /**
18385 * After optional whitespace, at `[`.
18386 *
18387 * ```markdown
18388 * > | [a]: b "c"
18389 * ^
18390 * ```
18391 *
18392 * @type {State}
18393 */
18394 function before(code) {
18395 return factoryLabel.call(self, effects, labelAfter, nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code);
18396 }
18397 /**
18398 * After label.
18399 *
18400 * ```markdown
18401 * > | [a]: b "c"
18402 * ^
18403 * ```
18404 *
18405 * @type {State}
18406 */
18407 function labelAfter(code) {
18408 identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
18409 if (code === 58) {
18410 effects.enter("definitionMarker");
18411 effects.consume(code);
18412 effects.exit("definitionMarker");
18413 return markerAfter;
18414 }
18415 return nok(code);
18416 }
18417 /**
18418 * After marker.
18419 *
18420 * ```markdown
18421 * > | [a]: b "c"
18422 * ^
18423 * ```
18424 *
18425 * @type {State}
18426 */
18427 function markerAfter(code) {
18428 return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code);
18429 }
18430 /**
18431 * Before destination.
18432 *
18433 * ```markdown
18434 * > | [a]: b "c"
18435 * ^
18436 * ```
18437 *
18438 * @type {State}
18439 */
18440 function destinationBefore(code) {
18441 return factoryDestination(effects, destinationAfter, nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString")(code);
18442 }
18443 /**
18444 * After destination.
18445 *
18446 * ```markdown
18447 * > | [a]: b "c"
18448 * ^
18449 * ```
18450 *
18451 * @type {State}
18452 */
18453 function destinationAfter(code) {
18454 return effects.attempt(titleBefore, after, after)(code);
18455 }
18456 /**
18457 * After definition.
18458 *
18459 * ```markdown
18460 * > | [a]: b
18461 * ^
18462 * > | [a]: b "c"
18463 * ^
18464 * ```
18465 *
18466 * @type {State}
18467 */
18468 function after(code) {
18469 return markdownSpace(code) ? factorySpace(effects, afterWhitespace, "whitespace")(code) : afterWhitespace(code);
18470 }
18471 /**
18472 * After definition, after optional whitespace.
18473 *
18474 * ```markdown
18475 * > | [a]: b
18476 * ^
18477 * > | [a]: b "c"
18478 * ^
18479 * ```
18480 *
18481 * @type {State}
18482 */
18483 function afterWhitespace(code) {
18484 if (code === null || markdownLineEnding(code)) {
18485 effects.exit("definition");
18486 self.parser.defined.push(identifier);
18487 return ok(code);
18488 }
18489 return nok(code);
18490 }
18491 }
18492 /**
18493 * @this {TokenizeContext}
18494 * @type {Tokenizer}
18495 */
18496 function tokenizeTitleBefore(effects, ok, nok) {
18497 return titleBefore;
18498 /**
18499 * After destination, at whitespace.
18500 *
18501 * ```markdown
18502 * > | [a]: b
18503 * ^
18504 * > | [a]: b "c"
18505 * ^
18506 * ```
18507 *
18508 * @type {State}
18509 */
18510 function titleBefore(code) {
18511 return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code);
18512 }
18513 /**
18514 * At title.
18515 *
18516 * ```markdown
18517 * | [a]: b
18518 * > | "c"
18519 * ^
18520 * ```
18521 *
18522 * @type {State}
18523 */
18524 function beforeMarker(code) {
18525 return factoryTitle(effects, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code);
18526 }
18527 /**
18528 * After title.
18529 *
18530 * ```markdown
18531 * > | [a]: b "c"
18532 * ^
18533 * ```
18534 *
18535 * @type {State}
18536 */
18537 function titleAfter(code) {
18538 return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code) : titleAfterOptionalWhitespace(code);
18539 }
18540 /**
18541 * After title, after optional whitespace.
18542 *
18543 * ```markdown
18544 * > | [a]: b "c"
18545 * ^
18546 * ```
18547 *
18548 * @type {State}
18549 */
18550 function titleAfterOptionalWhitespace(code) {
18551 return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
18552 }
18553 }
18554 var definition, titleBefore;
18555 var init_definition = __esmMin((() => {
18556 init_micromark_factory_destination();
18557 init_micromark_factory_label();
18558 init_micromark_factory_space();
18559 init_micromark_factory_title();
18560 init_micromark_factory_whitespace();
18561 init_micromark_util_character();
18562 init_micromark_util_normalize_identifier();
18563 definition = {
18564 name: "definition",
18565 tokenize: tokenizeDefinition
18566 };
18567 titleBefore = {
18568 tokenize: tokenizeTitleBefore,
18569 partial: true
18570 };
18571 }));
18572
18573 //#endregion
18574 //#region node_modules/micromark-core-commonmark/lib/hard-break-escape.js
18575 /**
18576 * @this {TokenizeContext}
18577 * @type {Tokenizer}
18578 */
18579 function tokenizeHardBreakEscape(effects, ok, nok) {
18580 return start;
18581 /**
18582 * Start of a hard break (escape).
18583 *
18584 * ```markdown
18585 * > | a\
18586 * ^
18587 * | b
18588 * ```
18589 *
18590 * @type {State}
18591 */
18592 function start(code) {
18593 effects.enter("hardBreakEscape");
18594 effects.consume(code);
18595 return after;
18596 }
18597 /**
18598 * After `\`, at eol.
18599 *
18600 * ```markdown
18601 * > | a\
18602 * ^
18603 * | b
18604 * ```
18605 *
18606 * @type {State}
18607 */
18608 function after(code) {
18609 if (markdownLineEnding(code)) {
18610 effects.exit("hardBreakEscape");
18611 return ok(code);
18612 }
18613 return nok(code);
18614 }
18615 }
18616 var hardBreakEscape;
18617 var init_hard_break_escape = __esmMin((() => {
18618 init_micromark_util_character();
18619 hardBreakEscape = {
18620 name: "hardBreakEscape",
18621 tokenize: tokenizeHardBreakEscape
18622 };
18623 }));
18624
18625 //#endregion
18626 //#region node_modules/micromark-core-commonmark/lib/heading-atx.js
18627 /** @type {Resolver} */
18628 function resolveHeadingAtx(events, context) {
18629 let contentEnd = events.length - 2;
18630 let contentStart = 3;
18631 /** @type {Token} */
18632 let content;
18633 /** @type {Token} */
18634 let text;
18635 if (events[contentStart][1].type === "whitespace") contentStart += 2;
18636 if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") contentEnd -= 2;
18637 if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
18638 if (contentEnd > contentStart) {
18639 content = {
18640 type: "atxHeadingText",
18641 start: events[contentStart][1].start,
18642 end: events[contentEnd][1].end
18643 };
18644 text = {
18645 type: "chunkText",
18646 start: events[contentStart][1].start,
18647 end: events[contentEnd][1].end,
18648 contentType: "text"
18649 };
18650 splice(events, contentStart, contentEnd - contentStart + 1, [
18651 [
18652 "enter",
18653 content,
18654 context
18655 ],
18656 [
18657 "enter",
18658 text,
18659 context
18660 ],
18661 [
18662 "exit",
18663 text,
18664 context
18665 ],
18666 [
18667 "exit",
18668 content,
18669 context
18670 ]
18671 ]);
18672 }
18673 return events;
18674 }
18675 /**
18676 * @this {TokenizeContext}
18677 * @type {Tokenizer}
18678 */
18679 function tokenizeHeadingAtx(effects, ok, nok) {
18680 let size = 0;
18681 return start;
18682 /**
18683 * Start of a heading (atx).
18684 *
18685 * ```markdown
18686 * > | ## aa
18687 * ^
18688 * ```
18689 *
18690 * @type {State}
18691 */
18692 function start(code) {
18693 effects.enter("atxHeading");
18694 return before(code);
18695 }
18696 /**
18697 * After optional whitespace, at `#`.
18698 *
18699 * ```markdown
18700 * > | ## aa
18701 * ^
18702 * ```
18703 *
18704 * @type {State}
18705 */
18706 function before(code) {
18707 effects.enter("atxHeadingSequence");
18708 return sequenceOpen(code);
18709 }
18710 /**
18711 * In opening sequence.
18712 *
18713 * ```markdown
18714 * > | ## aa
18715 * ^
18716 * ```
18717 *
18718 * @type {State}
18719 */
18720 function sequenceOpen(code) {
18721 if (code === 35 && size++ < 6) {
18722 effects.consume(code);
18723 return sequenceOpen;
18724 }
18725 if (code === null || markdownLineEndingOrSpace(code)) {
18726 effects.exit("atxHeadingSequence");
18727 return atBreak(code);
18728 }
18729 return nok(code);
18730 }
18731 /**
18732 * After something, before something else.
18733 *
18734 * ```markdown
18735 * > | ## aa
18736 * ^
18737 * ```
18738 *
18739 * @type {State}
18740 */
18741 function atBreak(code) {
18742 if (code === 35) {
18743 effects.enter("atxHeadingSequence");
18744 return sequenceFurther(code);
18745 }
18746 if (code === null || markdownLineEnding(code)) {
18747 effects.exit("atxHeading");
18748 return ok(code);
18749 }
18750 if (markdownSpace(code)) return factorySpace(effects, atBreak, "whitespace")(code);
18751 effects.enter("atxHeadingText");
18752 return data(code);
18753 }
18754 /**
18755 * In further sequence (after whitespace).
18756 *
18757 * Could be normal “visible” hashes in the heading or a final sequence.
18758 *
18759 * ```markdown
18760 * > | ## aa ##
18761 * ^
18762 * ```
18763 *
18764 * @type {State}
18765 */
18766 function sequenceFurther(code) {
18767 if (code === 35) {
18768 effects.consume(code);
18769 return sequenceFurther;
18770 }
18771 effects.exit("atxHeadingSequence");
18772 return atBreak(code);
18773 }
18774 /**
18775 * In text.
18776 *
18777 * ```markdown
18778 * > | ## aa
18779 * ^
18780 * ```
18781 *
18782 * @type {State}
18783 */
18784 function data(code) {
18785 if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {
18786 effects.exit("atxHeadingText");
18787 return atBreak(code);
18788 }
18789 effects.consume(code);
18790 return data;
18791 }
18792 }
18793 var headingAtx;
18794 var init_heading_atx = __esmMin((() => {
18795 init_micromark_factory_space();
18796 init_micromark_util_character();
18797 init_micromark_util_chunked();
18798 headingAtx = {
18799 name: "headingAtx",
18800 tokenize: tokenizeHeadingAtx,
18801 resolve: resolveHeadingAtx
18802 };
18803 }));
18804
18805 //#endregion
18806 //#region node_modules/micromark-util-html-tag-name/index.js
18807 var htmlBlockNames, htmlRawNames;
18808 var init_micromark_util_html_tag_name = __esmMin((() => {
18809 htmlBlockNames = [
18810 "address",
18811 "article",
18812 "aside",
18813 "base",
18814 "basefont",
18815 "blockquote",
18816 "body",
18817 "caption",
18818 "center",
18819 "col",
18820 "colgroup",
18821 "dd",
18822 "details",
18823 "dialog",
18824 "dir",
18825 "div",
18826 "dl",
18827 "dt",
18828 "fieldset",
18829 "figcaption",
18830 "figure",
18831 "footer",
18832 "form",
18833 "frame",
18834 "frameset",
18835 "h1",
18836 "h2",
18837 "h3",
18838 "h4",
18839 "h5",
18840 "h6",
18841 "head",
18842 "header",
18843 "hr",
18844 "html",
18845 "iframe",
18846 "legend",
18847 "li",
18848 "link",
18849 "main",
18850 "menu",
18851 "menuitem",
18852 "nav",
18853 "noframes",
18854 "ol",
18855 "optgroup",
18856 "option",
18857 "p",
18858 "param",
18859 "search",
18860 "section",
18861 "summary",
18862 "table",
18863 "tbody",
18864 "td",
18865 "tfoot",
18866 "th",
18867 "thead",
18868 "title",
18869 "tr",
18870 "track",
18871 "ul"
18872 ];
18873 htmlRawNames = [
18874 "pre",
18875 "script",
18876 "style",
18877 "textarea"
18878 ];
18879 }));
18880
18881 //#endregion
18882 //#region node_modules/micromark-core-commonmark/lib/html-flow.js
18883 /** @type {Resolver} */
18884 function resolveToHtmlFlow(events) {
18885 let index = events.length;
18886 while (index--) if (events[index][0] === "enter" && events[index][1].type === "htmlFlow") break;
18887 if (index > 1 && events[index - 2][1].type === "linePrefix") {
18888 events[index][1].start = events[index - 2][1].start;
18889 events[index + 1][1].start = events[index - 2][1].start;
18890 events.splice(index - 2, 2);
18891 }
18892 return events;
18893 }
18894 /**
18895 * @this {TokenizeContext}
18896 * @type {Tokenizer}
18897 */
18898 function tokenizeHtmlFlow(effects, ok, nok) {
18899 const self = this;
18900 /** @type {number} */
18901 let marker;
18902 /** @type {boolean} */
18903 let closingTag;
18904 /** @type {string} */
18905 let buffer;
18906 /** @type {number} */
18907 let index;
18908 /** @type {Code} */
18909 let markerB;
18910 return start;
18911 /**
18912 * Start of HTML (flow).
18913 *
18914 * ```markdown
18915 * > | <x />
18916 * ^
18917 * ```
18918 *
18919 * @type {State}
18920 */
18921 function start(code) {
18922 return before(code);
18923 }
18924 /**
18925 * At `<`, after optional whitespace.
18926 *
18927 * ```markdown
18928 * > | <x />
18929 * ^
18930 * ```
18931 *
18932 * @type {State}
18933 */
18934 function before(code) {
18935 effects.enter("htmlFlow");
18936 effects.enter("htmlFlowData");
18937 effects.consume(code);
18938 return open;
18939 }
18940 /**
18941 * After `<`, at tag name or other stuff.
18942 *
18943 * ```markdown
18944 * > | <x />
18945 * ^
18946 * > | <!doctype>
18947 * ^
18948 * > | <!--xxx-->
18949 * ^
18950 * ```
18951 *
18952 * @type {State}
18953 */
18954 function open(code) {
18955 if (code === 33) {
18956 effects.consume(code);
18957 return declarationOpen;
18958 }
18959 if (code === 47) {
18960 effects.consume(code);
18961 closingTag = true;
18962 return tagCloseStart;
18963 }
18964 if (code === 63) {
18965 effects.consume(code);
18966 marker = 3;
18967 return self.interrupt ? ok : continuationDeclarationInside;
18968 }
18969 if (asciiAlpha(code)) {
18970 effects.consume(code);
18971 buffer = String.fromCharCode(code);
18972 return tagName;
18973 }
18974 return nok(code);
18975 }
18976 /**
18977 * After `<!`, at declaration, comment, or CDATA.
18978 *
18979 * ```markdown
18980 * > | <!doctype>
18981 * ^
18982 * > | <!--xxx-->
18983 * ^
18984 * > | <![CDATA[>&<]]>
18985 * ^
18986 * ```
18987 *
18988 * @type {State}
18989 */
18990 function declarationOpen(code) {
18991 if (code === 45) {
18992 effects.consume(code);
18993 marker = 2;
18994 return commentOpenInside;
18995 }
18996 if (code === 91) {
18997 effects.consume(code);
18998 marker = 5;
18999 index = 0;
19000 return cdataOpenInside;
19001 }
19002 if (asciiAlpha(code)) {
19003 effects.consume(code);
19004 marker = 4;
19005 return self.interrupt ? ok : continuationDeclarationInside;
19006 }
19007 return nok(code);
19008 }
19009 /**
19010 * After `<!-`, inside a comment, at another `-`.
19011 *
19012 * ```markdown
19013 * > | <!--xxx-->
19014 * ^
19015 * ```
19016 *
19017 * @type {State}
19018 */
19019 function commentOpenInside(code) {
19020 if (code === 45) {
19021 effects.consume(code);
19022 return self.interrupt ? ok : continuationDeclarationInside;
19023 }
19024 return nok(code);
19025 }
19026 /**
19027 * After `<![`, inside CDATA, expecting `CDATA[`.
19028 *
19029 * ```markdown
19030 * > | <![CDATA[>&<]]>
19031 * ^^^^^^
19032 * ```
19033 *
19034 * @type {State}
19035 */
19036 function cdataOpenInside(code) {
19037 if (code === "CDATA[".charCodeAt(index++)) {
19038 effects.consume(code);
19039 if (index === 6) return self.interrupt ? ok : continuation;
19040 return cdataOpenInside;
19041 }
19042 return nok(code);
19043 }
19044 /**
19045 * After `</`, in closing tag, at tag name.
19046 *
19047 * ```markdown
19048 * > | </x>
19049 * ^
19050 * ```
19051 *
19052 * @type {State}
19053 */
19054 function tagCloseStart(code) {
19055 if (asciiAlpha(code)) {
19056 effects.consume(code);
19057 buffer = String.fromCharCode(code);
19058 return tagName;
19059 }
19060 return nok(code);
19061 }
19062 /**
19063 * In tag name.
19064 *
19065 * ```markdown
19066 * > | <ab>
19067 * ^^
19068 * > | </ab>
19069 * ^^
19070 * ```
19071 *
19072 * @type {State}
19073 */
19074 function tagName(code) {
19075 if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
19076 const slash = code === 47;
19077 const name = buffer.toLowerCase();
19078 if (!slash && !closingTag && htmlRawNames.includes(name)) {
19079 marker = 1;
19080 return self.interrupt ? ok(code) : continuation(code);
19081 }
19082 if (htmlBlockNames.includes(buffer.toLowerCase())) {
19083 marker = 6;
19084 if (slash) {
19085 effects.consume(code);
19086 return basicSelfClosing;
19087 }
19088 return self.interrupt ? ok(code) : continuation(code);
19089 }
19090 marker = 7;
19091 return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code);
19092 }
19093 if (code === 45 || asciiAlphanumeric(code)) {
19094 effects.consume(code);
19095 buffer += String.fromCharCode(code);
19096 return tagName;
19097 }
19098 return nok(code);
19099 }
19100 /**
19101 * After closing slash of a basic tag name.
19102 *
19103 * ```markdown
19104 * > | <div/>
19105 * ^
19106 * ```
19107 *
19108 * @type {State}
19109 */
19110 function basicSelfClosing(code) {
19111 if (code === 62) {
19112 effects.consume(code);
19113 return self.interrupt ? ok : continuation;
19114 }
19115 return nok(code);
19116 }
19117 /**
19118 * After closing slash of a complete tag name.
19119 *
19120 * ```markdown
19121 * > | <x/>
19122 * ^
19123 * ```
19124 *
19125 * @type {State}
19126 */
19127 function completeClosingTagAfter(code) {
19128 if (markdownSpace(code)) {
19129 effects.consume(code);
19130 return completeClosingTagAfter;
19131 }
19132 return completeEnd(code);
19133 }
19134 /**
19135 * At an attribute name.
19136 *
19137 * At first, this state is used after a complete tag name, after whitespace,
19138 * where it expects optional attributes or the end of the tag.
19139 * It is also reused after attributes, when expecting more optional
19140 * attributes.
19141 *
19142 * ```markdown
19143 * > | <a />
19144 * ^
19145 * > | <a :b>
19146 * ^
19147 * > | <a _b>
19148 * ^
19149 * > | <a b>
19150 * ^
19151 * > | <a >
19152 * ^
19153 * ```
19154 *
19155 * @type {State}
19156 */
19157 function completeAttributeNameBefore(code) {
19158 if (code === 47) {
19159 effects.consume(code);
19160 return completeEnd;
19161 }
19162 if (code === 58 || code === 95 || asciiAlpha(code)) {
19163 effects.consume(code);
19164 return completeAttributeName;
19165 }
19166 if (markdownSpace(code)) {
19167 effects.consume(code);
19168 return completeAttributeNameBefore;
19169 }
19170 return completeEnd(code);
19171 }
19172 /**
19173 * In attribute name.
19174 *
19175 * ```markdown
19176 * > | <a :b>
19177 * ^
19178 * > | <a _b>
19179 * ^
19180 * > | <a b>
19181 * ^
19182 * ```
19183 *
19184 * @type {State}
19185 */
19186 function completeAttributeName(code) {
19187 if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
19188 effects.consume(code);
19189 return completeAttributeName;
19190 }
19191 return completeAttributeNameAfter(code);
19192 }
19193 /**
19194 * After attribute name, at an optional initializer, the end of the tag, or
19195 * whitespace.
19196 *
19197 * ```markdown
19198 * > | <a b>
19199 * ^
19200 * > | <a b=c>
19201 * ^
19202 * ```
19203 *
19204 * @type {State}
19205 */
19206 function completeAttributeNameAfter(code) {
19207 if (code === 61) {
19208 effects.consume(code);
19209 return completeAttributeValueBefore;
19210 }
19211 if (markdownSpace(code)) {
19212 effects.consume(code);
19213 return completeAttributeNameAfter;
19214 }
19215 return completeAttributeNameBefore(code);
19216 }
19217 /**
19218 * Before unquoted, double quoted, or single quoted attribute value, allowing
19219 * whitespace.
19220 *
19221 * ```markdown
19222 * > | <a b=c>
19223 * ^
19224 * > | <a b="c">
19225 * ^
19226 * ```
19227 *
19228 * @type {State}
19229 */
19230 function completeAttributeValueBefore(code) {
19231 if (code === null || code === 60 || code === 61 || code === 62 || code === 96) return nok(code);
19232 if (code === 34 || code === 39) {
19233 effects.consume(code);
19234 markerB = code;
19235 return completeAttributeValueQuoted;
19236 }
19237 if (markdownSpace(code)) {
19238 effects.consume(code);
19239 return completeAttributeValueBefore;
19240 }
19241 return completeAttributeValueUnquoted(code);
19242 }
19243 /**
19244 * In double or single quoted attribute value.
19245 *
19246 * ```markdown
19247 * > | <a b="c">
19248 * ^
19249 * > | <a b='c'>
19250 * ^
19251 * ```
19252 *
19253 * @type {State}
19254 */
19255 function completeAttributeValueQuoted(code) {
19256 if (code === markerB) {
19257 effects.consume(code);
19258 markerB = null;
19259 return completeAttributeValueQuotedAfter;
19260 }
19261 if (code === null || markdownLineEnding(code)) return nok(code);
19262 effects.consume(code);
19263 return completeAttributeValueQuoted;
19264 }
19265 /**
19266 * In unquoted attribute value.
19267 *
19268 * ```markdown
19269 * > | <a b=c>
19270 * ^
19271 * ```
19272 *
19273 * @type {State}
19274 */
19275 function completeAttributeValueUnquoted(code) {
19276 if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) return completeAttributeNameAfter(code);
19277 effects.consume(code);
19278 return completeAttributeValueUnquoted;
19279 }
19280 /**
19281 * After double or single quoted attribute value, before whitespace or the
19282 * end of the tag.
19283 *
19284 * ```markdown
19285 * > | <a b="c">
19286 * ^
19287 * ```
19288 *
19289 * @type {State}
19290 */
19291 function completeAttributeValueQuotedAfter(code) {
19292 if (code === 47 || code === 62 || markdownSpace(code)) return completeAttributeNameBefore(code);
19293 return nok(code);
19294 }
19295 /**
19296 * In certain circumstances of a complete tag where only an `>` is allowed.
19297 *
19298 * ```markdown
19299 * > | <a b="c">
19300 * ^
19301 * ```
19302 *
19303 * @type {State}
19304 */
19305 function completeEnd(code) {
19306 if (code === 62) {
19307 effects.consume(code);
19308 return completeAfter;
19309 }
19310 return nok(code);
19311 }
19312 /**
19313 * After `>` in a complete tag.
19314 *
19315 * ```markdown
19316 * > | <x>
19317 * ^
19318 * ```
19319 *
19320 * @type {State}
19321 */
19322 function completeAfter(code) {
19323 if (code === null || markdownLineEnding(code)) return continuation(code);
19324 if (markdownSpace(code)) {
19325 effects.consume(code);
19326 return completeAfter;
19327 }
19328 return nok(code);
19329 }
19330 /**
19331 * In continuation of any HTML kind.
19332 *
19333 * ```markdown
19334 * > | <!--xxx-->
19335 * ^
19336 * ```
19337 *
19338 * @type {State}
19339 */
19340 function continuation(code) {
19341 if (code === 45 && marker === 2) {
19342 effects.consume(code);
19343 return continuationCommentInside;
19344 }
19345 if (code === 60 && marker === 1) {
19346 effects.consume(code);
19347 return continuationRawTagOpen;
19348 }
19349 if (code === 62 && marker === 4) {
19350 effects.consume(code);
19351 return continuationClose;
19352 }
19353 if (code === 63 && marker === 3) {
19354 effects.consume(code);
19355 return continuationDeclarationInside;
19356 }
19357 if (code === 93 && marker === 5) {
19358 effects.consume(code);
19359 return continuationCdataInside;
19360 }
19361 if (markdownLineEnding(code) && (marker === 6 || marker === 7)) {
19362 effects.exit("htmlFlowData");
19363 return effects.check(blankLineBefore, continuationAfter, continuationStart)(code);
19364 }
19365 if (code === null || markdownLineEnding(code)) {
19366 effects.exit("htmlFlowData");
19367 return continuationStart(code);
19368 }
19369 effects.consume(code);
19370 return continuation;
19371 }
19372 /**
19373 * In continuation, at eol.
19374 *
19375 * ```markdown
19376 * > | <x>
19377 * ^
19378 * | asd
19379 * ```
19380 *
19381 * @type {State}
19382 */
19383 function continuationStart(code) {
19384 return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
19385 }
19386 /**
19387 * In continuation, at eol, before non-lazy content.
19388 *
19389 * ```markdown
19390 * > | <x>
19391 * ^
19392 * | asd
19393 * ```
19394 *
19395 * @type {State}
19396 */
19397 function continuationStartNonLazy(code) {
19398 effects.enter("lineEnding");
19399 effects.consume(code);
19400 effects.exit("lineEnding");
19401 return continuationBefore;
19402 }
19403 /**
19404 * In continuation, before non-lazy content.
19405 *
19406 * ```markdown
19407 * | <x>
19408 * > | asd
19409 * ^
19410 * ```
19411 *
19412 * @type {State}
19413 */
19414 function continuationBefore(code) {
19415 if (code === null || markdownLineEnding(code)) return continuationStart(code);
19416 effects.enter("htmlFlowData");
19417 return continuation(code);
19418 }
19419 /**
19420 * In comment continuation, after one `-`, expecting another.
19421 *
19422 * ```markdown
19423 * > | <!--xxx-->
19424 * ^
19425 * ```
19426 *
19427 * @type {State}
19428 */
19429 function continuationCommentInside(code) {
19430 if (code === 45) {
19431 effects.consume(code);
19432 return continuationDeclarationInside;
19433 }
19434 return continuation(code);
19435 }
19436 /**
19437 * In raw continuation, after `<`, at `/`.
19438 *
19439 * ```markdown
19440 * > | <script>console.log(1)<\/script>
19441 * ^
19442 * ```
19443 *
19444 * @type {State}
19445 */
19446 function continuationRawTagOpen(code) {
19447 if (code === 47) {
19448 effects.consume(code);
19449 buffer = "";
19450 return continuationRawEndTag;
19451 }
19452 return continuation(code);
19453 }
19454 /**
19455 * In raw continuation, after `</`, in a raw tag name.
19456 *
19457 * ```markdown
19458 * > | <script>console.log(1)<\/script>
19459 * ^^^^^^
19460 * ```
19461 *
19462 * @type {State}
19463 */
19464 function continuationRawEndTag(code) {
19465 if (code === 62) {
19466 const name = buffer.toLowerCase();
19467 if (htmlRawNames.includes(name)) {
19468 effects.consume(code);
19469 return continuationClose;
19470 }
19471 return continuation(code);
19472 }
19473 if (asciiAlpha(code) && buffer.length < 8) {
19474 effects.consume(code);
19475 buffer += String.fromCharCode(code);
19476 return continuationRawEndTag;
19477 }
19478 return continuation(code);
19479 }
19480 /**
19481 * In cdata continuation, after `]`, expecting `]>`.
19482 *
19483 * ```markdown
19484 * > | <![CDATA[>&<]]>
19485 * ^
19486 * ```
19487 *
19488 * @type {State}
19489 */
19490 function continuationCdataInside(code) {
19491 if (code === 93) {
19492 effects.consume(code);
19493 return continuationDeclarationInside;
19494 }
19495 return continuation(code);
19496 }
19497 /**
19498 * In declaration or instruction continuation, at `>`.
19499 *
19500 * ```markdown
19501 * > | <!-->
19502 * ^
19503 * > | <?>
19504 * ^
19505 * > | <!q>
19506 * ^
19507 * > | <!--ab-->
19508 * ^
19509 * > | <![CDATA[>&<]]>
19510 * ^
19511 * ```
19512 *
19513 * @type {State}
19514 */
19515 function continuationDeclarationInside(code) {
19516 if (code === 62) {
19517 effects.consume(code);
19518 return continuationClose;
19519 }
19520 if (code === 45 && marker === 2) {
19521 effects.consume(code);
19522 return continuationDeclarationInside;
19523 }
19524 return continuation(code);
19525 }
19526 /**
19527 * In closed continuation: everything we get until the eol/eof is part of it.
19528 *
19529 * ```markdown
19530 * > | <!doctype>
19531 * ^
19532 * ```
19533 *
19534 * @type {State}
19535 */
19536 function continuationClose(code) {
19537 if (code === null || markdownLineEnding(code)) {
19538 effects.exit("htmlFlowData");
19539 return continuationAfter(code);
19540 }
19541 effects.consume(code);
19542 return continuationClose;
19543 }
19544 /**
19545 * Done.
19546 *
19547 * ```markdown
19548 * > | <!doctype>
19549 * ^
19550 * ```
19551 *
19552 * @type {State}
19553 */
19554 function continuationAfter(code) {
19555 effects.exit("htmlFlow");
19556 return ok(code);
19557 }
19558 }
19559 /**
19560 * @this {TokenizeContext}
19561 * @type {Tokenizer}
19562 */
19563 function tokenizeNonLazyContinuationStart(effects, ok, nok) {
19564 const self = this;
19565 return start;
19566 /**
19567 * At eol, before continuation.
19568 *
19569 * ```markdown
19570 * > | * ```js
19571 * ^
19572 * | b
19573 * ```
19574 *
19575 * @type {State}
19576 */
19577 function start(code) {
19578 if (markdownLineEnding(code)) {
19579 effects.enter("lineEnding");
19580 effects.consume(code);
19581 effects.exit("lineEnding");
19582 return after;
19583 }
19584 return nok(code);
19585 }
19586 /**
19587 * A continuation.
19588 *
19589 * ```markdown
19590 * | * ```js
19591 * > | b
19592 * ^
19593 * ```
19594 *
19595 * @type {State}
19596 */
19597 function after(code) {
19598 return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
19599 }
19600 }
19601 /**
19602 * @this {TokenizeContext}
19603 * @type {Tokenizer}
19604 */
19605 function tokenizeBlankLineBefore(effects, ok, nok) {
19606 return start;
19607 /**
19608 * Before eol, expecting blank line.
19609 *
19610 * ```markdown
19611 * > | <div>
19612 * ^
19613 * |
19614 * ```
19615 *
19616 * @type {State}
19617 */
19618 function start(code) {
19619 effects.enter("lineEnding");
19620 effects.consume(code);
19621 effects.exit("lineEnding");
19622 return effects.attempt(blankLine, ok, nok);
19623 }
19624 }
19625 var htmlFlow, blankLineBefore, nonLazyContinuationStart;
19626 var init_html_flow = __esmMin((() => {
19627 init_micromark_util_character();
19628 init_micromark_util_html_tag_name();
19629 init_blank_line();
19630 htmlFlow = {
19631 name: "htmlFlow",
19632 tokenize: tokenizeHtmlFlow,
19633 resolveTo: resolveToHtmlFlow,
19634 concrete: true
19635 };
19636 blankLineBefore = {
19637 tokenize: tokenizeBlankLineBefore,
19638 partial: true
19639 };
19640 nonLazyContinuationStart = {
19641 tokenize: tokenizeNonLazyContinuationStart,
19642 partial: true
19643 };
19644 }));
19645
19646 //#endregion
19647 //#region node_modules/micromark-core-commonmark/lib/html-text.js
19648 /**
19649 * @this {TokenizeContext}
19650 * @type {Tokenizer}
19651 */
19652 function tokenizeHtmlText(effects, ok, nok) {
19653 const self = this;
19654 /** @type {NonNullable<Code> | undefined} */
19655 let marker;
19656 /** @type {number} */
19657 let index;
19658 /** @type {State} */
19659 let returnState;
19660 return start;
19661 /**
19662 * Start of HTML (text).
19663 *
19664 * ```markdown
19665 * > | a <b> c
19666 * ^
19667 * ```
19668 *
19669 * @type {State}
19670 */
19671 function start(code) {
19672 effects.enter("htmlText");
19673 effects.enter("htmlTextData");
19674 effects.consume(code);
19675 return open;
19676 }
19677 /**
19678 * After `<`, at tag name or other stuff.
19679 *
19680 * ```markdown
19681 * > | a <b> c
19682 * ^
19683 * > | a <!doctype> c
19684 * ^
19685 * > | a <!--b--> c
19686 * ^
19687 * ```
19688 *
19689 * @type {State}
19690 */
19691 function open(code) {
19692 if (code === 33) {
19693 effects.consume(code);
19694 return declarationOpen;
19695 }
19696 if (code === 47) {
19697 effects.consume(code);
19698 return tagCloseStart;
19699 }
19700 if (code === 63) {
19701 effects.consume(code);
19702 return instruction;
19703 }
19704 if (asciiAlpha(code)) {
19705 effects.consume(code);
19706 return tagOpen;
19707 }
19708 return nok(code);
19709 }
19710 /**
19711 * After `<!`, at declaration, comment, or CDATA.
19712 *
19713 * ```markdown
19714 * > | a <!doctype> c
19715 * ^
19716 * > | a <!--b--> c
19717 * ^
19718 * > | a <![CDATA[>&<]]> c
19719 * ^
19720 * ```
19721 *
19722 * @type {State}
19723 */
19724 function declarationOpen(code) {
19725 if (code === 45) {
19726 effects.consume(code);
19727 return commentOpenInside;
19728 }
19729 if (code === 91) {
19730 effects.consume(code);
19731 index = 0;
19732 return cdataOpenInside;
19733 }
19734 if (asciiAlpha(code)) {
19735 effects.consume(code);
19736 return declaration;
19737 }
19738 return nok(code);
19739 }
19740 /**
19741 * In a comment, after `<!-`, at another `-`.
19742 *
19743 * ```markdown
19744 * > | a <!--b--> c
19745 * ^
19746 * ```
19747 *
19748 * @type {State}
19749 */
19750 function commentOpenInside(code) {
19751 if (code === 45) {
19752 effects.consume(code);
19753 return commentEnd;
19754 }
19755 return nok(code);
19756 }
19757 /**
19758 * In comment.
19759 *
19760 * ```markdown
19761 * > | a <!--b--> c
19762 * ^
19763 * ```
19764 *
19765 * @type {State}
19766 */
19767 function comment(code) {
19768 if (code === null) return nok(code);
19769 if (code === 45) {
19770 effects.consume(code);
19771 return commentClose;
19772 }
19773 if (markdownLineEnding(code)) {
19774 returnState = comment;
19775 return lineEndingBefore(code);
19776 }
19777 effects.consume(code);
19778 return comment;
19779 }
19780 /**
19781 * In comment, after `-`.
19782 *
19783 * ```markdown
19784 * > | a <!--b--> c
19785 * ^
19786 * ```
19787 *
19788 * @type {State}
19789 */
19790 function commentClose(code) {
19791 if (code === 45) {
19792 effects.consume(code);
19793 return commentEnd;
19794 }
19795 return comment(code);
19796 }
19797 /**
19798 * In comment, after `--`.
19799 *
19800 * ```markdown
19801 * > | a <!--b--> c
19802 * ^
19803 * ```
19804 *
19805 * @type {State}
19806 */
19807 function commentEnd(code) {
19808 return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);
19809 }
19810 /**
19811 * After `<![`, in CDATA, expecting `CDATA[`.
19812 *
19813 * ```markdown
19814 * > | a <![CDATA[>&<]]> b
19815 * ^^^^^^
19816 * ```
19817 *
19818 * @type {State}
19819 */
19820 function cdataOpenInside(code) {
19821 if (code === "CDATA[".charCodeAt(index++)) {
19822 effects.consume(code);
19823 return index === 6 ? cdata : cdataOpenInside;
19824 }
19825 return nok(code);
19826 }
19827 /**
19828 * In CDATA.
19829 *
19830 * ```markdown
19831 * > | a <![CDATA[>&<]]> b
19832 * ^^^
19833 * ```
19834 *
19835 * @type {State}
19836 */
19837 function cdata(code) {
19838 if (code === null) return nok(code);
19839 if (code === 93) {
19840 effects.consume(code);
19841 return cdataClose;
19842 }
19843 if (markdownLineEnding(code)) {
19844 returnState = cdata;
19845 return lineEndingBefore(code);
19846 }
19847 effects.consume(code);
19848 return cdata;
19849 }
19850 /**
19851 * In CDATA, after `]`, at another `]`.
19852 *
19853 * ```markdown
19854 * > | a <![CDATA[>&<]]> b
19855 * ^
19856 * ```
19857 *
19858 * @type {State}
19859 */
19860 function cdataClose(code) {
19861 if (code === 93) {
19862 effects.consume(code);
19863 return cdataEnd;
19864 }
19865 return cdata(code);
19866 }
19867 /**
19868 * In CDATA, after `]]`, at `>`.
19869 *
19870 * ```markdown
19871 * > | a <![CDATA[>&<]]> b
19872 * ^
19873 * ```
19874 *
19875 * @type {State}
19876 */
19877 function cdataEnd(code) {
19878 if (code === 62) return end(code);
19879 if (code === 93) {
19880 effects.consume(code);
19881 return cdataEnd;
19882 }
19883 return cdata(code);
19884 }
19885 /**
19886 * In declaration.
19887 *
19888 * ```markdown
19889 * > | a <!b> c
19890 * ^
19891 * ```
19892 *
19893 * @type {State}
19894 */
19895 function declaration(code) {
19896 if (code === null || code === 62) return end(code);
19897 if (markdownLineEnding(code)) {
19898 returnState = declaration;
19899 return lineEndingBefore(code);
19900 }
19901 effects.consume(code);
19902 return declaration;
19903 }
19904 /**
19905 * In instruction.
19906 *
19907 * ```markdown
19908 * > | a <?b?> c
19909 * ^
19910 * ```
19911 *
19912 * @type {State}
19913 */
19914 function instruction(code) {
19915 if (code === null) return nok(code);
19916 if (code === 63) {
19917 effects.consume(code);
19918 return instructionClose;
19919 }
19920 if (markdownLineEnding(code)) {
19921 returnState = instruction;
19922 return lineEndingBefore(code);
19923 }
19924 effects.consume(code);
19925 return instruction;
19926 }
19927 /**
19928 * In instruction, after `?`, at `>`.
19929 *
19930 * ```markdown
19931 * > | a <?b?> c
19932 * ^
19933 * ```
19934 *
19935 * @type {State}
19936 */
19937 function instructionClose(code) {
19938 return code === 62 ? end(code) : instruction(code);
19939 }
19940 /**
19941 * After `</`, in closing tag, at tag name.
19942 *
19943 * ```markdown
19944 * > | a </b> c
19945 * ^
19946 * ```
19947 *
19948 * @type {State}
19949 */
19950 function tagCloseStart(code) {
19951 if (asciiAlpha(code)) {
19952 effects.consume(code);
19953 return tagClose;
19954 }
19955 return nok(code);
19956 }
19957 /**
19958 * After `</x`, in a tag name.
19959 *
19960 * ```markdown
19961 * > | a </b> c
19962 * ^
19963 * ```
19964 *
19965 * @type {State}
19966 */
19967 function tagClose(code) {
19968 if (code === 45 || asciiAlphanumeric(code)) {
19969 effects.consume(code);
19970 return tagClose;
19971 }
19972 return tagCloseBetween(code);
19973 }
19974 /**
19975 * In closing tag, after tag name.
19976 *
19977 * ```markdown
19978 * > | a </b> c
19979 * ^
19980 * ```
19981 *
19982 * @type {State}
19983 */
19984 function tagCloseBetween(code) {
19985 if (markdownLineEnding(code)) {
19986 returnState = tagCloseBetween;
19987 return lineEndingBefore(code);
19988 }
19989 if (markdownSpace(code)) {
19990 effects.consume(code);
19991 return tagCloseBetween;
19992 }
19993 return end(code);
19994 }
19995 /**
19996 * After `<x`, in opening tag name.
19997 *
19998 * ```markdown
19999 * > | a <b> c
20000 * ^
20001 * ```
20002 *
20003 * @type {State}
20004 */
20005 function tagOpen(code) {
20006 if (code === 45 || asciiAlphanumeric(code)) {
20007 effects.consume(code);
20008 return tagOpen;
20009 }
20010 if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) return tagOpenBetween(code);
20011 return nok(code);
20012 }
20013 /**
20014 * In opening tag, after tag name.
20015 *
20016 * ```markdown
20017 * > | a <b> c
20018 * ^
20019 * ```
20020 *
20021 * @type {State}
20022 */
20023 function tagOpenBetween(code) {
20024 if (code === 47) {
20025 effects.consume(code);
20026 return end;
20027 }
20028 if (code === 58 || code === 95 || asciiAlpha(code)) {
20029 effects.consume(code);
20030 return tagOpenAttributeName;
20031 }
20032 if (markdownLineEnding(code)) {
20033 returnState = tagOpenBetween;
20034 return lineEndingBefore(code);
20035 }
20036 if (markdownSpace(code)) {
20037 effects.consume(code);
20038 return tagOpenBetween;
20039 }
20040 return end(code);
20041 }
20042 /**
20043 * In attribute name.
20044 *
20045 * ```markdown
20046 * > | a <b c> d
20047 * ^
20048 * ```
20049 *
20050 * @type {State}
20051 */
20052 function tagOpenAttributeName(code) {
20053 if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
20054 effects.consume(code);
20055 return tagOpenAttributeName;
20056 }
20057 return tagOpenAttributeNameAfter(code);
20058 }
20059 /**
20060 * After attribute name, before initializer, the end of the tag, or
20061 * whitespace.
20062 *
20063 * ```markdown
20064 * > | a <b c> d
20065 * ^
20066 * ```
20067 *
20068 * @type {State}
20069 */
20070 function tagOpenAttributeNameAfter(code) {
20071 if (code === 61) {
20072 effects.consume(code);
20073 return tagOpenAttributeValueBefore;
20074 }
20075 if (markdownLineEnding(code)) {
20076 returnState = tagOpenAttributeNameAfter;
20077 return lineEndingBefore(code);
20078 }
20079 if (markdownSpace(code)) {
20080 effects.consume(code);
20081 return tagOpenAttributeNameAfter;
20082 }
20083 return tagOpenBetween(code);
20084 }
20085 /**
20086 * Before unquoted, double quoted, or single quoted attribute value, allowing
20087 * whitespace.
20088 *
20089 * ```markdown
20090 * > | a <b c=d> e
20091 * ^
20092 * ```
20093 *
20094 * @type {State}
20095 */
20096 function tagOpenAttributeValueBefore(code) {
20097 if (code === null || code === 60 || code === 61 || code === 62 || code === 96) return nok(code);
20098 if (code === 34 || code === 39) {
20099 effects.consume(code);
20100 marker = code;
20101 return tagOpenAttributeValueQuoted;
20102 }
20103 if (markdownLineEnding(code)) {
20104 returnState = tagOpenAttributeValueBefore;
20105 return lineEndingBefore(code);
20106 }
20107 if (markdownSpace(code)) {
20108 effects.consume(code);
20109 return tagOpenAttributeValueBefore;
20110 }
20111 effects.consume(code);
20112 return tagOpenAttributeValueUnquoted;
20113 }
20114 /**
20115 * In double or single quoted attribute value.
20116 *
20117 * ```markdown
20118 * > | a <b c="d"> e
20119 * ^
20120 * ```
20121 *
20122 * @type {State}
20123 */
20124 function tagOpenAttributeValueQuoted(code) {
20125 if (code === marker) {
20126 effects.consume(code);
20127 marker = void 0;
20128 return tagOpenAttributeValueQuotedAfter;
20129 }
20130 if (code === null) return nok(code);
20131 if (markdownLineEnding(code)) {
20132 returnState = tagOpenAttributeValueQuoted;
20133 return lineEndingBefore(code);
20134 }
20135 effects.consume(code);
20136 return tagOpenAttributeValueQuoted;
20137 }
20138 /**
20139 * In unquoted attribute value.
20140 *
20141 * ```markdown
20142 * > | a <b c=d> e
20143 * ^
20144 * ```
20145 *
20146 * @type {State}
20147 */
20148 function tagOpenAttributeValueUnquoted(code) {
20149 if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) return nok(code);
20150 if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) return tagOpenBetween(code);
20151 effects.consume(code);
20152 return tagOpenAttributeValueUnquoted;
20153 }
20154 /**
20155 * After double or single quoted attribute value, before whitespace or the end
20156 * of the tag.
20157 *
20158 * ```markdown
20159 * > | a <b c="d"> e
20160 * ^
20161 * ```
20162 *
20163 * @type {State}
20164 */
20165 function tagOpenAttributeValueQuotedAfter(code) {
20166 if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) return tagOpenBetween(code);
20167 return nok(code);
20168 }
20169 /**
20170 * In certain circumstances of a tag where only an `>` is allowed.
20171 *
20172 * ```markdown
20173 * > | a <b c="d"> e
20174 * ^
20175 * ```
20176 *
20177 * @type {State}
20178 */
20179 function end(code) {
20180 if (code === 62) {
20181 effects.consume(code);
20182 effects.exit("htmlTextData");
20183 effects.exit("htmlText");
20184 return ok;
20185 }
20186 return nok(code);
20187 }
20188 /**
20189 * At eol.
20190 *
20191 * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
20192 * > empty tokens.
20193 *
20194 * ```markdown
20195 * > | a <!--a
20196 * ^
20197 * | b-->
20198 * ```
20199 *
20200 * @type {State}
20201 */
20202 function lineEndingBefore(code) {
20203 effects.exit("htmlTextData");
20204 effects.enter("lineEnding");
20205 effects.consume(code);
20206 effects.exit("lineEnding");
20207 return lineEndingAfter;
20208 }
20209 /**
20210 * After eol, at optional whitespace.
20211 *
20212 * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
20213 * > empty tokens.
20214 *
20215 * ```markdown
20216 * | a <!--a
20217 * > | b-->
20218 * ^
20219 * ```
20220 *
20221 * @type {State}
20222 */
20223 function lineEndingAfter(code) {
20224 return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code) : lineEndingAfterPrefix(code);
20225 }
20226 /**
20227 * After eol, after optional whitespace.
20228 *
20229 * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
20230 * > empty tokens.
20231 *
20232 * ```markdown
20233 * | a <!--a
20234 * > | b-->
20235 * ^
20236 * ```
20237 *
20238 * @type {State}
20239 */
20240 function lineEndingAfterPrefix(code) {
20241 effects.enter("htmlTextData");
20242 return returnState(code);
20243 }
20244 }
20245 var htmlText;
20246 var init_html_text = __esmMin((() => {
20247 init_micromark_factory_space();
20248 init_micromark_util_character();
20249 htmlText = {
20250 name: "htmlText",
20251 tokenize: tokenizeHtmlText
20252 };
20253 }));
20254
20255 //#endregion
20256 //#region node_modules/micromark-core-commonmark/lib/label-end.js
20257 /** @type {Resolver} */
20258 function resolveAllLabelEnd(events) {
20259 let index = -1;
20260 while (++index < events.length) {
20261 const token = events[index][1];
20262 if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") {
20263 events.splice(index + 1, token.type === "labelImage" ? 4 : 2);
20264 token.type = "data";
20265 index++;
20266 }
20267 }
20268 return events;
20269 }
20270 /** @type {Resolver} */
20271 function resolveToLabelEnd(events, context) {
20272 let index = events.length;
20273 let offset = 0;
20274 /** @type {Token} */
20275 let token;
20276 /** @type {number | undefined} */
20277 let open;
20278 /** @type {number | undefined} */
20279 let close;
20280 /** @type {Array<Event>} */
20281 let media;
20282 while (index--) {
20283 token = events[index][1];
20284 if (open) {
20285 if (token.type === "link" || token.type === "labelLink" && token._inactive) break;
20286 if (events[index][0] === "enter" && token.type === "labelLink") token._inactive = true;
20287 } else if (close) {
20288 if (events[index][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) {
20289 open = index;
20290 if (token.type !== "labelLink") {
20291 offset = 2;
20292 break;
20293 }
20294 }
20295 } else if (token.type === "labelEnd") close = index;
20296 }
20297 const group = {
20298 type: events[open][1].type === "labelLink" ? "link" : "image",
20299 start: Object.assign({}, events[open][1].start),
20300 end: Object.assign({}, events[events.length - 1][1].end)
20301 };
20302 const label = {
20303 type: "label",
20304 start: Object.assign({}, events[open][1].start),
20305 end: Object.assign({}, events[close][1].end)
20306 };
20307 const text = {
20308 type: "labelText",
20309 start: Object.assign({}, events[open + offset + 2][1].end),
20310 end: Object.assign({}, events[close - 2][1].start)
20311 };
20312 media = [[
20313 "enter",
20314 group,
20315 context
20316 ], [
20317 "enter",
20318 label,
20319 context
20320 ]];
20321 media = push(media, events.slice(open + 1, open + offset + 3));
20322 media = push(media, [[
20323 "enter",
20324 text,
20325 context
20326 ]]);
20327 media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));
20328 media = push(media, [
20329 [
20330 "exit",
20331 text,
20332 context
20333 ],
20334 events[close - 2],
20335 events[close - 1],
20336 [
20337 "exit",
20338 label,
20339 context
20340 ]
20341 ]);
20342 media = push(media, events.slice(close + 1));
20343 media = push(media, [[
20344 "exit",
20345 group,
20346 context
20347 ]]);
20348 splice(events, open, events.length, media);
20349 return events;
20350 }
20351 /**
20352 * @this {TokenizeContext}
20353 * @type {Tokenizer}
20354 */
20355 function tokenizeLabelEnd(effects, ok, nok) {
20356 const self = this;
20357 let index = self.events.length;
20358 /** @type {Token} */
20359 let labelStart;
20360 /** @type {boolean} */
20361 let defined;
20362 while (index--) if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) {
20363 labelStart = self.events[index][1];
20364 break;
20365 }
20366 return start;
20367 /**
20368 * Start of label end.
20369 *
20370 * ```markdown
20371 * > | [a](b) c
20372 * ^
20373 * > | [a][b] c
20374 * ^
20375 * > | [a][] b
20376 * ^
20377 * > | [a] b
20378 * ```
20379 *
20380 * @type {State}
20381 */
20382 function start(code) {
20383 if (!labelStart) return nok(code);
20384 if (labelStart._inactive) return labelEndNok(code);
20385 defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({
20386 start: labelStart.end,
20387 end: self.now()
20388 })));
20389 effects.enter("labelEnd");
20390 effects.enter("labelMarker");
20391 effects.consume(code);
20392 effects.exit("labelMarker");
20393 effects.exit("labelEnd");
20394 return after;
20395 }
20396 /**
20397 * After `]`.
20398 *
20399 * ```markdown
20400 * > | [a](b) c
20401 * ^
20402 * > | [a][b] c
20403 * ^
20404 * > | [a][] b
20405 * ^
20406 * > | [a] b
20407 * ^
20408 * ```
20409 *
20410 * @type {State}
20411 */
20412 function after(code) {
20413 if (code === 40) return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);
20414 if (code === 91) return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);
20415 return defined ? labelEndOk(code) : labelEndNok(code);
20416 }
20417 /**
20418 * After `]`, at `[`, but not at a full reference.
20419 *
20420 * > 👉 **Note**: we only get here if the label is defined.
20421 *
20422 * ```markdown
20423 * > | [a][] b
20424 * ^
20425 * > | [a] b
20426 * ^
20427 * ```
20428 *
20429 * @type {State}
20430 */
20431 function referenceNotFull(code) {
20432 return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);
20433 }
20434 /**
20435 * Done, we found something.
20436 *
20437 * ```markdown
20438 * > | [a](b) c
20439 * ^
20440 * > | [a][b] c
20441 * ^
20442 * > | [a][] b
20443 * ^
20444 * > | [a] b
20445 * ^
20446 * ```
20447 *
20448 * @type {State}
20449 */
20450 function labelEndOk(code) {
20451 return ok(code);
20452 }
20453 /**
20454 * Done, it’s nothing.
20455 *
20456 * There was an okay opening, but we didn’t match anything.
20457 *
20458 * ```markdown
20459 * > | [a](b c
20460 * ^
20461 * > | [a][b c
20462 * ^
20463 * > | [a] b
20464 * ^
20465 * ```
20466 *
20467 * @type {State}
20468 */
20469 function labelEndNok(code) {
20470 labelStart._balanced = true;
20471 return nok(code);
20472 }
20473 }
20474 /**
20475 * @this {TokenizeContext}
20476 * @type {Tokenizer}
20477 */
20478 function tokenizeResource(effects, ok, nok) {
20479 return resourceStart;
20480 /**
20481 * At a resource.
20482 *
20483 * ```markdown
20484 * > | [a](b) c
20485 * ^
20486 * ```
20487 *
20488 * @type {State}
20489 */
20490 function resourceStart(code) {
20491 effects.enter("resource");
20492 effects.enter("resourceMarker");
20493 effects.consume(code);
20494 effects.exit("resourceMarker");
20495 return resourceBefore;
20496 }
20497 /**
20498 * In resource, after `(`, at optional whitespace.
20499 *
20500 * ```markdown
20501 * > | [a](b) c
20502 * ^
20503 * ```
20504 *
20505 * @type {State}
20506 */
20507 function resourceBefore(code) {
20508 return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);
20509 }
20510 /**
20511 * In resource, after optional whitespace, at `)` or a destination.
20512 *
20513 * ```markdown
20514 * > | [a](b) c
20515 * ^
20516 * ```
20517 *
20518 * @type {State}
20519 */
20520 function resourceOpen(code) {
20521 if (code === 41) return resourceEnd(code);
20522 return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code);
20523 }
20524 /**
20525 * In resource, after destination, at optional whitespace.
20526 *
20527 * ```markdown
20528 * > | [a](b) c
20529 * ^
20530 * ```
20531 *
20532 * @type {State}
20533 */
20534 function resourceDestinationAfter(code) {
20535 return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);
20536 }
20537 /**
20538 * At invalid destination.
20539 *
20540 * ```markdown
20541 * > | [a](<<) b
20542 * ^
20543 * ```
20544 *
20545 * @type {State}
20546 */
20547 function resourceDestinationMissing(code) {
20548 return nok(code);
20549 }
20550 /**
20551 * In resource, after destination and whitespace, at `(` or title.
20552 *
20553 * ```markdown
20554 * > | [a](b ) c
20555 * ^
20556 * ```
20557 *
20558 * @type {State}
20559 */
20560 function resourceBetween(code) {
20561 if (code === 34 || code === 39 || code === 40) return factoryTitle(effects, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code);
20562 return resourceEnd(code);
20563 }
20564 /**
20565 * In resource, after title, at optional whitespace.
20566 *
20567 * ```markdown
20568 * > | [a](b "c") d
20569 * ^
20570 * ```
20571 *
20572 * @type {State}
20573 */
20574 function resourceTitleAfter(code) {
20575 return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);
20576 }
20577 /**
20578 * In resource, at `)`.
20579 *
20580 * ```markdown
20581 * > | [a](b) d
20582 * ^
20583 * ```
20584 *
20585 * @type {State}
20586 */
20587 function resourceEnd(code) {
20588 if (code === 41) {
20589 effects.enter("resourceMarker");
20590 effects.consume(code);
20591 effects.exit("resourceMarker");
20592 effects.exit("resource");
20593 return ok;
20594 }
20595 return nok(code);
20596 }
20597 }
20598 /**
20599 * @this {TokenizeContext}
20600 * @type {Tokenizer}
20601 */
20602 function tokenizeReferenceFull(effects, ok, nok) {
20603 const self = this;
20604 return referenceFull;
20605 /**
20606 * In a reference (full), at the `[`.
20607 *
20608 * ```markdown
20609 * > | [a][b] d
20610 * ^
20611 * ```
20612 *
20613 * @type {State}
20614 */
20615 function referenceFull(code) {
20616 return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code);
20617 }
20618 /**
20619 * In a reference (full), after `]`.
20620 *
20621 * ```markdown
20622 * > | [a][b] d
20623 * ^
20624 * ```
20625 *
20626 * @type {State}
20627 */
20628 function referenceFullAfter(code) {
20629 return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);
20630 }
20631 /**
20632 * In reference (full) that was missing.
20633 *
20634 * ```markdown
20635 * > | [a][b d
20636 * ^
20637 * ```
20638 *
20639 * @type {State}
20640 */
20641 function referenceFullMissing(code) {
20642 return nok(code);
20643 }
20644 }
20645 /**
20646 * @this {TokenizeContext}
20647 * @type {Tokenizer}
20648 */
20649 function tokenizeReferenceCollapsed(effects, ok, nok) {
20650 return referenceCollapsedStart;
20651 /**
20652 * In reference (collapsed), at `[`.
20653 *
20654 * > 👉 **Note**: we only get here if the label is defined.
20655 *
20656 * ```markdown
20657 * > | [a][] d
20658 * ^
20659 * ```
20660 *
20661 * @type {State}
20662 */
20663 function referenceCollapsedStart(code) {
20664 effects.enter("reference");
20665 effects.enter("referenceMarker");
20666 effects.consume(code);
20667 effects.exit("referenceMarker");
20668 return referenceCollapsedOpen;
20669 }
20670 /**
20671 * In reference (collapsed), at `]`.
20672 *
20673 * > 👉 **Note**: we only get here if the label is defined.
20674 *
20675 * ```markdown
20676 * > | [a][] d
20677 * ^
20678 * ```
20679 *
20680 * @type {State}
20681 */
20682 function referenceCollapsedOpen(code) {
20683 if (code === 93) {
20684 effects.enter("referenceMarker");
20685 effects.consume(code);
20686 effects.exit("referenceMarker");
20687 effects.exit("reference");
20688 return ok;
20689 }
20690 return nok(code);
20691 }
20692 }
20693 var labelEnd, resourceConstruct, referenceFullConstruct, referenceCollapsedConstruct;
20694 var init_label_end = __esmMin((() => {
20695 init_micromark_factory_destination();
20696 init_micromark_factory_label();
20697 init_micromark_factory_title();
20698 init_micromark_factory_whitespace();
20699 init_micromark_util_character();
20700 init_micromark_util_chunked();
20701 init_micromark_util_normalize_identifier();
20702 init_micromark_util_resolve_all();
20703 labelEnd = {
20704 name: "labelEnd",
20705 tokenize: tokenizeLabelEnd,
20706 resolveTo: resolveToLabelEnd,
20707 resolveAll: resolveAllLabelEnd
20708 };
20709 resourceConstruct = { tokenize: tokenizeResource };
20710 referenceFullConstruct = { tokenize: tokenizeReferenceFull };
20711 referenceCollapsedConstruct = { tokenize: tokenizeReferenceCollapsed };
20712 }));
20713
20714 //#endregion
20715 //#region node_modules/micromark-core-commonmark/lib/label-start-image.js
20716 /**
20717 * @this {TokenizeContext}
20718 * @type {Tokenizer}
20719 */
20720 function tokenizeLabelStartImage(effects, ok, nok) {
20721 const self = this;
20722 return start;
20723 /**
20724 * Start of label (image) start.
20725 *
20726 * ```markdown
20727 * > | a ![b] c
20728 * ^
20729 * ```
20730 *
20731 * @type {State}
20732 */
20733 function start(code) {
20734 effects.enter("labelImage");
20735 effects.enter("labelImageMarker");
20736 effects.consume(code);
20737 effects.exit("labelImageMarker");
20738 return open;
20739 }
20740 /**
20741 * After `!`, at `[`.
20742 *
20743 * ```markdown
20744 * > | a ![b] c
20745 * ^
20746 * ```
20747 *
20748 * @type {State}
20749 */
20750 function open(code) {
20751 if (code === 91) {
20752 effects.enter("labelMarker");
20753 effects.consume(code);
20754 effects.exit("labelMarker");
20755 effects.exit("labelImage");
20756 return after;
20757 }
20758 return nok(code);
20759 }
20760 /**
20761 * After `![`.
20762 *
20763 * ```markdown
20764 * > | a ![b] c
20765 * ^
20766 * ```
20767 *
20768 * This is needed in because, when GFM footnotes are enabled, images never
20769 * form when started with a `^`.
20770 * Instead, links form:
20771 *
20772 * ```markdown
20773 * ![^a](b)
20774 *
20775 * ![^a][b]
20776 *
20777 * [b]: c
20778 * ```
20779 *
20780 * ```html
20781 * <p>!<a href=\"b\">^a</a></p>
20782 * <p>!<a href=\"c\">^a</a></p>
20783 * ```
20784 *
20785 * @type {State}
20786 */
20787 function after(code) {
20788 /* c8 ignore next 3 */
20789 return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
20790 }
20791 }
20792 var labelStartImage;
20793 var init_label_start_image = __esmMin((() => {
20794 init_label_end();
20795 labelStartImage = {
20796 name: "labelStartImage",
20797 tokenize: tokenizeLabelStartImage,
20798 resolveAll: labelEnd.resolveAll
20799 };
20800 }));
20801
20802 //#endregion
20803 //#region node_modules/micromark-core-commonmark/lib/label-start-link.js
20804 /**
20805 * @this {TokenizeContext}
20806 * @type {Tokenizer}
20807 */
20808 function tokenizeLabelStartLink(effects, ok, nok) {
20809 const self = this;
20810 return start;
20811 /**
20812 * Start of label (link) start.
20813 *
20814 * ```markdown
20815 * > | a [b] c
20816 * ^
20817 * ```
20818 *
20819 * @type {State}
20820 */
20821 function start(code) {
20822 effects.enter("labelLink");
20823 effects.enter("labelMarker");
20824 effects.consume(code);
20825 effects.exit("labelMarker");
20826 effects.exit("labelLink");
20827 return after;
20828 }
20829 /** @type {State} */
20830 function after(code) {
20831 /* c8 ignore next 3 */
20832 return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
20833 }
20834 }
20835 var labelStartLink;
20836 var init_label_start_link = __esmMin((() => {
20837 init_label_end();
20838 labelStartLink = {
20839 name: "labelStartLink",
20840 tokenize: tokenizeLabelStartLink,
20841 resolveAll: labelEnd.resolveAll
20842 };
20843 }));
20844
20845 //#endregion
20846 //#region node_modules/micromark-core-commonmark/lib/line-ending.js
20847 /**
20848 * @this {TokenizeContext}
20849 * @type {Tokenizer}
20850 */
20851 function tokenizeLineEnding(effects, ok) {
20852 return start;
20853 /** @type {State} */
20854 function start(code) {
20855 effects.enter("lineEnding");
20856 effects.consume(code);
20857 effects.exit("lineEnding");
20858 return factorySpace(effects, ok, "linePrefix");
20859 }
20860 }
20861 var lineEnding;
20862 var init_line_ending = __esmMin((() => {
20863 init_micromark_factory_space();
20864 lineEnding = {
20865 name: "lineEnding",
20866 tokenize: tokenizeLineEnding
20867 };
20868 }));
20869
20870 //#endregion
20871 //#region node_modules/micromark-core-commonmark/lib/thematic-break.js
20872 /**
20873 * @this {TokenizeContext}
20874 * @type {Tokenizer}
20875 */
20876 function tokenizeThematicBreak(effects, ok, nok) {
20877 let size = 0;
20878 /** @type {NonNullable<Code>} */
20879 let marker;
20880 return start;
20881 /**
20882 * Start of thematic break.
20883 *
20884 * ```markdown
20885 * > | ***
20886 * ^
20887 * ```
20888 *
20889 * @type {State}
20890 */
20891 function start(code) {
20892 effects.enter("thematicBreak");
20893 return before(code);
20894 }
20895 /**
20896 * After optional whitespace, at marker.
20897 *
20898 * ```markdown
20899 * > | ***
20900 * ^
20901 * ```
20902 *
20903 * @type {State}
20904 */
20905 function before(code) {
20906 marker = code;
20907 return atBreak(code);
20908 }
20909 /**
20910 * After something, before something else.
20911 *
20912 * ```markdown
20913 * > | ***
20914 * ^
20915 * ```
20916 *
20917 * @type {State}
20918 */
20919 function atBreak(code) {
20920 if (code === marker) {
20921 effects.enter("thematicBreakSequence");
20922 return sequence(code);
20923 }
20924 if (size >= 3 && (code === null || markdownLineEnding(code))) {
20925 effects.exit("thematicBreak");
20926 return ok(code);
20927 }
20928 return nok(code);
20929 }
20930 /**
20931 * In sequence.
20932 *
20933 * ```markdown
20934 * > | ***
20935 * ^
20936 * ```
20937 *
20938 * @type {State}
20939 */
20940 function sequence(code) {
20941 if (code === marker) {
20942 effects.consume(code);
20943 size++;
20944 return sequence;
20945 }
20946 effects.exit("thematicBreakSequence");
20947 return markdownSpace(code) ? factorySpace(effects, atBreak, "whitespace")(code) : atBreak(code);
20948 }
20949 }
20950 var thematicBreak$1;
20951 var init_thematic_break$1 = __esmMin((() => {
20952 init_micromark_factory_space();
20953 init_micromark_util_character();
20954 thematicBreak$1 = {
20955 name: "thematicBreak",
20956 tokenize: tokenizeThematicBreak
20957 };
20958 }));
20959
20960 //#endregion
20961 //#region node_modules/micromark-core-commonmark/lib/list.js
20962 /**
20963 * @type {Tokenizer}
20964 * @this {TokenizeContext}
20965 */
20966 function tokenizeListStart(effects, ok, nok) {
20967 const self = this;
20968 const tail = self.events[self.events.length - 1];
20969 let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
20970 let size = 0;
20971 return start;
20972 /** @type {State} */
20973 function start(code) {
20974 const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? "listUnordered" : "listOrdered");
20975 if (kind === "listUnordered" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {
20976 if (!self.containerState.type) {
20977 self.containerState.type = kind;
20978 effects.enter(kind, { _container: true });
20979 }
20980 if (kind === "listUnordered") {
20981 effects.enter("listItemPrefix");
20982 return code === 42 || code === 45 ? effects.check(thematicBreak$1, nok, atMarker)(code) : atMarker(code);
20983 }
20984 if (!self.interrupt || code === 49) {
20985 effects.enter("listItemPrefix");
20986 effects.enter("listItemValue");
20987 return inside(code);
20988 }
20989 }
20990 return nok(code);
20991 }
20992 /** @type {State} */
20993 function inside(code) {
20994 if (asciiDigit(code) && ++size < 10) {
20995 effects.consume(code);
20996 return inside;
20997 }
20998 if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {
20999 effects.exit("listItemValue");
21000 return atMarker(code);
21001 }
21002 return nok(code);
21003 }
21004 /**
21005 * @type {State}
21006 **/
21007 function atMarker(code) {
21008 effects.enter("listItemMarker");
21009 effects.consume(code);
21010 effects.exit("listItemMarker");
21011 self.containerState.marker = self.containerState.marker || code;
21012 return effects.check(blankLine, self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));
21013 }
21014 /** @type {State} */
21015 function onBlank(code) {
21016 self.containerState.initialBlankLine = true;
21017 initialSize++;
21018 return endOfPrefix(code);
21019 }
21020 /** @type {State} */
21021 function otherPrefix(code) {
21022 if (markdownSpace(code)) {
21023 effects.enter("listItemPrefixWhitespace");
21024 effects.consume(code);
21025 effects.exit("listItemPrefixWhitespace");
21026 return endOfPrefix;
21027 }
21028 return nok(code);
21029 }
21030 /** @type {State} */
21031 function endOfPrefix(code) {
21032 self.containerState.size = initialSize + self.sliceSerialize(effects.exit("listItemPrefix"), true).length;
21033 return ok(code);
21034 }
21035 }
21036 /**
21037 * @type {Tokenizer}
21038 * @this {TokenizeContext}
21039 */
21040 function tokenizeListContinuation(effects, ok, nok) {
21041 const self = this;
21042 self.containerState._closeFlow = void 0;
21043 return effects.check(blankLine, onBlank, notBlank);
21044 /** @type {State} */
21045 function onBlank(code) {
21046 self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;
21047 return factorySpace(effects, ok, "listItemIndent", self.containerState.size + 1)(code);
21048 }
21049 /** @type {State} */
21050 function notBlank(code) {
21051 if (self.containerState.furtherBlankLines || !markdownSpace(code)) {
21052 self.containerState.furtherBlankLines = void 0;
21053 self.containerState.initialBlankLine = void 0;
21054 return notInCurrentItem(code);
21055 }
21056 self.containerState.furtherBlankLines = void 0;
21057 self.containerState.initialBlankLine = void 0;
21058 return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);
21059 }
21060 /** @type {State} */
21061 function notInCurrentItem(code) {
21062 self.containerState._closeFlow = true;
21063 self.interrupt = void 0;
21064 return factorySpace(effects, effects.attempt(list$1, ok, nok), "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code);
21065 }
21066 }
21067 /**
21068 * @type {Tokenizer}
21069 * @this {TokenizeContext}
21070 */
21071 function tokenizeIndent(effects, ok, nok) {
21072 const self = this;
21073 return factorySpace(effects, afterPrefix, "listItemIndent", self.containerState.size + 1);
21074 /** @type {State} */
21075 function afterPrefix(code) {
21076 const tail = self.events[self.events.length - 1];
21077 return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);
21078 }
21079 }
21080 /**
21081 * @type {Exiter}
21082 * @this {TokenizeContext}
21083 */
21084 function tokenizeListEnd(effects) {
21085 effects.exit(this.containerState.type);
21086 }
21087 /**
21088 * @type {Tokenizer}
21089 * @this {TokenizeContext}
21090 */
21091 function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
21092 const self = this;
21093 return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5);
21094 /** @type {State} */
21095 function afterPrefix(code) {
21096 const tail = self.events[self.events.length - 1];
21097 return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code);
21098 }
21099 }
21100 var list$1, listItemPrefixWhitespaceConstruct, indentConstruct;
21101 var init_list$1 = __esmMin((() => {
21102 init_micromark_factory_space();
21103 init_micromark_util_character();
21104 init_blank_line();
21105 init_thematic_break$1();
21106 list$1 = {
21107 name: "list",
21108 tokenize: tokenizeListStart,
21109 continuation: { tokenize: tokenizeListContinuation },
21110 exit: tokenizeListEnd
21111 };
21112 listItemPrefixWhitespaceConstruct = {
21113 tokenize: tokenizeListItemPrefixWhitespace,
21114 partial: true
21115 };
21116 indentConstruct = {
21117 tokenize: tokenizeIndent,
21118 partial: true
21119 };
21120 }));
21121
21122 //#endregion
21123 //#region node_modules/micromark-core-commonmark/lib/setext-underline.js
21124 /** @type {Resolver} */
21125 function resolveToSetextUnderline(events, context) {
21126 let index = events.length;
21127 /** @type {number | undefined} */
21128 let content;
21129 /** @type {number | undefined} */
21130 let text;
21131 /** @type {number | undefined} */
21132 let definition;
21133 while (index--) if (events[index][0] === "enter") {
21134 if (events[index][1].type === "content") {
21135 content = index;
21136 break;
21137 }
21138 if (events[index][1].type === "paragraph") text = index;
21139 } else {
21140 if (events[index][1].type === "content") events.splice(index, 1);
21141 if (!definition && events[index][1].type === "definition") definition = index;
21142 }
21143 const heading = {
21144 type: "setextHeading",
21145 start: Object.assign({}, events[text][1].start),
21146 end: Object.assign({}, events[events.length - 1][1].end)
21147 };
21148 events[text][1].type = "setextHeadingText";
21149 if (definition) {
21150 events.splice(text, 0, [
21151 "enter",
21152 heading,
21153 context
21154 ]);
21155 events.splice(definition + 1, 0, [
21156 "exit",
21157 events[content][1],
21158 context
21159 ]);
21160 events[content][1].end = Object.assign({}, events[definition][1].end);
21161 } else events[content][1] = heading;
21162 events.push([
21163 "exit",
21164 heading,
21165 context
21166 ]);
21167 return events;
21168 }
21169 /**
21170 * @this {TokenizeContext}
21171 * @type {Tokenizer}
21172 */
21173 function tokenizeSetextUnderline(effects, ok, nok) {
21174 const self = this;
21175 /** @type {NonNullable<Code>} */
21176 let marker;
21177 return start;
21178 /**
21179 * At start of heading (setext) underline.
21180 *
21181 * ```markdown
21182 * | aa
21183 * > | ==
21184 * ^
21185 * ```
21186 *
21187 * @type {State}
21188 */
21189 function start(code) {
21190 let index = self.events.length;
21191 /** @type {boolean | undefined} */
21192 let paragraph;
21193 while (index--) if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") {
21194 paragraph = self.events[index][1].type === "paragraph";
21195 break;
21196 }
21197 if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {
21198 effects.enter("setextHeadingLine");
21199 marker = code;
21200 return before(code);
21201 }
21202 return nok(code);
21203 }
21204 /**
21205 * After optional whitespace, at `-` or `=`.
21206 *
21207 * ```markdown
21208 * | aa
21209 * > | ==
21210 * ^
21211 * ```
21212 *
21213 * @type {State}
21214 */
21215 function before(code) {
21216 effects.enter("setextHeadingLineSequence");
21217 return inside(code);
21218 }
21219 /**
21220 * In sequence.
21221 *
21222 * ```markdown
21223 * | aa
21224 * > | ==
21225 * ^
21226 * ```
21227 *
21228 * @type {State}
21229 */
21230 function inside(code) {
21231 if (code === marker) {
21232 effects.consume(code);
21233 return inside;
21234 }
21235 effects.exit("setextHeadingLineSequence");
21236 return markdownSpace(code) ? factorySpace(effects, after, "lineSuffix")(code) : after(code);
21237 }
21238 /**
21239 * After sequence, after optional whitespace.
21240 *
21241 * ```markdown
21242 * | aa
21243 * > | ==
21244 * ^
21245 * ```
21246 *
21247 * @type {State}
21248 */
21249 function after(code) {
21250 if (code === null || markdownLineEnding(code)) {
21251 effects.exit("setextHeadingLine");
21252 return ok(code);
21253 }
21254 return nok(code);
21255 }
21256 }
21257 var setextUnderline;
21258 var init_setext_underline = __esmMin((() => {
21259 init_micromark_factory_space();
21260 init_micromark_util_character();
21261 setextUnderline = {
21262 name: "setextUnderline",
21263 tokenize: tokenizeSetextUnderline,
21264 resolveTo: resolveToSetextUnderline
21265 };
21266 }));
21267
21268 //#endregion
21269 //#region node_modules/micromark-core-commonmark/index.js
21270 var init_micromark_core_commonmark = __esmMin((() => {
21271 init_attention();
21272 init_autolink();
21273 init_blank_line();
21274 init_block_quote();
21275 init_character_escape();
21276 init_character_reference();
21277 init_code_fenced();
21278 init_code_indented();
21279 init_code_text();
21280 init_content();
21281 init_definition();
21282 init_hard_break_escape();
21283 init_heading_atx();
21284 init_html_flow();
21285 init_html_text();
21286 init_label_end();
21287 init_label_start_image();
21288 init_label_start_link();
21289 init_line_ending();
21290 init_list$1();
21291 init_setext_underline();
21292 init_thematic_break$1();
21293 }));
21294
21295 //#endregion
21296 //#region node_modules/micromark/lib/initialize/flow.js
21297 /**
21298 * @this {TokenizeContext}
21299 * @type {Initializer}
21300 */
21301 function initializeFlow(effects) {
21302 const self = this;
21303 const initial = effects.attempt(blankLine, atBlankEnding, effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), "linePrefix")));
21304 return initial;
21305 /** @type {State} */
21306 function atBlankEnding(code) {
21307 if (code === null) {
21308 effects.consume(code);
21309 return;
21310 }
21311 effects.enter("lineEndingBlank");
21312 effects.consume(code);
21313 effects.exit("lineEndingBlank");
21314 self.currentConstruct = void 0;
21315 return initial;
21316 }
21317 /** @type {State} */
21318 function afterConstruct(code) {
21319 if (code === null) {
21320 effects.consume(code);
21321 return;
21322 }
21323 effects.enter("lineEnding");
21324 effects.consume(code);
21325 effects.exit("lineEnding");
21326 self.currentConstruct = void 0;
21327 return initial;
21328 }
21329 }
21330 var flow$1;
21331 var init_flow = __esmMin((() => {
21332 init_micromark_core_commonmark();
21333 init_micromark_factory_space();
21334 flow$1 = { tokenize: initializeFlow };
21335 }));
21336
21337 //#endregion
21338 //#region node_modules/micromark/lib/initialize/text.js
21339 /**
21340 * @param {'string' | 'text'} field
21341 * @returns {InitialConstruct}
21342 */
21343 function initializeFactory(field) {
21344 return {
21345 tokenize: initializeText,
21346 resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0)
21347 };
21348 /**
21349 * @this {TokenizeContext}
21350 * @type {Initializer}
21351 */
21352 function initializeText(effects) {
21353 const self = this;
21354 const constructs = this.parser.constructs[field];
21355 const text = effects.attempt(constructs, start, notText);
21356 return start;
21357 /** @type {State} */
21358 function start(code) {
21359 return atBreak(code) ? text(code) : notText(code);
21360 }
21361 /** @type {State} */
21362 function notText(code) {
21363 if (code === null) {
21364 effects.consume(code);
21365 return;
21366 }
21367 effects.enter("data");
21368 effects.consume(code);
21369 return data;
21370 }
21371 /** @type {State} */
21372 function data(code) {
21373 if (atBreak(code)) {
21374 effects.exit("data");
21375 return text(code);
21376 }
21377 effects.consume(code);
21378 return data;
21379 }
21380 /**
21381 * @param {Code} code
21382 * @returns {boolean}
21383 */
21384 function atBreak(code) {
21385 if (code === null) return true;
21386 const list = constructs[code];
21387 let index = -1;
21388 if (list) while (++index < list.length) {
21389 const item = list[index];
21390 if (!item.previous || item.previous.call(self, self.previous)) return true;
21391 }
21392 return false;
21393 }
21394 }
21395 }
21396 /**
21397 * @param {Resolver | undefined} [extraResolver]
21398 * @returns {Resolver}
21399 */
21400 function createResolver(extraResolver) {
21401 return resolveAllText;
21402 /** @type {Resolver} */
21403 function resolveAllText(events, context) {
21404 let index = -1;
21405 /** @type {number | undefined} */
21406 let enter;
21407 while (++index <= events.length) if (enter === void 0) {
21408 if (events[index] && events[index][1].type === "data") {
21409 enter = index;
21410 index++;
21411 }
21412 } else if (!events[index] || events[index][1].type !== "data") {
21413 if (index !== enter + 2) {
21414 events[enter][1].end = events[index - 1][1].end;
21415 events.splice(enter + 2, index - enter - 2);
21416 index = enter + 2;
21417 }
21418 enter = void 0;
21419 }
21420 return extraResolver ? extraResolver(events, context) : events;
21421 }
21422 }
21423 /**
21424 * A rather ugly set of instructions which again looks at chunks in the input
21425 * stream.
21426 * The reason to do this here is that it is *much* faster to parse in reverse.
21427 * And that we can’t hook into `null` to split the line suffix before an EOF.
21428 * To do: figure out if we can make this into a clean utility, or even in core.
21429 * As it will be useful for GFMs literal autolink extension (and maybe even
21430 * tables?)
21431 *
21432 * @type {Resolver}
21433 */
21434 function resolveAllLineSuffixes(events, context) {
21435 let eventIndex = 0;
21436 while (++eventIndex <= events.length) if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") {
21437 const data = events[eventIndex - 1][1];
21438 const chunks = context.sliceStream(data);
21439 let index = chunks.length;
21440 let bufferIndex = -1;
21441 let size = 0;
21442 /** @type {boolean | undefined} */
21443 let tabs;
21444 while (index--) {
21445 const chunk = chunks[index];
21446 if (typeof chunk === "string") {
21447 bufferIndex = chunk.length;
21448 while (chunk.charCodeAt(bufferIndex - 1) === 32) {
21449 size++;
21450 bufferIndex--;
21451 }
21452 if (bufferIndex) break;
21453 bufferIndex = -1;
21454 } else if (chunk === -2) {
21455 tabs = true;
21456 size++;
21457 } else if (chunk === -1) {} else {
21458 index++;
21459 break;
21460 }
21461 }
21462 if (size) {
21463 const token = {
21464 type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing",
21465 start: {
21466 line: data.end.line,
21467 column: data.end.column - size,
21468 offset: data.end.offset - size,
21469 _index: data.start._index + index,
21470 _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex
21471 },
21472 end: Object.assign({}, data.end)
21473 };
21474 data.end = Object.assign({}, token.start);
21475 if (data.start.offset === data.end.offset) Object.assign(data, token);
21476 else {
21477 events.splice(eventIndex, 0, [
21478 "enter",
21479 token,
21480 context
21481 ], [
21482 "exit",
21483 token,
21484 context
21485 ]);
21486 eventIndex += 2;
21487 }
21488 }
21489 eventIndex++;
21490 }
21491 return events;
21492 }
21493 var resolver, string$1, text$2;
21494 var init_text$1 = __esmMin((() => {
21495 resolver = { resolveAll: createResolver() };
21496 string$1 = initializeFactory("string");
21497 text$2 = initializeFactory("text");
21498 }));
21499
21500 //#endregion
21501 //#region node_modules/micromark/lib/create-tokenizer.js
21502 /**
21503 * Create a tokenizer.
21504 * Tokenizers deal with one type of data (e.g., containers, flow, text).
21505 * The parser is the object dealing with it all.
21506 * `initialize` works like other constructs, except that only its `tokenize`
21507 * function is used, in which case it doesn’t receive an `ok` or `nok`.
21508 * `from` can be given to set the point before the first character, although
21509 * when further lines are indented, they must be set with `defineSkip`.
21510 *
21511 * @param {ParseContext} parser
21512 * @param {InitialConstruct} initialize
21513 * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from]
21514 * @returns {TokenizeContext}
21515 */
21516 function createTokenizer(parser, initialize, from) {
21517 /** @type {Point} */
21518 let point = Object.assign(from ? Object.assign({}, from) : {
21519 line: 1,
21520 column: 1,
21521 offset: 0
21522 }, {
21523 _index: 0,
21524 _bufferIndex: -1
21525 });
21526 /** @type {Record<string, number>} */
21527 const columnStart = {};
21528 /** @type {Array<Construct>} */
21529 const resolveAllConstructs = [];
21530 /** @type {Array<Chunk>} */
21531 let chunks = [];
21532 /** @type {Array<Token>} */
21533 let stack = [];
21534 /**
21535 * Tools used for tokenizing.
21536 *
21537 * @type {Effects}
21538 */
21539 const effects = {
21540 consume,
21541 enter,
21542 exit,
21543 attempt: constructFactory(onsuccessfulconstruct),
21544 check: constructFactory(onsuccessfulcheck),
21545 interrupt: constructFactory(onsuccessfulcheck, { interrupt: true })
21546 };
21547 /**
21548 * State and tools for resolving and serializing.
21549 *
21550 * @type {TokenizeContext}
21551 */
21552 const context = {
21553 previous: null,
21554 code: null,
21555 containerState: {},
21556 events: [],
21557 parser,
21558 sliceStream,
21559 sliceSerialize,
21560 now,
21561 defineSkip,
21562 write
21563 };
21564 /**
21565 * The state function.
21566 *
21567 * @type {State | void}
21568 */
21569 let state = initialize.tokenize.call(context, effects);
21570 if (initialize.resolveAll) resolveAllConstructs.push(initialize);
21571 return context;
21572 /** @type {TokenizeContext['write']} */
21573 function write(slice) {
21574 chunks = push(chunks, slice);
21575 main();
21576 if (chunks[chunks.length - 1] !== null) return [];
21577 addResult(initialize, 0);
21578 context.events = resolveAll(resolveAllConstructs, context.events, context);
21579 return context.events;
21580 }
21581 /** @type {TokenizeContext['sliceSerialize']} */
21582 function sliceSerialize(token, expandTabs) {
21583 return serializeChunks(sliceStream(token), expandTabs);
21584 }
21585 /** @type {TokenizeContext['sliceStream']} */
21586 function sliceStream(token) {
21587 return sliceChunks(chunks, token);
21588 }
21589 /** @type {TokenizeContext['now']} */
21590 function now() {
21591 const { line, column, offset, _index, _bufferIndex } = point;
21592 return {
21593 line,
21594 column,
21595 offset,
21596 _index,
21597 _bufferIndex
21598 };
21599 }
21600 /** @type {TokenizeContext['defineSkip']} */
21601 function defineSkip(value) {
21602 columnStart[value.line] = value.column;
21603 accountForPotentialSkip();
21604 }
21605 /**
21606 * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by
21607 * `consume`).
21608 * Here is where we walk through the chunks, which either include strings of
21609 * several characters, or numerical character codes.
21610 * The reason to do this in a loop instead of a call is so the stack can
21611 * drain.
21612 *
21613 * @returns {void}
21614 */
21615 function main() {
21616 /** @type {number} */
21617 let chunkIndex;
21618 while (point._index < chunks.length) {
21619 const chunk = chunks[point._index];
21620 if (typeof chunk === "string") {
21621 chunkIndex = point._index;
21622 if (point._bufferIndex < 0) point._bufferIndex = 0;
21623 while (point._index === chunkIndex && point._bufferIndex < chunk.length) go(chunk.charCodeAt(point._bufferIndex));
21624 } else go(chunk);
21625 }
21626 }
21627 /**
21628 * Deal with one code.
21629 *
21630 * @param {Code} code
21631 * @returns {void}
21632 */
21633 function go(code) {
21634 state = state(code);
21635 }
21636 /** @type {Effects['consume']} */
21637 function consume(code) {
21638 if (markdownLineEnding(code)) {
21639 point.line++;
21640 point.column = 1;
21641 point.offset += code === -3 ? 2 : 1;
21642 accountForPotentialSkip();
21643 } else if (code !== -1) {
21644 point.column++;
21645 point.offset++;
21646 }
21647 if (point._bufferIndex < 0) point._index++;
21648 else {
21649 point._bufferIndex++;
21650 if (point._bufferIndex === chunks[point._index].length) {
21651 point._bufferIndex = -1;
21652 point._index++;
21653 }
21654 }
21655 context.previous = code;
21656 }
21657 /** @type {Effects['enter']} */
21658 function enter(type, fields) {
21659 /** @type {Token} */
21660 const token = fields || {};
21661 token.type = type;
21662 token.start = now();
21663 context.events.push([
21664 "enter",
21665 token,
21666 context
21667 ]);
21668 stack.push(token);
21669 return token;
21670 }
21671 /** @type {Effects['exit']} */
21672 function exit(type) {
21673 const token = stack.pop();
21674 token.end = now();
21675 context.events.push([
21676 "exit",
21677 token,
21678 context
21679 ]);
21680 return token;
21681 }
21682 /**
21683 * Use results.
21684 *
21685 * @type {ReturnHandle}
21686 */
21687 function onsuccessfulconstruct(construct, info) {
21688 addResult(construct, info.from);
21689 }
21690 /**
21691 * Discard results.
21692 *
21693 * @type {ReturnHandle}
21694 */
21695 function onsuccessfulcheck(_, info) {
21696 info.restore();
21697 }
21698 /**
21699 * Factory to attempt/check/interrupt.
21700 *
21701 * @param {ReturnHandle} onreturn
21702 * @param {{interrupt?: boolean | undefined} | undefined} [fields]
21703 */
21704 function constructFactory(onreturn, fields) {
21705 return hook;
21706 /**
21707 * Handle either an object mapping codes to constructs, a list of
21708 * constructs, or a single construct.
21709 *
21710 * @param {Array<Construct> | Construct | ConstructRecord} constructs
21711 * @param {State} returnState
21712 * @param {State | undefined} [bogusState]
21713 * @returns {State}
21714 */
21715 function hook(constructs, returnState, bogusState) {
21716 /** @type {Array<Construct>} */
21717 let listOfConstructs;
21718 /** @type {number} */
21719 let constructIndex;
21720 /** @type {Construct} */
21721 let currentConstruct;
21722 /** @type {Info} */
21723 let info;
21724 return Array.isArray(constructs) ? handleListOfConstructs(constructs) : "tokenize" in constructs ? handleListOfConstructs([constructs]) : handleMapOfConstructs(constructs);
21725 /**
21726 * Handle a list of construct.
21727 *
21728 * @param {ConstructRecord} map
21729 * @returns {State}
21730 */
21731 function handleMapOfConstructs(map) {
21732 return start;
21733 /** @type {State} */
21734 function start(code) {
21735 const def = code !== null && map[code];
21736 const all = code !== null && map.null;
21737 return handleListOfConstructs([...Array.isArray(def) ? def : def ? [def] : [], ...Array.isArray(all) ? all : all ? [all] : []])(code);
21738 }
21739 }
21740 /**
21741 * Handle a list of construct.
21742 *
21743 * @param {Array<Construct>} list
21744 * @returns {State}
21745 */
21746 function handleListOfConstructs(list) {
21747 listOfConstructs = list;
21748 constructIndex = 0;
21749 if (list.length === 0) return bogusState;
21750 return handleConstruct(list[constructIndex]);
21751 }
21752 /**
21753 * Handle a single construct.
21754 *
21755 * @param {Construct} construct
21756 * @returns {State}
21757 */
21758 function handleConstruct(construct) {
21759 return start;
21760 /** @type {State} */
21761 function start(code) {
21762 info = store();
21763 currentConstruct = construct;
21764 if (!construct.partial) context.currentConstruct = construct;
21765 if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) return nok(code);
21766 return construct.tokenize.call(fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);
21767 }
21768 }
21769 /** @type {State} */
21770 function ok(code) {
21771 onreturn(currentConstruct, info);
21772 return returnState;
21773 }
21774 /** @type {State} */
21775 function nok(code) {
21776 info.restore();
21777 if (++constructIndex < listOfConstructs.length) return handleConstruct(listOfConstructs[constructIndex]);
21778 return bogusState;
21779 }
21780 }
21781 }
21782 /**
21783 * @param {Construct} construct
21784 * @param {number} from
21785 * @returns {void}
21786 */
21787 function addResult(construct, from) {
21788 if (construct.resolveAll && !resolveAllConstructs.includes(construct)) resolveAllConstructs.push(construct);
21789 if (construct.resolve) splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));
21790 if (construct.resolveTo) context.events = construct.resolveTo(context.events, context);
21791 }
21792 /**
21793 * Store state.
21794 *
21795 * @returns {Info}
21796 */
21797 function store() {
21798 const startPoint = now();
21799 const startPrevious = context.previous;
21800 const startCurrentConstruct = context.currentConstruct;
21801 const startEventsIndex = context.events.length;
21802 const startStack = Array.from(stack);
21803 return {
21804 restore,
21805 from: startEventsIndex
21806 };
21807 /**
21808 * Restore state.
21809 *
21810 * @returns {void}
21811 */
21812 function restore() {
21813 point = startPoint;
21814 context.previous = startPrevious;
21815 context.currentConstruct = startCurrentConstruct;
21816 context.events.length = startEventsIndex;
21817 stack = startStack;
21818 accountForPotentialSkip();
21819 }
21820 }
21821 /**
21822 * Move the current point a bit forward in the line when it’s on a column
21823 * skip.
21824 *
21825 * @returns {void}
21826 */
21827 function accountForPotentialSkip() {
21828 if (point.line in columnStart && point.column < 2) {
21829 point.column = columnStart[point.line];
21830 point.offset += columnStart[point.line] - 1;
21831 }
21832 }
21833 }
21834 /**
21835 * Get the chunks from a slice of chunks in the range of a token.
21836 *
21837 * @param {Array<Chunk>} chunks
21838 * @param {Pick<Token, 'end' | 'start'>} token
21839 * @returns {Array<Chunk>}
21840 */
21841 function sliceChunks(chunks, token) {
21842 const startIndex = token.start._index;
21843 const startBufferIndex = token.start._bufferIndex;
21844 const endIndex = token.end._index;
21845 const endBufferIndex = token.end._bufferIndex;
21846 /** @type {Array<Chunk>} */
21847 let view;
21848 if (startIndex === endIndex) view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
21849 else {
21850 view = chunks.slice(startIndex, endIndex);
21851 if (startBufferIndex > -1) {
21852 const head = view[0];
21853 if (typeof head === "string") view[0] = head.slice(startBufferIndex);
21854 else view.shift();
21855 }
21856 if (endBufferIndex > 0) view.push(chunks[endIndex].slice(0, endBufferIndex));
21857 }
21858 return view;
21859 }
21860 /**
21861 * Get the string value of a slice of chunks.
21862 *
21863 * @param {Array<Chunk>} chunks
21864 * @param {boolean | undefined} [expandTabs=false]
21865 * @returns {string}
21866 */
21867 function serializeChunks(chunks, expandTabs) {
21868 let index = -1;
21869 /** @type {Array<string>} */
21870 const result = [];
21871 /** @type {boolean | undefined} */
21872 let atTab;
21873 while (++index < chunks.length) {
21874 const chunk = chunks[index];
21875 /** @type {string} */
21876 let value;
21877 if (typeof chunk === "string") value = chunk;
21878 else switch (chunk) {
21879 case -5:
21880 value = "\r";
21881 break;
21882 case -4:
21883 value = "\n";
21884 break;
21885 case -3:
21886 value = "\r\n";
21887 break;
21888 case -2:
21889 value = expandTabs ? " " : " ";
21890 break;
21891 case -1:
21892 if (!expandTabs && atTab) continue;
21893 value = " ";
21894 break;
21895 default: value = String.fromCharCode(chunk);
21896 }
21897 atTab = chunk === -2;
21898 result.push(value);
21899 }
21900 return result.join("");
21901 }
21902 var init_create_tokenizer = __esmMin((() => {
21903 init_micromark_util_character();
21904 init_micromark_util_chunked();
21905 init_micromark_util_resolve_all();
21906 }));
21907
21908 //#endregion
21909 //#region node_modules/micromark/lib/constructs.js
21910 var constructs_exports = /* @__PURE__ */ __exportAll({
21911 attentionMarkers: () => attentionMarkers,
21912 contentInitial: () => contentInitial,
21913 disable: () => disable,
21914 document: () => document$1,
21915 flow: () => flow,
21916 flowInitial: () => flowInitial,
21917 insideSpan: () => insideSpan,
21918 string: () => string,
21919 text: () => text$1
21920 });
21921 var document$1, contentInitial, flowInitial, flow, string, text$1, insideSpan, attentionMarkers, disable;
21922 var init_constructs = __esmMin((() => {
21923 init_micromark_core_commonmark();
21924 init_text$1();
21925 document$1 = {
21926 [42]: list$1,
21927 [43]: list$1,
21928 [45]: list$1,
21929 [48]: list$1,
21930 [49]: list$1,
21931 [50]: list$1,
21932 [51]: list$1,
21933 [52]: list$1,
21934 [53]: list$1,
21935 [54]: list$1,
21936 [55]: list$1,
21937 [56]: list$1,
21938 [57]: list$1,
21939 [62]: blockQuote
21940 };
21941 contentInitial = { [91]: definition };
21942 flowInitial = {
21943 [-2]: codeIndented,
21944 [-1]: codeIndented,
21945 [32]: codeIndented
21946 };
21947 flow = {
21948 [35]: headingAtx,
21949 [42]: thematicBreak$1,
21950 [45]: [setextUnderline, thematicBreak$1],
21951 [60]: htmlFlow,
21952 [61]: setextUnderline,
21953 [95]: thematicBreak$1,
21954 [96]: codeFenced,
21955 [126]: codeFenced
21956 };
21957 string = {
21958 [38]: characterReference,
21959 [92]: characterEscape
21960 };
21961 text$1 = {
21962 [-5]: lineEnding,
21963 [-4]: lineEnding,
21964 [-3]: lineEnding,
21965 [33]: labelStartImage,
21966 [38]: characterReference,
21967 [42]: attention,
21968 [60]: [autolink, htmlText],
21969 [91]: labelStartLink,
21970 [92]: [hardBreakEscape, characterEscape],
21971 [93]: labelEnd,
21972 [95]: attention,
21973 [96]: codeText
21974 };
21975 insideSpan = { null: [attention, resolver] };
21976 attentionMarkers = { null: [42, 95] };
21977 disable = { null: [] };
21978 }));
21979
21980 //#endregion
21981 //#region node_modules/micromark/lib/parse.js
21982 /**
21983 * @param {ParseOptions | null | undefined} [options]
21984 * @returns {ParseContext}
21985 */
21986 function parse(options) {
21987 /** @type {ParseContext} */
21988 const parser = {
21989 defined: [],
21990 lazy: {},
21991 constructs: combineExtensions([constructs_exports, ...(options || {}).extensions || []]),
21992 content: create(content$1),
21993 document: create(document$2),
21994 flow: create(flow$1),
21995 string: create(string$1),
21996 text: create(text$2)
21997 };
21998 return parser;
21999 /**
22000 * @param {InitialConstruct} initial
22001 */
22002 function create(initial) {
22003 return creator;
22004 /** @type {Create} */
22005 function creator(from) {
22006 return createTokenizer(parser, initial, from);
22007 }
22008 }
22009 }
22010 var init_parse = __esmMin((() => {
22011 init_micromark_util_combine_extensions();
22012 init_content$1();
22013 init_document();
22014 init_flow();
22015 init_text$1();
22016 init_create_tokenizer();
22017 init_constructs();
22018 }));
22019
22020 //#endregion
22021 //#region node_modules/micromark/lib/preprocess.js
22022 /**
22023 * @returns {Preprocessor}
22024 */
22025 function preprocess() {
22026 let column = 1;
22027 let buffer = "";
22028 /** @type {boolean | undefined} */
22029 let start = true;
22030 /** @type {boolean | undefined} */
22031 let atCarriageReturn;
22032 return preprocessor;
22033 /** @type {Preprocessor} */
22034 function preprocessor(value, encoding, end) {
22035 /** @type {Array<Chunk>} */
22036 const chunks = [];
22037 /** @type {RegExpMatchArray | null} */
22038 let match;
22039 /** @type {number} */
22040 let next;
22041 /** @type {number} */
22042 let startPosition;
22043 /** @type {number} */
22044 let endPosition;
22045 /** @type {Code} */
22046 let code;
22047 value = buffer + value.toString(encoding);
22048 startPosition = 0;
22049 buffer = "";
22050 if (start) {
22051 if (value.charCodeAt(0) === 65279) startPosition++;
22052 start = void 0;
22053 }
22054 while (startPosition < value.length) {
22055 search.lastIndex = startPosition;
22056 match = search.exec(value);
22057 endPosition = match && match.index !== void 0 ? match.index : value.length;
22058 code = value.charCodeAt(endPosition);
22059 if (!match) {
22060 buffer = value.slice(startPosition);
22061 break;
22062 }
22063 if (code === 10 && startPosition === endPosition && atCarriageReturn) {
22064 chunks.push(-3);
22065 atCarriageReturn = void 0;
22066 } else {
22067 if (atCarriageReturn) {
22068 chunks.push(-5);
22069 atCarriageReturn = void 0;
22070 }
22071 if (startPosition < endPosition) {
22072 chunks.push(value.slice(startPosition, endPosition));
22073 column += endPosition - startPosition;
22074 }
22075 switch (code) {
22076 case 0:
22077 chunks.push(65533);
22078 column++;
22079 break;
22080 case 9:
22081 next = Math.ceil(column / 4) * 4;
22082 chunks.push(-2);
22083 while (column++ < next) chunks.push(-1);
22084 break;
22085 case 10:
22086 chunks.push(-4);
22087 column = 1;
22088 break;
22089 default:
22090 atCarriageReturn = true;
22091 column = 1;
22092 }
22093 }
22094 startPosition = endPosition + 1;
22095 }
22096 if (end) {
22097 if (atCarriageReturn) chunks.push(-5);
22098 if (buffer) chunks.push(buffer);
22099 chunks.push(null);
22100 }
22101 return chunks;
22102 }
22103 }
22104 var search;
22105 var init_preprocess = __esmMin((() => {
22106 search = /[\0\t\n\r]/g;
22107 }));
22108
22109 //#endregion
22110 //#region node_modules/micromark/lib/postprocess.js
22111 /**
22112 * @param {Array<Event>} events
22113 * @returns {Array<Event>}
22114 */
22115 function postprocess(events) {
22116 while (!subtokenize(events));
22117 return events;
22118 }
22119 var init_postprocess = __esmMin((() => {
22120 init_micromark_util_subtokenize();
22121 }));
22122
22123 //#endregion
22124 //#region node_modules/micromark-util-decode-numeric-character-reference/index.js
22125 /**
22126 * Turn the number (in string form as either hexa- or plain decimal) coming from
22127 * a numeric character reference into a character.
22128 *
22129 * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes
22130 * non-characters and control characters safe.
22131 *
22132 * @param {string} value
22133 * Value to decode.
22134 * @param {number} base
22135 * Numeric base.
22136 * @returns {string}
22137 * Character.
22138 */
22139 function decodeNumericCharacterReference(value, base) {
22140 const code = Number.parseInt(value, base);
22141 if (code < 9 || code === 11 || code > 13 && code < 32 || code > 126 && code < 160 || code > 55295 && code < 57344 || code > 64975 && code < 65008 || (code & 65535) === 65535 || (code & 65535) === 65534 || code > 1114111) return "�";
22142 return String.fromCharCode(code);
22143 }
22144 var init_micromark_util_decode_numeric_character_reference = __esmMin((() => {}));
22145
22146 //#endregion
22147 //#region node_modules/micromark-util-decode-string/index.js
22148 /**
22149 * Decode markdown strings (which occur in places such as fenced code info
22150 * strings, destinations, labels, and titles).
22151 *
22152 * The “string” content type allows character escapes and -references.
22153 * This decodes those.
22154 *
22155 * @param {string} value
22156 * Value to decode.
22157 * @returns {string}
22158 * Decoded value.
22159 */
22160 function decodeString(value) {
22161 return value.replace(characterEscapeOrReference, decode);
22162 }
22163 /**
22164 * @param {string} $0
22165 * @param {string} $1
22166 * @param {string} $2
22167 * @returns {string}
22168 */
22169 function decode($0, $1, $2) {
22170 if ($1) return $1;
22171 if ($2.charCodeAt(0) === 35) {
22172 const head = $2.charCodeAt(1);
22173 const hex = head === 120 || head === 88;
22174 return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);
22175 }
22176 return decodeNamedCharacterReference($2) || $0;
22177 }
22178 var characterEscapeOrReference;
22179 var init_micromark_util_decode_string = __esmMin((() => {
22180 init_index_dom();
22181 init_micromark_util_decode_numeric_character_reference();
22182 characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
22183 }));
22184
22185 //#endregion
22186 //#region node_modules/mdast-util-from-markdown/lib/index.js
22187 /**
22188 * Note this compiler only understand complete buffering, not streaming.
22189 *
22190 * @param {Options | null | undefined} [options]
22191 */
22192 function compiler(options) {
22193 /** @type {Config} */
22194 const config = {
22195 transforms: [],
22196 canContainEols: [
22197 "emphasis",
22198 "fragment",
22199 "heading",
22200 "paragraph",
22201 "strong"
22202 ],
22203 enter: {
22204 autolink: opener(link),
22205 autolinkProtocol: onenterdata,
22206 autolinkEmail: onenterdata,
22207 atxHeading: opener(heading),
22208 blockQuote: opener(blockQuote),
22209 characterEscape: onenterdata,
22210 characterReference: onenterdata,
22211 codeFenced: opener(codeFlow),
22212 codeFencedFenceInfo: buffer,
22213 codeFencedFenceMeta: buffer,
22214 codeIndented: opener(codeFlow, buffer),
22215 codeText: opener(codeText, buffer),
22216 codeTextData: onenterdata,
22217 data: onenterdata,
22218 codeFlowValue: onenterdata,
22219 definition: opener(definition),
22220 definitionDestinationString: buffer,
22221 definitionLabelString: buffer,
22222 definitionTitleString: buffer,
22223 emphasis: opener(emphasis),
22224 hardBreakEscape: opener(hardBreak),
22225 hardBreakTrailing: opener(hardBreak),
22226 htmlFlow: opener(html, buffer),
22227 htmlFlowData: onenterdata,
22228 htmlText: opener(html, buffer),
22229 htmlTextData: onenterdata,
22230 image: opener(image),
22231 label: buffer,
22232 link: opener(link),
22233 listItem: opener(listItem),
22234 listItemValue: onenterlistitemvalue,
22235 listOrdered: opener(list, onenterlistordered),
22236 listUnordered: opener(list),
22237 paragraph: opener(paragraph),
22238 reference: onenterreference,
22239 referenceString: buffer,
22240 resourceDestinationString: buffer,
22241 resourceTitleString: buffer,
22242 setextHeading: opener(heading),
22243 strong: opener(strong),
22244 thematicBreak: opener(thematicBreak)
22245 },
22246 exit: {
22247 atxHeading: closer(),
22248 atxHeadingSequence: onexitatxheadingsequence,
22249 autolink: closer(),
22250 autolinkEmail: onexitautolinkemail,
22251 autolinkProtocol: onexitautolinkprotocol,
22252 blockQuote: closer(),
22253 characterEscapeValue: onexitdata,
22254 characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
22255 characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
22256 characterReferenceValue: onexitcharacterreferencevalue,
22257 codeFenced: closer(onexitcodefenced),
22258 codeFencedFence: onexitcodefencedfence,
22259 codeFencedFenceInfo: onexitcodefencedfenceinfo,
22260 codeFencedFenceMeta: onexitcodefencedfencemeta,
22261 codeFlowValue: onexitdata,
22262 codeIndented: closer(onexitcodeindented),
22263 codeText: closer(onexitcodetext),
22264 codeTextData: onexitdata,
22265 data: onexitdata,
22266 definition: closer(),
22267 definitionDestinationString: onexitdefinitiondestinationstring,
22268 definitionLabelString: onexitdefinitionlabelstring,
22269 definitionTitleString: onexitdefinitiontitlestring,
22270 emphasis: closer(),
22271 hardBreakEscape: closer(onexithardbreak),
22272 hardBreakTrailing: closer(onexithardbreak),
22273 htmlFlow: closer(onexithtmlflow),
22274 htmlFlowData: onexitdata,
22275 htmlText: closer(onexithtmltext),
22276 htmlTextData: onexitdata,
22277 image: closer(onexitimage),
22278 label: onexitlabel,
22279 labelText: onexitlabeltext,
22280 lineEnding: onexitlineending,
22281 link: closer(onexitlink),
22282 listItem: closer(),
22283 listOrdered: closer(),
22284 listUnordered: closer(),
22285 paragraph: closer(),
22286 referenceString: onexitreferencestring,
22287 resourceDestinationString: onexitresourcedestinationstring,
22288 resourceTitleString: onexitresourcetitlestring,
22289 resource: onexitresource,
22290 setextHeading: closer(onexitsetextheading),
22291 setextHeadingLineSequence: onexitsetextheadinglinesequence,
22292 setextHeadingText: onexitsetextheadingtext,
22293 strong: closer(),
22294 thematicBreak: closer()
22295 }
22296 };
22297 configure(config, (options || {}).mdastExtensions || []);
22298 /** @type {CompileData} */
22299 const data = {};
22300 return compile;
22301 /**
22302 * Turn micromark events into an mdast tree.
22303 *
22304 * @param {Array<Event>} events
22305 * Events.
22306 * @returns {Root}
22307 * mdast tree.
22308 */
22309 function compile(events) {
22310 /** @type {Root} */
22311 let tree = {
22312 type: "root",
22313 children: []
22314 };
22315 /** @type {Omit<CompileContext, 'sliceSerialize'>} */
22316 const context = {
22317 stack: [tree],
22318 tokenStack: [],
22319 config,
22320 enter,
22321 exit,
22322 buffer,
22323 resume,
22324 setData,
22325 getData
22326 };
22327 /** @type {Array<number>} */
22328 const listStack = [];
22329 let index = -1;
22330 while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") if (events[index][0] === "enter") listStack.push(index);
22331 else index = prepareList(events, listStack.pop(), index);
22332 index = -1;
22333 while (++index < events.length) {
22334 const handler = config[events[index][0]];
22335 if (own$5.call(handler, events[index][1].type)) handler[events[index][1].type].call(Object.assign({ sliceSerialize: events[index][2].sliceSerialize }, context), events[index][1]);
22336 }
22337 if (context.tokenStack.length > 0) {
22338 const tail = context.tokenStack[context.tokenStack.length - 1];
22339 (tail[1] || defaultOnError).call(context, void 0, tail[0]);
22340 }
22341 tree.position = {
22342 start: point$1(events.length > 0 ? events[0][1].start : {
22343 line: 1,
22344 column: 1,
22345 offset: 0
22346 }),
22347 end: point$1(events.length > 0 ? events[events.length - 2][1].end : {
22348 line: 1,
22349 column: 1,
22350 offset: 0
22351 })
22352 };
22353 index = -1;
22354 while (++index < config.transforms.length) tree = config.transforms[index](tree) || tree;
22355 return tree;
22356 }
22357 /**
22358 * @param {Array<Event>} events
22359 * @param {number} start
22360 * @param {number} length
22361 * @returns {number}
22362 */
22363 function prepareList(events, start, length) {
22364 let index = start - 1;
22365 let containerBalance = -1;
22366 let listSpread = false;
22367 /** @type {Token | undefined} */
22368 let listItem;
22369 /** @type {number | undefined} */
22370 let lineIndex;
22371 /** @type {number | undefined} */
22372 let firstBlankLineIndex;
22373 /** @type {boolean | undefined} */
22374 let atMarker;
22375 while (++index <= length) {
22376 const event = events[index];
22377 if (event[1].type === "listUnordered" || event[1].type === "listOrdered" || event[1].type === "blockQuote") {
22378 if (event[0] === "enter") containerBalance++;
22379 else containerBalance--;
22380 atMarker = void 0;
22381 } else if (event[1].type === "lineEndingBlank") {
22382 if (event[0] === "enter") {
22383 if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) firstBlankLineIndex = index;
22384 atMarker = void 0;
22385 }
22386 } else if (event[1].type === "linePrefix" || event[1].type === "listItemValue" || event[1].type === "listItemMarker" || event[1].type === "listItemPrefix" || event[1].type === "listItemPrefixWhitespace") {} else atMarker = void 0;
22387 if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
22388 if (listItem) {
22389 let tailIndex = index;
22390 lineIndex = void 0;
22391 while (tailIndex--) {
22392 const tailEvent = events[tailIndex];
22393 if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
22394 if (tailEvent[0] === "exit") continue;
22395 if (lineIndex) {
22396 events[lineIndex][1].type = "lineEndingBlank";
22397 listSpread = true;
22398 }
22399 tailEvent[1].type = "lineEnding";
22400 lineIndex = tailIndex;
22401 } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") {} else break;
22402 }
22403 if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) listItem._spread = true;
22404 listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
22405 events.splice(lineIndex || index, 0, [
22406 "exit",
22407 listItem,
22408 event[2]
22409 ]);
22410 index++;
22411 length++;
22412 }
22413 if (event[1].type === "listItemPrefix") {
22414 listItem = {
22415 type: "listItem",
22416 _spread: false,
22417 start: Object.assign({}, event[1].start),
22418 end: void 0
22419 };
22420 events.splice(index, 0, [
22421 "enter",
22422 listItem,
22423 event[2]
22424 ]);
22425 index++;
22426 length++;
22427 firstBlankLineIndex = void 0;
22428 atMarker = true;
22429 }
22430 }
22431 }
22432 events[start][1]._spread = listSpread;
22433 return length;
22434 }
22435 /**
22436 * Set data.
22437 *
22438 * @template {keyof CompileData} Key
22439 * Field type.
22440 * @param {Key} key
22441 * Key of field.
22442 * @param {CompileData[Key]} [value]
22443 * New value.
22444 * @returns {void}
22445 * Nothing.
22446 */
22447 function setData(key, value) {
22448 data[key] = value;
22449 }
22450 /**
22451 * Get data.
22452 *
22453 * @template {keyof CompileData} Key
22454 * Field type.
22455 * @param {Key} key
22456 * Key of field.
22457 * @returns {CompileData[Key]}
22458 * Value.
22459 */
22460 function getData(key) {
22461 return data[key];
22462 }
22463 /**
22464 * Create an opener handle.
22465 *
22466 * @param {(token: Token) => Node} create
22467 * Create a node.
22468 * @param {Handle} [and]
22469 * Optional function to also run.
22470 * @returns {Handle}
22471 * Handle.
22472 */
22473 function opener(create, and) {
22474 return open;
22475 /**
22476 * @this {CompileContext}
22477 * @param {Token} token
22478 * @returns {void}
22479 */
22480 function open(token) {
22481 enter.call(this, create(token), token);
22482 if (and) and.call(this, token);
22483 }
22484 }
22485 /**
22486 * @this {CompileContext}
22487 * @returns {void}
22488 */
22489 function buffer() {
22490 this.stack.push({
22491 type: "fragment",
22492 children: []
22493 });
22494 }
22495 /**
22496 * @template {Node} Kind
22497 * Node type.
22498 * @this {CompileContext}
22499 * Context.
22500 * @param {Kind} node
22501 * Node to enter.
22502 * @param {Token} token
22503 * Corresponding token.
22504 * @param {OnEnterError | undefined} [errorHandler]
22505 * Handle the case where this token is open, but it is closed by something else.
22506 * @returns {Kind}
22507 * The given node.
22508 */
22509 function enter(node, token, errorHandler) {
22510 this.stack[this.stack.length - 1].children.push(node);
22511 this.stack.push(node);
22512 this.tokenStack.push([token, errorHandler]);
22513 node.position = { start: point$1(token.start) };
22514 return node;
22515 }
22516 /**
22517 * Create a closer handle.
22518 *
22519 * @param {Handle} [and]
22520 * Optional function to also run.
22521 * @returns {Handle}
22522 * Handle.
22523 */
22524 function closer(and) {
22525 return close;
22526 /**
22527 * @this {CompileContext}
22528 * @param {Token} token
22529 * @returns {void}
22530 */
22531 function close(token) {
22532 if (and) and.call(this, token);
22533 exit.call(this, token);
22534 }
22535 }
22536 /**
22537 * @this {CompileContext}
22538 * Context.
22539 * @param {Token} token
22540 * Corresponding token.
22541 * @param {OnExitError | undefined} [onExitError]
22542 * Handle the case where another token is open.
22543 * @returns {Node}
22544 * The closed node.
22545 */
22546 function exit(token, onExitError) {
22547 const node = this.stack.pop();
22548 const open = this.tokenStack.pop();
22549 if (!open) throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({
22550 start: token.start,
22551 end: token.end
22552 }) + "): it’s not open");
22553 else if (open[0].type !== token.type) if (onExitError) onExitError.call(this, token, open[0]);
22554 else (open[1] || defaultOnError).call(this, token, open[0]);
22555 node.position.end = point$1(token.end);
22556 return node;
22557 }
22558 /**
22559 * @this {CompileContext}
22560 * @returns {string}
22561 */
22562 function resume() {
22563 return toString(this.stack.pop());
22564 }
22565 /**
22566 * @this {CompileContext}
22567 * @type {Handle}
22568 */
22569 function onenterlistordered() {
22570 setData("expectingFirstListItemValue", true);
22571 }
22572 /**
22573 * @this {CompileContext}
22574 * @type {Handle}
22575 */
22576 function onenterlistitemvalue(token) {
22577 if (getData("expectingFirstListItemValue")) {
22578 const ancestor = this.stack[this.stack.length - 2];
22579 ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);
22580 setData("expectingFirstListItemValue");
22581 }
22582 }
22583 /**
22584 * @this {CompileContext}
22585 * @type {Handle}
22586 */
22587 function onexitcodefencedfenceinfo() {
22588 const data = this.resume();
22589 const node = this.stack[this.stack.length - 1];
22590 node.lang = data;
22591 }
22592 /**
22593 * @this {CompileContext}
22594 * @type {Handle}
22595 */
22596 function onexitcodefencedfencemeta() {
22597 const data = this.resume();
22598 const node = this.stack[this.stack.length - 1];
22599 node.meta = data;
22600 }
22601 /**
22602 * @this {CompileContext}
22603 * @type {Handle}
22604 */
22605 function onexitcodefencedfence() {
22606 if (getData("flowCodeInside")) return;
22607 this.buffer();
22608 setData("flowCodeInside", true);
22609 }
22610 /**
22611 * @this {CompileContext}
22612 * @type {Handle}
22613 */
22614 function onexitcodefenced() {
22615 const data = this.resume();
22616 const node = this.stack[this.stack.length - 1];
22617 node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
22618 setData("flowCodeInside");
22619 }
22620 /**
22621 * @this {CompileContext}
22622 * @type {Handle}
22623 */
22624 function onexitcodeindented() {
22625 const data = this.resume();
22626 const node = this.stack[this.stack.length - 1];
22627 node.value = data.replace(/(\r?\n|\r)$/g, "");
22628 }
22629 /**
22630 * @this {CompileContext}
22631 * @type {Handle}
22632 */
22633 function onexitdefinitionlabelstring(token) {
22634 const label = this.resume();
22635 const node = this.stack[this.stack.length - 1];
22636 node.label = label;
22637 node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
22638 }
22639 /**
22640 * @this {CompileContext}
22641 * @type {Handle}
22642 */
22643 function onexitdefinitiontitlestring() {
22644 const data = this.resume();
22645 const node = this.stack[this.stack.length - 1];
22646 node.title = data;
22647 }
22648 /**
22649 * @this {CompileContext}
22650 * @type {Handle}
22651 */
22652 function onexitdefinitiondestinationstring() {
22653 const data = this.resume();
22654 const node = this.stack[this.stack.length - 1];
22655 node.url = data;
22656 }
22657 /**
22658 * @this {CompileContext}
22659 * @type {Handle}
22660 */
22661 function onexitatxheadingsequence(token) {
22662 const node = this.stack[this.stack.length - 1];
22663 if (!node.depth) node.depth = this.sliceSerialize(token).length;
22664 }
22665 /**
22666 * @this {CompileContext}
22667 * @type {Handle}
22668 */
22669 function onexitsetextheadingtext() {
22670 setData("setextHeadingSlurpLineEnding", true);
22671 }
22672 /**
22673 * @this {CompileContext}
22674 * @type {Handle}
22675 */
22676 function onexitsetextheadinglinesequence(token) {
22677 const node = this.stack[this.stack.length - 1];
22678 node.depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2;
22679 }
22680 /**
22681 * @this {CompileContext}
22682 * @type {Handle}
22683 */
22684 function onexitsetextheading() {
22685 setData("setextHeadingSlurpLineEnding");
22686 }
22687 /**
22688 * @this {CompileContext}
22689 * @type {Handle}
22690 */
22691 function onenterdata(token) {
22692 const node = this.stack[this.stack.length - 1];
22693 let tail = node.children[node.children.length - 1];
22694 if (!tail || tail.type !== "text") {
22695 tail = text();
22696 tail.position = { start: point$1(token.start) };
22697 node.children.push(tail);
22698 }
22699 this.stack.push(tail);
22700 }
22701 /**
22702 * @this {CompileContext}
22703 * @type {Handle}
22704 */
22705 function onexitdata(token) {
22706 const tail = this.stack.pop();
22707 tail.value += this.sliceSerialize(token);
22708 tail.position.end = point$1(token.end);
22709 }
22710 /**
22711 * @this {CompileContext}
22712 * @type {Handle}
22713 */
22714 function onexitlineending(token) {
22715 const context = this.stack[this.stack.length - 1];
22716 if (getData("atHardBreak")) {
22717 const tail = context.children[context.children.length - 1];
22718 tail.position.end = point$1(token.end);
22719 setData("atHardBreak");
22720 return;
22721 }
22722 if (!getData("setextHeadingSlurpLineEnding") && config.canContainEols.includes(context.type)) {
22723 onenterdata.call(this, token);
22724 onexitdata.call(this, token);
22725 }
22726 }
22727 /**
22728 * @this {CompileContext}
22729 * @type {Handle}
22730 */
22731 function onexithardbreak() {
22732 setData("atHardBreak", true);
22733 }
22734 /**
22735 * @this {CompileContext}
22736 * @type {Handle}
22737 */
22738 function onexithtmlflow() {
22739 const data = this.resume();
22740 const node = this.stack[this.stack.length - 1];
22741 node.value = data;
22742 }
22743 /**
22744 * @this {CompileContext}
22745 * @type {Handle}
22746 */
22747 function onexithtmltext() {
22748 const data = this.resume();
22749 const node = this.stack[this.stack.length - 1];
22750 node.value = data;
22751 }
22752 /**
22753 * @this {CompileContext}
22754 * @type {Handle}
22755 */
22756 function onexitcodetext() {
22757 const data = this.resume();
22758 const node = this.stack[this.stack.length - 1];
22759 node.value = data;
22760 }
22761 /**
22762 * @this {CompileContext}
22763 * @type {Handle}
22764 */
22765 function onexitlink() {
22766 const node = this.stack[this.stack.length - 1];
22767 if (getData("inReference")) {
22768 /** @type {ReferenceType} */
22769 const referenceType = getData("referenceType") || "shortcut";
22770 node.type += "Reference";
22771 node.referenceType = referenceType;
22772 delete node.url;
22773 delete node.title;
22774 } else {
22775 delete node.identifier;
22776 delete node.label;
22777 }
22778 setData("referenceType");
22779 }
22780 /**
22781 * @this {CompileContext}
22782 * @type {Handle}
22783 */
22784 function onexitimage() {
22785 const node = this.stack[this.stack.length - 1];
22786 if (getData("inReference")) {
22787 /** @type {ReferenceType} */
22788 const referenceType = getData("referenceType") || "shortcut";
22789 node.type += "Reference";
22790 node.referenceType = referenceType;
22791 delete node.url;
22792 delete node.title;
22793 } else {
22794 delete node.identifier;
22795 delete node.label;
22796 }
22797 setData("referenceType");
22798 }
22799 /**
22800 * @this {CompileContext}
22801 * @type {Handle}
22802 */
22803 function onexitlabeltext(token) {
22804 const string = this.sliceSerialize(token);
22805 const ancestor = this.stack[this.stack.length - 2];
22806 ancestor.label = decodeString(string);
22807 ancestor.identifier = normalizeIdentifier(string).toLowerCase();
22808 }
22809 /**
22810 * @this {CompileContext}
22811 * @type {Handle}
22812 */
22813 function onexitlabel() {
22814 const fragment = this.stack[this.stack.length - 1];
22815 const value = this.resume();
22816 const node = this.stack[this.stack.length - 1];
22817 setData("inReference", true);
22818 if (node.type === "link") node.children = fragment.children;
22819 else node.alt = value;
22820 }
22821 /**
22822 * @this {CompileContext}
22823 * @type {Handle}
22824 */
22825 function onexitresourcedestinationstring() {
22826 const data = this.resume();
22827 const node = this.stack[this.stack.length - 1];
22828 node.url = data;
22829 }
22830 /**
22831 * @this {CompileContext}
22832 * @type {Handle}
22833 */
22834 function onexitresourcetitlestring() {
22835 const data = this.resume();
22836 const node = this.stack[this.stack.length - 1];
22837 node.title = data;
22838 }
22839 /**
22840 * @this {CompileContext}
22841 * @type {Handle}
22842 */
22843 function onexitresource() {
22844 setData("inReference");
22845 }
22846 /**
22847 * @this {CompileContext}
22848 * @type {Handle}
22849 */
22850 function onenterreference() {
22851 setData("referenceType", "collapsed");
22852 }
22853 /**
22854 * @this {CompileContext}
22855 * @type {Handle}
22856 */
22857 function onexitreferencestring(token) {
22858 const label = this.resume();
22859 const node = this.stack[this.stack.length - 1];
22860 node.label = label;
22861 node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
22862 setData("referenceType", "full");
22863 }
22864 /**
22865 * @this {CompileContext}
22866 * @type {Handle}
22867 */
22868 function onexitcharacterreferencemarker(token) {
22869 setData("characterReferenceType", token.type);
22870 }
22871 /**
22872 * @this {CompileContext}
22873 * @type {Handle}
22874 */
22875 function onexitcharacterreferencevalue(token) {
22876 const data = this.sliceSerialize(token);
22877 const type = getData("characterReferenceType");
22878 /** @type {string} */
22879 let value;
22880 if (type) {
22881 value = decodeNumericCharacterReference(data, type === "characterReferenceMarkerNumeric" ? 10 : 16);
22882 setData("characterReferenceType");
22883 } else value = decodeNamedCharacterReference(data);
22884 const tail = this.stack.pop();
22885 tail.value += value;
22886 tail.position.end = point$1(token.end);
22887 }
22888 /**
22889 * @this {CompileContext}
22890 * @type {Handle}
22891 */
22892 function onexitautolinkprotocol(token) {
22893 onexitdata.call(this, token);
22894 const node = this.stack[this.stack.length - 1];
22895 node.url = this.sliceSerialize(token);
22896 }
22897 /**
22898 * @this {CompileContext}
22899 * @type {Handle}
22900 */
22901 function onexitautolinkemail(token) {
22902 onexitdata.call(this, token);
22903 const node = this.stack[this.stack.length - 1];
22904 node.url = "mailto:" + this.sliceSerialize(token);
22905 }
22906 /** @returns {Blockquote} */
22907 function blockQuote() {
22908 return {
22909 type: "blockquote",
22910 children: []
22911 };
22912 }
22913 /** @returns {Code} */
22914 function codeFlow() {
22915 return {
22916 type: "code",
22917 lang: null,
22918 meta: null,
22919 value: ""
22920 };
22921 }
22922 /** @returns {InlineCode} */
22923 function codeText() {
22924 return {
22925 type: "inlineCode",
22926 value: ""
22927 };
22928 }
22929 /** @returns {Definition} */
22930 function definition() {
22931 return {
22932 type: "definition",
22933 identifier: "",
22934 label: null,
22935 title: null,
22936 url: ""
22937 };
22938 }
22939 /** @returns {Emphasis} */
22940 function emphasis() {
22941 return {
22942 type: "emphasis",
22943 children: []
22944 };
22945 }
22946 /** @returns {Heading} */
22947 function heading() {
22948 return {
22949 type: "heading",
22950 depth: void 0,
22951 children: []
22952 };
22953 }
22954 /** @returns {Break} */
22955 function hardBreak() {
22956 return { type: "break" };
22957 }
22958 /** @returns {HTML} */
22959 function html() {
22960 return {
22961 type: "html",
22962 value: ""
22963 };
22964 }
22965 /** @returns {Image} */
22966 function image() {
22967 return {
22968 type: "image",
22969 title: null,
22970 url: "",
22971 alt: null
22972 };
22973 }
22974 /** @returns {Link} */
22975 function link() {
22976 return {
22977 type: "link",
22978 title: null,
22979 url: "",
22980 children: []
22981 };
22982 }
22983 /**
22984 * @param {Token} token
22985 * @returns {List}
22986 */
22987 function list(token) {
22988 return {
22989 type: "list",
22990 ordered: token.type === "listOrdered",
22991 start: null,
22992 spread: token._spread,
22993 children: []
22994 };
22995 }
22996 /**
22997 * @param {Token} token
22998 * @returns {ListItem}
22999 */
23000 function listItem(token) {
23001 return {
23002 type: "listItem",
23003 spread: token._spread,
23004 checked: null,
23005 children: []
23006 };
23007 }
23008 /** @returns {Paragraph} */
23009 function paragraph() {
23010 return {
23011 type: "paragraph",
23012 children: []
23013 };
23014 }
23015 /** @returns {Strong} */
23016 function strong() {
23017 return {
23018 type: "strong",
23019 children: []
23020 };
23021 }
23022 /** @returns {Text} */
23023 function text() {
23024 return {
23025 type: "text",
23026 value: ""
23027 };
23028 }
23029 /** @returns {ThematicBreak} */
23030 function thematicBreak() {
23031 return { type: "thematicBreak" };
23032 }
23033 }
23034 /**
23035 * Copy a point-like value.
23036 *
23037 * @param {Point} d
23038 * Point-like value.
23039 * @returns {Point}
23040 * unist point.
23041 */
23042 function point$1(d) {
23043 return {
23044 line: d.line,
23045 column: d.column,
23046 offset: d.offset
23047 };
23048 }
23049 /**
23050 * @param {Config} combined
23051 * @param {Array<Extension | Array<Extension>>} extensions
23052 * @returns {void}
23053 */
23054 function configure(combined, extensions) {
23055 let index = -1;
23056 while (++index < extensions.length) {
23057 const value = extensions[index];
23058 if (Array.isArray(value)) configure(combined, value);
23059 else extension(combined, value);
23060 }
23061 }
23062 /**
23063 * @param {Config} combined
23064 * @param {Extension} extension
23065 * @returns {void}
23066 */
23067 function extension(combined, extension) {
23068 /** @type {keyof Extension} */
23069 let key;
23070 for (key in extension) if (own$5.call(extension, key)) {
23071 if (key === "canContainEols") {
23072 const right = extension[key];
23073 if (right) combined[key].push(...right);
23074 } else if (key === "transforms") {
23075 const right = extension[key];
23076 if (right) combined[key].push(...right);
23077 } else if (key === "enter" || key === "exit") {
23078 const right = extension[key];
23079 if (right) Object.assign(combined[key], right);
23080 }
23081 }
23082 }
23083 /** @type {OnEnterError} */
23084 function defaultOnError(left, right) {
23085 if (left) throw new Error("Cannot close `" + left.type + "` (" + stringifyPosition({
23086 start: left.start,
23087 end: left.end
23088 }) + "): a different token (`" + right.type + "`, " + stringifyPosition({
23089 start: right.start,
23090 end: right.end
23091 }) + ") is open");
23092 else throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({
23093 start: right.start,
23094 end: right.end
23095 }) + ") is still open");
23096 }
23097 var own$5, fromMarkdown;
23098 var init_lib$9 = __esmMin((() => {
23099 init_mdast_util_to_string();
23100 init_parse();
23101 init_preprocess();
23102 init_postprocess();
23103 init_micromark_util_decode_numeric_character_reference();
23104 init_micromark_util_decode_string();
23105 init_micromark_util_normalize_identifier();
23106 init_index_dom();
23107 init_unist_util_stringify_position();
23108 own$5 = {}.hasOwnProperty;
23109 fromMarkdown = function(value, encoding, options) {
23110 if (typeof encoding !== "string") {
23111 options = encoding;
23112 encoding = void 0;
23113 }
23114 return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));
23115 };
23116 __name(point$1, "point");
23117 }));
23118
23119 //#endregion
23120 //#region node_modules/mdast-util-from-markdown/index.js
23121 var init_mdast_util_from_markdown = __esmMin((() => {
23122 init_lib$9();
23123 }));
23124
23125 //#endregion
23126 //#region node_modules/remark-parse/lib/index.js
23127 /**
23128 * @this {import('unified').Processor}
23129 * @type {import('unified').Plugin<[Options?] | void[], string, Root>}
23130 */
23131 function remarkParse(options) {
23132 /** @type {import('unified').ParserFunction<Root>} */
23133 const parser = (doc) => {
23134 const settings = this.data("settings");
23135 return fromMarkdown(doc, Object.assign({}, settings, options, {
23136 extensions: this.data("micromarkExtensions") || [],
23137 mdastExtensions: this.data("fromMarkdownExtensions") || []
23138 }));
23139 };
23140 Object.assign(this, { Parser: parser });
23141 }
23142 var init_lib$8 = __esmMin((() => {
23143 init_mdast_util_from_markdown();
23144 }));
23145
23146 //#endregion
23147 //#region node_modules/remark-parse/index.js
23148 var init_remark_parse = __esmMin((() => {
23149 init_lib$8();
23150 }));
23151
23152 //#endregion
23153 //#region node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
23154 /**
23155 * @typedef {import('hast').Element} Element
23156 * @typedef {import('mdast').Blockquote} Blockquote
23157 * @typedef {import('../state.js').State} State
23158 */
23159 /**
23160 * Turn an mdast `blockquote` node into hast.
23161 *
23162 * @param {State} state
23163 * Info passed around.
23164 * @param {Blockquote} node
23165 * mdast node.
23166 * @returns {Element}
23167 * hast node.
23168 */
23169 function blockquote(state, node) {
23170 /** @type {Element} */
23171 const result = {
23172 type: "element",
23173 tagName: "blockquote",
23174 properties: {},
23175 children: state.wrap(state.all(node), true)
23176 };
23177 state.patch(node, result);
23178 return state.applyData(node, result);
23179 }
23180 var init_blockquote = __esmMin((() => {}));
23181
23182 //#endregion
23183 //#region node_modules/mdast-util-to-hast/lib/handlers/break.js
23184 /**
23185 * @typedef {import('hast').Element} Element
23186 * @typedef {import('hast').Text} Text
23187 * @typedef {import('mdast').Break} Break
23188 * @typedef {import('../state.js').State} State
23189 */
23190 /**
23191 * Turn an mdast `break` node into hast.
23192 *
23193 * @param {State} state
23194 * Info passed around.
23195 * @param {Break} node
23196 * mdast node.
23197 * @returns {Array<Element | Text>}
23198 * hast element content.
23199 */
23200 function hardBreak(state, node) {
23201 /** @type {Element} */
23202 const result = {
23203 type: "element",
23204 tagName: "br",
23205 properties: {},
23206 children: []
23207 };
23208 state.patch(node, result);
23209 return [state.applyData(node, result), {
23210 type: "text",
23211 value: "\n"
23212 }];
23213 }
23214 var init_break = __esmMin((() => {}));
23215
23216 //#endregion
23217 //#region node_modules/mdast-util-to-hast/lib/handlers/code.js
23218 /**
23219 * @typedef {import('hast').Element} Element
23220 * @typedef {import('hast').Properties} Properties
23221 * @typedef {import('mdast').Code} Code
23222 * @typedef {import('../state.js').State} State
23223
23224 */
23225 /**
23226 * Turn an mdast `code` node into hast.
23227 *
23228 * @param {State} state
23229 * Info passed around.
23230 * @param {Code} node
23231 * mdast node.
23232 * @returns {Element}
23233 * hast node.
23234 */
23235 function code(state, node) {
23236 const value = node.value ? node.value + "\n" : "";
23237 const lang = node.lang ? node.lang.match(/^[^ \t]+(?=[ \t]|$)/) : null;
23238 /** @type {Properties} */
23239 const properties = {};
23240 if (lang) properties.className = ["language-" + lang];
23241 /** @type {Element} */
23242 let result = {
23243 type: "element",
23244 tagName: "code",
23245 properties,
23246 children: [{
23247 type: "text",
23248 value
23249 }]
23250 };
23251 if (node.meta) result.data = { meta: node.meta };
23252 state.patch(node, result);
23253 result = state.applyData(node, result);
23254 result = {
23255 type: "element",
23256 tagName: "pre",
23257 properties: {},
23258 children: [result]
23259 };
23260 state.patch(node, result);
23261 return result;
23262 }
23263 var init_code = __esmMin((() => {}));
23264
23265 //#endregion
23266 //#region node_modules/mdast-util-to-hast/lib/handlers/delete.js
23267 /**
23268 * @typedef {import('hast').Element} Element
23269 * @typedef {import('mdast').Delete} Delete
23270 * @typedef {import('../state.js').State} State
23271
23272 */
23273 /**
23274 * Turn an mdast `delete` node into hast.
23275 *
23276 * @param {State} state
23277 * Info passed around.
23278 * @param {Delete} node
23279 * mdast node.
23280 * @returns {Element}
23281 * hast node.
23282 */
23283 function strikethrough(state, node) {
23284 /** @type {Element} */
23285 const result = {
23286 type: "element",
23287 tagName: "del",
23288 properties: {},
23289 children: state.all(node)
23290 };
23291 state.patch(node, result);
23292 return state.applyData(node, result);
23293 }
23294 var init_delete = __esmMin((() => {}));
23295
23296 //#endregion
23297 //#region node_modules/mdast-util-to-hast/lib/handlers/emphasis.js
23298 /**
23299 * @typedef {import('hast').Element} Element
23300 * @typedef {import('mdast').Emphasis} Emphasis
23301 * @typedef {import('../state.js').State} State
23302 */
23303 /**
23304 * Turn an mdast `emphasis` node into hast.
23305 *
23306 * @param {State} state
23307 * Info passed around.
23308 * @param {Emphasis} node
23309 * mdast node.
23310 * @returns {Element}
23311 * hast node.
23312 */
23313 function emphasis(state, node) {
23314 /** @type {Element} */
23315 const result = {
23316 type: "element",
23317 tagName: "em",
23318 properties: {},
23319 children: state.all(node)
23320 };
23321 state.patch(node, result);
23322 return state.applyData(node, result);
23323 }
23324 var init_emphasis = __esmMin((() => {}));
23325
23326 //#endregion
23327 //#region node_modules/micromark-util-sanitize-uri/index.js
23328 /**
23329 * Normalize a URL.
23330 *
23331 * Encode unsafe characters with percent-encoding, skipping already encoded
23332 * sequences.
23333 *
23334 * @param {string} value
23335 * URI to normalize.
23336 * @returns {string}
23337 * Normalized URI.
23338 */
23339 function normalizeUri(value) {
23340 /** @type {Array<string>} */
23341 const result = [];
23342 let index = -1;
23343 let start = 0;
23344 let skip = 0;
23345 while (++index < value.length) {
23346 const code = value.charCodeAt(index);
23347 /** @type {string} */
23348 let replace = "";
23349 if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) skip = 2;
23350 else if (code < 128) {
23351 if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) replace = String.fromCharCode(code);
23352 } else if (code > 55295 && code < 57344) {
23353 const next = value.charCodeAt(index + 1);
23354 if (code < 56320 && next > 56319 && next < 57344) {
23355 replace = String.fromCharCode(code, next);
23356 skip = 1;
23357 } else replace = "�";
23358 } else replace = String.fromCharCode(code);
23359 if (replace) {
23360 result.push(value.slice(start, index), encodeURIComponent(replace));
23361 start = index + skip + 1;
23362 replace = "";
23363 }
23364 if (skip) {
23365 index += skip;
23366 skip = 0;
23367 }
23368 }
23369 return result.join("") + value.slice(start);
23370 }
23371 var init_micromark_util_sanitize_uri = __esmMin((() => {
23372 init_micromark_util_character();
23373 }));
23374
23375 //#endregion
23376 //#region node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js
23377 /**
23378 * Turn an mdast `footnoteReference` node into hast.
23379 *
23380 * @param {State} state
23381 * Info passed around.
23382 * @param {FootnoteReference} node
23383 * mdast node.
23384 * @returns {Element}
23385 * hast node.
23386 */
23387 function footnoteReference(state, node) {
23388 const id = String(node.identifier).toUpperCase();
23389 const safeId = normalizeUri(id.toLowerCase());
23390 const index = state.footnoteOrder.indexOf(id);
23391 /** @type {number} */
23392 let counter;
23393 if (index === -1) {
23394 state.footnoteOrder.push(id);
23395 state.footnoteCounts[id] = 1;
23396 counter = state.footnoteOrder.length;
23397 } else {
23398 state.footnoteCounts[id]++;
23399 counter = index + 1;
23400 }
23401 const reuseCounter = state.footnoteCounts[id];
23402 /** @type {Element} */
23403 const link = {
23404 type: "element",
23405 tagName: "a",
23406 properties: {
23407 href: "#" + state.clobberPrefix + "fn-" + safeId,
23408 id: state.clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""),
23409 dataFootnoteRef: true,
23410 ariaDescribedBy: ["footnote-label"]
23411 },
23412 children: [{
23413 type: "text",
23414 value: String(counter)
23415 }]
23416 };
23417 state.patch(node, link);
23418 /** @type {Element} */
23419 const sup = {
23420 type: "element",
23421 tagName: "sup",
23422 properties: {},
23423 children: [link]
23424 };
23425 state.patch(node, sup);
23426 return state.applyData(node, sup);
23427 }
23428 var init_footnote_reference = __esmMin((() => {
23429 init_micromark_util_sanitize_uri();
23430 }));
23431
23432 //#endregion
23433 //#region node_modules/mdast-util-to-hast/lib/handlers/footnote.js
23434 /**
23435 * Turn an mdast `footnote` node into hast.
23436 *
23437 * @param {State} state
23438 * Info passed around.
23439 * @param {Footnote} node
23440 * mdast node.
23441 * @returns {Element}
23442 * hast node.
23443 */
23444 function footnote(state, node) {
23445 const footnoteById = state.footnoteById;
23446 let no = 1;
23447 while (no in footnoteById) no++;
23448 const identifier = String(no);
23449 footnoteById[identifier] = {
23450 type: "footnoteDefinition",
23451 identifier,
23452 children: [{
23453 type: "paragraph",
23454 children: node.children
23455 }],
23456 position: node.position
23457 };
23458 return footnoteReference(state, {
23459 type: "footnoteReference",
23460 identifier,
23461 position: node.position
23462 });
23463 }
23464 var init_footnote = __esmMin((() => {
23465 init_footnote_reference();
23466 }));
23467
23468 //#endregion
23469 //#region node_modules/mdast-util-to-hast/lib/handlers/heading.js
23470 /**
23471 * @typedef {import('hast').Element} Element
23472 * @typedef {import('mdast').Heading} Heading
23473 * @typedef {import('../state.js').State} State
23474 */
23475 /**
23476 * Turn an mdast `heading` node into hast.
23477 *
23478 * @param {State} state
23479 * Info passed around.
23480 * @param {Heading} node
23481 * mdast node.
23482 * @returns {Element}
23483 * hast node.
23484 */
23485 function heading(state, node) {
23486 /** @type {Element} */
23487 const result = {
23488 type: "element",
23489 tagName: "h" + node.depth,
23490 properties: {},
23491 children: state.all(node)
23492 };
23493 state.patch(node, result);
23494 return state.applyData(node, result);
23495 }
23496 var init_heading = __esmMin((() => {}));
23497
23498 //#endregion
23499 //#region node_modules/mdast-util-to-hast/lib/handlers/html.js
23500 /**
23501 * @typedef {import('hast').Element} Element
23502 * @typedef {import('mdast').HTML} Html
23503 * @typedef {import('../state.js').State} State
23504 * @typedef {import('../../index.js').Raw} Raw
23505 */
23506 /**
23507 * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
23508 * nothing).
23509 *
23510 * @param {State} state
23511 * Info passed around.
23512 * @param {Html} node
23513 * mdast node.
23514 * @returns {Raw | Element | null}
23515 * hast node.
23516 */
23517 function html$2(state, node) {
23518 if (state.dangerous) {
23519 /** @type {Raw} */
23520 const result = {
23521 type: "raw",
23522 value: node.value
23523 };
23524 state.patch(node, result);
23525 return state.applyData(node, result);
23526 }
23527 return null;
23528 }
23529 var init_html$1 = __esmMin((() => {
23530 __name(html$2, "html");
23531 }));
23532
23533 //#endregion
23534 //#region node_modules/mdast-util-to-hast/lib/revert.js
23535 /**
23536 * @typedef {import('hast').ElementContent} ElementContent
23537 *
23538 * @typedef {import('mdast').Content} Content
23539 * @typedef {import('mdast').Reference} Reference
23540 * @typedef {import('mdast').Root} Root
23541 *
23542 * @typedef {import('./state.js').State} State
23543 */
23544 /**
23545 * @typedef {Root | Content} Nodes
23546 * @typedef {Extract<Nodes, Reference>} References
23547 */
23548 /**
23549 * Return the content of a reference without definition as plain text.
23550 *
23551 * @param {State} state
23552 * Info passed around.
23553 * @param {References} node
23554 * Reference node (image, link).
23555 * @returns {ElementContent | Array<ElementContent>}
23556 * hast content.
23557 */
23558 function revert(state, node) {
23559 const subtype = node.referenceType;
23560 let suffix = "]";
23561 if (subtype === "collapsed") suffix += "[]";
23562 else if (subtype === "full") suffix += "[" + (node.label || node.identifier) + "]";
23563 if (node.type === "imageReference") return {
23564 type: "text",
23565 value: "![" + node.alt + suffix
23566 };
23567 const contents = state.all(node);
23568 const head = contents[0];
23569 if (head && head.type === "text") head.value = "[" + head.value;
23570 else contents.unshift({
23571 type: "text",
23572 value: "["
23573 });
23574 const tail = contents[contents.length - 1];
23575 if (tail && tail.type === "text") tail.value += suffix;
23576 else contents.push({
23577 type: "text",
23578 value: suffix
23579 });
23580 return contents;
23581 }
23582 var init_revert = __esmMin((() => {}));
23583
23584 //#endregion
23585 //#region node_modules/mdast-util-to-hast/lib/handlers/image-reference.js
23586 /**
23587 * Turn an mdast `imageReference` node into hast.
23588 *
23589 * @param {State} state
23590 * Info passed around.
23591 * @param {ImageReference} node
23592 * mdast node.
23593 * @returns {ElementContent | Array<ElementContent>}
23594 * hast node.
23595 */
23596 function imageReference(state, node) {
23597 const def = state.definition(node.identifier);
23598 if (!def) return revert(state, node);
23599 /** @type {Properties} */
23600 const properties = {
23601 src: normalizeUri(def.url || ""),
23602 alt: node.alt
23603 };
23604 if (def.title !== null && def.title !== void 0) properties.title = def.title;
23605 /** @type {Element} */
23606 const result = {
23607 type: "element",
23608 tagName: "img",
23609 properties,
23610 children: []
23611 };
23612 state.patch(node, result);
23613 return state.applyData(node, result);
23614 }
23615 var init_image_reference = __esmMin((() => {
23616 init_micromark_util_sanitize_uri();
23617 init_revert();
23618 }));
23619
23620 //#endregion
23621 //#region node_modules/mdast-util-to-hast/lib/handlers/image.js
23622 /**
23623 * Turn an mdast `image` node into hast.
23624 *
23625 * @param {State} state
23626 * Info passed around.
23627 * @param {Image} node
23628 * mdast node.
23629 * @returns {Element}
23630 * hast node.
23631 */
23632 function image(state, node) {
23633 /** @type {Properties} */
23634 const properties = { src: normalizeUri(node.url) };
23635 if (node.alt !== null && node.alt !== void 0) properties.alt = node.alt;
23636 if (node.title !== null && node.title !== void 0) properties.title = node.title;
23637 /** @type {Element} */
23638 const result = {
23639 type: "element",
23640 tagName: "img",
23641 properties,
23642 children: []
23643 };
23644 state.patch(node, result);
23645 return state.applyData(node, result);
23646 }
23647 var init_image = __esmMin((() => {
23648 init_micromark_util_sanitize_uri();
23649 }));
23650
23651 //#endregion
23652 //#region node_modules/mdast-util-to-hast/lib/handlers/inline-code.js
23653 /**
23654 * @typedef {import('hast').Element} Element
23655 * @typedef {import('hast').Text} Text
23656 * @typedef {import('mdast').InlineCode} InlineCode
23657 * @typedef {import('../state.js').State} State
23658 */
23659 /**
23660 * Turn an mdast `inlineCode` node into hast.
23661 *
23662 * @param {State} state
23663 * Info passed around.
23664 * @param {InlineCode} node
23665 * mdast node.
23666 * @returns {Element}
23667 * hast node.
23668 */
23669 function inlineCode(state, node) {
23670 /** @type {Text} */
23671 const text = {
23672 type: "text",
23673 value: node.value.replace(/\r?\n|\r/g, " ")
23674 };
23675 state.patch(node, text);
23676 /** @type {Element} */
23677 const result = {
23678 type: "element",
23679 tagName: "code",
23680 properties: {},
23681 children: [text]
23682 };
23683 state.patch(node, result);
23684 return state.applyData(node, result);
23685 }
23686 var init_inline_code = __esmMin((() => {}));
23687
23688 //#endregion
23689 //#region node_modules/mdast-util-to-hast/lib/handlers/link-reference.js
23690 /**
23691 * Turn an mdast `linkReference` node into hast.
23692 *
23693 * @param {State} state
23694 * Info passed around.
23695 * @param {LinkReference} node
23696 * mdast node.
23697 * @returns {ElementContent | Array<ElementContent>}
23698 * hast node.
23699 */
23700 function linkReference(state, node) {
23701 const def = state.definition(node.identifier);
23702 if (!def) return revert(state, node);
23703 /** @type {Properties} */
23704 const properties = { href: normalizeUri(def.url || "") };
23705 if (def.title !== null && def.title !== void 0) properties.title = def.title;
23706 /** @type {Element} */
23707 const result = {
23708 type: "element",
23709 tagName: "a",
23710 properties,
23711 children: state.all(node)
23712 };
23713 state.patch(node, result);
23714 return state.applyData(node, result);
23715 }
23716 var init_link_reference = __esmMin((() => {
23717 init_micromark_util_sanitize_uri();
23718 init_revert();
23719 }));
23720
23721 //#endregion
23722 //#region node_modules/mdast-util-to-hast/lib/handlers/link.js
23723 /**
23724 * Turn an mdast `link` node into hast.
23725 *
23726 * @param {State} state
23727 * Info passed around.
23728 * @param {Link} node
23729 * mdast node.
23730 * @returns {Element}
23731 * hast node.
23732 */
23733 function link(state, node) {
23734 /** @type {Properties} */
23735 const properties = { href: normalizeUri(node.url) };
23736 if (node.title !== null && node.title !== void 0) properties.title = node.title;
23737 /** @type {Element} */
23738 const result = {
23739 type: "element",
23740 tagName: "a",
23741 properties,
23742 children: state.all(node)
23743 };
23744 state.patch(node, result);
23745 return state.applyData(node, result);
23746 }
23747 var init_link = __esmMin((() => {
23748 init_micromark_util_sanitize_uri();
23749 }));
23750
23751 //#endregion
23752 //#region node_modules/mdast-util-to-hast/lib/handlers/list-item.js
23753 /**
23754 * @typedef {import('hast').Element} Element
23755 * @typedef {import('hast').ElementContent} ElementContent
23756 * @typedef {import('hast').Properties} Properties
23757 * @typedef {import('mdast').Content} Content
23758 * @typedef {import('mdast').ListItem} ListItem
23759 * @typedef {import('mdast').Parent} Parent
23760 * @typedef {import('mdast').Root} Root
23761 * @typedef {import('../state.js').State} State
23762 */
23763 /**
23764 * @typedef {Root | Content} Nodes
23765 * @typedef {Extract<Nodes, Parent>} Parents
23766 */
23767 /**
23768 * Turn an mdast `listItem` node into hast.
23769 *
23770 * @param {State} state
23771 * Info passed around.
23772 * @param {ListItem} node
23773 * mdast node.
23774 * @param {Parents | null | undefined} parent
23775 * Parent of `node`.
23776 * @returns {Element}
23777 * hast node.
23778 */
23779 function listItem(state, node, parent) {
23780 const results = state.all(node);
23781 const loose = parent ? listLoose(parent) : listItemLoose(node);
23782 /** @type {Properties} */
23783 const properties = {};
23784 /** @type {Array<ElementContent>} */
23785 const children = [];
23786 if (typeof node.checked === "boolean") {
23787 const head = results[0];
23788 /** @type {Element} */
23789 let paragraph;
23790 if (head && head.type === "element" && head.tagName === "p") paragraph = head;
23791 else {
23792 paragraph = {
23793 type: "element",
23794 tagName: "p",
23795 properties: {},
23796 children: []
23797 };
23798 results.unshift(paragraph);
23799 }
23800 if (paragraph.children.length > 0) paragraph.children.unshift({
23801 type: "text",
23802 value: " "
23803 });
23804 paragraph.children.unshift({
23805 type: "element",
23806 tagName: "input",
23807 properties: {
23808 type: "checkbox",
23809 checked: node.checked,
23810 disabled: true
23811 },
23812 children: []
23813 });
23814 properties.className = ["task-list-item"];
23815 }
23816 let index = -1;
23817 while (++index < results.length) {
23818 const child = results[index];
23819 if (loose || index !== 0 || child.type !== "element" || child.tagName !== "p") children.push({
23820 type: "text",
23821 value: "\n"
23822 });
23823 if (child.type === "element" && child.tagName === "p" && !loose) children.push(...child.children);
23824 else children.push(child);
23825 }
23826 const tail = results[results.length - 1];
23827 if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) children.push({
23828 type: "text",
23829 value: "\n"
23830 });
23831 /** @type {Element} */
23832 const result = {
23833 type: "element",
23834 tagName: "li",
23835 properties,
23836 children
23837 };
23838 state.patch(node, result);
23839 return state.applyData(node, result);
23840 }
23841 /**
23842 * @param {Parents} node
23843 * @return {Boolean}
23844 */
23845 function listLoose(node) {
23846 let loose = false;
23847 if (node.type === "list") {
23848 loose = node.spread || false;
23849 const children = node.children;
23850 let index = -1;
23851 while (!loose && ++index < children.length) loose = listItemLoose(children[index]);
23852 }
23853 return loose;
23854 }
23855 /**
23856 * @param {ListItem} node
23857 * @return {Boolean}
23858 */
23859 function listItemLoose(node) {
23860 const spread = node.spread;
23861 return spread === void 0 || spread === null ? node.children.length > 1 : spread;
23862 }
23863 var init_list_item = __esmMin((() => {}));
23864
23865 //#endregion
23866 //#region node_modules/mdast-util-to-hast/lib/handlers/list.js
23867 /**
23868 * @typedef {import('hast').Element} Element
23869 * @typedef {import('hast').Properties} Properties
23870 * @typedef {import('mdast').List} List
23871 * @typedef {import('../state.js').State} State
23872 */
23873 /**
23874 * Turn an mdast `list` node into hast.
23875 *
23876 * @param {State} state
23877 * Info passed around.
23878 * @param {List} node
23879 * mdast node.
23880 * @returns {Element}
23881 * hast node.
23882 */
23883 function list(state, node) {
23884 /** @type {Properties} */
23885 const properties = {};
23886 const results = state.all(node);
23887 let index = -1;
23888 if (typeof node.start === "number" && node.start !== 1) properties.start = node.start;
23889 while (++index < results.length) {
23890 const child = results[index];
23891 if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) {
23892 properties.className = ["contains-task-list"];
23893 break;
23894 }
23895 }
23896 /** @type {Element} */
23897 const result = {
23898 type: "element",
23899 tagName: node.ordered ? "ol" : "ul",
23900 properties,
23901 children: state.wrap(results, true)
23902 };
23903 state.patch(node, result);
23904 return state.applyData(node, result);
23905 }
23906 var init_list = __esmMin((() => {}));
23907
23908 //#endregion
23909 //#region node_modules/mdast-util-to-hast/lib/handlers/paragraph.js
23910 /**
23911 * @typedef {import('hast').Element} Element
23912 * @typedef {import('mdast').Paragraph} Paragraph
23913 * @typedef {import('../state.js').State} State
23914 */
23915 /**
23916 * Turn an mdast `paragraph` node into hast.
23917 *
23918 * @param {State} state
23919 * Info passed around.
23920 * @param {Paragraph} node
23921 * mdast node.
23922 * @returns {Element}
23923 * hast node.
23924 */
23925 function paragraph(state, node) {
23926 /** @type {Element} */
23927 const result = {
23928 type: "element",
23929 tagName: "p",
23930 properties: {},
23931 children: state.all(node)
23932 };
23933 state.patch(node, result);
23934 return state.applyData(node, result);
23935 }
23936 var init_paragraph = __esmMin((() => {}));
23937
23938 //#endregion
23939 //#region node_modules/mdast-util-to-hast/lib/handlers/root.js
23940 /**
23941 * @typedef {import('hast').Root} HastRoot
23942 * @typedef {import('hast').Element} HastElement
23943 * @typedef {import('mdast').Root} MdastRoot
23944 * @typedef {import('../state.js').State} State
23945 */
23946 /**
23947 * Turn an mdast `root` node into hast.
23948 *
23949 * @param {State} state
23950 * Info passed around.
23951 * @param {MdastRoot} node
23952 * mdast node.
23953 * @returns {HastRoot | HastElement}
23954 * hast node.
23955 */
23956 function root(state, node) {
23957 /** @type {HastRoot} */
23958 const result = {
23959 type: "root",
23960 children: state.wrap(state.all(node))
23961 };
23962 state.patch(node, result);
23963 return state.applyData(node, result);
23964 }
23965 var init_root = __esmMin((() => {}));
23966
23967 //#endregion
23968 //#region node_modules/mdast-util-to-hast/lib/handlers/strong.js
23969 /**
23970 * @typedef {import('hast').Element} Element
23971 * @typedef {import('mdast').Strong} Strong
23972 * @typedef {import('../state.js').State} State
23973 */
23974 /**
23975 * Turn an mdast `strong` node into hast.
23976 *
23977 * @param {State} state
23978 * Info passed around.
23979 * @param {Strong} node
23980 * mdast node.
23981 * @returns {Element}
23982 * hast node.
23983 */
23984 function strong(state, node) {
23985 /** @type {Element} */
23986 const result = {
23987 type: "element",
23988 tagName: "strong",
23989 properties: {},
23990 children: state.all(node)
23991 };
23992 state.patch(node, result);
23993 return state.applyData(node, result);
23994 }
23995 var init_strong = __esmMin((() => {}));
23996
23997 //#endregion
23998 //#region node_modules/unist-util-position/lib/index.js
23999 /**
24000 * Get the positional info of `node`.
24001 *
24002 * @param {NodeLike | Node | null | undefined} [node]
24003 * Node.
24004 * @returns {Position}
24005 * Position.
24006 */
24007 function position(node) {
24008 return {
24009 start: pointStart(node),
24010 end: pointEnd(node)
24011 };
24012 }
24013 /**
24014 * Get the positional info of `node`.
24015 *
24016 * @param {'start' | 'end'} type
24017 * Side.
24018 * @returns
24019 * Getter.
24020 */
24021 function point(type) {
24022 return point;
24023 /**
24024 * Get the point info of `node` at a bound side.
24025 *
24026 * @param {NodeLike | Node | null | undefined} [node]
24027 * @returns {Point}
24028 */
24029 function point(node) {
24030 const point = node && node.position && node.position[type] || {};
24031 return {
24032 line: point.line || null,
24033 column: point.column || null,
24034 offset: point.offset > -1 ? point.offset : null
24035 };
24036 }
24037 }
24038 var pointStart, pointEnd;
24039 var init_lib$7 = __esmMin((() => {
24040 pointStart = point("start");
24041 pointEnd = point("end");
24042 }));
24043
24044 //#endregion
24045 //#region node_modules/unist-util-position/index.js
24046 var init_unist_util_position = __esmMin((() => {
24047 init_lib$7();
24048 }));
24049
24050 //#endregion
24051 //#region node_modules/mdast-util-to-hast/lib/handlers/table.js
24052 /**
24053 * Turn an mdast `table` node into hast.
24054 *
24055 * @param {State} state
24056 * Info passed around.
24057 * @param {Table} node
24058 * mdast node.
24059 * @returns {Element}
24060 * hast node.
24061 */
24062 function table(state, node) {
24063 const rows = state.all(node);
24064 const firstRow = rows.shift();
24065 /** @type {Array<Element>} */
24066 const tableContent = [];
24067 if (firstRow) {
24068 /** @type {Element} */
24069 const head = {
24070 type: "element",
24071 tagName: "thead",
24072 properties: {},
24073 children: state.wrap([firstRow], true)
24074 };
24075 state.patch(node.children[0], head);
24076 tableContent.push(head);
24077 }
24078 if (rows.length > 0) {
24079 /** @type {Element} */
24080 const body = {
24081 type: "element",
24082 tagName: "tbody",
24083 properties: {},
24084 children: state.wrap(rows, true)
24085 };
24086 const start = pointStart(node.children[1]);
24087 const end = pointEnd(node.children[node.children.length - 1]);
24088 if (start.line && end.line) body.position = {
24089 start,
24090 end
24091 };
24092 tableContent.push(body);
24093 }
24094 /** @type {Element} */
24095 const result = {
24096 type: "element",
24097 tagName: "table",
24098 properties: {},
24099 children: state.wrap(tableContent, true)
24100 };
24101 state.patch(node, result);
24102 return state.applyData(node, result);
24103 }
24104 var init_table = __esmMin((() => {
24105 init_unist_util_position();
24106 }));
24107
24108 //#endregion
24109 //#region node_modules/mdast-util-to-hast/lib/handlers/table-row.js
24110 /**
24111 * @typedef {import('hast').Properties} Properties
24112 * @typedef {import('hast').Element} Element
24113 * @typedef {import('hast').ElementContent} ElementContent
24114 * @typedef {import('mdast').Content} Content
24115 * @typedef {import('mdast').Parent} Parent
24116 * @typedef {import('mdast').Root} Root
24117 * @typedef {import('mdast').TableRow} TableRow
24118 * @typedef {import('../state.js').State} State
24119 */
24120 /**
24121 * @typedef {Root | Content} Nodes
24122 * @typedef {Extract<Nodes, Parent>} Parents
24123 */
24124 /**
24125 * Turn an mdast `tableRow` node into hast.
24126 *
24127 * @param {State} state
24128 * Info passed around.
24129 * @param {TableRow} node
24130 * mdast node.
24131 * @param {Parents | null | undefined} parent
24132 * Parent of `node`.
24133 * @returns {Element}
24134 * hast node.
24135 */
24136 function tableRow(state, node, parent) {
24137 const siblings = parent ? parent.children : void 0;
24138 const tagName = (siblings ? siblings.indexOf(node) : 1) === 0 ? "th" : "td";
24139 const align = parent && parent.type === "table" ? parent.align : void 0;
24140 const length = align ? align.length : node.children.length;
24141 let cellIndex = -1;
24142 /** @type {Array<ElementContent>} */
24143 const cells = [];
24144 while (++cellIndex < length) {
24145 const cell = node.children[cellIndex];
24146 /** @type {Properties} */
24147 const properties = {};
24148 const alignValue = align ? align[cellIndex] : void 0;
24149 if (alignValue) properties.align = alignValue;
24150 /** @type {Element} */
24151 let result = {
24152 type: "element",
24153 tagName,
24154 properties,
24155 children: []
24156 };
24157 if (cell) {
24158 result.children = state.all(cell);
24159 state.patch(cell, result);
24160 result = state.applyData(node, result);
24161 }
24162 cells.push(result);
24163 }
24164 /** @type {Element} */
24165 const result = {
24166 type: "element",
24167 tagName: "tr",
24168 properties: {},
24169 children: state.wrap(cells, true)
24170 };
24171 state.patch(node, result);
24172 return state.applyData(node, result);
24173 }
24174 var init_table_row = __esmMin((() => {}));
24175
24176 //#endregion
24177 //#region node_modules/mdast-util-to-hast/lib/handlers/table-cell.js
24178 /**
24179 * @typedef {import('hast').Element} Element
24180 * @typedef {import('mdast').TableCell} TableCell
24181 * @typedef {import('../state.js').State} State
24182 */
24183 /**
24184 * Turn an mdast `tableCell` node into hast.
24185 *
24186 * @param {State} state
24187 * Info passed around.
24188 * @param {TableCell} node
24189 * mdast node.
24190 * @returns {Element}
24191 * hast node.
24192 */
24193 function tableCell(state, node) {
24194 /** @type {Element} */
24195 const result = {
24196 type: "element",
24197 tagName: "td",
24198 properties: {},
24199 children: state.all(node)
24200 };
24201 state.patch(node, result);
24202 return state.applyData(node, result);
24203 }
24204 var init_table_cell = __esmMin((() => {}));
24205
24206 //#endregion
24207 //#region node_modules/trim-lines/index.js
24208 /**
24209 * Remove initial and final spaces and tabs at the line breaks in `value`.
24210 * Does not trim initial and final spaces and tabs of the value itself.
24211 *
24212 * @param {string} value
24213 * Value to trim.
24214 * @returns {string}
24215 * Trimmed value.
24216 */
24217 function trimLines(value) {
24218 const source = String(value);
24219 const search = /\r?\n|\r/g;
24220 let match = search.exec(source);
24221 let last = 0;
24222 /** @type {Array<string>} */
24223 const lines = [];
24224 while (match) {
24225 lines.push(trimLine(source.slice(last, match.index), last > 0, true), match[0]);
24226 last = match.index + match[0].length;
24227 match = search.exec(source);
24228 }
24229 lines.push(trimLine(source.slice(last), last > 0, false));
24230 return lines.join("");
24231 }
24232 /**
24233 * @param {string} value
24234 * Line to trim.
24235 * @param {boolean} start
24236 * Whether to trim the start of the line.
24237 * @param {boolean} end
24238 * Whether to trim the end of the line.
24239 * @returns {string}
24240 * Trimmed line.
24241 */
24242 function trimLine(value, start, end) {
24243 let startIndex = 0;
24244 let endIndex = value.length;
24245 if (start) {
24246 let code = value.codePointAt(startIndex);
24247 while (code === tab || code === space) {
24248 startIndex++;
24249 code = value.codePointAt(startIndex);
24250 }
24251 }
24252 if (end) {
24253 let code = value.codePointAt(endIndex - 1);
24254 while (code === tab || code === space) {
24255 endIndex--;
24256 code = value.codePointAt(endIndex - 1);
24257 }
24258 }
24259 return endIndex > startIndex ? value.slice(startIndex, endIndex) : "";
24260 }
24261 var tab, space;
24262 var init_trim_lines = __esmMin((() => {
24263 tab = 9;
24264 space = 32;
24265 }));
24266
24267 //#endregion
24268 //#region node_modules/mdast-util-to-hast/lib/handlers/text.js
24269 /**
24270 * Turn an mdast `text` node into hast.
24271 *
24272 * @param {State} state
24273 * Info passed around.
24274 * @param {MdastText} node
24275 * mdast node.
24276 * @returns {HastText | HastElement}
24277 * hast node.
24278 */
24279 function text(state, node) {
24280 /** @type {HastText} */
24281 const result = {
24282 type: "text",
24283 value: trimLines(String(node.value))
24284 };
24285 state.patch(node, result);
24286 return state.applyData(node, result);
24287 }
24288 var init_text = __esmMin((() => {
24289 init_trim_lines();
24290 }));
24291
24292 //#endregion
24293 //#region node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js
24294 /**
24295 * @typedef {import('hast').Element} Element
24296 * @typedef {import('mdast').ThematicBreak} ThematicBreak
24297 * @typedef {import('../state.js').State} State
24298 */
24299 /**
24300 * Turn an mdast `thematicBreak` node into hast.
24301 *
24302 * @param {State} state
24303 * Info passed around.
24304 * @param {ThematicBreak} node
24305 * mdast node.
24306 * @returns {Element}
24307 * hast node.
24308 */
24309 function thematicBreak(state, node) {
24310 /** @type {Element} */
24311 const result = {
24312 type: "element",
24313 tagName: "hr",
24314 properties: {},
24315 children: []
24316 };
24317 state.patch(node, result);
24318 return state.applyData(node, result);
24319 }
24320 var init_thematic_break = __esmMin((() => {}));
24321
24322 //#endregion
24323 //#region node_modules/mdast-util-to-hast/lib/handlers/index.js
24324 function ignore() {
24325 return null;
24326 }
24327 var handlers;
24328 var init_handlers = __esmMin((() => {
24329 init_blockquote();
24330 init_break();
24331 init_code();
24332 init_delete();
24333 init_emphasis();
24334 init_footnote_reference();
24335 init_footnote();
24336 init_heading();
24337 init_html$1();
24338 init_image_reference();
24339 init_image();
24340 init_inline_code();
24341 init_link_reference();
24342 init_link();
24343 init_list_item();
24344 init_list();
24345 init_paragraph();
24346 init_root();
24347 init_strong();
24348 init_table();
24349 init_table_row();
24350 init_table_cell();
24351 init_text();
24352 init_thematic_break();
24353 handlers = {
24354 blockquote,
24355 break: hardBreak,
24356 code,
24357 delete: strikethrough,
24358 emphasis,
24359 footnoteReference,
24360 footnote,
24361 heading,
24362 html: html$2,
24363 imageReference,
24364 image,
24365 inlineCode,
24366 linkReference,
24367 link,
24368 listItem,
24369 list,
24370 paragraph,
24371 root,
24372 strong,
24373 table,
24374 tableCell,
24375 tableRow,
24376 text,
24377 thematicBreak,
24378 toml: ignore,
24379 yaml: ignore,
24380 definition: ignore,
24381 footnoteDefinition: ignore
24382 };
24383 }));
24384
24385 //#endregion
24386 //#region node_modules/unist-util-is/lib/index.js
24387 /**
24388 * @param {Array<string | Props | TestFunctionAnything>} tests
24389 * @returns {AssertAnything}
24390 */
24391 function anyFactory(tests) {
24392 /** @type {Array<AssertAnything>} */
24393 const checks = [];
24394 let index = -1;
24395 while (++index < tests.length) checks[index] = convert(tests[index]);
24396 return castFactory(any);
24397 /**
24398 * @this {unknown}
24399 * @param {Array<unknown>} parameters
24400 * @returns {boolean}
24401 */
24402 function any(...parameters) {
24403 let index = -1;
24404 while (++index < checks.length) if (checks[index].call(this, ...parameters)) return true;
24405 return false;
24406 }
24407 }
24408 /**
24409 * Turn an object into a test for a node with a certain fields.
24410 *
24411 * @param {Props} check
24412 * @returns {AssertAnything}
24413 */
24414 function propsFactory(check) {
24415 return castFactory(all);
24416 /**
24417 * @param {Node} node
24418 * @returns {boolean}
24419 */
24420 function all(node) {
24421 /** @type {string} */
24422 let key;
24423 for (key in check) if (node[key] !== check[key]) return false;
24424 return true;
24425 }
24426 }
24427 /**
24428 * Turn a string into a test for a node with a certain type.
24429 *
24430 * @param {string} check
24431 * @returns {AssertAnything}
24432 */
24433 function typeFactory(check) {
24434 return castFactory(type);
24435 /**
24436 * @param {Node} node
24437 */
24438 function type(node) {
24439 return node && node.type === check;
24440 }
24441 }
24442 /**
24443 * Turn a custom test into a test for a node that passes that test.
24444 *
24445 * @param {TestFunctionAnything} check
24446 * @returns {AssertAnything}
24447 */
24448 function castFactory(check) {
24449 return assertion;
24450 /**
24451 * @this {unknown}
24452 * @param {unknown} node
24453 * @param {Array<unknown>} parameters
24454 * @returns {boolean}
24455 */
24456 function assertion(node, ...parameters) {
24457 return Boolean(node && typeof node === "object" && "type" in node && Boolean(check.call(this, node, ...parameters)));
24458 }
24459 }
24460 function ok() {
24461 return true;
24462 }
24463 var convert;
24464 var init_lib$6 = __esmMin((() => {
24465 convert = (
24466 /**
24467 * @param {Test} [test]
24468 * @returns {AssertAnything}
24469 */
24470 function(test) {
24471 if (test === void 0 || test === null) return ok;
24472 if (typeof test === "string") return typeFactory(test);
24473 if (typeof test === "object") return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
24474 if (typeof test === "function") return castFactory(test);
24475 throw new Error("Expected function, string, or object as test");
24476 });
24477 }));
24478
24479 //#endregion
24480 //#region node_modules/unist-util-is/index.js
24481 var init_unist_util_is = __esmMin((() => {
24482 init_lib$6();
24483 }));
24484
24485 //#endregion
24486 //#region node_modules/unist-util-visit-parents/lib/color.browser.js
24487 /**
24488 * @param {string} d
24489 * @returns {string}
24490 */
24491 function color(d) {
24492 return d;
24493 }
24494 var init_color_browser = __esmMin((() => {}));
24495
24496 //#endregion
24497 //#region node_modules/unist-util-visit-parents/lib/index.js
24498 /**
24499 * Turn a return value into a clean result.
24500 *
24501 * @param {VisitorResult} value
24502 * Valid return values from visitors.
24503 * @returns {ActionTuple}
24504 * Clean result.
24505 */
24506 function toResult(value) {
24507 if (Array.isArray(value)) return value;
24508 if (typeof value === "number") return [true, value];
24509 return [value];
24510 }
24511 var CONTINUE, EXIT, SKIP, visitParents;
24512 var init_lib$5 = __esmMin((() => {
24513 init_unist_util_is();
24514 init_color_browser();
24515 CONTINUE = true;
24516 EXIT = false;
24517 SKIP = "skip";
24518 visitParents = (
24519 /**
24520 * @param {Node} tree
24521 * @param {Test} test
24522 * @param {Visitor<Node>} visitor
24523 * @param {boolean | null | undefined} [reverse]
24524 * @returns {void}
24525 */
24526 function(tree, test, visitor, reverse) {
24527 if (typeof test === "function" && typeof visitor !== "function") {
24528 reverse = visitor;
24529 visitor = test;
24530 test = null;
24531 }
24532 const is = convert(test);
24533 const step = reverse ? -1 : 1;
24534 factory(tree, void 0, [])();
24535 /**
24536 * @param {Node} node
24537 * @param {number | undefined} index
24538 * @param {Array<Parent>} parents
24539 */
24540 function factory(node, index, parents) {
24541 /** @type {Record<string, unknown>} */
24542 const value = node && typeof node === "object" ? node : {};
24543 if (typeof value.type === "string") {
24544 const name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0;
24545 Object.defineProperty(visit, "name", { value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")" });
24546 }
24547 return visit;
24548 function visit() {
24549 /** @type {ActionTuple} */
24550 let result = [];
24551 /** @type {ActionTuple} */
24552 let subresult;
24553 /** @type {number} */
24554 let offset;
24555 /** @type {Array<Parent>} */
24556 let grandparents;
24557 if (!test || is(node, index, parents[parents.length - 1] || null)) {
24558 result = toResult(visitor(node, parents));
24559 if (result[0] === false) return result;
24560 }
24561 if (node.children && result[0] !== "skip") {
24562 offset = (reverse ? node.children.length : -1) + step;
24563 grandparents = parents.concat(node);
24564 while (offset > -1 && offset < node.children.length) {
24565 subresult = factory(node.children[offset], offset, grandparents)();
24566 if (subresult[0] === false) return subresult;
24567 offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
24568 }
24569 }
24570 return result;
24571 }
24572 }
24573 });
24574 }));
24575
24576 //#endregion
24577 //#region node_modules/unist-util-visit-parents/index.js
24578 var init_unist_util_visit_parents = __esmMin((() => {
24579 init_lib$5();
24580 }));
24581
24582 //#endregion
24583 //#region node_modules/unist-util-visit/lib/index.js
24584 var visit;
24585 var init_lib$4 = __esmMin((() => {
24586 init_unist_util_visit_parents();
24587 visit = (
24588 /**
24589 * @param {Node} tree
24590 * @param {Test} test
24591 * @param {Visitor} visitor
24592 * @param {boolean | null | undefined} [reverse]
24593 * @returns {void}
24594 */
24595 function(tree, test, visitor, reverse) {
24596 if (typeof test === "function" && typeof visitor !== "function") {
24597 reverse = visitor;
24598 visitor = test;
24599 test = null;
24600 }
24601 visitParents(tree, test, overload, reverse);
24602 /**
24603 * @param {Node} node
24604 * @param {Array<Parent>} parents
24605 */
24606 function overload(node, parents) {
24607 const parent = parents[parents.length - 1];
24608 return visitor(node, parent ? parent.children.indexOf(node) : null, parent);
24609 }
24610 });
24611 }));
24612
24613 //#endregion
24614 //#region node_modules/unist-util-visit/index.js
24615 var init_unist_util_visit = __esmMin((() => {
24616 init_lib$4();
24617 }));
24618
24619 //#endregion
24620 //#region node_modules/unist-util-generated/lib/index.js
24621 /**
24622 * @typedef PointLike
24623 * @property {number | null | undefined} [line]
24624 * @property {number | null | undefined} [column]
24625 * @property {number | null | undefined} [offset]
24626 *
24627 * @typedef PositionLike
24628 * @property {PointLike | null | undefined} [start]
24629 * @property {PointLike | null | undefined} [end]
24630 *
24631 * @typedef NodeLike
24632 * @property {PositionLike | null | undefined} [position]
24633 */
24634 /**
24635 * Check if `node` is generated.
24636 *
24637 * @param {NodeLike | null | undefined} [node]
24638 * Node to check.
24639 * @returns {boolean}
24640 * Whether `node` is generated (does not have positional info).
24641 */
24642 function generated(node) {
24643 return !node || !node.position || !node.position.start || !node.position.start.line || !node.position.start.column || !node.position.end || !node.position.end.line || !node.position.end.column;
24644 }
24645 var init_lib$3 = __esmMin((() => {}));
24646
24647 //#endregion
24648 //#region node_modules/unist-util-generated/index.js
24649 var init_unist_util_generated = __esmMin((() => {
24650 init_lib$3();
24651 }));
24652
24653 //#endregion
24654 //#region node_modules/mdast-util-definitions/lib/index.js
24655 /**
24656 * Find definitions in `tree`.
24657 *
24658 * Uses CommonMark precedence, which means that earlier definitions are
24659 * preferred over duplicate later definitions.
24660 *
24661 * @param {Node} tree
24662 * Tree to check.
24663 * @returns {GetDefinition}
24664 * Getter.
24665 */
24666 function definitions(tree) {
24667 /** @type {Record<string, Definition>} */
24668 const cache = Object.create(null);
24669 if (!tree || !tree.type) throw new Error("mdast-util-definitions expected node");
24670 visit(tree, "definition", (definition) => {
24671 const id = clean(definition.identifier);
24672 if (id && !own$4.call(cache, id)) cache[id] = definition;
24673 });
24674 return definition;
24675 /** @type {GetDefinition} */
24676 function definition(identifier) {
24677 const id = clean(identifier);
24678 return id && own$4.call(cache, id) ? cache[id] : null;
24679 }
24680 }
24681 /**
24682 * @param {string | null | undefined} [value]
24683 * @returns {string}
24684 */
24685 function clean(value) {
24686 return String(value || "").toUpperCase();
24687 }
24688 var own$4;
24689 var init_lib$2 = __esmMin((() => {
24690 init_unist_util_visit();
24691 own$4 = {}.hasOwnProperty;
24692 }));
24693
24694 //#endregion
24695 //#region node_modules/mdast-util-definitions/index.js
24696 var init_mdast_util_definitions = __esmMin((() => {
24697 init_lib$2();
24698 }));
24699
24700 //#endregion
24701 //#region node_modules/mdast-util-to-hast/lib/state.js
24702 /**
24703 * Create `state` from an mdast tree.
24704 *
24705 * @param {MdastNodes} tree
24706 * mdast node to transform.
24707 * @param {Options | null | undefined} [options]
24708 * Configuration.
24709 * @returns {State}
24710 * `state` function.
24711 */
24712 function createState(tree, options) {
24713 const settings = options || {};
24714 const dangerous = settings.allowDangerousHtml || false;
24715 /** @type {Record<string, MdastFootnoteDefinition>} */
24716 const footnoteById = {};
24717 state.dangerous = dangerous;
24718 state.clobberPrefix = settings.clobberPrefix === void 0 || settings.clobberPrefix === null ? "user-content-" : settings.clobberPrefix;
24719 state.footnoteLabel = settings.footnoteLabel || "Footnotes";
24720 state.footnoteLabelTagName = settings.footnoteLabelTagName || "h2";
24721 state.footnoteLabelProperties = settings.footnoteLabelProperties || { className: ["sr-only"] };
24722 state.footnoteBackLabel = settings.footnoteBackLabel || "Back to content";
24723 state.unknownHandler = settings.unknownHandler;
24724 state.passThrough = settings.passThrough;
24725 state.handlers = _objectSpread2(_objectSpread2({}, handlers), settings.handlers);
24726 state.definition = definitions(tree);
24727 state.footnoteById = footnoteById;
24728 /** @type {Array<string>} */
24729 state.footnoteOrder = [];
24730 /** @type {Record<string, number>} */
24731 state.footnoteCounts = {};
24732 state.patch = patch;
24733 state.applyData = applyData;
24734 state.one = oneBound;
24735 state.all = allBound;
24736 state.wrap = wrap;
24737 state.augment = augment;
24738 visit(tree, "footnoteDefinition", (definition) => {
24739 const id = String(definition.identifier).toUpperCase();
24740 if (!own$3.call(footnoteById, id)) footnoteById[id] = definition;
24741 });
24742 return state;
24743 /**
24744 * Finalise the created `right`, a hast node, from `left`, an mdast node.
24745 *
24746 * @param {MdastNodeWithData | PositionLike | null | undefined} left
24747 * @param {HastElementContent} right
24748 * @returns {HastElementContent}
24749 */
24750 /* c8 ignore start */
24751 function augment(left, right) {
24752 if (left && "data" in left && left.data) {
24753 /** @type {MdastData} */
24754 const data = left.data;
24755 if (data.hName) {
24756 if (right.type !== "element") right = {
24757 type: "element",
24758 tagName: "",
24759 properties: {},
24760 children: []
24761 };
24762 right.tagName = data.hName;
24763 }
24764 if (right.type === "element" && data.hProperties) right.properties = _objectSpread2(_objectSpread2({}, right.properties), data.hProperties);
24765 if ("children" in right && right.children && data.hChildren) right.children = data.hChildren;
24766 }
24767 if (left) {
24768 const ctx = "type" in left ? left : { position: left };
24769 if (!generated(ctx)) right.position = {
24770 start: pointStart(ctx),
24771 end: pointEnd(ctx)
24772 };
24773 }
24774 return right;
24775 }
24776 /* c8 ignore stop */
24777 /**
24778 * Create an element for `node`.
24779 *
24780 * @type {HFunctionProps}
24781 */
24782 /* c8 ignore start */
24783 function state(node, tagName, props, children) {
24784 if (Array.isArray(props)) {
24785 children = props;
24786 props = {};
24787 }
24788 return augment(node, {
24789 type: "element",
24790 tagName,
24791 properties: props || {},
24792 children: children || []
24793 });
24794 }
24795 /* c8 ignore stop */
24796 /**
24797 * Transform an mdast node into a hast node.
24798 *
24799 * @param {MdastNodes} node
24800 * mdast node.
24801 * @param {MdastParents | null | undefined} [parent]
24802 * Parent of `node`.
24803 * @returns {HastElementContent | Array<HastElementContent> | null | undefined}
24804 * Resulting hast node.
24805 */
24806 function oneBound(node, parent) {
24807 return one(state, node, parent);
24808 }
24809 /**
24810 * Transform the children of an mdast node into hast nodes.
24811 *
24812 * @param {MdastNodes} parent
24813 * mdast node to compile
24814 * @returns {Array<HastElementContent>}
24815 * Resulting hast nodes.
24816 */
24817 function allBound(parent) {
24818 return all(state, parent);
24819 }
24820 }
24821 /**
24822 * Copy a node’s positional info.
24823 *
24824 * @param {MdastNodes} from
24825 * mdast node to copy from.
24826 * @param {HastNodes} to
24827 * hast node to copy into.
24828 * @returns {void}
24829 * Nothing.
24830 */
24831 function patch(from, to) {
24832 if (from.position) to.position = position(from);
24833 }
24834 /**
24835 * Honor the `data` of `from` and maybe generate an element instead of `to`.
24836 *
24837 * @template {HastNodes} Type
24838 * Node type.
24839 * @param {MdastNodes} from
24840 * mdast node to use data from.
24841 * @param {Type} to
24842 * hast node to change.
24843 * @returns {Type | HastElement}
24844 * Nothing.
24845 */
24846 function applyData(from, to) {
24847 /** @type {Type | HastElement} */
24848 let result = to;
24849 if (from && from.data) {
24850 const hName = from.data.hName;
24851 const hChildren = from.data.hChildren;
24852 const hProperties = from.data.hProperties;
24853 if (typeof hName === "string") if (result.type === "element") result.tagName = hName;
24854 else result = {
24855 type: "element",
24856 tagName: hName,
24857 properties: {},
24858 children: []
24859 };
24860 if (result.type === "element" && hProperties) result.properties = _objectSpread2(_objectSpread2({}, result.properties), hProperties);
24861 if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) result.children = hChildren;
24862 }
24863 return result;
24864 }
24865 /**
24866 * Transform an mdast node into a hast node.
24867 *
24868 * @param {State} state
24869 * Info passed around.
24870 * @param {MdastNodes} node
24871 * mdast node.
24872 * @param {MdastParents | null | undefined} [parent]
24873 * Parent of `node`.
24874 * @returns {HastElementContent | Array<HastElementContent> | null | undefined}
24875 * Resulting hast node.
24876 */
24877 function one(state, node, parent) {
24878 const type = node && node.type;
24879 if (!type) throw new Error("Expected node, got `" + node + "`");
24880 if (own$3.call(state.handlers, type)) return state.handlers[type](state, node, parent);
24881 if (state.passThrough && state.passThrough.includes(type)) return "children" in node ? _objectSpread2(_objectSpread2({}, node), {}, { children: all(state, node) }) : node;
24882 if (state.unknownHandler) return state.unknownHandler(state, node, parent);
24883 return defaultUnknownHandler(state, node);
24884 }
24885 /**
24886 * Transform the children of an mdast node into hast nodes.
24887 *
24888 * @param {State} state
24889 * Info passed around.
24890 * @param {MdastNodes} parent
24891 * mdast node to compile
24892 * @returns {Array<HastElementContent>}
24893 * Resulting hast nodes.
24894 */
24895 function all(state, parent) {
24896 /** @type {Array<HastElementContent>} */
24897 const values = [];
24898 if ("children" in parent) {
24899 const nodes = parent.children;
24900 let index = -1;
24901 while (++index < nodes.length) {
24902 const result = one(state, nodes[index], parent);
24903 if (result) {
24904 if (index && nodes[index - 1].type === "break") {
24905 if (!Array.isArray(result) && result.type === "text") result.value = result.value.replace(/^\s+/, "");
24906 if (!Array.isArray(result) && result.type === "element") {
24907 const head = result.children[0];
24908 if (head && head.type === "text") head.value = head.value.replace(/^\s+/, "");
24909 }
24910 }
24911 if (Array.isArray(result)) values.push(...result);
24912 else values.push(result);
24913 }
24914 }
24915 }
24916 return values;
24917 }
24918 /**
24919 * Transform an unknown node.
24920 *
24921 * @param {State} state
24922 * Info passed around.
24923 * @param {MdastNodes} node
24924 * Unknown mdast node.
24925 * @returns {HastText | HastElement}
24926 * Resulting hast node.
24927 */
24928 function defaultUnknownHandler(state, node) {
24929 const data = node.data || {};
24930 /** @type {HastText | HastElement} */
24931 const result = "value" in node && !(own$3.call(data, "hProperties") || own$3.call(data, "hChildren")) ? {
24932 type: "text",
24933 value: node.value
24934 } : {
24935 type: "element",
24936 tagName: "div",
24937 properties: {},
24938 children: all(state, node)
24939 };
24940 state.patch(node, result);
24941 return state.applyData(node, result);
24942 }
24943 /**
24944 * Wrap `nodes` with line endings between each node.
24945 *
24946 * @template {HastContent} Type
24947 * Node type.
24948 * @param {Array<Type>} nodes
24949 * List of nodes to wrap.
24950 * @param {boolean | null | undefined} [loose=false]
24951 * Whether to add line endings at start and end.
24952 * @returns {Array<Type | HastText>}
24953 * Wrapped nodes.
24954 */
24955 function wrap(nodes, loose) {
24956 /** @type {Array<Type | HastText>} */
24957 const result = [];
24958 let index = -1;
24959 if (loose) result.push({
24960 type: "text",
24961 value: "\n"
24962 });
24963 while (++index < nodes.length) {
24964 if (index) result.push({
24965 type: "text",
24966 value: "\n"
24967 });
24968 result.push(nodes[index]);
24969 }
24970 if (loose && nodes.length > 0) result.push({
24971 type: "text",
24972 value: "\n"
24973 });
24974 return result;
24975 }
24976 var own$3;
24977 var init_state = __esmMin((() => {
24978 init_unist_util_visit();
24979 init_unist_util_position();
24980 init_unist_util_generated();
24981 init_mdast_util_definitions();
24982 init_handlers();
24983 init_objectSpread2();
24984 own$3 = {}.hasOwnProperty;
24985 }));
24986
24987 //#endregion
24988 //#region node_modules/mdast-util-to-hast/lib/footer.js
24989 /**
24990 * Generate a hast footer for called footnote definitions.
24991 *
24992 * @param {State} state
24993 * Info passed around.
24994 * @returns {Element | undefined}
24995 * `section` element or `undefined`.
24996 */
24997 function footer(state) {
24998 /** @type {Array<ElementContent>} */
24999 const listItems = [];
25000 let index = -1;
25001 while (++index < state.footnoteOrder.length) {
25002 const def = state.footnoteById[state.footnoteOrder[index]];
25003 if (!def) continue;
25004 const content = state.all(def);
25005 const id = String(def.identifier).toUpperCase();
25006 const safeId = normalizeUri(id.toLowerCase());
25007 let referenceIndex = 0;
25008 /** @type {Array<ElementContent>} */
25009 const backReferences = [];
25010 while (++referenceIndex <= state.footnoteCounts[id]) {
25011 /** @type {Element} */
25012 const backReference = {
25013 type: "element",
25014 tagName: "a",
25015 properties: {
25016 href: "#" + state.clobberPrefix + "fnref-" + safeId + (referenceIndex > 1 ? "-" + referenceIndex : ""),
25017 dataFootnoteBackref: true,
25018 className: ["data-footnote-backref"],
25019 ariaLabel: state.footnoteBackLabel
25020 },
25021 children: [{
25022 type: "text",
25023 value: "↩"
25024 }]
25025 };
25026 if (referenceIndex > 1) backReference.children.push({
25027 type: "element",
25028 tagName: "sup",
25029 children: [{
25030 type: "text",
25031 value: String(referenceIndex)
25032 }]
25033 });
25034 if (backReferences.length > 0) backReferences.push({
25035 type: "text",
25036 value: " "
25037 });
25038 backReferences.push(backReference);
25039 }
25040 const tail = content[content.length - 1];
25041 if (tail && tail.type === "element" && tail.tagName === "p") {
25042 const tailTail = tail.children[tail.children.length - 1];
25043 if (tailTail && tailTail.type === "text") tailTail.value += " ";
25044 else tail.children.push({
25045 type: "text",
25046 value: " "
25047 });
25048 tail.children.push(...backReferences);
25049 } else content.push(...backReferences);
25050 /** @type {Element} */
25051 const listItem = {
25052 type: "element",
25053 tagName: "li",
25054 properties: { id: state.clobberPrefix + "fn-" + safeId },
25055 children: state.wrap(content, true)
25056 };
25057 state.patch(def, listItem);
25058 listItems.push(listItem);
25059 }
25060 if (listItems.length === 0) return;
25061 return {
25062 type: "element",
25063 tagName: "section",
25064 properties: {
25065 dataFootnotes: true,
25066 className: ["footnotes"]
25067 },
25068 children: [
25069 {
25070 type: "element",
25071 tagName: state.footnoteLabelTagName,
25072 properties: _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(state.footnoteLabelProperties))), {}, { id: "footnote-label" }),
25073 children: [{
25074 type: "text",
25075 value: state.footnoteLabel
25076 }]
25077 },
25078 {
25079 type: "text",
25080 value: "\n"
25081 },
25082 {
25083 type: "element",
25084 tagName: "ol",
25085 properties: {},
25086 children: state.wrap(listItems, true)
25087 },
25088 {
25089 type: "text",
25090 value: "\n"
25091 }
25092 ]
25093 };
25094 }
25095 var init_footer = __esmMin((() => {
25096 init_micromark_util_sanitize_uri();
25097 init_objectSpread2();
25098 }));
25099
25100 //#endregion
25101 //#region node_modules/mdast-util-to-hast/lib/index.js
25102 /**
25103 * Transform mdast to hast.
25104 *
25105 * ##### Notes
25106 *
25107 * ###### HTML
25108 *
25109 * Raw HTML is available in mdast as `html` nodes and can be embedded in hast
25110 * as semistandard `raw` nodes.
25111 * Most utilities ignore `raw` nodes but two notable ones don’t:
25112 *
25113 * * `hast-util-to-html` also has an option `allowDangerousHtml` which will
25114 * output the raw HTML.
25115 * This is typically discouraged as noted by the option name but is useful
25116 * if you completely trust authors
25117 * * `hast-util-raw` can handle the raw embedded HTML strings by parsing them
25118 * into standard hast nodes (`element`, `text`, etc).
25119 * This is a heavy task as it needs a full HTML parser, but it is the only
25120 * way to support untrusted content
25121 *
25122 * ###### Footnotes
25123 *
25124 * Many options supported here relate to footnotes.
25125 * Footnotes are not specified by CommonMark, which we follow by default.
25126 * They are supported by GitHub, so footnotes can be enabled in markdown with
25127 * `mdast-util-gfm`.
25128 *
25129 * The options `footnoteBackLabel` and `footnoteLabel` define natural language
25130 * that explains footnotes, which is hidden for sighted users but shown to
25131 * assistive technology.
25132 * When your page is not in English, you must define translated values.
25133 *
25134 * Back references use ARIA attributes, but the section label itself uses a
25135 * heading that is hidden with an `sr-only` class.
25136 * To show it to sighted users, define different attributes in
25137 * `footnoteLabelProperties`.
25138 *
25139 * ###### Clobbering
25140 *
25141 * Footnotes introduces a problem, as it links footnote calls to footnote
25142 * definitions on the page through `id` attributes generated from user content,
25143 * which results in DOM clobbering.
25144 *
25145 * DOM clobbering is this:
25146 *
25147 * ```html
25148 * <p id=x></p>
25149 * <script>alert(x) // `x` now refers to the DOM `p#x` element<\/script>
25150 * ```
25151 *
25152 * Elements by their ID are made available by browsers on the `window` object,
25153 * which is a security risk.
25154 * Using a prefix solves this problem.
25155 *
25156 * More information on how to handle clobbering and the prefix is explained in
25157 * Example: headings (DOM clobbering) in `rehype-sanitize`.
25158 *
25159 * ###### Unknown nodes
25160 *
25161 * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.
25162 * The default behavior for unknown nodes is:
25163 *
25164 * * when the node has a `value` (and doesn’t have `data.hName`,
25165 * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`
25166 * node
25167 * * otherwise, create a `<div>` element (which could be changed with
25168 * `data.hName`), with its children mapped from mdast to hast as well
25169 *
25170 * This behavior can be changed by passing an `unknownHandler`.
25171 *
25172 * @param {MdastNodes} tree
25173 * mdast tree.
25174 * @param {Options | null | undefined} [options]
25175 * Configuration.
25176 * @returns {HastNodes | null | undefined}
25177 * hast tree.
25178 */
25179 function toHast(tree, options) {
25180 const state = createState(tree, options);
25181 const node = state.one(tree, null);
25182 const foot = footer(state);
25183 if (foot) node.children.push({
25184 type: "text",
25185 value: "\n"
25186 }, foot);
25187 return Array.isArray(node) ? {
25188 type: "root",
25189 children: node
25190 } : node;
25191 }
25192 var init_lib$1 = __esmMin((() => {
25193 init_footer();
25194 init_state();
25195 }));
25196
25197 //#endregion
25198 //#region node_modules/mdast-util-to-hast/index.js
25199 var init_mdast_util_to_hast = __esmMin((() => {
25200 init_handlers();
25201 init_state();
25202 init_lib$1();
25203 }));
25204
25205 //#endregion
25206 //#region node_modules/remark-rehype/lib/index.js
25207 /**
25208 * Bridge-mode.
25209 * Runs the destination with the new hast tree.
25210 *
25211 * @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}
25212 */
25213 function bridge(destination, options) {
25214 return (node, file, next) => {
25215 destination.run(toHast(node, options), file, (error) => {
25216 next(error);
25217 });
25218 };
25219 }
25220 /**
25221 * Mutate-mode.
25222 * Further plugins run on the hast tree.
25223 *
25224 * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}
25225 */
25226 function mutate(options) {
25227 return (node) => toHast(node, options);
25228 }
25229 var remarkRehype;
25230 var init_lib = __esmMin((() => {
25231 init_mdast_util_to_hast();
25232 remarkRehype = (function(destination, options) {
25233 return destination && "run" in destination ? bridge(destination, options) : mutate(destination || options);
25234 });
25235 }));
25236
25237 //#endregion
25238 //#region node_modules/remark-rehype/index.js
25239 var init_remark_rehype = __esmMin((() => {
25240 init_mdast_util_to_hast();
25241 init_lib();
25242 }));
25243
25244 //#endregion
25245 //#region node_modules/property-information/lib/util/schema.js
25246 var Schema;
25247 var init_schema = __esmMin((() => {
25248 Schema = class {
25249 /**
25250 * @constructor
25251 * @param {Properties} property
25252 * @param {Normal} normal
25253 * @param {string} [space]
25254 */
25255 constructor(property, normal, space) {
25256 this.property = property;
25257 this.normal = normal;
25258 if (space) this.space = space;
25259 }
25260 };
25261 /** @type {Properties} */
25262 Schema.prototype.property = {};
25263 /** @type {Normal} */
25264 Schema.prototype.normal = {};
25265 /** @type {string|null} */
25266 Schema.prototype.space = null;
25267 }));
25268
25269 //#endregion
25270 //#region node_modules/property-information/lib/util/merge.js
25271 /**
25272 * @param {Schema[]} definitions
25273 * @param {string} [space]
25274 * @returns {Schema}
25275 */
25276 function merge(definitions, space) {
25277 /** @type {Properties} */
25278 const property = {};
25279 /** @type {Normal} */
25280 const normal = {};
25281 let index = -1;
25282 while (++index < definitions.length) {
25283 Object.assign(property, definitions[index].property);
25284 Object.assign(normal, definitions[index].normal);
25285 }
25286 return new Schema(property, normal, space);
25287 }
25288 var init_merge = __esmMin((() => {
25289 init_schema();
25290 }));
25291
25292 //#endregion
25293 //#region node_modules/property-information/lib/normalize.js
25294 /**
25295 * @param {string} value
25296 * @returns {string}
25297 */
25298 function normalize(value) {
25299 return value.toLowerCase();
25300 }
25301 var init_normalize = __esmMin((() => {}));
25302
25303 //#endregion
25304 //#region node_modules/property-information/lib/util/info.js
25305 var Info;
25306 var init_info = __esmMin((() => {
25307 Info = class {
25308 /**
25309 * @constructor
25310 * @param {string} property
25311 * @param {string} attribute
25312 */
25313 constructor(property, attribute) {
25314 /** @type {string} */
25315 this.property = property;
25316 /** @type {string} */
25317 this.attribute = attribute;
25318 }
25319 };
25320 /** @type {string|null} */
25321 Info.prototype.space = null;
25322 Info.prototype.boolean = false;
25323 Info.prototype.booleanish = false;
25324 Info.prototype.overloadedBoolean = false;
25325 Info.prototype.number = false;
25326 Info.prototype.commaSeparated = false;
25327 Info.prototype.spaceSeparated = false;
25328 Info.prototype.commaOrSpaceSeparated = false;
25329 Info.prototype.mustUseProperty = false;
25330 Info.prototype.defined = false;
25331 }));
25332
25333 //#endregion
25334 //#region node_modules/property-information/lib/util/types.js
25335 var types_exports = /* @__PURE__ */ __exportAll({
25336 boolean: () => boolean,
25337 booleanish: () => booleanish,
25338 commaOrSpaceSeparated: () => commaOrSpaceSeparated,
25339 commaSeparated: () => commaSeparated,
25340 number: () => number,
25341 overloadedBoolean: () => overloadedBoolean,
25342 spaceSeparated: () => spaceSeparated
25343 });
25344 function increment() {
25345 return Math.pow(2, ++powers);
25346 }
25347 var powers, boolean, booleanish, overloadedBoolean, number, spaceSeparated, commaSeparated, commaOrSpaceSeparated;
25348 var init_types = __esmMin((() => {
25349 powers = 0;
25350 boolean = increment();
25351 booleanish = increment();
25352 overloadedBoolean = increment();
25353 number = increment();
25354 spaceSeparated = increment();
25355 commaSeparated = increment();
25356 commaOrSpaceSeparated = increment();
25357 }));
25358
25359 //#endregion
25360 //#region node_modules/property-information/lib/util/defined-info.js
25361 /**
25362 * @param {DefinedInfo} values
25363 * @param {string} key
25364 * @param {unknown} value
25365 */
25366 function mark(values, key, value) {
25367 if (value) values[key] = value;
25368 }
25369 var checks, DefinedInfo;
25370 var init_defined_info = __esmMin((() => {
25371 init_info();
25372 init_types();
25373 checks = Object.keys(types_exports);
25374 DefinedInfo = class extends Info {
25375 /**
25376 * @constructor
25377 * @param {string} property
25378 * @param {string} attribute
25379 * @param {number|null} [mask]
25380 * @param {string} [space]
25381 */
25382 constructor(property, attribute, mask, space) {
25383 let index = -1;
25384 super(property, attribute);
25385 mark(this, "space", space);
25386 if (typeof mask === "number") while (++index < checks.length) {
25387 const check = checks[index];
25388 mark(this, checks[index], (mask & types_exports[check]) === types_exports[check]);
25389 }
25390 }
25391 };
25392 DefinedInfo.prototype.defined = true;
25393 }));
25394
25395 //#endregion
25396 //#region node_modules/property-information/lib/util/create.js
25397 /**
25398 * @param {Definition} definition
25399 * @returns {Schema}
25400 */
25401 function create(definition) {
25402 /** @type {Properties} */
25403 const property = {};
25404 /** @type {Normal} */
25405 const normal = {};
25406 /** @type {string} */
25407 let prop;
25408 for (prop in definition.properties) if (own$2.call(definition.properties, prop)) {
25409 const value = definition.properties[prop];
25410 const info = new DefinedInfo(prop, definition.transform(definition.attributes || {}, prop), value, definition.space);
25411 if (definition.mustUseProperty && definition.mustUseProperty.includes(prop)) info.mustUseProperty = true;
25412 property[prop] = info;
25413 normal[normalize(prop)] = prop;
25414 normal[normalize(info.attribute)] = prop;
25415 }
25416 return new Schema(property, normal, definition.space);
25417 }
25418 var own$2;
25419 var init_create = __esmMin((() => {
25420 init_normalize();
25421 init_schema();
25422 init_defined_info();
25423 own$2 = {}.hasOwnProperty;
25424 }));
25425
25426 //#endregion
25427 //#region node_modules/property-information/lib/xlink.js
25428 var xlink;
25429 var init_xlink = __esmMin((() => {
25430 init_create();
25431 xlink = create({
25432 space: "xlink",
25433 transform(_, prop) {
25434 return "xlink:" + prop.slice(5).toLowerCase();
25435 },
25436 properties: {
25437 xLinkActuate: null,
25438 xLinkArcRole: null,
25439 xLinkHref: null,
25440 xLinkRole: null,
25441 xLinkShow: null,
25442 xLinkTitle: null,
25443 xLinkType: null
25444 }
25445 });
25446 }));
25447
25448 //#endregion
25449 //#region node_modules/property-information/lib/xml.js
25450 var xml;
25451 var init_xml = __esmMin((() => {
25452 init_create();
25453 xml = create({
25454 space: "xml",
25455 transform(_, prop) {
25456 return "xml:" + prop.slice(3).toLowerCase();
25457 },
25458 properties: {
25459 xmlLang: null,
25460 xmlBase: null,
25461 xmlSpace: null
25462 }
25463 });
25464 }));
25465
25466 //#endregion
25467 //#region node_modules/property-information/lib/util/case-sensitive-transform.js
25468 /**
25469 * @param {Record<string, string>} attributes
25470 * @param {string} attribute
25471 * @returns {string}
25472 */
25473 function caseSensitiveTransform(attributes, attribute) {
25474 return attribute in attributes ? attributes[attribute] : attribute;
25475 }
25476 var init_case_sensitive_transform = __esmMin((() => {}));
25477
25478 //#endregion
25479 //#region node_modules/property-information/lib/util/case-insensitive-transform.js
25480 /**
25481 * @param {Record<string, string>} attributes
25482 * @param {string} property
25483 * @returns {string}
25484 */
25485 function caseInsensitiveTransform(attributes, property) {
25486 return caseSensitiveTransform(attributes, property.toLowerCase());
25487 }
25488 var init_case_insensitive_transform = __esmMin((() => {
25489 init_case_sensitive_transform();
25490 }));
25491
25492 //#endregion
25493 //#region node_modules/property-information/lib/xmlns.js
25494 var xmlns;
25495 var init_xmlns = __esmMin((() => {
25496 init_create();
25497 init_case_insensitive_transform();
25498 xmlns = create({
25499 space: "xmlns",
25500 attributes: { xmlnsxlink: "xmlns:xlink" },
25501 transform: caseInsensitiveTransform,
25502 properties: {
25503 xmlns: null,
25504 xmlnsXLink: null
25505 }
25506 });
25507 }));
25508
25509 //#endregion
25510 //#region node_modules/property-information/lib/aria.js
25511 var aria;
25512 var init_aria = __esmMin((() => {
25513 init_types();
25514 init_create();
25515 aria = create({
25516 transform(_, prop) {
25517 return prop === "role" ? prop : "aria-" + prop.slice(4).toLowerCase();
25518 },
25519 properties: {
25520 ariaActiveDescendant: null,
25521 ariaAtomic: booleanish,
25522 ariaAutoComplete: null,
25523 ariaBusy: booleanish,
25524 ariaChecked: booleanish,
25525 ariaColCount: number,
25526 ariaColIndex: number,
25527 ariaColSpan: number,
25528 ariaControls: spaceSeparated,
25529 ariaCurrent: null,
25530 ariaDescribedBy: spaceSeparated,
25531 ariaDetails: null,
25532 ariaDisabled: booleanish,
25533 ariaDropEffect: spaceSeparated,
25534 ariaErrorMessage: null,
25535 ariaExpanded: booleanish,
25536 ariaFlowTo: spaceSeparated,
25537 ariaGrabbed: booleanish,
25538 ariaHasPopup: null,
25539 ariaHidden: booleanish,
25540 ariaInvalid: null,
25541 ariaKeyShortcuts: null,
25542 ariaLabel: null,
25543 ariaLabelledBy: spaceSeparated,
25544 ariaLevel: number,
25545 ariaLive: null,
25546 ariaModal: booleanish,
25547 ariaMultiLine: booleanish,
25548 ariaMultiSelectable: booleanish,
25549 ariaOrientation: null,
25550 ariaOwns: spaceSeparated,
25551 ariaPlaceholder: null,
25552 ariaPosInSet: number,
25553 ariaPressed: booleanish,
25554 ariaReadOnly: booleanish,
25555 ariaRelevant: null,
25556 ariaRequired: booleanish,
25557 ariaRoleDescription: spaceSeparated,
25558 ariaRowCount: number,
25559 ariaRowIndex: number,
25560 ariaRowSpan: number,
25561 ariaSelected: booleanish,
25562 ariaSetSize: number,
25563 ariaSort: null,
25564 ariaValueMax: number,
25565 ariaValueMin: number,
25566 ariaValueNow: number,
25567 ariaValueText: null,
25568 role: null
25569 }
25570 });
25571 }));
25572
25573 //#endregion
25574 //#region node_modules/property-information/lib/html.js
25575 var html$1;
25576 var init_html = __esmMin((() => {
25577 init_types();
25578 init_create();
25579 init_case_insensitive_transform();
25580 html$1 = create({
25581 space: "html",
25582 attributes: {
25583 acceptcharset: "accept-charset",
25584 classname: "class",
25585 htmlfor: "for",
25586 httpequiv: "http-equiv"
25587 },
25588 transform: caseInsensitiveTransform,
25589 mustUseProperty: [
25590 "checked",
25591 "multiple",
25592 "muted",
25593 "selected"
25594 ],
25595 properties: {
25596 abbr: null,
25597 accept: commaSeparated,
25598 acceptCharset: spaceSeparated,
25599 accessKey: spaceSeparated,
25600 action: null,
25601 allow: null,
25602 allowFullScreen: boolean,
25603 allowPaymentRequest: boolean,
25604 allowUserMedia: boolean,
25605 alt: null,
25606 as: null,
25607 async: boolean,
25608 autoCapitalize: null,
25609 autoComplete: spaceSeparated,
25610 autoFocus: boolean,
25611 autoPlay: boolean,
25612 blocking: spaceSeparated,
25613 capture: null,
25614 charSet: null,
25615 checked: boolean,
25616 cite: null,
25617 className: spaceSeparated,
25618 cols: number,
25619 colSpan: null,
25620 content: null,
25621 contentEditable: booleanish,
25622 controls: boolean,
25623 controlsList: spaceSeparated,
25624 coords: number | commaSeparated,
25625 crossOrigin: null,
25626 data: null,
25627 dateTime: null,
25628 decoding: null,
25629 default: boolean,
25630 defer: boolean,
25631 dir: null,
25632 dirName: null,
25633 disabled: boolean,
25634 download: overloadedBoolean,
25635 draggable: booleanish,
25636 encType: null,
25637 enterKeyHint: null,
25638 fetchPriority: null,
25639 form: null,
25640 formAction: null,
25641 formEncType: null,
25642 formMethod: null,
25643 formNoValidate: boolean,
25644 formTarget: null,
25645 headers: spaceSeparated,
25646 height: number,
25647 hidden: boolean,
25648 high: number,
25649 href: null,
25650 hrefLang: null,
25651 htmlFor: spaceSeparated,
25652 httpEquiv: spaceSeparated,
25653 id: null,
25654 imageSizes: null,
25655 imageSrcSet: null,
25656 inert: boolean,
25657 inputMode: null,
25658 integrity: null,
25659 is: null,
25660 isMap: boolean,
25661 itemId: null,
25662 itemProp: spaceSeparated,
25663 itemRef: spaceSeparated,
25664 itemScope: boolean,
25665 itemType: spaceSeparated,
25666 kind: null,
25667 label: null,
25668 lang: null,
25669 language: null,
25670 list: null,
25671 loading: null,
25672 loop: boolean,
25673 low: number,
25674 manifest: null,
25675 max: null,
25676 maxLength: number,
25677 media: null,
25678 method: null,
25679 min: null,
25680 minLength: number,
25681 multiple: boolean,
25682 muted: boolean,
25683 name: null,
25684 nonce: null,
25685 noModule: boolean,
25686 noValidate: boolean,
25687 onAbort: null,
25688 onAfterPrint: null,
25689 onAuxClick: null,
25690 onBeforeMatch: null,
25691 onBeforePrint: null,
25692 onBeforeToggle: null,
25693 onBeforeUnload: null,
25694 onBlur: null,
25695 onCancel: null,
25696 onCanPlay: null,
25697 onCanPlayThrough: null,
25698 onChange: null,
25699 onClick: null,
25700 onClose: null,
25701 onContextLost: null,
25702 onContextMenu: null,
25703 onContextRestored: null,
25704 onCopy: null,
25705 onCueChange: null,
25706 onCut: null,
25707 onDblClick: null,
25708 onDrag: null,
25709 onDragEnd: null,
25710 onDragEnter: null,
25711 onDragExit: null,
25712 onDragLeave: null,
25713 onDragOver: null,
25714 onDragStart: null,
25715 onDrop: null,
25716 onDurationChange: null,
25717 onEmptied: null,
25718 onEnded: null,
25719 onError: null,
25720 onFocus: null,
25721 onFormData: null,
25722 onHashChange: null,
25723 onInput: null,
25724 onInvalid: null,
25725 onKeyDown: null,
25726 onKeyPress: null,
25727 onKeyUp: null,
25728 onLanguageChange: null,
25729 onLoad: null,
25730 onLoadedData: null,
25731 onLoadedMetadata: null,
25732 onLoadEnd: null,
25733 onLoadStart: null,
25734 onMessage: null,
25735 onMessageError: null,
25736 onMouseDown: null,
25737 onMouseEnter: null,
25738 onMouseLeave: null,
25739 onMouseMove: null,
25740 onMouseOut: null,
25741 onMouseOver: null,
25742 onMouseUp: null,
25743 onOffline: null,
25744 onOnline: null,
25745 onPageHide: null,
25746 onPageShow: null,
25747 onPaste: null,
25748 onPause: null,
25749 onPlay: null,
25750 onPlaying: null,
25751 onPopState: null,
25752 onProgress: null,
25753 onRateChange: null,
25754 onRejectionHandled: null,
25755 onReset: null,
25756 onResize: null,
25757 onScroll: null,
25758 onScrollEnd: null,
25759 onSecurityPolicyViolation: null,
25760 onSeeked: null,
25761 onSeeking: null,
25762 onSelect: null,
25763 onSlotChange: null,
25764 onStalled: null,
25765 onStorage: null,
25766 onSubmit: null,
25767 onSuspend: null,
25768 onTimeUpdate: null,
25769 onToggle: null,
25770 onUnhandledRejection: null,
25771 onUnload: null,
25772 onVolumeChange: null,
25773 onWaiting: null,
25774 onWheel: null,
25775 open: boolean,
25776 optimum: number,
25777 pattern: null,
25778 ping: spaceSeparated,
25779 placeholder: null,
25780 playsInline: boolean,
25781 popover: null,
25782 popoverTarget: null,
25783 popoverTargetAction: null,
25784 poster: null,
25785 preload: null,
25786 readOnly: boolean,
25787 referrerPolicy: null,
25788 rel: spaceSeparated,
25789 required: boolean,
25790 reversed: boolean,
25791 rows: number,
25792 rowSpan: number,
25793 sandbox: spaceSeparated,
25794 scope: null,
25795 scoped: boolean,
25796 seamless: boolean,
25797 selected: boolean,
25798 shadowRootClonable: boolean,
25799 shadowRootDelegatesFocus: boolean,
25800 shadowRootMode: null,
25801 shape: null,
25802 size: number,
25803 sizes: null,
25804 slot: null,
25805 span: number,
25806 spellCheck: booleanish,
25807 src: null,
25808 srcDoc: null,
25809 srcLang: null,
25810 srcSet: null,
25811 start: number,
25812 step: null,
25813 style: null,
25814 tabIndex: number,
25815 target: null,
25816 title: null,
25817 translate: null,
25818 type: null,
25819 typeMustMatch: boolean,
25820 useMap: null,
25821 value: booleanish,
25822 width: number,
25823 wrap: null,
25824 writingSuggestions: null,
25825 align: null,
25826 aLink: null,
25827 archive: spaceSeparated,
25828 axis: null,
25829 background: null,
25830 bgColor: null,
25831 border: number,
25832 borderColor: null,
25833 bottomMargin: number,
25834 cellPadding: null,
25835 cellSpacing: null,
25836 char: null,
25837 charOff: null,
25838 classId: null,
25839 clear: null,
25840 code: null,
25841 codeBase: null,
25842 codeType: null,
25843 color: null,
25844 compact: boolean,
25845 declare: boolean,
25846 event: null,
25847 face: null,
25848 frame: null,
25849 frameBorder: null,
25850 hSpace: number,
25851 leftMargin: number,
25852 link: null,
25853 longDesc: null,
25854 lowSrc: null,
25855 marginHeight: number,
25856 marginWidth: number,
25857 noResize: boolean,
25858 noHref: boolean,
25859 noShade: boolean,
25860 noWrap: boolean,
25861 object: null,
25862 profile: null,
25863 prompt: null,
25864 rev: null,
25865 rightMargin: number,
25866 rules: null,
25867 scheme: null,
25868 scrolling: booleanish,
25869 standby: null,
25870 summary: null,
25871 text: null,
25872 topMargin: number,
25873 valueType: null,
25874 version: null,
25875 vAlign: null,
25876 vLink: null,
25877 vSpace: number,
25878 allowTransparency: null,
25879 autoCorrect: null,
25880 autoSave: null,
25881 disablePictureInPicture: boolean,
25882 disableRemotePlayback: boolean,
25883 prefix: null,
25884 property: null,
25885 results: number,
25886 security: null,
25887 unselectable: null
25888 }
25889 });
25890 }));
25891
25892 //#endregion
25893 //#region node_modules/property-information/lib/svg.js
25894 var svg$1;
25895 var init_svg = __esmMin((() => {
25896 init_types();
25897 init_create();
25898 init_case_sensitive_transform();
25899 svg$1 = create({
25900 space: "svg",
25901 attributes: {
25902 accentHeight: "accent-height",
25903 alignmentBaseline: "alignment-baseline",
25904 arabicForm: "arabic-form",
25905 baselineShift: "baseline-shift",
25906 capHeight: "cap-height",
25907 className: "class",
25908 clipPath: "clip-path",
25909 clipRule: "clip-rule",
25910 colorInterpolation: "color-interpolation",
25911 colorInterpolationFilters: "color-interpolation-filters",
25912 colorProfile: "color-profile",
25913 colorRendering: "color-rendering",
25914 crossOrigin: "crossorigin",
25915 dataType: "datatype",
25916 dominantBaseline: "dominant-baseline",
25917 enableBackground: "enable-background",
25918 fillOpacity: "fill-opacity",
25919 fillRule: "fill-rule",
25920 floodColor: "flood-color",
25921 floodOpacity: "flood-opacity",
25922 fontFamily: "font-family",
25923 fontSize: "font-size",
25924 fontSizeAdjust: "font-size-adjust",
25925 fontStretch: "font-stretch",
25926 fontStyle: "font-style",
25927 fontVariant: "font-variant",
25928 fontWeight: "font-weight",
25929 glyphName: "glyph-name",
25930 glyphOrientationHorizontal: "glyph-orientation-horizontal",
25931 glyphOrientationVertical: "glyph-orientation-vertical",
25932 hrefLang: "hreflang",
25933 horizAdvX: "horiz-adv-x",
25934 horizOriginX: "horiz-origin-x",
25935 horizOriginY: "horiz-origin-y",
25936 imageRendering: "image-rendering",
25937 letterSpacing: "letter-spacing",
25938 lightingColor: "lighting-color",
25939 markerEnd: "marker-end",
25940 markerMid: "marker-mid",
25941 markerStart: "marker-start",
25942 navDown: "nav-down",
25943 navDownLeft: "nav-down-left",
25944 navDownRight: "nav-down-right",
25945 navLeft: "nav-left",
25946 navNext: "nav-next",
25947 navPrev: "nav-prev",
25948 navRight: "nav-right",
25949 navUp: "nav-up",
25950 navUpLeft: "nav-up-left",
25951 navUpRight: "nav-up-right",
25952 onAbort: "onabort",
25953 onActivate: "onactivate",
25954 onAfterPrint: "onafterprint",
25955 onBeforePrint: "onbeforeprint",
25956 onBegin: "onbegin",
25957 onCancel: "oncancel",
25958 onCanPlay: "oncanplay",
25959 onCanPlayThrough: "oncanplaythrough",
25960 onChange: "onchange",
25961 onClick: "onclick",
25962 onClose: "onclose",
25963 onCopy: "oncopy",
25964 onCueChange: "oncuechange",
25965 onCut: "oncut",
25966 onDblClick: "ondblclick",
25967 onDrag: "ondrag",
25968 onDragEnd: "ondragend",
25969 onDragEnter: "ondragenter",
25970 onDragExit: "ondragexit",
25971 onDragLeave: "ondragleave",
25972 onDragOver: "ondragover",
25973 onDragStart: "ondragstart",
25974 onDrop: "ondrop",
25975 onDurationChange: "ondurationchange",
25976 onEmptied: "onemptied",
25977 onEnd: "onend",
25978 onEnded: "onended",
25979 onError: "onerror",
25980 onFocus: "onfocus",
25981 onFocusIn: "onfocusin",
25982 onFocusOut: "onfocusout",
25983 onHashChange: "onhashchange",
25984 onInput: "oninput",
25985 onInvalid: "oninvalid",
25986 onKeyDown: "onkeydown",
25987 onKeyPress: "onkeypress",
25988 onKeyUp: "onkeyup",
25989 onLoad: "onload",
25990 onLoadedData: "onloadeddata",
25991 onLoadedMetadata: "onloadedmetadata",
25992 onLoadStart: "onloadstart",
25993 onMessage: "onmessage",
25994 onMouseDown: "onmousedown",
25995 onMouseEnter: "onmouseenter",
25996 onMouseLeave: "onmouseleave",
25997 onMouseMove: "onmousemove",
25998 onMouseOut: "onmouseout",
25999 onMouseOver: "onmouseover",
26000 onMouseUp: "onmouseup",
26001 onMouseWheel: "onmousewheel",
26002 onOffline: "onoffline",
26003 onOnline: "ononline",
26004 onPageHide: "onpagehide",
26005 onPageShow: "onpageshow",
26006 onPaste: "onpaste",
26007 onPause: "onpause",
26008 onPlay: "onplay",
26009 onPlaying: "onplaying",
26010 onPopState: "onpopstate",
26011 onProgress: "onprogress",
26012 onRateChange: "onratechange",
26013 onRepeat: "onrepeat",
26014 onReset: "onreset",
26015 onResize: "onresize",
26016 onScroll: "onscroll",
26017 onSeeked: "onseeked",
26018 onSeeking: "onseeking",
26019 onSelect: "onselect",
26020 onShow: "onshow",
26021 onStalled: "onstalled",
26022 onStorage: "onstorage",
26023 onSubmit: "onsubmit",
26024 onSuspend: "onsuspend",
26025 onTimeUpdate: "ontimeupdate",
26026 onToggle: "ontoggle",
26027 onUnload: "onunload",
26028 onVolumeChange: "onvolumechange",
26029 onWaiting: "onwaiting",
26030 onZoom: "onzoom",
26031 overlinePosition: "overline-position",
26032 overlineThickness: "overline-thickness",
26033 paintOrder: "paint-order",
26034 panose1: "panose-1",
26035 pointerEvents: "pointer-events",
26036 referrerPolicy: "referrerpolicy",
26037 renderingIntent: "rendering-intent",
26038 shapeRendering: "shape-rendering",
26039 stopColor: "stop-color",
26040 stopOpacity: "stop-opacity",
26041 strikethroughPosition: "strikethrough-position",
26042 strikethroughThickness: "strikethrough-thickness",
26043 strokeDashArray: "stroke-dasharray",
26044 strokeDashOffset: "stroke-dashoffset",
26045 strokeLineCap: "stroke-linecap",
26046 strokeLineJoin: "stroke-linejoin",
26047 strokeMiterLimit: "stroke-miterlimit",
26048 strokeOpacity: "stroke-opacity",
26049 strokeWidth: "stroke-width",
26050 tabIndex: "tabindex",
26051 textAnchor: "text-anchor",
26052 textDecoration: "text-decoration",
26053 textRendering: "text-rendering",
26054 transformOrigin: "transform-origin",
26055 typeOf: "typeof",
26056 underlinePosition: "underline-position",
26057 underlineThickness: "underline-thickness",
26058 unicodeBidi: "unicode-bidi",
26059 unicodeRange: "unicode-range",
26060 unitsPerEm: "units-per-em",
26061 vAlphabetic: "v-alphabetic",
26062 vHanging: "v-hanging",
26063 vIdeographic: "v-ideographic",
26064 vMathematical: "v-mathematical",
26065 vectorEffect: "vector-effect",
26066 vertAdvY: "vert-adv-y",
26067 vertOriginX: "vert-origin-x",
26068 vertOriginY: "vert-origin-y",
26069 wordSpacing: "word-spacing",
26070 writingMode: "writing-mode",
26071 xHeight: "x-height",
26072 playbackOrder: "playbackorder",
26073 timelineBegin: "timelinebegin"
26074 },
26075 transform: caseSensitiveTransform,
26076 properties: {
26077 about: commaOrSpaceSeparated,
26078 accentHeight: number,
26079 accumulate: null,
26080 additive: null,
26081 alignmentBaseline: null,
26082 alphabetic: number,
26083 amplitude: number,
26084 arabicForm: null,
26085 ascent: number,
26086 attributeName: null,
26087 attributeType: null,
26088 azimuth: number,
26089 bandwidth: null,
26090 baselineShift: null,
26091 baseFrequency: null,
26092 baseProfile: null,
26093 bbox: null,
26094 begin: null,
26095 bias: number,
26096 by: null,
26097 calcMode: null,
26098 capHeight: number,
26099 className: spaceSeparated,
26100 clip: null,
26101 clipPath: null,
26102 clipPathUnits: null,
26103 clipRule: null,
26104 color: null,
26105 colorInterpolation: null,
26106 colorInterpolationFilters: null,
26107 colorProfile: null,
26108 colorRendering: null,
26109 content: null,
26110 contentScriptType: null,
26111 contentStyleType: null,
26112 crossOrigin: null,
26113 cursor: null,
26114 cx: null,
26115 cy: null,
26116 d: null,
26117 dataType: null,
26118 defaultAction: null,
26119 descent: number,
26120 diffuseConstant: number,
26121 direction: null,
26122 display: null,
26123 dur: null,
26124 divisor: number,
26125 dominantBaseline: null,
26126 download: boolean,
26127 dx: null,
26128 dy: null,
26129 edgeMode: null,
26130 editable: null,
26131 elevation: number,
26132 enableBackground: null,
26133 end: null,
26134 event: null,
26135 exponent: number,
26136 externalResourcesRequired: null,
26137 fill: null,
26138 fillOpacity: number,
26139 fillRule: null,
26140 filter: null,
26141 filterRes: null,
26142 filterUnits: null,
26143 floodColor: null,
26144 floodOpacity: null,
26145 focusable: null,
26146 focusHighlight: null,
26147 fontFamily: null,
26148 fontSize: null,
26149 fontSizeAdjust: null,
26150 fontStretch: null,
26151 fontStyle: null,
26152 fontVariant: null,
26153 fontWeight: null,
26154 format: null,
26155 fr: null,
26156 from: null,
26157 fx: null,
26158 fy: null,
26159 g1: commaSeparated,
26160 g2: commaSeparated,
26161 glyphName: commaSeparated,
26162 glyphOrientationHorizontal: null,
26163 glyphOrientationVertical: null,
26164 glyphRef: null,
26165 gradientTransform: null,
26166 gradientUnits: null,
26167 handler: null,
26168 hanging: number,
26169 hatchContentUnits: null,
26170 hatchUnits: null,
26171 height: null,
26172 href: null,
26173 hrefLang: null,
26174 horizAdvX: number,
26175 horizOriginX: number,
26176 horizOriginY: number,
26177 id: null,
26178 ideographic: number,
26179 imageRendering: null,
26180 initialVisibility: null,
26181 in: null,
26182 in2: null,
26183 intercept: number,
26184 k: number,
26185 k1: number,
26186 k2: number,
26187 k3: number,
26188 k4: number,
26189 kernelMatrix: commaOrSpaceSeparated,
26190 kernelUnitLength: null,
26191 keyPoints: null,
26192 keySplines: null,
26193 keyTimes: null,
26194 kerning: null,
26195 lang: null,
26196 lengthAdjust: null,
26197 letterSpacing: null,
26198 lightingColor: null,
26199 limitingConeAngle: number,
26200 local: null,
26201 markerEnd: null,
26202 markerMid: null,
26203 markerStart: null,
26204 markerHeight: null,
26205 markerUnits: null,
26206 markerWidth: null,
26207 mask: null,
26208 maskContentUnits: null,
26209 maskUnits: null,
26210 mathematical: null,
26211 max: null,
26212 media: null,
26213 mediaCharacterEncoding: null,
26214 mediaContentEncodings: null,
26215 mediaSize: number,
26216 mediaTime: null,
26217 method: null,
26218 min: null,
26219 mode: null,
26220 name: null,
26221 navDown: null,
26222 navDownLeft: null,
26223 navDownRight: null,
26224 navLeft: null,
26225 navNext: null,
26226 navPrev: null,
26227 navRight: null,
26228 navUp: null,
26229 navUpLeft: null,
26230 navUpRight: null,
26231 numOctaves: null,
26232 observer: null,
26233 offset: null,
26234 onAbort: null,
26235 onActivate: null,
26236 onAfterPrint: null,
26237 onBeforePrint: null,
26238 onBegin: null,
26239 onCancel: null,
26240 onCanPlay: null,
26241 onCanPlayThrough: null,
26242 onChange: null,
26243 onClick: null,
26244 onClose: null,
26245 onCopy: null,
26246 onCueChange: null,
26247 onCut: null,
26248 onDblClick: null,
26249 onDrag: null,
26250 onDragEnd: null,
26251 onDragEnter: null,
26252 onDragExit: null,
26253 onDragLeave: null,
26254 onDragOver: null,
26255 onDragStart: null,
26256 onDrop: null,
26257 onDurationChange: null,
26258 onEmptied: null,
26259 onEnd: null,
26260 onEnded: null,
26261 onError: null,
26262 onFocus: null,
26263 onFocusIn: null,
26264 onFocusOut: null,
26265 onHashChange: null,
26266 onInput: null,
26267 onInvalid: null,
26268 onKeyDown: null,
26269 onKeyPress: null,
26270 onKeyUp: null,
26271 onLoad: null,
26272 onLoadedData: null,
26273 onLoadedMetadata: null,
26274 onLoadStart: null,
26275 onMessage: null,
26276 onMouseDown: null,
26277 onMouseEnter: null,
26278 onMouseLeave: null,
26279 onMouseMove: null,
26280 onMouseOut: null,
26281 onMouseOver: null,
26282 onMouseUp: null,
26283 onMouseWheel: null,
26284 onOffline: null,
26285 onOnline: null,
26286 onPageHide: null,
26287 onPageShow: null,
26288 onPaste: null,
26289 onPause: null,
26290 onPlay: null,
26291 onPlaying: null,
26292 onPopState: null,
26293 onProgress: null,
26294 onRateChange: null,
26295 onRepeat: null,
26296 onReset: null,
26297 onResize: null,
26298 onScroll: null,
26299 onSeeked: null,
26300 onSeeking: null,
26301 onSelect: null,
26302 onShow: null,
26303 onStalled: null,
26304 onStorage: null,
26305 onSubmit: null,
26306 onSuspend: null,
26307 onTimeUpdate: null,
26308 onToggle: null,
26309 onUnload: null,
26310 onVolumeChange: null,
26311 onWaiting: null,
26312 onZoom: null,
26313 opacity: null,
26314 operator: null,
26315 order: null,
26316 orient: null,
26317 orientation: null,
26318 origin: null,
26319 overflow: null,
26320 overlay: null,
26321 overlinePosition: number,
26322 overlineThickness: number,
26323 paintOrder: null,
26324 panose1: null,
26325 path: null,
26326 pathLength: number,
26327 patternContentUnits: null,
26328 patternTransform: null,
26329 patternUnits: null,
26330 phase: null,
26331 ping: spaceSeparated,
26332 pitch: null,
26333 playbackOrder: null,
26334 pointerEvents: null,
26335 points: null,
26336 pointsAtX: number,
26337 pointsAtY: number,
26338 pointsAtZ: number,
26339 preserveAlpha: null,
26340 preserveAspectRatio: null,
26341 primitiveUnits: null,
26342 propagate: null,
26343 property: commaOrSpaceSeparated,
26344 r: null,
26345 radius: null,
26346 referrerPolicy: null,
26347 refX: null,
26348 refY: null,
26349 rel: commaOrSpaceSeparated,
26350 rev: commaOrSpaceSeparated,
26351 renderingIntent: null,
26352 repeatCount: null,
26353 repeatDur: null,
26354 requiredExtensions: commaOrSpaceSeparated,
26355 requiredFeatures: commaOrSpaceSeparated,
26356 requiredFonts: commaOrSpaceSeparated,
26357 requiredFormats: commaOrSpaceSeparated,
26358 resource: null,
26359 restart: null,
26360 result: null,
26361 rotate: null,
26362 rx: null,
26363 ry: null,
26364 scale: null,
26365 seed: null,
26366 shapeRendering: null,
26367 side: null,
26368 slope: null,
26369 snapshotTime: null,
26370 specularConstant: number,
26371 specularExponent: number,
26372 spreadMethod: null,
26373 spacing: null,
26374 startOffset: null,
26375 stdDeviation: null,
26376 stemh: null,
26377 stemv: null,
26378 stitchTiles: null,
26379 stopColor: null,
26380 stopOpacity: null,
26381 strikethroughPosition: number,
26382 strikethroughThickness: number,
26383 string: null,
26384 stroke: null,
26385 strokeDashArray: commaOrSpaceSeparated,
26386 strokeDashOffset: null,
26387 strokeLineCap: null,
26388 strokeLineJoin: null,
26389 strokeMiterLimit: number,
26390 strokeOpacity: number,
26391 strokeWidth: null,
26392 style: null,
26393 surfaceScale: number,
26394 syncBehavior: null,
26395 syncBehaviorDefault: null,
26396 syncMaster: null,
26397 syncTolerance: null,
26398 syncToleranceDefault: null,
26399 systemLanguage: commaOrSpaceSeparated,
26400 tabIndex: number,
26401 tableValues: null,
26402 target: null,
26403 targetX: number,
26404 targetY: number,
26405 textAnchor: null,
26406 textDecoration: null,
26407 textRendering: null,
26408 textLength: null,
26409 timelineBegin: null,
26410 title: null,
26411 transformBehavior: null,
26412 type: null,
26413 typeOf: commaOrSpaceSeparated,
26414 to: null,
26415 transform: null,
26416 transformOrigin: null,
26417 u1: null,
26418 u2: null,
26419 underlinePosition: number,
26420 underlineThickness: number,
26421 unicode: null,
26422 unicodeBidi: null,
26423 unicodeRange: null,
26424 unitsPerEm: number,
26425 values: null,
26426 vAlphabetic: number,
26427 vMathematical: number,
26428 vectorEffect: null,
26429 vHanging: number,
26430 vIdeographic: number,
26431 version: null,
26432 vertAdvY: number,
26433 vertOriginX: number,
26434 vertOriginY: number,
26435 viewBox: null,
26436 viewTarget: null,
26437 visibility: null,
26438 width: null,
26439 widths: null,
26440 wordSpacing: null,
26441 writingMode: null,
26442 x: null,
26443 x1: null,
26444 x2: null,
26445 xChannelSelector: null,
26446 xHeight: number,
26447 y: null,
26448 y1: null,
26449 y2: null,
26450 yChannelSelector: null,
26451 z: null,
26452 zoomAndPan: null
26453 }
26454 });
26455 }));
26456
26457 //#endregion
26458 //#region node_modules/property-information/lib/find.js
26459 /**
26460 * @param {Schema} schema
26461 * @param {string} value
26462 * @returns {Info}
26463 */
26464 function find(schema, value) {
26465 const normal = normalize(value);
26466 let prop = value;
26467 let Type = Info;
26468 if (normal in schema.normal) return schema.property[schema.normal[normal]];
26469 if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) {
26470 if (value.charAt(4) === "-") {
26471 const rest = value.slice(5).replace(dash, camelcase);
26472 prop = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
26473 } else {
26474 const rest = value.slice(4);
26475 if (!dash.test(rest)) {
26476 let dashes = rest.replace(cap, kebab);
26477 if (dashes.charAt(0) !== "-") dashes = "-" + dashes;
26478 value = "data" + dashes;
26479 }
26480 }
26481 Type = DefinedInfo;
26482 }
26483 return new Type(prop, value);
26484 }
26485 /**
26486 * @param {string} $0
26487 * @returns {string}
26488 */
26489 function kebab($0) {
26490 return "-" + $0.toLowerCase();
26491 }
26492 /**
26493 * @param {string} $0
26494 * @returns {string}
26495 */
26496 function camelcase($0) {
26497 return $0.charAt(1).toUpperCase();
26498 }
26499 var valid, dash, cap;
26500 var init_find = __esmMin((() => {
26501 init_normalize();
26502 init_defined_info();
26503 init_info();
26504 valid = /^data[-\w.:]+$/i;
26505 dash = /-[a-z]/g;
26506 cap = /[A-Z]/g;
26507 }));
26508
26509 //#endregion
26510 //#region node_modules/property-information/lib/hast-to-react.js
26511 var hastToReact;
26512 var init_hast_to_react = __esmMin((() => {
26513 hastToReact = {
26514 classId: "classID",
26515 dataType: "datatype",
26516 itemId: "itemID",
26517 strokeDashArray: "strokeDasharray",
26518 strokeDashOffset: "strokeDashoffset",
26519 strokeLineCap: "strokeLinecap",
26520 strokeLineJoin: "strokeLinejoin",
26521 strokeMiterLimit: "strokeMiterlimit",
26522 typeOf: "typeof",
26523 xLinkActuate: "xlinkActuate",
26524 xLinkArcRole: "xlinkArcrole",
26525 xLinkHref: "xlinkHref",
26526 xLinkRole: "xlinkRole",
26527 xLinkShow: "xlinkShow",
26528 xLinkTitle: "xlinkTitle",
26529 xLinkType: "xlinkType",
26530 xmlnsXLink: "xmlnsXlink"
26531 };
26532 }));
26533
26534 //#endregion
26535 //#region node_modules/property-information/index.js
26536 var html, svg;
26537 var init_property_information = __esmMin((() => {
26538 init_merge();
26539 init_xlink();
26540 init_xml();
26541 init_xmlns();
26542 init_aria();
26543 init_html();
26544 init_svg();
26545 init_find();
26546 init_hast_to_react();
26547 init_normalize();
26548 html = merge([
26549 xml,
26550 xlink,
26551 xmlns,
26552 aria,
26553 html$1
26554 ], "html");
26555 svg = merge([
26556 xml,
26557 xlink,
26558 xmlns,
26559 aria,
26560 svg$1
26561 ], "svg");
26562 }));
26563
26564 //#endregion
26565 //#region node_modules/react-markdown/lib/rehype-filter.js
26566 /**
26567 * @typedef {import('unist').Node} Node
26568 * @typedef {import('hast').Root} Root
26569 * @typedef {import('hast').Element} Element
26570 *
26571 * @callback AllowElement
26572 * @param {Element} element
26573 * @param {number} index
26574 * @param {Element|Root} parent
26575 * @returns {boolean|undefined}
26576 *
26577 * @typedef Options
26578 * @property {Array<string>} [allowedElements]
26579 * @property {Array<string>} [disallowedElements=[]]
26580 * @property {AllowElement} [allowElement]
26581 * @property {boolean} [unwrapDisallowed=false]
26582 */
26583 /**
26584 * @type {import('unified').Plugin<[Options], Root>}
26585 */
26586 function rehypeFilter(options) {
26587 if (options.allowedElements && options.disallowedElements) throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");
26588 if (options.allowedElements || options.disallowedElements || options.allowElement) return (tree) => {
26589 visit(tree, "element", (node, index, parent_) => {
26590 const parent = parent_;
26591 /** @type {boolean|undefined} */
26592 let remove;
26593 if (options.allowedElements) remove = !options.allowedElements.includes(node.tagName);
26594 else if (options.disallowedElements) remove = options.disallowedElements.includes(node.tagName);
26595 if (!remove && options.allowElement && typeof index === "number") remove = !options.allowElement(node, index, parent);
26596 if (remove && typeof index === "number") {
26597 if (options.unwrapDisallowed && node.children) parent.children.splice(index, 1, ...node.children);
26598 else parent.children.splice(index, 1);
26599 return index;
26600 }
26601 });
26602 };
26603 }
26604 var init_rehype_filter = __esmMin((() => {
26605 init_unist_util_visit();
26606 }));
26607
26608 //#endregion
26609 //#region node_modules/react-is/cjs/react-is.development.js
26610 /**
26611 * @license React
26612 * react-is.development.js
26613 *
26614 * Copyright (c) Facebook, Inc. and its affiliates.
26615 *
26616 * This source code is licensed under the MIT license found in the
26617 * LICENSE file in the root directory of this source tree.
26618 */
26619 var require_react_is_development = /* @__PURE__ */ __commonJSMin(((exports) => {
26620 (function() {
26621 "use strict";
26622 var REACT_ELEMENT_TYPE = Symbol.for("react.element");
26623 var REACT_PORTAL_TYPE = Symbol.for("react.portal");
26624 var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
26625 var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
26626 var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
26627 var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
26628 var REACT_CONTEXT_TYPE = Symbol.for("react.context");
26629 var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
26630 var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
26631 var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
26632 var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
26633 var REACT_MEMO_TYPE = Symbol.for("react.memo");
26634 var REACT_LAZY_TYPE = Symbol.for("react.lazy");
26635 var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
26636 var enableScopeAPI = false;
26637 var enableCacheElement = false;
26638 var enableTransitionTracing = false;
26639 var enableLegacyHidden = false;
26640 var enableDebugTracing = false;
26641 var REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
26642 function isValidElementType(type) {
26643 if (typeof type === "string" || typeof type === "function") return true;
26644 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) return true;
26645 if (typeof type === "object" && type !== null) {
26646 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) return true;
26647 }
26648 return false;
26649 }
26650 function typeOf(object) {
26651 if (typeof object === "object" && object !== null) {
26652 var $$typeof = object.$$typeof;
26653 switch ($$typeof) {
26654 case REACT_ELEMENT_TYPE:
26655 var type = object.type;
26656 switch (type) {
26657 case REACT_FRAGMENT_TYPE:
26658 case REACT_PROFILER_TYPE:
26659 case REACT_STRICT_MODE_TYPE:
26660 case REACT_SUSPENSE_TYPE:
26661 case REACT_SUSPENSE_LIST_TYPE: return type;
26662 default:
26663 var $$typeofType = type && type.$$typeof;
26664 switch ($$typeofType) {
26665 case REACT_SERVER_CONTEXT_TYPE:
26666 case REACT_CONTEXT_TYPE:
26667 case REACT_FORWARD_REF_TYPE:
26668 case REACT_LAZY_TYPE:
26669 case REACT_MEMO_TYPE:
26670 case REACT_PROVIDER_TYPE: return $$typeofType;
26671 default: return $$typeof;
26672 }
26673 }
26674 case REACT_PORTAL_TYPE: return $$typeof;
26675 }
26676 }
26677 }
26678 var ContextConsumer = REACT_CONTEXT_TYPE;
26679 var ContextProvider = REACT_PROVIDER_TYPE;
26680 var Element = REACT_ELEMENT_TYPE;
26681 var ForwardRef = REACT_FORWARD_REF_TYPE;
26682 var Fragment = REACT_FRAGMENT_TYPE;
26683 var Lazy = REACT_LAZY_TYPE;
26684 var Memo = REACT_MEMO_TYPE;
26685 var Portal = REACT_PORTAL_TYPE;
26686 var Profiler = REACT_PROFILER_TYPE;
26687 var StrictMode = REACT_STRICT_MODE_TYPE;
26688 var Suspense = REACT_SUSPENSE_TYPE;
26689 var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
26690 var hasWarnedAboutDeprecatedIsAsyncMode = false;
26691 var hasWarnedAboutDeprecatedIsConcurrentMode = false;
26692 function isAsyncMode(object) {
26693 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
26694 hasWarnedAboutDeprecatedIsAsyncMode = true;
26695 console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
26696 }
26697 return false;
26698 }
26699 function isConcurrentMode(object) {
26700 if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
26701 hasWarnedAboutDeprecatedIsConcurrentMode = true;
26702 console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
26703 }
26704 return false;
26705 }
26706 function isContextConsumer(object) {
26707 return typeOf(object) === REACT_CONTEXT_TYPE;
26708 }
26709 function isContextProvider(object) {
26710 return typeOf(object) === REACT_PROVIDER_TYPE;
26711 }
26712 function isElement(object) {
26713 return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
26714 }
26715 function isForwardRef(object) {
26716 return typeOf(object) === REACT_FORWARD_REF_TYPE;
26717 }
26718 function isFragment(object) {
26719 return typeOf(object) === REACT_FRAGMENT_TYPE;
26720 }
26721 function isLazy(object) {
26722 return typeOf(object) === REACT_LAZY_TYPE;
26723 }
26724 function isMemo(object) {
26725 return typeOf(object) === REACT_MEMO_TYPE;
26726 }
26727 function isPortal(object) {
26728 return typeOf(object) === REACT_PORTAL_TYPE;
26729 }
26730 function isProfiler(object) {
26731 return typeOf(object) === REACT_PROFILER_TYPE;
26732 }
26733 function isStrictMode(object) {
26734 return typeOf(object) === REACT_STRICT_MODE_TYPE;
26735 }
26736 function isSuspense(object) {
26737 return typeOf(object) === REACT_SUSPENSE_TYPE;
26738 }
26739 function isSuspenseList(object) {
26740 return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
26741 }
26742 exports.ContextConsumer = ContextConsumer;
26743 exports.ContextProvider = ContextProvider;
26744 exports.Element = Element;
26745 exports.ForwardRef = ForwardRef;
26746 exports.Fragment = Fragment;
26747 exports.Lazy = Lazy;
26748 exports.Memo = Memo;
26749 exports.Portal = Portal;
26750 exports.Profiler = Profiler;
26751 exports.StrictMode = StrictMode;
26752 exports.Suspense = Suspense;
26753 exports.SuspenseList = SuspenseList;
26754 exports.isAsyncMode = isAsyncMode;
26755 exports.isConcurrentMode = isConcurrentMode;
26756 exports.isContextConsumer = isContextConsumer;
26757 exports.isContextProvider = isContextProvider;
26758 exports.isElement = isElement;
26759 exports.isForwardRef = isForwardRef;
26760 exports.isFragment = isFragment;
26761 exports.isLazy = isLazy;
26762 exports.isMemo = isMemo;
26763 exports.isPortal = isPortal;
26764 exports.isProfiler = isProfiler;
26765 exports.isStrictMode = isStrictMode;
26766 exports.isSuspense = isSuspense;
26767 exports.isSuspenseList = isSuspenseList;
26768 exports.isValidElementType = isValidElementType;
26769 exports.typeOf = typeOf;
26770 })();
26771 }));
26772
26773 //#endregion
26774 //#region node_modules/react-is/index.js
26775 var require_react_is = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26776 module.exports = require_react_is_development();
26777 }));
26778
26779 //#endregion
26780 //#region node_modules/hast-util-whitespace/index.js
26781 /**
26782 * Check if the given value is *inter-element whitespace*.
26783 *
26784 * @param {unknown} thing
26785 * Thing to check (typically `Node` or `string`).
26786 * @returns {boolean}
26787 * Whether the `value` is inter-element whitespace (`boolean`): consisting of
26788 * zero or more of space, tab (`\t`), line feed (`\n`), carriage return
26789 * (`\r`), or form feed (`\f`).
26790 * If a node is passed it must be a `Text` node, whose `value` field is
26791 * checked.
26792 */
26793 function whitespace(thing) {
26794 /** @type {string} */
26795 const value = thing && typeof thing === "object" && thing.type === "text" ? thing.value || "" : thing;
26796 return typeof value === "string" && value.replace(/[ \t\n\f\r]/g, "") === "";
26797 }
26798 var init_hast_util_whitespace = __esmMin((() => {}));
26799
26800 //#endregion
26801 //#region node_modules/space-separated-tokens/index.js
26802 /**
26803 * Serialize an array of strings as space separated-tokens.
26804 *
26805 * @param {Array<string|number>} values
26806 * List of tokens.
26807 * @returns {string}
26808 * Space-separated tokens.
26809 */
26810 function stringify$1(values) {
26811 return values.join(" ").trim();
26812 }
26813 var init_space_separated_tokens = __esmMin((() => {
26814 __name(stringify$1, "stringify");
26815 }));
26816
26817 //#endregion
26818 //#region node_modules/comma-separated-tokens/index.js
26819 /**
26820 * Serialize an array of strings or numbers to comma-separated tokens.
26821 *
26822 * @param {Array<string|number>} values
26823 * List of tokens.
26824 * @param {Options} [options]
26825 * Configuration for `stringify` (optional).
26826 * @returns {string}
26827 * Comma-separated tokens.
26828 */
26829 function stringify(values, options) {
26830 const settings = options || {};
26831 return (values[values.length - 1] === "" ? [...values, ""] : values).join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim();
26832 }
26833 var init_comma_separated_tokens = __esmMin((() => {}));
26834
26835 //#endregion
26836 //#region node_modules/inline-style-parser/index.js
26837 var require_inline_style_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26838 var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
26839 var NEWLINE_REGEX = /\n/g;
26840 var WHITESPACE_REGEX = /^\s*/;
26841 var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
26842 var COLON_REGEX = /^:\s*/;
26843 var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
26844 var SEMICOLON_REGEX = /^[;\s]*/;
26845 var TRIM_REGEX = /^\s+|\s+$/g;
26846 var NEWLINE = "\n";
26847 var FORWARD_SLASH = "/";
26848 var ASTERISK = "*";
26849 var EMPTY_STRING = "";
26850 var TYPE_COMMENT = "comment";
26851 var TYPE_DECLARATION = "declaration";
26852 /**
26853 * @param {String} style
26854 * @param {Object} [options]
26855 * @return {Object[]}
26856 * @throws {TypeError}
26857 * @throws {Error}
26858 */
26859 module.exports = function(style, options) {
26860 if (typeof style !== "string") throw new TypeError("First argument must be a string");
26861 if (!style) return [];
26862 options = options || {};
26863 /**
26864 * Positional.
26865 */
26866 var lineno = 1;
26867 var column = 1;
26868 /**
26869 * Update lineno and column based on `str`.
26870 *
26871 * @param {String} str
26872 */
26873 function updatePosition(str) {
26874 var lines = str.match(NEWLINE_REGEX);
26875 if (lines) lineno += lines.length;
26876 var i = str.lastIndexOf(NEWLINE);
26877 column = ~i ? str.length - i : column + str.length;
26878 }
26879 /**
26880 * Mark position and patch `node.position`.
26881 *
26882 * @return {Function}
26883 */
26884 function position() {
26885 var start = {
26886 line: lineno,
26887 column
26888 };
26889 return function(node) {
26890 node.position = new Position(start);
26891 whitespace();
26892 return node;
26893 };
26894 }
26895 /**
26896 * Store position information for a node.
26897 *
26898 * @constructor
26899 * @property {Object} start
26900 * @property {Object} end
26901 * @property {undefined|String} source
26902 */
26903 function Position(start) {
26904 this.start = start;
26905 this.end = {
26906 line: lineno,
26907 column
26908 };
26909 this.source = options.source;
26910 }
26911 /**
26912 * Non-enumerable source string.
26913 */
26914 Position.prototype.content = style;
26915 var errorsList = [];
26916 /**
26917 * Error `msg`.
26918 *
26919 * @param {String} msg
26920 * @throws {Error}
26921 */
26922 function error(msg) {
26923 var err = /* @__PURE__ */ new Error(options.source + ":" + lineno + ":" + column + ": " + msg);
26924 err.reason = msg;
26925 err.filename = options.source;
26926 err.line = lineno;
26927 err.column = column;
26928 err.source = style;
26929 if (options.silent) errorsList.push(err);
26930 else throw err;
26931 }
26932 /**
26933 * Match `re` and return captures.
26934 *
26935 * @param {RegExp} re
26936 * @return {undefined|Array}
26937 */
26938 function match(re) {
26939 var m = re.exec(style);
26940 if (!m) return;
26941 var str = m[0];
26942 updatePosition(str);
26943 style = style.slice(str.length);
26944 return m;
26945 }
26946 /**
26947 * Parse whitespace.
26948 */
26949 function whitespace() {
26950 match(WHITESPACE_REGEX);
26951 }
26952 /**
26953 * Parse comments.
26954 *
26955 * @param {Object[]} [rules]
26956 * @return {Object[]}
26957 */
26958 function comments(rules) {
26959 var c;
26960 rules = rules || [];
26961 while (c = comment()) if (c !== false) rules.push(c);
26962 return rules;
26963 }
26964 /**
26965 * Parse comment.
26966 *
26967 * @return {Object}
26968 * @throws {Error}
26969 */
26970 function comment() {
26971 var pos = position();
26972 if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
26973 var i = 2;
26974 while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) ++i;
26975 i += 2;
26976 if (EMPTY_STRING === style.charAt(i - 1)) return error("End of comment missing");
26977 var str = style.slice(2, i - 2);
26978 column += 2;
26979 updatePosition(str);
26980 style = style.slice(i);
26981 column += 2;
26982 return pos({
26983 type: TYPE_COMMENT,
26984 comment: str
26985 });
26986 }
26987 /**
26988 * Parse declaration.
26989 *
26990 * @return {Object}
26991 * @throws {Error}
26992 */
26993 function declaration() {
26994 var pos = position();
26995 var prop = match(PROPERTY_REGEX);
26996 if (!prop) return;
26997 comment();
26998 if (!match(COLON_REGEX)) return error("property missing ':'");
26999 var val = match(VALUE_REGEX);
27000 var ret = pos({
27001 type: TYPE_DECLARATION,
27002 property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
27003 value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
27004 });
27005 match(SEMICOLON_REGEX);
27006 return ret;
27007 }
27008 /**
27009 * Parse declarations.
27010 *
27011 * @return {Object[]}
27012 */
27013 function declarations() {
27014 var decls = [];
27015 comments(decls);
27016 var decl;
27017 while (decl = declaration()) if (decl !== false) {
27018 decls.push(decl);
27019 comments(decls);
27020 }
27021 return decls;
27022 }
27023 whitespace();
27024 return declarations();
27025 };
27026 /**
27027 * Trim `str`.
27028 *
27029 * @param {String} str
27030 * @return {String}
27031 */
27032 function trim(str) {
27033 return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
27034 }
27035 }));
27036
27037 //#endregion
27038 //#region node_modules/style-to-object/index.js
27039 var require_style_to_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27040 var parse = require_inline_style_parser();
27041 /**
27042 * Parses inline style to object.
27043 *
27044 * @example
27045 * // returns { 'line-height': '42' }
27046 * StyleToObject('line-height: 42;');
27047 *
27048 * @param {String} style - The inline style.
27049 * @param {Function} [iterator] - The iterator function.
27050 * @return {null|Object}
27051 */
27052 function StyleToObject(style, iterator) {
27053 var output = null;
27054 if (!style || typeof style !== "string") return output;
27055 var declaration;
27056 var declarations = parse(style);
27057 var hasIterator = typeof iterator === "function";
27058 var property;
27059 var value;
27060 for (var i = 0, len = declarations.length; i < len; i++) {
27061 declaration = declarations[i];
27062 property = declaration.property;
27063 value = declaration.value;
27064 if (hasIterator) iterator(property, value, declaration);
27065 else if (value) {
27066 output || (output = {});
27067 output[property] = value;
27068 }
27069 }
27070 return output;
27071 }
27072 module.exports = StyleToObject;
27073 module.exports.default = StyleToObject;
27074 }));
27075
27076 //#endregion
27077 //#region node_modules/style-to-object/index.mjs
27078 var import_style_to_object, style_to_object_default;
27079 var init_style_to_object = __esmMin((() => {
27080 import_style_to_object = /* @__PURE__ */ __toESM(require_style_to_object(), 1);
27081 style_to_object_default = import_style_to_object.default;
27082 }));
27083
27084 //#endregion
27085 //#region node_modules/react-markdown/lib/ast-to-react.js
27086 /**
27087 * @template T
27088 * @typedef {Promise.resolve(React).ComponentType<T>} ComponentType<T>
27089 */
27090 /**
27091 * @template {Promise.resolve(React).ElementType} T
27092 * @typedef {Promise.resolve(React).ComponentPropsWithoutRef<T>} ComponentPropsWithoutRef<T>
27093 */
27094 /**
27095 * @typedef {Promise.resolve(React).ReactNode} ReactNode
27096 * @typedef {import('unist').Position} Position
27097 * @typedef {import('hast').Element} Element
27098 * @typedef {import('hast').ElementContent} ElementContent
27099 * @typedef {import('hast').Root} Root
27100 * @typedef {import('hast').Text} Text
27101 * @typedef {import('hast').Comment} Comment
27102 * @typedef {import('hast').DocType} Doctype
27103 * @typedef {import('property-information').Info} Info
27104 * @typedef {import('property-information').Schema} Schema
27105 * @typedef {import('./complex-types.js').ReactMarkdownProps} ReactMarkdownProps
27106 *
27107 * @typedef Raw
27108 * @property {'raw'} type
27109 * @property {string} value
27110 *
27111 * @typedef Context
27112 * @property {Options} options
27113 * @property {Schema} schema
27114 * @property {number} listDepth
27115 *
27116 * @callback TransformLink
27117 * @param {string} href
27118 * @param {Array<ElementContent>} children
27119 * @param {string?} title
27120 * @returns {string}
27121 *
27122 * @callback TransformImage
27123 * @param {string} src
27124 * @param {string} alt
27125 * @param {string?} title
27126 * @returns {string}
27127 *
27128 * @typedef {Promise.resolve(React).HTMLAttributeAnchorTarget} TransformLinkTargetType
27129 *
27130 * @callback TransformLinkTarget
27131 * @param {string} href
27132 * @param {Array<ElementContent>} children
27133 * @param {string?} title
27134 * @returns {TransformLinkTargetType|undefined}
27135 *
27136 * @typedef {keyof JSX.IntrinsicElements} ReactMarkdownNames
27137 *
27138 * To do: is `data-sourcepos` typeable?
27139 *
27140 * @typedef {ComponentPropsWithoutRef<'code'> & ReactMarkdownProps & {inline?: boolean}} CodeProps
27141 * @typedef {ComponentPropsWithoutRef<'h1'> & ReactMarkdownProps & {level: number}} HeadingProps
27142 * @typedef {ComponentPropsWithoutRef<'li'> & ReactMarkdownProps & {checked: boolean|null, index: number, ordered: boolean}} LiProps
27143 * @typedef {ComponentPropsWithoutRef<'ol'> & ReactMarkdownProps & {depth: number, ordered: true}} OrderedListProps
27144 * @typedef {ComponentPropsWithoutRef<'td'> & ReactMarkdownProps & {style?: Record<string, unknown>, isHeader: false}} TableDataCellProps
27145 * @typedef {ComponentPropsWithoutRef<'th'> & ReactMarkdownProps & {style?: Record<string, unknown>, isHeader: true}} TableHeaderCellProps
27146 * @typedef {ComponentPropsWithoutRef<'tr'> & ReactMarkdownProps & {isHeader: boolean}} TableRowProps
27147 * @typedef {ComponentPropsWithoutRef<'ul'> & ReactMarkdownProps & {depth: number, ordered: false}} UnorderedListProps
27148 *
27149 * @typedef {ComponentType<CodeProps>} CodeComponent
27150 * @typedef {ComponentType<HeadingProps>} HeadingComponent
27151 * @typedef {ComponentType<LiProps>} LiComponent
27152 * @typedef {ComponentType<OrderedListProps>} OrderedListComponent
27153 * @typedef {ComponentType<TableDataCellProps>} TableDataCellComponent
27154 * @typedef {ComponentType<TableHeaderCellProps>} TableHeaderCellComponent
27155 * @typedef {ComponentType<TableRowProps>} TableRowComponent
27156 * @typedef {ComponentType<UnorderedListProps>} UnorderedListComponent
27157 *
27158 * @typedef SpecialComponents
27159 * @property {CodeComponent|ReactMarkdownNames} code
27160 * @property {HeadingComponent|ReactMarkdownNames} h1
27161 * @property {HeadingComponent|ReactMarkdownNames} h2
27162 * @property {HeadingComponent|ReactMarkdownNames} h3
27163 * @property {HeadingComponent|ReactMarkdownNames} h4
27164 * @property {HeadingComponent|ReactMarkdownNames} h5
27165 * @property {HeadingComponent|ReactMarkdownNames} h6
27166 * @property {LiComponent|ReactMarkdownNames} li
27167 * @property {OrderedListComponent|ReactMarkdownNames} ol
27168 * @property {TableDataCellComponent|ReactMarkdownNames} td
27169 * @property {TableHeaderCellComponent|ReactMarkdownNames} th
27170 * @property {TableRowComponent|ReactMarkdownNames} tr
27171 * @property {UnorderedListComponent|ReactMarkdownNames} ul
27172 *
27173 * @typedef {Partial<Omit<import('./complex-types.js').NormalComponents, keyof SpecialComponents> & SpecialComponents>} Components
27174 *
27175 * @typedef Options
27176 * @property {boolean} [sourcePos=false]
27177 * @property {boolean} [rawSourcePos=false]
27178 * @property {boolean} [skipHtml=false]
27179 * @property {boolean} [includeElementIndex=false]
27180 * @property {null|false|TransformLink} [transformLinkUri]
27181 * @property {TransformImage} [transformImageUri]
27182 * @property {TransformLinkTargetType|TransformLinkTarget} [linkTarget]
27183 * @property {Components} [components]
27184 */
27185 /**
27186 * @param {Context} context
27187 * @param {Element|Root} node
27188 */
27189 function childrenToReact(context, node) {
27190 /** @type {Array<ReactNode>} */
27191 const children = [];
27192 let childIndex = -1;
27193 /** @type {Comment|Doctype|Element|Raw|Text} */
27194 let child;
27195 while (++childIndex < node.children.length) {
27196 child = node.children[childIndex];
27197 if (child.type === "element") children.push(toReact(context, child, childIndex, node));
27198 else if (child.type === "text") {
27199 if (node.type !== "element" || !tableElements.has(node.tagName) || !whitespace(child)) children.push(child.value);
27200 } else if (child.type === "raw" && !context.options.skipHtml) children.push(child.value);
27201 }
27202 return children;
27203 }
27204 /**
27205 * @param {Context} context
27206 * @param {Element} node
27207 * @param {number} index
27208 * @param {Element|Root} parent
27209 */
27210 function toReact(context, node, index, parent) {
27211 const options = context.options;
27212 const transform = options.transformLinkUri === void 0 ? uriTransformer : options.transformLinkUri;
27213 const parentSchema = context.schema;
27214 /** @type {ReactMarkdownNames} */
27215 const name = node.tagName;
27216 /** @type {Record<string, unknown>} */
27217 const properties = {};
27218 let schema = parentSchema;
27219 /** @type {string} */
27220 let property;
27221 if (parentSchema.space === "html" && name === "svg") {
27222 schema = svg;
27223 context.schema = schema;
27224 }
27225 if (node.properties) {
27226 for (property in node.properties) if (own$1.call(node.properties, property)) addProperty(properties, property, node.properties[property], context);
27227 }
27228 if (name === "ol" || name === "ul") context.listDepth++;
27229 const children = childrenToReact(context, node);
27230 if (name === "ol" || name === "ul") context.listDepth--;
27231 context.schema = parentSchema;
27232 const position = node.position || {
27233 start: {
27234 line: null,
27235 column: null,
27236 offset: null
27237 },
27238 end: {
27239 line: null,
27240 column: null,
27241 offset: null
27242 }
27243 };
27244 const component = options.components && own$1.call(options.components, name) ? options.components[name] : name;
27245 const basic = typeof component === "string" || component === react$1.default.Fragment;
27246 if (!import_react_is.isValidElementType(component)) throw new TypeError(`Component for name \`${name}\` not defined or is not renderable`);
27247 properties.key = index;
27248 if (name === "a" && options.linkTarget) properties.target = typeof options.linkTarget === "function" ? options.linkTarget(String(properties.href || ""), node.children, typeof properties.title === "string" ? properties.title : null) : options.linkTarget;
27249 if (name === "a" && transform) properties.href = transform(String(properties.href || ""), node.children, typeof properties.title === "string" ? properties.title : null);
27250 if (!basic && name === "code" && parent.type === "element" && parent.tagName !== "pre") properties.inline = true;
27251 if (!basic && (name === "h1" || name === "h2" || name === "h3" || name === "h4" || name === "h5" || name === "h6")) properties.level = Number.parseInt(name.charAt(1), 10);
27252 if (name === "img" && options.transformImageUri) properties.src = options.transformImageUri(String(properties.src || ""), String(properties.alt || ""), typeof properties.title === "string" ? properties.title : null);
27253 if (!basic && name === "li" && parent.type === "element") {
27254 const input = getInputElement(node);
27255 properties.checked = input && input.properties ? Boolean(input.properties.checked) : null;
27256 properties.index = getElementsBeforeCount(parent, node);
27257 properties.ordered = parent.tagName === "ol";
27258 }
27259 if (!basic && (name === "ol" || name === "ul")) {
27260 properties.ordered = name === "ol";
27261 properties.depth = context.listDepth;
27262 }
27263 if (name === "td" || name === "th") {
27264 if (properties.align) {
27265 if (!properties.style) properties.style = {};
27266 properties.style.textAlign = properties.align;
27267 delete properties.align;
27268 }
27269 if (!basic) properties.isHeader = name === "th";
27270 }
27271 if (!basic && name === "tr" && parent.type === "element") properties.isHeader = Boolean(parent.tagName === "thead");
27272 if (options.sourcePos) properties["data-sourcepos"] = flattenPosition(position);
27273 if (!basic && options.rawSourcePos) properties.sourcePosition = node.position;
27274 if (!basic && options.includeElementIndex) {
27275 properties.index = getElementsBeforeCount(parent, node);
27276 properties.siblingCount = getElementsBeforeCount(parent);
27277 }
27278 if (!basic) properties.node = node;
27279 return children.length > 0 ? react$1.default.createElement(component, properties, children) : react$1.default.createElement(component, properties);
27280 }
27281 /**
27282 * @param {Element|Root} node
27283 * @returns {Element?}
27284 */
27285 function getInputElement(node) {
27286 let index = -1;
27287 while (++index < node.children.length) {
27288 const child = node.children[index];
27289 if (child.type === "element" && child.tagName === "input") return child;
27290 }
27291 return null;
27292 }
27293 /**
27294 * @param {Element|Root} parent
27295 * @param {Element} [node]
27296 * @returns {number}
27297 */
27298 function getElementsBeforeCount(parent, node) {
27299 let index = -1;
27300 let count = 0;
27301 while (++index < parent.children.length) {
27302 if (parent.children[index] === node) break;
27303 if (parent.children[index].type === "element") count++;
27304 }
27305 return count;
27306 }
27307 /**
27308 * @param {Record<string, unknown>} props
27309 * @param {string} prop
27310 * @param {unknown} value
27311 * @param {Context} ctx
27312 */
27313 function addProperty(props, prop, value, ctx) {
27314 const info = find(ctx.schema, prop);
27315 let result = value;
27316 if (result === null || result === void 0 || result !== result) return;
27317 if (Array.isArray(result)) result = info.commaSeparated ? stringify(result) : stringify$1(result);
27318 if (info.property === "style" && typeof result === "string") result = parseStyle(result);
27319 if (info.space && info.property) props[own$1.call(hastToReact, info.property) ? hastToReact[info.property] : info.property] = result;
27320 else if (info.attribute) props[info.attribute] = result;
27321 }
27322 /**
27323 * @param {string} value
27324 * @returns {Record<string, string>}
27325 */
27326 function parseStyle(value) {
27327 /** @type {Record<string, string>} */
27328 const result = {};
27329 try {
27330 style_to_object_default(value, iterator);
27331 } catch (_unused) {}
27332 return result;
27333 /**
27334 * @param {string} name
27335 * @param {string} v
27336 */
27337 function iterator(name, v) {
27338 const k = name.slice(0, 4) === "-ms-" ? `ms-${name.slice(4)}` : name;
27339 result[k.replace(/-([a-z])/g, styleReplacer)] = v;
27340 }
27341 }
27342 /**
27343 * @param {unknown} _
27344 * @param {string} $1
27345 */
27346 function styleReplacer(_, $1) {
27347 return $1.toUpperCase();
27348 }
27349 /**
27350 * @param {Position|{start: {line: null, column: null, offset: null}, end: {line: null, column: null, offset: null}}} pos
27351 * @returns {string}
27352 */
27353 function flattenPosition(pos) {
27354 return [
27355 pos.start.line,
27356 ":",
27357 pos.start.column,
27358 "-",
27359 pos.end.line,
27360 ":",
27361 pos.end.column
27362 ].map(String).join("");
27363 }
27364 var import_react_is, own$1, tableElements;
27365 var init_ast_to_react = __esmMin((() => {
27366 import_react_is = /* @__PURE__ */ __toESM(require_react_is(), 1);
27367 init_hast_util_whitespace();
27368 init_property_information();
27369 init_space_separated_tokens();
27370 init_comma_separated_tokens();
27371 init_style_to_object();
27372 init_uri_transformer();
27373 own$1 = {}.hasOwnProperty;
27374 tableElements = /* @__PURE__ */ new Set([
27375 "table",
27376 "thead",
27377 "tbody",
27378 "tfoot",
27379 "tr"
27380 ]);
27381 }));
27382
27383 //#endregion
27384 //#region node_modules/react-markdown/lib/react-markdown.js
27385 /**
27386 * @typedef {Promise.resolve(React).ReactNode} ReactNode
27387 * @typedef {Promise.resolve(React).ReactElement<{}>} ReactElement
27388 * @typedef {import('unified').PluggableList} PluggableList
27389 * @typedef {import('hast').Root} Root
27390 * @typedef {import('./rehype-filter.js').Options} FilterOptions
27391 * @typedef {import('./ast-to-react.js').Options} TransformOptions
27392 *
27393 * @typedef CoreOptions
27394 * @property {string} children
27395 *
27396 * @typedef PluginOptions
27397 * @property {PluggableList} [remarkPlugins=[]]
27398 * @property {PluggableList} [rehypePlugins=[]]
27399 * @property {import('remark-rehype').Options | undefined} [remarkRehypeOptions={}]
27400 *
27401 * @typedef LayoutOptions
27402 * @property {string} [className]
27403 *
27404 * @typedef {CoreOptions & PluginOptions & LayoutOptions & FilterOptions & TransformOptions} ReactMarkdownOptions
27405 *
27406 * @typedef Deprecation
27407 * @property {string} id
27408 * @property {string} [to]
27409 */
27410 /**
27411 * React component to render markdown.
27412 *
27413 * @param {ReactMarkdownOptions} options
27414 * @returns {ReactElement}
27415 */
27416 function ReactMarkdown$1(options) {
27417 for (const key in deprecated) if (own.call(deprecated, key) && own.call(options, key)) {
27418 const deprecation = deprecated[key];
27419 console.warn(`[react-markdown] Warning: please ${deprecation.to ? `use \`${deprecation.to}\` instead of` : "remove"} \`${key}\` (see <${changelog}#${deprecation.id}> for more info)`);
27420 delete deprecated[key];
27421 }
27422 const processor = unified().use(remarkParse).use(options.remarkPlugins || []).use(remarkRehype, _objectSpread2(_objectSpread2({}, options.remarkRehypeOptions), {}, { allowDangerousHtml: true })).use(options.rehypePlugins || []).use(rehypeFilter, options);
27423 const file = new VFile();
27424 if (typeof options.children === "string") file.value = options.children;
27425 else if (options.children !== void 0 && options.children !== null) console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${options.children}\`)`);
27426 const hastNode = processor.runSync(processor.parse(file), file);
27427 if (hastNode.type !== "root") throw new TypeError("Expected a `root` node");
27428 /** @type {ReactElement} */
27429 let result = react$1.default.createElement(react$1.default.Fragment, {}, childrenToReact({
27430 options,
27431 schema: html,
27432 listDepth: 0
27433 }, hastNode));
27434 if (options.className) result = react$1.default.createElement("div", { className: options.className }, result);
27435 return result;
27436 }
27437 var import_prop_types$1, own, changelog, deprecated;
27438 var init_react_markdown$1 = __esmMin((() => {
27439 init_vfile();
27440 init_unified();
27441 init_remark_parse();
27442 init_remark_rehype();
27443 import_prop_types$1 = /* @__PURE__ */ __toESM(require_prop_types(), 1);
27444 init_property_information();
27445 init_rehype_filter();
27446 init_ast_to_react();
27447 init_objectSpread2();
27448 own = {}.hasOwnProperty;
27449 changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
27450 deprecated = {
27451 plugins: {
27452 to: "remarkPlugins",
27453 id: "change-plugins-to-remarkplugins"
27454 },
27455 renderers: {
27456 to: "components",
27457 id: "change-renderers-to-components"
27458 },
27459 astPlugins: { id: "remove-buggy-html-in-markdown-parser" },
27460 allowDangerousHtml: { id: "remove-buggy-html-in-markdown-parser" },
27461 escapeHtml: { id: "remove-buggy-html-in-markdown-parser" },
27462 source: {
27463 to: "children",
27464 id: "change-source-to-children"
27465 },
27466 allowNode: {
27467 to: "allowElement",
27468 id: "replace-allownode-allowedtypes-and-disallowedtypes"
27469 },
27470 allowedTypes: {
27471 to: "allowedElements",
27472 id: "replace-allownode-allowedtypes-and-disallowedtypes"
27473 },
27474 disallowedTypes: {
27475 to: "disallowedElements",
27476 id: "replace-allownode-allowedtypes-and-disallowedtypes"
27477 },
27478 includeNodeIndex: {
27479 to: "includeElementIndex",
27480 id: "change-includenodeindex-to-includeelementindex"
27481 }
27482 };
27483 __name(ReactMarkdown$1, "ReactMarkdown");
27484 ReactMarkdown$1.propTypes = {
27485 children: import_prop_types$1.default.string,
27486 className: import_prop_types$1.default.string,
27487 allowElement: import_prop_types$1.default.func,
27488 allowedElements: import_prop_types$1.default.arrayOf(import_prop_types$1.default.string),
27489 disallowedElements: import_prop_types$1.default.arrayOf(import_prop_types$1.default.string),
27490 unwrapDisallowed: import_prop_types$1.default.bool,
27491 remarkPlugins: import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([
27492 import_prop_types$1.default.object,
27493 import_prop_types$1.default.func,
27494 import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([
27495 import_prop_types$1.default.bool,
27496 import_prop_types$1.default.string,
27497 import_prop_types$1.default.object,
27498 import_prop_types$1.default.func,
27499 import_prop_types$1.default.arrayOf(import_prop_types$1.default.any)
27500 ]))
27501 ])),
27502 rehypePlugins: import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([
27503 import_prop_types$1.default.object,
27504 import_prop_types$1.default.func,
27505 import_prop_types$1.default.arrayOf(import_prop_types$1.default.oneOfType([
27506 import_prop_types$1.default.bool,
27507 import_prop_types$1.default.string,
27508 import_prop_types$1.default.object,
27509 import_prop_types$1.default.func,
27510 import_prop_types$1.default.arrayOf(import_prop_types$1.default.any)
27511 ]))
27512 ])),
27513 sourcePos: import_prop_types$1.default.bool,
27514 rawSourcePos: import_prop_types$1.default.bool,
27515 skipHtml: import_prop_types$1.default.bool,
27516 includeElementIndex: import_prop_types$1.default.bool,
27517 transformLinkUri: import_prop_types$1.default.oneOfType([import_prop_types$1.default.func, import_prop_types$1.default.bool]),
27518 linkTarget: import_prop_types$1.default.oneOfType([import_prop_types$1.default.func, import_prop_types$1.default.string]),
27519 transformImageUri: import_prop_types$1.default.func,
27520 components: import_prop_types$1.default.object
27521 };
27522 }));
27523
27524 //#endregion
27525 //#region node_modules/react-markdown/index.js
27526 var react_markdown_exports = /* @__PURE__ */ __exportAll({
27527 default: () => ReactMarkdown$1,
27528 uriTransformer: () => uriTransformer
27529 });
27530 var init_react_markdown = __esmMin((() => {
27531 init_uri_transformer();
27532 init_react_markdown$1();
27533 }));
27534
27535 //#endregion
27536 //#region modules/ai/assets/js/editor/pages/form-code/index.js
27537 var form_code_exports = /* @__PURE__ */ __exportAll({ default: () => FormCode$1 });
27538 function ownKeys$5(e, r) {
27539 var t = Object.keys(e);
27540 if (Object.getOwnPropertySymbols) {
27541 var o = Object.getOwnPropertySymbols(e);
27542 r && (o = o.filter(function(r) {
27543 return Object.getOwnPropertyDescriptor(e, r).enumerable;
27544 })), t.push.apply(t, o);
27545 }
27546 return t;
27547 }
27548 function _objectSpread$5(e) {
27549 for (var r = 1; r < arguments.length; r++) {
27550 var t = null != arguments[r] ? arguments[r] : {};
27551 r % 2 ? ownKeys$5(Object(t), !0).forEach(function(r) {
27552 _defineProperty$1(e, r, t[r]);
27553 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function(r) {
27554 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
27555 });
27556 }
27557 return e;
27558 }
27559 var import_regenerator, import_prop_types, ReactMarkdown, generateUniqueId, CodeDisplayWrapper, FormCode$1;
27560 var init_form_code = __esmMin((() => {
27561 init_extends();
27562 init_asyncToGenerator();
27563 init_slicedToArray();
27564 init_defineProperty$1();
27565 import_regenerator = /* @__PURE__ */ __toESM(require_regenerator());
27566 import_prop_types = /* @__PURE__ */ __toESM(require_prop_types());
27567 init_actions_data();
27568 init_loader();
27569 init_prompt_search();
27570 init_prompt_suggestions();
27571 init_generate_button();
27572 init_prompt_error_message();
27573 init_code_block();
27574 init_use_code_prompt();
27575 init_prompt_history_action_context();
27576 init_prompt_library_link();
27577 init_requests_ids();
27578 init_voice_promotion_alert();
27579 init_splitTextResult();
27580 init_preload_helper();
27581 __name(ownKeys$5, "ownKeys");
27582 __name(_objectSpread$5, "_objectSpread");
27583 ReactMarkdown = (0, react.lazy)(function() {
27584 return __vitePreload(() => Promise.resolve().then(() => (init_react_markdown(), react_markdown_exports)), void 0);
27585 });
27586 generateUniqueId = function generateUniqueId() {
27587 return "custom-css-".concat(Math.random().toString(36).substr(2, 9));
27588 };
27589 CodeDisplayWrapper = (0, _elementor_ui.styled)(_elementor_ui.Box)(function() {
27590 return {
27591 "& p": {
27592 mb: "10px",
27593 fontSize: "13px",
27594 lineHeight: "1.5"
27595 },
27596 "& pre": { position: "relative" },
27597 "& textarea": {
27598 fontSize: "13px",
27599 lineHeight: "1.7"
27600 }
27601 };
27602 });
27603 FormCode$1 = function FormCode(_ref) {
27604 var onClose = _ref.onClose;
27605 var getControlValue = _ref.getControlValue;
27606 var setControlValue = _ref.setControlValue;
27607 var additionalOptions = _ref.additionalOptions;
27608 var credits = _ref.credits;
27609 var children = _ref.children;
27610 var _useCodePrompt = useCodePrompt(_objectSpread$5(_objectSpread$5({}, additionalOptions), {}, { credits }));
27611 var data = _useCodePrompt.data;
27612 var isLoading = _useCodePrompt.isLoading;
27613 var error = _useCodePrompt.error;
27614 var reset = _useCodePrompt.reset;
27615 var send = _useCodePrompt.send;
27616 var sendUsageData = _useCodePrompt.sendUsageData;
27617 var _splitText = splitText(data.result);
27618 var code = _splitText.code;
27619 var details = _splitText.details;
27620 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
27621 var prompt = _useState2[0];
27622 var setPrompt = _useState2[1];
27623 var setGenerate = useRequestIds().setGenerate;
27624 var styleTagId = (0, react.useRef)(generateUniqueId());
27625 useSubscribeOnPromptHistoryAction([{
27626 type: ACTION_TYPES.REUSE,
27627 handler: function handler(action) {
27628 reset();
27629 setPrompt(action.data);
27630 }
27631 }]);
27632 var lastRun = (0, react.useRef)(function() {});
27633 var autocompleteItems = codeHtmlAutocomplete;
27634 var promptLibraryLink = "";
27635 if ("css" === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.codeLanguage)) {
27636 autocompleteItems = codeCssAutocomplete;
27637 promptLibraryLink = "https://go.elementor.com/ai-prompt-library-css/";
27638 } else if (additionalOptions !== null && additionalOptions !== void 0 && additionalOptions.htmlMarkup) promptLibraryLink = "https://go.elementor.com/ai-prompt-library-html/";
27639 else promptLibraryLink = "https://go.elementor.com/ai-prompt-library-custom-code/";
27640 var showSuggestions = !prompt;
27641 var handleSubmit = /*#__PURE__*/ function() {
27642 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator.default.mark(function _callee(event) {
27643 var response;
27644 return import_regenerator.default.wrap(function(_context) {
27645 while (1) switch (_context.prev = _context.next) {
27646 case 0:
27647 event.preventDefault();
27648 setGenerate();
27649 lastRun.current = function() {
27650 return send({ prompt });
27651 };
27652 _context.next = 1;
27653 return lastRun.current();
27654 case 1:
27655 response = _context.sent;
27656 if ("css" === (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.codeLanguage) && response.result) showCssPreview(splitText(response.result).code);
27657 case 2:
27658 case "end": return _context.stop();
27659 }
27660 }, _callee);
27661 }));
27662 return function handleSubmit(_x) {
27663 return _ref2.apply(this, arguments);
27664 };
27665 }();
27666 (0, react.useEffect)(function() {
27667 return function() {
27668 removeStyleTag();
27669 };
27670 }, []);
27671 var showCssPreview = function showCssPreview(cssCode) {
27672 insertStyleTag(parseCSS(cssCode));
27673 };
27674 var parseCSS = function parseCSS(cssCode) {
27675 var elementId = additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.elementId;
27676 var selector = "document" === elementId ? elementor.config.document.settings.cssWrapperSelector : ".elementor-element.elementor-element-".concat(elementId);
27677 return cssCode && cssCode.replace(/`/g, "").replace(/^css\s*/i, "").replace(/selector/g, selector);
27678 };
27679 var isElementorEditor = function isElementorEditor() {
27680 return window.elementorFrontend;
27681 };
27682 var insertStyleTag = function insertStyleTag(cssCode) {
27683 if (!isElementorEditor()) return;
27684 var style = document.createElement("style");
27685 style.id = styleTagId.current;
27686 style.appendChild(document.createTextNode(cssCode));
27687 elementorFrontend.elements.$body[0].appendChild(style);
27688 };
27689 var removeStyleTag = function removeStyleTag() {
27690 if (!isElementorEditor()) return;
27691 var styleTag = elementorFrontend.elements.$body[0].querySelector("#".concat(styleTagId.current));
27692 if (styleTag) styleTag.remove();
27693 };
27694 var applyPrompt = function applyPrompt(inputText) {
27695 sendUsageData();
27696 setControlValue(inputText);
27697 onClose();
27698 };
27699 if (isLoading) return /*#__PURE__*/ react.default.createElement(Loader, null);
27700 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, error && /*#__PURE__*/ react.default.createElement(PromptErrorMessage, {
27701 error,
27702 onRetry: lastRun.current,
27703 sx: { mb: 2.5 }
27704 }), children, !data.result && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
27705 component: "form",
27706 onSubmit: handleSubmit
27707 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { pb: 1.5 } }, /*#__PURE__*/ react.default.createElement(PromptSearch, {
27708 placeholder: (0, _wordpress_i18n.__)("Describe the code you want to use...", "elementor"),
27709 name: "prompt",
27710 value: prompt,
27711 color: "secondary",
27712 onChange: function onChange(event) {
27713 return setPrompt(event.target.value);
27714 }
27715 })), showSuggestions && /*#__PURE__*/ react.default.createElement(PromptSuggestions, {
27716 suggestions: autocompleteItems,
27717 onSelect: setPrompt
27718 }, /*#__PURE__*/ react.default.createElement(PromptLibraryLink, { libraryLink: promptLibraryLink })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
27719 direction: "row",
27720 alignItems: "center",
27721 sx: {
27722 py: 1.5,
27723 mt: 4
27724 }
27725 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
27726 direction: "row",
27727 justifyContent: "flex-end",
27728 flexGrow: 1
27729 }, /*#__PURE__*/ react.default.createElement(GenerateButton$1, null, (0, _wordpress_i18n.__)("Generate code", "elementor"))))), data.result && /*#__PURE__*/ react.default.createElement(CodeDisplayWrapper, null, /*#__PURE__*/ react.default.createElement(react.Suspense, { fallback: /*#__PURE__*/ react.default.createElement(Loader, null) }, /*#__PURE__*/ react.default.createElement(ReactMarkdown, { components: { code: function code(props) {
27730 return /*#__PURE__*/ react.default.createElement(CodeBlock, _extends$1({}, props, {
27731 defaultValue: getControlValue(),
27732 onInsert: applyPrompt
27733 }));
27734 } } }, code)), details, /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-code-promotion" }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
27735 direction: "row",
27736 alignItems: "center",
27737 sx: { mt: 4 }
27738 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
27739 direction: "row",
27740 gap: 1,
27741 justifyContent: "flex-end",
27742 flexGrow: 1
27743 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
27744 size: "small",
27745 color: "secondary",
27746 variant: "text",
27747 onClick: function onClick() {
27748 removeStyleTag();
27749 reset();
27750 }
27751 }, (0, _wordpress_i18n.__)("New prompt", "elementor"))))));
27752 };
27753 FormCode$1.propTypes = {
27754 onClose: import_prop_types.default.func.isRequired,
27755 getControlValue: import_prop_types.default.func.isRequired,
27756 setControlValue: import_prop_types.default.func.isRequired,
27757 additionalOptions: import_prop_types.default.shape({
27758 codeLanguage: import_prop_types.default.string,
27759 htmlMarkup: import_prop_types.default.string,
27760 elementId: import_prop_types.default.string,
27761 initialCredits: import_prop_types.default.number
27762 }),
27763 credits: import_prop_types.default.number,
27764 children: import_prop_types.default.node
27765 };
27766 }));
27767
27768 //#endregion
27769 //#region modules/ai/assets/js/editor/page-content.js
27770 init_extends();
27771 init_defineProperty$1();
27772 init_slicedToArray();
27773 init_history_types();
27774 init_prompt_history_action_context();
27775 init_prompt_history_context();
27776 init_loader();
27777 init_requests_ids();
27778 init_preload_helper();
27779 function ownKeys$4(e, r) {
27780 var t = Object.keys(e);
27781 if (Object.getOwnPropertySymbols) {
27782 var o = Object.getOwnPropertySymbols(e);
27783 r && (o = o.filter(function(r) {
27784 return Object.getOwnPropertyDescriptor(e, r).enumerable;
27785 })), t.push.apply(t, o);
27786 }
27787 return t;
27788 }
27789 __name(ownKeys$4, "ownKeys");
27790 function _objectSpread$4(e) {
27791 for (var r = 1; r < arguments.length; r++) {
27792 var t = null != arguments[r] ? arguments[r] : {};
27793 r % 2 ? ownKeys$4(Object(t), !0).forEach(function(r) {
27794 _defineProperty$1(e, r, t[r]);
27795 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r) {
27796 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
27797 });
27798 }
27799 return e;
27800 }
27801 __name(_objectSpread$4, "_objectSpread");
27802 var FormCode = (0, react.lazy)(function() {
27803 return __vitePreload(() => Promise.resolve().then(() => (init_form_code(), form_code_exports)), void 0);
27804 });
27805 var PageContent = function PageContent(_ref) {
27806 var type = _ref.type;
27807 var controlType = _ref.controlType;
27808 var onClose = _ref.onClose;
27809 var onConnect = _ref.onConnect;
27810 var getControlValue = _ref.getControlValue;
27811 var setControlValue = _ref.setControlValue;
27812 var additionalOptions = _ref.additionalOptions;
27813 var _ref2 = function(_additionalOptions$us) {
27814 return (_additionalOptions$us = additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.useCustomInit) !== null && _additionalOptions$us !== void 0 ? _additionalOptions$us : useUserInfo;
27815 }()();
27816 var isLoading = _ref2.isLoading;
27817 var isConnected = _ref2.isConnected;
27818 var isGetStarted = _ref2.isGetStarted;
27819 var connectUrl = _ref2.connectUrl;
27820 var fetchData = _ref2.fetchData;
27821 var hasSubscription = _ref2.hasSubscription;
27822 var credits = _ref2.credits;
27823 var initialUsagePercentage = _ref2.usagePercentage;
27824 var _useRequestIds = useRequestIds();
27825 var updateUsagePercentage = _useRequestIds.updateUsagePercentage;
27826 var usagePercentage = _useRequestIds.usagePercentage;
27827 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
27828 var isInitUsageDone = _useState2[0];
27829 var setIsInitUsageDone = _useState2[1];
27830 (0, react.useEffect)(function() {
27831 if (!isInitUsageDone && !isLoading && (initialUsagePercentage || 0 === initialUsagePercentage)) {
27832 updateUsagePercentage(initialUsagePercentage);
27833 setIsInitUsageDone(true);
27834 }
27835 }, [
27836 isLoading,
27837 initialUsagePercentage,
27838 isInitUsageDone,
27839 updateUsagePercentage
27840 ]);
27841 var showBadge = useUpgradeMessage({
27842 usagePercentage,
27843 hasSubscription
27844 }).showBadge;
27845 var _useState4 = _slicedToArray((0, react.useState)({ pointerEvents: "none" }), 2);
27846 var sxStyle = _useState4[0];
27847 var setSxStyle = _useState4[1];
27848 var timeoutRef = (0, react.useRef)(null);
27849 var _useState6 = _slicedToArray((0, react.useState)(), 2);
27850 var originalControlValue = _useState6[0];
27851 var setOriginalControlValue = _useState6[1];
27852 var promptDialogStyleProps = {
27853 sx: {
27854 zIndex: 17e4,
27855 "& .MuiDialog-container": {
27856 alignItems: "flex-start",
27857 mt: "media" === type ? "2.5vh" : "18vh"
27858 },
27859 "& .MuiDialogContent-root": {
27860 willChange: "height",
27861 transition: "height 300ms ease-in-out",
27862 position: "relative"
27863 },
27864 "& .MuiBox-root": { boxSizing: "border-box" }
27865 },
27866 PaperProps: { sx: {
27867 m: 0,
27868 maxHeight: "media" === type ? "95vh" : "76vh",
27869 minHeight: "80vh",
27870 height: "auto"
27871 } }
27872 };
27873 var codePromptDialogStyleProps = {
27874 sx: _objectSpread$4(_objectSpread$4({}, promptDialogStyleProps.sx), sxStyle),
27875 PaperProps: {
27876 onMouseEnter: function onMouseEnter() {
27877 clearTimeout(timeoutRef.current);
27878 setSxStyle({ pointerEvents: "all" });
27879 },
27880 onMouseLeave: function onMouseLeave() {
27881 clearTimeout(timeoutRef.current);
27882 timeoutRef.current = setTimeout(function() {
27883 setSxStyle({ pointerEvents: "none" });
27884 }, 200);
27885 },
27886 sx: _objectSpread$4(_objectSpread$4({}, promptDialogStyleProps.PaperProps.sx), {}, { pointerEvents: "auto" })
27887 }
27888 };
27889 var maybeRenderUpgradeChip = function maybeRenderUpgradeChip() {
27890 if (!showBadge) return;
27891 return /*#__PURE__*/ react.default.createElement(UpgradeChip, {
27892 hasSubscription,
27893 usagePercentage
27894 });
27895 };
27896 (0, react.useEffect)(function() {
27897 if (!originalControlValue) setOriginalControlValue(getControlValue());
27898 }, []);
27899 if (isLoading || !isInitUsageDone) return /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({ onClose }, promptDialogStyleProps, { maxWidth: "media" === type ? "lg" : "sm" }), /*#__PURE__*/ react.default.createElement(PromptDialog.Header, { onClose }), /*#__PURE__*/ react.default.createElement(PromptDialog.Content, { dividers: true }, (additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.loadingTitle) && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { style: {
27900 display: "flex",
27901 justifyContent: "center",
27902 alignItems: "center",
27903 width: "100%"
27904 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
27905 variant: "body1",
27906 color: "secondary"
27907 }, additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.loadingTitle)), /*#__PURE__*/ react.default.createElement(Loader, null)));
27908 if (!isConnected) return /*#__PURE__*/ react.default.createElement(WizardDialog, { onClose }, /*#__PURE__*/ react.default.createElement(WizardDialog.Header, { onClose }), /*#__PURE__*/ react.default.createElement(WizardDialog.Content, { dividers: true }, /*#__PURE__*/ react.default.createElement(Connect, {
27909 connectUrl,
27910 onSuccess: function onSuccess(data) {
27911 onConnect(data);
27912 fetchData();
27913 }
27914 })));
27915 if (!isGetStarted) return /*#__PURE__*/ react.default.createElement(WizardDialog, { onClose }, /*#__PURE__*/ react.default.createElement(WizardDialog.Header, { onClose }), /*#__PURE__*/ react.default.createElement(WizardDialog.Content, { dividers: true }, /*#__PURE__*/ react.default.createElement(GetStarted, { onSuccess: fetchData })));
27916 if ("media" === type) return /*#__PURE__*/ react.default.createElement(PromptHistoryProvider, { historyType: HISTORY_TYPES.IMAGE }, /*#__PURE__*/ react.default.createElement(PromptHistoryActionProvider, null, /*#__PURE__*/ react.default.createElement(FormMedia, {
27917 onClose,
27918 getControlValue,
27919 setControlValue,
27920 additionalOptions,
27921 credits,
27922 maybeRenderUpgradeChip,
27923 DialogProps: promptDialogStyleProps,
27924 hasSubscription,
27925 usagePercentage
27926 })));
27927 if ("code" === type) return /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({ onClose }, codePromptDialogStyleProps), /*#__PURE__*/ react.default.createElement(PromptHistoryProvider, { historyType: HISTORY_TYPES.CODE }, /*#__PURE__*/ react.default.createElement(PromptHistoryActionProvider, null, /*#__PURE__*/ react.default.createElement(PromptDialog.Header, { onClose }, /*#__PURE__*/ react.default.createElement(PromptHistory, null), maybeRenderUpgradeChip()), /*#__PURE__*/ react.default.createElement(PromptDialog.Content, {
27928 className: "e-ai-dialog-content",
27929 dividers: true
27930 }, /*#__PURE__*/ react.default.createElement(react.Suspense, { fallback: /*#__PURE__*/ react.default.createElement(Loader, null) }, /*#__PURE__*/ react.default.createElement(FormCode, {
27931 onClose,
27932 getControlValue,
27933 setControlValue,
27934 additionalOptions,
27935 credits,
27936 usagePercentage
27937 }, /*#__PURE__*/ react.default.createElement(UsageMessages, {
27938 hasSubscription,
27939 usagePercentage,
27940 sx: { mb: 2 },
27941 feature: FREE_TRIAL_FEATURES_NAMES.CODE
27942 })))))));
27943 if ("animation" === type || "hover_animation" === type) {
27944 var onCloseAnimationDialog = function onCloseAnimationDialog() {
27945 setControlValue(originalControlValue);
27946 elementor.documents.getCurrent().history.setActive(true);
27947 onClose();
27948 };
27949 return /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({ onClose: onCloseAnimationDialog }, codePromptDialogStyleProps), /*#__PURE__*/ react.default.createElement(PromptDialog.Header, {
27950 onClose: onCloseAnimationDialog,
27951 hideAiBetaLogo: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideAiBetaLogo
27952 }, maybeRenderUpgradeChip()), /*#__PURE__*/ react.default.createElement(PromptDialog.Content, {
27953 className: "e-ai-dialog-content",
27954 dividers: true
27955 }, /*#__PURE__*/ react.default.createElement(FormAnimation, {
27956 onClose,
27957 getControlValue,
27958 setControlValue,
27959 additionalOptions: _objectSpread$4(_objectSpread$4({}, additionalOptions), {}, { animationType: "hover_animation" === type ? "hover" : "other" }),
27960 credits,
27961 usagePercentage
27962 }, /*#__PURE__*/ react.default.createElement(UsageMessages, {
27963 hasSubscription,
27964 usagePercentage,
27965 sx: { mb: 2 },
27966 feature: FREE_TRIAL_FEATURES_NAMES.ANIMATION
27967 }))));
27968 }
27969 return /*#__PURE__*/ react.default.createElement(PromptDialog, _extends$1({ onClose }, promptDialogStyleProps), /*#__PURE__*/ react.default.createElement(PromptHistoryProvider, { historyType: HISTORY_TYPES.TEXT }, /*#__PURE__*/ react.default.createElement(PromptHistoryActionProvider, null, /*#__PURE__*/ react.default.createElement(PromptDialog.Header, {
27970 onClose,
27971 hideAiBetaLogo: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.hideAiBetaLogo
27972 }, !(additionalOptions !== null && additionalOptions !== void 0 && additionalOptions.withoutHistory) && /*#__PURE__*/ react.default.createElement(PromptHistory, null), maybeRenderUpgradeChip()), /*#__PURE__*/ react.default.createElement(PromptDialog.Content, {
27973 className: "e-ai-dialog-content",
27974 dividers: true
27975 }, /*#__PURE__*/ react.default.createElement(FormText, {
27976 type,
27977 controlType,
27978 onClose,
27979 getControlValue,
27980 setControlValue,
27981 additionalOptions,
27982 credits,
27983 usagePercentage
27984 }, /*#__PURE__*/ react.default.createElement(UsageMessages, {
27985 hasSubscription,
27986 usagePercentage,
27987 sx: { mb: 2 },
27988 feature: FREE_TRIAL_FEATURES_NAMES.TEXT
27989 }))))));
27990 };
27991 PageContent.propTypes = {
27992 type: import_prop_types$8.default.string,
27993 controlType: import_prop_types$8.default.string,
27994 onClose: import_prop_types$8.default.func.isRequired,
27995 onConnect: import_prop_types$8.default.func,
27996 getControlValue: import_prop_types$8.default.func.isRequired,
27997 setControlValue: import_prop_types$8.default.func.isRequired,
27998 additionalOptions: import_prop_types$8.default.object
27999 };
28000
28001 //#endregion
28002 //#region node_modules/react-dom/client.js
28003 var require_client = /* @__PURE__ */ __commonJSMin(((exports) => {
28004 var m = (globalThis.ReactDOM);
28005 var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
28006 }));
28007
28008 //#endregion
28009 //#region assets/dev/js/utils/react.js
28010 var import_client = require_client();
28011
28012 //#endregion
28013 //#region modules/ai/assets/js/editor/utils/preview-container.js
28014 /**
28015 * @typedef {import('elementor/assets/dev/js/editor/container/container')} Container
28016 */
28017 var PREFIX = "e-ai-preview-container";
28018 var CLASS_HIDDEN = PREFIX + "--hidden";
28019 var CLASS_IDLE = PREFIX + "--idle";
28020
28021 //#endregion
28022 //#region modules/ai/assets/js/editor/pages/form-layout/components/unsaved-changes-alert.js
28023 init_extends();
28024 init_objectWithoutProperties$1();
28025 var _excluded$4 = [
28026 "onClose",
28027 "onCancel",
28028 "title",
28029 "text"
28030 ];
28031 var UnsavedChangesAlert = function UnsavedChangesAlert(_ref) {
28032 var onClose = _ref.onClose;
28033 var onCancel = _ref.onCancel;
28034 var title = _ref.title;
28035 var text = _ref.text;
28036 var props = _objectWithoutProperties$1(_ref, _excluded$4);
28037 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, _extends$1({
28038 "aria-labelledby": "unsaved-changes-alert-title",
28039 "aria-describedby": "unsaved-changes-alert-description"
28040 }, props), /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogTitle, { id: "unsaved-changes-alert-title" }, title), /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContent, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContentText, { id: "unsaved-changes-alert-description" }, text)), /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogActions, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
28041 onClick: onCancel,
28042 color: "secondary"
28043 }, (0, _wordpress_i18n.__)("Cancel", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
28044 onClick: onClose,
28045 color: "error",
28046 variant: "contained"
28047 }, (0, _wordpress_i18n.__)("Yes, leave", "elementor"))));
28048 };
28049 UnsavedChangesAlert.propTypes = {
28050 title: import_prop_types$8.default.string,
28051 text: import_prop_types$8.default.string,
28052 onCancel: import_prop_types$8.default.func,
28053 onClose: import_prop_types$8.default.func
28054 };
28055
28056 //#endregion
28057 //#region modules/ai/assets/js/editor/pages/form-layout/components/layout-dialog.js
28058 init_extends();
28059 init_defineProperty$1();
28060 init_slicedToArray();
28061 init_objectWithoutProperties$1();
28062 var _excluded$3 = ["sx", "PaperProps"];
28063 function ownKeys$3(e, r) {
28064 var t = Object.keys(e);
28065 if (Object.getOwnPropertySymbols) {
28066 var o = Object.getOwnPropertySymbols(e);
28067 r && (o = o.filter(function(r) {
28068 return Object.getOwnPropertyDescriptor(e, r).enumerable;
28069 })), t.push.apply(t, o);
28070 }
28071 return t;
28072 }
28073 __name(ownKeys$3, "ownKeys");
28074 function _objectSpread$3(e) {
28075 for (var r = 1; r < arguments.length; r++) {
28076 var t = null != arguments[r] ? arguments[r] : {};
28077 r % 2 ? ownKeys$3(Object(t), !0).forEach(function(r) {
28078 _defineProperty$1(e, r, t[r]);
28079 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r) {
28080 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
28081 });
28082 }
28083 return e;
28084 }
28085 __name(_objectSpread$3, "_objectSpread");
28086 var StyledDialog = (0, _elementor_ui.styled)(PromptDialog)(function() {
28087 return {
28088 "& .MuiDialog-container": {
28089 marginTop: 0,
28090 alignItems: "flex-end",
28091 paddingBottom: "16vh"
28092 },
28093 "& .MuiPaper-root": {
28094 margin: 0,
28095 maxHeight: "80vh"
28096 }
28097 };
28098 });
28099 var DialogHeader = function DialogHeader(_ref) {
28100 var onClose = _ref.onClose;
28101 var children = _ref.children;
28102 return /*#__PURE__*/ react.default.createElement(_elementor_ui.AppBar, {
28103 sx: { fontWeight: "normal" },
28104 color: "transparent",
28105 position: "relative"
28106 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Toolbar, { variant: "dense" }, /*#__PURE__*/ react.default.createElement(_elementor_icons.AIIcon, { sx: { mr: 1 } }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
28107 component: "span",
28108 variant: "subtitle2",
28109 sx: {
28110 fontWeight: "bold",
28111 textTransform: "uppercase"
28112 }
28113 }, (0, _wordpress_i18n.__)("AI", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, {
28114 label: (0, _wordpress_i18n.__)("Beta", "elementor"),
28115 color: "default",
28116 size: "small",
28117 sx: { ml: 1 }
28118 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
28119 direction: "row",
28120 spacing: 1,
28121 alignItems: "center",
28122 sx: { ml: "auto" }
28123 }, children, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
28124 size: "small",
28125 "aria-label": "close",
28126 onClick: onClose,
28127 sx: { "&.MuiButtonBase-root": { mr: -1 } }
28128 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.XIcon, null)))));
28129 };
28130 DialogHeader.propTypes = {
28131 children: import_prop_types$8.default.node,
28132 onClose: import_prop_types$8.default.func.isRequired
28133 };
28134 var StyledDialogContent = (0, _elementor_ui.styled)(PromptDialog.Content)(function() {
28135 return { "&.MuiDialogContent-root": { padding: 0 } };
28136 });
28137 var LayoutDialog = function LayoutDialog(_ref2) {
28138 var _ref2$sx = _ref2.sx;
28139 var sx = _ref2$sx === void 0 ? {} : _ref2$sx;
28140 var _ref2$PaperProps = _ref2.PaperProps;
28141 var PaperProps = _ref2$PaperProps === void 0 ? {} : _ref2$PaperProps;
28142 var props = _objectWithoutProperties$1(_ref2, _excluded$3);
28143 var _useState2 = _slicedToArray((0, react.useState)({ pointerEvents: "none" }), 2);
28144 var sxStyle = _useState2[0];
28145 var setSxStyle = _useState2[1];
28146 var timeoutRef = (0, react.useRef)(null);
28147 /**
28148 * The PromptDialog is using disableScrollLock in order to allow scrolling the page when the Dialog is opened.
28149 * When using the react-draggable library inside the editor, the background page scroll is not working smoothly.
28150 * Therefore, we need to delay the pointerEvents: none, which allowing to scroll the page content.
28151 */
28152 return /*#__PURE__*/ react.default.createElement(StyledDialog, _extends$1({
28153 maxWidth: "md",
28154 PaperProps: _objectSpread$3({
28155 sx: { pointerEvents: "auto" },
28156 onMouseEnter: function onMouseEnter() {
28157 clearTimeout(timeoutRef.current);
28158 setSxStyle({ pointerEvents: "all" });
28159 },
28160 onMouseLeave: function onMouseLeave() {
28161 clearTimeout(timeoutRef.current);
28162 timeoutRef.current = setTimeout(function() {
28163 setSxStyle({ pointerEvents: "none" });
28164 }, 200);
28165 }
28166 }, PaperProps)
28167 }, props, { sx: _objectSpread$3(_objectSpread$3({}, sxStyle), sx) }));
28168 };
28169 LayoutDialog.propTypes = {
28170 sx: import_prop_types$8.default.object,
28171 PaperProps: import_prop_types$8.default.object
28172 };
28173 LayoutDialog.Header = DialogHeader;
28174 LayoutDialog.Content = StyledDialogContent;
28175
28176 //#endregion
28177 //#region modules/ai/assets/js/editor/pages/form-layout/components/prompt-autocomplete.js
28178 init_slicedToArray();
28179 init_objectWithoutProperties$1();
28180 init_extends();
28181 init_defineProperty$1();
28182 init_prompt_library_link();
28183 var _excluded$2 = ["onSubmit"];
28184 function ownKeys$2(e, r) {
28185 var t = Object.keys(e);
28186 if (Object.getOwnPropertySymbols) {
28187 var o = Object.getOwnPropertySymbols(e);
28188 r && (o = o.filter(function(r) {
28189 return Object.getOwnPropertyDescriptor(e, r).enumerable;
28190 })), t.push.apply(t, o);
28191 }
28192 return t;
28193 }
28194 __name(ownKeys$2, "ownKeys");
28195 function _objectSpread$2(e) {
28196 for (var r = 1; r < arguments.length; r++) {
28197 var t = null != arguments[r] ? arguments[r] : {};
28198 r % 2 ? ownKeys$2(Object(t), !0).forEach(function(r) {
28199 _defineProperty$1(e, r, t[r]);
28200 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r) {
28201 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
28202 });
28203 }
28204 return e;
28205 }
28206 __name(_objectSpread$2, "_objectSpread");
28207 var TextInput = (0, react.forwardRef)(function(props, ref) {
28208 return /*#__PURE__*/ react.default.createElement(_elementor_ui.TextField, _extends$1({
28209 autoFocus: true,
28210 multiline: true,
28211 size: "small",
28212 maxRows: 3,
28213 color: "secondary",
28214 variant: "standard"
28215 }, props, {
28216 inputRef: ref,
28217 InputProps: _objectSpread$2(_objectSpread$2({}, props.InputProps), {}, {
28218 type: "search",
28219 sx: { pt: 0 }
28220 })
28221 }));
28222 });
28223 TextInput.propTypes = { InputProps: import_prop_types$8.default.object };
28224 var PaperComponent = function PaperComponent(props) {
28225 var libraryLink = "variation" === useConfig().mode ? "https://go.elementor.com/ai-prompt-library-variations/" : "https://go.elementor.com/ai-prompt-library-containers/";
28226 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Paper, _extends$1({}, props, {
28227 elevation: 8,
28228 sx: { borderRadius: 2 }
28229 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
28230 component: _elementor_ui.Box,
28231 color: function color(theme) {
28232 return theme.palette.text.tertiary;
28233 },
28234 variant: "caption",
28235 paddingX: 2,
28236 paddingY: 1
28237 }, (0, _wordpress_i18n.__)("Suggested Prompts", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Divider, null), props.children, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { sx: { m: 2 } }, /*#__PURE__*/ react.default.createElement(PromptLibraryLink, { libraryLink })));
28238 };
28239 PaperComponent.propTypes = { children: import_prop_types$8.default.node };
28240 var PromptAutocomplete = function PromptAutocomplete(_ref) {
28241 var onSubmit = _ref.onSubmit;
28242 var props = _objectWithoutProperties$1(_ref, _excluded$2);
28243 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
28244 var showSuggestions = _useState2[0];
28245 var setShowSuggestions = _useState2[1];
28246 var theme = (0, _elementor_ui.useTheme)();
28247 var itemHeight = parseInt(theme.spacing(4));
28248 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Autocomplete, _extends$1({
28249 PaperComponent,
28250 ListboxProps: { sx: { maxHeight: 5 * itemHeight } },
28251 renderOption: function renderOption(optionProps, option) {
28252 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, _extends$1({}, optionProps, {
28253 title: option.text,
28254 noWrap: true,
28255 variant: "body2",
28256 component: _elementor_ui.Box,
28257 sx: { "&.MuiAutocomplete-option": {
28258 display: "block",
28259 minHeight: itemHeight
28260 } }
28261 }), option.text);
28262 },
28263 freeSolo: true,
28264 fullWidth: true,
28265 disableClearable: true,
28266 open: showSuggestions,
28267 onClose: function onClose(e) {
28268 var _e$relatedTarget;
28269 return setShowSuggestions("A" === ((_e$relatedTarget = e.relatedTarget) === null || _e$relatedTarget === void 0 ? void 0 : _e$relatedTarget.tagName));
28270 },
28271 onKeyDown: function onKeyDown(e) {
28272 if ("Enter" === e.key && !e.shiftKey && !showSuggestions) onSubmit(e);
28273 else if ("/" === e.key && "" === e.target.value) {
28274 e.preventDefault();
28275 setShowSuggestions(true);
28276 }
28277 }
28278 }, props));
28279 };
28280 PromptAutocomplete.propTypes = { onSubmit: import_prop_types$8.default.func.isRequired };
28281 PromptAutocomplete.TextInput = TextInput;
28282
28283 //#endregion
28284 //#region modules/ai/assets/js/editor/icons/arrow-left-icon.js
28285 init_extends();
28286 var ArrowLeftIcon = react.default.forwardRef(function(props, ref) {
28287 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
28288 fillRule: "evenodd",
28289 clipRule: "evenodd",
28290 d: "M9.53033 7.46967C9.82322 7.76256 9.82322 8.23744 9.53033 8.53033L6.81066 11.25H19C19.4142 11.25 19.75 11.5858 19.75 12C19.75 12.4142 19.4142 12.75 19 12.75H6.81066L9.53033 15.4697C9.82322 15.7626 9.82322 16.2374 9.53033 16.5303C9.23744 16.8232 8.76256 16.8232 8.46967 16.5303L4.46967 12.5303C4.17678 12.2374 4.17678 11.7626 4.46967 11.4697L8.46967 7.46967C8.76256 7.17678 9.23744 7.17678 9.53033 7.46967Z"
28291 }));
28292 });
28293
28294 //#endregion
28295 //#region modules/ai/assets/js/editor/icons/x-circle-icon.js
28296 init_extends();
28297 var XCircleIcon = react.default.forwardRef(function(props, ref) {
28298 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { d: "M12 2.69231C6.8595 2.69231 2.69231 6.8595 2.69231 12C2.69231 17.1405 6.8595 21.3077 12 21.3077C17.1405 21.3077 21.3077 17.1405 21.3077 12C21.3077 6.8595 17.1405 2.69231 12 2.69231ZM1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM9.14527 9.14527C9.47571 8.81483 10.0115 8.81483 10.3419 9.14527L12 10.8034L13.6581 9.14527C13.9885 8.81483 14.5243 8.81483 14.8547 9.14527C15.1852 9.47571 15.1852 10.0115 14.8547 10.3419L13.1966 12L14.8547 13.6581C15.1852 13.9885 15.1852 14.5243 14.8547 14.8547C14.5243 15.1852 13.9885 15.1852 13.6581 14.8547L12 13.1966L10.3419 14.8547C10.0115 15.1852 9.47571 15.1852 9.14527 14.8547C8.81483 14.5243 8.81483 13.9885 9.14527 13.6581L10.8034 12L9.14527 10.3419C8.81483 10.0115 8.81483 9.47571 9.14527 9.14527Z" }));
28299 });
28300
28301 //#endregion
28302 //#region modules/ai/assets/js/editor/icons/plus-circle-icon.js
28303 init_extends();
28304 var PlusCircleIcon = react.default.forwardRef(function(props, ref) {
28305 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", { d: "M12 2.69231C6.8595 2.69231 2.69231 6.8595 2.69231 12C2.69231 17.1405 6.8595 21.3077 12 21.3077C17.1405 21.3077 21.3077 17.1405 21.3077 12C21.3077 6.8595 17.1405 2.69231 12 2.69231ZM1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 7.76923C12.4673 7.76923 12.8462 8.14807 12.8462 8.61538V11.1538H15.3846C15.8519 11.1538 16.2308 11.5327 16.2308 12C16.2308 12.4673 15.8519 12.8462 15.3846 12.8462H12.8462V15.3846C12.8462 15.8519 12.4673 16.2308 12 16.2308C11.5327 16.2308 11.1538 15.8519 11.1538 15.3846V12.8462H8.61538C8.14807 12.8462 7.76923 12.4673 7.76923 12C7.76923 11.5327 8.14807 11.1538 8.61538 11.1538H11.1538V8.61538C11.1538 8.14807 11.5327 7.76923 12 7.76923Z" }));
28306 });
28307
28308 //#endregion
28309 //#region modules/ai/assets/js/editor/components/alert-dialog.js
28310 init_slicedToArray();
28311 var AlertDialog = function AlertDialog(props) {
28312 var _useState2 = _slicedToArray((0, react.useState)(true), 2);
28313 var isShown = _useState2[0];
28314 var setIsShown = _useState2[1];
28315 if (!isShown) return null;
28316 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, {
28317 open: true,
28318 maxWidth: "lg"
28319 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.DialogContent, { sx: { padding: 0 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { sx: {
28320 textAlign: "center",
28321 padding: 3
28322 } }, props.message), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
28323 alignItems: "center",
28324 spacing: 2,
28325 marginBottom: 2
28326 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
28327 variant: "contained",
28328 type: "button",
28329 color: "primary",
28330 onClick: function onClick() {
28331 var _props$onClose;
28332 setIsShown(false);
28333 (_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props);
28334 }
28335 }, (0, _wordpress_i18n.__)("Close", "elementor")))));
28336 };
28337 AlertDialog.propTypes = {
28338 message: import_prop_types$8.default.string.isRequired,
28339 onClose: import_prop_types$8.default.func
28340 };
28341
28342 //#endregion
28343 //#region modules/ai/assets/js/editor/hooks/use-timeout.js
28344 init_slicedToArray();
28345 var useTimeout = function useTimeout(delay) {
28346 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
28347 var isTimeout = _useState2[0];
28348 var setIsTimeout = _useState2[1];
28349 var timeoutIdRef = (0, react.useRef)(null);
28350 var turnOffTimeout = function turnOffTimeout() {
28351 clearTimeout(timeoutIdRef.current);
28352 setIsTimeout(false);
28353 };
28354 (0, react.useEffect)(function() {
28355 timeoutIdRef.current = setTimeout(function() {
28356 setIsTimeout(true);
28357 }, delay);
28358 return function() {
28359 clearTimeout(timeoutIdRef.current);
28360 };
28361 }, [delay]);
28362 return [isTimeout, turnOffTimeout];
28363 };
28364
28365 //#endregion
28366 //#region modules/ai/assets/js/editor/pages/form-layout/context/remote-config.js
28367 init_asyncToGenerator();
28368 init_slicedToArray();
28369 init_api();
28370 var RemoteConfigContext = react.default.createContext({});
28371 var useRemoteConfig = function useRemoteConfig() {
28372 return react.default.useContext(RemoteConfigContext);
28373 };
28374 var CONFIG_KEYS = {
28375 WEB_BASED_BUILDER_URL: "webBasedBuilderUrl",
28376 AUTH_TOKEN: "jwt"
28377 };
28378 var RemoteConfigProvider = function RemoteConfigProvider(props) {
28379 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
28380 var isLoading = _useState2[0];
28381 var setIsLoading = _useState2[1];
28382 var _useState4 = _slicedToArray((0, react.useState)(false), 2);
28383 var isLoaded = _useState4[0];
28384 var setIsLoaded = _useState4[1];
28385 var _useState6 = _slicedToArray((0, react.useState)(false), 2);
28386 var isError = _useState6[0];
28387 var setIsError = _useState6[1];
28388 var _useState8 = _slicedToArray((0, react.useState)({}), 2);
28389 var remoteConfig = _useState8[0];
28390 var setRemoteConfig = _useState8[1];
28391 var fetchData = /*#__PURE__*/ function() {
28392 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee() {
28393 var result;
28394 return import_regenerator$2.default.wrap(function(_context) {
28395 while (1) switch (_context.prev = _context.next) {
28396 case 0:
28397 setIsLoading(true);
28398 setIsError(false);
28399 _context.prev = 1;
28400 _context.next = 2;
28401 return getRemoteConfig().finally(function() {
28402 setIsLoaded(true);
28403 setIsLoading(false);
28404 });
28405 case 2:
28406 result = _context.sent;
28407 if (result.config) {
28408 _context.next = 3;
28409 break;
28410 }
28411 throw new Error("Invalid remote config");
28412 case 3:
28413 setRemoteConfig(result.config);
28414 _context.next = 5;
28415 break;
28416 case 4:
28417 _context.prev = 4;
28418 _context["catch"](1);
28419 setIsError(true);
28420 setIsLoaded(true);
28421 setIsLoading(false);
28422 case 5:
28423 case "end": return _context.stop();
28424 }
28425 }, _callee, null, [[1, 4]]);
28426 }));
28427 return function fetchData() {
28428 return _ref.apply(this, arguments);
28429 };
28430 }();
28431 (0, react.useEffect)(function() {
28432 window.addEventListener("elementor/connect/success", fetchData);
28433 return function() {
28434 window.removeEventListener("elementor/connect/success", fetchData);
28435 };
28436 }, []);
28437 if (!isLoaded && !isLoading) fetchData();
28438 return /*#__PURE__*/ react.default.createElement(RemoteConfigContext.Provider, { value: {
28439 isLoading,
28440 isLoaded,
28441 isError,
28442 remoteConfig
28443 } }, props.children);
28444 };
28445 RemoteConfigProvider.propTypes = {
28446 children: import_prop_types$8.default.node.isRequired,
28447 onError: import_prop_types$8.default.func.isRequired
28448 };
28449
28450 //#endregion
28451 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/url-dialog.js
28452 init_slicedToArray();
28453 init_requests_ids();
28454 var UrlDialog = function UrlDialog(props) {
28455 var _useTimeout2 = _slicedToArray(useTimeout(1e4), 2);
28456 var isTimeout = _useTimeout2[0];
28457 var turnOffTimeout = _useTimeout2[1];
28458 var _useUserInfo = useUserInfo();
28459 var isLoading = _useUserInfo.isLoading;
28460 var initialUsagePercentage = _useUserInfo.usagePercentage;
28461 var updateUsagePercentage = useRequestIds().updateUsagePercentage;
28462 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
28463 var isInitUsageDone = _useState2[0];
28464 var setIsInitUsageDone = _useState2[1];
28465 var builderUrl = useRemoteConfig().remoteConfig[CONFIG_KEYS.WEB_BASED_BUILDER_URL];
28466 var iframeOrigin = (builderUrl ? new URL(builderUrl) : {}).origin;
28467 var isOpen = (0, react.useRef)(false);
28468 (0, react.useEffect)(function() {
28469 if (!isInitUsageDone && !isLoading && (initialUsagePercentage || 0 === initialUsagePercentage)) {
28470 updateUsagePercentage(initialUsagePercentage);
28471 setIsInitUsageDone(true);
28472 }
28473 }, [
28474 isLoading,
28475 initialUsagePercentage,
28476 isInitUsageDone,
28477 updateUsagePercentage
28478 ]);
28479 (0, react.useEffect)(function() {
28480 if (!isOpen.current) try {
28481 window.$e.run("ai-integration/open-choose-element", { url: props.url });
28482 isOpen.current = true;
28483 } catch (error) {
28484 console.error(error);
28485 }
28486 }, [isOpen.current]);
28487 (0, react.useEffect)(function() {
28488 var onMessage = function onMessage(event) {
28489 if (event.origin !== iframeOrigin) return;
28490 var _event$data = event.data;
28491 var type = _event$data.type;
28492 var html = _event$data.html;
28493 var url = _event$data.url;
28494 switch (type) {
28495 case "element-selector/close":
28496 isOpen.current = false;
28497 props.onClose();
28498 break;
28499 case "element-selector/loaded":
28500 turnOffTimeout();
28501 isOpen.current = true;
28502 break;
28503 case "element-selector/attach":
28504 props.onAttach([{
28505 type: "url",
28506 previewHTML: html,
28507 content: html,
28508 label: url ? new URL(url).href : "",
28509 source: USER_URL_SOURCE
28510 }]);
28511 break;
28512 }
28513 };
28514 window.addEventListener("message", onMessage);
28515 return function() {
28516 window.removeEventListener("message", onMessage);
28517 };
28518 }, [
28519 iframeOrigin,
28520 props,
28521 turnOffTimeout
28522 ]);
28523 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, !isOpen.current && !isTimeout && /*#__PURE__*/ react.default.createElement(_elementor_ui.Dialog, {
28524 open: true,
28525 maxWidth: "lg"
28526 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { sx: {
28527 textAlign: "center",
28528 padding: 3
28529 } }, (0, _wordpress_i18n.__)("Loading...", "elementor"))), isTimeout && /*#__PURE__*/ react.default.createElement(AlertDialog, {
28530 message: (0, _wordpress_i18n.__)("The app is not responding. Please try again later. (#408)", "elementor"),
28531 onClose: props.onClose
28532 }));
28533 };
28534 UrlDialog.propTypes = {
28535 onAttach: import_prop_types$8.default.func.isRequired,
28536 onClose: import_prop_types$8.default.func.isRequired,
28537 url: import_prop_types$8.default.string
28538 };
28539
28540 //#endregion
28541 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/library-dialog.js
28542 var LibraryDialog = function LibraryDialog(props) {
28543 var isApplyingTemplate = (0, react.useRef)(false);
28544 (0, react.useEffect)(function() {
28545 var onLibraryHide = function onLibraryHide() {
28546 if (isApplyingTemplate.current) return;
28547 props.onClose();
28548 };
28549 $e.components.get("library").layout.getModal().on("hide", onLibraryHide);
28550 return function() {
28551 $e.components.get("library").layout.getModal().off("hide", onLibraryHide);
28552 };
28553 }, [props]);
28554 (0, react.useEffect)(function() {
28555 var onMessage = function onMessage(event) {
28556 var _event$data = event.data;
28557 var type = _event$data.type;
28558 var json = _event$data.json;
28559 var html = _event$data.html;
28560 var label = _event$data.label;
28561 var source = _event$data.source;
28562 switch (type) {
28563 case "library/attach:start":
28564 isApplyingTemplate.current = true;
28565 break;
28566 case "library/attach":
28567 props.onAttach([{
28568 type: ATTACHMENT_TYPE_JSON,
28569 previewHTML: html,
28570 content: json,
28571 label,
28572 source
28573 }]);
28574 isApplyingTemplate.current = false;
28575 props.onClose();
28576 break;
28577 }
28578 };
28579 window.addEventListener("message", onMessage);
28580 return function() {
28581 window.removeEventListener("message", onMessage);
28582 };
28583 });
28584 $e.run("library/open", {
28585 toDefault: true,
28586 mode: "ai-attachment"
28587 });
28588 isApplyingTemplate.current = false;
28589 return null;
28590 };
28591 LibraryDialog.propTypes = {
28592 onAttach: import_prop_types$8.default.func.isRequired,
28593 onClose: import_prop_types$8.default.func.isRequired
28594 };
28595
28596 //#endregion
28597 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/attach-dialog.js
28598 var AttachDialog = function AttachDialog(props) {
28599 var type = props.type;
28600 var url = props.url;
28601 switch (type) {
28602 case "url": return /*#__PURE__*/ react.default.createElement(UrlDialog, {
28603 url,
28604 onAttach: props.onAttach,
28605 onClose: props.onClose
28606 });
28607 case MENU_TYPE_LIBRARY: return /*#__PURE__*/ react.default.createElement(LibraryDialog, {
28608 onAttach: props.onAttach,
28609 onClose: props.onClose
28610 });
28611 }
28612 return null;
28613 };
28614 AttachDialog.propTypes = {
28615 type: import_prop_types$8.default.string,
28616 onAttach: import_prop_types$8.default.func,
28617 onClose: import_prop_types$8.default.func,
28618 url: import_prop_types$8.default.string
28619 };
28620
28621 //#endregion
28622 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/menu.js
28623 init_slicedToArray();
28624 init_use_introduction();
28625 var Menu = function Menu(props) {
28626 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
28627 var isOpen = _useState2[0];
28628 var setIsOpen = _useState2[1];
28629 var _useState4 = _slicedToArray((0, react.useState)(null), 2);
28630 var selectedType = _useState4[0];
28631 var setSelectedType = _useState4[1];
28632 var direction = (0, _elementor_ui.useTheme)().direction;
28633 var anchorRef = (0, react.useRef)(null);
28634 var _useIntroduction = useIntroduction("e-ai-attachment-badge");
28635 var isViewed = _useIntroduction.isViewed;
28636 var markAsViewed = _useIntroduction.markAsViewed;
28637 return /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
28638 size: "small",
28639 ref: anchorRef,
28640 disabled: props.disabled,
28641 onClick: function onClick() {
28642 setIsOpen(true);
28643 if (!isViewed) markAsViewed();
28644 },
28645 color: "secondary"
28646 }, function() {
28647 if (isOpen) return /*#__PURE__*/ react.default.createElement(XCircleIcon, { fontSize: "small" });
28648 else if (isViewed) return /*#__PURE__*/ react.default.createElement(PlusCircleIcon, { fontSize: "small" });
28649 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Badge, {
28650 color: "primary",
28651 badgeContent: " ",
28652 variant: "dot"
28653 }, /*#__PURE__*/ react.default.createElement(PlusCircleIcon, { fontSize: "small" }));
28654 }()), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popover, {
28655 open: isOpen,
28656 anchorEl: anchorRef.current,
28657 onClose: function onClose() {
28658 return setIsOpen(false);
28659 },
28660 anchorOrigin: {
28661 vertical: "bottom",
28662 horizontal: "rtl" === direction ? "right" : "left"
28663 },
28664 transformOrigin: {
28665 vertical: "top",
28666 horizontal: "rtl" === direction ? "right" : "left"
28667 }
28668 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, { sx: { width: 440 } }, props.items.map(function(item) {
28669 var IconComponent = item.icon;
28670 return /*#__PURE__*/ react.default.createElement(_elementor_ui.MenuItem, {
28671 key: item.type,
28672 onClick: function onClick() {
28673 setSelectedType(item.type);
28674 setIsOpen(false);
28675 }
28676 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ListItemIcon, null, /*#__PURE__*/ react.default.createElement(IconComponent, null)), item.title);
28677 }))), /*#__PURE__*/ react.default.createElement(AttachDialog, {
28678 type: selectedType,
28679 onAttach: props.onAttach,
28680 onClose: function onClose() {
28681 setIsOpen(false);
28682 setSelectedType(null);
28683 }
28684 }));
28685 };
28686 Menu.propTypes = {
28687 items: import_prop_types$8.default.arrayOf(import_prop_types$8.default.shape({
28688 title: import_prop_types$8.default.string.isRequired,
28689 type: import_prop_types$8.default.string.isRequired,
28690 icon: import_prop_types$8.default.elementType
28691 })).isRequired,
28692 onAttach: import_prop_types$8.default.func.isRequired,
28693 disabled: import_prop_types$8.default.bool
28694 };
28695
28696 //#endregion
28697 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/thumbnail.js
28698 var _templateObject;
28699 var THUMBNAIL_SIZE = 64;
28700 var StyledBody = (0, _elementor_ui.styled)("body")(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n html, body {\n margin: 0;\n padding: 0;\n overflow: hidden;\n }\n\n body > * {\n width: 100% !important;\n }\n\n body > img {\n height: 100%;\n object-fit: cover;\n }\n\n body:has(> img) {\n height: ", "px\n }\n"])), 64);
28701 var Thumbnail = function Thumbnail(props) {
28702 var _props$html$match;
28703 var _props$html$match2;
28704 var dataWidth = (_props$html$match = props.html.match("data-width=\"(?<width>\\d+)\"")) === null || _props$html$match === void 0 || (_props$html$match = _props$html$match.groups) === null || _props$html$match === void 0 ? void 0 : _props$html$match.width;
28705 var dataHeight = (_props$html$match2 = props.html.match("data-height=\"(?<height>\\d+)\"")) === null || _props$html$match2 === void 0 || (_props$html$match2 = _props$html$match2.groups) === null || _props$html$match2 === void 0 ? void 0 : _props$html$match2.height;
28706 var width = dataWidth ? parseInt(dataWidth) : 64;
28707 var height = dataHeight ? parseInt(dataHeight) : 64;
28708 var scale = 64 / Math.min(height, width);
28709 var top = height > width ? (64 - 64 * (height / width)) / 2 : 0;
28710 var left = width > height ? (64 - 64 * (width / height)) / 2 : 0;
28711 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
28712 dir: "ltr",
28713 sx: {
28714 position: "relative",
28715 cursor: "default",
28716 overflow: "hidden",
28717 border: "1px solid",
28718 borderColor: "grey.300",
28719 borderRadius: 1,
28720 boxSizing: "border-box",
28721 width: 64,
28722 height: 64,
28723 opacity: props.disabled ? .5 : 1
28724 }
28725 }, /*#__PURE__*/ react.default.createElement("iframe", {
28726 title: (0, _wordpress_i18n.__)("Preview", "elementor"),
28727 sandbox: "",
28728 srcDoc: "<style>" + StyledBody.componentStyle.rules.join("") + "</style>" + props.html,
28729 style: {
28730 border: "none",
28731 overflow: "hidden",
28732 width,
28733 height,
28734 transform: "scale(".concat(scale, ")"),
28735 transformOrigin: "".concat(left, "px ").concat(top, "px")
28736 }
28737 }));
28738 };
28739 Thumbnail.propTypes = {
28740 html: import_prop_types$8.default.string.isRequired,
28741 disabled: import_prop_types$8.default.bool
28742 };
28743
28744 //#endregion
28745 //#region modules/ai/assets/js/editor/types/attachment.js
28746 var AttachmentPropType = import_prop_types$8.default.shape({
28747 type: import_prop_types$8.default.string,
28748 previewHTML: import_prop_types$8.default.string,
28749 content: import_prop_types$8.default.string,
28750 label: import_prop_types$8.default.string,
28751 source: import_prop_types$8.default.string
28752 });
28753 var AttachmentsTypesPropType = import_prop_types$8.default.shape({ type: import_prop_types$8.default.shape({
28754 promptPlaceholder: import_prop_types$8.default.string,
28755 promptSuggestions: import_prop_types$8.default.arrayOf(import_prop_types$8.default.shape({ text: import_prop_types$8.default.string.isRequired })),
28756 previewGenerator: import_prop_types$8.default.func
28757 }) });
28758
28759 //#endregion
28760 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/thumbnail-json.js
28761 var ThumbnailJson = function ThumbnailJson(props) {
28762 var _props$attachments;
28763 var attachment = (_props$attachments = props.attachments) === null || _props$attachments === void 0 ? void 0 : _props$attachments.find(function(item) {
28764 return "json" === item.type;
28765 });
28766 if (!attachment) return null;
28767 if (!attachment.previewHTML) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, {
28768 animation: "wave",
28769 variant: "rounded",
28770 width: 60,
28771 height: 60
28772 });
28773 return /*#__PURE__*/ react.default.createElement(Thumbnail, {
28774 html: attachment.previewHTML,
28775 disabled: props.disabled
28776 });
28777 };
28778 ThumbnailJson.propTypes = {
28779 attachments: import_prop_types$8.default.arrayOf(AttachmentPropType).isRequired,
28780 disabled: import_prop_types$8.default.bool
28781 };
28782
28783 //#endregion
28784 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/thumbnail-url.js
28785 var ThumbnailUrl = function ThumbnailUrl(props) {
28786 var _props$attachments;
28787 var attachment = (_props$attachments = props.attachments) === null || _props$attachments === void 0 ? void 0 : _props$attachments.find(function(item) {
28788 return "url" === item.type;
28789 });
28790 if (!attachment) return null;
28791 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
28792 position: "relative",
28793 "&:hover::before": {
28794 content: "\"\"",
28795 position: "absolute",
28796 userSelect: "none",
28797 inset: 0,
28798 backgroundColor: "rgba(0,0,0,0.6)",
28799 borderRadius: 1,
28800 zIndex: 1
28801 },
28802 "&:hover .remove-attachment": { display: "flex" }
28803 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
28804 className: "remove-attachment",
28805 size: "small",
28806 "aria-label": (0, _wordpress_i18n.__)("Remove", "elementor"),
28807 disabled: props.disabled,
28808 onClick: function onClick(event) {
28809 event.stopPropagation();
28810 props.onDetach();
28811 },
28812 sx: {
28813 display: "none",
28814 position: "absolute",
28815 insetInlineEnd: 4,
28816 insetBlockStart: 4,
28817 backgroundColor: "secondary.main",
28818 zIndex: 1,
28819 borderRadius: 1,
28820 p: "3px",
28821 "&:hover": { backgroundColor: "secondary.dark" }
28822 }
28823 }, /*#__PURE__*/ react.default.createElement(_elementor_icons.TrashIcon, { sx: {
28824 fontSize: "1.125rem",
28825 color: "common.white"
28826 } })), /*#__PURE__*/ react.default.createElement(Thumbnail, {
28827 disabled: props.disabled,
28828 html: attachment.previewHTML
28829 }));
28830 };
28831 ThumbnailUrl.propTypes = {
28832 attachments: import_prop_types$8.default.arrayOf(AttachmentPropType).isRequired,
28833 disabled: import_prop_types$8.default.bool,
28834 onDetach: import_prop_types$8.default.func
28835 };
28836
28837 //#endregion
28838 //#region modules/ai/assets/js/editor/icons/website-icon.js
28839 init_extends();
28840 var WebsiteIcon = react.default.forwardRef(function(props, ref) {
28841 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
28842 fillRule: "evenodd",
28843 clipRule: "evenodd",
28844 d: "M4.16707 3.95837C4.11182 3.95837 4.05883 3.98032 4.01976 4.01939C3.98069 4.05846 3.95874 4.11145 3.95874 4.16671V6.04171H6.04207V3.95837H4.16707ZM4.16707 2.70837C3.7803 2.70837 3.40937 2.86202 3.13588 3.13551C2.86239 3.409 2.70874 3.77993 2.70874 4.16671V15.8334C2.70874 16.2201 2.86239 16.5911 3.13588 16.8646C3.40937 17.1381 3.7803 17.2917 4.16707 17.2917H15.8337C16.2205 17.2917 16.5914 17.1381 16.8649 16.8646C17.1384 16.5911 17.2921 16.2201 17.2921 15.8334V4.16671C17.2921 3.77993 17.1384 3.409 16.8649 3.13551C16.5914 2.86202 16.2205 2.70837 15.8337 2.70837H4.16707ZM7.29207 3.95837V6.04171H16.0421V4.16671C16.0421 4.11145 16.0201 4.05846 15.9811 4.01939C15.942 3.98032 15.889 3.95837 15.8337 3.95837H7.29207ZM16.0421 7.29171H3.95874V15.8334C3.95874 15.8886 3.98069 15.9416 4.01976 15.9807C4.05883 16.0198 4.11182 16.0417 4.16707 16.0417H15.8337C15.889 16.0417 15.942 16.0198 15.9811 15.9807C16.0201 15.9416 16.0421 15.8886 16.0421 15.8334V7.29171Z"
28845 }));
28846 });
28847
28848 //#endregion
28849 //#region modules/ai/assets/js/editor/icons/copy-page-icon.js
28850 init_extends();
28851 var CopyPageIcon = react.default.forwardRef(function(props, ref) {
28852 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
28853 fillRule: "evenodd",
28854 clipRule: "evenodd",
28855 d: "M16.6667 0.208496C17.0534 0.208496 17.4244 0.362142 17.6979 0.635632C17.9714 0.909123 18.125 1.28006 18.125 1.66683V11.6668C18.125 12.0536 17.9714 12.4245 17.6979 12.698C17.4244 12.9715 17.0534 13.1252 16.6667 13.1252H14.7917V16.6668C14.7917 17.0536 14.638 17.4245 14.3645 17.698C14.091 17.9715 13.7201 18.1252 13.3333 18.1252H3.33333C2.94656 18.1252 2.57563 17.9715 2.30214 17.698C2.02865 17.4245 1.875 17.0536 1.875 16.6668V6.66683C1.875 6.28005 2.02865 5.90912 2.30214 5.63563C2.57563 5.36214 2.94656 5.2085 3.33333 5.2085H5.20833V1.66683C5.20833 1.28005 5.36198 0.909122 5.63547 0.635632C5.90896 0.362142 6.27989 0.208496 6.66667 0.208496H16.6667ZM6.66667 1.4585C6.61141 1.4585 6.55842 1.48045 6.51935 1.51952C6.48028 1.55859 6.45833 1.61158 6.45833 1.66683V3.54183H8.54167V1.4585H6.66667ZM3.125 9.79183V16.6668C3.125 16.7221 3.14695 16.7751 3.18602 16.8141C3.22509 16.8532 3.27808 16.8752 3.33333 16.8752H13.3333C13.3886 16.8752 13.4416 16.8532 13.4806 16.8141C13.5197 16.7751 13.5417 16.7221 13.5417 16.6668V13.1252H6.66667C6.27989 13.1252 5.90896 12.9715 5.63547 12.698C5.36198 12.4245 5.20833 12.0536 5.20833 11.6668V9.79183H3.125ZM5.20833 8.54183H3.125V6.66683C3.125 6.61158 3.14695 6.55859 3.18602 6.51952C3.22509 6.48045 3.27808 6.4585 3.33333 6.4585H5.20833V8.54183ZM6.45833 11.6668C6.45833 11.7221 6.48028 11.7751 6.51935 11.8141C6.55842 11.8532 6.61141 11.8752 6.66667 11.8752H16.6667C16.7219 11.8752 16.7749 11.8532 16.814 11.8141C16.853 11.7751 16.875 11.7221 16.875 11.6668V4.79183H6.45833V11.6668ZM9.79167 1.4585V3.54183H16.875V1.66683C16.875 1.61157 16.853 1.55858 16.814 1.51952C16.7749 1.48045 16.7219 1.4585 16.6667 1.4585H9.79167Z"
28856 }));
28857 });
28858
28859 //#endregion
28860 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments.js
28861 init_extends();
28862 var ATTACHMENT_TYPE_JSON = "json";
28863 var ATTACHMENT_TYPE_URL = "url";
28864 var MENU_TYPE_LIBRARY = "library";
28865 var USER_URL_SOURCE = "user-url";
28866 var Attachments = function Attachments(props) {
28867 if (!props.attachments.length) return /*#__PURE__*/ react.default.createElement(Menu, {
28868 disabled: props.disabled,
28869 onAttach: props.onAttach,
28870 items: [{
28871 title: (0, _wordpress_i18n.__)("Reference a website", "elementor"),
28872 icon: WebsiteIcon,
28873 type: "url"
28874 }, {
28875 title: (0, _wordpress_i18n.__)("Create variations from Template Library", "elementor"),
28876 icon: CopyPageIcon,
28877 type: MENU_TYPE_LIBRARY
28878 }]
28879 });
28880 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
28881 direction: "row",
28882 spacing: 1
28883 }, props.attachments.map(function(attachment, index) {
28884 switch (attachment.type) {
28885 case ATTACHMENT_TYPE_JSON: return /*#__PURE__*/ react.default.createElement(ThumbnailJson, _extends$1({ key: index }, props));
28886 case "url": return /*#__PURE__*/ react.default.createElement(ThumbnailUrl, _extends$1({ key: index }, props));
28887 default: return null;
28888 }
28889 }));
28890 };
28891 Attachments.propTypes = {
28892 attachments: import_prop_types$8.default.arrayOf(AttachmentPropType).isRequired,
28893 onAttach: import_prop_types$8.default.func.isRequired,
28894 onDetach: import_prop_types$8.default.func,
28895 disabled: import_prop_types$8.default.bool
28896 };
28897
28898 //#endregion
28899 //#region modules/ai/assets/js/editor/pages/form-layout/components/prompt-form.js
28900 init_slicedToArray();
28901 init_extends();
28902 init_objectWithoutProperties$1();
28903 var _excluded$1 = ["tooltip"];
28904 var PROMPT_SUGGESTIONS = Object.freeze([
28905 { text: (0, _wordpress_i18n.__)("Hero section on [topic] with heading, text, buttons on the right, and an image on the left", "elementor.com") },
28906 { text: (0, _wordpress_i18n.__)("About Us section on [topic] with heading, text, and big image below", "elementor.com") },
28907 { text: (0, _wordpress_i18n.__)("Team section with four image boxes showcasing team members", "elementor.com") },
28908 { text: (0, _wordpress_i18n.__)("FAQ section with a toggle widget showcasing FAQs about [topic]", "elementor.com") },
28909 { text: (0, _wordpress_i18n.__)("Gallery section with a carousel displaying three images at once", "elementor.com") },
28910 { text: (0, _wordpress_i18n.__)("Contact section with a form for [topic]", "elementor.com") },
28911 { text: (0, _wordpress_i18n.__)("Client section featuring companies' logos", "elementor.com") },
28912 { text: (0, _wordpress_i18n.__)("Testimonial section with testimonials, each featuring a star rating and an image", "elementor.com") },
28913 { text: (0, _wordpress_i18n.__)("Service section about [topic], showcasing four services with buttons", "elementor.com") },
28914 { text: (0, _wordpress_i18n.__)("Stats section with counters displaying data about [topic]", "elementor.com") },
28915 { text: (0, _wordpress_i18n.__)("Quote section with colored background, featuring a centered quote", "elementor.com") },
28916 { text: (0, _wordpress_i18n.__)("Pricing section for [topic] with a pricing list", "elementor.com") },
28917 { text: (0, _wordpress_i18n.__)("Subscribe section featuring a simple email form, inviting users to stay informed on [topic]", "elementor.com") }
28918 ]);
28919 var IconButtonWithTooltip = function IconButtonWithTooltip(_ref) {
28920 var tooltip = _ref.tooltip;
28921 var props = _objectWithoutProperties$1(_ref, _excluded$1);
28922 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: tooltip }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
28923 component: "span",
28924 sx: { cursor: props.disabled ? "default" : "pointer" }
28925 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, props)));
28926 };
28927 IconButtonWithTooltip.propTypes = {
28928 tooltip: import_prop_types$8.default.string,
28929 disabled: import_prop_types$8.default.bool
28930 };
28931 var BackButton = function BackButton(props) {
28932 return /*#__PURE__*/ react.default.createElement(IconButtonWithTooltip, _extends$1({
28933 size: "small",
28934 color: "secondary",
28935 tooltip: (0, _wordpress_i18n.__)("Back to results", "elementor")
28936 }, props), /*#__PURE__*/ react.default.createElement(ArrowLeftIcon, null));
28937 };
28938 var EditButton = function EditButton(props) {
28939 return /*#__PURE__*/ react.default.createElement(IconButtonWithTooltip, _extends$1({
28940 size: "small",
28941 color: "primary",
28942 tooltip: (0, _wordpress_i18n.__)("Edit prompt", "elementor")
28943 }, props), /*#__PURE__*/ react.default.createElement(EditIcon$1, null));
28944 };
28945 var GenerateButton = function GenerateButton(props) {
28946 return /*#__PURE__*/ react.default.createElement(GenerateSubmit, _extends$1({
28947 size: "small",
28948 fullWidth: false
28949 }, props), (0, _wordpress_i18n.__)("Generate", "elementor"));
28950 };
28951 var PromptForm = (0, react.forwardRef)(function(_ref2, ref) {
28952 var _attachments$;
28953 var attachments = _ref2.attachments;
28954 var isActive = _ref2.isActive;
28955 var isLoading = _ref2.isLoading;
28956 var _ref2$showActions = _ref2.showActions;
28957 var showActions = _ref2$showActions === void 0 ? false : _ref2$showActions;
28958 var onAttach = _ref2.onAttach;
28959 var onDetach = _ref2.onDetach;
28960 var _onSubmit = _ref2.onSubmit;
28961 var onBack = _ref2.onBack;
28962 var onEdit = _ref2.onEdit;
28963 var _ref2$shouldResetProm = _ref2.shouldResetPrompt;
28964 var shouldResetPrompt = _ref2$shouldResetProm === void 0 ? false : _ref2$shouldResetProm;
28965 var _useState2 = _slicedToArray((0, react.useState)(""), 2);
28966 var prompt = _useState2[0];
28967 var setPrompt = _useState2[1];
28968 (0, react.useEffect)(function() {
28969 if (shouldResetPrompt) setPrompt("");
28970 }, [shouldResetPrompt]);
28971 var _usePromptEnhancer = usePromptEnhancer(prompt, "layout");
28972 var isEnhancing = _usePromptEnhancer.isEnhancing;
28973 var enhance = _usePromptEnhancer.enhance;
28974 var previousPrompt = (0, react.useRef)("");
28975 var attachmentsTypes = useConfig().attachmentsTypes;
28976 var isInputDisabled = isLoading || isEnhancing || !isActive;
28977 var isInputEmpty = "" === prompt && !attachments.length;
28978 var isGenerateDisabled = isInputDisabled || isInputEmpty;
28979 var attachmentsConfig = attachmentsTypes[((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.type) || ""];
28980 var promptSuggestions = (attachmentsConfig === null || attachmentsConfig === void 0 ? void 0 : attachmentsConfig.promptSuggestions) || PROMPT_SUGGESTIONS;
28981 var promptPlaceholder = (attachmentsConfig === null || attachmentsConfig === void 0 ? void 0 : attachmentsConfig.promptPlaceholder) || (0, _wordpress_i18n.__)("Press '/' for suggested prompts or describe the layout you want to create", "elementor");
28982 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
28983 component: "form",
28984 onSubmit: function onSubmit(e) {
28985 return _onSubmit(e, prompt);
28986 },
28987 direction: "row",
28988 sx: { p: 3 },
28989 alignItems: "start",
28990 gap: 1
28991 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
28992 direction: "row",
28993 alignItems: "start",
28994 flexGrow: 1,
28995 spacing: 2
28996 }, showActions && (isActive ? /*#__PURE__*/ react.default.createElement(BackButton, {
28997 disabled: isLoading || isEnhancing,
28998 onClick: function handleBack() {
28999 setPrompt(previousPrompt.current);
29000 onBack();
29001 }
29002 }) : /*#__PURE__*/ react.default.createElement(EditButton, {
29003 disabled: isLoading,
29004 onClick: function handleEdit() {
29005 previousPrompt.current = prompt;
29006 onEdit();
29007 }
29008 })), /*#__PURE__*/ react.default.createElement(Attachments, {
29009 attachments,
29010 onAttach,
29011 onDetach,
29012 disabled: isInputDisabled
29013 }), /*#__PURE__*/ react.default.createElement(PromptAutocomplete, {
29014 value: prompt,
29015 disabled: isInputDisabled,
29016 onSubmit: function onSubmit(e) {
29017 return _onSubmit(e, prompt);
29018 },
29019 options: promptSuggestions,
29020 onChange: function onChange(_, selectedValue) {
29021 return setPrompt(selectedValue.text + " ");
29022 },
29023 renderInput: function renderInput(params) {
29024 return /*#__PURE__*/ react.default.createElement(PromptAutocomplete.TextInput, _extends$1({}, params, {
29025 ref,
29026 onChange: function onChange(e) {
29027 return setPrompt(e.target.value);
29028 },
29029 placeholder: promptPlaceholder
29030 }));
29031 }
29032 })), /*#__PURE__*/ react.default.createElement(EnhanceButton, {
29033 size: "small",
29034 disabled: isGenerateDisabled || "" === prompt,
29035 isLoading: isEnhancing,
29036 onClick: function onClick() {
29037 return enhance().then(function(_ref3) {
29038 var result = _ref3.result;
29039 return setPrompt(result);
29040 });
29041 }
29042 }), /*#__PURE__*/ react.default.createElement(GenerateButton, { disabled: isGenerateDisabled }));
29043 });
29044 PromptForm.propTypes = {
29045 isActive: import_prop_types$8.default.bool,
29046 onAttach: import_prop_types$8.default.func,
29047 onDetach: import_prop_types$8.default.func,
29048 isLoading: import_prop_types$8.default.bool,
29049 showActions: import_prop_types$8.default.bool,
29050 onSubmit: import_prop_types$8.default.func.isRequired,
29051 onBack: import_prop_types$8.default.func.isRequired,
29052 onEdit: import_prop_types$8.default.func.isRequired,
29053 attachments: import_prop_types$8.default.arrayOf(AttachmentPropType),
29054 shouldResetPrompt: import_prop_types$8.default.bool
29055 };
29056
29057 //#endregion
29058 //#region modules/ai/assets/js/editor/pages/form-layout/components/screenshot-container.js
29059 var ScreenshotContainer = (0, _elementor_ui.styled)(_elementor_ui.Box, { shouldForwardProp: function shouldForwardProp(prop) {
29060 return prop !== "outlineOffset";
29061 } })(function(_ref) {
29062 var theme = _ref.theme;
29063 var selected = _ref.selected;
29064 var height = _ref.height;
29065 var disabled = _ref.disabled;
29066 var _ref$outlineOffset = _ref.outlineOffset;
29067 var outlineOffset = _ref$outlineOffset === void 0 ? "0px" : _ref$outlineOffset;
29068 var outlineColor = selected ? theme.palette.text.primary : theme.palette.text.disabled;
29069 var outline = "2px solid ".concat(outlineColor);
29070 return {
29071 height,
29072 cursor: disabled ? "default" : "pointer",
29073 overflow: "hidden",
29074 boxSizing: "border-box",
29075 backgroundPosition: "top center",
29076 backgroundSize: "100% auto",
29077 backgroundRepeat: "no-repeat",
29078 backgroundColor: theme.palette.common.white,
29079 borderRadius: theme.shape.borderRadius * .5,
29080 outlineOffset,
29081 outline,
29082 opacity: disabled ? "0.4" : "1",
29083 transition: "all 50ms linear",
29084 "&:hover": disabled ? {} : { outlineColor: theme.palette.text.primary }
29085 };
29086 });
29087
29088 //#endregion
29089 //#region modules/ai/assets/js/editor/pages/form-layout/components/screenshot-unavailable.js
29090 init_extends();
29091 init_defineProperty$1();
29092 function ownKeys$1(e, r) {
29093 var t = Object.keys(e);
29094 if (Object.getOwnPropertySymbols) {
29095 var o = Object.getOwnPropertySymbols(e);
29096 r && (o = o.filter(function(r) {
29097 return Object.getOwnPropertyDescriptor(e, r).enumerable;
29098 })), t.push.apply(t, o);
29099 }
29100 return t;
29101 }
29102 __name(ownKeys$1, "ownKeys");
29103 function _objectSpread$1(e) {
29104 for (var r = 1; r < arguments.length; r++) {
29105 var t = null != arguments[r] ? arguments[r] : {};
29106 r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r) {
29107 _defineProperty$1(e, r, t[r]);
29108 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r) {
29109 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
29110 });
29111 }
29112 return e;
29113 }
29114 __name(_objectSpread$1, "_objectSpread");
29115 function ScreenshotUnavailable(props) {
29116 return /*#__PURE__*/ react.default.createElement(ScreenshotContainer, _extends$1({}, props, { sx: _objectSpread$1(_objectSpread$1({}, props.sx || {}), {}, {
29117 display: "flex",
29118 alignItems: "center",
29119 justifyContent: "center",
29120 backgroundColor: "background.paper",
29121 color: "text.tertiary",
29122 fontStyle: "italic",
29123 fontSize: "12px",
29124 paddingInline: 12,
29125 textAlign: "center",
29126 lineHeight: 1.5
29127 }) }), (0, _wordpress_i18n.__)("Preview unavailable", "elementor"));
29128 }
29129 ScreenshotUnavailable.propTypes = { sx: import_prop_types$8.default.object };
29130
29131 //#endregion
29132 //#region modules/ai/assets/js/editor/icons/lock-icon.js
29133 init_extends();
29134 var LockIcon = react.default.forwardRef(function(props, ref) {
29135 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
29136 fillRule: "evenodd",
29137 clipRule: "evenodd",
29138 d: "M7.8125 11.9996C7.29473 11.9996 6.875 12.4473 6.875 12.9996V18.9996C6.875 19.5519 7.29473 19.9996 7.8125 19.9996H17.1875C17.7053 19.9996 18.125 19.5519 18.125 18.9996V12.9996C18.125 12.4473 17.7053 11.9996 17.1875 11.9996H7.8125ZM5 12.9996C5 11.3428 6.2592 9.99963 7.8125 9.99963H17.1875C18.7408 9.99963 20 11.3428 20 12.9996V18.9996C20 20.6565 18.7408 21.9996 17.1875 21.9996H7.8125C6.2592 21.9996 5 20.6565 5 18.9996V12.9996Z"
29139 }), /*#__PURE__*/ react.default.createElement("path", {
29140 fillRule: "evenodd",
29141 clipRule: "evenodd",
29142 d: "M12.5 3.90527C11.7044 3.90527 10.9413 4.22134 10.3787 4.78395C9.81607 5.34656 9.5 6.10962 9.5 6.90527V10.9053C9.5 11.4576 9.05228 11.9053 8.5 11.9053C7.94772 11.9053 7.5 11.4576 7.5 10.9053V6.90527C7.5 5.57919 8.02678 4.30742 8.96447 3.36974C9.90215 2.43206 11.1739 1.90527 12.5 1.90527C13.8261 1.90527 15.0979 2.43206 16.0355 3.36974C16.9732 4.30742 17.5 5.57919 17.5 6.90527V10.9053C17.5 11.4576 17.0523 11.9053 16.5 11.9053C15.9477 11.9053 15.5 11.4576 15.5 10.9053V6.90527C15.5 6.10962 15.1839 5.34656 14.6213 4.78395C14.0587 4.22134 13.2956 3.90527 12.5 3.90527Z"
29143 }), /*#__PURE__*/ react.default.createElement("path", { d: "M6 12H19V20H6V12Z" }));
29144 });
29145
29146 //#endregion
29147 //#region modules/ai/assets/js/editor/pages/form-layout/components/pro-template-indicator.js
29148 init_slicedToArray();
29149 var popoverId = "e-pro-upgrade-popover";
29150 var StyledContent = (0, _elementor_ui.styled)(_elementor_ui.Paper)(function(_ref) {
29151 var theme = _ref.theme;
29152 return {
29153 position: "relative",
29154 padding: theme.spacing(3),
29155 boxShadow: theme.shadows[4],
29156 zIndex: "9999"
29157 };
29158 });
29159 var StyledArrow = (0, _elementor_ui.styled)(_elementor_ui.Box)(function(_ref2) {
29160 var theme = _ref2.theme;
29161 return {
29162 position: "absolute",
29163 width: theme.spacing(5),
29164 height: theme.spacing(5),
29165 overflow: "hidden",
29166 left: "100% !important",
29167 transform: "translateX(-50%) translateY(-50%) rotate(var(--rotate, 0deg)) !important",
29168 "&::after": {
29169 backgroundColor: theme.palette.background.paper,
29170 content: "\"\"",
29171 display: "block",
29172 position: "absolute",
29173 width: theme.spacing(2.5),
29174 height: theme.spacing(2.5),
29175 top: "50%",
29176 left: "50%",
29177 transform: "translateX(-50%) translateY(-50%) rotate(45deg)",
29178 boxShadow: "5px -5px 5px 0px rgba(0, 0, 0, 0.2)",
29179 backgroundImage: "linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))"
29180 }
29181 };
29182 });
29183 var ProTemplateIndicator = function ProTemplateIndicator() {
29184 var actionUrl = "https://go.elementor.com/go-pro-ai/";
29185 var actionLabel = (0, _wordpress_i18n.__)("Go Pro", "elementor");
29186 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
29187 var isPopoverOpen = _useState2[0];
29188 var setIsPopoverOpen = _useState2[1];
29189 var anchorEl = (0, react.useRef)(null);
29190 var arrowEl = (0, react.useRef)(null);
29191 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
29192 flexDirection: "row-reverse",
29193 component: "span",
29194 display: "flex",
29195 onMouseLeave: function hidePopover() {
29196 return setIsPopoverOpen(false);
29197 },
29198 alignItems: "center"
29199 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
29200 ref: anchorEl,
29201 onMouseEnter: function showPopover() {
29202 return setIsPopoverOpen(true);
29203 },
29204 onClick: function onClick(e) {
29205 return e.stopPropagation();
29206 },
29207 "aria-owns": isPopoverOpen ? popoverId : void 0,
29208 "aria-haspopup": "true",
29209 sx: {
29210 m: 1,
29211 "&:hover": { backgroundColor: "action.selected" }
29212 }
29213 }, /*#__PURE__*/ react.default.createElement(LockIcon, { sx: { color: "text.primary" } })), /*#__PURE__*/ react.default.createElement(_elementor_ui.Popper, {
29214 open: isPopoverOpen,
29215 popperOptions: {
29216 placement: "left-start",
29217 modifiers: [{
29218 name: "arrow",
29219 enabled: true,
29220 options: {
29221 element: arrowEl.current,
29222 padding: 5
29223 }
29224 }, {
29225 name: "offset",
29226 options: { offset: [0, 10] }
29227 }]
29228 },
29229 anchorEl: anchorEl.current,
29230 sx: {
29231 zIndex: "9999",
29232 maxWidth: 300
29233 }
29234 }, /*#__PURE__*/ react.default.createElement(StyledContent, null, /*#__PURE__*/ react.default.createElement(StyledArrow, { ref: arrowEl }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Stack, {
29235 alignItems: "start",
29236 spacing: 2
29237 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Chip, {
29238 color: "promotion",
29239 variant: "outlined",
29240 size: "small",
29241 label: (0, _wordpress_i18n.__)("Pro", "elementor"),
29242 icon: /*#__PURE__*/ react.default.createElement(LockIcon, null)
29243 }), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, { variant: "body2" }, (0, _wordpress_i18n.__)("This result includes an Elementor Pro widget that's not available with your current plan. Upgrade to use all the widgets in this result.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, {
29244 variant: "contained",
29245 color: "promotion",
29246 size: "small",
29247 href: actionUrl,
29248 target: "_blank",
29249 sx: { alignSelf: "flex-end" }
29250 }, actionLabel)))));
29251 };
29252
29253 //#endregion
29254 //#region modules/ai/assets/js/editor/pages/form-layout/components/template-badge.js
29255 var TemplateBadge = function TemplateBadge(props) {
29256 var hasPro = useConfig().hasPro;
29257 if ("Pro" === props.type && !hasPro) return /*#__PURE__*/ react.default.createElement(ProTemplateIndicator, null);
29258 return null;
29259 };
29260 TemplateBadge.propTypes = { type: import_prop_types$8.default.string };
29261
29262 //#endregion
29263 //#region modules/ai/assets/js/editor/pages/form-layout/components/screenshot.js
29264 init_defineProperty$1();
29265 function ownKeys(e, r) {
29266 var t = Object.keys(e);
29267 if (Object.getOwnPropertySymbols) {
29268 var o = Object.getOwnPropertySymbols(e);
29269 r && (o = o.filter(function(r) {
29270 return Object.getOwnPropertyDescriptor(e, r).enumerable;
29271 })), t.push.apply(t, o);
29272 }
29273 return t;
29274 }
29275 function _objectSpread(e) {
29276 for (var r = 1; r < arguments.length; r++) {
29277 var t = null != arguments[r] ? arguments[r] : {};
29278 r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
29279 _defineProperty$1(e, r, t[r]);
29280 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
29281 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
29282 });
29283 }
29284 return e;
29285 }
29286 var SCREENSHOT_HEIGHT = "138px";
29287 var Screenshot = function Screenshot(_ref) {
29288 var url = _ref.url;
29289 var type = _ref.type;
29290 var _ref$isLoading = _ref.isLoading;
29291 var isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
29292 var _ref$isSelected = _ref.isSelected;
29293 var isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected;
29294 var isPlaceholder = _ref.isPlaceholder;
29295 var disabled = _ref.disabled;
29296 var onClick = _ref.onClick;
29297 var _ref$sx = _ref.sx;
29298 var sx = _ref$sx === void 0 ? {} : _ref$sx;
29299 var outlineOffset = _ref.outlineOffset;
29300 if (isPlaceholder) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: _objectSpread({ height: SCREENSHOT_HEIGHT }, sx) });
29301 if (isLoading) return /*#__PURE__*/ react.default.createElement(_elementor_ui.Skeleton, {
29302 width: "100%",
29303 animation: "wave",
29304 variant: "rounded",
29305 height: SCREENSHOT_HEIGHT,
29306 sx
29307 });
29308 if (!url) return /*#__PURE__*/ react.default.createElement(ScreenshotUnavailable, {
29309 selected: isSelected,
29310 disabled,
29311 sx,
29312 onClick,
29313 height: SCREENSHOT_HEIGHT,
29314 outlineOffset
29315 });
29316 return /*#__PURE__*/ react.default.createElement(ScreenshotContainer, {
29317 selected: isSelected,
29318 disabled,
29319 sx: _objectSpread({ backgroundImage: "url('".concat(url, "')") }, sx),
29320 onClick,
29321 height: SCREENSHOT_HEIGHT,
29322 outlineOffset
29323 }, /*#__PURE__*/ react.default.createElement(TemplateBadge, { type }));
29324 };
29325 Screenshot.propTypes = {
29326 isSelected: import_prop_types$8.default.bool,
29327 isLoading: import_prop_types$8.default.bool,
29328 isPlaceholder: import_prop_types$8.default.bool,
29329 disabled: import_prop_types$8.default.bool,
29330 onClick: import_prop_types$8.default.func.isRequired,
29331 url: import_prop_types$8.default.string,
29332 type: import_prop_types$8.default.string,
29333 sx: import_prop_types$8.default.object,
29334 outlineOffset: import_prop_types$8.default.string
29335 };
29336
29337 //#endregion
29338 //#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-layout-prompt.js
29339 init_api();
29340 init_use_prompt();
29341 var useLayoutPrompt = function useLayoutPrompt(type, initialValue) {
29342 return usePrompt(function(requestBody, signal) {
29343 requestBody.variationType = type;
29344 return generateLayout(requestBody, signal);
29345 }, initialValue);
29346 };
29347
29348 //#endregion
29349 //#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-screenshot.js
29350 init_asyncToGenerator();
29351 init_slicedToArray();
29352 var ERROR_INITIAL_VALUE = "";
29353 var useScreenshot = function useScreenshot(type, onData) {
29354 var _useState2 = _slicedToArray((0, react.useState)(ERROR_INITIAL_VALUE), 2);
29355 var error = _useState2[0];
29356 var setError = _useState2[1];
29357 var _useState4 = _slicedToArray((0, react.useState)(false), 2);
29358 var isLoading = _useState4[0];
29359 var setIsLoading = _useState4[1];
29360 var layoutData = useLayoutPrompt(type, null);
29361 return {
29362 generate: function generate(requestBody, signal) {
29363 setIsLoading(true);
29364 setError(ERROR_INITIAL_VALUE);
29365 return layoutData.send(requestBody, signal).then(/*#__PURE__*/ function() {
29366 var _ref = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(data) {
29367 var createdScreenshot;
29368 return import_regenerator$2.default.wrap(function(_context) {
29369 while (1) switch (_context.prev = _context.next) {
29370 case 0:
29371 _context.next = 1;
29372 return onData(data.result);
29373 case 1:
29374 createdScreenshot = _context.sent;
29375 createdScreenshot.sendUsageData = function() {
29376 return layoutData.sendUsageData(data);
29377 };
29378 createdScreenshot.baseTemplateId = data.baseTemplateId;
29379 createdScreenshot.type = data.type;
29380 return _context.abrupt("return", createdScreenshot);
29381 case 2:
29382 case "end": return _context.stop();
29383 }
29384 }, _callee);
29385 }));
29386 return function(_x) {
29387 return _ref.apply(this, arguments);
29388 };
29389 }()).catch(function(err) {
29390 setError(err.extra_data ? err : err.message || err);
29391 throw err;
29392 }).finally(function() {
29393 return setIsLoading(false);
29394 });
29395 },
29396 error,
29397 isLoading
29398 };
29399 };
29400
29401 //#endregion
29402 //#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-screenshots.js
29403 init_asyncToGenerator();
29404 init_slicedToArray();
29405 init_requests_ids();
29406 var PENDING_VALUE = { isPending: true };
29407 var useScreenshots = function useScreenshots(_ref) {
29408 var onData = _ref.onData;
29409 var _useState2 = _slicedToArray((0, react.useState)([]), 2);
29410 var screenshots = _useState2[0];
29411 var setScreenshots = _useState2[1];
29412 /**
29413 * The ids for each request are:
29414 * - editorSessionId: a unique id for each editor opening
29415 * - sessionId: a unique id for each session. (open the AI builder)
29416 * - generateId: a unique id for each generate request. (prompt change)
29417 * - batchId: a unique id for each batch of generate requests. (generate, regenerate)
29418 * - requestId: a unique id for each generate request.
29419 */
29420 var currentContext = useConfig().currentContext;
29421 var _useRequestIds = useRequestIds();
29422 var editorSessionId = _useRequestIds.editorSessionId;
29423 var sessionId = _useRequestIds.sessionId;
29424 var setRequest = _useRequestIds.setRequest;
29425 var setBatch = _useRequestIds.setBatch;
29426 var setGenerate = _useRequestIds.setGenerate;
29427 var generateIdRef = (0, react.useRef)("");
29428 var batchId = setBatch();
29429 var screenshotsData = [
29430 useScreenshot(0, onData),
29431 useScreenshot(1, onData),
29432 useScreenshot(2, onData)
29433 ];
29434 var screenshotsGroupCount = screenshotsData.length;
29435 var error = screenshotsData.every(function(s) {
29436 return s === null || s === void 0 ? void 0 : s.error;
29437 }) ? screenshotsData[0].error : "";
29438 var isLoading = screenshotsData.some(function(s) {
29439 return s === null || s === void 0 ? void 0 : s.isLoading;
29440 });
29441 var abortController = (0, react.useRef)(null);
29442 var abort = function abort() {
29443 var _abortController$curr;
29444 return (_abortController$curr = abortController.current) === null || _abortController$curr === void 0 ? void 0 : _abortController$curr.abort();
29445 };
29446 var createScreenshots = /*#__PURE__*/ function() {
29447 var _ref2 = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator$2.default.mark(function _callee(prompt, attachments) {
29448 var onGenerate;
29449 var onError;
29450 var promises;
29451 var results;
29452 var isAllFailed;
29453 return import_regenerator$2.default.wrap(function(_context) {
29454 while (1) switch (_context.prev = _context.next) {
29455 case 0:
29456 abortController.current = new AbortController();
29457 onGenerate = function onGenerate(screenshot) {
29458 setScreenshots(function(prev) {
29459 var updatedData = _toConsumableArray(prev);
29460 var pendingIndex = updatedData.indexOf(PENDING_VALUE);
29461 updatedData[pendingIndex] = screenshot;
29462 return updatedData;
29463 });
29464 return true;
29465 };
29466 onError = function onError() {
29467 setScreenshots(function(prev) {
29468 var updatedData = _toConsumableArray(prev);
29469 var pendingIndex = updatedData.lastIndexOf(PENDING_VALUE);
29470 updatedData[pendingIndex] = { isError: true };
29471 return updatedData;
29472 });
29473 return false;
29474 };
29475 promises = screenshotsData.map(function(_ref3) {
29476 var generate = _ref3.generate;
29477 return generate({
29478 prompt,
29479 prevGeneratedIds: screenshots.map(function(screenshot) {
29480 return screenshot.baseTemplateId || "";
29481 }),
29482 currentContext,
29483 ids: {
29484 editorSessionId: editorSessionId.current,
29485 sessionId: sessionId.current,
29486 generateId: generateIdRef.current,
29487 batchId: batchId.current,
29488 requestId: setRequest().current
29489 },
29490 attachments: attachments.map(function(_ref4) {
29491 return {
29492 type: _ref4.type,
29493 content: _ref4.content,
29494 label: _ref4.label,
29495 source: _ref4.source
29496 };
29497 })
29498 }, abortController.current.signal).then(onGenerate).catch(onError);
29499 });
29500 _context.next = 1;
29501 return Promise.all(promises);
29502 case 1:
29503 results = _context.sent;
29504 isAllFailed = results.every(function(value) {
29505 return false === value;
29506 });
29507 if (isAllFailed) setScreenshots(function(prev) {
29508 var updatedData = _toConsumableArray(prev);
29509 updatedData.splice(screenshotsGroupCount * -1);
29510 return updatedData;
29511 });
29512 case 2:
29513 case "end": return _context.stop();
29514 }
29515 }, _callee);
29516 }));
29517 return function createScreenshots(_x, _x2) {
29518 return _ref2.apply(this, arguments);
29519 };
29520 }();
29521 return {
29522 generate: function generate(prompt, attachments) {
29523 var placeholders = Array(screenshotsGroupCount).fill(PENDING_VALUE);
29524 generateIdRef.current = setGenerate().current;
29525 setScreenshots(placeholders);
29526 createScreenshots(prompt, attachments);
29527 },
29528 regenerate: function regenerate(prompt, attachments) {
29529 var placeholders = Array(screenshotsGroupCount).fill(PENDING_VALUE);
29530 setScreenshots(function(prev) {
29531 return [].concat(_toConsumableArray(prev), _toConsumableArray(placeholders));
29532 });
29533 createScreenshots(prompt, attachments);
29534 },
29535 screenshots,
29536 isLoading,
29537 error,
29538 abort
29539 };
29540 };
29541
29542 //#endregion
29543 //#region modules/ai/assets/js/editor/pages/form-layout/hooks/use-slider.js
29544 init_slicedToArray();
29545 var SCREENSHOTS_PER_PAGE = 3;
29546 var useSlider = function useSlider() {
29547 var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
29548 var _ref$slidesCount = _ref.slidesCount;
29549 var slidesCount = _ref$slidesCount === void 0 ? 0 : _ref$slidesCount;
29550 var _ref$slidesPerPage = _ref.slidesPerPage;
29551 var slidesPerPage = _ref$slidesPerPage === void 0 ? 3 : _ref$slidesPerPage;
29552 var _ref$gapPercentage = _ref.gapPercentage;
29553 var gapPercentage = _ref$gapPercentage === void 0 ? 2 : _ref$gapPercentage;
29554 var _useState2 = _slicedToArray((0, react.useState)(1), 2);
29555 var currentPage = _useState2[0];
29556 var setCurrentPage = _useState2[1];
29557 var slideWidthPercentage = (100 - gapPercentage * (slidesPerPage - 1)) / slidesPerPage;
29558 var offsetXPercentage = (slideWidthPercentage + gapPercentage) * slidesPerPage * (currentPage - 1) * -1;
29559 var pagesCount = Math.ceil(slidesCount / slidesPerPage);
29560 (0, react.useEffect)(function() {
29561 if (currentPage > 1 && currentPage > pagesCount) setCurrentPage(pagesCount);
29562 }, [pagesCount]);
29563 return {
29564 currentPage,
29565 setCurrentPage,
29566 pagesCount,
29567 slidesPerPage,
29568 gapPercentage,
29569 offsetXPercentage,
29570 slideWidthPercentage
29571 };
29572 };
29573
29574 //#endregion
29575 //#region modules/ai/assets/js/editor/icons/minimize-diagonal-icon.js
29576 init_extends();
29577 var MinimizeDiagonalIcon = react.default.forwardRef(function(props, ref) {
29578 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
29579 fillRule: "evenodd",
29580 clipRule: "evenodd",
29581 d: "M3.46967 3.46967C3.76256 3.17678 4.23744 3.17678 4.53033 3.46967L9.25 8.18934V6C9.25 5.58579 9.58579 5.25 10 5.25C10.4142 5.25 10.75 5.58579 10.75 6V10C10.75 10.4142 10.4142 10.75 10 10.75H6C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25H8.18934L3.46967 4.53033C3.17678 4.23744 3.17678 3.76256 3.46967 3.46967ZM14 13.25H18C18.4142 13.25 18.75 13.5858 18.75 14C18.75 14.4142 18.4142 14.75 18 14.75H15.8107L20.5303 19.4697C20.8232 19.7626 20.8232 20.2374 20.5303 20.5303C20.2374 20.8232 19.7626 20.8232 19.4697 20.5303L14.75 15.8107V18C14.75 18.4142 14.4142 18.75 14 18.75C13.5858 18.75 13.25 18.4142 13.25 18V14C13.25 13.5858 13.5858 13.25 14 13.25Z"
29582 }));
29583 });
29584
29585 //#endregion
29586 //#region modules/ai/assets/js/editor/icons/expand-diagonal-icon.js
29587 init_extends();
29588 var ExpandDiagonalIcon = react.default.forwardRef(function(props, ref) {
29589 return /*#__PURE__*/ react.default.createElement(_elementor_ui.SvgIcon, _extends$1({ viewBox: "0 0 24 24" }, props, { ref }), /*#__PURE__*/ react.default.createElement("path", {
29590 fillRule: "evenodd",
29591 clipRule: "evenodd",
29592 d: "M4 3.25H8C8.41421 3.25 8.75 3.58579 8.75 4C8.75 4.41421 8.41421 4.75 8 4.75H5.81066L10.5303 9.46967C10.8232 9.76256 10.8232 10.2374 10.5303 10.5303C10.2374 10.8232 9.76256 10.8232 9.46967 10.5303L4.75 5.81066V8C4.75 8.41421 4.41421 8.75 4 8.75C3.58579 8.75 3.25 8.41421 3.25 8V4C3.25 3.58579 3.58579 3.25 4 3.25ZM13.4697 13.4697C13.7626 13.1768 14.2374 13.1768 14.5303 13.4697L19.25 18.1893V16C19.25 15.5858 19.5858 15.25 20 15.25C20.4142 15.25 20.75 15.5858 20.75 16V20C20.75 20.4142 20.4142 20.75 20 20.75H16C15.5858 20.75 15.25 20.4142 15.25 20C15.25 19.5858 15.5858 19.25 16 19.25H18.1893L13.4697 14.5303C13.1768 14.2374 13.1768 13.7626 13.4697 13.4697Z"
29593 }));
29594 });
29595
29596 //#endregion
29597 //#region modules/ai/assets/js/editor/pages/form-layout/components/attachments/prompt-power-notice.js
29598 init_use_introduction();
29599 var PromptPowerNotice = function PromptPowerNotice() {
29600 var _useIntroduction = useIntroduction("e-ai-builder-attachments-power");
29601 var isViewed = _useIntroduction.isViewed;
29602 var markAsViewed = _useIntroduction.markAsViewed;
29603 if (isViewed) return null;
29604 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
29605 pt: 2,
29606 px: 2,
29607 pb: 0
29608 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Alert, {
29609 severity: "info",
29610 onClose: function onClose() {
29611 return markAsViewed();
29612 }
29613 }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
29614 variant: "body2",
29615 display: "inline-block",
29616 sx: { paddingInlineEnd: 1 }
29617 }, (0, _wordpress_i18n.__)("You’ve got the power.", "elementor")), /*#__PURE__*/ react.default.createElement(_elementor_ui.Typography, {
29618 variant: "body2",
29619 display: "inline-block"
29620 }, (0, _wordpress_i18n.__)("Craft your prompt to affect content, images and/or colors - whichever you decide.", "elementor"))));
29621 };
29622
29623 //#endregion
29624 //#region node_modules/validator/lib/util/assertString.js
29625 var require_assertString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29626 Object.defineProperty(exports, "__esModule", { value: true });
29627 exports.default = assertString;
29628 function assertString(input) {
29629 if (input === void 0 || input === null) throw new TypeError("Expected a string but received a ".concat(input));
29630 if (input.constructor.name !== "String") throw new TypeError("Expected a string but received a ".concat(input.constructor.name));
29631 }
29632 module.exports = exports.default;
29633 module.exports.default = exports.default;
29634 }));
29635
29636 //#endregion
29637 //#region node_modules/validator/lib/util/checkHost.js
29638 var require_checkHost = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29639 Object.defineProperty(exports, "__esModule", { value: true });
29640 exports.default = checkHost;
29641 function isRegExp(obj) {
29642 return Object.prototype.toString.call(obj) === "[object RegExp]";
29643 }
29644 function checkHost(host, matches) {
29645 for (var i = 0; i < matches.length; i++) {
29646 var match = matches[i];
29647 if (host === match || isRegExp(match) && match.test(host)) return true;
29648 }
29649 return false;
29650 }
29651 module.exports = exports.default;
29652 module.exports.default = exports.default;
29653 }));
29654
29655 //#endregion
29656 //#region node_modules/validator/lib/util/includesString.js
29657 var require_includesString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29658 Object.defineProperty(exports, "__esModule", { value: true });
29659 exports.default = void 0;
29660 var includes = function includes(str, val) {
29661 return str.indexOf(val) !== -1;
29662 };
29663 exports.default = includes;
29664 module.exports = exports.default;
29665 module.exports.default = exports.default;
29666 }));
29667
29668 //#endregion
29669 //#region node_modules/validator/lib/util/merge.js
29670 var require_merge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29671 Object.defineProperty(exports, "__esModule", { value: true });
29672 exports.default = merge;
29673 function merge() {
29674 var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
29675 var defaults = arguments.length > 1 ? arguments[1] : void 0;
29676 for (var key in defaults) if (typeof obj[key] === "undefined") obj[key] = defaults[key];
29677 return obj;
29678 }
29679 module.exports = exports.default;
29680 module.exports.default = exports.default;
29681 }));
29682
29683 //#endregion
29684 //#region node_modules/validator/lib/isFQDN.js
29685 var require_isFQDN = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29686 Object.defineProperty(exports, "__esModule", { value: true });
29687 exports.default = isFQDN;
29688 var _assertString = _interopRequireDefault(require_assertString());
29689 var _merge = _interopRequireDefault(require_merge());
29690 function _interopRequireDefault(e) {
29691 return e && e.__esModule ? e : { default: e };
29692 }
29693 var default_fqdn_options = {
29694 require_tld: true,
29695 allow_underscores: false,
29696 allow_trailing_dot: false,
29697 allow_numeric_tld: false,
29698 allow_wildcard: false,
29699 ignore_max_length: false
29700 };
29701 function isFQDN(str, options) {
29702 (0, _assertString.default)(str);
29703 options = (0, _merge.default)(options, default_fqdn_options);
29704 if (options.allow_trailing_dot && str[str.length - 1] === ".") str = str.substring(0, str.length - 1);
29705 if (options.allow_wildcard === true && str.indexOf("*.") === 0) str = str.substring(2);
29706 var parts = str.split(".");
29707 var tld = parts[parts.length - 1];
29708 if (options.require_tld) {
29709 if (parts.length < 2) return false;
29710 if (!options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) return false;
29711 if (/\s/.test(tld)) return false;
29712 }
29713 if (!options.allow_numeric_tld && /^\d+$/.test(tld)) return false;
29714 return parts.every(function(part) {
29715 if (part.length > 63 && !options.ignore_max_length) return false;
29716 if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) return false;
29717 if (/[\uff01-\uff5e]/.test(part)) return false;
29718 if (/^-|-$/.test(part)) return false;
29719 if (!options.allow_underscores && /_/.test(part)) return false;
29720 return true;
29721 });
29722 }
29723 module.exports = exports.default;
29724 module.exports.default = exports.default;
29725 }));
29726
29727 //#endregion
29728 //#region node_modules/validator/lib/isIP.js
29729 var require_isIP = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29730 Object.defineProperty(exports, "__esModule", { value: true });
29731 exports.default = isIP;
29732 var _assertString = _interopRequireDefault(require_assertString());
29733 function _interopRequireDefault(e) {
29734 return e && e.__esModule ? e : { default: e };
29735 }
29736 function _typeof(o) {
29737 "@babel/helpers - typeof";
29738 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
29739 return typeof o;
29740 } : function(o) {
29741 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
29742 }, _typeof(o);
29743 }
29744 /**
29745 11.3. Examples
29746
29747 The following addresses
29748
29749 fe80::1234 (on the 1st link of the node)
29750 ff02::5678 (on the 5th link of the node)
29751 ff08::9abc (on the 10th organization of the node)
29752
29753 would be represented as follows:
29754
29755 fe80::1234%1
29756 ff02::5678%5
29757 ff08::9abc%10
29758
29759 (Here we assume a natural translation from a zone index to the
29760 <zone_id> part, where the Nth zone of any scope is translated into
29761 "N".)
29762
29763 If we use interface names as <zone_id>, those addresses could also be
29764 represented as follows:
29765
29766 fe80::1234%ne0
29767 ff02::5678%pvc1.3
29768 ff08::9abc%interface10
29769
29770 where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs
29771 to the 5th link, and "interface10" belongs to the 10th organization.
29772 * * */
29773 var IPv4SegmentFormat = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";
29774 var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
29775 var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$"));
29776 var IPv6SegmentFormat = "(?:[0-9a-fA-F]{1,4})";
29777 var IPv6AddressRegExp = new RegExp("^(" + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ")(%[0-9a-zA-Z.]{1,})?$");
29778 function isIP(ipAddress) {
29779 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
29780 (0, _assertString.default)(ipAddress);
29781 var version = (_typeof(options) === "object" ? options.version : arguments[1]) || "";
29782 if (!version) return isIP(ipAddress, { version: 4 }) || isIP(ipAddress, { version: 6 });
29783 if (version.toString() === "4") return IPv4AddressRegExp.test(ipAddress);
29784 if (version.toString() === "6") return IPv6AddressRegExp.test(ipAddress);
29785 return false;
29786 }
29787 module.exports = exports.default;
29788 module.exports.default = exports.default;
29789 }));
29790
29791 //#endregion
29792 //#region node_modules/validator/lib/isURL.js
29793 var require_isURL = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29794 Object.defineProperty(exports, "__esModule", { value: true });
29795 exports.default = isURL;
29796 var _assertString = _interopRequireDefault(require_assertString());
29797 var _checkHost = _interopRequireDefault(require_checkHost());
29798 var _includesString = _interopRequireDefault(require_includesString());
29799 var _isFQDN = _interopRequireDefault(require_isFQDN());
29800 var _isIP = _interopRequireDefault(require_isIP());
29801 var _merge = _interopRequireDefault(require_merge());
29802 function _interopRequireDefault(e) {
29803 return e && e.__esModule ? e : { default: e };
29804 }
29805 function _slicedToArray(r, e) {
29806 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
29807 }
29808 function _nonIterableRest() {
29809 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29810 }
29811 function _unsupportedIterableToArray(r, a) {
29812 if (r) {
29813 if ("string" == typeof r) return _arrayLikeToArray(r, a);
29814 var t = {}.toString.call(r).slice(8, -1);
29815 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
29816 }
29817 }
29818 function _arrayLikeToArray(r, a) {
29819 (null == a || a > r.length) && (a = r.length);
29820 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
29821 return n;
29822 }
29823 function _iterableToArrayLimit(r, l) {
29824 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
29825 if (null != t) {
29826 var e;
29827 var n;
29828 var i;
29829 var u;
29830 var a = [];
29831 var f = !0;
29832 var o = !1;
29833 try {
29834 if (i = (t = t.call(r)).next, 0 === l) {
29835 if (Object(t) !== t) return;
29836 f = !1;
29837 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
29838 } catch (r) {
29839 o = !0, n = r;
29840 } finally {
29841 try {
29842 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
29843 } finally {
29844 if (o) throw n;
29845 }
29846 }
29847 return a;
29848 }
29849 }
29850 function _arrayWithHoles(r) {
29851 if (Array.isArray(r)) return r;
29852 }
29853 var default_url_options = {
29854 protocols: [
29855 "http",
29856 "https",
29857 "ftp"
29858 ],
29859 require_tld: true,
29860 require_protocol: false,
29861 require_host: true,
29862 require_port: false,
29863 require_valid_protocol: true,
29864 allow_underscores: false,
29865 allow_trailing_dot: false,
29866 allow_protocol_relative_urls: false,
29867 allow_fragments: true,
29868 allow_query_components: true,
29869 validate_length: true,
29870 max_allowed_length: 2084
29871 };
29872 var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
29873 function isURL(url, options) {
29874 (0, _assertString.default)(url);
29875 if (!url || /[\s<>]/.test(url)) return false;
29876 if (url.indexOf("mailto:") === 0) return false;
29877 options = (0, _merge.default)(options, default_url_options);
29878 if (options.validate_length && url.length > options.max_allowed_length) return false;
29879 if (!options.allow_fragments && (0, _includesString.default)(url, "#")) return false;
29880 if (!options.allow_query_components && ((0, _includesString.default)(url, "?") || (0, _includesString.default)(url, "&"))) return false;
29881 var protocol;
29882 var auth;
29883 var host;
29884 var hostname;
29885 var port;
29886 var port_str;
29887 var split = url.split("#");
29888 var ipv6;
29889 url = split.shift();
29890 split = url.split("?");
29891 url = split.shift();
29892 var protocol_match = url.match(/^([a-z][a-z0-9+\-.]*):/i);
29893 var had_explicit_protocol = false;
29894 var cleanUpProtocol = function cleanUpProtocol(potential_protocol) {
29895 had_explicit_protocol = true;
29896 protocol = potential_protocol.toLowerCase();
29897 if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) return false;
29898 return url.substring(protocol_match[0].length);
29899 };
29900 if (protocol_match) {
29901 var potential_protocol = protocol_match[1];
29902 var after_colon = url.substring(protocol_match[0].length);
29903 if (!(after_colon.slice(0, 2) === "//")) {
29904 var first_slash_position = after_colon.indexOf("/");
29905 var before_slash = first_slash_position === -1 ? after_colon : after_colon.substring(0, first_slash_position);
29906 var at_position = before_slash.indexOf("@");
29907 if (at_position !== -1) {
29908 var before_at = before_slash.substring(0, at_position);
29909 if (/^[a-zA-Z0-9\-_.%:]*$/.test(before_at)) {
29910 if (options.require_protocol) return false;
29911 } else {
29912 url = cleanUpProtocol(potential_protocol);
29913 if (url === false) return false;
29914 }
29915 } else if (/^[0-9]/.test(after_colon)) {
29916 if (options.require_protocol) return false;
29917 } else {
29918 url = cleanUpProtocol(potential_protocol);
29919 if (url === false) return false;
29920 }
29921 } else {
29922 url = cleanUpProtocol(potential_protocol);
29923 if (url === false) return false;
29924 }
29925 } else if (options.require_protocol) return false;
29926 if (url.slice(0, 2) === "//") {
29927 if (!had_explicit_protocol && !options.allow_protocol_relative_urls) return false;
29928 url = url.slice(2);
29929 }
29930 if (url === "") return false;
29931 split = url.split("/");
29932 url = split.shift();
29933 if (url === "" && !options.require_host) return true;
29934 split = url.split("@");
29935 if (split.length > 1) {
29936 if (options.disallow_auth) return false;
29937 if (split[0] === "") return false;
29938 auth = split.shift();
29939 if (auth.indexOf(":") >= 0 && auth.split(":").length > 2) return false;
29940 var _auth$split2 = _slicedToArray(auth.split(":"), 2);
29941 var user = _auth$split2[0];
29942 var password = _auth$split2[1];
29943 if (user === "" && password === "") return false;
29944 }
29945 hostname = split.join("@");
29946 port_str = null;
29947 ipv6 = null;
29948 var ipv6_match = hostname.match(wrapped_ipv6);
29949 if (ipv6_match) {
29950 host = "";
29951 ipv6 = ipv6_match[1];
29952 port_str = ipv6_match[2] || null;
29953 } else {
29954 split = hostname.split(":");
29955 host = split.shift();
29956 if (split.length) port_str = split.join(":");
29957 }
29958 if (port_str !== null && port_str.length > 0) {
29959 port = parseInt(port_str, 10);
29960 if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) return false;
29961 } else if (options.require_port) return false;
29962 if (options.host_whitelist) return (0, _checkHost.default)(host, options.host_whitelist);
29963 if (host === "" && !options.require_host) return true;
29964 if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) return false;
29965 host = host || ipv6;
29966 if (options.host_blacklist && (0, _checkHost.default)(host, options.host_blacklist)) return false;
29967 return true;
29968 }
29969 module.exports = exports.default;
29970 module.exports.default = exports.default;
29971 }));
29972
29973 //#endregion
29974 //#region modules/ai/assets/js/editor/pages/form-layout/index.js
29975 init_objectWithoutProperties$1();
29976 init_slicedToArray();
29977 init_extends();
29978 init_prompt_error_message();
29979 var import_isURL = /* @__PURE__ */ __toESM(require_isURL());
29980 init_voice_promotion_alert();
29981 var _excluded = ["children"];
29982 var DirectionalMinimizeDiagonalIcon = (0, _elementor_ui.withDirection)(MinimizeDiagonalIcon);
29983 var DirectionalExpandDiagonalIcon = (0, _elementor_ui.withDirection)(ExpandDiagonalIcon);
29984 /**
29985 * @typedef {Object} Attachment
29986 * @property {('json')} type - The type of the attachment, currently only `json` is supported.
29987 * @property {string} previewHTML - HTML content as a string, representing a preview.
29988 * @property {string} content - Actual content of the attachment as a string.
29989 * @property {string} label - Label for the attachment.
29990 */
29991 var RegenerateButton = function RegenerateButton(props) {
29992 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
29993 size: "small",
29994 color: "secondary",
29995 startIcon: /*#__PURE__*/ react.default.createElement(RefreshIcon, null)
29996 }, props), (0, _wordpress_i18n.__)("Regenerate", "elementor"));
29997 };
29998 var UseLayoutButton = function UseLayoutButton(props) {
29999 return /*#__PURE__*/ react.default.createElement(_elementor_ui.Button, _extends$1({
30000 size: "small",
30001 variant: "contained"
30002 }, props), (0, _wordpress_i18n.__)("Use Layout", "elementor"));
30003 };
30004 UseLayoutButton.propTypes = { sx: import_prop_types$8.default.object };
30005 var isRegenerateButtonDisabled = function isRegenerateButtonDisabled(screenshots, isLoading, isPromptFormActive) {
30006 if (isLoading || isPromptFormActive) return true;
30007 return screenshots.length >= 3 * 5;
30008 };
30009 var FormLayout = function FormLayout(_ref) {
30010 var _screenshots$selected;
30011 var _screenshots$2;
30012 var _ref$DialogHeaderProp = _ref.DialogHeaderProps;
30013 var DialogHeaderProps = _ref$DialogHeaderProp === void 0 ? {} : _ref$DialogHeaderProp;
30014 var _ref$DialogContentPro = _ref.DialogContentProps;
30015 var DialogContentProps = _ref$DialogContentPro === void 0 ? {} : _ref$DialogContentPro;
30016 var initialAttachments = _ref.attachments;
30017 var _useConfig = useConfig();
30018 var attachmentsTypes = _useConfig.attachmentsTypes;
30019 var onData = _useConfig.onData;
30020 var onInsert = _useConfig.onInsert;
30021 var onSelect = _useConfig.onSelect;
30022 var onClose = _useConfig.onClose;
30023 var onGenerate = _useConfig.onGenerate;
30024 var _useScreenshots = useScreenshots({ onData });
30025 var screenshots = _useScreenshots.screenshots;
30026 var generate = _useScreenshots.generate;
30027 var regenerate = _useScreenshots.regenerate;
30028 var isLoading = _useScreenshots.isLoading;
30029 var error = _useScreenshots.error;
30030 var abort = _useScreenshots.abort;
30031 var screenshotOutlineOffset = "2px";
30032 var _useSlider = useSlider({ slidesCount: screenshots.length });
30033 var currentPage = _useSlider.currentPage;
30034 var setCurrentPage = _useSlider.setCurrentPage;
30035 var pagesCount = _useSlider.pagesCount;
30036 var gapPercentage = _useSlider.gapPercentage;
30037 var slidesPerPage = _useSlider.slidesPerPage;
30038 var offsetXPercentage = _useSlider.offsetXPercentage;
30039 var slideWidthPercentage = _useSlider.slideWidthPercentage;
30040 var _useState2 = _slicedToArray((0, react.useState)(-1), 2);
30041 var selectedScreenshotIndex = _useState2[0];
30042 var setSelectedScreenshotIndex = _useState2[1];
30043 var _useState4 = _slicedToArray((0, react.useState)(false), 2);
30044 var showUnsavedChangesAlert = _useState4[0];
30045 var setShowUnsavedChangesAlert = _useState4[1];
30046 var _useState6 = _slicedToArray((0, react.useState)(true), 2);
30047 var isPromptEditable = _useState6[0];
30048 var setIsPromptEditable = _useState6[1];
30049 var _useState8 = _slicedToArray((0, react.useState)([]), 2);
30050 var attachments = _useState8[0];
30051 var setAttachments = _useState8[1];
30052 var _useState0 = _slicedToArray((0, react.useState)(false), 2);
30053 var shouldRenderWebApp = _useState0[0];
30054 var setShouldRenderWebApp = _useState0[1];
30055 var _useState10 = _slicedToArray((0, react.useState)(false), 2);
30056 var isMinimized = _useState10[0];
30057 var setIsMinimized = _useState10[1];
30058 var lastRun = (0, react.useRef)(function() {});
30059 var promptInputRef = (0, react.useRef)(null);
30060 var selectedTemplate = (_screenshots$selected = screenshots[selectedScreenshotIndex]) === null || _screenshots$selected === void 0 ? void 0 : _screenshots$selected.template;
30061 var dialogContentChildren = DialogContentProps.children;
30062 var dialogContentProps = _objectWithoutProperties$1(DialogContentProps, _excluded);
30063 var shouldFallbackToEditPrompt = !!(error && 0 === screenshots.length);
30064 var isPromptFormActive = isPromptEditable || shouldFallbackToEditPrompt;
30065 var abortAndClose = function abortAndClose() {
30066 abort();
30067 onClose();
30068 };
30069 var onCloseIntent = function onCloseIntent() {
30070 if (promptInputRef.current.value.trim() !== "" || screenshots.length > 0) return setShowUnsavedChangesAlert(true);
30071 abortAndClose();
30072 };
30073 var handleGenerate = function handleGenerate(event, prompt) {
30074 event.preventDefault();
30075 if ("" === prompt.trim() && 0 === attachments.length) return;
30076 if ((0, import_isURL.default)(prompt)) {
30077 setShouldRenderWebApp(true);
30078 return;
30079 }
30080 onGenerate();
30081 lastRun.current = function() {
30082 setSelectedScreenshotIndex(-1);
30083 generate(prompt, attachments);
30084 };
30085 lastRun.current();
30086 setIsPromptEditable(false);
30087 setCurrentPage(1);
30088 };
30089 var handleRegenerate = function handleRegenerate() {
30090 lastRun.current = function() {
30091 regenerate(promptInputRef.current.value, attachments);
30092 setCurrentPage(pagesCount + 1);
30093 };
30094 lastRun.current();
30095 };
30096 var applyTemplate = function applyTemplate() {
30097 onInsert(selectedTemplate);
30098 screenshots[selectedScreenshotIndex].sendUsageData();
30099 abortAndClose();
30100 };
30101 var handleScreenshotClick = function handleScreenshotClick(index, template) {
30102 return function() {
30103 if (isPromptFormActive) return;
30104 setSelectedScreenshotIndex(index);
30105 onSelect(template);
30106 };
30107 };
30108 /**
30109 * @param {Attachment[]} items
30110 */
30111 var onAttach = function onAttach(items) {
30112 items.forEach(function(item) {
30113 if (!attachmentsTypes[item.type]) throw new Error("Invalid attachment type: ".concat(item.type));
30114 var typeConfig = attachmentsTypes[item.type];
30115 if (!item.previewHTML && typeConfig.previewGenerator) typeConfig.previewGenerator(item.content).then(function(html) {
30116 item.previewHTML = html;
30117 setAttachments(function(prev) {
30118 return prev.map(function(attachment) {
30119 if (attachment.content === item.content) return item;
30120 return attachment;
30121 });
30122 });
30123 });
30124 });
30125 setAttachments(items);
30126 setShouldRenderWebApp(false);
30127 setIsPromptEditable(true);
30128 };
30129 (0, react.useEffect)(function() {
30130 var _screenshots$;
30131 if ((_screenshots$ = screenshots[0]) === null || _screenshots$ === void 0 ? void 0 : _screenshots$.template) {
30132 onSelect(screenshots[0].template);
30133 setSelectedScreenshotIndex(0);
30134 }
30135 }, [(_screenshots$2 = screenshots[0]) === null || _screenshots$2 === void 0 ? void 0 : _screenshots$2.template]);
30136 (0, react.useEffect)(function() {
30137 if (initialAttachments !== null && initialAttachments !== void 0 && initialAttachments.length) onAttach(initialAttachments);
30138 }, []);
30139 return /*#__PURE__*/ react.default.createElement(LayoutDialog, { onClose: onCloseIntent }, /*#__PURE__*/ react.default.createElement(LayoutDialog.Header, _extends$1({ onClose: onCloseIntent }, DialogHeaderProps), DialogHeaderProps.children, /*#__PURE__*/ react.default.createElement(_elementor_ui.Tooltip, { title: isMinimized ? (0, _wordpress_i18n.__)("Expand", "elementor") : (0, _wordpress_i18n.__)("Minimize", "elementor") }, /*#__PURE__*/ react.default.createElement(_elementor_ui.IconButton, {
30140 size: "small",
30141 "aria-label": "minimize",
30142 onClick: function onClick() {
30143 return setIsMinimized(function(prev) {
30144 return !prev;
30145 });
30146 }
30147 }, isMinimized ? /*#__PURE__*/ react.default.createElement(DirectionalExpandDiagonalIcon, null) : /*#__PURE__*/ react.default.createElement(DirectionalMinimizeDiagonalIcon, null)))), /*#__PURE__*/ react.default.createElement(LayoutDialog.Content, _extends$1({ dividers: true }, dialogContentProps), /*#__PURE__*/ react.default.createElement(_elementor_ui.Collapse, { in: !isMinimized }, dialogContentChildren && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
30148 pt: 2,
30149 px: 2,
30150 pb: 0
30151 } }, dialogContentChildren), attachments.length > 0 && /*#__PURE__*/ react.default.createElement(PromptPowerNotice, null), error && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
30152 pt: 2,
30153 px: 2,
30154 pb: 0
30155 } }, /*#__PURE__*/ react.default.createElement(PromptErrorMessage, {
30156 error,
30157 onRetry: lastRun.current
30158 })), showUnsavedChangesAlert && /*#__PURE__*/ react.default.createElement(UnsavedChangesAlert, {
30159 open: showUnsavedChangesAlert,
30160 title: (0, _wordpress_i18n.__)("Leave Elementor AI?", "elementor"),
30161 text: (0, _wordpress_i18n.__)("Your progress will be deleted, and can't be recovered.", "elementor"),
30162 onClose: abortAndClose,
30163 onCancel: function onCancel() {
30164 return setShowUnsavedChangesAlert(false);
30165 }
30166 }), shouldRenderWebApp && /*#__PURE__*/ react.default.createElement(AttachDialog, {
30167 type: "url",
30168 url: promptInputRef.current.value,
30169 onAttach,
30170 onClose: function onClose() {
30171 setShouldRenderWebApp(false);
30172 }
30173 }), /*#__PURE__*/ react.default.createElement(PromptForm, {
30174 shouldResetPrompt: shouldRenderWebApp,
30175 ref: promptInputRef,
30176 isActive: isPromptFormActive,
30177 isLoading,
30178 showActions: screenshots.length > 0 || isLoading,
30179 attachmentsTypes,
30180 attachments,
30181 onAttach,
30182 onDetach: function onDetach(index) {
30183 setAttachments(function(prev) {
30184 var newAttachments = _toConsumableArray(prev);
30185 newAttachments.splice(index, 1);
30186 return newAttachments;
30187 });
30188 setIsPromptEditable(true);
30189 },
30190 onSubmit: handleGenerate,
30191 onBack: function onBack() {
30192 return setIsPromptEditable(false);
30193 },
30194 onEdit: function onEdit() {
30195 return setIsPromptEditable(true);
30196 }
30197 }), (screenshots.length > 0 || isLoading) && /*#__PURE__*/ react.default.createElement(react.default.Fragment, null, /*#__PURE__*/ react.default.createElement(_elementor_ui.Divider, null), /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: { p: 1.5 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
30198 overflow: "hidden",
30199 p: .5
30200 } }, /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, { sx: {
30201 display: "flex",
30202 transition: "all 0.4s ease",
30203 gap: "".concat(gapPercentage, "%"),
30204 transform: "translateX(".concat(offsetXPercentage, "%)")
30205 } }, screenshots.map(function(_ref2, index) {
30206 var screenshot = _ref2.screenshot;
30207 var type = _ref2.type;
30208 var template = _ref2.template;
30209 var isError = _ref2.isError;
30210 var isPending = _ref2.isPending;
30211 return /*#__PURE__*/ react.default.createElement(Screenshot, {
30212 key: index,
30213 url: screenshot,
30214 type,
30215 disabled: isPromptFormActive,
30216 isPlaceholder: isError,
30217 isLoading: isPending,
30218 isSelected: selectedScreenshotIndex === index,
30219 onClick: handleScreenshotClick(index, template),
30220 outlineOffset: screenshotOutlineOffset,
30221 sx: { flex: "0 0 ".concat(slideWidthPercentage, "%") }
30222 });
30223 }))), /*#__PURE__*/ react.default.createElement(VoicePromotionAlert, { introductionKey: "ai-context-layout-promotion" })), screenshots.length > 0 && /*#__PURE__*/ react.default.createElement(_elementor_ui.Box, {
30224 sx: {
30225 pt: 0,
30226 px: 2,
30227 pb: 2
30228 },
30229 display: "grid",
30230 gridTemplateColumns: "repeat(3, 1fr)",
30231 justifyItems: "center"
30232 }, /*#__PURE__*/ react.default.createElement(RegenerateButton, {
30233 onClick: handleRegenerate,
30234 disabled: isRegenerateButtonDisabled(screenshots, isLoading, isPromptFormActive),
30235 sx: { justifySelf: "start" }
30236 }), screenshots.length > slidesPerPage && /*#__PURE__*/ react.default.createElement(_elementor_ui.Pagination, {
30237 page: currentPage,
30238 count: pagesCount,
30239 disabled: isPromptFormActive,
30240 onChange: function onChange(_, page) {
30241 return setCurrentPage(page);
30242 }
30243 }), /*#__PURE__*/ react.default.createElement(UseLayoutButton, {
30244 onClick: applyTemplate,
30245 disabled: isPromptFormActive || -1 === selectedScreenshotIndex,
30246 sx: {
30247 justifySelf: "end",
30248 gridColumn: 3
30249 }
30250 }))))));
30251 };
30252 FormLayout.propTypes = {
30253 DialogHeaderProps: import_prop_types$8.default.object,
30254 DialogContentProps: import_prop_types$8.default.object,
30255 attachments: import_prop_types$8.default.arrayOf(AttachmentPropType)
30256 };
30257
30258 //#endregion
30259 //#region modules/ai/assets/js/editor/layout-content.js
30260 init_slicedToArray();
30261 init_loader();
30262 init_requests_ids();
30263 var LayoutContent = function LayoutContent(props) {
30264 var _useUserInfo = useUserInfo();
30265 var isLoading = _useUserInfo.isLoading;
30266 var isConnected = _useUserInfo.isConnected;
30267 var isGetStarted = _useUserInfo.isGetStarted;
30268 var connectUrl = _useUserInfo.connectUrl;
30269 var fetchData = _useUserInfo.fetchData;
30270 var hasSubscription = _useUserInfo.hasSubscription;
30271 var initialUsagePercentage = _useUserInfo.usagePercentage;
30272 var _useConfig = useConfig();
30273 var onClose = _useConfig.onClose;
30274 var onConnect = _useConfig.onConnect;
30275 var _useRequestIds = useRequestIds();
30276 var updateUsagePercentage = _useRequestIds.updateUsagePercentage;
30277 var usagePercentage = _useRequestIds.usagePercentage;
30278 var _useState2 = _slicedToArray((0, react.useState)(false), 2);
30279 var isInitUsageDone = _useState2[0];
30280 var setIsInitUsageDone = _useState2[1];
30281 (0, react.useEffect)(function() {
30282 if (!isInitUsageDone && !isLoading && (initialUsagePercentage || 0 === initialUsagePercentage)) {
30283 updateUsagePercentage(initialUsagePercentage);
30284 setIsInitUsageDone(true);
30285 }
30286 }, [
30287 isLoading,
30288 initialUsagePercentage,
30289 isInitUsageDone,
30290 updateUsagePercentage
30291 ]);
30292 if (isLoading || !isInitUsageDone) return /*#__PURE__*/ react.default.createElement(LayoutDialog, { onClose }, /*#__PURE__*/ react.default.createElement(LayoutDialog.Header, { onClose }), /*#__PURE__*/ react.default.createElement(LayoutDialog.Content, { dividers: true }, /*#__PURE__*/ react.default.createElement(Loader, { BoxProps: { sx: { px: 3 } } })));
30293 if (!isConnected) return /*#__PURE__*/ react.default.createElement(WizardDialog, { onClose }, /*#__PURE__*/ react.default.createElement(LayoutDialog, { onClose }), /*#__PURE__*/ react.default.createElement(WizardDialog.Content, { dividers: true }, /*#__PURE__*/ react.default.createElement(Connect, {
30294 connectUrl,
30295 onSuccess: function onSuccess(data) {
30296 onConnect(data);
30297 fetchData();
30298 }
30299 })));
30300 if (!isGetStarted) return /*#__PURE__*/ react.default.createElement(WizardDialog, { onClose }, /*#__PURE__*/ react.default.createElement(LayoutDialog, { onClose }), /*#__PURE__*/ react.default.createElement(WizardDialog.Content, { dividers: true }, /*#__PURE__*/ react.default.createElement(GetStarted, { onSuccess: fetchData })));
30301 var showUpgradeChip = !hasSubscription || 80 <= usagePercentage;
30302 return /*#__PURE__*/ react.default.createElement(FormLayout, {
30303 attachments: props.attachments,
30304 DialogHeaderProps: { children: showUpgradeChip && /*#__PURE__*/ react.default.createElement(UpgradeChip, {
30305 hasSubscription,
30306 usagePercentage
30307 }) }
30308 });
30309 };
30310 LayoutContent.propTypes = { attachments: import_prop_types$8.default.arrayOf(AttachmentPropType) };
30311
30312 //#endregion
30313 //#region modules/ai/assets/js/editor/layout-app.js
30314 init_requests_ids();
30315 var LayoutApp = function LayoutApp(props) {
30316 return /*#__PURE__*/ react.default.createElement(RemoteConfigProvider, { onError: props.onClose }, /*#__PURE__*/ react.default.createElement(RequestIdsProvider, null, /*#__PURE__*/ react.default.createElement(ConfigProvider, {
30317 mode: props.mode,
30318 attachmentsTypes: props.attachmentsTypes,
30319 onClose: props.onClose,
30320 onConnect: props.onConnect,
30321 onData: props.onData,
30322 onInsert: props.onInsert,
30323 onSelect: props.onSelect,
30324 onGenerate: props.onGenerate,
30325 currentContext: props.currentContext,
30326 hasPro: props.hasPro
30327 }, /*#__PURE__*/ react.default.createElement(LayoutContent, { attachments: props.attachments }))));
30328 };
30329 LayoutApp.propTypes = {
30330 mode: import_prop_types$8.default.oneOf(LAYOUT_APP_MODES).isRequired,
30331 attachmentsTypes: AttachmentsTypesPropType,
30332 attachments: import_prop_types$8.default.arrayOf(AttachmentPropType),
30333 onClose: import_prop_types$8.default.func.isRequired,
30334 onConnect: import_prop_types$8.default.func.isRequired,
30335 onData: import_prop_types$8.default.func.isRequired,
30336 onInsert: import_prop_types$8.default.func.isRequired,
30337 onSelect: import_prop_types$8.default.func.isRequired,
30338 onGenerate: import_prop_types$8.default.func.isRequired,
30339 currentContext: import_prop_types$8.default.object,
30340 hasPro: import_prop_types$8.default.bool
30341 };
30342
30343 //#endregion
30344 //#region modules/ai/assets/js/editor/utils/screenshot.js
30345 init_requests_ids();
30346
30347 //#endregion
30348 //#region modules/ai/assets/js/editor/layout-app-wrapper.js
30349 var LayoutAppWrapper = function LayoutAppWrapper(props) {
30350 return /*#__PURE__*/ react.default.createElement(_elementor_ui.DirectionProvider, { rtl: props.isRTL }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ThemeProvider, { colorScheme: props.colorScheme }, props.children));
30351 };
30352 LayoutAppWrapper.propTypes = {
30353 children: import_prop_types$8.default.node,
30354 isRTL: import_prop_types$8.default.bool,
30355 colorScheme: import_prop_types$8.default.oneOf([
30356 "auto",
30357 "light",
30358 "dark"
30359 ])
30360 };
30361
30362 //#endregion
30363 //#region modules/ai/assets/js/editor/utils/editor-integration.js
30364 init_requests_ids();
30365 var onConnect = function onConnect(data) {
30366 elementorCommon.config.library_connect.is_connected = true;
30367 elementorCommon.config.library_connect.current_access_level = data.kits_access_level || data.access_level || 0;
30368 elementorCommon.config.library_connect.current_access_tier = data.access_tier;
30369 elementorCommon.config.library_connect.plan_type = data.plan_type;
30370 };
30371 var VARIATIONS_PROMPTS = [
30372 { text: (0, _wordpress_i18n.__)("Minimalist design with bold typography about", "elementor") },
30373 { text: (0, _wordpress_i18n.__)("Elegant style with serif fonts discussing", "elementor") },
30374 { text: (0, _wordpress_i18n.__)("Retro vibe with muted colors and classic fonts about", "elementor") },
30375 { text: (0, _wordpress_i18n.__)("Futuristic design with neon accents about", "elementor") },
30376 { text: (0, _wordpress_i18n.__)("Professional look with clean lines for", "elementor") },
30377 { text: (0, _wordpress_i18n.__)("Earthy tones and organic shapes featuring", "elementor") },
30378 { text: (0, _wordpress_i18n.__)("Luxurious theme with rich colors discussing", "elementor") },
30379 { text: (0, _wordpress_i18n.__)("Tech-inspired style with modern fonts about", "elementor") },
30380 { text: (0, _wordpress_i18n.__)("Warm hues with comforting visuals about", "elementor") }
30381 ];
30382 var WEB_BASED_PROMPTS = [
30383 { text: (0, _wordpress_i18n.__)("Change the content to be about [topic]", "elementor") },
30384 { text: (0, _wordpress_i18n.__)("Generate lorem ipsum placeholder text for all paragraphs", "elementor") },
30385 { text: (0, _wordpress_i18n.__)("Revise the content to focus on [topic] and then translate it into Spanish", "elementor") },
30386 { text: (0, _wordpress_i18n.__)("Shift the focus of the content to [topic] in order to showcase our company's mission and values", "elementor") },
30387 { text: (0, _wordpress_i18n.__)("Alter the content to provide helpful tips related to [topic]", "elementor") },
30388 { text: (0, _wordpress_i18n.__)("Adjust the content to include FAQs and answers for common inquiries about [topic]", "elementor") }
30389 ];
30390 var PROMPT_PLACEHOLDER = (0, _wordpress_i18n.__)("Press '/' for suggestions or describe the changes you want to apply (optional)...", "elementor");
30391
30392 //#endregion
30393 //#region modules/ai/assets/js/editor/app.js
30394 init_requests_ids();
30395 var App = function App(props) {
30396 return /*#__PURE__*/ react.default.createElement(_elementor_ui.DirectionProvider, { rtl: props.isRTL }, /*#__PURE__*/ react.default.createElement(_elementor_ui.ThemeProvider, { colorScheme: props.colorScheme }, /*#__PURE__*/ react.default.createElement(RequestIdsProvider, null, /*#__PURE__*/ react.default.createElement(PageContent, {
30397 type: props.type,
30398 controlType: props.controlType,
30399 onClose: props.onClose,
30400 onConnect,
30401 getControlValue: props.getControlValue,
30402 setControlValue: props.setControlValue,
30403 additionalOptions: props.additionalOptions
30404 }))));
30405 };
30406 App.propTypes = {
30407 colorScheme: import_prop_types$8.default.oneOf([
30408 "auto",
30409 "light",
30410 "dark"
30411 ]),
30412 type: import_prop_types$8.default.string,
30413 controlType: import_prop_types$8.default.string,
30414 onClose: import_prop_types$8.default.func,
30415 getControlValue: import_prop_types$8.default.func,
30416 setControlValue: import_prop_types$8.default.func,
30417 additionalOptions: import_prop_types$8.default.object,
30418 isRTL: import_prop_types$8.default.bool
30419 };
30420
30421 //#endregion
30422 //#region modules/ai/assets/js/admin/index.js
30423 window.__UNSTABLE__elementorAI = { App };
30424
30425 //#endregion
30426 })(React, elementorV2.ui, wp.i18n, elementorV2.icons, elementorV2.ui['TextField']);
30427 //# sourceMappingURL=ai-admin.js.map